Updated delivery note with botanical field
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-01-19 14:43:40 +01:00
parent 727fcddc3d
commit 3625ea2c36
2 changed files with 4 additions and 13 deletions

View File

@ -99,13 +99,8 @@ module.exports = {
getBotanical() { getBotanical() {
let phytosanitary = []; let phytosanitary = [];
this.sales.forEach(sale => { this.sales.forEach(sale => {
let itemPhytosanitary; if (sale.botanical)
if (sale.latinGenusName || sale.latinSpeciesName) phytosanitary.push(sale.botanical);
itemPhytosanitary = [sale.latinGenusName, sale.latinSpeciesName].filter(Boolean).join(' ');
else if (sale.botanical)
itemPhytosanitary = sale.botanical;
phytosanitary.push(itemPhytosanitary);
}); });
return phytosanitary.filter((item, index) => return phytosanitary.filter((item, index) =>

View File

@ -14,9 +14,7 @@ SELECT
i.inkFk, i.inkFk,
s.ticketFk, s.ticketFk,
tcl.code vatType, tcl.code vatType,
ib.botanical, ib.ediBotanic botanical,
eg.latinGenusName,
es.latinSpeciesName,
i.tag5, i.tag5,
i.value5, i.value5,
i.tag6, i.tag6,
@ -37,10 +35,8 @@ FROM vn.sale s
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
AND itc.countryFk = sp.countryFk AND itc.countryFk = sp.countryFk
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
LEFT JOIN itemBotanical ib ON ib.itemFk = i.id LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
AND ic.code = 'plant' AND ic.code = 'plant'
LEFT JOIN ediGenus eg ON eg.id = ib.genusFk
LEFT JOIN ediSpecie es ON es.id = ib.specieFk
WHERE s.ticketFk = ? WHERE s.ticketFk = ?
GROUP BY s.id GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk ORDER BY (it.isPackaging), s.concept, s.itemFk