From ef6b3e0f7c507386b15342d57537c8a3b888cd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Fri, 7 Nov 2025 10:21:54 +0100 Subject: [PATCH] currency in csv reports --- REST/functions.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/REST/functions.php b/REST/functions.php index ebff4797..e96f8055 100644 --- a/REST/functions.php +++ b/REST/functions.php @@ -269,10 +269,12 @@ function createCSVReports() END AS group_ks, GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, ii.quantity, - ii.price_netto + ii.price_netto, + cur.name AS currency_name, FROM ecminvoiceouts AS i INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id +INNER JOIN currencies AS cur ON cur.id = i.currency_id LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci AND cb.bean_name = 'EcmProducts' AND cb.deleted = 0 @@ -308,10 +310,12 @@ ORDER BY i.register_date DESC; END AS group_ks, GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, ii.quantity, - ii.price_netto + ii.price_netto, + cur.name AS currency_name, FROM ecminvoiceouts AS i INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id +INNER JOIN currencies AS cur ON cur.id = i.currency_id LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci AND cb.bean_name = 'EcmProducts' AND cb.deleted = 0 @@ -349,11 +353,13 @@ SELECT END AS group_ks, GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, ii.quantity_corrected AS quantity_correced, - ii.total_netto_corrected AS total_netto_corrected + ii.total_netto_corrected AS total_netto_corrected, + cur.name AS currency_name FROM ecminvoiceouts AS i INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id INNER JOIN ecminvoiceouts AS oi ON oi.id = i.ecminvoiceout_id + INNER JOIN currencies AS cur ON cur.id = i.currency_id LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci AND cb.bean_name = 'EcmProducts' AND cb.deleted = 0 @@ -395,11 +401,13 @@ SELECT END AS group_ks, GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, ii.quantity_corrected AS quantity_correced, - ii.total_netto_corrected AS total_netto_corrected + ii.total_netto_corrected AS total_netto_corrected, + cur.name AS currency_name FROM ecminvoiceouts AS i INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id INNER JOIN ecminvoiceouts AS oi ON oi.id = i.ecminvoiceout_id + INNER JOIN currencies AS cur ON cur.id = i.currency_id LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci AND cb.bean_name = 'EcmProducts' AND cb.deleted = 0