Files
thetool/Layout/default/Contract/Export.csv.php
2025-04-18 15:53:37 +02:00

10 lines
1.9 KiB
PHP

<?php
$filename = "contracts-export-".date("Y-m-d_H-i-s").".csv";
header("Content-type: text/csv; charset=utf-8");
header('Content-disposition: attachment; filename="'.$filename.'"');
?>
<?="\u{FEFF}"?>Contract ID;Vertragsinhaber Kundennummer;Vertragsinhaber Name;Vertragsinhaber Straße;Vertragsinhaber PLZ;Vertragsinhaber Ort;Vertragsinhaber Land;Rechnungsempfänger Kundennummer;Rechnungsempfänger Name;Rechnungsempfänger Straße;Rechnungsempfänger PLZ;Rechnungsempfänger Ort;Rechnungsempfänger Land;SLA;Produktgruppe;Produktname;Matchcode;Menge;Einzelpreis;Gesamtpreis;Preis Setup;Rechungsperiode;Verrechnungsstart Verzögerung;Bestelldatum;Fertigstellungsdatum;Kündigungsdatum;Erstellt;Zuletzt bearbeitet
<?php foreach($contracts as $contract): ?>
<?=$contract->id?>;<?=$contract->owner->customer_number?>;"<?=$contract->owner->getCompanyOrName()?>";"<?=$contract->owner->street?>";"<?=$contract->owner->zip?>";"<?=$contract->owner->city?>";"<?=$contract->owner->country->isocode?>";<?=$contract->billingaddress->customer_number?>;"<?=$contract->billingaddress->getCompanyOrName()?>";"<?=$contract->billingaddress->street?>";"<?=$contract->billingaddress->zip?>";"<?=$contract->billingaddress->city?>";"<?=$contract->billingaddress->country->isocode?>";"<?=$contract->sla->name?>";"<?=$contract->product->productgroup->name?>";"<?=$contract->product->name?>";"<?=str_replace(["\r","\n",'"'],[" ", " ", '""'],$contract->matchcode)?>";<?=$contract->amount?>;<?=$contract->price?>;<?=$contract->price * $contract->amount?>;<?=$contract->price_setup?>;<?=__($contract->billing_period, "billing_period")?>;<?=$contract->billing_delay?>;<?=($contract->order_date) ? date("Y-m-d", $contract->order_date) : ""?>;<?=($contract->finish_date) ? date("Y-m-d", $contract->finish_date) : ""?>;<?=($contract->cancel_date) ? date("Y-m-d", $contract->cancel_date) : ""?>;<?=date("Y-m-d", $contract->create)?>;<?=date("Y-m-d", $contract->edit)?>
<?php endforeach; ?>