src/Entity/Estimate.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Core\Model\Orderable;
  4. use App\Repository\EstimateRepository;
  5. use DateInterval;
  6. use DateTime;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use JsonSerializable;
  11. /**
  12.  * @ORM\Entity(repositoryClass=EstimateRepository::class)
  13.  * @ORM\Table(
  14.  *     name="`estimate`"
  15.  * )
  16.  */
  17. class Estimate extends Orderable implements JsonSerializable
  18. {
  19.     const DELIVERY_MODE_BY_HAND           1;
  20.     const DELIVERY_MODE_EMAIL             3;
  21.     const DELIVERY_MODE_POSTAL_REGISTERED 2;
  22.     const INSTRUCTION_ACCEPTED            2;
  23.     const INSTRUCTION_PENDING             1;
  24.     const INSTRUCTION_REFUSED             3;
  25.     const PAYMENT_MODE_CASH               1;
  26.     const PAYMENT_MODE_CHECK              2;
  27.     const PAYMENT_MODE_CREDIT             3;
  28.     const STATUS_CANCELLED                3;
  29.     const STATUS_PENDING                  0;
  30.     const STATUS_VALID                    1;
  31.     const STATUS_VERIFIED                 2;
  32.     const YOUSIGN_STATUS_ACTIVE           "active";
  33.     const YOUSIGN_STATUS_DONE             "done";
  34.     const YOUSIGN_STATUS_DRAFT            'draft';
  35.     const YOUSIGN_STATUS_EXPIRED          'expired';
  36.     const YOUSIGN_STATUS_FINISHED         'finished';
  37.     const YOUSIGN_STATUS_PENDING          'pending';
  38.     const YOUSIGN_STATUS_PROCESSING       "processing";
  39.     const YOUSIGN_STATUS_REFUSED          'refused';
  40.     /**
  41.      * @var EstimateBuilding | null
  42.      * @ORM\OneToOne(targetEntity="App\Entity\EstimateBuilding", mappedBy="estimate", cascade={"persist", "remove"})
  43.      */
  44.     private $building;
  45.     /**
  46.      * @var boolean | null
  47.      * @ORM\Column(name="canceled", type="boolean", nullable=true)
  48.      */
  49.     private $canceled;
  50.     /**
  51.      * @var string | null
  52.      * @ORM\Column(name="cerfa_document", type="string", length=255, nullable=true)
  53.      */
  54.     private $cerfaDocument;
  55.     /**
  56.      * @var string | null
  57.      * @ORM\Column(name="cerfa_signature", type="text", nullable=true)
  58.      */
  59.     private $cerfaSignature;
  60.     /**
  61.      * @var string | null
  62.      * @ORM\Column(name="comment", type="text", nullable=true)
  63.      */
  64.     private $comment;
  65.     /**
  66.      * @var Collection|User[]
  67.      * @ORM\ManyToMany(targetEntity="App\Entity\User")
  68.      */
  69.     private $commercials;
  70.     /**
  71.      * @var float | null
  72.      * @ORM\Column(name="contribution_amount", type="float", nullable=true)
  73.      */
  74.     private $contributionAmount;
  75.     /**
  76.      * @var DateTime
  77.      * @ORM\Column(name="created_at", type="datetime", nullable=false)
  78.      */
  79.     private $createdAt;
  80.     /**
  81.      * @var float | null
  82.      * @ORM\Column(name="credit_amount", type="float", nullable=true)
  83.      */
  84.     private $creditAmount;
  85.     /**
  86.      * @var float | null
  87.      * @ORM\Column(name="credit_amount_with_insurance", type="float", nullable=true)
  88.      */
  89.     private $creditAmountWithInsurance;
  90.     /**
  91.      * @var float | null
  92.      * @ORM\Column(name="credit_amount_without_insurance", type="float", nullable=true)
  93.      */
  94.     private $creditAmountWithoutInsurance;
  95.     /**
  96.      * @var float | null
  97.      * @ORM\Column(name="credit_cost_wihout_insurance", type="float", nullable=true)
  98.      */
  99.     private $creditCostWihoutInsurance;
  100.     /**
  101.      * @var float | null
  102.      * @ORM\Column(name="credit_cost_with_insurance", type="float", nullable=true)
  103.      */
  104.     private $creditCostWithInsurance;
  105.     /**
  106.      * @var float | null
  107.      * @ORM\Column(name="credit_debit_rate", type="float", nullable=true)
  108.      */
  109.     private $creditDebitRate;
  110.     /**
  111.      * @var int | null
  112.      * @ORM\Column(name="credit_duration", type="integer", nullable=true)
  113.      */
  114.     private $creditDuration;
  115.     /**
  116.      * @var string | null
  117.      * @ORM\Column(name="credit_etablishment", type="string", length=255, nullable=true)
  118.      */
  119.     private $creditEtablishment;
  120.     /**
  121.      * @var int | null
  122.      * @ORM\Column(name="credit_mensuality_number", type="integer", nullable=true)
  123.      */
  124.     private $creditMensualityNumber;
  125.     /**
  126.      * @var float | null
  127.      * @ORM\Column(name="credit_mensuality_wihout_insurance", type="float", nullable=true)
  128.      */
  129.     private $creditMensualityWihoutInsurance;
  130.     /**
  131.      * @var float | null
  132.      * @ORM\Column(name="credit_mensuality_with_insurance", type="float", nullable=true)
  133.      */
  134.     private $creditMensualityWithInsurance;
  135.     /**
  136.      * @var float | null
  137.      * @ORM\Column(name="credit_rate", type="float", nullable=true)
  138.      */
  139.     private $creditRate;
  140.     /**
  141.      * @var float | null
  142.      * @ORM\Column(name="credit_report", type="float", nullable=true)
  143.      */
  144.     private $creditReport;
  145.     /**
  146.      * @var float | null
  147.      * @ORM\Column(name="credit_taeg", type="float", nullable=true)
  148.      */
  149.     private $creditTAEG;
  150.     /**
  151.      * @var float | null
  152.      * @ORM\Column(name="credit_without_insurance", type="float", nullable=true)
  153.      */
  154.     private $creditWihoutInsurance;
  155.     /**
  156.      * @var EstimateCustomer | null
  157.      * @ORM\OneToOne(targetEntity="App\Entity\EstimateCustomer", mappedBy="estimate", cascade={"persist", "remove"})
  158.      */
  159.     private $customer;
  160.     /**
  161.      * @var DateTime | null
  162.      * @ORM\Column(name="date_email", type="datetime", nullable=true)
  163.      */
  164.     private $dateEmail;
  165.     /**
  166.      * @var DateTime
  167.      * @ORM\Column(name="date_previsionnelle", type="date")
  168.      */
  169.     private $datePrevisionnelle;
  170.     /**
  171.      * @var DateTime
  172.      * @ORM\Column(name="date_visite", type="date")
  173.      */
  174.     private $dateVisite;
  175.     /**
  176.      * @var int|null
  177.      * @ORM\Column(name="delivery_mode", type="integer", nullable=true, options={"default": 3})
  178.      */
  179.     private $deliveryMode self::DELIVERY_MODE_EMAIL;
  180.     /**
  181.      * @var string | null
  182.      * @ORM\Column(name="document", type="string", length=255, nullable=true)
  183.      */
  184.     private $document;
  185.     /**
  186.      * @var string | null
  187.      * @ORM\Column(name="document_bon_de_commande", type="string", length=255, nullable=true)
  188.      */
  189.     private $documentBonDeCommande;
  190.     /**
  191.      * @var string | null
  192.      * @ORM\Column(name="document_devis", type="string", length=255, nullable=true)
  193.      */
  194.     private $documentDevis;
  195.     /**
  196.      * @var int | null
  197.      * @ORM\Column(name="extrabat_devis_id", type="integer", nullable=true)
  198.      */
  199.     private $extrabatDevisId;
  200.     /**
  201.      * @var int | null
  202.      * @ORM\Column(name="instruction", type="integer", nullable=true)
  203.      */
  204.     private $instruction null;
  205.     /**
  206.      * @var boolean
  207.      * @ORM\Column(name="new_version", type="boolean", nullable=true)
  208.      */
  209.     private $newVersion false;
  210.     /**
  211.      * @var boolean | null
  212.      * @ORM\Column(name="nouveau_client", type="boolean", nullable=true)
  213.      */
  214.     private $nouveauClient true;
  215.     /**
  216.      * @var string | null
  217.      * @ORM\Column(name="organism", type="text", length=255, nullable=true)
  218.      */
  219.     private $organism;
  220.     /**
  221.      * @var string | null
  222.      * @ORM\Column(name="programmated", type="boolean", nullable=true)
  223.      */
  224.     private $programmated;
  225.     /**
  226.      * @var PurchaseOrder | null
  227.      * @ORM\OneToOne(targetEntity=PurchaseOrder::class, mappedBy="estimate", cascade={"persist", "remove"})
  228.      */
  229.     private $purchaseOrder;
  230.     /**
  231.      * @var string | null
  232.      * @ORM\Column(name="signed_document", type="string", length=255, nullable=true)
  233.      */
  234.     private $signedDocument;
  235.     /**
  236.      * @var int | null
  237.      * @ORM\Column(name="status", type="integer", nullable=true)
  238.      */
  239.     private $status;
  240.     /**
  241.      * @var boolean
  242.      * @ORM\Column(name="step_bonus_complete", type="boolean", nullable=true)
  243.      */
  244.     private $stepBonusComplete false;
  245.     /**
  246.      * @var boolean
  247.      * @ORM\Column(name="step_building_complete", type="boolean", nullable=true)
  248.      */
  249.     private $stepBuildingComplete false;
  250.     /**
  251.      * @var boolean
  252.      * @ORM\Column(name="step_customer_complete", type="boolean", nullable=true)
  253.      */
  254.     private $stepCustomerComplete false;
  255.     /**
  256.      * @var boolean
  257.      * @ORM\Column(name="step_paiment_complete", type="boolean", nullable=true)
  258.      */
  259.     private $stepPaimentComplete false;
  260.     /**
  261.      * @var boolean
  262.      * @ORM\Column(name="step_signature_complete", type="boolean", nullable=true)
  263.      */
  264.     private $stepSignatureComplete false;
  265.     /**
  266.      * @var boolean
  267.      * @ORM\Column(name="step_waste_complete", type="boolean", nullable=true)
  268.      */
  269.     private $stepWasteComplete false;
  270.     /**
  271.      * @var boolean
  272.      * @ORM\Column(name="step_work_complete", type="boolean", nullable=true)
  273.      */
  274.     private $stepWorkComplete false;
  275.     /**
  276.      * @var Agency|null
  277.      * @ORM\ManyToOne(targetEntity="App\Entity\Agency")
  278.      * @ORM\JoinColumn(name="subcontractor", referencedColumnName="id", onDelete="SET NULL")
  279.      */
  280.     private $subcontractor;
  281.     /**
  282.      * @var User|null
  283.      *
  284.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="estimates")
  285.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
  286.      */
  287.     private $user;
  288.     /**
  289.      * @var boolean | null
  290.      * @ORM\Column(name="is_valid", type="boolean", nullable=true)
  291.      */
  292.     private $valid;
  293.     /**
  294.      * @var string | null
  295.      * @ORM\Column(name="view_collab", type="boolean", nullable=true)
  296.      */
  297.     private $viewByCOLLAB;
  298.     /**
  299.      * @var string | null
  300.      * @ORM\Column(name="view_da", type="boolean", nullable=true)
  301.      */
  302.     private $viewByDA;
  303.     /**
  304.      * @var EstimateWork | null
  305.      * @ORM\OneToOne(targetEntity="App\Entity\EstimateWork", mappedBy="estimate", cascade={"persist", "remove"})
  306.      */
  307.     private $work;
  308.     /**
  309.      * @var string | null
  310.      * @ORM\Column(name="yousign", type="string", length=255, nullable=true)
  311.      */
  312.     private $yousign;
  313.     /**
  314.      * @var string | null
  315.      * @ORM\Column(name="yousign_file", type="string", length=255, nullable=true)
  316.      */
  317.     private $yousignFile;
  318.     /**
  319.      * @var string | null
  320.      * @ORM\Column(name="yougign_status", type="string", length=255, nullable=true)
  321.      */
  322.     private $yousignStatus;
  323.     public function __construct ()
  324.     {
  325.         $this->dateVisite           = new DateTime();
  326.         $this->datePrevisionnelle   = (new DateTime())->add(new DateInterval('P15D'));
  327.         $this->commercials          = new ArrayCollection();
  328.         $this->createdAt            = new DateTime();
  329.         $this->wasteTypes           = [];
  330.         $this->viewByDA             false;
  331.         $this->viewByCOLLAB         false;
  332.         $this->programmated         false;
  333.         $this->canceled             false;
  334.         $this->newVersion           false;
  335.         $this->stepCustomerComplete false;
  336.         $this->status               null;
  337.     }
  338.     public function __clone ()
  339.     {
  340.         $this->createdAt             = new DateTime();
  341.         $this->dateVisite            = new DateTime();
  342.         $this->datePrevisionnelle    = (new DateTime())->add(new DateInterval('P15D'));
  343.         $this->dateEmail             null;
  344.         $this->number                null;
  345.         $this->yousignFile           null;
  346.         $this->yousignStatus         null;
  347.         $this->cerfaSignature        null;
  348.         $this->cerfaDocument         null;
  349.         $this->yousign               null;
  350.         $this->documentDevis         null;
  351.         $this->documentBonDeCommande null;
  352.         $this->viewByDA              false;
  353.         $this->viewByCOLLAB          false;
  354.         $this->programmated          false;
  355.         $this->canceled              false;
  356.         $this->newVersion            true;
  357.         $this->status                null;
  358.         $this->purchaseOrder         null;
  359. //        $this->stepCustomerComplete  = false;
  360.     }
  361.     /**
  362.      * @param User $user
  363.      *
  364.      * @return $this
  365.      */
  366.     public function addCommercial (User $user): self
  367.     {
  368.         if (!$this->commercials->contains($user)) {
  369.             $this->commercials[] = $user;
  370.         }
  371.         return $this;
  372.     }
  373.     /**
  374.      * Get the value of advise
  375.      */
  376.     public function getAdvise (): string
  377.     {
  378.         return ($this->getUser()) ? $this->getUser()->getFirstname() . ' ' $this->getUser()->getLastname() : "";
  379.     }
  380.     /**
  381.      * Get Building.
  382.      *
  383.      * @return EstimateBuilding|null The Building.
  384.      */
  385.     public function getBuilding (): ?EstimateBuilding
  386.     {
  387.         return $this->building;
  388.     }
  389.     /**
  390.      * Set the Building.
  391.      *
  392.      * @param EstimateBuilding|null $building
  393.      *
  394.      * @return Estimate return this class.
  395.      */
  396.     public function setBuilding (?EstimateBuilding $building): Estimate
  397.     {
  398.         $this->building $building;
  399.         // set the owning side of the relation if necessary
  400.         if ($building !== null && $building->getEstimate() !== $this) {
  401.             $building->setEstimate($this);
  402.         }
  403.         return $this;
  404.     }
  405.     /**
  406.      * @return bool|null
  407.      */
  408.     public function getCanceled (): ?bool
  409.     {
  410.         return $this->canceled;
  411.     }
  412.     /**
  413.      * @param bool|null $canceled
  414.      * @return $this
  415.      */
  416.     public function setCanceled (?bool $canceled): self
  417.     {
  418.         $this->canceled $canceled;
  419.         return $this;
  420.     }
  421.     /**
  422.      * @return string|null
  423.      */
  424.     public function getCerfaDocument (): ?string
  425.     {
  426.         return $this->cerfaDocument;
  427.     }
  428.     /**
  429.      * @param string|null $cerfaDocument
  430.      * @return Estimate
  431.      */
  432.     public function setCerfaDocument (?string $cerfaDocument): Estimate
  433.     {
  434.         $this->cerfaDocument $cerfaDocument;
  435.         return $this;
  436.     }
  437.     /**
  438.      * @return string|null
  439.      */
  440.     public function getCerfaSignature (): ?string
  441.     {
  442.         return $this->cerfaSignature;
  443.     }
  444.     /**
  445.      * @param string|null $cerfaSignature
  446.      * @return Estimate
  447.      */
  448.     public function setCerfaSignature (?string $cerfaSignature): Estimate
  449.     {
  450.         $this->cerfaSignature $cerfaSignature;
  451.         return $this;
  452.     }
  453.     /**
  454.      * @return string|null
  455.      */
  456.     public function getComment (): ?string
  457.     {
  458.         return $this->comment;
  459.     }
  460.     /**
  461.      * Set the value of comment
  462.      */
  463.     public function setComment ($comment): self
  464.     {
  465.         $this->comment $comment;
  466.         return $this;
  467.     }
  468.     /**
  469.      * Get Commercials.
  470.      *
  471.      * @return User[]|Collection The Commercials.
  472.      */
  473.     public function getCommercials ()
  474.     {
  475.         return $this->commercials;
  476.     }
  477.     /**
  478.      * @return float|null
  479.      */
  480.     public function getContributionAmount (): ?float
  481.     {
  482.         return $this->contributionAmount;
  483.     }
  484.     /**
  485.      * Set the value of contributionAmount
  486.      */
  487.     public function setContributionAmount ($contributionAmount): self
  488.     {
  489.         $this->contributionAmount $contributionAmount;
  490.         return $this;
  491.     }
  492.     /**
  493.      * Get CreatedAt.
  494.      *
  495.      * @return DateTime The CreatedAt.
  496.      */
  497.     public function getCreatedAt (): DateTime
  498.     {
  499.         return $this->createdAt;
  500.     }
  501.     /**
  502.      * Set the CreatedAt.
  503.      *
  504.      * @param DateTime $createdAt
  505.      *
  506.      * @return Estimate return this class.
  507.      */
  508.     public function setCreatedAt (DateTime $createdAt): Estimate
  509.     {
  510.         $this->createdAt $createdAt;
  511.         return $this;
  512.     }
  513.     /**
  514.      * @return float|null
  515.      */
  516.     public function getCreditAmount (): ?float
  517.     {
  518.         return $this->creditAmount;
  519.     }
  520.     /**
  521.      * @param float|null $creditAmount
  522.      * @return Estimate
  523.      */
  524.     public function setCreditAmount (?float $creditAmount): Estimate
  525.     {
  526.         $this->creditAmount $creditAmount;
  527.         return $this;
  528.     }
  529.     /**
  530.      * @return float|null
  531.      */
  532.     public function getCreditAmountWithInsurance (): ?float
  533.     {
  534.         return $this->creditAmountWithInsurance;
  535.     }
  536.     /**
  537.      * @param float|null $creditAmountWithInsurance
  538.      * @return Estimate
  539.      */
  540.     public function setCreditAmountWithInsurance (?float $creditAmountWithInsurance): Estimate
  541.     {
  542.         $this->creditAmountWithInsurance $creditAmountWithInsurance;
  543.         return $this;
  544.     }
  545.     /**
  546.      * @return float|null
  547.      */
  548.     public function getCreditAmountWithoutInsurance (): ?float
  549.     {
  550.         return $this->creditAmountWithoutInsurance;
  551.     }
  552.     /**
  553.      * @param float|null $creditAmountWithoutInsurance
  554.      * @return Estimate
  555.      */
  556.     public function setCreditAmountWithoutInsurance (?float $creditAmountWithoutInsurance): Estimate
  557.     {
  558.         $this->creditAmountWithoutInsurance $creditAmountWithoutInsurance;
  559.         return $this;
  560.     }
  561.     /**
  562.      * @return float|null
  563.      */
  564.     public function getCreditCostWihoutInsurance (): ?float
  565.     {
  566.         return $this->creditCostWihoutInsurance;
  567.     }
  568.     /**
  569.      * @param float|null $creditCostWihoutInsurance
  570.      * @return Estimate
  571.      */
  572.     public function setCreditCostWihoutInsurance (?float $creditCostWihoutInsurance): Estimate
  573.     {
  574.         $this->creditCostWihoutInsurance $creditCostWihoutInsurance;
  575.         return $this;
  576.     }
  577.     /**
  578.      * @return float|null
  579.      */
  580.     public function getCreditCostWithInsurance (): ?float
  581.     {
  582.         return $this->creditCostWithInsurance;
  583.     }
  584.     /**
  585.      * @param float|null $creditCostWithInsurance
  586.      * @return Estimate
  587.      */
  588.     public function setCreditCostWithInsurance (?float $creditCostWithInsurance): Estimate
  589.     {
  590.         $this->creditCostWithInsurance $creditCostWithInsurance;
  591.         return $this;
  592.     }
  593.     /**
  594.      * @return string|null
  595.      */
  596.     public function getCreditDebitRate (): ?string
  597.     {
  598.         return $this->creditDebitRate;
  599.     }
  600.     /**
  601.      * @param string|null $creditDebitRate
  602.      * @return Estimate
  603.      */
  604.     public function setCreditDebitRate (?string $creditDebitRate): Estimate
  605.     {
  606.         $this->creditDebitRate $creditDebitRate;
  607.         return $this;
  608.     }
  609.     /**
  610.      * @return int|null
  611.      */
  612.     public function getCreditDuration (): ?int
  613.     {
  614.         return $this->creditDuration;
  615.     }
  616.     /**
  617.      * @param int|null $creditDuration
  618.      * @return Estimate
  619.      */
  620.     public function setCreditDuration (?int $creditDuration): Estimate
  621.     {
  622.         $this->creditDuration $creditDuration;
  623.         return $this;
  624.     }
  625.     /**
  626.      * @return string|null
  627.      */
  628.     public function getCreditEtablishment (): ?string
  629.     {
  630.         return $this->creditEtablishment;
  631.     }
  632.     /**
  633.      * @param string|null $creditEtablishment
  634.      * @return Estimate
  635.      */
  636.     public function setCreditEtablishment (?string $creditEtablishment): Estimate
  637.     {
  638.         $this->creditEtablishment $creditEtablishment;
  639.         return $this;
  640.     }
  641.     /**
  642.      * @return string|null
  643.      */
  644.     public function getCreditMensualityNumber (): ?string
  645.     {
  646.         return $this->creditMensualityNumber;
  647.     }
  648.     /**
  649.      * @param string|null $creditMensualityNumber
  650.      * @return Estimate
  651.      */
  652.     public function setCreditMensualityNumber (?string $creditMensualityNumber): Estimate
  653.     {
  654.         $this->creditMensualityNumber $creditMensualityNumber;
  655.         return $this;
  656.     }
  657.     /**
  658.      * @return string|null
  659.      */
  660.     public function getCreditMensualityWihoutInsurance (): ?string
  661.     {
  662.         return $this->creditMensualityWihoutInsurance;
  663.     }
  664.     /**
  665.      * @param string|null $creditMensualityWihoutInsurance
  666.      * @return Estimate
  667.      */
  668.     public function setCreditMensualityWihoutInsurance (?string $creditMensualityWihoutInsurance): Estimate
  669.     {
  670.         $this->creditMensualityWihoutInsurance $creditMensualityWihoutInsurance;
  671.         return $this;
  672.     }
  673.     /**
  674.      * @return string|null
  675.      */
  676.     public function getCreditMensualityWithInsurance (): ?string
  677.     {
  678.         return $this->creditMensualityWithInsurance;
  679.     }
  680.     /**
  681.      * @param string|null $creditMensualityWithInsurance
  682.      * @return Estimate
  683.      */
  684.     public function setCreditMensualityWithInsurance (?string $creditMensualityWithInsurance): Estimate
  685.     {
  686.         $this->creditMensualityWithInsurance $creditMensualityWithInsurance;
  687.         return $this;
  688.     }
  689.     /**
  690.      * @return string|null
  691.      */
  692.     public function getCreditRate (): ?string
  693.     {
  694.         return $this->creditRate;
  695.     }
  696.     /**
  697.      * @param string|null $creditRate
  698.      * @return Estimate
  699.      */
  700.     public function setCreditRate (?string $creditRate): Estimate
  701.     {
  702.         $this->creditRate $creditRate;
  703.         return $this;
  704.     }
  705.     /**
  706.      * @return string|null
  707.      */
  708.     public function getCreditReport (): ?string
  709.     {
  710.         return $this->creditReport;
  711.     }
  712.     /**
  713.      * @param string|null $creditReport
  714.      * @return Estimate
  715.      */
  716.     public function setCreditReport (?string $creditReport): Estimate
  717.     {
  718.         $this->creditReport $creditReport;
  719.         return $this;
  720.     }
  721.     /**
  722.      * @return string|null
  723.      */
  724.     public function getCreditTAEG (): ?string
  725.     {
  726.         return $this->creditTAEG;
  727.     }
  728.     /**
  729.      * @param string|null $creditTAEG
  730.      * @return Estimate
  731.      */
  732.     public function setCreditTAEG (?string $creditTAEG): Estimate
  733.     {
  734.         $this->creditTAEG $creditTAEG;
  735.         return $this;
  736.     }
  737.     /**
  738.      * @return string|null
  739.      */
  740.     public function getCreditWihoutInsurance (): ?string
  741.     {
  742.         return $this->creditWihoutInsurance;
  743.     }
  744.     /**
  745.      * @param string|null $creditWihoutInsurance
  746.      * @return Estimate
  747.      */
  748.     public function setCreditWihoutInsurance (?string $creditWihoutInsurance): Estimate
  749.     {
  750.         $this->creditWihoutInsurance $creditWihoutInsurance;
  751.         return $this;
  752.     }
  753.     /**
  754.      * Get Customer.
  755.      *
  756.      * @return EstimateCustomer|null The Customer.
  757.      */
  758.     public function getCustomer (): ?EstimateCustomer
  759.     {
  760.         return $this->customer;
  761.     }
  762.     /**
  763.      * Set the Customer.
  764.      *
  765.      * @param EstimateCustomer|null $customer
  766.      *
  767.      * @return Estimate return this class.
  768.      */
  769.     public function setCustomer (?EstimateCustomer $customer): Estimate
  770.     {
  771.         $this->customer $customer;
  772.         if ($customer$customer->setEstimate($this);
  773.         return $this;
  774.     }
  775.     /**
  776.      * Get DateEmail.
  777.      *
  778.      * @return DateTime|null The DateEmail.
  779.      */
  780.     public function getDateEmail (): ?DateTime
  781.     {
  782.         return $this->dateEmail;
  783.     }
  784.     /**
  785.      * Set the DateEmail.
  786.      *
  787.      * @param DateTime|null $dateEmail
  788.      * @return $this return this class.
  789.      */
  790.     public function setDateEmail (?DateTime $dateEmail): self
  791.     {
  792.         $this->dateEmail $dateEmail;
  793.         return $this;
  794.     }
  795.     /**
  796.      * Get DatePrevisionnelle.
  797.      *
  798.      * @return DateTime The DatePrevisionnelle.
  799.      */
  800.     public function getDatePrevisionnelle (): DateTime
  801.     {
  802.         return $this->datePrevisionnelle;
  803.     }
  804.     /**
  805.      * Set the DatePrevisionnelle.
  806.      *
  807.      * @param DateTime|null $datePrevisionnelle
  808.      *
  809.      * @return Estimate return this class.
  810.      */
  811.     public function setDatePrevisionnelle (?DateTime $datePrevisionnelle): Estimate
  812.     {
  813.         $this->datePrevisionnelle $datePrevisionnelle ?? new DateTime();
  814.         return $this;
  815.     }
  816.     /**
  817.      * Get DateVisite.
  818.      *
  819.      * @return DateTime The DateVisite.
  820.      */
  821.     public function getDateVisite (): DateTime
  822.     {
  823.         return $this->dateVisite;
  824.     }
  825.     /**
  826.      * Set the DateVisite.
  827.      *
  828.      * @param DateTime|null $dateVisite
  829.      *
  830.      * @return Estimate return this class.
  831.      */
  832.     public function setDateVisite (?DateTime $dateVisite): Estimate
  833.     {
  834.         $this->dateVisite $dateVisite ?? new DateTime();
  835.         return $this;
  836.     }
  837.     /**
  838.      * Get DeliveryMode.
  839.      *
  840.      * @return int|null The DeliveryMode.
  841.      */
  842.     public function getDeliveryMode (): ?int
  843.     {
  844.         return $this->deliveryMode;
  845.     }
  846.     /**
  847.      * Set the DeliveryMode.
  848.      *
  849.      * @param int|null $deliveryMode
  850.      * @return $this
  851.      */
  852.     public function setDeliveryMode (?int $deliveryMode): self
  853.     {
  854.         $this->deliveryMode $deliveryMode;
  855.         return $this;
  856.     }
  857.     /**
  858.      * @return string[]
  859.      */
  860.     public static function getDeliveryModesList (): array
  861.     {
  862.         return [
  863.             self::DELIVERY_MODE_BY_HAND           => 'En main propre',
  864.             self::DELIVERY_MODE_EMAIL             => 'Par email',
  865.             self::DELIVERY_MODE_POSTAL_REGISTERED => 'Par courrier recommandé',
  866.         ];
  867.     }
  868.     /**
  869.      * Get Document.
  870.      *
  871.      * @return string|null The Document.
  872.      */
  873.     public function getDocument (): ?string
  874.     {
  875.         return $this->document;
  876.     }
  877.     /**
  878.      * Set the Document.
  879.      *
  880.      * @param string|null $document
  881.      *
  882.      * @return Estimate return this class.
  883.      */
  884.     public function setDocument (?string $document): Estimate
  885.     {
  886.         $this->document $document;
  887.         return $this;
  888.     }
  889.     /**
  890.      * Get DocumentBonDeCommande.
  891.      *
  892.      * @return string|null The DocumentBonDeCommande.
  893.      */
  894.     public function getDocumentBonDeCommande (): ?string
  895.     {
  896.         return $this->documentBonDeCommande;
  897.     }
  898.     /**
  899.      * Set the DocumentBonDeCommande.
  900.      *
  901.      * @param string|null $documentBonDeCommande
  902.      * @return $this return this class.
  903.      */
  904.     public function setDocumentBonDeCommande (?string $documentBonDeCommande): self
  905.     {
  906.         $this->documentBonDeCommande $documentBonDeCommande;
  907.         return $this;
  908.     }
  909.     /**
  910.      * Get DocumentDevis.
  911.      *
  912.      * @return string|null The DocumentDevis.
  913.      */
  914.     public function getDocumentDevis (): ?string
  915.     {
  916.         return $this->documentDevis;
  917.     }
  918.     /**
  919.      * Set the DocumentDevis.
  920.      *
  921.      * @param string|null $documentDevis
  922.      * @return $this return this class.
  923.      */
  924.     public function setDocumentDevis (?string $documentDevis): self
  925.     {
  926.         $this->documentDevis $documentDevis;
  927.         return $this;
  928.     }
  929.     /**
  930.      * Get ExtrabatDevisId.
  931.      *
  932.      * @return int|null The ExtrabatDevisId.
  933.      */
  934.     public function getExtrabatDevisId (): ?int
  935.     {
  936.         return $this->extrabatDevisId;
  937.     }
  938.     /**
  939.      * Set the ExtrabatDevisId.
  940.      *
  941.      * @param int|null $extrabatDevisId
  942.      *
  943.      * @return Estimate return this class.
  944.      */
  945.     public function setExtrabatDevisId (?int $extrabatDevisId): Estimate
  946.     {
  947.         $this->extrabatDevisId $extrabatDevisId;
  948.         return $this;
  949.     }
  950.     /**
  951.      * Get Instruction.
  952.      *
  953.      * @return int|null The Instruction.
  954.      */
  955.     public function getInstruction (): ?int
  956.     {
  957.         return $this->instruction;
  958.     }
  959.     /**
  960.      * Set the Instruction.
  961.      *
  962.      * @param int|null $instruction
  963.      * @return $this return this class.
  964.      */
  965.     public function setInstruction (?int $instruction): self
  966.     {
  967.         $this->instruction $instruction;
  968.         return $this;
  969.     }
  970.     /**
  971.      * @return string[]
  972.      */
  973.     public static function getInstructionChoices (): array
  974.     {
  975.         return [
  976.             self::INSTRUCTION_PENDING  => "En attente",
  977.             self::INSTRUCTION_ACCEPTED => "Accepté",
  978.             self::INSTRUCTION_REFUSED  => "Refusé",
  979.         ];
  980.     }
  981.     public function getNouveauClient (): bool
  982.     {
  983.         return $this->nouveauClient ?? false;
  984.     }
  985.     public function setNouveauClient (?bool $nouveauClient): self
  986.     {
  987.         $this->nouveauClient $nouveauClient;
  988.         return $this;
  989.     }
  990.     /**
  991.      * Get Organism.
  992.      *
  993.      * @return string|null The Organism.
  994.      */
  995.     public function getOrganism (): ?string
  996.     {
  997.         return $this->organism;
  998.     }
  999.     /**
  1000.      * Set the Organism.
  1001.      *
  1002.      * @param string|null $organism
  1003.      *
  1004.      * @return Estimate return this class.
  1005.      */
  1006.     public function setOrganism (?string $organism): Estimate
  1007.     {
  1008.         $this->organism $organism;
  1009.         return $this;
  1010.     }
  1011.     /**
  1012.      * @return string[]
  1013.      */
  1014.     public static function getPaimentModeChoices (): array
  1015.     {
  1016.         return [
  1017.             self::PAYMENT_MODE_CASH   => "Espèces",
  1018.             self::PAYMENT_MODE_CHECK  => "Chèque",
  1019.             self::PAYMENT_MODE_CREDIT => "Crédit",
  1020.         ];
  1021.     }
  1022.     /**
  1023.      * Get the value of programmated
  1024.      */
  1025.     public function getProgrammated ()
  1026.     {
  1027.         return $this->programmated;
  1028.     }
  1029.     /**
  1030.      * Set the value of programmated
  1031.      */
  1032.     public function setProgrammated ($programmated): self
  1033.     {
  1034.         $this->programmated $programmated;
  1035.         return $this;
  1036.     }
  1037.     /**
  1038.      * @return PurchaseOrder|null
  1039.      */
  1040.     public function getPurchaseOrder (): ?PurchaseOrder
  1041.     {
  1042.         return $this->purchaseOrder;
  1043.     }
  1044.     /**
  1045.      * @param PurchaseOrder|null $purchaseOrder
  1046.      *
  1047.      * @return $this
  1048.      */
  1049.     public function setPurchaseOrder (?PurchaseOrder $purchaseOrder): self
  1050.     {
  1051.         // unset the owning side of the relation if necessary
  1052.         if ($purchaseOrder === null && $this->purchaseOrder !== null) {
  1053.             $this->purchaseOrder->setEstimate(null);
  1054.         }
  1055.         // set the owning side of the relation if necessary
  1056.         if ($purchaseOrder !== null && $purchaseOrder->getEstimate() !== $this) {
  1057.             $purchaseOrder->setEstimate($this);
  1058.         }
  1059.         $this->purchaseOrder $purchaseOrder;
  1060.         return $this;
  1061.     }
  1062.     /**
  1063.      * Get SignedDocument.
  1064.      *
  1065.      * @return string|null The SignedDocument.
  1066.      */
  1067.     public function getSignedDocument (): ?string
  1068.     {
  1069.         return $this->signedDocument;
  1070.     }
  1071.     /**
  1072.      * Set the SignedDocument.
  1073.      *
  1074.      * @param string|null $signedDocument
  1075.      *
  1076.      * @return Estimate return this class.
  1077.      */
  1078.     public function setSignedDocument (?string $signedDocument): Estimate
  1079.     {
  1080.         $this->signedDocument $signedDocument;
  1081.         return $this;
  1082.     }
  1083.     /**
  1084.      * Get Status.
  1085.      *
  1086.      * @return int|null The Status.
  1087.      */
  1088.     public function getStatus (): ?int
  1089.     {
  1090.         return $this->status;
  1091.     }
  1092.     /**
  1093.      * Set the Status.
  1094.      *
  1095.      * @param int|null $status
  1096.      * @return $this return this class.
  1097.      */
  1098.     public function setStatus (?int $status): self
  1099.     {
  1100.         $this->status $status;
  1101.         if ($status === self::STATUS_VALID$this->valid true;
  1102.         return $this;
  1103.     }
  1104.     /**
  1105.      * @return string[]
  1106.      */
  1107.     public static function getStatusChoices (): array
  1108.     {
  1109.         return [
  1110.             self::STATUS_PENDING   => "En Ã©tude",
  1111.             self::STATUS_VALID     => "Validé DA",
  1112.             self::STATUS_VERIFIED  => "Vérifié Collab.",
  1113.             self::STATUS_CANCELLED => "Annulé",
  1114.         ];
  1115.     }
  1116.     /**
  1117.      * Get Subcontractor.
  1118.      *
  1119.      * @return Agency|null The Subcontractor.
  1120.      */
  1121.     public function getSubcontractor (): ?Agency
  1122.     {
  1123.         return $this->subcontractor;
  1124.     }
  1125.     /**
  1126.      * Set the Subcontractor.
  1127.      *
  1128.      * @param Agency|null $subcontractor
  1129.      *
  1130.      * @return Estimate return this class.
  1131.      */
  1132.     public function setSubcontractor (?Agency $subcontractor): Estimate
  1133.     {
  1134.         $this->subcontractor $subcontractor;
  1135.         return $this;
  1136.     }
  1137.     public function getTotalExcludingVatDiscountedPrice ()
  1138.     {
  1139.         return array_sum(($this->getWork() ? $this->getWork()->getOrders() : new ArrayCollection([]))->map(function (EstimateWorkOrder $order) {
  1140.             return $order->getTotalExcludingVatDiscountedPrice();
  1141.         })->toArray());
  1142.     }
  1143.     /**
  1144.      * Get User.
  1145.      *
  1146.      * @return User|null The User.
  1147.      */
  1148.     public function getUser (): ?User
  1149.     {
  1150.         return $this->user;
  1151.     }
  1152.     /**
  1153.      * Set the User.
  1154.      *
  1155.      * @param User|null $user
  1156.      *
  1157.      * @return Estimate return this class.
  1158.      */
  1159.     public function setUser (?User $user): Estimate
  1160.     {
  1161.         $this->user $user;
  1162.         return $this;
  1163.     }
  1164.     /**
  1165.      * Get the value of viewByCOLLAB
  1166.      */
  1167.     public function getViewByCOLLAB ()
  1168.     {
  1169.         return $this->viewByCOLLAB;
  1170.     }
  1171.     /**
  1172.      * Set the value of viewByCOLLAB
  1173.      */
  1174.     public function setViewByCOLLAB ($viewByCOLLAB): self
  1175.     {
  1176.         $this->viewByCOLLAB $viewByCOLLAB;
  1177.         return $this;
  1178.     }
  1179.     // Credit
  1180.     /**
  1181.      * Get the value of viewByDA
  1182.      */
  1183.     public function getViewByDA ()
  1184.     {
  1185.         return $this->viewByDA;
  1186.     }
  1187.     /**
  1188.      * Set the value of viewByDA
  1189.      */
  1190.     public function setViewByDA ($viewByDA): self
  1191.     {
  1192.         $this->viewByDA $viewByDA;
  1193.         return $this;
  1194.     }
  1195.     /**
  1196.      * Get Work.
  1197.      *
  1198.      * @return EstimateWork|null The Work.
  1199.      */
  1200.     public function getWork (): ?EstimateWork
  1201.     {
  1202.         return $this->work;
  1203.     }
  1204.     /**
  1205.      * Set the Work.
  1206.      *
  1207.      * @param EstimateWork|null $work
  1208.      *
  1209.      * @return Estimate return this class.
  1210.      */
  1211.     public function setWork (?EstimateWork $work): Estimate
  1212.     {
  1213.         $this->work $work;
  1214.         // set the owning side of the relation if necessary
  1215.         if ($work !== null && $work->getEstimate() !== $this) {
  1216.             $work->setEstimate($this);
  1217.         }
  1218.         return $this;
  1219.     }
  1220.     /**
  1221.      * Get YousignId.
  1222.      *
  1223.      * @return string|null The YousignId.
  1224.      */
  1225.     public function getYousign (): ?string
  1226.     {
  1227.         return $this->yousign;
  1228.     }
  1229.     /**
  1230.      * Set the YousignId.
  1231.      *
  1232.      * @param string|null $yousign
  1233.      *
  1234.      * @return Estimate return this class.
  1235.      */
  1236.     public function setYousign (?string $yousign): Estimate
  1237.     {
  1238.         $this->yousign $yousign;
  1239.         return $this;
  1240.     }
  1241.     /**
  1242.      * Get Link.
  1243.      *
  1244.      * @return string|null The Link.
  1245.      */
  1246.     public function getYousignFile (): ?string
  1247.     {
  1248.         return $this->yousignFile;
  1249.     }
  1250.     /**
  1251.      * Set the Link.
  1252.      *
  1253.      * @param string|null $yousignFile
  1254.      *
  1255.      * @return $this return this class.
  1256.      */
  1257.     public function setYousignFile (?string $yousignFile): self
  1258.     {
  1259.         $this->yousignFile $yousignFile;
  1260.         return $this;
  1261.     }
  1262.     /**
  1263.      * Get YougignStatus.
  1264.      *
  1265.      * @return string|null The YougignStatus.
  1266.      */
  1267.     public function getYousignStatus (): ?string
  1268.     {
  1269.         return $this->yousignStatus;
  1270.     }
  1271.     /**
  1272.      * Set the YougignStatus.
  1273.      *
  1274.      * @param string|null $yousignStatus
  1275.      * @return $this return this class.
  1276.      */
  1277.     public function setYousignStatus (?string $yousignStatus): self
  1278.     {
  1279.         $this->yousignStatus $yousignStatus;
  1280.         return $this;
  1281.     }
  1282.     /**
  1283.      * @return bool
  1284.      */
  1285.     public function isAllStepsComplete (): bool
  1286.     {
  1287.         return $this->isStepCustomerComplete()
  1288.             && $this->isStepBonusComplete()
  1289.             && $this->isStepBuildingComplete()
  1290.             && $this->isStepPaimentComplete()
  1291.             && $this->isStepSignatureComplete()
  1292.             && $this->isStepWasteComplete()
  1293.             && $this->isStepWorkComplete();
  1294.     }
  1295.     /**
  1296.      * Get NewVersion.
  1297.      *
  1298.      * @return bool The NewVersion.
  1299.      */
  1300.     public function isNewVersion (): bool
  1301.     {
  1302.         return $this->newVersion === true;
  1303.     }
  1304.     /**
  1305.      * Set the NewVersion.
  1306.      *
  1307.      * @param bool $newVersion
  1308.      * @return $this return this class.
  1309.      */
  1310.     public function setNewVersion (bool $newVersion): self
  1311.     {
  1312.         $this->newVersion $newVersion;
  1313.         return $this;
  1314.     }
  1315.     /**
  1316.      * Get StepBonusComplete.
  1317.      *
  1318.      * @return bool The StepBonusComplete.
  1319.      */
  1320.     public function isStepBonusComplete (): bool
  1321.     {
  1322.         return $this->stepBonusComplete === true;
  1323.     }
  1324.     /**
  1325.      * Set the StepBonusComplete.
  1326.      *
  1327.      * @param bool $stepBonusComplete
  1328.      * @return $this return this class.
  1329.      */
  1330.     public function setStepBonusComplete (bool $stepBonusComplete): self
  1331.     {
  1332.         $this->stepBonusComplete $stepBonusComplete;
  1333.         return $this;
  1334.     }
  1335.     /**
  1336.      * Get StepBuildingComplete.
  1337.      *
  1338.      * @return bool The StepBuildingComplete.
  1339.      */
  1340.     public function isStepBuildingComplete (): bool
  1341.     {
  1342.         return $this->stepBuildingComplete === true;
  1343.     }
  1344.     /**
  1345.      * Set the StepBuildingComplete.
  1346.      *
  1347.      * @param bool $stepBuildingComplete
  1348.      * @return $this return this class.
  1349.      */
  1350.     public function setStepBuildingComplete (bool $stepBuildingComplete): self
  1351.     {
  1352.         $this->stepBuildingComplete $stepBuildingComplete;
  1353.         return $this;
  1354.     }
  1355.     /**
  1356.      * Get StepCustomerComplete.
  1357.      *
  1358.      * @return bool The StepCustomerComplete.
  1359.      */
  1360.     public function isStepCustomerComplete (): bool
  1361.     {
  1362.         return $this->stepCustomerComplete === true;
  1363.     }
  1364.     /**
  1365.      * Set the StepCustomerComplete.
  1366.      *
  1367.      * @param bool $stepCustomerComplete
  1368.      * @return $this return this class.
  1369.      */
  1370.     public function setStepCustomerComplete (bool $stepCustomerComplete): self
  1371.     {
  1372.         $this->stepCustomerComplete $stepCustomerComplete;
  1373.         return $this;
  1374.     }
  1375.     /**
  1376.      * Get StepPaimentComplete.
  1377.      *
  1378.      * @return bool The StepPaimentComplete.
  1379.      */
  1380.     public function isStepPaimentComplete (): bool
  1381.     {
  1382.         return $this->stepPaimentComplete === true;
  1383.     }
  1384.     /**
  1385.      * Set the StepPaimentComplete.
  1386.      *
  1387.      * @param bool $stepPaimentComplete
  1388.      * @return $this return this class.
  1389.      */
  1390.     public function setStepPaimentComplete (bool $stepPaimentComplete): self
  1391.     {
  1392.         $this->stepPaimentComplete $stepPaimentComplete;
  1393.         return $this;
  1394.     }
  1395.     /**
  1396.      * Get StepSignatureComplete.
  1397.      *
  1398.      * @return bool The StepSignatureComplete.
  1399.      */
  1400.     public function isStepSignatureComplete (): bool
  1401.     {
  1402.         return $this->stepSignatureComplete === true;
  1403.     }
  1404.     /**
  1405.      * Set the StepSignatureComplete.
  1406.      *
  1407.      * @param bool $stepSignatureComplete
  1408.      * @return $this return this class.
  1409.      */
  1410.     public function setStepSignatureComplete (bool $stepSignatureComplete): self
  1411.     {
  1412.         $this->stepSignatureComplete $stepSignatureComplete;
  1413.         return $this;
  1414.     }
  1415.     /**
  1416.      * Get StepWasteComplete.
  1417.      *
  1418.      * @return bool The StepWasteComplete.
  1419.      */
  1420.     public function isStepWasteComplete (): bool
  1421.     {
  1422.         return $this->stepWasteComplete === true;
  1423.     }
  1424.     /**
  1425.      * Set the StepWasteComplete.
  1426.      *
  1427.      * @param bool $stepWasteComplete
  1428.      * @return $this return this class.
  1429.      */
  1430.     public function setStepWasteComplete (bool $stepWasteComplete): self
  1431.     {
  1432.         $this->stepWasteComplete $stepWasteComplete;
  1433.         return $this;
  1434.     }
  1435.     /**
  1436.      * Get StepWorkComplete.
  1437.      *
  1438.      * @return bool The StepWorkComplete.
  1439.      */
  1440.     public function isStepWorkComplete (): bool
  1441.     {
  1442.         return $this->stepWorkComplete === true;
  1443.     }
  1444.     /**
  1445.      * Set the StepWorkComplete.
  1446.      *
  1447.      * @param bool $stepWorkComplete
  1448.      * @return $this return this class.
  1449.      */
  1450.     public function setStepWorkComplete (bool $stepWorkComplete): self
  1451.     {
  1452.         $this->stepWorkComplete $stepWorkComplete;
  1453.         return $this;
  1454.     }
  1455.     /**
  1456.      * Get Valid.
  1457.      *
  1458.      * @return bool The Valid.
  1459.      */
  1460.     public function isValid (): bool
  1461.     {
  1462.         return $this->valid === true;
  1463.     }
  1464.     public function jsonFormAdminSerialize (): array
  1465.     {
  1466.         return [
  1467.             'paymentMode'                     => $this->getPaymentMode(),
  1468.             'paymentType'                     => $this->getPaymentType(),
  1469.             'modePayment'                     => $this->getModePayment() ? $this->getModePayment()->jsonSerialize() : null,
  1470.             'deposit'                         => $this->getDeposit(),
  1471.             'customer'                        => $this->getCustomer() ? $this->getCustomer()->jsonFormSerialize() : null,
  1472.             'work'                            => $this->getWork() ? $this->getWork()->jsonFormSerialize() : null,
  1473.             'building'                        => $this->getBuilding() ? $this->getBuilding()->jsonSerialiseForm() : null,
  1474.             'user'                            => $this->getUser() ? ['id' => $this->getUser()->getId()] : ['id' => null],
  1475.             'agency'                          => $this->getAgency() ? ['id' => $this->getAgency()->getId(), 'label' => $this->getAgency()->getLabel()] : null,
  1476.             'datePrevisionnelle'              => $this->getDatePrevisionnelle()->format('Y-m-d'),
  1477.             'dateVisite'                      => $this->getDateVisite()->format('Y-m-d'),
  1478.             'maPrimeRenove'                   => $this->getMaPrimeRenove(),
  1479.             'energySavingCertificate'         => $this->getEnergySavingCertificate(),
  1480.             'wasteTypes'                      => $this->getWasteTypes(),
  1481.             'wasteAddress'                    => $this->getWasteAddress(),
  1482.             'wastePostalCode'                 => $this->getWastePostalCode(),
  1483.             'wasteCity'                       => $this->getWasteCity(),
  1484.             'wasteQuantity'                   => $this->getWasteQuantity(),
  1485.             'commercials'                     => $this->getCommercials()->map(function (User $user) {
  1486.                 return $user->getId();
  1487.             })->toArray(),
  1488.             'creditEtablishment'              => $this->getCreditEtablishment(),
  1489.             'creditAmount'                    => $this->getCreditAmount(),
  1490.             'contributionAmount'              => $this->getContributionAmount(),
  1491.             'creditMensualityWihoutInsurance' => $this->getCreditMensualityWihoutInsurance(),
  1492.             'creditMensualityWithInsurance'   => $this->getCreditMensualityWithInsurance(),
  1493.             'creditDuration'                  => $this->getCreditDuration(),
  1494.             'creditMensualityNumber'          => $this->getCreditMensualityNumber(),
  1495.             'creditAmountWithoutInsurance'    => $this->getCreditAmountWithoutInsurance(),
  1496.             'creditAmountWithInsurance'       => $this->getCreditAmountWithInsurance(),
  1497.             'creditCostWihoutInsurance'       => $this->getCreditCostWihoutInsurance(),
  1498.             'creditCostWithInsurance'         => $this->getCreditCostWithInsurance(),
  1499.             'creditRate'                      => $this->getCreditRate(),
  1500.             'creditTAEG'                      => $this->getCreditTAEG(),
  1501.             'creditDebitRate'                 => $this->getCreditDebitRate(),
  1502.             'creditReport'                    => $this->getCreditReport(),
  1503.             //            'comment'                         => $this->getComment(),
  1504.             'subcontractor'                   => $this->getSubcontractor() ? $this->getSubcontractor()->getId() : null,
  1505.             "deliveryMode"                    => $this->getDeliveryMode(),
  1506.             "nouveauClient"                   => $this->getNouveauClient()
  1507.         ];
  1508.     }
  1509.     /**
  1510.      * @inheritDoc
  1511.      */
  1512.     public function jsonSerialize (): array
  1513.     {
  1514.         return [
  1515.             'id'                              => $this->getId(),
  1516.             'createdAt'                       => $this->getCreatedAt() ? $this->getCreatedAt()->format('Y-m-d H:i:s') : null,
  1517.             'number'                          => $this->getNumber(),
  1518.             'paymentMode'                     => $this->getPaymentMode(),
  1519.             'paymentType'                     => $this->getPaymentType(),
  1520.             'modePayment'                     => $this->getModePayment() ? $this->getModePayment()->jsonSerialize() : null,
  1521.             'deposit'                         => $this->getDeposit(),
  1522.             'customer'                        => $this->getCustomer() ? $this->getCustomer()->jsonSerialize() : null,
  1523.             'work'                            => $this->getWork() ? $this->getWork()->jsonSerialize() : null,
  1524.             'building'                        => $this->getBuilding() ? $this->getBuilding()->jsonSerialize() : null,
  1525.             'purchaseOrder'                   => $this->getPurchaseOrder() ? $this->getPurchaseOrder()->jsonSerialize() : null,
  1526.             'yousignId'                       => $this->getYousign(),
  1527.             'yousignFile'                     => $this->getYousignFile(),
  1528.             'yousignStatus'                   => $this->getYousignStatus(),
  1529.             'user'                            => $this->getUser()->jsonSerializeInfos(),
  1530.             'agency'                          => $this->getAgency() ? $this->getAgency()->jsonSerializeInfos() : null,
  1531.             'datePrevisionnelle'              => $this->getDatePrevisionnelle()->format('Y-m-d'),
  1532.             'dateVisite'                      => $this->getDateVisite()->format('Y-m-d'),
  1533.             'dateEmail'                       => $this->getDateEmail() ? $this->getDateEmail()->format('Y-m-d') : null,
  1534.             'maPrimeRenov'                    => $this->getMaPrimeRenove(),
  1535.             'maPrimeRenove'                   => $this->getMaPrimeRenove(),
  1536.             'energySavingCertificate'         => $this->getEnergySavingCertificate(),
  1537.             'wasteTypes'                      => $this->getWasteTypes(),
  1538.             'wasteAddress'                    => $this->getWasteAddress(),
  1539.             'wastePostalCode'                 => $this->getWastePostalCode(),
  1540.             'wasteCity'                       => $this->getWasteCity(),
  1541.             'wasteQuantity'                   => $this->getWasteQuantity(),
  1542.             'document'                        => $this->getDocument(),
  1543.             'documentDevis'                   => $this->getDocumentDevis(),
  1544.             'documentBonDeCommande'           => $this->getDocumentBonDeCommande(),
  1545.             'signedDocument'                  => $this->getSignedDocument(),
  1546.             'cerfaDocument'                   => $this->getCerfaDocument(),
  1547.             'commercials'                     => $this->getCommercials()->map(function (User $user) {
  1548.                 return $user->jsonSerializeInfos();
  1549.             })->toArray(),
  1550.             'creditEtablishment'              => $this->getCreditEtablishment(),
  1551.             'creditAmount'                    => $this->getCreditAmount(),
  1552.             'contributionAmount'              => $this->getContributionAmount(),
  1553.             'creditMensualityWihoutInsurance' => $this->getCreditMensualityWihoutInsurance(),
  1554.             'creditMensualityWithInsurance'   => $this->getCreditMensualityWithInsurance(),
  1555.             'creditDuration'                  => $this->getCreditDuration(),
  1556.             'creditMensualityNumber'          => $this->getCreditMensualityNumber(),
  1557.             'creditAmountWithoutInsurance'    => $this->getCreditAmountWithoutInsurance(),
  1558.             'creditAmountWithInsurance'       => $this->getCreditAmountWithInsurance(),
  1559.             'creditCostWihoutInsurance'       => $this->getCreditCostWihoutInsurance(),
  1560.             'creditCostWithInsurance'         => $this->getCreditCostWithInsurance(),
  1561.             'creditRate'                      => $this->getCreditRate(),
  1562.             'creditTAEG'                      => $this->getCreditTAEG(),
  1563.             'creditDebitRate'                 => $this->getCreditDebitRate(),
  1564.             'creditReport'                    => $this->getCreditReport(),
  1565.             'comment'                         => $this->getComment(),
  1566.             'advise'                          => $this->getAdvise() ?: "",
  1567.             'subcontractor'                   => $this->getSubcontractor() ? $this->getSubcontractor()->jsonSerializeInfos() : null,
  1568.             'viewByDA'                        => $this->getViewByDA(),
  1569.             'viewByCOLLAB'                    => $this->getViewByCOLLAB(),
  1570.             'programmated'                    => $this->getProgrammated(),
  1571.             'canceled'                        => $this->getCanceled(),
  1572.             'cerfaSignature'                  => $this->getCerfaSignature(),
  1573.             'newVersion'                      => $this->isNewVersion(),
  1574.             'stepCustomerComplete'            => $this->isStepCustomerComplete(),
  1575.             'stepBonusComplete'               => $this->isStepBonusComplete(),
  1576.             'stepBuildingComplete'            => $this->isStepBuildingComplete(),
  1577.             'stepPaimentComplete'             => $this->isStepPaimentComplete(),
  1578.             'stepSignatureComplete'           => $this->isStepSignatureComplete(),
  1579.             'stepWasteComplete'               => $this->isStepWasteComplete(),
  1580.             'stepWorkComplete'                => $this->isStepWorkComplete(),
  1581.             'allStepsComplete'                => $this->isAllStepsComplete(),
  1582.             "deliveryMode"                    => $this->getDeliveryMode(),
  1583.             "status"                          => $this->getStatus(),
  1584.             "nouveauClient"                   => $this->getNouveauClient()
  1585.         ];
  1586.     }
  1587.     /**
  1588.      * @param User $user
  1589.      *
  1590.      * @return $this
  1591.      */
  1592.     public function removeCommercial (User $user): self
  1593.     {
  1594.         $this->commercials->removeElement($user);
  1595.         return $this;
  1596.     }
  1597.     /**
  1598.      * @return $this
  1599.      */
  1600.     public function setAllStepsComplete (): self
  1601.     {
  1602.         $this->setStepCustomerComplete(true)
  1603.             ->setStepBonusComplete(true)
  1604.             ->setStepBuildingComplete(true)
  1605.             ->setStepPaimentComplete(true)
  1606.             ->setStepSignatureComplete(true)
  1607.             ->setStepWasteComplete(true)
  1608.             ->setStepWorkComplete(true);
  1609.         return $this;
  1610.     }
  1611.     /**
  1612.      * Set the Valid.
  1613.      *
  1614.      * @param bool|null $valid
  1615.      * @return $this return this class.
  1616.      */
  1617.     public function setValid (?bool $valid): self
  1618.     {
  1619.         $this->valid $valid;
  1620.         return $this;
  1621.     }
  1622. }