コード例 #1
0
 public function getBankAutocompleteInvoices(PaginationParameters $paginationParameters)
 {
     return $this->entityManager->getRepository(Document\Invoice::getClass())->getBankAutocompleteInvoices($paginationParameters);
 }
コード例 #2
0
 public function getSalesJson($fromDate, $toDate, $interval)
 {
     $result = array();
     $result[] = array('Year', 'Sales');
     if ($interval == 'days') {
         $interval2 = '+1 day';
     } elseif ($interval == 'months') {
         $interval2 = '+1 month';
     } elseif ($interval == 'years') {
         $interval2 = '+1 year';
     }
     foreach ($this->invoiceService->getDateRange($fromDate, $toDate, $interval2) as $date) {
         $result[] = array($date, $this->entityManager->getRepository(Invoice::getClass())->getAmountByStringDate($date, $interval));
     }
     return $result;
 }
コード例 #3
0
ファイル: BankService.php プロジェクト: kristjanAnd/SimpleIV
 public function associateTransaction(Parameters $data)
 {
     if (isset($data->transactionId) && isset($data->invoiceId)) {
         $transaction = $this->getOneObjectByField(Transaction::getClass(), 'id', $data->transactionId);
         /* @var $transaction \Application\Entity\Transaction */
         $invoice = $this->getOneObjectByField(Invoice::getClass(), 'id', $data->invoiceId);
         /* @var $invoice \Application\Entity\Document\Invoice */
         if ($invoice && $transaction) {
             $transaction->setStatus(Transaction::STATUS_ASSOCIATED);
             $invoice->addTransaction($transaction);
             $this->saveObject($invoice);
             $this->isInvoicePaid($invoice);
             $this->saveObject($transaction);
             $this->saveObject($invoice);
             return $transaction;
         }
     }
     return null;
 }
コード例 #4
0
 public function confirmDocument(Document $invoice, User $user)
 {
     if ($invoice instanceof Invoice) {
         $numberPrefix = null;
         $numberNumber = null;
         $number = $this->settingsService->getNumberByUser($user);
         if ($number) {
             $numberNumber = $number->getStartNumber();
             $numberPrefix = $number->getPrefix();
         }
         $sysNr = $this->entityManager->getRepository(Invoice::getClass())->getNextDocumentNumber();
         $finalNumber = $numberNumber > $sysNr ? $numberNumber : $sysNr;
         $invoice->setDocumentNumber($finalNumber);
         $invoice->setPrefix($numberPrefix);
         $invoice->setFullNumber($numberPrefix . $finalNumber);
     }
     $invoice->setConfirmed(true);
     $invoice->setStatus(Invoice::STATUS_CONFIRMED);
     return $this->saveInvoice($invoice);
 }