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

@@ -93,7 +93,9 @@ $is_credit = $net_total < 0;
<tr class="<?=($i%2 == 0) ? "even" : "odd" ?> one-position">
<td class="name">
<span class="product-name"><?=$p->product_name?></span>
<?php if($start_date->format("d.m.Y") != $end_date->format("d.m.Y")): ?>
<?php if($p->billing_period > 1): ?>
&nbsp;(<?=$start_date->format("m/Y")?> - <?=$end_date->format("m/Y")?>)
<?php elseif($start_date->format("d.m.Y") != $end_date->format("d.m.Y")): ?>
&nbsp;(<?=$start_date->format("d.m.Y")?> - <?=$end_date->format("d.m.Y")?>)
<?php endif; ?>
<?=($p->matchcode) ? "<div class='pl-2'>".$p->matchcode."</div>" : ""?>

View File

@@ -212,6 +212,7 @@ class Admin_IvtContractImport {
$finish_date->modify("first day of this month");
$finish_date->setTime(2,0,0);
$finish_date->modify("+1 month"); // XXX for debugging only; must be removed
//$finish_date->setDate($finish_date->format("Y"), $finish_date->format("m"), 1);
//$finish_date->modify("+1 hours");

View File

@@ -165,6 +165,7 @@ class Admin_IvtCreditImport {
$finish_date = new DateTime($cust_cred->lastdate);
$finish_date->modify("first day of this month");
$finish_date->setTime(2,0,0);
$finish_date->modify("+ 1 month"); // XXX for debugging only; must be removed
//$finish_date->setDate($finish_date->format("Y"), $finish_date->format("m"), 1);
$data["orderproduct_id"] = null;

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;