">
- | =$zone->zone?> |
+ =$zone->zone?> |
=number_format($zone->price * 60, 4, ",",".")?> € |
=number_format($zone->call_count, 0, ",",".")?> |
=self::getHumanReadableInterval($zone->duration)?> |
=number_format($zone->price_total, 4, ",",".")?> € |
- =$zone->price_total_gross?> € |
+ =$zone->price_total_gross?> € |
diff --git a/application/Billing/BillingController.php b/application/Billing/BillingController.php
index be7ed4937..45e9525c6 100644
--- a/application/Billing/BillingController.php
+++ b/application/Billing/BillingController.php
@@ -94,48 +94,43 @@ class BillingController extends mfBaseController {
protected function importContractsAction() {
$r = $this->request;
- $today = new DateTime("now");
- $today->setTime(0,0,0);
-
- //$tomorrow = new DateTime("tomorrow");
- //$tomorrow->setTime(0,0,0);
-
$i = 0;
$v = 0;
- //$yearly_not_before = new DateTime("2023-06-01");
+ $today = new DateTime("now");
+ $today->setTime(0,0,0);
$now_year = date("Y");
$now_month = date("m");
$now_day = date("d");
+
//$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");
- $yearly_not_before = new DateTime("$now_year-06-01");
+ $yearly_not_before = new DateTime("$now_year-$now_month-01");
$del = 0;
// first delete all non-invoiced billing records
- /*foreach(BillingModel::search(["invoice_id" => null]) as $bill) {
+ foreach(BillingModel::search(["invoice_id" => null]) as $bill) {
$bill->delete();
$del++;
- }*/
+ }
$this->log->notice(__METHOD__.": $del Billing records deleted");
- //$stop = false;
- foreach(ContractModel::search(["owner_id" => 783, "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);
- //var_dump($contract);exit;
+ $contract_search = [
+ "finish_date<" => mktime(2,0,0,$now_month, $now_day, $now_year),
+ "cancel_date_null_or_gte" => mktime(0,0,0,$now_month, 1, $now_year)
+ ];
+
+ foreach(ContractModel::search($contract_search) as $contract) {
$bill_month = $now_month;
$bill_year = $now_year;
//$bill_day = $now_day;
$bill_date = new DateTime("$bill_year-$bill_month-01");
- //echo $bill_date->format("Y-m-d H:i:s")."