diff --git a/Layout/default/Address/invoice.php b/Layout/default/Address/invoice.php index 82b254942..7c3b974bc 100644 --- a/Layout/default/Address/invoice.php +++ b/Layout/default/Address/invoice.php @@ -49,6 +49,7 @@ Betrag Brutto Zahlungsart Versand + @@ -68,6 +69,7 @@ ">€ total_gross, 2, ",", ".")?> billing_type == "sepa") ? "Einzug" : "Einzahlung" ?> billing_delivery == "email") ? "Email (".$invoice->email.")" : "Postversand" ?> + $invoice->id])?>" title="CSV-Download"> diff --git a/Layout/default/Invoice/Index.php b/Layout/default/Invoice/Index.php index a171e81c4..a1e553470 100644 --- a/Layout/default/Invoice/Index.php +++ b/Layout/default/Invoice/Index.php @@ -152,9 +152,7 @@ $pagination_entity_name = "Rechnungen"; billing_type == "sepa") ? "SEPA" : "Überweisung"?> billing_delivery == "email") ? "Email" : "Papier"?> - total < 0): ?> - $invoice->id])?>"> - + $invoice->id])?>" title="CSV-Download"> diff --git a/Layout/default/Invoice/invoicepositions.csv.php b/Layout/default/Invoice/invoicepositions.csv.php index 90ee06bf4..9e232ac60 100644 --- a/Layout/default/Invoice/invoicepositions.csv.php +++ b/Layout/default/Invoice/invoicepositions.csv.php @@ -3,36 +3,33 @@ header("Content-type: text/csv"); header('Content-disposition: attachment; filename="'.$invoice->invoice_number.'.csv"'); ?> -Rechnungsnummer;Belegdatum;Kundennummer;Firma;Nachname;Vorname;Produktname;Matchcode;Anschluss Name;Bauabschnitt;Anschluss PLZ;Anschluss Ort;Anschluss Strasse; +Rechnungsnummer;Belegdatum;Kundennummer;Firma;Nachname;Vorname;Produktname;Matchcode;Zeitraum;Anzahl;Preis Netto;Ust%;Preis Brutto positions as $p): -?> -invoice_number?>;invoice_date)?>;customer_number?>;"company)?>";"lastname?>";"firstname?>";"product_name?>";"matchcode)?>";contract_id) { - $credit = $p->contract; + $timerange_month_only = $p->getOption('timerange_month_only'); + $start_date = new DateTime($p->start_date); + $end_date = new DateTime($p->end_date); + $amount = (float) number_format($p->amount, 3, ",", "."); + $price = number_format($p->price, 2, ",","."); + $price_total = number_format($p->price_total, 2, ",","."); + $price_gross = number_format($p->price_gross, 2, ",","."); + $vatrate = number_format($p->vatrate, 0, ",","."); - foreach($credit->linkFrom as $link) { - if($link->type == "credit" && $link->origin->termination_id) { - $contract = $link->origin; - break; + $timerange = ""; + if($timerange_month_only) { + $timerange = $start_date->format("m.Y"); + } elseif($p->billing_period > 1) { + $timerange = $start_date->format("m.Y")?> - format("m.Y"); + } else { + if($start_date->format("d.m.Y") == $end_date->format("d.m.Y")) { + $timerange = $start_date->format("d.m.Y"); + } else { + $timerange = $start_date->format("d.m.Y")." - ".$end_date->format("d.m.Y"); } - } -} -if($contract): ?> -termination; - //var_dump($term); - $building = $term->building; - //var_dump($building); - $order = OrderModel::getFirst(["termination_id" => $term->id]); - //var_dump($order);exit; + ?> -"owner->getCompanyOrName()) : str_replace(["\n","\r"], " ", $term->contact)?>";"networksection_id) ? $building->networksection->name : ""?>";zip?>;"city?>";"street?>"; - -;;;;; - +invoice_number?>;invoice_date)?>;customer_number?>;"company)?>";"lastname?>";"firstname?>";"product_name?>";"matchcode)?>";"";amount?>;price_total, 2, ",", "")?>;vatrate, 2, ",", "")?>;price_gross, 2, ",", "")?> +