fix: refs #7844 salesFilter and tmp.ticket_problems.totalProblems
This commit is contained in:
parent
bd06bed570
commit
3cc19549e4
|
@ -9,7 +9,7 @@ BEGIN
|
|||
* @param vBuyFk Buy id
|
||||
*/
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vWareHouseFk INT;
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vMaxDated DATE;
|
||||
DECLARE vMinDated DATE;
|
||||
DECLARE vLanding DATE;
|
||||
|
@ -18,12 +18,13 @@ BEGIN
|
|||
DECLARE vGrouping INT;
|
||||
|
||||
SELECT b.itemFk, t.warehouseInFk
|
||||
INTO vItemFk, vWareHouseFk
|
||||
INTO vItemFk, vWarehouseFk
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE b.id = vBuyFk;
|
||||
|
||||
IF vItemFk AND vWarehouseFk THEN
|
||||
SELECT DATE(MAX(t.shipped)) + INTERVAL 1 DAY, DATE(MIN(t.shipped))
|
||||
INTO vMaxDated, vMinDated
|
||||
FROM sale s
|
||||
|
@ -32,7 +33,7 @@ BEGIN
|
|||
AND s.itemFk = vItemFk
|
||||
AND s.quantity > 0;
|
||||
|
||||
CALL buy_getUltimate(vItemFk, vWareHouseFk, vMinDated);
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, vMinDated);
|
||||
|
||||
SELECT bu.buyFk, b.grouping INTO vLastBuy, vGrouping
|
||||
FROM tmp.buyUltimate bu
|
||||
|
@ -45,7 +46,7 @@ BEGIN
|
|||
WHILE vCurrentBuy <> vLastBuy OR vLanding > vMinDated DO
|
||||
SET vMaxDated = vLanding - INTERVAL 1 DAY;
|
||||
|
||||
CALL buy_getUltimate(vItemFk, vWareHouseFk, vMaxDated);
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, vMaxDated);
|
||||
|
||||
SELECT buyFk, landing
|
||||
INTO vCurrentBuy, vLanding
|
||||
|
@ -69,5 +70,6 @@ BEGIN
|
|||
CALL sale_setProblem('hasRounding');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -264,7 +264,7 @@ module.exports = Self => {
|
|||
|
||||
stmt = new ParameterizedSQL(`
|
||||
UPDATE tmp.ticket_problems
|
||||
SET risk = IF(hasRisk AND risk > 0, risk, 0)
|
||||
SET risk = IF(hasRisk, risk, 0)
|
||||
`);
|
||||
stmts.push(stmt);
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ module.exports = Self => {
|
|||
|
||||
stmt = new ParameterizedSQL(`
|
||||
UPDATE tmp.ticket_problems
|
||||
SET risk = IF(hasRisk AND risk > 0, risk, 0)
|
||||
SET risk = IF(hasRisk, risk, 0)
|
||||
`);
|
||||
stmts.push(stmt);
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ module.exports = Self => {
|
|||
|
||||
stmt = new ParameterizedSQL(`
|
||||
UPDATE tmp.ticket_problems
|
||||
SET risk = IF(hasRisk AND risk > 0, risk, 0)
|
||||
SET risk = IF(hasRisk, risk, 0)
|
||||
`);
|
||||
stmts.push(stmt);
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
},
|
||||
"cmrFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"problem": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<vn-icon
|
||||
vn-tooltip="Client has debt"
|
||||
icon="icon-risk"
|
||||
ng-if="$ctrl.ticket.client.debt > $ctrl.ticket.client.credit">
|
||||
ng-if="$ctrl.ticket.problem.includes('hasRisk')">
|
||||
</vn-icon>
|
||||
<vn-icon
|
||||
vn-tooltip="Client not checked"
|
||||
|
|
Loading…
Reference in New Issue