WIP Preorder Billing 2025-03-27

This commit is contained in:
Frank Schubert
2025-03-28 13:43:11 +01:00
parent b8db830214
commit 2fa0d31837
11 changed files with 189 additions and 65 deletions

View File

@@ -168,6 +168,20 @@ class PreorderBillingInvoiceController extends mfBaseController {
protected function createAction() {
$netowner_id = $this->me->address_id;
$today = new DateTime();
$bill_month = clone $today;
$bill_month->modify("-1 month");
$fmt = new IntlDateFormatter(
MFLOCALE_TIME,
IntlDateFormatter::NONE,
IntlDateFormatter::NONE,
"Europe/Vienna",
IntlDateFormatter::GREGORIAN,
'MMMM'
);
$bill_month_year_text = $fmt->format($bill_month)." ".$bill_month->format("Y");
$bill_quarter = ceil($bill_month->format("n") / 3);
$billing_row_count = 0;
$positions_count = 0;
@@ -191,6 +205,8 @@ class PreorderBillingInvoiceController extends mfBaseController {
}
$campaign_name = $campaign->name;
$campaign_name = preg_replace('/^RML Liezen\s+-\s+/', '', $campaign_name);
$cluster = array_shift($campaign->salesclusters);
$cluster_name = $cluster->extref;
$bill_positions = [];
$credit_positions = [];
@@ -397,8 +413,12 @@ class PreorderBillingInvoiceController extends mfBaseController {
unset($position->count);
if($position->product_id != 2) {
$invoice->head_text = "Entgelte für Netzgebiet $campaign_name";
if($position->product_type != "enduser_setup") {
if(array_key_exists($netoperator_id, TT_PREORDER_BILLING[$netowner_id]["netoperators"]) && TT_PREORDER_BILLING[$netowner_id]["netoperators"][$netoperator_id]["billing-period"] == "quarterly") {
$invoice->head_text = "Abrechnung Q$bill_quarter ".$bill_month->format("Y")."\n$campaign_name\nPOP-Cluster: $cluster_name";
} else {
$invoice->head_text = "Abrechnung $bill_month_year_text\n$campaign_name\nPOP-Cluster: $cluster_name";
}
}
$total_net += $position->price_total;