WIP PreorderBilling 2025-03-26
This commit is contained in:
@@ -4,7 +4,7 @@ class PreorderBilling extends mfBaseModel {
|
||||
protected $forcestr = ["product_name","product_info","matchcode"];
|
||||
private $preorder;
|
||||
private $invoice;
|
||||
private $vatgroup;
|
||||
private $adb_wohneinheit;
|
||||
|
||||
public static $earliest_bill_date = "2025-01-01";
|
||||
|
||||
@@ -21,6 +21,13 @@ class PreorderBilling extends mfBaseModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "adb_wohneinheit") {
|
||||
if(!$this->preorder_id) return null;
|
||||
$preorder = $this->getProperty("preorder");
|
||||
if(!$preorder || !$preorder->adb_wohneinheit_id) return null;
|
||||
return $preorder->adb_wohneinheit;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($creator) {
|
||||
@@ -77,9 +84,9 @@ class PreorderBilling extends mfBaseModel {
|
||||
$model = new PreorderBilling();
|
||||
|
||||
$table_fields = [
|
||||
"netowner_id","invoice_id", "preorder_id", "oaid", "adb_wohneinheit_id", "order_date", "start_date", "end_date", "preorderbillingcustomer_id", "owner_id",
|
||||
"billingaddress_id", "fibu_account_number", "company", "firstname", "lastname", "street", "zip", "city", "country", "email", "uid",
|
||||
"billing_delivery", "product_id", "product_name", "product_info", "article_number", "amount", "unit", "price", "price_setup", "vatrate", "billing_period",
|
||||
"netowner_id","invoice_id", "preorder_id", "product_type", "oaid", "adb_wohneinheit_id", "order_date", "start_date", "end_date", "preorderbillingcustomer_id",
|
||||
"owner_id", "billingaddress_id", "fibu_account_number", "company", "firstname", "lastname", "street", "zip", "city", "country", "email", "uid", "billing_delivery",
|
||||
"product_id", "product_type", "product_name", "product_info", "article_number", "amount", "unit", "price", "price_setup", "vatrate", "billing_period",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
|
||||
@@ -148,7 +148,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-04-13");
|
||||
$today->setTime(2,0,0);
|
||||
$today->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
|
||||
@@ -339,6 +339,7 @@ class PreorderBillingController extends mfBaseController {
|
||||
"end_date" => $status_change_date->format("Y-m-d"),
|
||||
"billing_delivery" => "email",
|
||||
"product_id" => $product->id,
|
||||
"product_type" => $product->type,
|
||||
"product_info" => "",
|
||||
"article_number" => $article_number,
|
||||
"amount" => 1,
|
||||
@@ -425,6 +426,11 @@ 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()) {
|
||||
die("Billing record could not be saved!");
|
||||
@@ -632,6 +638,7 @@ class PreorderBillingController extends mfBaseController {
|
||||
"end_date" => $end_date->format("Y-m-d"),
|
||||
"billing_delivery" => "email",
|
||||
"product_id" => $product->id,
|
||||
"product_type" => $product->type,
|
||||
"product_info" => "",
|
||||
"article_number" => $article_number,
|
||||
"amount" => 1,
|
||||
|
||||
Reference in New Issue
Block a user