Merge pull request 'MASTER_hotfix_invoiceOut' (!1197) from MASTER_hotfix_invoiceOut into master
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
Reviewed-on: #1197
This commit is contained in:
commit
f7178f4e32
|
@ -138,7 +138,7 @@ module.exports = Self => {
|
||||||
recipient: invoiceOut.client().email
|
recipient: invoiceOut.client().email
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await models.InvoiceOut.invoiceEmail(ctx);
|
await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref);
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
|
|
||||||
return invoiceId;
|
return invoiceId;
|
||||||
|
|
|
@ -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, reference, reference]);
|
return this.rawSqlFromDef(`intrastat`, [reference, reference, reference, reference, reference]);
|
||||||
},
|
},
|
||||||
fetchRectified(reference) {
|
fetchRectified(reference) {
|
||||||
return this.rawSqlFromDef(`rectified`, [reference]);
|
return this.rawSqlFromDef(`rectified`, [reference]);
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
(SELECT
|
SELECT *
|
||||||
|
FROM invoiceOut io
|
||||||
|
JOIN invoiceOutSerial ios ON io.serial = ios.code
|
||||||
|
JOIN
|
||||||
|
(SELECT
|
||||||
|
t.refFk,
|
||||||
ir.id code,
|
ir.id code,
|
||||||
ir.description description,
|
ir.description description,
|
||||||
CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems,
|
CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems,
|
||||||
|
@ -19,14 +24,16 @@
|
||||||
WHERE t.refFk = ?
|
WHERE t.refFk = ?
|
||||||
AND i.intrastatFk
|
AND i.intrastatFk
|
||||||
GROUP BY i.intrastatFk
|
GROUP BY i.intrastatFk
|
||||||
ORDER BY i.intrastatFk)
|
UNION ALL
|
||||||
UNION ALL
|
SELECT
|
||||||
(SELECT
|
NULL AS refFk,
|
||||||
NULL AS code,
|
NULL AS code,
|
||||||
NULL AS description,
|
NULL AS description,
|
||||||
0 AS stems,
|
0 AS stems,
|
||||||
0 AS netKg,
|
0 AS netKg,
|
||||||
CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)) AS subtotal
|
IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) AS subtotal
|
||||||
FROM vn.ticketService ts
|
FROM vn.ticketService ts
|
||||||
JOIN vn.ticket t ON ts.ticketFk = t.id
|
JOIN vn.ticket t ON ts.ticketFk = t.id
|
||||||
WHERE t.refFk = ?);
|
WHERE t.refFk = ?) sub
|
||||||
|
WHERE io.`ref` = ? AND ios.isCEE
|
||||||
|
ORDER BY sub.code;
|
||||||
|
|
Loading…
Reference in New Issue