/**
  * 
  * @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;
 }