fix: refs #7213 problem rounding #2903

Merged
carlosap merged 4 commits from 7213-Sale_setProblemRoundingByBuy into master 2024-09-02 15:48:27 +00:00
1 changed files with 11 additions and 10 deletions
Showing only changes of commit 4ed5811042 - Show all commits

View File

@ -4,8 +4,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRoun
)
BEGIN
/**
* Update rounding problem for all sales related to a buy
* @param vBuyFk Id buy
* Update rounding problem for all sales related to a buy.
carlosap marked this conversation as resolved Outdated
/**
 * Update rounding problem for all sales related to a buy.
 *
 * @param vBuyFk Buy id
 */
``` /** * Update rounding problem for all sales related to a buy. * * @param vBuyFk Buy id */ ```
*
* @param vBuyFk Buy id
*/
DECLARE vItemFk INT;
DECLARE vWareHouseFk INT;
@ -18,16 +19,16 @@ BEGIN
SELECT b.itemFk, t.warehouseInFk
INTO vItemFk, vWareHouseFk
carlosap marked this conversation as resolved
Review

No utilizar vn.

No utilizar `vn.`
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel t ON t.id = e.travelFk
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
WHERE b.id = vBuyFk;
SELECT DATE(MAX(t.shipped)) + INTERVAL 1 DAY, DATE(MIN(t.shipped))
INTO vMaxDated, vMinDated
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
carlosap marked this conversation as resolved
Review

util.VN_CURDATE()

util.VN_CURDATE()
WHERE t.shipped >= CURDATE()
WHERE t.shipped >= util.VN_CURDATE()
AND s.itemFk = vItemFk
AND s.quantity > 0;
@ -55,15 +56,15 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
carlosap marked this conversation as resolved
Review

ENGINE = MEMORY

ENGINE = MEMORY
(INDEX(saleFk, isProblemCalcNeeded))
carlosap marked this conversation as resolved Outdated

espacio entre el alias y la ,

espacio entre el alias y la ,
SELECT s.id saleFk ,
ENGINE = MEMORY
SELECT s.id saleFk,
MOD(s.quantity, vGrouping) hasProblem,
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE s.itemFk = vItemFk
carlosap marked this conversation as resolved
Review

Per que no fiques aço en una linea? No he vist ningún lloc aon no se fique el BETWEEN seguit

Per que no fiques aço en una linea? No he vist ningún lloc aon no se fique el BETWEEN seguit
AND s.quantity > 0
AND t.shipped BETWEEN vMinDated
AND util.dayEnd(vMaxDated);
AND t.shipped BETWEEN vMinDated AND util.dayEnd(vMaxDated);
CALL sale_setProblem('hasRounding');