123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace Core\App\Factory;
- class ProformaFactory extends OrderFactory
- {
- public function createProforma(
- $facturi_serie,
- $order_id,
- $created_date,
- $currency,
- $customer_id,
- $customer_first_name,
- $customer_last_name,
- $billing_company,
- $email,
- $billing_address_first_name,
- $billing_address_last_name,
- $billing_address_address1,
- $billing_address_address2,
- $billing_address_zip,
- $billing_address_city,
- $billing_address_province,
- $billing_address_phone,
-
- $shipping_address_first_name,
- $shipping_address_last_name,
- $shipping_address_address1,
- $shipping_address_address2,
- $shipping_address_zip,
- $shipping_address_city,
- $shipping_address_province,
- $shipping_address_phone,
- $payment_method,
- $comments,
- $fiscal_code,
- $company,
- $nr_inreg,
- $facturi_cont_client,
- $facturi_banca_client,
- $taxRate
- )
- {
-
- $proforma = new \Core\App\Entity\Proforma();
- $proforma->setFacturiData(date('Y-m-d H:i:s', strtotime($created_date)));
- $proforma->setFacturiDataScadenta(date('Y-m-d H:i:s', strtotime($created_date)));
- $proforma->setFacturiCotaTva($this->getTaxName($taxRate));
- $proforma->setFacturiMoneda($currency);
- $proforma->setFacturiSerie($facturi_serie);
- $proforma->setFacturiObsUp($this->getObs($order_id, $shipping_address_first_name, $shipping_address_last_name, $shipping_address_phone, $billing_address_phone, $comments));
- $proforma->setFacturiModPlata($payment_method);
- $proforma->setFacturiStatus('Emisa');
- $proforma->setFacturiClientId($customer_id);
- $proforma->setFacturiNumeClient($this->getPaymentName($customer_first_name, $customer_last_name, $billing_address_first_name, $billing_address_last_name, $billing_company, $company));
- $proforma->setFacturiTipPersoana(!empty($fiscal_code) ? 'juridica' : 'fizica');
- $proforma->setFacturiCodfClient($fiscal_code);
- $proforma->setFacturiNrregClient($nr_inreg);
- $proforma->setFacturiSediuClient($this->getPaymentAddress($billing_address_address1, $billing_address_address2, $billing_address_zip));
- $proforma->setFacturiJudetClient($this->stripSpecialChars($billing_address_province));
- $proforma->setFacturiOrasClient($this->stripSpecialChars($billing_address_city));
- $proforma->setFacturiClientiTel($billing_address_phone);
- $proforma->setFacturiEmailClient($email);
- $proforma->setFacturiClientiAdresaLivrare($this->getShippingAddress($shipping_address_address1, $shipping_address_address2, $shipping_address_zip));
- $proforma->setFacturiContClient($facturi_cont_client);
- $proforma->setFacturiBancaClient($facturi_banca_client);
- $proforma->setFacturiObsClient('Id extern client: ' . $customer_id);
- $proforma->setFacturiClientiOrasLivrare($this->stripSpecialChars($shipping_address_city));
- $proforma->setFacturiClientiJudetLivrare($this->stripSpecialChars($shipping_address_province));
- $proforma->setUniqueIdInsert($this->getPrefix() . $facturi_serie . '_' . $customer_id . '_' . $order_id . '_' . strtotime($created_date));
- return $proforma;
- }
- }
|