src/Entity/Document.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocumentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\CancelReason ;
  8. use App\Entity\ReturnReason ;
  9. use App\Entity\RefundReason ;
  10. use JsonSerializable;
  11. /**
  12.  * @ORM\Entity(repositoryClass=DocumentRepository::class)
  13.  */
  14. class Document implements JsonSerializable
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $type;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $status;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $conditionDocument;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $internalNbr;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $externalNbr;
  42.     /**
  43.      * @ORM\Column(type="datetime")
  44.      */
  45.     private $createdAt;
  46.    
  47.     /**
  48.      * @ORM\Column(type="text", nullable=true)
  49.      */
  50.     private $object;
  51.     /**
  52.      * @ORM\Column(type="text", nullable=true)
  53.      */
  54.     private $note;
  55.    /**
  56.      * @ORM\Column(type="decimal", precision=12, scale=3, options={"default":"0.000", "comment": "Total HT brut (avant remise document)"})
  57.      */
  58.     private $totalAmountHt;
  59.     /**
  60.      * @ORM\Column(type="decimal", precision=12, scale=3, options={"default":"0.000"})
  61.      */
  62.     private $totalTva;
  63.     /**
  64.      * @ORM\Column(name="total_amount_ttc", type="decimal", precision=12, scale=3, options={"default":"0.000","comment":"Total TTC net (après remise document)"})
  65.      */
  66.     private $totalAmountTtc;
  67.     /**
  68.      * @ORM\Column(type="string", length=255)
  69.      */
  70.     private $paymentMethod;
  71.     /**
  72.      * @ORM\Column(type="string", length=255, nullable=true)
  73.      */
  74.     private $paymentDeadline;
  75.     /**
  76.      * @ORM\Column(type="string", length=255, nullable=true)
  77.      */
  78.     private $paymentRef;
  79.     /**
  80.      * @ORM\Column(type="float", nullable=true)
  81.      */
  82.     private $discount;
  83.     /**
  84.      * @ORM\Column(type="string", length=255, nullable=true)
  85.      */
  86.     private $discountType;
  87.     /**
  88.      * @ORM\Column(type="float", nullable=true)
  89.      */
  90.     private $advancePayment;
  91.     /**
  92.      * @ORM\Column(type="string", length=255, nullable=true)
  93.      */
  94.     private $advancePaymentType;
  95.     /**
  96.      * @ORM\Column(type="string", length=255, nullable=true)
  97.      */
  98.     private $parcelTrackingNbr;
  99.     /**
  100.      * @ORM\OneToMany(targetEntity=DocumentProduit::class, mappedBy="document" ,cascade={"persist"})
  101.      */
  102.     private $documentProduits;
  103.     /**
  104.      * @ORM\OneToMany(targetEntity=DocumentDeclinationProduit::class, mappedBy="document" ,cascade={"persist"})
  105.      */
  106.     private $documentDeclinationProduits;
  107.     /**
  108.      * @ORM\Column(type="string", length=255)
  109.      */
  110.     private $category;
  111.     /**
  112.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="documents")
  113.      */
  114.     private $client;
  115.     /**
  116.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="userDocuments")
  117.      */
  118.     private $user;
  119.     /**
  120.      * @ORM\ManyToOne(targetEntity=Document::class, inversedBy="documents")
  121.      */
  122.     private $document;
  123.     /**
  124.      * @ORM\OneToMany(targetEntity=Document::class, mappedBy="document")
  125.      */
  126.     private $documents;
  127.     /**
  128.      * @ORM\ManyToOne(targetEntity=Delivery::class, inversedBy="documents")
  129.      */
  130.     private $delivery;
  131.     /**
  132.      * @ORM\Column(type="string", length=255, nullable=true)
  133.      */
  134.     private $urlPdf;
  135.     /**
  136.      * @ORM\Column(type="float", nullable=true)
  137.      */
  138.     private $deliveryDiscount;
  139.     /**
  140.      * @ORM\Column(type="string", length=255, nullable=true)
  141.      */
  142.     private $deliveryDiscountType;
  143.     /**
  144.      * @ORM\Column(type="float", nullable=true)
  145.      */
  146.     private $deliveryPrice;
  147.     /**
  148.      * @ORM\ManyToOne(targetEntity=Tva::class)
  149.      */
  150.     private $deliveryTva;
  151.     /**
  152.      * @ORM\Column(type="float", nullable=true)
  153.      */
  154.     private $deliveryTotal;
  155.     // Document.php (à l'intérieur de la classe Document)
  156.    /**
  157.     * @ORM\Column(name="delivery_company_total", type="decimal", precision=12, scale=2, nullable=true)
  158.     */
  159.     private $deliveryCompanyTotal;
  160.     /**
  161.      * @ORM\Column(type="text", nullable=true)
  162.      */
  163.     private $adress;
  164.     /**
  165.      * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="document")
  166.      *  @ORM\OrderBy({"createAt" = "DESC"})
  167.      */
  168.     private $comments;
  169.     /**
  170.      * @ORM\ManyToOne(targetEntity=Supplier::class, inversedBy="documents")
  171.      */
  172.     private $supplier;
  173.     /**
  174.      * @ORM\Column(type="string", length=255, nullable=true)
  175.      */
  176.     private $urlTracking;
  177.     /**
  178.      * @ORM\Column(type="integer", nullable=true)
  179.      */
  180.     private $packagesNbr;
  181.     /**
  182.      * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="documentComment")
  183.      */
  184.     private $documentComments;
  185.     /**
  186.      * @ORM\Column(name="promised_at", type="datetime", nullable=true, options={"comment":"Date promise client/fournisseur"})
  187.      */
  188.     private ?\DateTimeInterface $promisedAt null;
  189.     
  190.     /**
  191.      * @ORM\Column(name="shipped_at", type="datetime", nullable=true)
  192.      */
  193.     private ?\DateTimeInterface $shippedAt null;
  194.     /**
  195.      * @ORM\Column(name="delivered_at", type="datetime", nullable=true)
  196.      */
  197.     private ?\DateTimeInterface $deliveredAt null;
  198.     /**
  199.      * @ORM\Column(type="datetime", nullable=true)
  200.      */
  201.     private $returnedAt;
  202.     /**
  203.      * @ORM\Column(type="datetime", nullable=true)
  204.      */
  205.     private $bonrecuAt;
  206.     
  207.      /**
  208.      * @ORM\Column(type="datetime", nullable=true)
  209.      */
  210.     private $aPayerLe;
  211.     /**
  212.      * @ORM\ManyToOne(targetEntity=Source::class, inversedBy="documents")
  213.      */
  214.     private $source;
  215.     /**
  216.      * @ORM\Column(type="boolean")
  217.      */
  218.     private $isFreeDelivery;
  219.     /**
  220.      * @ORM\ManyToOne(targetEntity=User::class)
  221.      */
  222.     private $updatedBy;
  223.     /**
  224.      * @ORM\Column(type="datetime", nullable=true)
  225.      */
  226.     private $updatedAt;
  227.     /**
  228.      * @ORM\OneToMany(targetEntity=Activity::class, mappedBy="document")
  229.      */
  230.     private $activities;
  231.     /**
  232.      * @ORM\ManyToOne(targetEntity=Promotion::class)
  233.      */
  234.     private $promotion;
  235.     /**
  236.      * @ORM\Column(name="payment_status", type="string", length=32, options={"default":"non-paye"})
  237.      */
  238.     private $paymentStatus 'non-paye';
  239.     /**
  240.      * @ORM\Column(name="paid_at", type="datetime", nullable=true)
  241.      */
  242.     private $paidAt;
  243.     /**
  244.     * @ORM\Column(type="decimal", precision=12, scale=3,  options={"default": "0.000", "comment": "Total des encaissements TTC"})
  245.     */
  246.     private $totalPaid;
  247.     /**
  248.      * @ORM\Column(name="refund_amount", type="decimal", precision=12, scale=3, nullable=true)
  249.      */
  250.     private $refundAmount;
  251.     /**
  252.      * @ORM\Column(name="refunded_at", type="datetime", nullable=true)
  253.      */
  254.     private $refundedAt;
  255.     /**
  256.      * @ORM\ManyToOne(targetEntity="App\Entity\CancelReason")
  257.      * @ORM\JoinColumn(name="cancel_reason_id", referencedColumnName="id", onDelete="SET NULL")
  258.      */
  259.     private $cancelReason;
  260.     
  261.     /**
  262.      * @ORM\ManyToOne(targetEntity="App\Entity\RefundReason")
  263.      * @ORM\JoinColumn(name="refund_reason_id", referencedColumnName="id", onDelete="SET NULL")
  264.      */
  265.     private $refundReason;
  266.     /**
  267.      * @ORM\ManyToOne(targetEntity="App\Entity\ReturnReason")
  268.      * @ORM\JoinColumn(name="return_reason_id", referencedColumnName="id", onDelete="SET NULL", nullable=true)
  269.      */
  270.     private $returnReason;
  271.     public function __construct()
  272.     {
  273.         $this->documentProduits = new ArrayCollection();
  274.         $this->documentDeclinationProduits = new ArrayCollection();
  275.         $this->documents = new ArrayCollection();
  276.         $this->comments = new ArrayCollection();
  277.         $this->documentComments = new ArrayCollection();
  278.         $this->activities = new ArrayCollection();
  279.     }
  280.     public function getId(): ?int
  281.     {
  282.         return $this->id;
  283.     }
  284.     public function getType(): ?string
  285.     {
  286.         return $this->type;
  287.     }
  288.     public function setType(string $type): self
  289.     {
  290.         $this->type $type;
  291.         return $this;
  292.     }
  293.     public function getStatus(): ?string
  294.     {
  295.         return $this->status;
  296.     }
  297.     public function setStatus(string $status): self
  298.     {
  299.         $this->status $status;
  300.         return $this;
  301.     }
  302.     public function getConditionDocument(): ?string
  303.     {
  304.         return $this->conditionDocument;
  305.     }
  306.     public function setConditionDocument(string $conditionDocument): self
  307.     {
  308.         $this->conditionDocument $conditionDocument;
  309.         return $this;
  310.     }
  311.     public function getInternalNbr(): ?string
  312.     {
  313.         return $this->internalNbr;
  314.     }
  315.     public function setInternalNbr(string $internalNbr): self
  316.     {
  317.         $this->internalNbr $internalNbr;
  318.         return $this;
  319.     }
  320.     public function getExternalNbr(): ?string
  321.     {
  322.         return $this->externalNbr;
  323.     }
  324.     public function setExternalNbr(string $externalNbr): self
  325.     {
  326.         $this->externalNbr $externalNbr;
  327.         return $this;
  328.     }
  329.     public function getCreatedAt(): ?\DateTimeInterface
  330.     {
  331.         return $this->createdAt;
  332.     }
  333.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  334.     {
  335.         $this->createdAt $createdAt;
  336.         return $this;
  337.     }
  338.    
  339.     public function getObject(): ?string
  340.     {
  341.         return $this->object;
  342.     }
  343.     public function setObject(?string $object): self
  344.     {
  345.         $this->object $object;
  346.         return $this;
  347.     }
  348.     public function getNote(): ?string
  349.     {
  350.         return $this->note;
  351.     }
  352.     public function setNote(?string $note): self
  353.     {
  354.         $this->note $note;
  355.         return $this;
  356.     }
  357.     public function getTotalAmountHt(): ?float
  358.     {
  359.         return $this->totalAmountHt;
  360.     }
  361.     public function setTotalAmountHt(float $totalAmountHt): self
  362.     {
  363.         $this->totalAmountHt $totalAmountHt;
  364.         return $this;
  365.     }
  366.     public function getTotalTva(): ?float
  367.     {
  368.         return $this->totalTva;
  369.     }
  370.     public function setTotalTva(float $totalTva): self
  371.     {
  372.         $this->totalTva $totalTva;
  373.         return $this;
  374.     }
  375.     public function getTotalAmountTtc(): ?float
  376.     {
  377.         return $this->totalAmountTtc;
  378.     }
  379.     public function setTotalAmountTtc(float $totalAmountTtc): self
  380.     {
  381.         $this->totalAmountTtc $totalAmountTtc;
  382.         return $this;
  383.     }
  384.     public function getPaymentMethod(): ?string
  385.     {
  386.         return $this->paymentMethod;
  387.     }
  388.     public function setPaymentMethod(string $paymentMethod): self
  389.     {
  390.         $this->paymentMethod $paymentMethod;
  391.         return $this;
  392.     }
  393.     public function getPaymentDeadline(): ?string
  394.     {
  395.         return $this->paymentDeadline;
  396.     }
  397.     public function setPaymentDeadline(?string $paymentDeadline): self
  398.     {
  399.         $this->paymentDeadline $paymentDeadline;
  400.         return $this;
  401.     }
  402.     public function getPaymentRef(): ?string
  403.     {
  404.         return $this->paymentRef;
  405.     }
  406.     public function setPaymentRef(?string $paymentRef): self
  407.     {
  408.         $this->paymentRef $paymentRef;
  409.         return $this;
  410.     }
  411.     public function getDiscount(): ?float
  412.     {
  413.         return $this->discount;
  414.     }
  415.     public function setDiscount(?float $discount): self
  416.     {
  417.         $this->discount $discount;
  418.         return $this;
  419.     }
  420.     public function getDiscountType(): ?string
  421.     {
  422.         return $this->discountType;
  423.     }
  424.     public function setDiscountType(?string $discountType): self
  425.     {
  426.         $this->discountType $discountType;
  427.         return $this;
  428.     }
  429.     public function getAdvancePayment(): ?float
  430.     {
  431.         return $this->advancePayment;
  432.     }
  433.     public function setAdvancePayment(?float $advancePayment): self
  434.     {
  435.         $this->advancePayment $advancePayment;
  436.         return $this;
  437.     }
  438.     public function getAdvancePaymentType(): ?string
  439.     {
  440.         return $this->advancePaymentType;
  441.     }
  442.     public function setAdvancePaymentType(?string $advancePaymentType): self
  443.     {
  444.         $this->advancePaymentType $advancePaymentType;
  445.         return $this;
  446.     }
  447.     public function getParcelTrackingNbr(): ?string
  448.     {
  449.         return $this->parcelTrackingNbr;
  450.     }
  451.     public function setParcelTrackingNbr(?string $parcelTrackingNbr): self
  452.     {
  453.         $this->parcelTrackingNbr $parcelTrackingNbr;
  454.         return $this;
  455.     }
  456.     /**
  457.      * @return Collection|DocumentProduit[]
  458.      */
  459.     public function getDocumentProduits(): Collection
  460.     {
  461.         return $this->documentProduits;
  462.     }
  463.     public function addDocumentProduit(DocumentProduit $documentProduit): self
  464.     {
  465.         if( !$this->documentProduits->contains($documentProduit)) {
  466.             $this->documentProduits[] = $documentProduit;
  467.             $documentProduit->setDocument($this);
  468.         }
  469.         return $this;
  470.     }
  471.     public function removeDocumentProduit(DocumentProduit $documentProduit): self
  472.     {
  473.         if( $this->documentProduits->removeElement($documentProduit)) {
  474.             // set the owning side to null (unless already changed)
  475.             if( $documentProduit->getDocument() === $this) {
  476.                 $documentProduit->setDocument(null);
  477.             }
  478.         }
  479.         return $this;
  480.     }
  481.     /**
  482.      * @return Collection|DocumentDeclinationProduit[]
  483.      */
  484.     public function getDocumentDeclinationProduits(): Collection
  485.     {
  486.         return $this->documentDeclinationProduits;
  487.     }
  488.     public function addDocumentDeclinationProduit(DocumentDeclinationProduit $documentDeclinationProduit): self
  489.     {
  490.         if( !$this->documentDeclinationProduits->contains($documentDeclinationProduit)) {
  491.             $this->documentDeclinationProduits[] = $documentDeclinationProduit;
  492.             $documentDeclinationProduit->setDocument($this);
  493.         }
  494.         return $this;
  495.     }
  496.     public function removeDocumentDeclinationProduit(DocumentDeclinationProduit $documentDeclinationProduit): self
  497.     {
  498.         if( $this->documentDeclinationProduits->removeElement($documentDeclinationProduit)) {
  499.             // set the owning side to null (unless already changed)
  500.             if( $documentDeclinationProduit->getDocument() === $this) {
  501.                 $documentDeclinationProduit->setDocument(null);
  502.             }
  503.         }
  504.         return $this;
  505.     }
  506.     public function getCategory(): ?string
  507.     {
  508.         return $this->category;
  509.     }
  510.     public function setCategory(string $category): self
  511.     {
  512.         $this->category $category;
  513.         return $this;
  514.     }
  515.     public function getClient(): ?User
  516.     {
  517.         return $this->client;
  518.     }
  519.     public function setClient(?User $client): self
  520.     {
  521.         $this->client $client;
  522.         return $this;
  523.     }
  524.     public function getUser(): ?User
  525.     {
  526.         return $this->user;
  527.     }
  528.     public function setUser(?User $user): self
  529.     {
  530.         $this->user $user;
  531.         return $this;
  532.     }
  533.     public function getDocument(): ?self
  534.     {
  535.         return $this->document;
  536.     }
  537.     public function setDocument(?self $document): self
  538.     {
  539.         $this->document $document;
  540.         return $this;
  541.     }
  542.     /**
  543.      * @return Collection|self[]
  544.      */
  545.     public function getDocuments(): Collection
  546.     {
  547.         return $this->documents;
  548.     }
  549.     public function addDocument(self $document): self
  550.     {
  551.         if( !$this->documents->contains($document)) {
  552.             $this->documents[] = $document;
  553.             $document->setDocument($this);
  554.         }
  555.         return $this;
  556.     }
  557.     public function removeDocument(self $document): self
  558.     {
  559.         if( $this->documents->removeElement($document)) {
  560.             // set the owning side to null (unless already changed)
  561.             if( $document->getDocument() === $this) {
  562.                 $document->setDocument(null);
  563.             }
  564.         }
  565.         return $this;
  566.     }
  567.     public function getDelivery(): ?Delivery
  568.     {
  569.         return $this->delivery;
  570.     }
  571.     public function setDelivery(?Delivery $delivery): self
  572.     {
  573.         $this->delivery $delivery;
  574.         return $this;
  575.     }
  576.     public function getUrlPdf(): ?string
  577.     {
  578.         return $this->urlPdf;
  579.     }
  580.     public function setUrlPdf(?string $urlPdf): self
  581.     {
  582.         $this->urlPdf $urlPdf;
  583.         return $this;
  584.     }
  585.     public function getDeliveryDiscount(): ?float
  586.     {
  587.         return $this->deliveryDiscount;
  588.     }
  589.     public function setDeliveryDiscount(?float $deliveryDiscount): self
  590.     {
  591.         $this->deliveryDiscount $deliveryDiscount;
  592.         return $this;
  593.     }
  594.     public function getDeliveryDiscountType(): ?string
  595.     {
  596.         return $this->deliveryDiscountType;
  597.     }
  598.     public function setDeliveryDiscountType(?string $deliveryDiscountType): self
  599.     {
  600.         $this->deliveryDiscountType $deliveryDiscountType;
  601.         return $this;
  602.     }
  603.     public function getDeliveryPrice(): ?float
  604.     {
  605.         return $this->deliveryPrice;
  606.     }
  607.     public function setDeliveryPrice(?float $deliveryPrice): self
  608.     {
  609.         $this->deliveryPrice $deliveryPrice;
  610.         return $this;
  611.     }
  612.     public function getDeliveryTva(): ?Tva
  613.     {
  614.         return $this->deliveryTva;
  615.     }
  616.     public function setDeliveryTva(?Tva $deliveryTva): self
  617.     {
  618.         $this->deliveryTva $deliveryTva;
  619.         return $this;
  620.     }
  621.     public function getDeliveryTotal(): ?float
  622.     {
  623.         return $this->deliveryTotal;
  624.     }
  625.     public function setDeliveryTotal(?float $deliveryTotal): self
  626.     {
  627.         $this->deliveryTotal $deliveryTotal;
  628.         return $this;
  629.     }
  630.     public function getDeliveryCompanyTotal(): ?string
  631.     {
  632.         return $this->deliveryCompanyTotal;
  633.     }
  634.     public function setDeliveryCompanyTotal(?string $deliveryCompanyTotal): self
  635.     {
  636.         $this->deliveryCompanyTotal $deliveryCompanyTotal;
  637.         return $this;
  638.     }
  639.     public function getAdress(): ?string
  640.     {
  641.         return $this->adress;
  642.     }
  643.     public function setAdress(?string $adress): self
  644.     {
  645.         $this->adress $adress;
  646.         return $this;
  647.     }
  648.     /**
  649.      * @return Collection|Comment[]
  650.      */
  651.     public function getComments(): Collection
  652.     {
  653.         return $this->comments;
  654.     }
  655.     public function addComment(Comment $comment): self
  656.     {
  657.         if( !$this->comments->contains($comment)) {
  658.             $this->comments[] = $comment;
  659.             $comment->setDocument($this);
  660.         }
  661.         return $this;
  662.     }
  663.     public function removeComment(Comment $comment): self
  664.     {
  665.         if( $this->comments->removeElement($comment)) {
  666.             // set the owning side to null (unless already changed)
  667.             if( $comment->getDocument() === $this) {
  668.                 $comment->setDocument(null);
  669.             }
  670.         }
  671.         return $this;
  672.     }
  673.     public function getSupplier(): ?Supplier
  674.     {
  675.         return $this->supplier;
  676.     }
  677.     public function setSupplier(?Supplier $supplier): self
  678.     {
  679.         $this->supplier $supplier;
  680.         return $this;
  681.     }
  682.     public function getUrlTracking(): ?string
  683.     {
  684.         return $this->urlTracking;
  685.     }
  686.     public function setUrlTracking(?string $urlTracking): self
  687.     {
  688.         $this->urlTracking $urlTracking;
  689.         return $this;
  690.     }
  691.     public function getPackagesNbr(): ?int
  692.     {
  693.         return $this->packagesNbr;
  694.     }
  695.     public function setPackagesNbr(?int $packagesNbr): self
  696.     {
  697.         $this->packagesNbr $packagesNbr;
  698.         return $this;
  699.     }
  700.     /**
  701.      * @return Collection|Comment[]
  702.      */
  703.     public function getDocumentComments(): Collection
  704.     {
  705.         return $this->documentComments;
  706.     }
  707.     public function addDocumentComment(Comment $documentComment): self
  708.     {
  709.         if( !$this->documentComments->contains($documentComment)) {
  710.             $this->documentComments[] = $documentComment;
  711.             $documentComment->setDocumentComment($this);
  712.         }
  713.         return $this;
  714.     }
  715.     public function removeDocumentComment(Comment $documentComment): self
  716.     {
  717.         if( $this->documentComments->removeElement($documentComment)) {
  718.             // set the owning side to null (unless already changed)
  719.             if( $documentComment->getDocumentComment() === $this) {
  720.                 $documentComment->setDocumentComment(null);
  721.             }
  722.         }
  723.         return $this;
  724.     }
  725.     public function getPromisedAt(): ?\DateTimeInterface
  726.     {
  727.         return $this->promisedAt;
  728.     }
  729.     public function setPromisedAt(?\DateTimeInterface $promisedAt): self
  730.     {
  731.         $this->promisedAt $promisedAt;
  732.         return $this;
  733.     }
  734.     public function getUpdatedAt(): ?\DateTimeInterface
  735.     {
  736.         return $this->updatedAt;
  737.     }
  738.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  739.     {
  740.         $this->updatedAt $updatedAt;
  741.         return $this;
  742.     }
  743.     public function getShippedAt(): ?\DateTimeInterface
  744.     {
  745.         return $this->shippedAt;
  746.     }
  747.     public function setShippedAt(?\DateTimeInterface $shippedAt): self
  748.     {
  749.         $this->shippedAt $shippedAt;
  750.         return $this;
  751.     }
  752.     public function getDeliveredAt(): ?\DateTimeInterface 
  753.     
  754.         return $this->deliveredAt
  755.     }
  756.     public function setDeliveredAt(?\DateTimeInterface $dt): self 
  757.     
  758.         $this->deliveredAt $dt; return $this
  759.     }
  760.     public function getReturnedAt(): ?\DateTimeInterface
  761.     {
  762.         return $this->returnedAt;
  763.     }
  764.     public function setReturnedAt(?\DateTimeInterface $returnedAt): self
  765.     {
  766.         $this->returnedAt $returnedAt;
  767.         return $this;
  768.     }
  769.     public function getBonrecuAt(): ?\DateTimeInterface
  770.     {
  771.         return $this->bonrecuAt;
  772.     }
  773.     public function setBonrecuAt(?\DateTimeInterface $bonrecuAt): self
  774.     {
  775.         $this->bonrecuAt $bonrecuAt;
  776.         return $this;
  777.     }
  778.     public function getAPayerLe(): ?\DateTimeInterface
  779.     {
  780.         return $this->aPayerLe;
  781.     }
  782.     public function setAPayerLe(?\DateTimeInterface $aPayerLe): self
  783.     {
  784.         $this->aPayerLe $aPayerLe;
  785.         return $this;
  786.     }
  787.     public function getSource(): ?Source
  788.     {
  789.         return $this->source;
  790.     }
  791.     public function setSource(?Source $source): self
  792.     {
  793.         $this->source $source;
  794.         return $this;
  795.     }
  796.     public function getIsFreeDelivery(): ?bool
  797.     {
  798.         return $this->isFreeDelivery;
  799.     }
  800.     public function setIsFreeDelivery(bool $isFreeDelivery): self
  801.     {
  802.         $this->isFreeDelivery $isFreeDelivery;
  803.         return $this;
  804.     }
  805.     /**
  806.      * @return Collection|Activity[]
  807.      */
  808.     public function getActivities(): Collection
  809.     {
  810.         return $this->activities;
  811.     }
  812.     public function addActivity(Activity $activity): self
  813.     {
  814.         if( !$this->activities->contains($activity)) {
  815.             $this->activities[] = $activity;
  816.             $activity->setDocument($this);
  817.         }
  818.         return $this;
  819.     }
  820.     public function removeActivity(Activity $activity): self
  821.     {
  822.         if( $this->activities->removeElement($activity)) {
  823.             // set the owning side to null (unless already changed)
  824.             if( $activity->getDocument() === $this) {
  825.                 $activity->setDocument(null);
  826.             }
  827.         }
  828.         return $this;
  829.     }
  830.     public function getUpdatedBy(): ?User
  831.     {
  832.         return $this->user;
  833.     }
  834.     public function setUpdatedBy(?User $user): self
  835.     {
  836.         $this->updatedBy $user;
  837.         return $this;
  838.     }
  839.     public function getPromotion(): ?Promotion
  840.     {
  841.         return $this->promotion;
  842.     }
  843.     public function setPromotion(?Promotion $promotion): self
  844.     {
  845.         $this->promotion $promotion;
  846.         return $this;
  847.     }
  848.     public function getCancelReason(): ?CancelReason
  849.     {
  850.         return $this->cancelReason;
  851.     }
  852.     public function setCancelReason(?CancelReason $cancelReason): self
  853.     {
  854.         $this->cancelReason $cancelReason;
  855.         return $this;
  856.     }
  857.     public function getRefundReason(): ?RefundReason
  858.     {
  859.         return $this->refundReason;
  860.     }
  861.     public function setRefundReason(?RefundReason $refundReason): self
  862.     {
  863.         $this->refundReason $refundReason;
  864.         return $this;
  865.     }
  866.     public function getReturnReason(): ?ReturnReason
  867.     {
  868.         return $this->returnReason;
  869.     }
  870.     public function setReturnReason(?ReturnReason $returnReason): self
  871.     {
  872.         $this->returnReason $returnReason;
  873.         return $this;
  874.     }
  875.     public function jsonSerialize()
  876.     {
  877.         return array(
  878.             'id' => $this->getId(),
  879.             'totalClient' => $this->getTotalAmountTtc() + $this->getDeliveryPrice(),
  880.             'createdAt' => $this->getCreatedAt()->format('d/m/Y h:i'),
  881.             'status' => $this->getStatus()
  882.         );
  883.     }
  884.     /* ---------- Getters/Setters paiement ---------- */
  885.     public function getPaymentStatus(): ?string
  886.     {
  887.         return $this->paymentStatus;
  888.     }
  889.     public function setPaymentStatus(string $paymentStatus): self
  890.     {
  891.         $this->paymentStatus $paymentStatus;
  892.         return $this;
  893.     }
  894.     public function getPaidAt(): ?\DateTimeInterface
  895.     {
  896.         return $this->paidAt;
  897.     }
  898.     public function setPaidAt(?\DateTimeInterface $paidAt): self
  899.     {
  900.         $this->paidAt $paidAt;
  901.         return $this;
  902.     }
  903.     /**
  904.      * Attention: Doctrine renvoie DECIMAL en string.
  905.      * On garde string pour éviter les surprises d’arrondi.
  906.      */
  907.     public function getTotalPaid(): ?string
  908.     {
  909.         return $this->totalPaid;
  910.     }
  911.     public function setTotalPaid($totalPaid): self
  912.     {
  913.         // accepte float|string, on normalise à 3 décimales
  914.         $this->totalPaid number_format((float)$totalPaid3'.''');
  915.         return $this;
  916.     }
  917.     /** @ORM\PrePersist */
  918.     public function ensureTotalPaid(): void
  919.     {
  920.         if ($this->totalPaid === null || $this->totalPaid === '') {
  921.             $this->totalPaid '0.000';
  922.         }
  923.     }
  924.     public function getRefundAmount(): ?string
  925.     {
  926.         return $this->refundAmount;
  927.     }
  928.     public function setRefundAmount($refundAmount): self
  929.     {
  930.         $this->refundAmount $refundAmount !== null
  931.             number_format((float)$refundAmount3'.''')
  932.             : null;
  933.         return $this;
  934.     }
  935.     public function getRefundedAt(): ?\DateTimeInterface
  936.     {
  937.         return $this->refundedAt;
  938.     }
  939.     public function setRefundedAt(?\DateTimeInterface $refundedAt): self
  940.     {
  941.         $this->refundedAt $refundedAt;
  942.         return $this;
  943.     }
  944.     /* ---------- Helper historique ---------- */
  945.     /** Ajoute proprement une étape dans condition_document */
  946.     public function addConditionStep(string $label): self
  947.     {
  948.         $current trim((string)$this->getConditionDocument());
  949.         $this->setConditionDocument($current !== '' $current.' -> '.$label $label);
  950.         return $this;
  951.     }
  952. }