ProformaItemFactory.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Core\App\Factory;
  3. class ProformaItemFactory extends OrderItemFactory
  4. {
  5. public function createProformaProduct(
  6. $product_ids,
  7. $product_name,
  8. $ean,
  9. $sku,
  10. $currency_code,
  11. $price,
  12. $taxRate,
  13. $quantity,
  14. $taxIncluded = false
  15. )
  16. {
  17. $proformaProduct = new \Core\App\Entity\OrderItem();
  18. $taxRate = $this->getTaxRate($taxRate) ;
  19. $pretFtva = $this->getPretftva($price, $taxRate, 0, $taxIncluded);
  20. $pretCtva = $this->getPretctva($price, $taxRate, 0, $taxIncluded);
  21. $proformaProduct->setFacturiProdNume($this->stripSpecialChars($product_name));
  22. $proformaProduct->setFacturiProdMoneda($currency_code);
  23. $proformaProduct->setFacturiProdPretftva($pretFtva);
  24. $proformaProduct->setFacturiProdPretctva($pretCtva);
  25. $proformaProduct->setFacturiProdTva($this->getTaxName($taxRate));
  26. $proformaProduct->setFacturiProdCant($quantity);
  27. $proformaProduct->setFacturiProdVal($pretFtva * $quantity);
  28. $proformaProduct->setFacturiProdValTva(($pretCtva - $pretFtva) * $quantity);
  29. $proformaProduct->setFacturiProdValTot($pretCtva * $quantity);
  30. $proformaProduct->setFacturiProdUm(self::UM);
  31. $proformaProduct->setProdCod($ean);
  32. $proformaProduct->setProdSku($sku);
  33. $proformaProduct->setProdCod1($this->getPrefix().$product_ids);
  34. $proformaProduct->setProdCodCautare('all');
  35. return $proformaProduct;
  36. }
  37. }