From 0fa2cf7423f4b92ae9d3d73c0e3c7da59fccc20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Fri, 7 Nov 2025 10:10:25 +0100 Subject: [PATCH] Add currency to CSV reports --- REST/functions.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/REST/functions.php b/REST/functions.php index 88c1d08d..f5286d70 100644 --- a/REST/functions.php +++ b/REST/functions.php @@ -339,10 +339,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 @@ -379,10 +381,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 @@ -421,11 +425,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 @@ -468,11 +474,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