示例#1
0
 /**
  *
  * @param Transaction $transaction
  * @param Iterator $iterator
  * @throws \Exception
  * @internal param Iterator $documents
  */
 public function TransactionSettle(Transaction $transaction, Iterator $iterator)
 {
     (new Settlement($transaction))->Settle($iterator);
     $transaction->set('rozliczane_automatycznie', Transaction::SETTLED_MANUALLY);
     $transaction->getEntityManager()->save();
     $this->getService('StatementMapper')->updateStatementStatus($transaction);
 }
示例#2
0
 /**
  * 
  * @param \Vindication\BankStatement\Entity\Statement $statement
  * @param closure $closure
  * @return \Vindication\BankStatement\Iterator\Transactions
  */
 public function getTransactions(Entity\Statement $statement, $closure = null)
 {
     $select = $this->getAdapter()->select()->from(array('o' => 'wyciag_bankowy_operacja', 's.*'))->joinLeft(array('d' => 'dluznicy'), 'd.PK_dluznicy = o.kontrahent_id', array('d.*'))->where('s.id =?', $statement->getID());
     $this->addFilters($select);
     if (null === $this->getRequestData()->getSort()) {
         $select->order(array('o.id ASC'));
     }
     if (is_callable($closure)) {
         $closure($select);
     }
     $iterator = new Iterator\Transactions();
     $iterator->setPaginator($paginator = $this->getPaginator($select));
     foreach ($paginator as $result) {
         $iterator->append($transaction = new Entity\Transaction($result));
         if ($transaction->get('kontrahent_id')) {
             $transaction->setContractor(new Contractor($result));
         }
     }
     return $iterator;
 }