WIP Contract/Billing 2024-07-04
This commit is contained in:
@@ -27,6 +27,8 @@ class Contract extends mfBaseModel {
|
||||
private $productchangeTo;
|
||||
private $relocationFrom;
|
||||
private $relocationTo;
|
||||
private $vatgroup;
|
||||
private $vatrate;
|
||||
private $finisher;
|
||||
private $canceler;
|
||||
private $creator;
|
||||
@@ -193,6 +195,15 @@ class Contract extends mfBaseModel {
|
||||
|
||||
}
|
||||
|
||||
public function getConfigValue($itemname) {
|
||||
$configvalues = $this->getProperty("configvalues");
|
||||
if(!$configvalues) return null;
|
||||
if(!array_key_exists($itemname, $configvalues)) return null;
|
||||
|
||||
$confitem = $configvalues[$itemname];
|
||||
return $confitem->value;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
@@ -292,6 +303,19 @@ class Contract extends mfBaseModel {
|
||||
|
||||
return $this->contractConfigItems;
|
||||
}*/
|
||||
|
||||
if($name == "vatrate") {
|
||||
$vatgroup = $this->getProperty("vatgroup");
|
||||
$country = $this->getProperty("country");
|
||||
$vatrate = $vatgroup->rates["domestic"]->rate;
|
||||
if($this->country_id && $country->is_eu) {
|
||||
$vatrate = $vatgroup->rates["eu"]->rate;
|
||||
} if($this->country_id && !$country->is_eu) {
|
||||
$vatrate = $vatgroup->rates["other"]->rate;
|
||||
}
|
||||
$this->vatrate = $vatrate;
|
||||
return $this->vatrate;
|
||||
}
|
||||
|
||||
if($name == "journals") {
|
||||
$this->journals = array_reverse(ContractjournalModel::search(["contract_id" => $this->id]));
|
||||
|
||||
Reference in New Issue
Block a user