feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-10-22 08:41:46 +02:00
parent 7e604f1a19
commit 5162c2037b
2 changed files with 5 additions and 1 deletions

View File

@ -65,12 +65,15 @@ proc: BEGIN
SET vDateSumFrom = vDateSumTo - INTERVAL vScopeDays DAY;
REPLACE itemCampaignQuantity(dated, itemFk, quantity, campaign)
REPLACE itemCampaignQuantity(dated, itemFk, quantity, total, campaign)
SELECT DATE(s.created),
s.itemFk,
SUM(CASE WHEN t.shipped BETWEEN vDateSumFrom AND vDateSumTo
THEN s.quantity
END) quantity,
SUM(CASE WHEN t.shipped BETWEEN vDateSumFrom AND vDateSumTo
THEN s.total
END) total,
vCampaign
FROM sale s
JOIN ticket t ON t.id = s.ticketFk

View File

@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `vn`.`itemCampaignQuantity` (
dated date NOT NULL,
itemFk int(11) NOT NULL,
quantity decimal(10,2) NOT NULL,
total decimal(10,2) NOT NULL,
campaign varchar(100) NOT NULL,
UNIQUE KEY `itemCampaignQuantity_UNIQUE` (`dated`,`itemFk`),
CONSTRAINT itemCampaignQuantity_item_FK FOREIGN KEY (itemFk) REFERENCES vn.item(id) ON DELETE RESTRICT ON UPDATE CASCADE