feat: add fixtures
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-12-22 15:20:18 +01:00
parent bd7a37bf90
commit e716ecc1e6
4 changed files with 37 additions and 37 deletions

View File

@ -209,20 +209,7 @@ BEGIN
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
JOIN intrastat ir ON ir.id = i.intrastatFk JOIN intrastat ir ON ir.id = i.intrastatFk
WHERE t.refFk = vNewRef WHERE t.refFk = vNewRef;
GROUP BY i.intrastatFk
UNION ALL
SELECT
vNewInvoiceInId invoiceInFk,
NULL intrastatFk,
IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) subtotal,
0 AS stems,
NULL countryFk,
0 AS netKg
FROM ticketService ts
JOIN ticket t ON ts.ticketFk = t.id
WHERE t.refFk = vNewRef
ORDER BY intrastatFk;
DROP TEMPORARY TABLE tmp.ticket; DROP TEMPORARY TABLE tmp.ticket;
DROP TEMPORARY TABLE tmp.ticketAmount; DROP TEMPORARY TABLE tmp.ticketAmount;

View File

@ -560,7 +560,9 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `cr
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0); (5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0),
(6, 'V', 135, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0);
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1; UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2; UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
@ -597,7 +599,11 @@ INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`
(4, 2, 110.33, 2000000000, util.VN_CURDATE()), (4, 2, 110.33, 2000000000, util.VN_CURDATE()),
(5, 3, 8.07, 2000000000, util.VN_CURDATE()), (5, 3, 8.07, 2000000000, util.VN_CURDATE()),
(6, 4, 8.07, 2000000000, util.VN_CURDATE()), (6, 4, 8.07, 2000000000, util.VN_CURDATE()),
(7, 5, 8.07, 2000000000, util.VN_CURDATE()); (7, 5, 8.07, 2000000000, util.VN_CURDATE()),
(8, 6, 111.60, 2000000000, util.VN_CURDATE()),
(9, 6, 17.90, 4751000000, util.VN_CURDATE()),
(10,6, 5.50, 7001000000, util.VN_CURDATE());
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`) INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`)
VALUES VALUES

View File

@ -82,7 +82,7 @@ module.exports = {
return this.rawSqlFromDef(`taxes`, [reference]); return this.rawSqlFromDef(`taxes`, [reference]);
}, },
fetchIntrastat(reference) { fetchIntrastat(reference) {
return this.rawSqlFromDef(`intrastat`, [reference, reference]); return this.rawSqlFromDef(`intrastat`, [reference, reference, reference]);
}, },
fetchRectified(reference) { fetchRectified(reference) {
return this.rawSqlFromDef(`rectified`, [reference]); return this.rawSqlFromDef(`rectified`, [reference]);

View File

@ -1,20 +1,27 @@
SELECT ir.id code, SELECT *
ir.description, FROM invoiceOut io
iii.stems, JOIN invoiceOutSerial ios ON io.serial = ios.code
iii.net netKg, JOIN(
iii.amount subtotal SELECT ir.id code,
FROM vn.invoiceInIntrastat iii ir.description,
LEFT JOIN vn.invoiceIn ii ON ii.id = iii.invoiceInFk iii.stems,
LEFT JOIN vn.invoiceOut io ON io.ref = ii.supplierRef iii.net netKg,
LEFT JOIN vn.intrastat ir ON ir.id = iii.intrastatFk iii.amount subtotal
WHERE io.`ref` = ? FROM vn.invoiceInIntrastat iii
UNION ALL LEFT JOIN vn.invoiceIn ii ON ii.id = iii.invoiceInFk
SELECT NULL code, LEFT JOIN vn.invoiceOut io ON io.ref = ii.supplierRef
'Servicios' description, LEFT JOIN vn.intrastat ir ON ir.id = iii.intrastatFk
0 stems, WHERE io.`ref` = ?
0 netKg, UNION ALL
IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) subtotal SELECT NULL code,
FROM vn.ticketService ts 'Servicios' description,
JOIN vn.ticket t ON ts.ticketFk = t.id 0 stems,
WHERE t.refFk = ? 0 netKg,
ORDER BY code; IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) subtotal
FROM vn.ticketService ts
JOIN vn.ticket t ON ts.ticketFk = t.id
WHERE t.refFk = ?
) sub
WHERE io.ref = ? AND ios.isCEE
ORDER BY sub.code;