35 lines
869 B
SQL
35 lines
869 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 vn.sale s
|
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
|
JOIN vn.item i ON i.id = s.itemFk
|
|
JOIN vn.supplier s2 ON s2.id = t.companyFk
|
|
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
|
|
AND itc.countryFk = s2.countryFk
|
|
JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
|
|
LEFT JOIN vn.invoiceOut io ON io.id = t.refFk
|
|
WHERE s.ticketFk = ?
|
|
ORDER BY s.ticketFk, s.created |