src/Entity/CRM/Order.php line 15

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Repository\OrderRepository;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Entity(repositoryClassOrderRepository::class)]
  11. #[ORM\Table(name'`order`')]
  12. class Order
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(inversedBy'orders')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?OrderStatus $orderStatus null;
  21.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  22.     private ?DateTimeInterface $addedDate null;
  23.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  24.     private ?DateTimeInterface $updateDate null;
  25.     #[ORM\ManyToOne(inversedBy'orders')]
  26.     #[ORM\JoinColumn(nullablefalse)]
  27.     private ?Shipping $shipping null;
  28.     #[ORM\ManyToOne(inversedBy'orders')]
  29.     #[ORM\JoinColumn(nullabletrue)]
  30.     private ?Consultant $consultant null;
  31.     #[ORM\Column(nullabletrue)]
  32.     private ?int $administrationFee null;
  33.     #[ORM\Column(nullabletrue)]
  34.     private ?int $ranking null;
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?string $invoiceNumber null;
  37.     #[ORM\Column]
  38.     private ?bool $optimaInvoiceAdded false;
  39.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  40.     private ?DateTimeInterface $optimaInvoiceAddedAt null;
  41.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  42.     private ?DateTimeInterface $paymentDate null;
  43.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  44.     private ?DateTimeInterface $dateOfPayment null;
  45.     #[ORM\Column]
  46.     private ?bool $ended false;
  47.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  48.     private ?DateTimeInterface $contractExpirationDate null;
  49.     #[ORM\Column]
  50.     private ?bool $fixedTerm false;
  51.     #[ORM\Column]
  52.     private ?bool $contractEnded false;
  53.     #[ORM\Column(length255nullabletrue)]
  54.     private ?string $contractNumber null;
  55.     #[ORM\Column]
  56.     private ?bool $checked false;
  57.     #[ORM\Column]
  58.     private ?bool $firstOrder false;
  59.     #[ORM\ManyToMany(targetEntityImplementer::class, inversedBy'orders')]
  60.     private Collection $implementer;
  61.     #[ORM\Column(length255nullabletrue)]
  62.     private ?string $inspector null;
  63.     #[ORM\Column]
  64.     private ?bool $implementationCompleted false;
  65.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  66.     private ?DateTimeInterface $implementationCompletedDate null;
  67.     #[ORM\ManyToOne(targetEntityself::class)]
  68.     private ?self $parentOrder null;
  69.     #[ORM\Column]
  70.     private ?bool $contractExtended false;
  71.     #[ORM\Column]
  72.     private ?bool $firstContract false;
  73.     #[ORM\Column]
  74.     private ?bool $contractSigned false;
  75.     #[ORM\Column(length255nullabletrue)]
  76.     private ?string $token null;
  77.     #[ORM\Column]
  78.     private ?bool $automaticallyExtended false;
  79.     #[ORM\Column(length255nullabletrue)]
  80.     private ?string $tokenOffice null;
  81.     #[ORM\Column(nullabletrue)]
  82.     private ?int $recommendedNumber null;
  83.     #[ORM\Column(length255nullabletrue)]
  84.     private ?string $officeInvoice null;
  85.     #[ORM\Column(nullabletrue)]
  86.     private ?int $commissionPercentage null;
  87.     #[ORM\Column(nullabletrue)]
  88.     private ?int $activationAmmount null;
  89.     #[ORM\Column]
  90.     private ?bool $officeContractEnded false;
  91.     #[ORM\Column(nullabletrue)]
  92.     private ?int $bhpPackage null;
  93.     #[ORM\Column(length255nullabletrue)]
  94.     private ?string $tokenBhpRodo null;
  95.     #[ORM\Column(nullabletrue)]
  96.     private ?int $reward null;
  97.     #[ORM\Column(length255nullabletrue)]
  98.     private ?string $tokenIod null;
  99.     #[ORM\Column(length255nullabletrue)]
  100.     private ?string $tokenBdo null;
  101.     #[ORM\Column(length255nullabletrue)]
  102.     private ?string $tokenBhpStationary null;
  103.     #[ORM\Column]
  104.     private ?bool $auditReady false;
  105.     #[ORM\Column]
  106.     private ?bool $auditEnded false;
  107.     #[ORM\Column]
  108.     private ?bool $contractWithoutCourses false;
  109.     public float $priceTotal 0;
  110.     public float $priceSubtotal 0;
  111.     public array $prices = [];
  112.     public string $firstOrderString '';
  113.     #[ORM\OneToMany(mappedBy'orderId'targetEntityOrderHistory::class, orphanRemovaltrue)]
  114.     private Collection $orderHistories;
  115.     #[ORM\ManyToOne(inversedBy'orders')]
  116.     #[ORM\JoinColumn(nullablefalse)]
  117.     private ?Customer $customer null;
  118.     #[ORM\ManyToOne(inversedBy'orders')]
  119.     #[ORM\JoinColumn(nullabletrue)]
  120.     private ?CustomerAddress $customerAddress null;
  121.     #[ORM\OneToMany(mappedBy'orderId'targetEntityOrderProduct::class, cascade: ['persist'], orphanRemovaltrue,)]
  122.     private Collection $orderProduct;
  123.     #[ORM\ManyToOne(inversedBy'orders')]
  124.     #[ORM\JoinColumn(nullablefalse)]
  125.     private ?Branch $branch null;
  126.     #[ORM\OneToOne(inversedBy'orderInstance'cascade: ['persist''remove'])]
  127.     private ?Contract $contract null;
  128.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityInstalments::class, cascade: ['persist''remove'])]
  129.     private Collection $instalments;
  130.     #[ORM\Column]
  131.     private ?bool $instalment false;
  132.     #[ORM\OneToOne(inversedBy'orderInst'cascade: ['persist''remove'])]
  133.     private ?ContractIndividual $contractIndividual null;
  134.     #[ORM\Column(nullabletrue)]
  135.     private ?bool $needContract null;
  136.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityOrderNote::class)]
  137.     private Collection $orderNotes;
  138.     #[ORM\ManyToOne(inversedBy'dividedOrders')]
  139.     private ?Consultant $orderDividedConsultant null;
  140.     #[ORM\OneToMany(mappedBy'orderId'targetEntityImplementerOrderHistory::class)]
  141.     private Collection $implementerOrderHistories;
  142.     #[ORM\OneToOne(mappedBy'orderId'cascade: ['persist''remove'])]
  143.     private ?ImplementerOrderData $implementerOrderData null;
  144.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityBhpOrderProduct::class)]
  145.     private Collection $BhpOrderProducts;
  146.     #[ORM\ManyToOne(inversedBy'orders')]
  147.     private ?Admin $admin null;
  148.     #[ORM\Column]
  149.     private bool $doBeforePayment false;
  150.     #[ORM\Column(nullabletrue)]
  151.     private ?int $oldOrderId null;
  152.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityAccountingOfficeCategory::class)]
  153.     private Collection $accountingOfficeCategories;
  154.     #[ORM\OneToMany(mappedBy'OrderInstance'targetEntityBhpJournals::class)]
  155.     private Collection $bhpJournals;
  156.     #[ORM\Column(length255nullabletrue)]
  157.     private ?string $tokenAml null;
  158.     #[ORM\Column(length255nullabletrue)]
  159.     private ?string $tokenAmlrodo null;
  160.     #[ORM\ManyToOne(inversedBy'orders')]
  161.     private ?DebtStatus $debtStatus null;
  162.     #[ORM\Column]
  163.     private ?bool $debtCollection null;
  164.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  165.     private ?\DateTimeInterface $debtContactDate null;
  166.     #[ORM\OneToMany(mappedBy'orderId'targetEntityDebtNote::class)]
  167.     private Collection $debtNotes;
  168.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  169.     private ?string $littleNote null;
  170.     #[ORM\OneToOne(mappedBy'orderId'cascade: ['persist''remove'])]
  171.     private ?OrderCustomer $orderCustomer null;
  172.     #[ORM\OneToOne(mappedBy'orderId'cascade: ['persist''remove'])]
  173.     private ?OrderCustomerAddress $orderCustomerAddress null;
  174.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  175.     private ?\DateTimeInterface $contractSignedDate null;
  176.     #[ORM\OneToMany(mappedBy'orderId'targetEntityOrderDivided::class, orphanRemovaltrue)]
  177.     private Collection $orderDivideds;
  178.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityMailHistory::class)]
  179.     private Collection $mailHistories;
  180.     #[ORM\Column]
  181.     private ?bool $haveInstalments false;
  182.     #[ORM\ManyToOne(inversedBy'extensionOrders')]
  183.     private ?OrderNote $orderNoteForExtension null;
  184.     #[ORM\Column]
  185.     private bool $implementationCompletedWithoutAudit false;
  186.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  187.     private ?\DateTimeInterface $debtStatusChangeDate null;
  188.     #[ORM\ManyToMany(targetEntityConsultant::class, inversedBy'ordersToNotes')]
  189.     private Collection $consultantForNotes;
  190.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityTask::class)]
  191.     private Collection $tasks;
  192.     #[ORM\OneToMany(mappedBy'orderId'targetEntitySmsHistory::class)]
  193.     private Collection $smsHistories;
  194.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  195.     private ?\DateTimeInterface $noticeDate null;
  196.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntitySurveyResponse::class)]
  197.     private Collection $surveyResponses;
  198.     #[ORM\OneToMany(mappedBy'orderInstance'targetEntityZoomList::class)]
  199.     private Collection $zoomLists;
  200.     #[ORM\Column(length255nullabletrue)]
  201.     private ?string $tokenLicencyjnaWebAml null;
  202.     #[ORM\Column(length255nullabletrue)]
  203.     private ?string $tokenLicencyjnaWebAmlPartnerska null;
  204.     #[ORM\Column(length255nullabletrue)]
  205.     private ?string $tokenLicencyjnaWebAmlNieruchomosci null;
  206.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  207.     private ?\DateTimeInterface $dateForPoints null;
  208.     #[ORM\Column]
  209.     private ?bool $pointsAdded null;
  210.     #[ORM\Column]
  211.     private ?bool $forCountingSprawozdaniaOther null;
  212.     #[ORM\Column]
  213.     private ?bool $annex null;
  214.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  215.     private ?\DateTimeInterface $terminationDate null;
  216.     #[ORM\Column]
  217.     private ?bool $effectivelyTerminated null;
  218.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  219.     private ?\DateTimeInterface $contractStartDate null;
  220.     public function __construct()
  221.     {
  222.         $this->addedDate = new DateTime();
  223.         $this->updateDate = new DateTime();
  224.         $this->implementer = new ArrayCollection();
  225.         $this->orderHistories = new ArrayCollection();
  226.         $this->orderProduct = new ArrayCollection();
  227.         $this->instalments = new ArrayCollection();
  228.         $this->orderNotes = new ArrayCollection();
  229.         $this->implementerOrderHistories = new ArrayCollection();
  230.         $this->BhpOrderProducts = new ArrayCollection();
  231.         $this->accountingOfficeCategories = new ArrayCollection();
  232.         $this->bhpJournals = new ArrayCollection();
  233.         $this->debtNotes = new ArrayCollection();
  234.         $this->orderDivideds = new ArrayCollection();
  235.         $this->mailHistories = new ArrayCollection();
  236.         $this->orderNoteForExtension NULL;
  237.         $this->consultantForNotes = new ArrayCollection();
  238.         $this->tasks = new ArrayCollection();
  239.         $this->smsHistories = new ArrayCollection();
  240.         $this->noticeDate NULL;
  241.         $this->surveyResponses = new ArrayCollection();
  242.         $this->zoomLists = new ArrayCollection();
  243.         $this->pointsAdded false;
  244.         $this->dateForPoints NULL;
  245.         $this->forCountingSprawozdaniaOther false;
  246.         $this->annex false;
  247.         $this->terminationDate NULL;
  248.         $this->effectivelyTerminated false;
  249.     }
  250.     public function __toString(): string
  251.     {
  252.         return $this->getId();
  253.     }
  254.     public function getId(): ?int
  255.     {
  256.         return $this->id;
  257.     }
  258.     public function getOrderSubTotal(): float
  259.     {
  260.         $products $this->getOrderProduct();
  261.         $sum 0;
  262.         foreach ($this->getOrderProduct() as $product) {
  263.             $sum $sum+$product->getPriceSubtotal();
  264.         }
  265.         return $sum;
  266.     }
  267.     public function getOrderTotal(): float
  268.     {
  269.         $products $this->getOrderProduct();
  270.         $sum 0;
  271.         foreach ($this->getOrderProduct() as $product) {
  272.             $sum = +$product->getPriceTotal();
  273.         }
  274.         return $sum;
  275.     }
  276.     public function getOrderStatus(): ?OrderStatus
  277.     {
  278.         return $this->orderStatus;
  279.     }
  280.     public function setOrderStatus(?OrderStatus $orderStatus): self
  281.     {
  282.         $this->orderStatus $orderStatus;
  283.         return $this;
  284.     }
  285.     public function getAddedDate(): DateTimeInterface
  286.     {
  287.         return $this->addedDate;
  288.     }
  289.     public function getUpdateDate(): ?DateTimeInterface
  290.     {
  291.         return $this->updateDate;
  292.     }
  293.     public function setUpdateDate(?DateTimeInterface $updateDate): self
  294.     {
  295.         $this->updateDate $updateDate;
  296.         return $this;
  297.     }
  298.     public function getShipping(): ?Shipping
  299.     {
  300.         return $this->shipping;
  301.     }
  302.     public function setShipping(?Shipping $shipping): self
  303.     {
  304.         $this->shipping $shipping;
  305.         return $this;
  306.     }
  307.     public function getConsultant(): ?Consultant
  308.     {
  309.         return $this->consultant;
  310.     }
  311.     public function setConsultant(?Consultant $consultant): self
  312.     {
  313.         $this->consultant $consultant;
  314.         return $this;
  315.     }
  316.     public function getAdministrationFee(): ?int
  317.     {
  318.         $adFeeSum 0;
  319.         foreach($this->orderProduct as $op){
  320.             $adFeeSum += $op->getAdministrationFee();
  321.         }
  322.         return $adFeeSum;
  323.     }
  324.     public function setAdministrationFee(int $administrationFee): self
  325.     {
  326.         $this->administrationFee $administrationFee;
  327.         return $this;
  328.     }
  329.     public function getRanking(): ?int
  330.     {
  331.         return $this->ranking;
  332.     }
  333.     public function setRanking(?int $ranking): self
  334.     {
  335.         $this->ranking $ranking;
  336.         return $this;
  337.     }
  338.     public function getInvoiceNumber(): ?string
  339.     {
  340.         return $this->invoiceNumber;
  341.     }
  342.     public function setInvoiceNumber(?string $invoiceNumber): self
  343.     {
  344.         $this->invoiceNumber $invoiceNumber;
  345.         return $this;
  346.     }
  347.     public function isOptimaInvoiceAdded(): ?bool
  348.     {
  349.         return $this->optimaInvoiceAdded;
  350.     }
  351.     public function setOptimaInvoiceAdded(bool $optimaInvoiceAdded): static
  352.     {
  353.         $this->optimaInvoiceAdded $optimaInvoiceAdded;
  354.         return $this;
  355.     }
  356.     public function getOptimaInvoiceAddedAt(): ?DateTimeInterface
  357.     {
  358.         return $this->optimaInvoiceAddedAt;
  359.     }
  360.     public function setOptimaInvoiceAddedAt(?DateTimeInterface $optimaInvoiceAddedAt): static
  361.     {
  362.         $this->optimaInvoiceAddedAt $optimaInvoiceAddedAt;
  363.         return $this;
  364.     }
  365.     public function getPaymentDate(): ?DateTimeInterface
  366.     {
  367.         return $this->paymentDate;
  368.     }
  369.     public function setPaymentDate(?DateTimeInterface $paymentDate): self
  370.     {
  371.         $this->paymentDate $paymentDate;
  372.         return $this;
  373.     }
  374.     public function getDateOfPayment(): ?DateTimeInterface
  375.     {
  376.         return $this->dateOfPayment;
  377.     }
  378.     public function setDateOfPayment(?DateTimeInterface $dateOfPayment): self
  379.     {
  380.         $this->dateOfPayment $dateOfPayment;
  381.         return $this;
  382.     }
  383.     public function isEnded(): ?bool
  384.     {
  385.         return $this->ended;
  386.     }
  387.     public function setEnded(bool $ended): self
  388.     {
  389.         $this->ended $ended;
  390.         return $this;
  391.     }
  392.     public function getContractExpirationDate(): ?DateTimeInterface
  393.     {
  394.         return $this->contractExpirationDate;
  395.     }
  396.     public function setContractExpirationDate(?DateTimeInterface $contractExpirationDate): self
  397.     {
  398.         $this->contractExpirationDate $contractExpirationDate;
  399.         return $this;
  400.     }
  401.     public function isFixedTerm(): ?bool
  402.     {
  403.         return $this->fixedTerm;
  404.     }
  405.     public function setFixedTerm(bool $fixedTerm): self
  406.     {
  407.         $this->fixedTerm $fixedTerm;
  408.         return $this;
  409.     }
  410.     public function isContractEnded(): ?bool
  411.     {
  412.         return $this->contractEnded;
  413.     }
  414.     public function setContractEnded(bool $contractEnded): self
  415.     {
  416.         $this->contractEnded $contractEnded;
  417.         return $this;
  418.     }
  419.     public function getContractNumber(): ?string
  420.     {
  421.         return $this->contractNumber;
  422.     }
  423.     public function setContractNumber(?string $contractNumber): self
  424.     {
  425.         $this->contractNumber $contractNumber;
  426.         return $this;
  427.     }
  428.     public function isChecked(): ?bool
  429.     {
  430.         return $this->checked;
  431.     }
  432.     public function setChecked(bool $checked): self
  433.     {
  434.         $this->checked $checked;
  435.         return $this;
  436.     }
  437.     public function isFirstOrder(): ?bool
  438.     {
  439.         return $this->firstOrder;
  440.     }
  441.     public function setFirstOrder(bool $firstOrder): self
  442.     {
  443.         $this->firstOrder $firstOrder;
  444.         return $this;
  445.     }
  446.     public function getImplementer(): Collection
  447.     {
  448.         return $this->implementer;
  449.     }
  450.     public function addImplementer(Implementer $implementer): self
  451.     {
  452.         if (!$this->implementer->contains($implementer)) {
  453.             $this->implementer->add($implementer);
  454.         }
  455.         return $this;
  456.     }
  457.     public function removeImplementer(Implementer $implementer): self
  458.     {
  459.         $this->implementer->removeElement($implementer);
  460.         return $this;
  461.     }
  462.     public function getAllImplementers(): array
  463.     {
  464.         $implementers = [];
  465.         $orderProducts $this->getOrderProduct();
  466.         foreach ($orderProducts as $orderProduct) {
  467.             $implementersOrderProducts $orderProduct->getImplementerOrderProducts();
  468.             foreach ($implementersOrderProducts as $implementersOrderProduct) {
  469.                 if(count($implementersOrderProduct->getProduct()->getChildProducts())===0) {
  470.                     $iopImplementers $implementersOrderProduct->getImplementer();
  471.                     foreach ($iopImplementers as $iopImplementer) {
  472.                         if (!in_array($iopImplementer$implementers)) {
  473.                             $implementers[] = $iopImplementer;
  474.                         }
  475.                     }
  476.                 }
  477.             }
  478.         }
  479.         return $implementers;
  480.     }
  481.     public function getAllImplementersForNotCompletedAndNotNeeded(): array
  482.     {
  483.         $implementers = [];
  484.         $orderProducts $this->getOrderProduct();
  485.         foreach ($orderProducts as $orderProduct) {
  486.             $implementersOrderProducts $orderProduct->getImplementerOrderProducts();
  487.             foreach ($implementersOrderProducts as $implementersOrderProduct) {
  488.                 $status $implementersOrderProduct->getStatus();
  489.                 if ($status === null || (!$status->isEnding() && !$status->isNotNeeded())) {
  490.                     if(count($implementersOrderProduct->getProduct()->getChildProducts())===0) {
  491.                         $iopImplementers $implementersOrderProduct->getImplementer();
  492.                         foreach ($iopImplementers as $iopImplementer) {
  493.                             if (!in_array($iopImplementer$implementers)) {
  494.                                 $implementers[] = $iopImplementer;
  495.                             }
  496.                         }
  497.                     }
  498.                 }
  499.             }
  500.         }
  501.         return $implementers;
  502.     }
  503.     public function getInspector(): ?string
  504.     {
  505.         return $this->inspector;
  506.     }
  507.     public function setInspector(?string $inspector): self
  508.     {
  509.         $this->inspector $inspector;
  510.         return $this;
  511.     }
  512.     public function isImplementationCompleted(): ?bool
  513.     {
  514.         return $this->implementationCompleted;
  515.     }
  516.     public function setImplementationCompleted(bool $implementationCompleted): self
  517.     {
  518.         $this->implementationCompleted $implementationCompleted;
  519.         return $this;
  520.     }
  521.     public function getImplementationCompletedDate(): ?DateTimeInterface
  522.     {
  523.         return $this->implementationCompletedDate;
  524.     }
  525.     public function setImplementationCompletedDate(?DateTimeInterface $implementationCompletedDate): self
  526.     {
  527.         $this->implementationCompletedDate $implementationCompletedDate;
  528.         return $this;
  529.     }
  530.     public function getParentOrder(): ?self
  531.     {
  532.         return $this->parentOrder;
  533.     }
  534.     public function setParentOrder(?self $parentOrder): self
  535.     {
  536.         $this->parentOrder $parentOrder;
  537.         return $this;
  538.     }
  539.     public function isContractExtended(): ?bool
  540.     {
  541.         return $this->contractExtended;
  542.     }
  543.     public function setContractExtended(bool $contractExtended): self
  544.     {
  545.         $this->contractExtended $contractExtended;
  546.         return $this;
  547.     }
  548.     public function isFirstContract(): ?bool
  549.     {
  550.         return $this->firstContract;
  551.     }
  552.     public function setFirstContract(bool $firstContract): self
  553.     {
  554.         $this->firstContract $firstContract;
  555.         return $this;
  556.     }
  557.     public function isContractSigned(): ?bool
  558.     {
  559.         return $this->contractSigned;
  560.     }
  561.     public function setContractSigned(bool $contractSigned): self
  562.     {
  563.         $this->contractSigned $contractSigned;
  564.         return $this;
  565.     }
  566.     public function getToken(): ?string
  567.     {
  568.         return $this->token;
  569.     }
  570.     public function setToken(?string $token): self
  571.     {
  572.         $this->token $token;
  573.         return $this;
  574.     }
  575.     public function isAutomaticallyExtended(): ?bool
  576.     {
  577.         return $this->automaticallyExtended;
  578.     }
  579.     public function setAutomaticallyExtended(bool $automaticallyExtended): self
  580.     {
  581.         $this->automaticallyExtended $automaticallyExtended;
  582.         ($automaticallyExtended)?$this->setNoticeDate(NULL):$this->setNoticeDate(new DateTime());
  583.         return $this;
  584.     }
  585.     public function getTokenOffice(): ?string
  586.     {
  587.         return $this->tokenOffice;
  588.     }
  589.     public function setTokenOffice(?string $tokenOffice): self
  590.     {
  591.         $this->tokenOffice $tokenOffice;
  592.         return $this;
  593.     }
  594.     public function getRecommendedNumber(): ?int
  595.     {
  596.         return $this->recommendedNumber;
  597.     }
  598.     public function setRecommendedNumber(?int $recommendedNumber): self
  599.     {
  600.         $this->recommendedNumber $recommendedNumber;
  601.         return $this;
  602.     }
  603.     public function getOfficeInvoice(): ?string
  604.     {
  605.         return $this->officeInvoice;
  606.     }
  607.     public function setOfficeInvoice(?string $officeInvoice): self
  608.     {
  609.         $this->officeInvoice $officeInvoice;
  610.         return $this;
  611.     }
  612.     public function getCommissionPercentage(): ?int
  613.     {
  614.         return $this->commissionPercentage;
  615.     }
  616.     public function setCommissionPercentage(?int $commissionPercentage): self
  617.     {
  618.         $this->commissionPercentage $commissionPercentage;
  619.         return $this;
  620.     }
  621.     public function getActivationAmmount(): ?int
  622.     {
  623.         return $this->activationAmmount;
  624.     }
  625.     public function setActivationAmmount(?int $activationAmmount): self
  626.     {
  627.         $this->activationAmmount $activationAmmount;
  628.         return $this;
  629.     }
  630.     public function isOfficeContractEnded(): ?bool
  631.     {
  632.         return $this->officeContractEnded;
  633.     }
  634.     public function setOfficeContractEnded(bool $officeContractEnded): self
  635.     {
  636.         $this->officeContractEnded $officeContractEnded;
  637.         return $this;
  638.     }
  639.     public function getBhpPackage(): ?int
  640.     {
  641.         return $this->bhpPackage;
  642.     }
  643.     public function setBhpPackage(int $bhpPackage): self
  644.     {
  645.         $this->bhpPackage $bhpPackage;
  646.         return $this;
  647.     }
  648.     public function getTokenBhpRodo(): ?string
  649.     {
  650.         return $this->tokenBhpRodo;
  651.     }
  652.     public function setTokenBhpRodo(?string $tokenBhpRodo): self
  653.     {
  654.         $this->tokenBhpRodo $tokenBhpRodo;
  655.         return $this;
  656.     }
  657.     public function getReward(): ?int
  658.     {
  659.         return $this->reward;
  660.     }
  661.     public function setReward(?int $reward): self
  662.     {
  663.         $this->reward $reward;
  664.         return $this;
  665.     }
  666.     public function getTokenIod(): ?string
  667.     {
  668.         return $this->tokenIod;
  669.     }
  670.     public function setTokenIod(?string $tokenIod): self
  671.     {
  672.         $this->tokenIod $tokenIod;
  673.         return $this;
  674.     }
  675.     public function getTokenBdo(): ?string
  676.     {
  677.         return $this->tokenBdo;
  678.     }
  679.     public function setTokenBdo(?string $tokenBdo): self
  680.     {
  681.         $this->tokenBdo $tokenBdo;
  682.         return $this;
  683.     }
  684.     public function getTokenBhpStationary(): ?string
  685.     {
  686.         return $this->tokenBhpStationary;
  687.     }
  688.     public function setTokenBhpStationary(?string $tokenBhpStationary): self
  689.     {
  690.         $this->tokenBhpStationary $tokenBhpStationary;
  691.         return $this;
  692.     }
  693.     public function isAuditReady(): ?bool
  694.     {
  695.         return $this->auditReady;
  696.     }
  697.     public function setAuditReady(bool $auditReady): self
  698.     {
  699.         $this->auditReady $auditReady;
  700.         return $this;
  701.     }
  702.     public function isAuditEnded(): ?bool
  703.     {
  704.         return $this->auditEnded;
  705.     }
  706.     public function setAuditEnded(bool $auditEnded): self
  707.     {
  708.         $this->auditEnded $auditEnded;
  709.         return $this;
  710.     }
  711.     public function isContractWithoutCourses(): ?bool
  712.     {
  713.         return $this->contractWithoutCourses;
  714.     }
  715.     public function setContractWithoutCourses(bool $contractWithoutCourses): self
  716.     {
  717.         $this->contractWithoutCourses $contractWithoutCourses;
  718.         return $this;
  719.     }
  720.     public function getOrderHistories(): Collection
  721.     {
  722.         return $this->orderHistories;
  723.     }
  724.     public function addOrderHistory(OrderHistory $orderHistory): self
  725.     {
  726.         if (!$this->orderHistories->contains($orderHistory)) {
  727.             $this->orderHistories->add($orderHistory);
  728.             $orderHistory->setOrderId($this);
  729.         }
  730.         return $this;
  731.     }
  732.     public function removeOrderHistory(OrderHistory $orderHistory): self
  733.     {
  734.         if ($this->orderHistories->removeElement($orderHistory)) {
  735.             if ($orderHistory->getOrderId() === $this) {
  736.                 $orderHistory->setOrderId(null);
  737.             }
  738.         }
  739.         return $this;
  740.     }
  741.     public function getCustomer(): ?Customer
  742.     {
  743.         return $this->customer;
  744.     }
  745.     public function setCustomer(?Customer $customer): self
  746.     {
  747.         $this->customer $customer;
  748.         return $this;
  749.     }
  750.     public function getCustomerAddress(): ?CustomerAddress
  751.     {
  752.         return $this->customerAddress;
  753.     }
  754.     public function setCustomerAddress(?CustomerAddress $customerAddress): self
  755.     {
  756.         $this->customerAddress $customerAddress;
  757.         return $this;
  758.     }
  759.     public function getOrderProduct(): Collection
  760.     {
  761.         return $this->orderProduct;
  762.     }
  763.     public function addOrderProduct(OrderProduct $orderProduct): self
  764.     {
  765.         if (!$this->orderProduct->contains($orderProduct)) {
  766.             $this->orderProduct->add($orderProduct);
  767.             $orderProduct->setOrderId($this);
  768.         }
  769.         return $this;
  770.     }
  771.     public function removeOrderProduct(OrderProduct $orderProduct): self
  772.     {
  773.         if ($this->orderProduct->removeElement($orderProduct)) {
  774.             if ($orderProduct->getOrderId() === $this) {
  775.                 $orderProduct->setOrderId(null);
  776.             }
  777.         }
  778.         return $this;
  779.     }
  780.     public function getPriceTotal(): float
  781.     {
  782.         $sum 0;
  783.         $products $this->getOrderProduct();
  784.         foreach ($products as $product) {
  785.             $sum $sum + (($product->getPriceSubtotal() * $product->getQuantity()) * (+ ($product->getProduct()->getTax() / 100)));
  786.         }
  787.         return $this->ceiling($sum,2);
  788.     }
  789.     function ceiling($valueint $precision 0) {
  790.         $offset 0.5;
  791.         if ($precision !== 0)
  792.             $offset /= pow(10$precision);
  793.         $final round($value $offset$precisionPHP_ROUND_HALF_DOWN);
  794.         return ($final == -$final);
  795.     }
  796.     public function getPriceSubtotal(): float
  797.     {
  798.         $sum 0;
  799.         $products $this->getOrderProduct();
  800.         foreach ($products as $product) {
  801.             $sum $sum + ($product->getPriceSubtotal() * $product->getQuantity());
  802.         }
  803.         return $sum;
  804.     }
  805.     public function getPrices(): array
  806.     {
  807.         return [
  808.             'subtotal' => number_format($this->getPriceSubtotal(), 2),
  809.             'total' => number_format($this->getPriceTotal(), 2),
  810.         ];
  811.     }
  812.     public function getFirstOrderString(): string
  813.     {
  814.         return $this->isFirstOrder();
  815.     }
  816.     public function getBranch(): ?Branch
  817.     {
  818.         return $this->branch;
  819.     }
  820.     public function setBranch(?Branch $branch): static
  821.     {
  822.         $this->branch $branch;
  823.         return $this;
  824.     }
  825.     public function getContract(): ?Contract
  826.     {
  827.         return $this->contract;
  828.     }
  829.     public function setContract(?Contract $contract): static
  830.     {
  831.         $this->contract $contract;
  832.         return $this;
  833.     }
  834.     /**
  835.      * @return Collection<int, Instalments>
  836.      */
  837.     public function getInstalments(): Collection
  838.     {
  839.         return $this->instalments;
  840.     }
  841.     public function addInstalment(Instalments $instalment): static
  842.     {
  843.         if (!$this->instalments->contains($instalment)) {
  844.             $this->instalments->add($instalment);
  845.             $instalment->setOrderInstance($this);
  846.         }
  847.         return $this;
  848.     }
  849.     public function removeInstalment(Instalments $instalment): static
  850.     {
  851.         if ($this->instalments->removeElement($instalment)) {
  852.             // set the owning side to null (unless already changed)
  853.             if ($instalment->getOrderInstance() === $this) {
  854.                 $instalment->setOrderInstance(null);
  855.             }
  856.         }
  857.         return $this;
  858.     }
  859.     public function isInstalment(): ?bool
  860.     {
  861.         return $this->instalment;
  862.     }
  863.     public function setInstalment(bool $instalment): static
  864.     {
  865.         $this->instalment $instalment;
  866.         return $this;
  867.     }
  868.     public function getContractIndividual(): ?ContractIndividual
  869.     {
  870.         return $this->contractIndividual;
  871.     }
  872.     public function setContractIndividual(?ContractIndividual $contractIndividual): static
  873.     {
  874.         $this->contractIndividual $contractIndividual;
  875.         return $this;
  876.     }
  877.     public function isNeedContract(): ?bool
  878.     {
  879.         return $this->needContract;
  880.     }
  881.     public function setNeedContract(?bool $needContract): static
  882.     {
  883.         $this->needContract $needContract;
  884.         return $this;
  885.     }
  886.     /**
  887.      * @return Collection<int, ImplementerOrderHistory>
  888.      */
  889.     public function getImplementerOrderHistories(): Collection
  890.     {
  891.         return $this->implementerOrderHistories;
  892.     }
  893.     public function addImplementerOrderHistory(ImplementerOrderHistory $implementerOrderHistory): static
  894.     {
  895.         if (!$this->implementerOrderHistories->contains($implementerOrderHistory)) {
  896.             $this->implementerOrderHistories->add($implementerOrderHistory);
  897.             $implementerOrderHistory->setOrderId($this);
  898.         }
  899.         return $this;
  900.     }
  901.     public function removeImplementerOrderHistory(ImplementerOrderHistory $implementerOrderHistory): static
  902.     {
  903.         if ($this->implementerOrderHistories->removeElement($implementerOrderHistory)) {
  904.             // set the owning side to null (unless already changed)
  905.             if ($implementerOrderHistory->getOrderId() === $this) {
  906.                 $implementerOrderHistory->setOrderId(null);
  907.             }
  908.         }
  909.         return $this;
  910.     }
  911.     public function getImplementerOrderData(): ?ImplementerOrderData
  912.     {
  913.         return $this->implementerOrderData;
  914.     }
  915.     public function setImplementerOrderData(ImplementerOrderData $implementerOrderData): static
  916.     {
  917.         // set the owning side of the relation if necessary
  918.         if ($implementerOrderData->getOrderId() !== $this) {
  919.             $implementerOrderData->setOrderId($this);
  920.         }
  921.         $this->implementerOrderData $implementerOrderData;
  922.         return $this;
  923.     }
  924.     /**
  925.      * @return Collection<int, OrderNote>
  926.      */
  927.     public function getOrderNotes(): Collection
  928.     {
  929.         return $this->orderNotes;
  930.     }
  931.     public function addOrderNote(OrderNote $orderNote): static
  932.     {
  933.         if (!$this->orderNotes->contains($orderNote)) {
  934.             $this->orderNotes->add($orderNote);
  935.             $orderNote->setOrderInstance($this);
  936.         }
  937.         return $this;
  938.     }
  939.     public function removeOrderNote(OrderNote $orderNote): static
  940.     {
  941.         if ($this->orderNotes->removeElement($orderNote)) {
  942.             // set the owning side to null (unless already changed)
  943.             if ($orderNote->getOrderInstance() === $this) {
  944.                 $orderNote->setOrderInstance(null);
  945.             }
  946.         }
  947.         return $this;
  948.     }
  949.     public function getOrderDividedConsultant(): ?Consultant
  950.     {
  951.         return $this->orderDividedConsultant;
  952.     }
  953.     public function setOrderDividedConsultant(?Consultant $orderDividedConsultant): static
  954.     {
  955.         $this->orderDividedConsultant $orderDividedConsultant;
  956.         return $this;
  957.     }
  958.     /**
  959.      * @return Collection<int, BhpOrderProduct>
  960.      */
  961.     public function getBhpOrderProducts(): Collection
  962.     {
  963.         return $this->BhpOrderProducts;
  964.     }
  965.     public function addBhpOrderProduct(BhpOrderProduct $BhpOrderProduct): static
  966.     {
  967.         if (!$this->BhpOrderProducts->contains($BhpOrderProduct)) {
  968.             $this->BhpOrderProducts->add($BhpOrderProduct);
  969.             $BhpOrderProduct->setOrderInstance($this);
  970.         }
  971.         return $this;
  972.     }
  973.     public function getAdmin(): ?Admin
  974.     {
  975.         return $this->admin;
  976.     }
  977.     public function setAdmin(?Admin $admin): static
  978.     {
  979.         $this->admin $admin;
  980.         return $this;
  981.     }
  982.     public function removeBhpOrderProduct(BhpOrderProduct $BhpOrderProduct): static
  983.     {
  984.         if ($this->BhpOrderProducts->removeElement($BhpOrderProduct)) {
  985.             // set the owning side to null (unless already changed)
  986.             if ($BhpOrderProduct->getOrderInstance() === $this) {
  987.                 $BhpOrderProduct->setOrderInstance(null);
  988.             }
  989.         }
  990.         return $this;
  991.     }
  992.     public function isDoBeforePayment(): ?bool
  993.     {
  994.         return $this->doBeforePayment;
  995.     }
  996.     public function setDoBeforePayment(bool $doBeforePayment): static
  997.     {
  998.         $this->doBeforePayment $doBeforePayment;
  999.         return $this;
  1000.     }
  1001.     public function getOldOrderId(): ?int
  1002.     {
  1003.         return $this->oldOrderId;
  1004.     }
  1005.     public function setOldOrderId(?int $oldOrderId): static
  1006.     {
  1007.         $this->oldOrderId $oldOrderId;
  1008.         return $this;
  1009.     }
  1010.     public function getAdministrationFeeSum()
  1011.     {
  1012.         $orderProductAdministrationSum 0;
  1013.         foreach($this->orderProduct as $orderProduct){
  1014.             $orderProductAdministrationSum += $orderProduct->getAdministrationFee();
  1015.         }
  1016.         return $orderProductAdministrationSum;
  1017.     }
  1018.     /**
  1019.      * @return Collection<int, AccountingOfficeCategory>
  1020.      */
  1021.     public function getAccountingOfficeCategories(): Collection
  1022.     {
  1023.         return $this->accountingOfficeCategories;
  1024.     }
  1025.     public function addAccountingOfficeCategory(AccountingOfficeCategory $accountingOfficeCategory): static
  1026.     {
  1027.         if (!$this->accountingOfficeCategories->contains($accountingOfficeCategory)) {
  1028.             $this->accountingOfficeCategories->add($accountingOfficeCategory);
  1029.             $accountingOfficeCategory->setOrderInstance($this);
  1030.         }
  1031.         return $this;
  1032.     }
  1033.     public function removeAccountingOfficeCategory(AccountingOfficeCategory $accountingOfficeCategory): static
  1034.     {
  1035.         if ($this->accountingOfficeCategories->removeElement($accountingOfficeCategory)) {
  1036.             // set the owning side to null (unless already changed)
  1037.             if ($accountingOfficeCategory->getOrderInstance() === $this) {
  1038.                 $accountingOfficeCategory->setOrderInstance(null);
  1039.             }
  1040.         }
  1041.         return $this;
  1042.     }
  1043.     /**
  1044.      * @return Collection<int, BhpJournals>
  1045.      */
  1046.     public function getBhpJournals(): Collection
  1047.     {
  1048.         return $this->bhpJournals;
  1049.     }
  1050.     public function addBhpJournal(BhpJournals $bhpJournal): static
  1051.     {
  1052.         if (!$this->bhpJournals->contains($bhpJournal)) {
  1053.             $this->bhpJournals->add($bhpJournal);
  1054.             $bhpJournal->setOrderInstance($this);
  1055.         }
  1056.         return $this;
  1057.     }
  1058.     public function removeBhpJournal(BhpJournals $bhpJournal): static
  1059.     {
  1060.         if ($this->bhpJournals->removeElement($bhpJournal)) {
  1061.             // set the owning side to null (unless already changed)
  1062.             if ($bhpJournal->getOrderInstance() === $this) {
  1063.                 $bhpJournal->setOrderInstance(null);
  1064.             }
  1065.         }
  1066.         return $this;
  1067.     }
  1068.     public function getTokenAml(): ?string
  1069.     {
  1070.         return $this->tokenAml;
  1071.     }
  1072.     public function setTokenAml(?string $tokenAml): static
  1073.     {
  1074.         $this->tokenAml $tokenAml;
  1075.         return $this;
  1076.     }
  1077.     public function getTokenAmlrodo(): ?string
  1078.     {
  1079.         return $this->tokenAmlrodo;
  1080.     }
  1081.     public function setTokenAmlrodo(?string $tokenAmlrodo): static
  1082.     {
  1083.         $this->tokenAmlrodo $tokenAmlrodo;
  1084.         return $this;
  1085.     }
  1086.     public function isWithUmowa():bool
  1087.     {
  1088.         $umowa false;
  1089.         foreach($this->getOrderProduct() as $orderProduct){
  1090.             if($orderProduct->getProduct()->isUmowa()){
  1091.                 $umowa true;
  1092.                 break;
  1093.             }
  1094.         }
  1095.         return $umowa;
  1096.     }
  1097.     public function getDebtStatus(): ?DebtStatus
  1098.     {
  1099.         return $this->debtStatus;
  1100.     }
  1101.     public function setDebtStatus(?DebtStatus $debtStatus): static
  1102.     {
  1103.         $this->debtStatus $debtStatus;
  1104.         return $this;
  1105.     }
  1106.     public function isDebtCollection(): ?bool
  1107.     {
  1108.         return $this->debtCollection;
  1109.     }
  1110.     public function setDebtCollection(bool $debtCollection): static
  1111.     {
  1112.         $this->debtCollection $debtCollection;
  1113.         return $this;
  1114.     }
  1115.     public function getDebtContactDate(): ?\DateTimeInterface
  1116.     {
  1117.         return $this->debtContactDate;
  1118.     }
  1119.     public function setDebtContactDate(?\DateTimeInterface $debtContactDate): static
  1120.     {
  1121.         $this->debtContactDate $debtContactDate;
  1122.         return $this;
  1123.     }
  1124.     /**
  1125.      * @return Collection<int, DebtNote>
  1126.      */
  1127.     public function getDebtNotes(): Collection
  1128.     {
  1129.         return $this->debtNotes;
  1130.     }
  1131.     public function addDebtNote(DebtNote $debtNote): static
  1132.     {
  1133.         if (!$this->debtNotes->contains($debtNote)) {
  1134.             $this->debtNotes->add($debtNote);
  1135.             $debtNote->setOrderId($this);
  1136.         }
  1137.         return $this;
  1138.     }
  1139.     public function removeDebtNote(DebtNote $debtNote): static
  1140.     {
  1141.         if ($this->debtNotes->removeElement($debtNote)) {
  1142.             // set the owning side to null (unless already changed)
  1143.             if ($debtNote->getOrderId() === $this) {
  1144.                 $debtNote->setOrderId(null);
  1145.             }
  1146.         }
  1147.         return $this;
  1148.     }
  1149.     public function getLittleNote(): ?string
  1150.     {
  1151.         return $this->littleNote;
  1152.     }
  1153.     public function setLittleNote(?string $littleNote): static
  1154.     {
  1155.         $this->littleNote $littleNote;
  1156.         return $this;
  1157.     }
  1158.     public function getOrderCustomer(): ?OrderCustomer
  1159.     {
  1160.         return $this->orderCustomer;
  1161.     }
  1162.     public function setOrderCustomer(OrderCustomer $orderCustomer): static
  1163.     {
  1164.         // set the owning side of the relation if necessary
  1165.         if ($orderCustomer->getOrderId() !== $this) {
  1166.             $orderCustomer->setOrderId($this);
  1167.         }
  1168.         $this->orderCustomer $orderCustomer;
  1169.         return $this;
  1170.     }
  1171.     public function getOrderCustomerAddress(): ?OrderCustomerAddress
  1172.     {
  1173.         return $this->orderCustomerAddress;
  1174.     }
  1175.     public function setOrderCustomerAddress(OrderCustomerAddress $orderCustomerAddress): static
  1176.     {
  1177.         // set the owning side of the relation if necessary
  1178.         if ($orderCustomerAddress->getOrderId() !== $this) {
  1179.             $orderCustomerAddress->setOrderId($this);
  1180.         }
  1181.         $this->orderCustomerAddress $orderCustomerAddress;
  1182.         return $this;
  1183.     }
  1184.     public function getContractSignedDate(): ?\DateTimeInterface
  1185.     {
  1186.         return $this->contractSignedDate;
  1187.     }
  1188.     public function setContractSignedDate(?\DateTimeInterface $contractSignedDate): static
  1189.     {
  1190.         $this->contractSignedDate $contractSignedDate;
  1191.         return $this;
  1192.     }
  1193.     /**
  1194.      * @return Collection<int, OrderDivided>
  1195.      */
  1196.     public function getOrderDivideds(): Collection
  1197.     {
  1198.         return $this->orderDivideds;
  1199.     }
  1200.     public function addOrderDivided(OrderDivided $orderDivided): static
  1201.     {
  1202.         if (!$this->orderDivideds->contains($orderDivided)) {
  1203.             $this->orderDivideds->add($orderDivided);
  1204.             $orderDivided->setOrderId($this);
  1205.         }
  1206.         return $this;
  1207.     }
  1208.     /**
  1209.      * @return Collection<int, MailHistory>
  1210.      */
  1211.     public function getMailHistories(): Collection
  1212.     {
  1213.         return $this->mailHistories;
  1214.     }
  1215.     public function addMailHistory(MailHistory $mailHistory): static
  1216.     {
  1217.         if (!$this->mailHistories->contains($mailHistory)) {
  1218.             $this->mailHistories->add($mailHistory);
  1219.             $mailHistory->setOrderInstance($this);
  1220.         }
  1221.         return $this;
  1222.     }
  1223.     public function removeOrderDivided(OrderDivided $orderDivided): static
  1224.     {
  1225.         if ($this->orderDivideds->removeElement($orderDivided)) {
  1226.             // set the owning side to null (unless already changed)
  1227.             if ($orderDivided->getOrderId() === $this) {
  1228.                 $orderDivided->setOrderId(null);
  1229.             }
  1230.         }
  1231.         return $this;
  1232.     }
  1233.     public function removeMailHistory(MailHistory $mailHistory): static
  1234.     {
  1235.         if ($this->mailHistories->removeElement($mailHistory)) {
  1236.             // set the owning side to null (unless already changed)
  1237.             if ($mailHistory->getOrderInstance() === $this) {
  1238.                 $mailHistory->setOrderInstance(null);
  1239.             }
  1240.         }
  1241.         return $this;
  1242.     }
  1243.     public function getOrderDividedSum(): float
  1244.     {
  1245.         $sum 0;
  1246.         foreach($this->getOrderDivideds() as $orderDivided){
  1247.             $sum $sum+$orderDivided->getValue();
  1248.         }
  1249.         return $sum;
  1250.     }
  1251.     public function isHaveInstalments(): ?bool
  1252.     {
  1253.         return $this->haveInstalments;
  1254.     }
  1255.     public function setHaveInstalments(bool $haveInstalments): static
  1256.     {
  1257.         $this->haveInstalments $haveInstalments;
  1258.         return $this;
  1259.     }
  1260.     public function getOrderNoteForExtension(): ?OrderNote
  1261.     {
  1262.         return $this->orderNoteForExtension;
  1263.     }
  1264.     public function setOrderNoteForExtension(?OrderNote $orderNoteForExtension): static
  1265.     {
  1266.         $this->orderNoteForExtension $orderNoteForExtension;
  1267.         return $this;
  1268.     }
  1269.     public function isImplementationCompletedWithoutAudit(): ?bool
  1270.     {
  1271.         return $this->implementationCompletedWithoutAudit;
  1272.     }
  1273.     public function setImplementationCompletedWithoutAudit(bool $implementationCompletedWithoutAudit): static
  1274.     {
  1275.         $this->implementationCompletedWithoutAudit $implementationCompletedWithoutAudit;
  1276.         return $this;
  1277.     }
  1278.     public function getDebtStatusChangeDate(): ?\DateTimeInterface
  1279.     {
  1280.         return $this->debtStatusChangeDate;
  1281.     }
  1282.     public function setDebtStatusChangeDate(?\DateTimeInterface $debtStatusChangeDate): static
  1283.     {
  1284.         $this->debtStatusChangeDate $debtStatusChangeDate;
  1285.         return $this;
  1286.     }
  1287.     /**
  1288.      * @return Collection<int, Consultant>
  1289.      */
  1290.     public function getConsultantForNotes(): Collection
  1291.     {
  1292.         return $this->consultantForNotes;
  1293.     }
  1294.     /**
  1295.      * @return Collection<int, Consultant>|Consultant|Admin
  1296.      */
  1297.     public function getCurrentConsultantsOrAdmin(): Collection|Consultant|Admin
  1298.     {
  1299.         $dateTimeNow = new DateTime();
  1300.         $paymentDate $this->getPaymentDate();
  1301.         $dateOfPayment $this->getDateOfPayment();
  1302.         $consultant $this->consultant;
  1303.         $admin $this->getAdmin();
  1304.         $consultantsForNotes $this->getConsultantForNotes();
  1305.         if (empty($dateOfPayment) && $paymentDate !== null && $dateTimeNow $paymentDate && !$consultantsForNotes->isEmpty()) {
  1306.             return $consultantsForNotes;
  1307.         } else {
  1308.             return $consultant ?? $admin;
  1309.         }
  1310.     }
  1311.     public function addConsultantForNote(Consultant $consultantForNote): static
  1312.     {
  1313.         if (!$this->consultantForNotes->contains($consultantForNote)) {
  1314.             $this->consultantForNotes->add($consultantForNote);
  1315.         }
  1316.         return $this;
  1317.     }
  1318.     public function removeConsultantForNote(Consultant $consultantForNote): static
  1319.     {
  1320.         $this->consultantForNotes->removeElement($consultantForNote);
  1321.         return $this;
  1322.     }
  1323.     /**
  1324.      * @return Collection<int, Task>
  1325.      */
  1326.     public function getTasks(): Collection
  1327.     {
  1328.         return $this->tasks;
  1329.     }
  1330.     public function addTask(Task $task): static
  1331.     {
  1332.         if (!$this->tasks->contains($task)) {
  1333.             $this->tasks->add($task);
  1334.             $task->setOrderInstance($this);
  1335.         }
  1336.         return $this;
  1337.     }
  1338.     public function removeTask(Task $task): static
  1339.     {
  1340.         if ($this->tasks->removeElement($task)) {
  1341.             // set the owning side to null (unless already changed)
  1342.             if ($task->getOrderInstance() === $this) {
  1343.                 $task->setOrderInstance(null);
  1344.             }
  1345.         }
  1346.         return $this;
  1347.     }
  1348.     /**
  1349.      * @return Collection<int, SmsHistory>
  1350.      */
  1351.     public function getSmsHistories(): Collection
  1352.     {
  1353.         return $this->smsHistories;
  1354.     }
  1355.     public function addSmsHistory(SmsHistory $smsHistory): static
  1356.     {
  1357.         if (!$this->smsHistories->contains($smsHistory)) {
  1358.             $this->smsHistories->add($smsHistory);
  1359.             $smsHistory->setOrderId($this);
  1360.         }
  1361.         return $this;
  1362.     }
  1363.     public function removeSmsHistory(SmsHistory $smsHistory): static
  1364.     {
  1365.         if ($this->smsHistories->removeElement($smsHistory)) {
  1366.             // set the owning side to null (unless already changed)
  1367.             if ($smsHistory->getOrderId() === $this) {
  1368.                 $smsHistory->setOrderId(null);
  1369.             }
  1370.         }
  1371.         return $this;
  1372.     }
  1373.     public function getNoticeDate(): ?\DateTimeInterface
  1374.     {
  1375.         return $this->noticeDate;
  1376.     }
  1377.     public function setNoticeDate(?\DateTimeInterface $noticeDate): static
  1378.     {
  1379.         $this->noticeDate $noticeDate;
  1380.         return $this;
  1381.     }
  1382.     /**
  1383.      * @return Collection<int, SurveyResponse>
  1384.      */
  1385.     public function getSurveyResponses(): Collection
  1386.     {
  1387.         return $this->surveyResponses;
  1388.     }
  1389.     public function addSurveyResponse(SurveyResponse $surveyResponse): static
  1390.     {
  1391.         if (!$this->surveyResponses->contains($surveyResponse)) {
  1392.             $this->surveyResponses->add($surveyResponse);
  1393.             $surveyResponse->setOrderInstance($this);
  1394.         }
  1395.         return $this;
  1396.     }
  1397.     public function removeSurveyResponse(SurveyResponse $surveyResponse): static
  1398.     {
  1399.         if ($this->surveyResponses->removeElement($surveyResponse)) {
  1400.             // set the owning side to null (unless already changed)
  1401.             if ($surveyResponse->getOrderInstance() === $this) {
  1402.                 $surveyResponse->setOrderInstance(null);
  1403.             }
  1404.         }
  1405.         return $this;
  1406.     }
  1407.     /**
  1408.      * @return Collection<int, ZoomList>
  1409.      */
  1410.     public function getZoomLists(): Collection
  1411.     {
  1412.         return $this->zoomLists;
  1413.     }
  1414.     public function addZoomList(ZoomList $zoomList): static
  1415.     {
  1416.         if (!$this->zoomLists->contains($zoomList)) {
  1417.             $this->zoomLists->add($zoomList);
  1418.             $zoomList->setOrderInstance($this);
  1419.         }
  1420.         return $this;
  1421.     }
  1422.     public function removeZoomList(ZoomList $zoomList): static
  1423.     {
  1424.         if ($this->zoomLists->removeElement($zoomList)) {
  1425.             // set the owning side to null (unless already changed)
  1426.             if ($zoomList->getOrderInstance() === $this) {
  1427.                 $zoomList->setOrderInstance(null);
  1428.             }
  1429.         }
  1430.         return $this;
  1431.     }
  1432.     public function getTokenLicencyjnaWebAml(): ?string
  1433.     {
  1434.         return $this->tokenLicencyjnaWebAml;
  1435.     }
  1436.     public function setTokenLicencyjnaWebAml(?string $tokenLicencyjnaWebAml): static
  1437.     {
  1438.         $this->tokenLicencyjnaWebAml $tokenLicencyjnaWebAml;
  1439.         return $this;
  1440.     }
  1441.     public function getTokenLicencyjnaWebAmlPartnerska(): ?string
  1442.     {
  1443.         return $this->tokenLicencyjnaWebAmlPartnerska;
  1444.     }
  1445.     public function setTokenLicencyjnaWebAmlPartnerska(?string $tokenLicencyjnaWebAmlPartnerska): static
  1446.     {
  1447.         $this->tokenLicencyjnaWebAmlPartnerska $tokenLicencyjnaWebAmlPartnerska;
  1448.         return $this;
  1449.     }
  1450.     public function getTokenLicencyjnaWebAmlNieruchomosci(): ?string
  1451.     {
  1452.         return $this->tokenLicencyjnaWebAmlNieruchomosci;
  1453.     }
  1454.     public function setTokenLicencyjnaWebAmlNieruchomosci(?string $tokenLicencyjnaWebAmlNieruchomosci): static
  1455.     {
  1456.         $this->tokenLicencyjnaWebAmlNieruchomosci $tokenLicencyjnaWebAmlNieruchomosci;
  1457.         return $this;
  1458.     }
  1459.     public function getDateForPoints(): ?\DateTimeInterface
  1460.     {
  1461.         return $this->dateForPoints;
  1462.     }
  1463.     public function setDateForPoints(?\DateTimeInterface $dateForPoints): static
  1464.     {
  1465.         $this->dateForPoints $dateForPoints;
  1466.         return $this;
  1467.     }
  1468.     public function isPointsAdded(): ?bool
  1469.     {
  1470.         return $this->pointsAdded;
  1471.     }
  1472.     public function setPointsAdded(bool $pointsAdded): static
  1473.     {
  1474.         $this->pointsAdded $pointsAdded;
  1475.         return $this;
  1476.     }
  1477.     public function isForCountingSprawozdaniaOther(): ?bool
  1478.     {
  1479.         return $this->forCountingSprawozdaniaOther;
  1480.     }
  1481.     public function setForCountingSprawozdaniaOther(bool $forCountingSprawozdaniaOther): static
  1482.     {
  1483.         $this->forCountingSprawozdaniaOther $forCountingSprawozdaniaOther;
  1484.         return $this;
  1485.     }
  1486.     public function getOrderProductAgreementToken(): string
  1487.     {
  1488.         $token '';
  1489.         foreach ($this->getOrderProduct() as $orderProduct) {
  1490.             $token = match ($orderProduct->getProduct()->getAgreement()->getType()) {
  1491.                 'rodo' => $orderProduct->getProduct()->getToken(),
  1492.                 'aml' => $orderProduct->getProduct()->getTokenAml(),
  1493.                 'amlrodo' => $orderProduct->getProduct()->getTokenAmlrodo(),
  1494.                 'bdo' => $orderProduct->getProduct()->getTokenBdo(),
  1495.                 'bhpstacjonarna' => $orderProduct->getProduct()->getTokenBhpStationary(),
  1496.                 'biurarachunkowe' => $orderProduct->getProduct()->getTokenOffice(),
  1497.                 'iod' => $orderProduct->getProduct()->getTokenIod(),
  1498.                 'rodobhp' => $orderProduct->getProduct()->getTokenBhpRodo(),
  1499.                 'licencyjnewebaml' => $orderProduct->getProduct()->getTokenLicencyjnaWebAml(),
  1500.                 'licencyjnewebamlpartnerska' => $orderProduct->getProduct()->getTokenLicencyjnaWebAmlPartnerska(),
  1501.                 'licencyjnewebamlnieruchomosci' => $orderProduct->getProduct()->getTokenLicencyjnaWebAmlNieruchomosci(),
  1502.                 default => '',
  1503.             };
  1504.             if($token){
  1505.                 return $token;
  1506.             }else{
  1507.                 return '';
  1508.             }
  1509.         }
  1510.         return $token;
  1511.     }
  1512.     public function isAnnex(): ?bool
  1513.     {
  1514.         return $this->annex;
  1515.     }
  1516.     public function setAnnex(bool $annex): static
  1517.     {
  1518.         $this->annex $annex;
  1519.         return $this;
  1520.     }
  1521.     public function getTerminationDate(): ?\DateTimeInterface
  1522.     {
  1523.         return $this->terminationDate;
  1524.     }
  1525.     public function setTerminationDate(?\DateTimeInterface $terminationDate): static
  1526.     {
  1527.         $this->terminationDate $terminationDate;
  1528.         return $this;
  1529.     }
  1530.     public function isEffectivelyTerminated(): ?bool
  1531.     {
  1532.         return $this->effectivelyTerminated;
  1533.     }
  1534.     public function setEffectivelyTerminated(bool $effectivelyTerminated): static
  1535.     {
  1536.         $this->effectivelyTerminated $effectivelyTerminated;
  1537.         return $this;
  1538.     }
  1539.     public function getRootOrder(): ?self
  1540.     {
  1541.         $order $this->getParentOrder();
  1542.         if ($order === null) {
  1543.             return null;
  1544.         }
  1545.         while ($order->getParentOrder() !== null) {
  1546.             $order $order->getParentOrder();
  1547.         }
  1548.         return $order;
  1549.     }
  1550.     public function getContractStartDate(): ?\DateTimeInterface
  1551.     {
  1552.         return $this->contractStartDate;
  1553.     }
  1554.     public function setContractStartDate(?\DateTimeInterface $contractStartDate): static
  1555.     {
  1556.         $this->contractStartDate $contractStartDate;
  1557.         return $this;
  1558.     }
  1559. }