123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- /**
- *
- * PHP Pro Bid $Id$ 2WsMNNNDj0TclgB0DHZdu59pP8slMnF4TXqN60b/5gs=
- *
- * @link http://www.phpprobid.com
- * @copyright Copyright (c) 2015 Online Ventures Software & CodeCube SRL
- * @license http://www.phpprobid.com/license Commercial License
- *
- * @version 7.5
- */
- /**
- * accounting table rowset class
- * @7.5 added currency method, to get the currency of the rowset - required in case the default currency has been changed
- */
- namespace Ppb\Db\Table\Rowset;
- use Ppb\Db\Table\Row\AbstractAccounting as AbstractAccountingRow;
- abstract class AbstractAccounting extends AbstractRowset
- {
- /**
- *
- * calculate the amount w/o tax for the selected rowset
- *
- * @return float
- */
- public function amountNoTax()
- {
- $amount = 0;
- /** @var \Ppb\Db\Table\Row\AbstractAccounting $row */
- foreach ($this->_rows as $row) {
- $amount += $row->amountNoTax();
- }
- return $amount;
- }
- /**
- *
- * calculate the total amount for the selected rowset
- *
- * @return float
- */
- public function totalAmount()
- {
- $amount = 0;
- /** @var \Ppb\Db\Table\Row\AbstractAccounting $row */
- foreach ($this->_rows as $row) {
- $amount += $row->totalAmount();
- }
- return $amount;
- }
- /**
- *
- * calculate the tax amount for the selected rowset
- *
- * @return float
- */
- public function taxAmount()
- {
- return $this->totalAmount() - $this->amountNoTax();
- }
- /**
- *
- * get rowset currency
- *
- * @return string|null
- */
- public function currency()
- {
- /** @var \Ppb\Db\Table\Row\AbstractAccounting $row */
- $row = $this->_rows[0];
- if ($row instanceof AbstractAccountingRow) {
- return $row->getData('currency');
- }
- return null;
- }
- }
|