Exemple #1
0
 /**
  * Create verification from template
  *
  * @param  ChartOfAccounts          $chart
  * @return Verification
  * @throws UnexpectedValueException If any key is NOT substituted
  */
 public function buildVerification(ChartOfAccounts $chart)
 {
     if (!$this->ready($key)) {
         throw new UnexpectedValueException("Unable to substitute template key <{$key}>");
     }
     // Build verification
     $ver = new Verification($this->getText());
     foreach ($this->getTransactions() as $arTransData) {
         list($number, $amount) = $arTransData;
         // Ignore 0 amount transactions
         if (0 != floatval($amount)) {
             $ver->addTransaction(new Transaction($chart->getAccount($number), new Amount($amount)));
         }
     }
     return $ver;
 }