feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
This commit is contained in:
parent
7e604f1a19
commit
5162c2037b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue