feat: refs #7984 add currency in sale
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-01-21 15:09:24 +01:00
parent 2b21e7d62b
commit cd776b691a
5 changed files with 17 additions and 10 deletions

View File

@ -127,15 +127,15 @@ module.exports = Self => {
async function getBarcodes(ticketId, options) { async function getBarcodes(ticketId, options) {
const query = const query =
`SELECT s.id movementId, `SELECT s.id movementId,
b.code, b.code,
c.id c.id
FROM vn.sale s FROM vn.sale s
LEFT JOIN vn.itemBarcode b ON b.itemFk = s.itemFk LEFT JOIN vn.itemBarcode b ON b.itemFk = s.itemFk
LEFT JOIN vn.buy c ON c.itemFk = s.itemFk LEFT JOIN vn.buy c ON c.itemFk = s.itemFk
LEFT JOIN vn.entry e ON e.id = c.entryFk LEFT JOIN vn.entry e ON e.id = c.entryFk
LEFT JOIN vn.travel tr ON tr.id = e.travelFk LEFT JOIN vn.travel tr ON tr.id = e.travelFk
WHERE s.ticketFk = ? WHERE s.ticketFk = ?
AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`; AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`;
return Self.rawSql(query, [ticketId], options); return Self.rawSql(query, [ticketId], options);
} }

View File

@ -276,13 +276,6 @@ INSERT INTO `hedera`.`tpvConfig` (currency, terminal, transactionType, maxAmount
VALUES (978, 1, 0, 2000, 9, 'https://sis.redsys.es/sis/realizarPago', 0, 'https://sis-t.redsys.es:25443/sis/realizarPago', 'sq7HjrUOBfKmC576ILgskD5srU870gJ7', NULL); VALUES (978, 1, 0, 2000, 9, 'https://sis.redsys.es/sis/realizarPago', 0, 'https://sis-t.redsys.es:25443/sis/realizarPago', 'sq7HjrUOBfKmC576ILgskD5srU870gJ7', NULL);
*/ */
UPDATE vn.ticket t
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.referenceRate rr ON rr.currencyFk = t.currency
AND rr.dated = util.VN_CURDATE()
SET t.foreignPrice = t.price * vn.currency_getRate(t.currencyFk, NULL);
INSERT INTO hedera.tpvMerchantEnable (merchantFk, companyFk) INSERT INTO hedera.tpvMerchantEnable (merchantFk, companyFk)
VALUES (1, 442); VALUES (1, 442);

View File

@ -4063,3 +4063,9 @@ INSERT IGNORE INTO vn.osrmConfig (id,url,tolerance)
INSERT IGNORE INTO vn.inventoryConfig INSERT IGNORE INTO vn.inventoryConfig
SET id = 1, SET id = 1,
supplierFk = 4; supplierFk = 4;
UPDATE vn.ticket t
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.referenceRate rr ON rr.currencyFk = t.currencyFk
AND rr.dated = util.VN_CURDATE()
SET s.foreignPrice = s.price * vn.currency_getRate(t.currencyFk, NULL);

View File

@ -25,6 +25,9 @@
"price": { "price": {
"type": "number" "type": "number"
}, },
"foreignPrice": {
"type": "number"
},
"discount": { "discount": {
"type": "number" "type": "number"
}, },

View File

@ -165,6 +165,11 @@
"model": "Cmr", "model": "Cmr",
"foreignKey": "cmrFk" "foreignKey": "cmrFk"
}, },
"currency": {
"type": "belongsTo",
"model": "Currency",
"foreignKey": "currencyFk"
},
"ticketCollections": { "ticketCollections": {
"type": "hasMany", "type": "hasMany",
"model": "TicketCollection", "model": "TicketCollection",