Billing / generation of Invoices finished

This commit is contained in:
Frank Schubert
2024-07-07 12:04:51 +02:00
parent f83ef19e8d
commit 564d5c53b5
18 changed files with 665 additions and 60 deletions
@@ -2,7 +2,41 @@
class Invoiceposition extends mfBaseModel {
public function setOption($name, $value) {
$options = $this->getOptions;
if($options) {
$options = json_decode($this->options);
if(json_last_error() !== JSON_ERROR_NONE) {
$options = new stdClass();
}
} else {
$options = new stdClass();
}
$options->$name = $value;
$this->options = json_encode($options);
}
public function getOption($name) {
if(!$this->options) return null;
$this->log->debug("getOptions ($name): ".print_r($this->options, true));
$options = json_decode($this->options);
if(json_last_error() !== JSON_ERROR_NONE) {
$this->log->debug("getOptions ($name) decoding failed");
return null;
}
if(property_exists($options, $name)) {
return $options->$name;
}
return null;
}
public function __clone() {
$me = new User;
$me->loadMe();
@@ -19,6 +19,7 @@ class InvoicepositionModel {
public $fibu_cost_account_legacy;
public $fibu_taxcode;
public $billing_period;
public $options;
public $create_by;
public $edit_by;
@@ -106,7 +107,7 @@ class InvoicepositionModel {
$items = [];
if(!$order) {
$order = "invoice_id,contract_id,start_date,matchcode ASC";
$order = "invoice_id,contract_id,id ASC";
}
$db = FronkDB::singleton();