src/AtechNet/CoreBundle/Entity/Document.php line 29

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Event\PreUpdateEventArgs;
  6. use Doctrine\ORM\Mapping\Column;
  7. use Doctrine\ORM\Mapping\Entity;
  8. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  9. use Doctrine\ORM\Mapping\JoinColumn;
  10. use Doctrine\ORM\Mapping\JoinTable;
  11. use Doctrine\ORM\Mapping\ManyToMany;
  12. use Doctrine\ORM\Mapping\ManyToOne;
  13. use Doctrine\ORM\Mapping\OneToMany;
  14. use Doctrine\ORM\Mapping\OneToOne;
  15. use Doctrine\ORM\Mapping\OrderBy;
  16. use Doctrine\ORM\Mapping\PrePersist;
  17. use Doctrine\ORM\Mapping\PreUpdate;
  18. use Doctrine\ORM\Mapping\Table as Table;
  19. /**
  20.  * Document
  21.  *
  22.  * @Table(name="documents")
  23.  * @Entity(repositoryClass="App\AtechNet\CoreBundle\Repository\DocumentRepository")
  24.  * @HasLifecycleCallbacks
  25.  */
  26. class Document extends AbstractSignedEntity
  27. {
  28.     public const int STATUS_NEW = 1;
  29.     public const int STATUS_PAID = 2;
  30.     public const int STATUS_POST_DUE_DATE = 3;
  31.     public const int STATUS_CANCELLED = 4;
  32.     public const int STATUS_ACCEPTED = 5;
  33.     public const int STATUS_DECLINED = 6;
  34.     public const int STATUS_OVERPAID = 7;
  35.     public const int STATUS_PARTIAL = 8;
  36.     public const int STATUS_NEEDS_ATTENTION = 9;
  37.     public const int LOCKED_AFTER_DAY_OF_MONTH = 5;
  38.     public const int LOCKED_AFTER_DAYS = 1;
  39.     public const array DOCUMENT_TYPE_TO_LOCK = [
  40.         DocumentGroup::TYPE_INVOICE_OUT,
  41.         DocumentGroup::TYPE_INVOICE_CREDIT_NOTE,
  42.     ];
  43.     public const int HU_COMPANY_ADDED_PROFIT_PERCENT = 70;
  44.     public const string ERP_TYPE_KISGEP = 'kisgép';
  45.     public const string ERP_TYPE_NAGYGEP = 'nagygép';
  46.     public const string ERP_TYPE_KEPERNYO = 'képernyő, monitor';
  47.     public const string ERP_TYPE_ELEM = 'elem, akkumulátor';
  48.     public const string ERP_TYPE_ELECTROMOS = 'elektromos, elektronikus berendezések';
  49.     public const string ERP_TYPE_KIS_BERENDEZESEK = 'kisméretű számítástechnikai és távközlési berendezések';
  50.     public const string KSH_TYPE_SMARTPHONE_TABLET = 'Mobil / smartphone-tablet';
  51.     public const string KSH_TYPE_MONITOR = 'Monitor';
  52.     public const string KSH_TYPE_NOTEBOOK = 'Notebook';
  53.     public const string KSH_TYPE_PC = 'PC';
  54.     /**
  55.      * @return string[]
  56.      */
  57.     public static function getCurrencyConvertCodes(): array
  58.     {
  59.         return [
  60.             '€'  => 'EUR',
  61.             'Ft' => 'HUF',
  62.             'Kč' => 'CZK',
  63.         ];
  64.     }
  65.     /**
  66.      * @return string[]
  67.      */
  68.     public static function getCurrencyCodeChoices(): array
  69.     {
  70.         return [
  71.             'EUR' => 'EUR',
  72.             'USD' => 'USD',
  73.             'CZK' => 'CZK',
  74.             'HUF' => 'HUF',
  75.             'GBP' => 'GBP',
  76.             'PLN' => 'PLN',
  77.             'SEK' => 'SEK',
  78.         ];
  79.     }
  80.     /**
  81.      * @return array
  82.      */
  83.     public static function getStatusChoices(): array
  84.     {
  85.         return [
  86.             self::STATUS_NEW             => 'Not paid',
  87.             self::STATUS_PAID            => 'Paid',
  88.             self::STATUS_POST_DUE_DATE   => 'Post due date',
  89.             self::STATUS_CANCELLED       => 'Cancelled',
  90.             self::STATUS_ACCEPTED        => 'Accepted',
  91.             self::STATUS_DECLINED        => 'Declined',
  92.             self::STATUS_OVERPAID        => 'Overpaid',
  93.             self::STATUS_PARTIAL         => 'Partial',
  94.             self::STATUS_NEEDS_ATTENTION => 'Needs attention',
  95.         ];
  96.     }
  97.     /**
  98.      * @param int $type
  99.      * @return array
  100.      */
  101.     public static function getStatusChoicesForType($type): array
  102.     {
  103.         $keys = [];
  104.         switch ($type) {
  105.             case DocumentGroup::TYPE_INVOICE_PRE:
  106.                 $keys = [
  107.                     self::STATUS_NEW,
  108.                     self::STATUS_POST_DUE_DATE,
  109.                     self::STATUS_PAID,
  110.                     self::STATUS_CANCELLED,
  111.                     self::STATUS_NEEDS_ATTENTION,
  112.                 ];
  113.                 break;
  114.             case DocumentGroup::TYPE_INVOICE_IN:
  115.             case DocumentGroup::TYPE_INVOICE_OUT:
  116.             case DocumentGroup::TYPE_INVOICE_CREDIT_NOTE:
  117.             case DocumentGroup::TYPE_BILL_OF_DELIVERY:
  118.                 $keys = [
  119.                     self::STATUS_NEW,
  120.                     self::STATUS_POST_DUE_DATE,
  121.                     self::STATUS_OVERPAID,
  122.                     self::STATUS_PARTIAL,
  123.                     self::STATUS_PAID,
  124.                     self::STATUS_NEEDS_ATTENTION,
  125.                 ];
  126.                 break;
  127.             case DocumentGroup::TYPE_PRICE_OFFER:
  128.                 $keys = [
  129.                     self::STATUS_NEW,
  130.                     self::STATUS_ACCEPTED,
  131.                     self::STATUS_DECLINED,
  132.                     self::STATUS_NEEDS_ATTENTION,
  133.                 ];
  134.                 break;
  135.         }
  136.         $result = [];
  137.         foreach ($keys as $k) {
  138.             $result[$k] = self::getStatusChoices()[$k];
  139.         }
  140.         return $result;
  141.     }
  142.     /**
  143.      * @param int $status
  144.      * @return string
  145.      */
  146.     public static function getLabelClassForStatus(): array
  147.     {
  148.         return [
  149.             self::STATUS_NEW             => "primary",
  150.             self::STATUS_PAID            => "success",
  151.             self::STATUS_POST_DUE_DATE   => "info",
  152.             self::STATUS_ACCEPTED        => "info",
  153.             self::STATUS_PARTIAL         => "info",
  154.             self::STATUS_CANCELLED       => "danger",
  155.             self::STATUS_NEEDS_ATTENTION => "warning",
  156.             self::STATUS_DECLINED        => "warning",
  157.             self::STATUS_OVERPAID        => "warning",
  158.         ];
  159.     }
  160.     /**
  161.      * @var DocumentGroup
  162.      *
  163.      * @ManyToOne(targetEntity="DocumentGroup", inversedBy="documents")
  164.      * @JoinColumn(name="group_id", referencedColumnName="id", nullable=false)
  165.      */
  166.     private $group;
  167.     /**
  168.      * @var ?Order
  169.      *
  170.      * @ManyToOne(targetEntity="Order", inversedBy="documents")
  171.      * @JoinColumn(name="order_id", referencedColumnName="id", nullable=true)
  172.      */
  173.     private $order;
  174.     /**
  175.      * @var ?Document
  176.      *
  177.      * @OneToOne(targetEntity="Document")
  178.      * @JoinColumn(name="related_document_id", referencedColumnName="id", nullable=true)
  179.      */
  180.     private $relatedDocument;
  181.     /**
  182.      * @var ArrayCollection
  183.      *
  184.      * @ManyToMany(targetEntity="Document", inversedBy="relatedDocuments")
  185.      * @JoinTable(
  186.      *  name="documents_related",
  187.      *  joinColumns={
  188.      *      @JoinColumn(name="document_id", referencedColumnName="id")
  189.      *  },
  190.      *  inverseJoinColumns={
  191.      *      @JoinColumn(name="related_id", referencedColumnName="id")
  192.      *  })
  193.      */
  194.     private $initialDocuments;
  195.     /**
  196.      * @var ArrayCollection
  197.      *
  198.      * @ManyToMany(targetEntity="Document", mappedBy="initialDocuments")
  199.      * @OrderBy({"created" = "DESC"})
  200.      */
  201.     private $relatedDocuments;
  202.     /**
  203.      * @var StockMovement
  204.      *
  205.      * @ManyToOne(targetEntity="StockMovement", inversedBy="documents")
  206.      * @JoinColumn(name="stock_movement_id", referencedColumnName="id", nullable=true)
  207.      */
  208.     private $stockMovement;
  209.     /**
  210.      * @var Customer
  211.      *
  212.      * @ManyToOne(targetEntity="Customer", inversedBy="documents")
  213.      * @JoinColumn(name="customer_id", referencedColumnName="id", nullable=false)
  214.      */
  215.     private $customer;
  216.     /**
  217.      * GROUP_PREFIX + GROUP_NEXT_ID (GROUP_ID_LENGTH)
  218.      * example: 02000001
  219.      * Number of zeros after prefix(02) depends on GROUP_ID_LENTH
  220.      *
  221.      * @var string
  222.      *
  223.      * @Column(name="code", type="string", length=32)
  224.      */
  225.     private $code;
  226.     /**
  227.      * @var \DateTime
  228.      *
  229.      * @Column(name="created_date", type="datetime", nullable=false)
  230.      */
  231.     private $createdDate;
  232.     /**
  233.      * @var string
  234.      *
  235.      * @Column(name="due_in_days", type="integer")
  236.      */
  237.     private $dueInDays;
  238.     /**
  239.      * @var \DateTime
  240.      *
  241.      * @Column(name="due_date", type="datetime", nullable=false)
  242.      */
  243.     private $dueDate;
  244.     /**
  245.      * @var \DateTime
  246.      *
  247.      * @Column(name="chargeability_date", type="datetime", nullable=false)
  248.      */
  249.     private $chargeabilityDate;
  250.     /**
  251.      * @var integer
  252.      *
  253.      * @Column(name="payment_type_id", type="integer")
  254.      */
  255.     private $paymentType;
  256.     /**
  257.      * @var integer
  258.      *
  259.      * @Column(name="shipping_type_id", type="integer")
  260.      */
  261.     private $shippingType;
  262.     /**
  263.      * @var int
  264.      *
  265.      * @Column(name="variable_symbol", type="string", length=32)
  266.      */
  267.     private $variableSymbol;
  268.     /**
  269.      * @var string
  270.      *
  271.      * @Column(name="external_number", type="string", length=40, nullable=true)
  272.      */
  273.     private $externalNumber;
  274.     /**
  275.      * @var int
  276.      *
  277.      * @Column(name="constant_symbol", type="integer")
  278.      */
  279.     private $constantSymbol;
  280.     /**
  281.      * @var string
  282.      *
  283.      * @Column(name="business_name", type="string", length=128, nullable=true)
  284.      */
  285.     private $businessName;
  286.     /**
  287.      * @var string
  288.      *
  289.      * @Column(name="degree", type="string", length=32, nullable=true)
  290.      */
  291.     private $degree;
  292.     /**
  293.      * @var string
  294.      *
  295.      * @Column(name="first_name", type="string", length=64)
  296.      */
  297.     private $firstName;
  298.     /**
  299.      * @var string
  300.      *
  301.      * @Column(name="last_name", type="string", length=64)
  302.      */
  303.     private $lastName;
  304.     /**
  305.      * @var string
  306.      *
  307.      * @Column(name="street", type="string", length=128)
  308.      */
  309.     private $street;
  310.     /**
  311.      * @var string
  312.      *
  313.      * @Column(name="city", type="string", length=128)
  314.      */
  315.     private $city;
  316.     /**
  317.      * @var string
  318.      *
  319.      * @Column(name="zip", type="string", length=16)
  320.      */
  321.     private $zip;
  322.     /**
  323.      * @var string
  324.      *
  325.      * @Column(name="country", type="string", length=2)
  326.      */
  327.     private $country;
  328.     /**
  329.      * @var string
  330.      *
  331.      * @Column(name="email", type="string", length=255, nullable=true)
  332.      */
  333.     private $email;
  334.     /**
  335.      * @var string
  336.      *
  337.      * @Column(name="email_sent", type="string", length=255, nullable=true)
  338.      */
  339.     private $emailSent;
  340.     /**
  341.      * @var string
  342.      *
  343.      * @Column(name="phone", type="string", length=32, nullable=true)
  344.      */
  345.     private $phone;
  346.     /**
  347.      * @var string
  348.      *
  349.      * @Column(name="business_id", type="string", length=24, nullable=true)
  350.      */
  351.     private $businessId;
  352.     /**
  353.      * @var string
  354.      *
  355.      * @Column(name="tax_id", type="string", length=24, nullable=true)
  356.      */
  357.     private $taxId;
  358.     /**
  359.      * @var string
  360.      *
  361.      * @Column(name="vat_id", type="string", length=24, nullable=true)
  362.      */
  363.     private $vatId;
  364.     /**
  365.      * @var float
  366.      *
  367.      * @Column(name="vat", type="decimal", precision=10, scale=2)
  368.      */
  369.     private $vat;
  370.     /**
  371.      * @var bool
  372.      *
  373.      * @Column(name="ship_address_same", type="boolean")
  374.      */
  375.     private $shipAddressSame = true;
  376.     /**
  377.      * @var string
  378.      *
  379.      * @Column(name="ship_business_name", type="string", length=128, nullable=true)
  380.      */
  381.     private $shipBusinessName;
  382.     /**
  383.      * @var string
  384.      *
  385.      * @Column(name="ship_degree", type="string", length=32, nullable=true, nullable=true)
  386.      */
  387.     private $shipDegree;
  388.     /**
  389.      * @var string
  390.      *
  391.      * @Column(name="ship_first_name", type="string", length=64, nullable=true)
  392.      */
  393.     private $shipFirstName;
  394.     /**
  395.      * @var string
  396.      *
  397.      * @Column(name="ship_last_name", type="string", length=64, nullable=true)
  398.      */
  399.     private $shipLastName;
  400.     /**
  401.      * @var string
  402.      *
  403.      * @Column(name="ship_street", type="string", length=128, nullable=true)
  404.      */
  405.     private $shipStreet;
  406.     /**
  407.      * @var string
  408.      *
  409.      * @Column(name="ship_city", type="string", length=128, nullable=true)
  410.      */
  411.     private $shipCity;
  412.     /**
  413.      * @var string
  414.      *
  415.      * @Column(name="ship_zip", type="string", length=16, nullable=true)
  416.      */
  417.     private $shipZip;
  418.     /**
  419.      * @var string
  420.      *
  421.      * @Column(name="ship_country", type="string", length=2, nullable=true)
  422.      */
  423.     private $shipCountry;
  424.     /**
  425.      * @var string
  426.      *
  427.      * @Column(name="ship_phone", type="string", length=32, nullable=true)
  428.      */
  429.     private $shipPhone;
  430.     /**
  431.      * @var string
  432.      *
  433.      * @Column(name="attachment", type="string", length=512)
  434.      */
  435.     private $attachment;
  436.     /**
  437.      * @var float
  438.      *
  439.      * @Column(name="total_price", type="decimal", precision=10, scale=2)
  440.      */
  441.     private $totalPrice = 0;
  442.     /**
  443.      * @var float
  444.      *
  445.      * @Column(name="total_vat_price", type="decimal", precision=10, scale=2)
  446.      */
  447.     private $totalVatPrice = 0;
  448.     /**
  449.      * @var float
  450.      *
  451.      * @Column(name="paid_price", type="decimal", precision=10, scale=2)
  452.      */
  453.     private $paidPrice = 0;
  454.     /**
  455.      * @var float
  456.      *
  457.      * @Column(name="paid_vat_price", type="decimal", precision=10, scale=2)
  458.      */
  459.     private $paidVatPrice = 0;
  460.     /**
  461.      * @var float
  462.      *
  463.      * @Column(name="exchange_rate", type="decimal", precision=10, scale=3)
  464.      */
  465.     private $exchangeRate = 0;
  466.     /**
  467.      * @var string
  468.      *
  469.      * @Column(name="currency", type="string", length=3, nullable=true)
  470.      */
  471.     private $currency;
  472.     /**
  473.      * @var User
  474.      *
  475.      * @ManyToOne(targetEntity="User")
  476.      * @JoinColumn(name="signed_by", referencedColumnName="id", nullable=false)
  477.      */
  478.     private $signedBy;
  479.     /**
  480.      * @var bool
  481.      *
  482.      * @Column(name="signed_anonymously", type="boolean")
  483.      */
  484.     private $signedAnonymously = false;
  485.     /**
  486.      * @var int
  487.      *
  488.      * @Column(name="status", type="integer")
  489.      */
  490.     private $status;
  491.     /**
  492.      * @var string
  493.      *
  494.      * @Column(name="note", type="text", nullable=true)
  495.      */
  496.     private $note;
  497.     /**
  498.      * @var int
  499.      *
  500.      * @Column(name="warranty", type="integer", nullable=true)
  501.      */
  502.     private $warranty;
  503.     /**
  504.      * @var bool
  505.      *
  506.      * @Column(name="qty_in_weight", type="boolean")
  507.      */
  508.     private $qtyInWeight = false;
  509.     /**
  510.      * @var \DateTime
  511.      *
  512.      * @Column(name="sent_date", type="datetime", nullable=true)
  513.      */
  514.     private $sentDate;
  515.     /**
  516.      * @var ArrayCollection
  517.      *
  518.      * @OneToMany(targetEntity="DocumentItem", mappedBy="document", orphanRemoval=true)
  519.      * @OrderBy({"created" = "DESC"})
  520.      **/
  521.     private $items;
  522.     /**
  523.      * @var ArrayCollection
  524.      *
  525.      * @OneToMany(targetEntity="DocumentPayment", mappedBy="document", orphanRemoval=true)
  526.      * @OrderBy({"created" = "DESC"})
  527.      **/
  528.     private $payments;
  529.     /**
  530.      * @var ArrayCollection
  531.      *
  532.      * @OneToMany(targetEntity="PaymentData", mappedBy="document", orphanRemoval=true)
  533.      * @OrderBy({"created" = "DESC"})
  534.      **/
  535.     private $paymentDatas;
  536.     /**
  537.      * @var bool
  538.      *
  539.      * @Column(name="payment_approved", type="boolean")
  540.      */
  541.     private $paymentApproved = false;
  542.     /**
  543.      * @var User
  544.      *
  545.      * @ManyToOne(targetEntity="User")
  546.      * @JoinColumn(name="payment_approved_by", referencedColumnName="id", nullable=true)
  547.      */
  548.     private $paymentApprovedBy;
  549.     /**
  550.      * @var \DateTime
  551.      *
  552.      * @Column(name="payment_approved_date", type="datetime", nullable=true)
  553.      */
  554.     private $paymentApprovedDate;
  555.     /**
  556.      * @var string
  557.      *
  558.      * @Column(name="pohoda_number", type="text", nullable=true)
  559.      */
  560.     private $pohodaNumber;
  561.     /**
  562.      * @var string|null
  563.      *
  564.      * @Column(name="account_number", type="text", nullable=true)
  565.      */
  566.     private $accountNumber;
  567.     /**
  568.      * @var string
  569.      *
  570.      * @Column(name="shipment_number", type="text", nullable=true)
  571.      */
  572.     private $shipmentNumber;
  573.     /**
  574.      * @var ArrayCollection
  575.      *
  576.      * @OneToMany(targetEntity="DocumentComment", mappedBy="document", orphanRemoval=true)
  577.      * @OrderBy({"created" = "DESC"})
  578.      **/
  579.     private $comments;
  580.     /**
  581.      * @var Shipment|null
  582.      *
  583.      * @ManyToOne(targetEntity="Shipment", inversedBy="documents")
  584.      * @JoinColumn(name="shipment_id", referencedColumnName="id")
  585.      */
  586.     private ?Shipment $shipment;
  587.     public function __construct()
  588.     {
  589.         parent::__construct();
  590.         $this->items = new ArrayCollection();
  591.         $this->initialDocuments = new ArrayCollection();
  592.         $this->relatedDocuments = new ArrayCollection();
  593.     }
  594.     /**
  595.      * @return DocumentGroup
  596.      */
  597.     public function getGroup()
  598.     {
  599.         return $this->group;
  600.     }
  601.     /**
  602.      * @param DocumentGroup $group
  603.      */
  604.     public function setGroup($group)
  605.     {
  606.         $this->group = $group;
  607.     }
  608.     /**
  609.      * @return Order|null
  610.      */
  611.     public function getOrder(): ?Order
  612.     {
  613.         return $this->order;
  614.     }
  615.     /**
  616.      * @param Order|null $order
  617.      * 
  618.      * @return void
  619.      */
  620.     public function setOrder(?Order $order): void
  621.     {
  622.         $this->order = $order;
  623.     }
  624.     /**
  625.      * @return Document|null
  626.      */
  627.     public function getRelatedDocument(): ?Document
  628.     {
  629.         return $this->relatedDocument;
  630.     }
  631.     /**
  632.      * @param Document|null $relatedDocument
  633.      *
  634.      * @return Document
  635.      */
  636.     public function setRelatedDocument(?Document $relatedDocument)
  637.     {
  638.         $this->relatedDocument = $relatedDocument;
  639.         return $this;
  640.     }
  641.     /**
  642.      * Get all initial documents
  643.      *
  644.      * @return ArrayCollection
  645.      */
  646.     public function getInitialDocuments(): Collection
  647.     {
  648.         return $this->initialDocuments;
  649.     }
  650.     /**
  651.      * Add an initial document
  652.      *
  653.      * @param Document $document
  654.      */
  655.     public function addInitialDocument(Document $document): void
  656.     {
  657.         if (!$this->initialDocuments->contains($document)) {
  658.             $this->initialDocuments->add($document);
  659.         }
  660.     }
  661.     /**
  662.      * Remove an initial document
  663.      *
  664.      * @param Document $document
  665.      */
  666.     public function removeInitialDocument(Document $document): void
  667.     {
  668.         if ($this->initialDocuments->contains($document)) {
  669.             $this->initialDocuments->removeElement($document);
  670.         }
  671.     }
  672.     /**
  673.      * Clear initial documents
  674.      */
  675.     public function clearInitialDocuments(): void
  676.     {
  677.         $this->initialDocuments->clear();
  678.     }
  679.     /**
  680.      * Get all related documents
  681.      *
  682.      * @return ArrayCollection
  683.      */
  684.     public function getRelatedDocuments(): Collection
  685.     {
  686.         return $this->relatedDocuments;
  687.     }
  688.     /**
  689.      * @return StockMovement
  690.      */
  691.     public function getStockMovement()
  692.     {
  693.         return $this->stockMovement;
  694.     }
  695.     /**
  696.      * @param ?StockMovement $stockMovement
  697.      */
  698.     public function setStockMovement(?StockMovement $stockMovement)
  699.     {
  700.         $this->stockMovement = $stockMovement;
  701.     }
  702.     /**
  703.      * @return Customer
  704.      */
  705.     public function getCustomer()
  706.     {
  707.         return $this->customer;
  708.     }
  709.     /**
  710.      * @param Customer $customer
  711.      */
  712.     public function setCustomer($customer)
  713.     {
  714.         $this->customer = $customer;
  715.     }
  716.     /**
  717.      * @return string
  718.      */
  719.     public function getCode()
  720.     {
  721.         return $this->code;
  722.     }
  723.     /**
  724.      * @param string $code
  725.      */
  726.     public function setCode($code)
  727.     {
  728.         $this->code = $code;
  729.     }
  730.     /**
  731.      * @return \DateTime
  732.      */
  733.     public function getCreatedDate()
  734.     {
  735.         return $this->createdDate;
  736.     }
  737.     /**
  738.      * @param \DateTime $createdDate
  739.      */
  740.     public function setCreatedDate($createdDate)
  741.     {
  742.         $this->createdDate = $createdDate;
  743.     }
  744.     /**
  745.      * @return int
  746.      */
  747.     public function getDueInDays()
  748.     {
  749.         return $this->dueInDays;
  750.     }
  751.     /**
  752.      * @param int $dueInDays
  753.      */
  754.     public function setDueInDays($dueInDays)
  755.     {
  756.         $this->dueInDays = $dueInDays;
  757.     }
  758.     /**
  759.      * @return \DateTime
  760.      */
  761.     public function getDueDate()
  762.     {
  763.         return $this->dueDate;
  764.     }
  765.     /**
  766.      * @param \DateTime $dueDate
  767.      */
  768.     public function setDueDate($dueDate)
  769.     {
  770.         $this->dueDate = $dueDate;
  771.     }
  772.     /**
  773.      * @return \DateTime
  774.      */
  775.     public function getChargeabilityDate()
  776.     {
  777.         return $this->chargeabilityDate;
  778.     }
  779.     /**
  780.      * @param \DateTime $chargeabilityDate
  781.      */
  782.     public function setChargeabilityDate($chargeabilityDate)
  783.     {
  784.         $this->chargeabilityDate = $chargeabilityDate;
  785.     }
  786.     /**
  787.      * @return DomainPaymentType
  788.      */
  789.     public function getPaymentType()
  790.     {
  791.         return $this->paymentType;
  792.     }
  793.     /**
  794.      * @param DomainPaymentType $paymentType
  795.      */
  796.     public function setPaymentType($paymentType)
  797.     {
  798.         $this->paymentType = $paymentType;
  799.     }
  800.     /**
  801.      * @return DomainShippingType
  802.      */
  803.     public function getShippingType()
  804.     {
  805.         return $this->shippingType;
  806.     }
  807.     /**
  808.      * @param DomainShippingType $shippingType
  809.      */
  810.     public function setShippingType($shippingType)
  811.     {
  812.         $this->shippingType = $shippingType;
  813.     }
  814.     /**
  815.      * @return int
  816.      */
  817.     public function getVariableSymbol()
  818.     {
  819.         return $this->variableSymbol;
  820.     }
  821.     /**
  822.      * @param int $variableSymbol
  823.      */
  824.     public function setVariableSymbol($variableSymbol)
  825.     {
  826.         $this->variableSymbol = $variableSymbol;
  827.     }
  828.     /**
  829.      * @return int
  830.      */
  831.     public function getExternalNumber()
  832.     {
  833.         return $this->externalNumber;
  834.     }
  835.     /**
  836.      * @param int $externalNumber
  837.      */
  838.     public function setExternalNumber($externalNumber)
  839.     {
  840.         $this->externalNumber = $externalNumber;
  841.         return $this;
  842.     }
  843.     /**
  844.      * @return int
  845.      */
  846.     public function getConstantSymbol()
  847.     {
  848.         return $this->constantSymbol;
  849.     }
  850.     /**
  851.      * @param int $constantSymbol
  852.      */
  853.     public function setConstantSymbol($constantSymbol)
  854.     {
  855.         $this->constantSymbol = $constantSymbol;
  856.     }
  857.     /**
  858.      * @return string
  859.      */
  860.     public function getBusinessName()
  861.     {
  862.         return $this->businessName;
  863.     }
  864.     /**
  865.      * @param string $businessName
  866.      */
  867.     public function setBusinessName($businessName)
  868.     {
  869.         $this->businessName = $businessName;
  870.     }
  871.     /**
  872.      * @return string
  873.      */
  874.     public function getDegree()
  875.     {
  876.         return $this->degree;
  877.     }
  878.     /**
  879.      * @param string $degree
  880.      */
  881.     public function setDegree($degree)
  882.     {
  883.         $this->degree = $degree;
  884.     }
  885.     /**
  886.      * @return string
  887.      */
  888.     public function getFirstName()
  889.     {
  890.         return $this->firstName;
  891.     }
  892.     /**
  893.      * @param string $firstName
  894.      */
  895.     public function setFirstName($firstName)
  896.     {
  897.         $this->firstName = $firstName;
  898.     }
  899.     /**
  900.      * @return string
  901.      */
  902.     public function getLastName()
  903.     {
  904.         return $this->lastName;
  905.     }
  906.     /**
  907.      * @param string $lastName
  908.      */
  909.     public function setLastName($lastName)
  910.     {
  911.         $this->lastName = $lastName;
  912.     }
  913.     /**
  914.      * @param bool $flipNames
  915.      * @return string
  916.      */
  917.     public function getFullName($flipNames = false)
  918.     {
  919.         if ($flipNames) {
  920.             return !is_null($this->degree) ? $this->degree . ' ' : '' . $this->lastName . ' ' . $this->firstName;
  921.         }
  922.         return !is_null($this->degree) ? $this->degree . ' ' : '' . $this->firstName . ' ' . $this->lastName;
  923.     }
  924.     /**
  925.      * @return string
  926.      */
  927.     public function getStreet()
  928.     {
  929.         return $this->street;
  930.     }
  931.     /**
  932.      * @param string $street
  933.      */
  934.     public function setStreet($street)
  935.     {
  936.         $this->street = $street;
  937.     }
  938.     /**
  939.      * @return string
  940.      */
  941.     public function getCity()
  942.     {
  943.         return $this->city;
  944.     }
  945.     /**
  946.      * @param string $city
  947.      */
  948.     public function setCity($city)
  949.     {
  950.         $this->city = $city;
  951.     }
  952.     /**
  953.      * @return string
  954.      */
  955.     public function getZip()
  956.     {
  957.         return $this->zip;
  958.     }
  959.     /**
  960.      * @param string $zip
  961.      */
  962.     public function setZip($zip)
  963.     {
  964.         $this->zip = $zip;
  965.     }
  966.     /**
  967.      * @return string
  968.      */
  969.     public function getCountry()
  970.     {
  971.         return $this->country;
  972.     }
  973.     /**
  974.      * @param string $country
  975.      */
  976.     public function setCountry($country)
  977.     {
  978.         $this->country = $country;
  979.     }
  980.     /**
  981.      * @return string
  982.      */
  983.     public function getEmail()
  984.     {
  985.         return $this->email;
  986.     }
  987.     /**
  988.      * @param string $email
  989.      */
  990.     public function setEmail($email)
  991.     {
  992.         $this->email = $email;
  993.     }
  994.     /**
  995.      * @return string|null
  996.      */
  997.     public function getEmailSent(): ?string
  998.     {
  999.         return $this->emailSent;
  1000.     }
  1001.     /**
  1002.      * @param string $emailSent
  1003.      * @return void
  1004.      */
  1005.     public function setEmailSent(string $emailSent): void
  1006.     {
  1007.         $this->emailSent = $emailSent;
  1008.     }
  1009.     /**
  1010.      * @return void
  1011.      */
  1012.     public function removeEmailSent(): void
  1013.     {
  1014.         $this->emailSent = null;
  1015.     }
  1016.     /**
  1017.      * @return string
  1018.      */
  1019.     public function getPhone()
  1020.     {
  1021.         return $this->phone;
  1022.     }
  1023.     /**
  1024.      * @param string $phone
  1025.      */
  1026.     public function setPhone($phone)
  1027.     {
  1028.         $this->phone = $phone;
  1029.     }
  1030.     /**
  1031.      * @return string
  1032.      */
  1033.     public function getBusinessId()
  1034.     {
  1035.         return $this->businessId;
  1036.     }
  1037.     /**
  1038.      * @param string $businessId
  1039.      */
  1040.     public function setBusinessId($businessId)
  1041.     {
  1042.         $this->businessId = $businessId;
  1043.     }
  1044.     /**
  1045.      * @return string
  1046.      */
  1047.     public function getTaxId()
  1048.     {
  1049.         return $this->taxId;
  1050.     }
  1051.     /**
  1052.      * @param string $taxId
  1053.      */
  1054.     public function setTaxId($taxId)
  1055.     {
  1056.         $this->taxId = $taxId;
  1057.     }
  1058.     /**
  1059.      * @return string
  1060.      */
  1061.     public function getVatId()
  1062.     {
  1063.         return $this->vatId;
  1064.     }
  1065.     /**
  1066.      * @param string $vatId
  1067.      */
  1068.     public function setVatId($vatId)
  1069.     {
  1070.         $this->vatId = $vatId;
  1071.     }
  1072.     /**
  1073.      * @return float
  1074.      */
  1075.     public function getVat(): float
  1076.     {
  1077.         return $this->vat;
  1078.     }
  1079.     /**
  1080.      * @param $vat
  1081.      * @return void
  1082.      */
  1083.     public function setVat($vat): void
  1084.     {
  1085.         $this->vat = $vat;
  1086.     }
  1087.     /**
  1088.      * @param null|float $totalPrice
  1089.      * @return float|int|null
  1090.      */
  1091.     public function getVatValueFromTotalPrice($totalPrice = null)
  1092.     {
  1093.         if ($this->getVat() > 0) {
  1094.             $totalPrice = is_null($totalPrice) ? $this->getTotalPrice() : $totalPrice;
  1095.             return $totalPrice * ($this->getVat() / 100);
  1096.         }
  1097.         return 0;
  1098.     }
  1099.     /**
  1100.      * @param null|float $totalVatPrice
  1101.      * @return float|int|null
  1102.      */
  1103.     public function getVatValueFromTotalVatPrice($totalVatPrice = null)
  1104.     {
  1105.         if ($this->getVat() > 0) {
  1106.             $totalVatPrice = is_null($totalVatPrice) ? $this->getTotalVatPrice() : $totalVatPrice;
  1107.             return $totalVatPrice - $totalVatPrice / ((100 + $this->getVat()) / 100);
  1108.         }
  1109.         return 0;
  1110.     }
  1111.     /**
  1112.      * @return boolean
  1113.      */
  1114.     public function isShipAddressSame()
  1115.     {
  1116.         return $this->shipAddressSame;
  1117.     }
  1118.     /**
  1119.      * @param boolean $shipAddressSame
  1120.      */
  1121.     public function setShipAddressSame($shipAddressSame)
  1122.     {
  1123.         $this->shipAddressSame = $shipAddressSame;
  1124.     }
  1125.     /**
  1126.      * @return string
  1127.      */
  1128.     public function getShipBusinessName()
  1129.     {
  1130.         return $this->shipBusinessName;
  1131.     }
  1132.     /**
  1133.      * @param string $shipBusinessName
  1134.      */
  1135.     public function setShipBusinessName($shipBusinessName)
  1136.     {
  1137.         $this->shipBusinessName = $shipBusinessName;
  1138.     }
  1139.     /**
  1140.      * @return string
  1141.      */
  1142.     public function getShipDegree()
  1143.     {
  1144.         return $this->shipDegree;
  1145.     }
  1146.     /**
  1147.      * @param string $shipDegree
  1148.      */
  1149.     public function setShipDegree($shipDegree)
  1150.     {
  1151.         $this->shipDegree = $shipDegree;
  1152.     }
  1153.     /**
  1154.      * @return string
  1155.      */
  1156.     public function getShipFirstName()
  1157.     {
  1158.         return $this->shipFirstName;
  1159.     }
  1160.     /**
  1161.      * @param string $shipFirstName
  1162.      */
  1163.     public function setShipFirstName($shipFirstName)
  1164.     {
  1165.         $this->shipFirstName = $shipFirstName;
  1166.     }
  1167.     /**
  1168.      * @return string
  1169.      */
  1170.     public function getShipLastName()
  1171.     {
  1172.         return $this->shipLastName;
  1173.     }
  1174.     /**
  1175.      * @param string $shipLastName
  1176.      */
  1177.     public function setShipLastName($shipLastName)
  1178.     {
  1179.         $this->shipLastName = $shipLastName;
  1180.     }
  1181.     /**
  1182.      * @return string
  1183.      */
  1184.     public function getShipStreet()
  1185.     {
  1186.         return $this->shipStreet;
  1187.     }
  1188.     /**
  1189.      * @param string $shipStreet
  1190.      */
  1191.     public function setShipStreet($shipStreet)
  1192.     {
  1193.         $this->shipStreet = $shipStreet;
  1194.     }
  1195.     /**
  1196.      * @return string
  1197.      */
  1198.     public function getShipCity()
  1199.     {
  1200.         return $this->shipCity;
  1201.     }
  1202.     /**
  1203.      * @param string $shipCity
  1204.      */
  1205.     public function setShipCity($shipCity)
  1206.     {
  1207.         $this->shipCity = $shipCity;
  1208.     }
  1209.     /**
  1210.      * @return string
  1211.      */
  1212.     public function getShipZip()
  1213.     {
  1214.         return $this->shipZip;
  1215.     }
  1216.     /**
  1217.      * @param string $shipZip
  1218.      */
  1219.     public function setShipZip($shipZip)
  1220.     {
  1221.         $this->shipZip = $shipZip;
  1222.     }
  1223.     /**
  1224.      * @return string
  1225.      */
  1226.     public function getShipCountry()
  1227.     {
  1228.         return $this->shipCountry;
  1229.     }
  1230.     /**
  1231.      * @param string $shipCountry
  1232.      */
  1233.     public function setShipCountry($shipCountry)
  1234.     {
  1235.         $this->shipCountry = $shipCountry;
  1236.     }
  1237.     /**
  1238.      * @return string
  1239.      */
  1240.     public function getShipPhone()
  1241.     {
  1242.         return $this->shipPhone;
  1243.     }
  1244.     /**
  1245.      * @param string $shipPhone
  1246.      */
  1247.     public function setShipPhone($shipPhone)
  1248.     {
  1249.         $this->shipPhone = $shipPhone;
  1250.     }
  1251.     /**
  1252.      * @return string
  1253.      */
  1254.     public function getAttachment()
  1255.     {
  1256.         return $this->attachment;
  1257.     }
  1258.     /**
  1259.      * @param string $attachment
  1260.      */
  1261.     public function setAttachment($attachment)
  1262.     {
  1263.         $this->attachment = $attachment;
  1264.     }
  1265.     /**
  1266.      * @return float
  1267.      */
  1268.     public function getTotalPrice()
  1269.     {
  1270.         return $this->totalPrice;
  1271.     }
  1272.     /**
  1273.      * @param float $totalPrice
  1274.      */
  1275.     public function setTotalPrice($totalPrice)
  1276.     {
  1277.         $this->totalPrice = str_replace(',', '.', $totalPrice);
  1278.     }
  1279.     /**
  1280.      * @return float
  1281.      */
  1282.     public function getTotalVatPrice()
  1283.     {
  1284.         return $this->totalVatPrice;
  1285.     }
  1286.     /**
  1287.      * @param float $totalVatPrice
  1288.      */
  1289.     public function setTotalVatPrice($totalVatPrice)
  1290.     {
  1291.         $this->totalVatPrice = str_replace(',', '.', $totalVatPrice);
  1292.     }
  1293.     /**
  1294.      * @return float
  1295.      */
  1296.     public function getPaidPrice()
  1297.     {
  1298.         return $this->paidPrice;
  1299.     }
  1300.     /**
  1301.      * @param float $paidPrice
  1302.      */
  1303.     public function setPaidPrice($paidPrice)
  1304.     {
  1305.         $this->paidPrice = $paidPrice;
  1306.     }
  1307.     /**
  1308.      * @return float
  1309.      */
  1310.     public function getPaidVatPrice()
  1311.     {
  1312.         return $this->paidVatPrice;
  1313.     }
  1314.     /**
  1315.      * @param float $paidVatPrice
  1316.      */
  1317.     public function setPaidVatPrice($paidVatPrice)
  1318.     {
  1319.         $this->paidVatPrice = $paidVatPrice;
  1320.     }
  1321.     /**
  1322.      * @param string $paidPrice
  1323.      */
  1324.     public function setPaidPrices($paidPrice)
  1325.     {
  1326.         $this->setPaidPrice($paidPrice);
  1327.         $this->setPaidVatPrice($this->getCompany()->createVatPrice($this->getPaidPrice(), $this->getVat()));
  1328.     }
  1329.     /**
  1330.      * @return float
  1331.      */
  1332.     public function getExchangeRate()
  1333.     {
  1334.         return $this->exchangeRate;
  1335.     }
  1336.     /**
  1337.      * @param float $exchangeRate
  1338.      *
  1339.      * @return Document
  1340.      */
  1341.     public function setExchangeRate($exchangeRate)
  1342.     {
  1343.         $this->exchangeRate = $exchangeRate;
  1344.         return $this;
  1345.     }
  1346.     /**
  1347.      * @return string
  1348.      */
  1349.     public function getCurrency()
  1350.     {
  1351.         return $this->currency;
  1352.     }
  1353.     /**
  1354.      * @param string $currency
  1355.      *
  1356.      * @return Document
  1357.      */
  1358.     public function setCurrency($currency)
  1359.     {
  1360.         $this->currency = $currency;
  1361.         return $this;
  1362.     }
  1363.     /**
  1364.      * @return User
  1365.      */
  1366.     public function getSignedBy()
  1367.     {
  1368.         return $this->signedBy;
  1369.     }
  1370.     /**
  1371.      * @param User $signedBy
  1372.      */
  1373.     public function setSignedBy($signedBy)
  1374.     {
  1375.         $this->signedBy = $signedBy;
  1376.     }
  1377.     /**
  1378.      * @return  bool
  1379.      */
  1380.     public function getSignedAnonymously()
  1381.     {
  1382.         return $this->signedAnonymously;
  1383.     }
  1384.     /**
  1385.      * @param bool $signedAnonymously
  1386.      */
  1387.     public function setSignedAnonymously(bool $signedAnonymously)
  1388.     {
  1389.         $this->signedAnonymously = $signedAnonymously;
  1390.     }
  1391.     /**
  1392.      * @return string
  1393.      */
  1394.     public function getNote()
  1395.     {
  1396.         return $this->note;
  1397.     }
  1398.     /**
  1399.      * @param string $note
  1400.      * @return Document
  1401.      */
  1402.     public function setNote($note)
  1403.     {
  1404.         $this->note = $note;
  1405.         return $this;
  1406.     }
  1407.     /**
  1408.      * @return int
  1409.      */
  1410.     public function getWarranty()
  1411.     {
  1412.         return $this->warranty;
  1413.     }
  1414.     /**
  1415.      * @param int $warranty
  1416.      */
  1417.     public function setWarranty($warranty)
  1418.     {
  1419.         return $this->warranty = $warranty;
  1420.     }
  1421.     /**
  1422.      * @return boolean
  1423.      */
  1424.     public function isQtyInWeight()
  1425.     {
  1426.         return $this->qtyInWeight;
  1427.     }
  1428.     /**
  1429.      * @param boolean $qtyInWeight
  1430.      */
  1431.     public function setQtyInWeight($qtyInWeight)
  1432.     {
  1433.         $this->qtyInWeight = $qtyInWeight;
  1434.     }
  1435.     public function getItems()
  1436.     {
  1437.         return $this->items;
  1438.     }
  1439.     /**
  1440.      * @param DocumentItem $item
  1441.      */
  1442.     public function addItem($item)
  1443.     {
  1444.         if (!$this->items->contains($item)) {
  1445.             $this->items->add($item);
  1446.         }
  1447.     }
  1448.     /**
  1449.      * @param DocumentItem $item
  1450.      */
  1451.     public function removeMovementItem($item)
  1452.     {
  1453.         $this->items->removeElement($item);
  1454.     }
  1455.     /**
  1456.      * @return void
  1457.      */
  1458.     public function clearItems(): void
  1459.     {
  1460.         $this->items = new ArrayCollection();
  1461.     }
  1462.     /**
  1463.      * @return ArrayCollection
  1464.      */
  1465.     public function getPayments()
  1466.     {
  1467.         return $this->payments;
  1468.     }
  1469.     /**
  1470.      * @return Company
  1471.      */
  1472.     public function getCompany()
  1473.     {
  1474.         return $this->getGroup()->getCompany();
  1475.     }
  1476.     /**
  1477.      * Set dueDate by numbers left for paying document
  1478.      *
  1479.      * @PrePersist
  1480.      * @PreUpdate
  1481.      */
  1482.     public function setDueDateByDueInDays()
  1483.     {
  1484.         $date = new \DateTime($this->createdDate->format('Y-m-d'));
  1485.         $this->dueDate = $date->add(new \DateInterval('P' . $this->dueInDays . 'D'));
  1486.     }
  1487.     /**
  1488.      * @PreUpdate
  1489.      * @param PreUpdateEventArgs $eventArgs
  1490.      */
  1491.     public function updateStatus(PreUpdateEventArgs $eventArgs)
  1492.     {
  1493.         if (!$eventArgs->getObject() instanceof Document) {
  1494.             return;
  1495.         }
  1496.         if (
  1497.             $eventArgs->hasChangedField('totalVatPrice')
  1498.             && $eventArgs->getOldValue('totalVatPrice') != $eventArgs->getNewValue('totalVatPrice')
  1499.             && $this->getStatus() != self::STATUS_PAID
  1500.         ) {
  1501.             if ($this->dueDate < new \DateTime()) {
  1502.                 $this->setStatus(self::STATUS_POST_DUE_DATE);
  1503.             } else {
  1504.                 $this->setStatus(self::STATUS_NEW);
  1505.             }
  1506.         }
  1507.         if ($eventArgs->hasChangedField('dueInDays') && $this->getStatus() != self::STATUS_PAID) {
  1508.             if ($this->dueDate < new \DateTime()) {
  1509.                 $this->setStatus(self::STATUS_POST_DUE_DATE);
  1510.             } else {
  1511.                 $this->setStatus(self::STATUS_NEW);
  1512.             }
  1513.         }
  1514.     }
  1515.     /**
  1516.      * @return int
  1517.      */
  1518.     public function getStatus()
  1519.     {
  1520.         return $this->status;
  1521.     }
  1522.     /**
  1523.      * @param int $status
  1524.      */
  1525.     public function setStatus($status)
  1526.     {
  1527.         $this->status = $status;
  1528.     }
  1529.     /**
  1530.      * @return int
  1531.      */
  1532.     public function getAllItemQuantity()
  1533.     {
  1534.         $allQuantity = 0;
  1535.         foreach ($this->getItems() as $item) {
  1536.             $allQuantity += $item->getQuantity();
  1537.         }
  1538.         return $allQuantity;
  1539.     }
  1540.     /**
  1541.      * @return mixed
  1542.      */
  1543.     public function getStatusTitle()
  1544.     {
  1545.         return self::getStatusChoices()[$this->getStatus()];
  1546.     }
  1547.     /**
  1548.      * @return bool
  1549.      * @throws \Exception
  1550.      */
  1551.     public function isLocked(): bool
  1552.     {
  1553.         $groupType = $this->getGroup()->getType();
  1554.         if ($groupType == DocumentGroup::TYPE_INVOICE_IN && $this->isPaymentApproved()) {
  1555.             return true;
  1556.         }
  1557.         /**
  1558.          * temporary disabled
  1559.          */
  1560.         //        if (!is_null($this->sentDate)){
  1561.         //            return true;
  1562.         //        }
  1563.         $lockBeforeDate = (new \DateTime())
  1564.             ->setTime(0, 0)
  1565.             ->sub(new \DateInterval('P' . self::LOCKED_AFTER_DAYS . 'D'))
  1566.         ;
  1567.         return in_array($groupType, self::DOCUMENT_TYPE_TO_LOCK) && $this->getCreatedDate() < $lockBeforeDate;
  1568.     }
  1569.     /**
  1570.      * @return ArrayCollection
  1571.      */
  1572.     public function getProducts(): ArrayCollection
  1573.     {
  1574.         $products = new ArrayCollection();
  1575.         foreach ($this->getItems() as $item) {
  1576.             $product = $item->getProduct();
  1577.             if (!is_null($product) && !$products->contains($product)) {
  1578.                 $products->add($product);
  1579.             }
  1580.         }
  1581.         return $products;
  1582.     }
  1583.     public function calculateAndSetTotalPrices()
  1584.     {
  1585.         $totalVatPrice = 0;
  1586.         foreach ($this->getItems() as $item) {
  1587.             if ($item->getParent() != null) {
  1588.                 continue;
  1589.             }
  1590.             $totalVatPrice += $item->getVatItemFullPrice();
  1591.         }
  1592.         $totalVatPrice = round($totalVatPrice, 2);
  1593.         $totalPrice = $totalVatPrice / Domain::getVatMultiplier($this->getVat());
  1594.         $totalPrice = round($totalPrice, 2);
  1595.         $this->setTotalVatPrice($totalVatPrice);
  1596.         $this->setTotalPrice($totalPrice);
  1597.     }
  1598.     /**
  1599.      * @return ArrayCollection
  1600.      */
  1601.     public function getStockItems()
  1602.     {
  1603.         $stockItems = new ArrayCollection();
  1604.         if (!is_null($this->getStockMovement())) {
  1605.             foreach ($this->getStockMovement()->getMovementItems() as $movementItem) {
  1606.                 foreach ($movementItem->getStockItems() as $stockItem) {
  1607.                     if (!$stockItems->contains($stockItem)) {
  1608.                         $stockItems->add($stockItem);
  1609.                     }
  1610.                 }
  1611.             }
  1612.         }
  1613.         return $stockItems;
  1614.     }
  1615.     /**
  1616.      * @return \DateTime
  1617.      */
  1618.     public function getSentDate()
  1619.     {
  1620.         return $this->sentDate;
  1621.     }
  1622.     /**
  1623.      * @param \DateTime $sentDate
  1624.      */
  1625.     public function setSentDate($sentDate)
  1626.     {
  1627.         $this->sentDate = $sentDate;
  1628.     }
  1629.     /**
  1630.      * @return void
  1631.      */
  1632.     public function removeSentDate()
  1633.     {
  1634.         $this->sentDate = null;
  1635.     }
  1636.     /**
  1637.      * @return ArrayCollection
  1638.      */
  1639.     public function getPaymentDatas()
  1640.     {
  1641.         return $this->paymentDatas;
  1642.     }
  1643.     /**
  1644.      * @return bool
  1645.      */
  1646.     public function isPaymentApproved(): bool
  1647.     {
  1648.         return $this->paymentApproved;
  1649.     }
  1650.     /**
  1651.      * @param bool $paymentApproved
  1652.      */
  1653.     public function setPaymentApproved(bool $paymentApproved): void
  1654.     {
  1655.         $this->paymentApproved = $paymentApproved;
  1656.     }
  1657.     /**
  1658.      * @return User|null
  1659.      */
  1660.     public function getPaymentApprovedBy(): ?User
  1661.     {
  1662.         return $this->paymentApprovedBy;
  1663.     }
  1664.     /**
  1665.      * @param User|null $paymentApprovedBy
  1666.      */
  1667.     public function setPaymentApprovedBy(?User $paymentApprovedBy): void
  1668.     {
  1669.         $this->paymentApprovedBy = $paymentApprovedBy;
  1670.     }
  1671.     /**
  1672.      * @return \DateTime|null
  1673.      */
  1674.     public function getPaymentApprovedDate(): ?\DateTime
  1675.     {
  1676.         return $this->paymentApprovedDate;
  1677.     }
  1678.     /**
  1679.      * @param \DateTime|null $paymentApprovedDate
  1680.      */
  1681.     public function setPaymentApprovedDate(?\DateTime $paymentApprovedDate): void
  1682.     {
  1683.         $this->paymentApprovedDate = $paymentApprovedDate;
  1684.     }
  1685.     /**
  1686.      * @return string|null
  1687.      */
  1688.     public function getPohodaNumber(): ?string
  1689.     {
  1690.         return $this->pohodaNumber;
  1691.     }
  1692.     /**
  1693.      * @param string|null $pohodaNumber
  1694.      */
  1695.     public function setPohodaNumber(string $pohodaNumber)
  1696.     {
  1697.         $this->pohodaNumber = $pohodaNumber;
  1698.     }
  1699.     /**
  1700.      * @return string|null
  1701.      */
  1702.     public function getShipmentNumber(): ?string
  1703.     {
  1704.         return $this->shipmentNumber;
  1705.     }
  1706.     /**
  1707.      * @param string|null $shipmentNumber
  1708.      */
  1709.     public function setShipmentNumber(string $shipmentNumber)
  1710.     {
  1711.         $this->shipmentNumber = $shipmentNumber;
  1712.     }
  1713.     /**
  1714.      * @return ArrayCollection
  1715.      */
  1716.     public function getComments()
  1717.     {
  1718.         return $this->comments;
  1719.     }
  1720.     /**
  1721.      * @param ArrayCollection $comments
  1722.      */
  1723.     public function setComments($comments)
  1724.     {
  1725.         $this->comments = $comments;
  1726.     }
  1727.     /**
  1728.      * @return OrderSetting|null
  1729.      */
  1730.     public function getEuPersonalTaxId(): ?OrderSetting
  1731.     {
  1732.         return $this->order && $this->group->getType() == DocumentGroup::TYPE_INVOICE_OUT ? $this->order->getEuPersonalTaxIdSetting() : null;
  1733.     }
  1734.     /**
  1735.      * @return string|null
  1736.      */
  1737.     public function getAccountNumber(): ?string
  1738.     {
  1739.         return $this->accountNumber;
  1740.     }
  1741.     /**
  1742.      * @param string|null $accountNumber
  1743.      * @return void
  1744.      */
  1745.     public function setAccountNumber(?string $accountNumber): void
  1746.     {
  1747.         $this->accountNumber = $accountNumber;
  1748.     }
  1749.     /**
  1750.      * @return Shipment|null
  1751.      */
  1752.     public function getShipment(): ?Shipment
  1753.     {
  1754.         return $this->shipment;
  1755.     }
  1756.     /**
  1757.      * @param Shipment|null $shipment
  1758.      * @return void
  1759.      */
  1760.     public function setShipment(?Shipment $shipment): void
  1761.     {
  1762.         $this->shipment = $shipment;
  1763.     }
  1764. }