Added IVT product export Admin function

This commit is contained in:
Frank Schubert
2023-05-05 15:08:41 +02:00
parent 93727c3bf9
commit ed4c6ad738
7 changed files with 388 additions and 0 deletions

View File

@@ -37,6 +37,9 @@
<div class="row col-12">
<div><a href="<?=self::getUrl("Admin", "ivtImportMatchProducts")?>">IVT Produkte zu thetool Produkte matchen</a></div>
</div>
<div class="row col-12">
<div><a href="<?=self::getUrl("Admin", "ivtDownloadActiveProducts")?>">Produkte in Verwendung herunterladen</a></div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,13 @@
<?php
ob_end_flush();
header("Content-type: text/csv");
header('Content-disposition: attachment; filename="ivtproducts-active-'.date('Y-m-d_H-i-s').'.csv"');
?>
IVT ID;Typ;Produkt;Standardpreis;Anzahl Kunden;Kunde
<?php
$types = array('-----', 'xDSL', 'FTTH', 'FTTB', 'DOCSIS', 'Funk', 'Telefon', 'Webhosting', 'Carrier', 'Housing', 'TV');
foreach($products as $product_id => $product):
?>
<?=$product_id?>;"<?=$types[$product['product']->typ]?>";"<?=$product['product']->name?>";<?=$product['product']->price?>;<?=$product['count']?>;<?=($product['customer']) ? $product['customer'] : ""?>;
<?php
endforeach;