added units used to Preorder

This commit is contained in:
Frank Schubert
2022-05-11 13:23:47 +02:00
parent 6e29312363
commit 11ede6a5b7
6 changed files with 61 additions and 10 deletions

View File

@@ -80,6 +80,25 @@ class Building extends mfBaseModel {
return $code;
}
public function getUsedTerminationCount($includePreorders = false) {
if(!$this->id) {
return false;
}
$count = 0;
$orders = OrderModel::search(['building_id' => $this->id]);
$count += count($orders);
if($includePreorders) {
$preorders = PreorderModel::search(['building_id' => $this->id]);
$count += count($preorders);
}
return $count;
}
public function loadWorkflowItems() {
$item_ids = [];