This commit is contained in:
parent
961aba285e
commit
1d0b89ed52
|
@ -1885,9 +1885,9 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
|
||||||
(1, 31, 4, 21, 2),
|
(1, 31, 4, 21, 2),
|
||||||
(2, 32, 3, 21, 3);
|
(2, 32, 3, 21, 3);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
|
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`, `monthsToRefund`, `minShipped`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 50);
|
(1, 5, 4, '2016-10-01');
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -5,7 +5,8 @@ BEGIN
|
||||||
* Añade a la tabla greuges todos los cargos necesario y
|
* Añade a la tabla greuges todos los cargos necesario y
|
||||||
* que luego lo utilizamos para calcular el recobro.
|
* que luego lo utilizamos para calcular el recobro.
|
||||||
*/
|
*/
|
||||||
DECLARE vMonthToRefund INT DEFAULT 4;
|
DECLARE vMonthToRefund INT
|
||||||
|
DEFAULT (SELECT monthsToRefund FROM claimConfig);
|
||||||
DECLARE vRecoveryGreugeType INT
|
DECLARE vRecoveryGreugeType INT
|
||||||
DEFAULT (SELECT id FROM greugeType WHERE code = 'recovery');
|
DEFAULT (SELECT id FROM greugeType WHERE code = 'recovery');
|
||||||
DECLARE vManaGreugeType INT
|
DECLARE vManaGreugeType INT
|
||||||
|
@ -15,7 +16,8 @@ BEGIN
|
||||||
DECLARE vDebtComponentType INT
|
DECLARE vDebtComponentType INT
|
||||||
DEFAULT (SELECT id FROM component WHERE code = 'debtCollection');
|
DEFAULT (SELECT id FROM component WHERE code = 'debtCollection');
|
||||||
|
|
||||||
IF vRecoveryGreugeType IS NULL
|
IF vMonthToRefund IS NULL
|
||||||
|
OR vRecoveryGreugeType IS NULL
|
||||||
OR vManaGreugeType IS NULL
|
OR vManaGreugeType IS NULL
|
||||||
OR vClaimGreugeType IS NULL
|
OR vClaimGreugeType IS NULL
|
||||||
OR vDebtComponentType IS NULL THEN
|
OR vDebtComponentType IS NULL THEN
|
||||||
|
@ -87,6 +89,7 @@ BEGIN
|
||||||
-- Recobros
|
-- Recobros
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tTicketList
|
CREATE OR REPLACE TEMPORARY TABLE tTicketList
|
||||||
(PRIMARY KEY (ticketFk))
|
(PRIMARY KEY (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
SELECT DISTINCT s.ticketFk
|
SELECT DISTINCT s.ticketFk
|
||||||
FROM saleComponent sc
|
FROM saleComponent sc
|
||||||
JOIN sale s ON sc.saleFk = s.id
|
JOIN sale s ON sc.saleFk = s.id
|
||||||
|
@ -97,7 +100,7 @@ BEGIN
|
||||||
JOIN alertLevel al ON al.id = st.alertLevel
|
JOIN alertLevel al ON al.id = st.alertLevel
|
||||||
WHERE sc.componentFk = vDebtComponentType
|
WHERE sc.componentFk = vDebtComponentType
|
||||||
AND NOT sc.isGreuge
|
AND NOT sc.isGreuge
|
||||||
AND t.shipped >= '2016-10-01'
|
AND t.shipped >= (SELECT minShipped FROM claimConfig)
|
||||||
AND t.shipped < util.VN_CURDATE()
|
AND t.shipped < util.VN_CURDATE()
|
||||||
AND al.code = 'DELIVERED';
|
AND al.code = 'DELIVERED';
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,11 @@ UPDATE IGNORE bs.nightTask
|
||||||
SET `schema` = 'vn',
|
SET `schema` = 'vn',
|
||||||
`procedure` = 'claimRatio_add'
|
`procedure` = 'claimRatio_add'
|
||||||
WHERE `procedure` = 'claim_ratio_routine';
|
WHERE `procedure` = 'claim_ratio_routine';
|
||||||
|
|
||||||
|
ALTER TABLE vn.claimConfig
|
||||||
|
ADD monthsToRefund int(11) DEFAULT NULL NULL,
|
||||||
|
ADD minShipped date DEFAULT NULL NULL;
|
||||||
|
|
||||||
|
UPDATE IGNORE vn.claimConfig
|
||||||
|
SET monthsToRefund = 4,
|
||||||
|
minShipped = '2016-10-01';
|
||||||
|
|
Loading…
Reference in New Issue