This commit is contained in:
parent
4da11c65bb
commit
111480f7b7
|
@ -91,20 +91,21 @@ module.exports = Self => {
|
|||
value: componentValue
|
||||
}, myOptions);
|
||||
}
|
||||
await sale.updateAttributes({price: newPrice}, myOptions);
|
||||
await Self.rawSql(`
|
||||
UPDATE sale
|
||||
SET priceFixed = (
|
||||
SELECT SUM(value)
|
||||
FROM sale s
|
||||
JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
JOIN component c ON c.id = sc.componentFk
|
||||
JOIN componentType ct ON ct.id = c.typeFk
|
||||
WHERE ct.isBase
|
||||
AND s.id = ?
|
||||
)
|
||||
WHERE id = ?
|
||||
`, [id, id], myOptions);
|
||||
|
||||
const [priceFixed] = await Self.rawSql(`
|
||||
SELECT SUM(value) value
|
||||
FROM sale s
|
||||
JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
JOIN component c ON c.id = sc.componentFk
|
||||
JOIN componentType ct ON ct.id = c.typeFk
|
||||
WHERE ct.isBase
|
||||
AND s.id = ?
|
||||
`, [id], myOptions);
|
||||
|
||||
await sale.updateAttributes({
|
||||
price: newPrice,
|
||||
priceFixed: priceFixed.value
|
||||
}, myOptions);
|
||||
|
||||
await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions);
|
||||
await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions);
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
"discount": {
|
||||
"type": "number"
|
||||
},
|
||||
"priceFixed": {
|
||||
"type": "number"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue