fix: refs #7126 Fix
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-07-09 11:56:32 +02:00
parent c3051ebcfb
commit f4e5f0205d
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`() CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
BEGIN BEGIN
CALL cache.last_buy_refresh (FALSE);
REPLACE bs.waste REPLACE bs.waste
SELECT YEAR(t.shipped), SELECT YEAR(t.shipped),
WEEK(t.shipped, 4), WEEK(t.shipped, 4),
@ -11,14 +13,14 @@ BEGIN
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity) value, SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity) value,
SUM ( SUM (
IF( IF(
aw.type = 'internal', aw.`type` = 'internal',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0 0
) )
) internalWaste, ) internalWaste,
SUM ( SUM (
IF( IF(
aw.type = 'external', aw.`type` = 'external',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
IF(c.code = 'manaClaim', IF(c.code = 'manaClaim',
sc.value * s.quantity, sc.value * s.quantity,
@ -30,7 +32,7 @@ BEGIN
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.ticket t ON t.id = s.ticketFk
STRAIGHT_JOIN vn.address a ON a.id = t.addressFk JOIN vn.address a FORCE INDEX (PRIMARY) ON a.id = t.addressFk
LEFT JOIN vn.addressWaste aw ON aw.addressFk = a.id LEFT JOIN vn.addressWaste aw ON aw.addressFk = a.id
JOIN vn.warehouse w ON w.id = t.warehouseFk JOIN vn.warehouse w ON w.id = t.warehouseFk
JOIN cache.last_buy lb ON lb.item_id = i.id JOIN cache.last_buy lb ON lb.item_id = i.id