35 lines
838 B
SQL
35 lines
838 B
SQL
SELECT io.ref Invoice,
|
|
io.issued InvoiceDate,
|
|
s.ticketFk Ticket,
|
|
s.itemFk Item,
|
|
s.concept Description,
|
|
i.size,
|
|
i.subName Producer,
|
|
s.quantity Quantity,
|
|
s.price Price,
|
|
s.discount Discount,
|
|
s.created Created,
|
|
tc.code Taxcode,
|
|
tc.description TaxDescription,
|
|
i.tag5,
|
|
i.value5,
|
|
i.tag6,
|
|
i.value6,
|
|
i.tag7,
|
|
i.value7,
|
|
i.tag8,
|
|
i.value8,
|
|
i.tag9,
|
|
i.value9,
|
|
i.tag10,
|
|
i.value10
|
|
FROM sale s
|
|
JOIN ticket t ON t.id = s.ticketFk
|
|
JOIN item i ON i.id = s.itemFk
|
|
JOIN supplier s2 ON s2.id = t.companyFk
|
|
JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
|
AND itc.countryFk = s2.countryFk
|
|
JOIN taxClass tc ON tc.id = itc.taxClassFk
|
|
JOIN invoiceOut io ON io.ref = t.refFk
|
|
WHERE io.id = ?
|
|
ORDER BY s.ticketFk, s.created |