Merge branch 'dev' into 7934-DeleteVn.MIDNIGHT
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Ivan Mas 2024-09-18 10:01:17 +00:00
commit 51981eda06
8 changed files with 49 additions and 15 deletions

View File

@ -29,7 +29,7 @@ describe('Postcode filter()', () => {
}
}, options);
expect(results.length).toEqual(4);
expect(results.length).toEqual(5);
await tx.rollback();
} catch (e) {
await tx.rollback();
@ -63,7 +63,7 @@ describe('Postcode filter()', () => {
search: 'one',
}}, options);
expect(results.length).toEqual(4);
expect(results.length).toEqual(5);
await tx.rollback();
} catch (e) {
await tx.rollback();

View File

@ -361,11 +361,12 @@ INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
VALUES
('46000', 1, 6),
('46460', 2, 6),
('46680', 3, 6),
('46600', 4, 7),
('EC170150', 5, 8);
('46000', 1, 6),
('46460', 2, 6),
('46680', 3, 6),
('46600', 4, 7),
('46600',1, 6),
('EC170150', 5, 8);
INSERT INTO `vn`.`clientType`(`code`, `type`)
VALUES
@ -3936,7 +3937,7 @@ INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
VALUES(35, 1.00, 1.00, '2001-01-01');
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)

View File

@ -1,8 +1,22 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`(
vDateFrom DATE,
vDateTo DATE
)
BEGIN
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
/**
* Recalcula las mermas de un periodo.
*
* @param vDateFrom Fecha desde
* @param vDateTo Fecha hasta
*/
IF vDateFrom IS NULL THEN
SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
END IF;
IF vDateTo IS NULL THEN
SET vDateTo = vDateFrom + INTERVAL 6 DAY;
END IF;
CALL cache.last_buy_refresh(FALSE);
@ -56,6 +70,6 @@ BEGIN
JOIN vn.buy b ON b.id = lb.buy_id
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
AND w.isManaged
GROUP BY i.id;
GROUP BY YEAR(t.shipped), WEEK(t.shipped, 4), i.id;
END$$
DELIMITER ;

View File

@ -0,0 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSalesLauncher`()
BEGIN
CALL waste_addSales(NULL, NULL);
END$$
DELIMITER ;

View File

@ -71,7 +71,10 @@ BEGIN
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
END IF;
IF NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
IF NOT (NEW.travelFk <=> OLD.travelFk)
OR NOT (NEW.currencyFk <=> OLD.currencyFk)
OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk, NEW.supplierFk);
END IF;
END$$

View File

@ -0,0 +1,3 @@
UPDATE bs.nightTask
SET `procedure` = 'waste_addSalesLauncher'
WHERE `procedure` = 'waste_addSales';

View File

@ -0,0 +1 @@
GRANT EXECUTE ON PROCEDURE bs.waste_addSales TO buyerBoss;

View File

@ -43,8 +43,14 @@ module.exports = Self => {
include: [{
relation: 'province',
scope: {
fields: ['id', 'name']
}
fields: ['id', 'name', 'countryFk'],
include: [
{
relation: 'country',
scope: {fields: ['id', 'name']},
},
],
},
}, {
relation: 'agencyMode',
scope: {