PreorderBilling BMD Expot

This commit is contained in:
Frank Schubert
2025-04-10 13:26:56 +02:00
parent 4bc1a0c97b
commit 653b28aa5c
5 changed files with 300 additions and 12 deletions

View File

@@ -141,7 +141,7 @@ class PreorderBillingController extends mfBaseController {
$now_day = date("d");
$today = new DateTime("$now_year-$now_month-$now_day");
//$today = new DateTime("2025-04-13");
//$today = new DateTime("2025-03-13");
$today->setTime(2,0,0);
$today->setTimezone(new DateTimeZone("Europe/Vienna"));
@@ -380,7 +380,7 @@ class PreorderBillingController extends mfBaseController {
// Endkunde Setup Gebühr
if($status_244_change_date < $earliest_bill_date) {
$this->log->debug(__METHOD__.": Not billing enduser_setup for preorder ".$preorder->id." because status change date ".$status_244_change_date->format("Y-m-d")." is before earliest_bill_date ".$earliest_bill_date->format("Y-m-d"));
$this->log->debug(__METHOD__.": Not billing enduser_setup for preorder ".$preorder->id." because status 244 change date ".$status_244_change_date->format("Y-m-d")." is before earliest_bill_date ".$earliest_bill_date->format("Y-m-d"));
return true;
}
@@ -448,7 +448,7 @@ class PreorderBillingController extends mfBaseController {
$billing_data["end_date"] = $status_change_date->format("Y-m-d");
}
if(!$status_change_date) {
if(!$change_to_active) {
$status_change_date = $status_244_change_date;
}
@@ -481,10 +481,6 @@ class PreorderBillingController extends mfBaseController {
die("Unknown billing type $type");
}
if(!$billing_data["unit"]) {
var_dump($billing_data);exit;
}
$billing = PreorderBilling::create($billing_data);
if(!$billing->save()) {
@@ -568,7 +564,7 @@ class PreorderBillingController extends mfBaseController {
}
if($status_change_date->format("Ymd") > $latest_bill_date->format("Ymd")) {
$this->log->debug(__METHOD__.": Skipping setup for preorder ".$preorder->id." because billing date (status change date) ".$status_change_date->format("Y-m-d")." is after latest_bill_date ".$latest_bill_date->format("Y-m-d"));
$this->log->debug(__METHOD__.": Skipping usage for preorder ".$preorder->id." because billing date (status change date) ".$status_change_date->format("Y-m-d")." is after latest_bill_date ".$latest_bill_date->format("Y-m-d"));
return true;
}
@@ -722,6 +718,7 @@ class PreorderBillingController extends mfBaseController {
"preorder_id" => $preorder->id,
"oaid" => $preorder->oaid,
"adb_wohneinheit_id" => $preorder->adb_wohneinheit_id,
"extref" => ($preorder->extref) ?: null,
"order_date" => $order_date->format("Y-m-d"),
"start_date" => $start_date->format("Y-m-d"),
"end_date" => $end_date->format("Y-m-d"),