Esempio n. 1
0
 /**
  * 
  * @return \ifirma\InvoiceBill
  */
 public function makeInvoice()
 {
     $invoice = new InvoiceBill();
     $invoice->{InvoiceBill::KEY_KONTRAHENT} = $this->_createContractorObject();
     $invoice->{InvoiceBill::KEY_FORMAT_DATY_SPRZEDAZY} = InvoiceBill::DEFAULT_VALUE_FORMAT_DATY_SPRZEDAZY;
     $invoice->{InvoiceBill::KEY_DATA_WYSTAWIENIA} = date('Y-m-d');
     $invoice->{InvoiceBill::KEY_DATA_SPRZEDAZY} = $this->_getOrderDate();
     $invoice->{InvoiceBill::KEY_ZAPLACONO} = 0;
     $invoice->{InvoiceBill::KEY_WPIS_DO_KPIR} = InvoiceBill::DEFAULT_VALUE_WPIS_DO_KPIR;
     $invoice->{InvoiceBill::KEY_UWAGI} = $this->_getOrderNumber();
     $invoice->{InvoiceBill::KEY_SPOSOB_ZAPLATY} = $this->_getPaymentType();
     foreach ($this->_order->getProducts() as $product) {
         $invoice->addInvoiceBillPosition($this->_createInvoiceBillPosition($product));
     }
     if ($this->_isNecessaryToAddShippingPosition()) {
         $invoice->addInvoiceBillPosition($this->_createInvoiceBillPositionShippingCost());
     }
     return $invoice;
 }
Esempio n. 2
0
 /**
  * 
  * @param ModelModuleInvoiceMap $invoiceMap
  * @return GetPdfInterface
  */
 private function _getInvoiceResponseObject($invoiceMap)
 {
     switch ($invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_INVOICE_TYPE]) {
         case ModelModuleInvoiceMap::INVOICE_TYPE_BILL:
             return InvoiceBill::get($invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_INVOICE_ID]);
             break;
         case ModelModuleInvoiceMap::INVOICE_TYPE_NORMAL:
             return Invoice::get($invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_INVOICE_ID]);
             break;
         case ModelModuleInvoiceMap::INVOICE_TYPE_PROFORMA:
             return InvoiceProforma::get($invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_INVOICE_ID]);
             break;
         case ModelModuleInvoiceMap::INVOICE_TYPE_SEND:
             return InvoiceSend::get($invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_INVOICE_ID]);
             break;
     }
 }
 /**
  * 
  * @param \ifirma\InvoiceAbstract $invoice
  * @throws IfirmaException
  * @return ConnectorAbstract
  */
 private static function _getInvoiceConnectorTypeBasedOnInvoice(InvoiceAbstract $invoice)
 {
     require_once dirname(__FILE__) . '/../Invoice/Invoice.php';
     require_once dirname(__FILE__) . '/../Invoice/InvoiceSend.php';
     require_once dirname(__FILE__) . '/../Invoice/InvoiceBill.php';
     require_once dirname(__FILE__) . '/../Invoice/InvoiceProforma.php';
     $invoiceType = get_class($invoice);
     switch ($invoiceType) {
         case Invoice::getType():
         case InvoiceResponse::getType():
             return new ConnectorInvoice();
             break;
         case InvoiceBill::getType():
         case InvoiceBillResponse::getType():
             return new ConnectorInvoiceBill();
             break;
         case InvoiceProforma::getType():
         case InvoiceProformaResponse::getType():
             return new ConnectorInvoiceProforma();
             break;
         case InvoiceSend::getType():
         case InvoiceSendResponse::getType():
             return new ConnectorInvoiceSend();
             break;
         default:
             throw new IfirmaException(sprintf("Unsupported invoice type: %s", $invoiceType));
             break;
     }
 }
 /**
  * 
  * @return array
  */
 public function getSupportedKeys()
 {
     return array_merge(parent::getSupportedKeys(), array(self::KEY_ZAPLACONO_NA_DOKUMENCIE, self::KEY_IDENTYFIKATOR_KONTRAHENTA, self::KEY_PREFIKS_UE_KNTRAHENTA, self::KEY_NIP_KONTRAHENTA, self::KEY_PELNY_NUMER, self::KEY_WPIS_DO_EWIDENCJI));
 }