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.

27 rindas
647B

  1. <?php
  2. namespace domain\Document\Invoice;
  3. use common\helpers\Price;
  4. use domain\Document\Document\DocumentSolver;
  5. use domain\Order\Order\Order;
  6. class InvoiceSolver extends DocumentSolver
  7. {
  8. public function getInvoiceAmountPaid(Invoice $invoice): float
  9. {
  10. $amountPaid = 0;
  11. foreach($invoice->payments as $payment) {
  12. $amountPaid += $payment->amount;
  13. }
  14. return $amountPaid;
  15. }
  16. public function isInvoicePaid(Invoice $invoice): bool
  17. {
  18. return $this->getInvoiceAmountPaid($invoice) >= Price::numberTwoDecimals($this->getAmountWithTax($invoice, Order::INVOICE_AMOUNT_TOTAL));
  19. }
  20. }