SELECT
    s.id,
    s.itemFk,
    s.concept,
    s.quantity,
    s.price,
    s.price - SUM(IF(ctr.id = 6, sc.value, 0)) netPrice,
    s.discount,
    i.size,
    i.stems,
    i.category,
    it.id itemTypeId,
    o.code AS origin,
    i.inkFk,
    s.ticketFk,
    tcl.code vatType,
    ib.ediBotanic botanical,
    i.tag5,
    i.value5,
    i.tag6,
    i.value6,
    i.tag7,
    i.value7,
    i.subName
FROM vn.sale s
    LEFT JOIN saleComponent sc ON sc.saleFk = s.id
    LEFT JOIN component cr ON cr.id = sc.componentFk
    LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
    LEFT JOIN item i ON i.id = s.itemFk
    LEFT JOIN ticket t ON t.id = s.ticketFk
    LEFT JOIN origin o ON o.id = i.originFk
    LEFT JOIN country c ON c.id = o.countryFk
    LEFT JOIN supplier sp ON sp.id = t.companyFk
    LEFT JOIN itemType it ON it.id = i.typeFk
    LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
    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 itemBotanicalWithGenus ib ON ib.itemFk = i.id
        AND ic.code = 'plant'
        AND ib.ediBotanic IS NOT NULL
WHERE s.ticketFk = ?
GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk
