diff --git a/application/PreorderBilling/PreorderBillingController.php b/application/PreorderBilling/PreorderBillingController.php index 4c8a7875c..d49365e14 100644 --- a/application/PreorderBilling/PreorderBillingController.php +++ b/application/PreorderBilling/PreorderBillingController.php @@ -452,6 +452,11 @@ class PreorderBillingController extends mfBaseController { $status_change_date = $status_244_change_date; } + if($status_change_date < $earliest_bill_date) { + $this->log->debug(__METHOD__.": Not billing operator_setup for preorder ".$preorder->id." because status change date ".$status_change_date->format("Y-m-d")." is before earliest_bill_date ".$earliest_bill_date->format("Y-m-d")); + return true; + } + if($netoperator_config["billing-period"] == "quarterly" && $status_change_date->format("Ymd") > $latest_quarter_bill_date->format("Ymd")) { $this->log->debug(__METHOD__.": Skipping operator_setup for preorder ".$preorder->id." because Billing date ".$status_change_date->format("Y-m-d")." is after latest_quarter_bill_date ".$latest_quarter_bill_date->format("Y-m-d")); return true; diff --git a/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php b/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php index 0a0658eec..d364feb85 100644 --- a/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php +++ b/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php @@ -828,7 +828,7 @@ class PreorderBillingInvoiceController extends mfBaseController { $prozent = 20; $steuercode = 1; - $csv = "\u{FEFF}satzart;konto;gkonto;belegnr;belegdatum;buchsymbol;buchcode;prozent;steuercode;betrag;steuer;text;kost;kotraeger;kobetrag\n"; + $csv = "\u{FEFF}satzart;konto;gkonto;belegnr;belegdatum;buchsymbol;buchcode;prozent;steuercode;betrag;steuer;text;kost;kotraeger;kobetrag;dokument\n"; $invoices = []; @@ -851,8 +851,8 @@ class PreorderBillingInvoiceController extends mfBaseController { $invoice_date = new DateTime($invoice->invoice_date); - $konto = $invoice->customer_number; - $gkonto = $invoice->fibu_revenue_code; + $konto = $invoice->fibu_account_number; + $gkonto = $invoice->fibu_revenue_account; $belegnr = $invoice->invoice_number; $belegdatum = $invoice_date->format("d.m.Y"); $betrag = number_format($invoice->total_gross, 2, ",", ""); @@ -860,14 +860,15 @@ class PreorderBillingInvoiceController extends mfBaseController { $text = ($invoice->company ?: $invoice->firstname." ".$invoice->lastname)." $belegnr"; $text = str_replace(["\r","\n", '"'], [" "," ",'""'], $text); $kost = $invoice->fibu_cost_account; + $dokument = $invoice->invoice_number.".pdf"; if(count($kostentraeger) < 2) { - $csv_line = "$satzart;$konto;$gkonto;$belegnr;$belegdatum;$buchsymbol;$buchcode;$prozent;$steuercode;$betrag;$steuer;\"$text\";$kost"; + $csv_line = "$satzart;$konto;$gkonto;$belegnr;$belegdatum;$buchsymbol;$buchcode;$prozent;$steuercode;$betrag;$steuer;\"$text\";$kost;;;$dokument"; } else { - $csv_line = "$satzart;$konto;$gkonto;$belegnr;$belegdatum;$buchsymbol;$buchcode;$prozent;$steuercode;$betrag;$steuer;\"$text\";;"; + $csv_line = "$satzart;$konto;$gkonto;$belegnr;$belegdatum;$buchsymbol;$buchcode;$prozent;$steuercode;$betrag;$steuer;\"$text\";;;;$dokument"; foreach($kostentraeger as $kotraeger => $kobetrag) { $kobetrag_text = number_format($kobetrag, 2, ",", ""); - $csv_line .= "\n1;;;;;;;;;;;;$kost;$kotraeger;$kobetrag_text"; + $csv_line .= "\n1;;;;;;;;;;;;$kost;$kotraeger;$kobetrag_text;"; } }