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 vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
JOIN intrastat ir ON ir.id = i.intrastatFk
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;
WHERE t.refFk = vNewRef;
DROP TEMPORARY TABLE tmp.ticket;
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),
(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),
(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 = 'T2222222' WHERE id = 2;
@ -597,7 +599,11 @@ INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`
(4, 2, 110.33, 2000000000, util.VN_CURDATE()),
(5, 3, 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`)
VALUES

View File

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

View File

@ -1,20 +1,27 @@
SELECT ir.id code,
ir.description,
iii.stems,
iii.net netKg,
iii.amount subtotal
FROM vn.invoiceInIntrastat iii
LEFT JOIN vn.invoiceIn ii ON ii.id = iii.invoiceInFk
LEFT JOIN vn.invoiceOut io ON io.ref = ii.supplierRef
LEFT JOIN vn.intrastat ir ON ir.id = iii.intrastatFk
WHERE io.`ref` = ?
UNION ALL
SELECT NULL code,
'Servicios' description,
0 stems,
0 netKg,
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 = ?
ORDER BY code;
SELECT *
FROM invoiceOut io
JOIN invoiceOutSerial ios ON io.serial = ios.code
JOIN(
SELECT ir.id code,
ir.description,
iii.stems,
iii.net netKg,
iii.amount subtotal
FROM vn.invoiceInIntrastat iii
LEFT JOIN vn.invoiceIn ii ON ii.id = iii.invoiceInFk
LEFT JOIN vn.invoiceOut io ON io.ref = ii.supplierRef
LEFT JOIN vn.intrastat ir ON ir.id = iii.intrastatFk
WHERE io.`ref` = ?
UNION ALL
SELECT NULL code,
'Servicios' description,
0 stems,
0 netKg,
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;