From 1131230170b3ebc9690d55288972a444876f3b71 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Tue, 20 Aug 2024 20:35:17 +0200 Subject: [PATCH] Added customer_number to credit invoice export --- .../default/Invoice/invoicepositions.csv.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Layout/default/Invoice/invoicepositions.csv.php b/Layout/default/Invoice/invoicepositions.csv.php index 9e232ac60..f0a058dee 100644 --- a/Layout/default/Invoice/invoicepositions.csv.php +++ b/Layout/default/Invoice/invoicepositions.csv.php @@ -15,6 +15,22 @@ foreach($invoice->positions as $p): $price_gross = number_format($p->price_gross, 2, ",","."); $vatrate = number_format($p->vatrate, 0, ",","."); + $credit_custnum = false; + $credit = false; + $contract = false; + if($p->contract_id) { + $credit = $p->contract; + foreach($credit->linkFrom as $link) { + if($link->type == "credit" && $link->origin->termination_id) { + $contract = $link->origin; + $credit_custnum = $contract->owner->customer_number; + break; + } + } + } + + + $timerange = ""; if($timerange_month_only) { $timerange = $start_date->format("m.Y"); @@ -29,7 +45,7 @@ foreach($invoice->positions as $p): } ?> -invoice_number?>;invoice_date)?>;customer_number?>;"company)?>";"lastname?>";"firstname?>";"product_name?>";"matchcode)?>";"";amount?>;price_total, 2, ",", "")?>;vatrate, 2, ",", "")?>;price_gross, 2, ",", "")?> +invoice_number?>;invoice_date)?>;customer_number?>;"company)?>";"lastname?>";"firstname?>";"product_name?>";"matchcode)?>";"";amount?>;price_total, 2, ",", "")?>;vatrate, 2, ",", "")?>;price_gross, 2, ",", "")?>