WIP Billing/Invoice 02.06.2024

This commit is contained in:
Frank Schubert
2024-07-02 16:52:37 +02:00
parent 350815f41a
commit 76cffdc374
5 changed files with 14 additions and 6 deletions

View File

@@ -107,8 +107,9 @@ class BillingController extends mfBaseController {
$now_year = date("Y");
$now_month = date("m");
$now_day = date("d");
$now_year = 2024;
$now_month = 7;
//$now_year = 2024;
//$now_month = 6;
$now_day = 3; // XXX for debugging only, must be removed
// XXX only for 1st Billing after IVT Import
//$yearly_not_before = new DateTime("$now_year-$now_month-01");
@@ -123,7 +124,7 @@ class BillingController extends mfBaseController {
$this->log->notice(__METHOD__.": $del Billing records deleted");
//$stop = false;
foreach(ContractModel::search(["finish_date<" => mktime(0,0,0,$now_month, $now_day, $now_year), "cancel_date" => null]) as $contract) {
foreach(ContractModel::search(["finish_date<" => mktime(0,1,0,$now_month, $now_day, $now_year), "cancel_date" => null]) as $contract) {
//while(!$stop) {
//$stop = true;
//$contract = new Contract(1475);
@@ -238,8 +239,10 @@ class BillingController extends mfBaseController {
}
if($create_date->format("Y") == $finish_year && $create_date->format("m") == $finish_month) {
// this is the finish month, so set day back to day of finish_date
$create_date->setDate($finish_year, $finish_month, $finish_day);
// this is the finish month, so set day back to day of finish_date, unless billing_period is more than 1 month
if($contract->billing_period == 1) {
$create_date->setDate($finish_year, $finish_month, $finish_day);
}
$last_create_date = true;
}

View File

@@ -31,6 +31,7 @@ class BillingModel {
public $price;
public $price_setup;
public $vatrate;
public $billing_period;
public $create_by;
public $edit_by;