src/Entity/SupplierInvoices.php line 29

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping\Id;
  4. use Doctrine\ORM\Mapping\Index;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Doctrine\ORM\Mapping\Table;
  7. use Doctrine\ORM\Mapping\Column;
  8. use Doctrine\ORM\Mapping\JoinColumn;
  9. use Doctrine\ORM\Mapping\ManyToOne;
  10. use Doctrine\ORM\Mapping\OneToOne;
  11. use Doctrine\ORM\Mapping\OneToMany;
  12. use Doctrine\ORM\Mapping\GeneratedValue;
  13. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  14. use Doctrine\ORM\Mapping\PrePersist;
  15. use Doctrine\ORM\Mapping\PreUpdate;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. /**
  18.  * SupplierInvoices
  19.  */
  20. #[Entity]
  21. #[HasLifecycleCallbacks]
  22. #[Table(name'supplier_invoices')]
  23. #[Index(name'created_by_fk_idx'columns: ['created_by'])]
  24. #[Index(name'updated_by_fk_idx'columns: ['updated_by'])]
  25. #[Index(name'supplier_invoices_issuer_fk'columns: ['issuer_id'])]
  26. class SupplierInvoices
  27. {
  28.     /**
  29.      * @var integer
  30.      */
  31.     #[Column(name'invoice_id'type'integer'nullablefalse)]
  32.     #[Id]
  33.     #[GeneratedValue(strategy'IDENTITY')]
  34.     private $invoiceId;
  35.     /**
  36.      * @var string
  37.      */
  38.     #[Assert\Regex(pattern'/^[a-zA-Z0-9]*$/')]
  39.     #[Column(name'invoice_number'type'string'length100nullabletrue)]
  40.     private $invoiceNumber;
  41.     /**
  42.      * @var float
  43.      */
  44.     #[Assert\GreaterThan(0)]
  45.     #[Column(name'value'type'float'precision10scale0nullabletrue)]
  46.     private $value;
  47.     /**
  48.      * @var float
  49.      */
  50.     #[Column(name'vat_amount'type'float'precision10scale0nullabletrue)]
  51.     private $vatAmount;
  52.     /**
  53.      * @var float
  54.      */
  55.     #[Assert\Regex(pattern'/^[+]?([.]\d+|\d+([.]\d+)?)$/'message'not Valid')]
  56.     #[Assert\GreaterThan(0)]
  57.     #[Column(name'total'type'float'precision10scale0nullabletrue)]
  58.     private $total;
  59.     /**
  60.      * @var boolean
  61.      */
  62.     #[Column(name'is_payed'type'boolean'nullabletrue)]
  63.     private $isPayed;
  64.     /**
  65.      * @var \DateTime
  66.      */
  67.     #[Column(name'payment_date'type'date'nullabletrue)]
  68.     private $paymentDate;
  69.     /**
  70.      * @var string
  71.      */
  72.     #[Column(name'payment_type'type'string'nullabletruecolumnDefinition"enum('Cash','Check','Transfer','Mada')")]
  73.     private $paymentType;
  74.     
  75.     /**
  76.      * available payment types
  77.      */
  78.     const PAYMENT_TYPES = [
  79.         'Cash'     => 'Cash',
  80.         'Check'    => 'Check',
  81.         'Transfer' => 'Transfer',
  82.         'Mada'     => 'Mada'
  83.     ];
  84.     /**
  85.      * @var string
  86.      */
  87.     #[Column(name'image_path'type'string'length100nullabletrue)]
  88.     private $imagePath;
  89.     
  90.     /**
  91.      * @var \Companies
  92.      */
  93.     #[ManyToOne(targetEntity\Companies::class)]
  94.     #[JoinColumn(name'issuer_id'referencedColumnName'company_id')]
  95.     private $issuer;
  96.     
  97.     /**
  98.      * @var \RtsInvoice
  99.      *
  100.      *
  101.      */
  102.     #[OneToOne(targetEntity\VehicleRtsActivitiesInvoices::class, cascade: ['persist'], mappedBy'supplierInvoice')]
  103.     private $rtsInvoice;
  104.     
  105.     /**
  106.      * @var \vehicleBeneficiary
  107.      */
  108.     #[OneToOne(targetEntity\VehicleBeneficiaryDetails::class, cascade: ['all'], mappedBy'purchaseInvoice')]
  109.     private $vehicleBeneficiary;
  110.     
  111.     /**
  112.      * @var \otInvoice
  113.      */
  114.     #[OneToOne(targetEntity\VehicleOwnershipTransferInvoices::class, cascade: ['all'], mappedBy'supplierInvoice')]
  115.     private $otInvoice;
  116.     /**
  117.      * @var \otInvoice
  118.      */
  119.     #[OneToOne(targetEntity\VehicleRepairInvoices::class, cascade: ['all'], mappedBy'supplierInvoice')]
  120.     private $vehicleRepairInvoice;
  121.     
  122.     /**
  123.      * @var string
  124.      *
  125.      */
  126.     private $imageWebPath;
  127.     /**
  128.      * @var invoice
  129.      */
  130.     #[OneToOne(targetEntity\Invoices::class, mappedBy'supplierInvoice'cascade: ['persist'])]
  131.     #[Assert\Valid]
  132.     private $invoice;
  133.     
  134.     /**
  135.      * @var trafficViolation
  136.      */
  137.     #[OneToOne(targetEntity\VehicleTrafficViolations::class, mappedBy'supplierInvoice'cascade: ['persist'])]
  138.     private $trafficViolation;
  139.     /**
  140.      * @var \DateTime
  141.      */
  142.     #[Column(name'created_at'type'datetime'nullabletrue)]
  143.     private $createdAt;
  144.     /**
  145.      * @var \Users
  146.      */
  147.     #[ManyToOne(targetEntity\Users::class)]
  148.     #[JoinColumn(name'created_by'referencedColumnName'user_id')]
  149.     private $createdBy;
  150.     /**
  151.      * @var \DateTime
  152.      */
  153.     #[Column(name'updated_at'type'datetime'nullabletrue)]
  154.     private $updatedAt;
  155.     /**
  156.      * @var Users
  157.      */
  158.     #[ManyToOne(targetEntity\Users::class)]
  159.     #[JoinColumn(name'updated_by'referencedColumnName'user_id')]
  160.     private $updatedBy;
  161.     /**
  162.      * @var VatRate
  163.      */
  164.     #[ManyToOne(targetEntity\VatRate::class)]
  165.     #[JoinColumn(name'vat_rate_id'referencedColumnName'vat_rate_id')]
  166.     private $vatRate;
  167.     /**
  168.      * Get invoiceId
  169.      *
  170.      * @return integer
  171.      */
  172.     public function getInvoiceId()
  173.     {
  174.         return $this->invoiceId;
  175.     }
  176.     /**
  177.      * Set invoiceNumber
  178.      *
  179.      * @param string $invoiceNumber
  180.      *
  181.      * @return SupplierInvoices
  182.      */
  183.     public function setInvoiceNumber($invoiceNumber)
  184.     {
  185.         $this->invoiceNumber $invoiceNumber;
  186.         return $this;
  187.     }
  188.     /**
  189.      * Get invoiceNumber
  190.      *
  191.      * @return string
  192.      */
  193.     public function getInvoiceNumber()
  194.     {
  195.         return $this->invoiceNumber;
  196.     }
  197.     /**
  198.      * Set value
  199.      *
  200.      * @param float $value
  201.      *
  202.      * @return Invoices
  203.      */
  204.     public function setValue($value)
  205.     {
  206.         $this->value $value;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get value
  211.      *
  212.      * @return float
  213.      */
  214.     public function getValue()
  215.     {
  216.         return $this->value;
  217.     }
  218.     /**
  219.      * Set vatAmount
  220.      *
  221.      * @param float $vatAmount
  222.      *
  223.      * @return Invoices
  224.      */
  225.     public function setVatAmount($vatAmount)
  226.     {
  227.         $this->vatAmount $vatAmount;
  228.         return $this;
  229.     }
  230.     /**
  231.      * Get vatAmount
  232.      *
  233.      * @return float
  234.      */
  235.     public function getVatAmount()
  236.     {
  237.         return $this->vatAmount;
  238.     }
  239.     /**
  240.      * Set total
  241.      *
  242.      * @param float $total
  243.      *
  244.      * @return Invoices
  245.      */
  246.     public function setTotal($total)
  247.     {
  248.         $this->total $total;
  249.         return $this;
  250.     }
  251.     /**
  252.      * Get total
  253.      *
  254.      * @return float
  255.      */
  256.     public function getTotal()
  257.     {
  258.         return $this->total;
  259.     }
  260.     /**
  261.      * Set isPayed
  262.      *
  263.      * @param boolean $isPayed
  264.      *
  265.      * @return SupplierInvoices
  266.      */
  267.     public function setIsPayed($isPayed)
  268.     {
  269.         $this->isPayed $isPayed;
  270.         return $this;
  271.     }
  272.     /**
  273.      * Get isPayed
  274.      *
  275.      * @return boolean
  276.      */
  277.     public function getIsPayed()
  278.     {
  279.         return $this->isPayed;
  280.     }
  281.     /**
  282.      * Set paymentDate
  283.      *
  284.      * @param \DateTime $paymentDate
  285.      *
  286.      * @return SupplierInvoices
  287.      */
  288.     public function setPaymentDate($paymentDate)
  289.     {
  290.         $this->paymentDate $paymentDate;
  291.         return $this;
  292.     }
  293.     /**
  294.      * Get paymentDate
  295.      *
  296.      * @return \DateTime
  297.      */
  298.     public function getPaymentDate()
  299.     {
  300.         return $this->paymentDate;
  301.     }
  302.     /**
  303.      * Set paymentType
  304.      *
  305.      * @param string $paymentType
  306.      *
  307.      * @return SupplierInvoices
  308.      */
  309.     public function setPaymentType($paymentType)
  310.     {
  311.         $this->paymentType $paymentType;
  312.         return $this;
  313.     }
  314.     /**
  315.      * Get paymentType
  316.      *
  317.      * @return string
  318.      */
  319.     public function getPaymentType()
  320.     {
  321.         return $this->paymentType;
  322.     }
  323.     /**
  324.      * Set imagePath
  325.      *
  326.      * @param string $imagePath
  327.      *
  328.      * @return SupplierInvoices
  329.      */
  330.     public function setImagePath($imagePath)
  331.     {
  332.         $this->imagePath $imagePath;
  333.         return $this;
  334.     }
  335.     /**
  336.      * Get imagePath
  337.      *
  338.      * @return string
  339.      */
  340.     public function getImagePath()
  341.     {
  342.         return $this->imagePath;
  343.     }
  344.     
  345.     /**
  346.      * Set rtsInvoice
  347.      *
  348.      *
  349.      * @return SupplierInvoices
  350.      */
  351.     public function setRtsInvoice(VehicleRtsActivitiesInvoices $rtsInvoice)
  352.     {
  353.         $this->rtsInvoice $rtsInvoice;
  354.         //$this->rtsInvoice->setRtsInvoiceId($this->invoiceId);
  355.         return $this;
  356.     }
  357.     /**
  358.      * Get rtsInvoice
  359.      *
  360.      * @return \RtsInvoice
  361.      */
  362.     public function getRtsInvoice()
  363.     {
  364.         return $this->rtsInvoice;
  365.     }
  366.     /**
  367.      * Set vehicleBeneficiary
  368.      *
  369.      *
  370.      * @return SupplierInvoices
  371.      */
  372.     public function setVehicleBeneficiary(VehicleBeneficiaryDetails $purchaseInvoicenull)
  373.     {
  374.         $this->vehicleBeneficiary $purchaseInvoice;
  375.         return $this;
  376.     }
  377.     /**
  378.      * Get vehicleBeneficiary
  379.      *
  380.      * @return VehicleBeneficiaryDetails
  381.      */
  382.     public function getVehicleBeneficiary()
  383.     {
  384.         return $this->vehicleBeneficiary;
  385.     }
  386.     /**
  387.      * Set otInvoice
  388.      *
  389.      *
  390.      * @return SupplierInvoices
  391.      */
  392.     public function setOtInvoice(VehicleOwnershipTransferInvoices $otInvoicenull)
  393.     {
  394.         $this->otInvoice $otInvoice;
  395.         return $this;
  396.     }
  397.     /**
  398.      * Get otInvoice
  399.      *
  400.      * @return VehicleOwnershipTransferInvoices
  401.      */
  402.     public function getOtInvoice()
  403.     {
  404.         return $this->otInvoice;
  405.     }
  406.     /**
  407.      * Set otInvoice
  408.      *
  409.      *
  410.      * @return SupplierInvoices
  411.      */
  412.     public function setVehicleRepairInvoice(VehicleRepairInvoices $vehicleRepairInvoicenull)
  413.     {
  414.         $this->vehicleRepairInvoice $vehicleRepairInvoice;
  415.         return $this;
  416.     }
  417.     /**
  418.      * Get otInvoice
  419.      *
  420.      * @return VehicleRepairInvoices
  421.      */
  422.     public function getVehicleRepairInvoice()
  423.     {
  424.         return $this->vehicleRepairInvoice;
  425.     }
  426.     /**
  427.      * Set imagePath
  428.      *
  429.      * @param string $imageWebPath
  430.      *
  431.      * @return SupplierInvoices
  432.      */
  433.     public function setImageWebPath($imageWebPath)
  434.     {
  435.         $this->imageWebPath $imageWebPath;
  436.     }
  437.     /**
  438.      * Get imageWebPath
  439.      *
  440.      * @return string
  441.      */
  442.     public function getImageWebPath()
  443.     {
  444.         return $this->imageWebPath;
  445.     }
  446.     /**
  447.      * set invoice
  448.      *
  449.      *
  450.      * @return SupplierInvoices
  451.      */
  452.     public function setInvoice(Invoices $invoice null)
  453.     {
  454.         $this->invoice$invoice;
  455.         
  456.         return $this;
  457.     }
  458.     /**
  459.      * Get invoice
  460.      *
  461.      * @return \App\Entity\Invoices
  462.      */
  463.     public function getInvoice()
  464.     {
  465.         return $this->invoice;
  466.     }
  467.     /**
  468.      * Set issuer
  469.      *
  470.      *
  471.      * @return SupplierInvoices
  472.      */
  473.     public function setIssuer(\App\Entity\Companies $issuer null)
  474.     {
  475.         $this->issuer $issuer;
  476.         return $this;
  477.     }
  478.     /**
  479.      * Get issuer
  480.      *
  481.      * @return \App\Entity\Companies
  482.      */
  483.     public function getIssuer()
  484.     {
  485.         return $this->issuer;
  486.     }
  487.     /**
  488.      * set trafficViolation
  489.      *
  490.      *
  491.      * @return SupplierInvoices
  492.      */
  493.     public function setTrafficViolation(VehicleTrafficViolations $trafficViolation null)
  494.     {
  495.         $this->trafficViolation$trafficViolation;
  496.         
  497.         return $this;
  498.     }
  499.     /**
  500.      * Get trafficViolation
  501.      *
  502.      * @return \VehicleTrafficViolations
  503.      */
  504.     public function getTrafficViolation()
  505.     {
  506.         return $this->trafficViolation;
  507.     }
  508.     /**
  509.      * Set createdAt
  510.      *
  511.      * @param \DateTime $createdAt
  512.      *
  513.      * @return SupplierInvoices
  514.      */
  515.     public function setCreatedAt($createdAt)
  516.     {
  517.         $this->createdAt $createdAt;
  518.         return $this;
  519.     }
  520.     /**
  521.      * Get createdAt
  522.      *
  523.      * @return \DateTime
  524.      */
  525.     public function getCreatedAt()
  526.     {
  527.         return $this->createdAt;
  528.     }
  529.     /**
  530.      * Set createdBy
  531.      *
  532.      *
  533.      * @return SupplierInvoices
  534.      */
  535.     public function setCreatedBy(Users $createdBy null)
  536.     {
  537.         $this->createdBy $createdBy;
  538.         return $this;
  539.     }
  540.     /**
  541.      * Get createdBy
  542.      *
  543.      * @return \Users
  544.      */
  545.     public function getCreatedBy()
  546.     {
  547.         return $this->createdBy;
  548.     }
  549.     /**
  550.      * Set updatedAt
  551.      *
  552.      * @param \DateTime $updatedAt
  553.      *
  554.      * @return SupplierInvoices
  555.      */
  556.     public function setUpdatedAt($updatedAt)
  557.     {
  558.         $this->updatedAt $updatedAt;
  559.         return $this;
  560.     }
  561.     /**
  562.      * Get updatedAt
  563.      *
  564.      * @return \DateTime
  565.      */
  566.     public function getUpdatedAt()
  567.     {
  568.         return $this->updatedAt;
  569.     }
  570.     /**
  571.      * Set updatedBy
  572.      *
  573.      *
  574.      * @return SupplierInvoices
  575.      */
  576.     public function setUpdatedBy(Users $updatedBy null)
  577.     {
  578.         $this->updatedBy $updatedBy;
  579.         return $this;
  580.     }
  581.     /**
  582.      * Get updatedBy
  583.      *
  584.      * @return Users
  585.      */
  586.     public function getUpdatedBy()
  587.     {
  588.         return $this->updatedBy;
  589.     }
  590.     /**
  591.      * Set vatRate
  592.      *
  593.      *
  594.      * @return SupplierInvoices
  595.      */
  596.     public function setVatRate(VatRate $vatRate null)
  597.     {
  598.         $this->vatRate $vatRate;
  599.         return $this;
  600.     }
  601.     /**
  602.      * Get vatRate
  603.      *
  604.      * @return VatRate
  605.      */
  606.     public function getVatRate()
  607.     {
  608.         return $this->vatRate;
  609.     }
  610.     #[PrePersist]
  611.     public function prePersist() {
  612.         if ($this->getCreatedAt() == null) {
  613.             $this->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
  614.         }
  615.     }
  616.     #[PreUpdate]
  617.     public function preUpdate() {
  618.         $this->setUpdatedAt(new \DateTime(date('Y-m-d H:i:s')));
  619.     }
  620. }