/**
  * 
  * @return \ifirma\InvoiceProforma
  */
 public function makeInvoice()
 {
     $invoice = new InvoiceProforma();
     $invoice->{InvoiceProforma::KEY_KONTRAHENT} = $this->_createContractorObject();
     $invoice->{InvoiceProforma::KEY_SPOSOB_ZAPLATY} = $this->_getPaymentType();
     $invoice->{InvoiceProforma::KEY_LICZ_OD} = InvoiceProforma::DEFAULT_VALUE_LICZ_OD;
     $invoice->{InvoiceProforma::KEY_DATA_WYSTAWIENIA} = date('Y-m-d');
     $invoice->{InvoiceProforma::KEY_RODZAJ_PODPISU_ODBIORCY} = InvoiceProforma::DEFAULT_VALUE_RODZAJ_PODPISU_ODBIORCY;
     $invoice->{InvoiceProforma::KEY_NUMER_ZAMOWIENIA} = $this->_getRawOrderNumber();
     $invoice->{InvoiceProforma::KEY_WIDOCZNY_NUMER_GIOS} = InvoiceProforma::DEFAULT_VALUE_WIDOCZNY_NUMER_GIOS;
     $invoice->{InvoiceProforma::KEY_TYP_FAKTURY_KRAJOWEJ} = InvoiceProforma::DEFAULT_VALUE_TYP_FAKTURY_KRAJOWEJ;
     foreach ($this->_order->getProducts() as $product) {
         $invoice->addInvoicePosition($this->_createInvoicePosition($product));
     }
     if ($this->_isNecessaryToAddShippingPosition()) {
         $invoice->addInvoicePosition($this->_createInvoicePositionShippingCost());
     }
     return $invoice;
 }
 /**
  * 
  * @return \ifirma\InvoiceProforma
  */
 public function makeInvoice()
 {
     global $loader, $registry;
     $invoice = new InvoiceProforma();
     $invoice->{InvoiceProforma::KEY_KONTRAHENT} = $this->_createContractorObject();
     $invoice->{InvoiceProforma::KEY_SPOSOB_ZAPLATY} = $this->_getPaymentType();
     $invoice->{InvoiceProforma::KEY_LICZ_OD} = InvoiceProforma::DEFAULT_VALUE_LICZ_OD;
     $invoice->{InvoiceProforma::KEY_DATA_WYSTAWIENIA} = date('Y-m-d');
     $invoice->{InvoiceProforma::KEY_RODZAJ_PODPISU_ODBIORCY} = InvoiceProforma::DEFAULT_VALUE_RODZAJ_PODPISU_ODBIORCY;
     $invoice->{InvoiceProforma::KEY_NUMER_ZAMOWIENIA} = $this->_getRawOrderNumber();
     $invoice->{InvoiceProforma::KEY_WIDOCZNY_NUMER_GIOS} = InvoiceProforma::DEFAULT_VALUE_WIDOCZNY_NUMER_GIOS;
     $invoice->{InvoiceProforma::KEY_TYP_FAKTURY_KRAJOWEJ} = InvoiceProforma::DEFAULT_VALUE_TYP_FAKTURY_KRAJOWEJ;
     $loader->model('sale/order');
     $order = $registry->get('model_sale_order');
     foreach ($order->getOrderProducts($this->_order["order_id"]) as $product) {
         $invoice->addInvoicePosition($this->_createInvoicePosition($product));
     }
     if ($this->_isNecessaryToAddShippingPosition()) {
         $invoice->addInvoicePosition($this->_createInvoicePositionShippingCost($this->_order["shipping_code"], $this->_order["shipping_country_id"], $this->_order["shipping_zone_id"]));
     }
     return $invoice;
 }
 /**
  * 
  * @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));
 }
Example #4
0
 /**
  * 
  * @param \ifirma\InvoiceMap $invoiceMap
  * @return \ifirma\GetPdfInterface
  */
 private function _getInvoiceResponseObject(InvoiceMap $invoiceMap)
 {
     switch ($invoiceMap->{InvoiceMap::COLUMN_NAME_INVOICE_TYPE}) {
         case InvoiceMap::INVOICE_TYPE_BILL:
             return InvoiceBill::get($invoiceMap->{InvoiceMap::COLUMN_NAME_INVOICE_ID});
             break;
         case InvoiceMap::INVOICE_TYPE_NORMAL:
             return Invoice::get($invoiceMap->{InvoiceMap::COLUMN_NAME_INVOICE_ID});
             break;
         case InvoiceMap::INVOICE_TYPE_PROFORMA:
             return InvoiceProforma::get($invoiceMap->{InvoiceMap::COLUMN_NAME_INVOICE_ID});
             break;
         case InvoiceMap::INVOICE_TYPE_SEND:
             return InvoiceSend::get($invoiceMap->{InvoiceMap::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;
     }
 }