You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
840B

  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace common\models ;
  8. class Document extends ActiveRecordCommon
  9. {
  10. public function getAmount($type = Order::AMOUNT_TOTAL, $format = false)
  11. {
  12. $amount = 0 ;
  13. $ordersArray = $this->orders ;
  14. foreach($ordersArray as $order) {
  15. $order->init() ;
  16. $amount += $order->getAmount($type) ;
  17. }
  18. if ($format) {
  19. return Price::format($amount) ;
  20. }
  21. else {
  22. return $amount;
  23. }
  24. }
  25. }