diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 5e5752e36..549759651 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -99,13 +99,8 @@ module.exports = { getBotanical() { let phytosanitary = []; this.sales.forEach(sale => { - let itemPhytosanitary; - if (sale.latinGenusName || sale.latinSpeciesName) - itemPhytosanitary = [sale.latinGenusName, sale.latinSpeciesName].filter(Boolean).join(' '); - else if (sale.botanical) - itemPhytosanitary = sale.botanical; - - phytosanitary.push(itemPhytosanitary); + if (sale.botanical) + phytosanitary.push(sale.botanical); }); return phytosanitary.filter((item, index) => diff --git a/print/templates/reports/delivery-note/sql/sales.sql b/print/templates/reports/delivery-note/sql/sales.sql index 08c349f5a..d17f6feee 100644 --- a/print/templates/reports/delivery-note/sql/sales.sql +++ b/print/templates/reports/delivery-note/sql/sales.sql @@ -14,9 +14,7 @@ SELECT i.inkFk, s.ticketFk, tcl.code vatType, - ib.botanical, - eg.latinGenusName, - es.latinSpeciesName, + ib.ediBotanic botanical, i.tag5, i.value5, i.tag6, @@ -37,10 +35,8 @@ FROM vn.sale s LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = sp.countryFk 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' - LEFT JOIN ediGenus eg ON eg.id = ib.genusFk - LEFT JOIN ediSpecie es ON es.id = ib.specieFk WHERE s.ticketFk = ? GROUP BY s.id ORDER BY (it.isPackaging), s.concept, s.itemFk \ No newline at end of file