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