123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- /**
- * 2007-2021 PrestaShop
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License (AFL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/afl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@prestashop.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
- * versions in the future. If you wish to customize PrestaShop for your
- * needs please refer to http://www.prestashop.com for more information.
- *
- * @author PrestaShop SA <contact@prestashop.com>
- * @copyright 2007-2021 PrestaShop SA
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- * International Registered Trademark & Property of PrestaShop SA
- */
- namespace Core\App\Factory;
- class InvoiceFactory extends OrderFactory
- {
- public function createInvoice(
- $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\Invoice();
- $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;
- }
- }
|