/**
  * 
  * @return \ifirma\InvoiceSend
  */
 public function makeInvoice()
 {
     $invoice = new InvoiceSend();
     $invoice->{InvoiceSend::KEY_KONTRAHENT} = $this->_createContractorObject();
     $invoice->{InvoiceSend::KEY_LICZ_OD} = InvoiceSend::DEFAULT_VALUE_LICZ_OD;
     $invoice->{InvoiceSend::KEY_FORMAT_DATY_SPRZEDAZY} = InvoiceSend::DEFAULT_VALUE_FORMAT_DATY_SPRZEDAZY;
     $invoice->{InvoiceSend::KEY_DATA_WYSTAWIENIA} = date('Y-m-d');
     $invoice->{InvoiceSend::KEY_DATA_SPRZEDAZY} = $this->_getOrderDate();
     $invoice->{InvoiceSend::KEY_ZAPLACONO} = 0;
     $invoice->{InvoiceSend::KEY_RODZAJ_PODPISU_ODBIORCY} = InvoiceSend::DEFAULT_VALUE_RODZAJ_PODPISU_ODBIORCY;
     $invoice->{InvoiceSend::KEY_UWAGI} = $this->_getOrderNumber();
     $invoice->{InvoiceSend::KEY_WIDOCZNY_NUMER_GIOS} = InvoiceSend::DEFAULT_VALUE_WIDOCZNY_NUMER_GIOS;
     foreach ($this->_order->getProducts() as $product) {
         $invoice->addInvoicePosition($this->_createInvoicePosition($product));
     }
     if ($this->_isNecessaryToAddShippingPosition()) {
         $invoice->addInvoicePosition($this->_createInvoicePositionShippingCost());
     }
     return $invoice;
 }
 /**
  * 
  * @return \ifirma\InvoiceSend
  */
 public function makeInvoice()
 {
     global $loader, $registry;
     $invoice = new InvoiceSend();
     $invoice->{InvoiceSend::KEY_KONTRAHENT} = $this->_createContractorObject();
     $invoice->{InvoiceSend::KEY_LICZ_OD} = InvoiceSend::DEFAULT_VALUE_LICZ_OD;
     $invoice->{InvoiceSend::KEY_FORMAT_DATY_SPRZEDAZY} = InvoiceSend::DEFAULT_VALUE_FORMAT_DATY_SPRZEDAZY;
     $invoice->{InvoiceSend::KEY_DATA_WYSTAWIENIA} = date('Y-m-d');
     $invoice->{InvoiceSend::KEY_DATA_SPRZEDAZY} = $this->_getOrderDate();
     $invoice->{InvoiceSend::KEY_ZAPLACONO} = 0;
     $invoice->{InvoiceSend::KEY_RODZAJ_PODPISU_ODBIORCY} = InvoiceSend::DEFAULT_VALUE_RODZAJ_PODPISU_ODBIORCY;
     $invoice->{InvoiceSend::KEY_UWAGI} = $this->_getOrderNumber();
     $invoice->{InvoiceSend::KEY_WIDOCZNY_NUMER_GIOS} = InvoiceSend::DEFAULT_VALUE_WIDOCZNY_NUMER_GIOS;
     $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;
 }
Example #3
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;
     }
 }
 /**
  * 
  * @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));
 }
 /**
  * 
  * @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;
     }
 }