Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- <?php
-
- namespace common\logic\Document\Invoice\Service;
-
- use common\helpers\Price;
- use common\logic\Document\Document\Service\DocumentSolver;
- use common\logic\Document\Invoice\Model\Invoice;
- use common\logic\Order\Order\Model\Order;
-
- class InvoiceSolver extends DocumentSolver
- {
- public function getInvoiceAmountPaid(Invoice $invoice): float
- {
- $amountPaid = 0;
-
- foreach($invoice->payments as $payment) {
- $amountPaid += $payment->amount;
- }
-
- return $amountPaid;
- }
-
- public function isInvoicePaid(Invoice $invoice): bool
- {
- return $this->getInvoiceAmountPaid($invoice) >= Price::numberTwoDecimals($this->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL));
- }
- }
|