public function makeInvoice()
 {
     $invoiceSend = new ifirma\InvoiceSend();
     $invoiceSend->{ifirma\InvoiceSend::KEY_KONTRAHENT} = $this->createContractorObject();
     $invoiceSend->{ifirma\InvoiceSend::KEY_LICZ_OD} = ifirma\InvoiceSend::DEFAULT_VALUE_LICZ_OD;
     $invoiceSend->{ifirma\InvoiceSend::KEY_FORMAT_DATY_SPRZEDAZY} = ifirma\InvoiceSend::DEFAULT_VALUE_FORMAT_DATY_SPRZEDAZY;
     $invoiceSend->{ifirma\InvoiceSend::KEY_DATA_WYSTAWIENIA} = date('Y-m-d');
     $invoiceSend->{ifirma\InvoiceSend::KEY_DATA_SPRZEDAZY} = $this->getOrderDate();
     $invoiceSend->{ifirma\InvoiceSend::KEY_ZAPLACONO} = 0;
     $invoiceSend->{ifirma\InvoiceSend::KEY_RODZAJ_PODPISU_ODBIORCY} = ifirma\InvoiceSend::DEFAULT_VALUE_RODZAJ_PODPISU_ODBIORCY;
     $invoiceSend->{ifirma\InvoiceSend::KEY_UWAGI} = $this->getOrderNumber();
     $invoiceSend->{ifirma\InvoiceSend::KEY_WIDOCZNY_NUMER_GIOS} = ifirma\InvoiceSend::DEFAULT_VALUE_WIDOCZNY_NUMER_GIOS;
     foreach ($this->getOrder()->getAllVisibleItems() as $item) {
         $invoiceSend->addInvoicePosition($this->createInvoicePosition($item));
     }
     if ($this->isNecessaryToAddShippingPosition()) {
         $invoiceSend->addInvoicePosition($this->createInvoicePositionShippingCost());
     }
     return $invoiceSend;
 }
Exemplo n.º 2
0
 private function getInvoiceResponseObject($invoiceMap)
 {
     switch ($invoiceMap->getInvoiceType()) {
         case PowerMedia_Ifirma_Model_Ifirma::TYPE_INVOICE:
             return ifirma\Invoice::get($invoiceMap->getInvoiceId());
             break;
         case PowerMedia_Ifirma_Model_Ifirma::TYPE_INVOICE_SEND:
             return ifirma\InvoiceSend::get($invoiceMap->getInvoiceId());
             break;
         case PowerMedia_Ifirma_Model_Ifirma::TYPE_INVOICE_PROFORMA:
             return ifirma\InvoiceProforma::get($invoiceMap->getInvoiceId());
             break;
         case PowerMedia_Ifirma_Model_Ifirma::TYPE_INVOICE_BILL:
             return ifirma\InvoiceBill::get($invoiceMap->getInvoiceId());
             break;
     }
 }