oms-Purchase/Models/OrderSuggestion/OrderSuggestion.php
Dennis Eichhorn da8369376e bump
2024-02-28 05:09:12 +00:00

57 lines
1.1 KiB
PHP

<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Purchase\Models\OrderSuggestion;
use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount;
use phpOMS\Stdlib\Base\FloatInt;
/**
* OrderSuggestion class.
*
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class OrderSuggestion
{
public int $id = 0;
public int $status = OrderSuggestionStatus::DRAFT;
public Account $createdBy;
public \DateTimeImmutable $createdAt;
public array $elements = [];
public function __construct()
{
$this->createdBy = new NullAccount();
$this->createdAt = new \DateTimeImmutable('now');
}
public function getTotalCosts() : FloatInt
{
$total = new FloatInt();
foreach ($this->elements as $element) {
$total->add($element->costs);
}
return $total;
}
}