7596-devToTest_2426 #2600
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`midnight`()
|
||||
RETURNS datetime
|
||||
NOT DETERMINISTIC
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
DECLARE vIsTooLittle TINYINT(1);
|
||||
|
||||
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
||||
OR IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
||||
AND IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
||||
FROM ticket t
|
||||
LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
|
||||
JOIN volumeConfig vc
|
||||
|
|
|
@ -49,7 +49,10 @@ BEGIN
|
|||
BEGIN
|
||||
IF vLockName IS NOT NULL THEN
|
||||
DO RELEASE_LOCK(vLockName);
|
||||
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
|
||||
CALL util.debugAdd(JSON_OBJECT(
|
||||
'type', 'releaseLock',
|
||||
'userFk', vUserFk
|
||||
), vLockName); -- Tmp
|
||||
END IF;
|
||||
|
||||
RESIGNAL;
|
||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
|||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
|
||||
GROUP BY s.id) sub;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
|
||||
|
||||
UPDATE tmp.ticket t
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (vSelf IS NULL OR t.id = vSelf);
|
||||
|
||||
UPDATE tmp.ticket t
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
|
||||
FROM ticket t
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (c.id = vClientFk OR vClientFk IS NULL);
|
||||
|
||||
CALL ticket_setProblem('isTaxDataChecked');
|
||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
|||
SELECT t.id ticketFk
|
||||
FROM vn.ticket t
|
||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
GROUP BY t.id
|
||||
)SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem
|
||||
|
|
|
@ -20,7 +20,7 @@ FROM (
|
|||
`vn`.`saleGroup` `sg`
|
||||
JOIN `vn`.`saleGroupDetail` `sgd` ON(`sgd`.`saleGroupFk` = `sg`.`id`)
|
||||
)
|
||||
JOIN `vn`.`sale` `s` ON(`s`.`id` = `sgd`.`saleFk`)
|
||||
JOIN `vn`.`sale` `s` FORCE INDEX (PRIMARY) ON(`s`.`id` = `sgd`.`saleFk`)
|
||||
)
|
||||
JOIN `vn`.`ticketState` `tls` ON(`tls`.`ticketFk` = `s`.`ticketFk`)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue