Preorder Billing Marketshare Price + RML layout tweaks
This commit is contained in:
@@ -183,6 +183,14 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
$owner_id = $base["owner_id"];
|
||||
$billingaddress_id = $base["billingaddress_id"];
|
||||
$billing_delivery = $base["billing_delivery"];
|
||||
$campaign_id = $base["campaign_id"];
|
||||
|
||||
$campaign = new Preordercampaign($campaign_id);
|
||||
if(!$campaign->id) {
|
||||
die("Kampagne $campaign_id nicht gefunden");
|
||||
}
|
||||
$campaign_name = $campaign->name;
|
||||
$campaign_name = preg_replace('/^RML Liezen\s+-\s+/', '', $campaign_name);
|
||||
|
||||
$bill_positions = [];
|
||||
$credit_positions = [];
|
||||
@@ -193,12 +201,11 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
"preorderbillingcustomer_id" => $preorderbillingcustomer_id,
|
||||
"owner_id" => $owner_id,
|
||||
"billingaddress_id" => $billingaddress_id,
|
||||
"preordercampaign_id" => $campaign_id,
|
||||
"billing_delivery" => $billing_delivery,
|
||||
"invoice_id" => null,
|
||||
];
|
||||
|
||||
|
||||
|
||||
$billing_rows = PreorderBilling::search($bill_filter);
|
||||
if(!count($billing_rows)) {
|
||||
var_dump($bill_filter);
|
||||
@@ -210,7 +217,7 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
$sorted_positions = [];
|
||||
$invoice_positions = [];
|
||||
$invoice_vatrate = 20;
|
||||
$price_total_sum = 0;
|
||||
//$price_total_sum = 0;
|
||||
|
||||
foreach($billing_rows as $bill) {
|
||||
$billing_row_count++;
|
||||
@@ -241,6 +248,7 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
$detail_data = [
|
||||
"owner_id" => $bill->owner_id,
|
||||
"company" => ($bill->company) ?: $bill->firstname . " " . $bill->lastname,
|
||||
"network_name" => $campaign_name,
|
||||
"oaid" => $bill->oaid,
|
||||
"order_date" => $bill->order_date,
|
||||
"start_date" => $start_date->format("Y-m-d"),
|
||||
@@ -349,6 +357,7 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
$invoice_data["fibu_revenue_account"] = TT_PREORDER_BILLING[$netowner_id]["fibu-revenue-code"];
|
||||
$invoice_data["fibu_tax_code"] = 1;
|
||||
$invoice_data["tax_text"] = null;
|
||||
$invoice_data["head_text"] = null;
|
||||
$invoice_data["uid"] = $bill->uid;
|
||||
$invoice_data["company"] = $bill->company;
|
||||
$invoice_data["firstname"] = $bill->firstname;
|
||||
@@ -385,6 +394,11 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
unset($position->preorder_billings);
|
||||
unset($position->count);
|
||||
|
||||
|
||||
if($position->product_id != 2) {
|
||||
$invoice->head_text = "Entgelte für Netzgebiet $campaign_name";
|
||||
}
|
||||
|
||||
$total_net += $position->price_total;
|
||||
$total_gross += $position->price_gross;
|
||||
|
||||
@@ -446,14 +460,15 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
||||
if(count($invoice_detail_data)) {
|
||||
// create CSV file
|
||||
//var_dump($invoice_detail_data);exit;
|
||||
$csv = "\u{FEFF}Netzbetreiber;Rechungsnummer;Rechnungsdateum;OAID;Bestelldatum;Periode von;Periode bis;Artikelnummer;Produkt;Anzahl;Preis Netto\n";
|
||||
$csv = "\u{FEFF}Netzbetreiber;Rechungsnummer;Rechnungsdateum;Netzgebiet;OAID;Bestelldatum;Periode von;Periode bis;Artikelnummer;Produkt;Anzahl;Preis Netto\n";
|
||||
foreach ($invoice_detail_data as $detail) {
|
||||
//var_dump($detail);
|
||||
//exit;
|
||||
|
||||
$csv .= '"'.str_replace(["\r","\n"], " ", $detail["company"]).'";';
|
||||
$csv .= '"'.str_replace(["\r","\n", '"'], [" "," ",'""'], $detail["company"]).'";';
|
||||
$csv .= '"'.$invoice->invoice_number.'";';
|
||||
$csv .= '"'.$invoice->invoice_date.'";';
|
||||
$csv .= '"'.str_replace('"','""',$detail["network_name"]).'";';
|
||||
$csv .= '"'.$detail["oaid"].'";';
|
||||
$csv .= '"'.$detail["order_date"].'";';
|
||||
$csv .= '"'.$detail["start_date"].'";';
|
||||
|
||||
Reference in New Issue
Block a user