src/Containers/CrmSection/ContractContainer/Entities/ContractEntity.php line 132

Open in your IDE?
  1. <?php
  2. namespace App\Containers\CrmSection\ContractContainer\Entities;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Delete;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\GetCollection;
  7. use ApiPlatform\Metadata\Patch;
  8. use ApiPlatform\Metadata\Put;
  9. use ApiPlatform\Metadata\Post;
  10. use ApiPlatform\Metadata\ApiFilter;
  11. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  12. use ApiPlatform\Doctrine\Orm\Filter\NumericFilter;
  13. use ApiPlatform\Doctrine\Orm\Filter\RangeFilter;
  14. use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
  15. use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
  16. use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  17. use Doctrine\ORM\Mapping as ORM;
  18. use Doctrine\DBAL\Types\Types;
  19. use Gedmo\Mapping\Annotation as Gedmo;
  20. use Symfony\Component\Serializer\Annotation\Groups;
  21. use Symfony\Component\Serializer\Annotation\MaxDepth;
  22. use Symfony\Component\Serializer\Annotation\Context;
  23. use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
  24. use App\Containers\CrmSection\ContractContainer\Data\Repositories\ContractRepository;
  25. use App\Containers\CrmSection\ClientContainer\Entities\ClientEntity;
  26. use App\Containers\CrmSection\CarContainer\Entities\CarEntity;
  27. use App\Containers\SettingSection\ListContainer\Entities\InsuranceProductEntity;
  28. use App\Containers\SettingSection\PartnerContainer\Entities\PartnerEntity;
  29. use App\Containers\SettingSection\ListContainer\Entities\FuelTypeEntity;
  30. use App\Containers\SettingSection\ListContainer\Entities\CarTypeEntity;
  31. use App\Containers\SettingSection\ListContainer\Entities\CarBrandEntity;
  32. use App\Containers\SettingSection\ListContainer\Entities\CarModelEntity;
  33. use App\Containers\SettingSection\ListContainer\Entities\SourceEntity;
  34. use App\Containers\SettingSection\ListContainer\Entities\StatusEntity;
  35. use App\Containers\SettingSection\ListContainer\Entities\CarUsageTypeEntity;
  36. use App\Containers\SettingSection\ListContainer\Entities\CarUsageReasonEntity;
  37. use App\Containers\SettingSection\ListContainer\Entities\DepartmentEntity;
  38. use App\Containers\CrmSection\CalculationContainer\Entities\CalculationEntity;
  39. use App\Containers\CrmSection\PrintablesContainer\Entities\PrintableEntity;
  40. use App\Containers\CrmSection\IndexContainer\Entities\TranslationEntity;
  41. use App\Ship\ApiPlatform\Filter\SimpleSearchFilter;
  42. /** 
  43.  * Договор
  44. */
  45. #[ApiResource(
  46.     routePrefix'/crm',
  47.     normalizationContext: [
  48.         'groups' => 'read',
  49.         'enable_max_depth' => true
  50.     ],
  51.     operations: [
  52.         new Get(
  53.             uriTemplate'/contracts/{id}'requirements: ['id' => '\d+'],
  54.             security"is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT') or is_granted('ROLE_READONLY') or is_granted('ROLE_DEPARTMENT_EMPLOYEE')"
  55.         ),
  56.         new Patch(
  57.             uriTemplate'/contracts/{id}'requirements: ['id' => '\d+'],
  58.             security"is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT')"
  59.         ),
  60.         // new Put(
  61.         //     uriTemplate: '/contracts/{id}', requirements: ['id' => '\d+'],
  62.         //     security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT')"
  63.         // ),
  64.         // new Delete(
  65.         //     uriTemplate: '/contracts/{id}', requirements: ['id' => '\d+'],
  66.         //     security: "is_granted('ROLE_ADMIN')"
  67.         // ),
  68.         // new Post(
  69.         //     uriTemplate: '/contracts',
  70.         //     security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT')"
  71.         // ),
  72.         new GetCollection(
  73.             uriTemplate'/contracts',
  74.             security"is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT') or is_granted('ROLE_READONLY') or is_granted('ROLE_DEPARTMENT_EMPLOYEE')"
  75.         ),
  76.     ],
  77.     shortName'CRM_Contracts'
  78. )]
  79. #[ApiFilter(SearchFilter::class, properties: [
  80.     'id' => 'exact',
  81.     'number' => 'partial',
  82.     'carNumber' => 'partial',
  83.     'carVIN' => 'partial',
  84.     'externalCode' => 'partial',
  85.     'carColor' => 'exact'
  86.     'status' => 'exact',
  87.     'state' => 'exact',
  88.     'client' => 'exact',
  89.     'car' => 'exact',
  90.     'insuranceProduct' => 'exact',
  91.     'carUsageType' => 'exact',
  92.     'carUsageReason' => 'exact',
  93.     'calculation' => 'exact',
  94.     'client.department' => 'exact',
  95.     'carFuelType' => 'exact',
  96.     'carType' => 'exact',
  97.     'carBrand' => 'exact',
  98.     'carModel' => 'exact',
  99.     'mainContract' => 'exact',
  100.     'client.name' => 'partial',
  101.     'client.lastName' => 'partial',
  102.     'client.patronymic' => 'partial',
  103.     'client.externalCode' => 'partial',
  104.     'client.phone' => 'exact',
  105.     'client.email' => 'exact',
  106.     'client.inn' => 'exact',
  107.     'partner' => 'exact',
  108.     'insuranceProduct.name' => 'exact',
  109.     'insuranceProduct.code' => 'exact',
  110.     'carBrand.name' => 'exact',
  111.     'carBrand.codeAutoria' => 'exact',
  112.     'carModel.name' => 'exact',
  113.     'carModel.codeAutoria' => 'exact',
  114.     'status.name' => 'exact',
  115.     'status.externalCode' => 'exact',
  116.     'source.name' => 'exact',
  117.     'source.externalCode' => 'exact'
  118. ])]
  119. #[ApiFilter(NumericFilter::class, properties: ['id''dateProduction''rating''ratingReport'])]
  120. #[ApiFilter(RangeFilter::class, properties: ['id''priceUAH''carPriceUSD''carPriceUAH''dateProduction''carEngineVolume''rating''ratingReport''prolongationBalanceKilometers''prolongationAdditionalCoefficientKilometers''currentBalanceKilometers'])]
  121. #[ApiFilter(BooleanFilter::class, properties: ['isProlongation''isActiveMainContract''isPaid''isSentTo1C''isForbidProlongation''isNotCheckOSCPV''isHide'])]
  122. #[ApiFilter(DateFilter::class, properties: ['dateStart''dateEnd''dateConclusionContract''dateSigningContract''dateSigningAct'])]
  123. #[ApiFilter(OrderFilter::class)]
  124. #[ApiFilter(filterClassSimpleSearchFilter::class, properties: [
  125.     'number''carNumber''carVIN''externalCode'
  126. ])]
  127. #[ORM\Entity(repositoryClassContractRepository::class)]
  128. #[ORM\Table(name'`crm_contracts`')]
  129. #[ORM\Index(columns: ['number''car_number'], name'crm_contracts_custom_idx')]
  130. #[Gedmo\TranslationEntity(class: TranslationEntity::class)]
  131. class ContractEntity
  132. {   
  133.     #[ORM\Id]
  134.     #[ORM\GeneratedValue]
  135.     #[ORM\Column(typeTypes::INTEGER)]
  136.     #[Groups(['read'])]
  137.     private ?int $id null;
  138.     #[ORM\Column(typeTypes::STRINGlength255nullabletrueuniquetrue)]
  139.     #[Groups(['read'])]
  140.     private ?string $externalCode null;
  141.     // Номер договора
  142.     #[ORM\Column(typeTypes::STRINGlength50nullabletrueuniquetrue)]
  143.     #[Groups(['read'])]
  144.     private ?string $number null;
  145.     // Статус
  146.     #[ORM\ManyToOne(targetEntityStatusEntity::class)]
  147.     #[ORM\JoinColumn(name'status_id'referencedColumnName'id'nullablefalse)]
  148.     #[Groups(['read'])]
  149.     #[MaxDepth(1)]
  150.     private StatusEntity $status;
  151.     // Состояние
  152.     #[Groups(['read'])]
  153.     #[MaxDepth(1)]
  154.     public ?StatusEntity $state null;
  155.     // Клиент
  156.     #[ORM\ManyToOne(targetEntityClientEntity::class)]
  157.     #[ORM\JoinColumn(name'client_id'referencedColumnName'id'nullablefalse)]
  158.     #[Groups(['read'])]
  159.     #[MaxDepth(2)]
  160.     private ClientEntity $client;
  161.     // Страховой продукт
  162.     #[ORM\ManyToOne(targetEntityInsuranceProductEntity::class)]
  163.     #[ORM\JoinColumn(name'insurance_product_id'referencedColumnName'id'nullablefalse)]
  164.     #[Groups(['read'])]
  165.     #[MaxDepth(1)]
  166.     private InsuranceProductEntity $insuranceProduct;
  167.     // Партнер
  168.     #[ORM\ManyToOne(targetEntityPartnerEntity::class)]
  169.     #[ORM\JoinColumn(name'partner_id'referencedColumnName'id'onDelete'SET NULL')]
  170.     #[Groups(['read'])]
  171.     #[MaxDepth(1)]
  172.     private ?PartnerEntity $partner;
  173.     
  174.     // Типы использования транспорта
  175.     #[ORM\ManyToOne(targetEntityCarUsageTypeEntity::class)]
  176.     #[ORM\JoinColumn(name'car_usage_type_id'referencedColumnName'id'nullablefalse)]
  177.     #[Groups(['read'])]
  178.     #[MaxDepth(1)]
  179.     private CarUsageTypeEntity $carUsageType;
  180.     // Основания использования транспорта
  181.     #[ORM\ManyToOne(targetEntityCarUsageReasonEntity::class)]
  182.     #[ORM\JoinColumn(name'car_usage_reason_id'referencedColumnName'id'nullablefalse)]
  183.     #[Groups(['read'])]
  184.     #[MaxDepth(1)]
  185.     private CarUsageReasonEntity $carUsageReason;
  186.     // Расчёт
  187.     #[ORM\ManyToOne(targetEntityCalculationEntity::class)]
  188.     #[ORM\JoinColumn(name'calculation_id'referencedColumnName'id'nullablefalse)]
  189.     #[Groups(['read'])]
  190.     #[MaxDepth(2)]
  191.     private CalculationEntity $calculation;
  192.     // Стоимость в ГРН
  193.     #[ORM\Column(typeTypes::FLOATscale3nullablefalse)]
  194.     #[Groups(['read'])]
  195.     private float $priceUAH;
  196.     // Стоимость дополнительного километра в ГРН
  197.     #[ORM\Column(typeTypes::FLOATscale3nullablefalse)]
  198.     #[Groups(['read'])]
  199.     private float $costAdditionalKilometerUAH;
  200.     // Оценка вождения автомобилем
  201.     #[ORM\Column(typeTypes::FLOATscale2nullabletrueoptions: ['default' => 0.00])]
  202.     #[Groups(['read'])]
  203.     private ?float $rating 0.00;
  204.     #[ORM\Column(typeTypes::FLOATscale2nullabletrueoptions: ['default' => 0.00])]
  205.     #[Groups(['read'])]
  206.     private ?float $ratingReport 0.00;
  207.     // Номер авто
  208.     #[ORM\Column(typeTypes::STRINGlength50nullablefalse)]
  209.     #[Groups(['read'])]
  210.     private string $carNumber;
  211.     // Год выпуска
  212.     #[ORM\Column(typeTypes::INTEGERlength4nullablefalse)]
  213.     #[Groups(['read'])]
  214.     private int $dateProduction;
  215.     // Стоимость авто в USD
  216.     #[ORM\Column(typeTypes::INTEGERnullablefalse)]
  217.     #[Groups(['read'])]
  218.     private int $carPriceUSD;
  219.     // Стоимость авто в ГРН
  220.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  221.     #[Groups(['read'])]
  222.     private ?int $carPriceUAH null;
  223.     // Объем двигателя
  224.     #[ORM\Column(typeTypes::FLOATscale3nullabletrue)]
  225.     #[Groups(['read'])]
  226.     private ?float $carEngineVolume null;
  227.     // Тип топлива
  228.     #[ORM\ManyToOne(targetEntityFuelTypeEntity::class)]
  229.     #[ORM\JoinColumn(name'car_fuel_type_id'referencedColumnName'id'nullabletrue)]
  230.     #[Groups(['read'])]
  231.     #[MaxDepth(1)]
  232.     private ?FuelTypeEntity $carFuelType null;
  233.     // Тип транспорта
  234.     #[ORM\ManyToOne(targetEntityCarTypeEntity::class)]
  235.     #[ORM\JoinColumn(name'car_type_id'referencedColumnName'id'nullabletrue)]
  236.     #[Groups(['read'])]
  237.     #[MaxDepth(1)]
  238.     private ?CarTypeEntity $carType null;
  239.     // Цвет
  240.     #[ORM\Column(typeTypes::STRINGlength150nullabletrue)]
  241.     #[Gedmo\Translatable]
  242.     #[Groups(['read'])]
  243.     private ?string $carColor null;
  244.     // VIN
  245.     #[ORM\Column(typeTypes::STRINGlength150nullabletrue)]
  246.     #[Groups(['read'])]
  247.     private ?string $carVIN null;
  248.     // Марка
  249.     #[ORM\ManyToOne(targetEntityCarBrandEntity::class)]
  250.     #[ORM\JoinColumn(name'car_brand_id'referencedColumnName'id'nullabletrue)]
  251.     #[Groups(['read'])]
  252.     #[MaxDepth(1)]
  253.     private ?CarBrandEntity $carBrand null;
  254.     // Модель
  255.     #[ORM\ManyToOne(targetEntityCarModelEntity::class)]
  256.     #[ORM\JoinColumn(name'car_model_id'referencedColumnName'id'nullabletrue)]
  257.     #[Groups(['read'])]
  258.     #[MaxDepth(1)]
  259.     private ?CarModelEntity $carModel null;
  260.     // Дата начала действия
  261.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLEnullabletrue)]
  262.     #[Context(
  263.         normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'],
  264.         denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d']
  265.     )]
  266.     #[Groups(['read'])]
  267.     private ?\DateTimeInterface $dateStart null;
  268.     // Дата окончания действия
  269.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLEnullabletrue)]
  270.     #[Context(
  271.         normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'],
  272.         denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d']
  273.     )]
  274.     #[Groups(['read'])]
  275.     private ?\DateTimeInterface $dateEnd null;
  276.     // Дата заключения договора
  277.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLEnullabletrue)]
  278.     #[Context(
  279.         normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s'],
  280.         denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s']
  281.     )]
  282.     #[Groups(['read'])]
  283.     private ?\DateTimeInterface $dateConclusionContract null;
  284.     // Пролонгация
  285.     #[ORM\Column(typeTypes::BOOLEAN)]
  286.     #[Groups(['read'])]
  287.     private ?bool $isProlongation false;
  288.     // Основновной договор при пролонгации
  289.     #[ORM\ManyToOne(targetEntityContractEntity::class)]
  290.     #[ORM\JoinColumn(name'main_contract_id'referencedColumnName'id'nullabletrue)]
  291.     #[Groups(['read'])]
  292.     #[MaxDepth(2)]
  293.     private ?ContractEntity $mainContract null;
  294.     // Активность основной сделки при пролонгации
  295.     #[ORM\Column(typeTypes::BOOLEAN)]
  296.     #[Groups(['read'])]
  297.     private ?bool $isActiveMainContract false;
  298.     // Пролонговано
  299.     #[Groups(['read'])]
  300.     public bool $isProlonged false;
  301.     // Количество бонусов
  302.     #[Groups(['read'])]
  303.     public ?int $bonuses 0;
  304.     // Количество оплаченных километров
  305.     #[Groups(['read'])]
  306.     public ?float $paidKilometers 0.00;
  307.     // Пробег
  308.     #[Groups(['read'])]
  309.     public ?float $mileage 0.00;
  310.     // Остаток километров
  311.     #[Groups(['read'])]
  312.     public ?float $remainingKilometers 0.00;
  313.     // Лимит КМ
  314.     #[ORM\Column(typeTypes::INTEGERnullablefalse)]
  315.     #[Groups(['read'])]
  316.     private ?int $limitKilometers null;
  317.     // Остаток КМ при пролонгации
  318.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  319.     #[Groups(['read'])]
  320.     private ?int $prolongationBalanceKilometers 0;
  321.     #[ORM\Column(typeTypes::FLOATscale3nullabletrue)]
  322.     #[Groups(['read'])]
  323.     private ?float $prolongationAdditionalCoefficientKilometers null;
  324.     // Текущий остаток КМ
  325.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  326.     #[Groups(['read'])]
  327.     private ?int $currentBalanceKilometers 0;
  328.     // Печатная форма
  329.     #[Groups(['read'])]
  330.     public ?PrintableEntity $printable null;
  331.     // Источник
  332.     #[ORM\ManyToOne(targetEntitySourceEntity::class)]
  333.     #[ORM\JoinColumn(name'source_id'referencedColumnName'id'nullabletrue)]
  334.     #[Groups(['read'])]
  335.     #[MaxDepth(1)]
  336.     private ?SourceEntity $source null;
  337.     // Код подписи договора
  338.     #[ORM\Column(typeTypes::STRINGlength100nullabletrue)]
  339.     #[Groups(['read'])]
  340.     private ?string $codeSigningContract null;
  341.     // Дата подписи договора
  342.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLEnullabletrue)]
  343.     #[Context(
  344.         normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s'],
  345.         denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s']
  346.     )]
  347.     #[Groups(['read'])]
  348.     private ?\DateTimeInterface $dateSigningContract null;
  349.     // Код подписи акта
  350.     #[ORM\Column(typeTypes::STRINGlength100nullabletrue)]
  351.     #[Groups(['read'])]
  352.     private ?string $codeSigningAct null;
  353.     // Дата подписи акта
  354.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLEnullabletrue)]
  355.     #[Context(
  356.         normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s'],
  357.         denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s']
  358.     )]
  359.     #[Groups(['read'])]
  360.     private ?\DateTimeInterface $dateSigningAct null;
  361.     // Договор оплачен
  362.     #[ORM\Column(typeTypes::BOOLEAN)]
  363.     #[Groups(['read'])]
  364.     private ?bool $isPaid false;
  365.     // Отправлен в 1С
  366.     #[ORM\Column(typeTypes::BOOLEAN)]
  367.     #[Groups(['read'])]
  368.     private ?bool $isSentTo1C false;
  369.     // Ошибка при отправке в 1С
  370.     #[ORM\Column(typeTypes::STRINGlength255nullabletrue)]
  371.     #[Groups(['read'])]
  372.     private ?string $errorSentTo1C null;
  373.     // Автомобиль
  374.     #[ORM\ManyToOne(targetEntityCarEntity::class)]
  375.     #[ORM\JoinColumn(name'car_id'referencedColumnName'id'nullabletrue)]
  376.     #[Groups(['read'])]
  377.     #[MaxDepth(2)]
  378.     private ?CarEntity $car null;
  379.     // Трекер активен
  380.     #[Groups(['read'])]
  381.     public ?bool $trackerIsActive null;
  382.     // Трекер заблокирован
  383.     #[Groups(['read'])]
  384.     public ?bool $trackerIsBlocked null;
  385.     // Дата деактивации трекера
  386.     #[Context(
  387.         normalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s'],
  388.         denormalizationContext: [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s']
  389.     )]
  390.     #[Groups(['read'])]
  391.     public ?\DateTimeInterface $trackerDeactivationDate null;
  392.     // Запрет пролонгации
  393.     #[ORM\Column(typeTypes::BOOLEAN)]
  394.     #[Groups(['read'])]
  395.     private ?bool $isForbidProlongation false;
  396.     // Не проверять ОСАГО
  397.     #[ORM\Column(typeTypes::BOOLEAN)]
  398.     #[Groups(['read'])]
  399.     private ?bool $isNotCheckOSCPV false;
  400.     // Скрыть
  401.     #[ORM\Column(typeTypes::BOOLEAN)]
  402.     #[Groups(['read'])]
  403.     private ?bool $isHide false;
  404.     #[Gedmo\Timestampable(on'create')]
  405.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  406.     #[Groups(['read'])]
  407.     protected $createdAt;
  408.     #[Gedmo\Timestampable(on'update')]
  409.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  410.     #[Groups(['read'])]
  411.     protected $updatedAt;
  412.     /**
  413.      * Used locale to override Translation listener`s locale
  414.      * this is not a mapped field of entity metadata, just a simple property
  415.      */
  416.     #[Gedmo\Locale]
  417.     private $locale;
  418.     public function getId(): ?int
  419.     {
  420.         return $this->id;
  421.     }
  422.     public function getExternalCode()
  423.     {
  424.         return $this->externalCode;
  425.     }
  426.     public function setExternalCode($code)
  427.     {
  428.         $this->externalCode $code;
  429.         return $this;
  430.     }
  431.     public function getNumber()
  432.     {
  433.         return $this->number;
  434.     }
  435.     public function setNumber($number)
  436.     {
  437.         $this->number $number;
  438.         return $this;
  439.     }
  440.  
  441.     public function getClient()
  442.     {
  443.         return $this->client;
  444.     }
  445.     public function setClient($client)
  446.     {
  447.         $this->client $client;
  448.         return $this;
  449.     }
  450.     public function getInsuranceProduct()
  451.     {
  452.         return $this->insuranceProduct;
  453.     }
  454.     public function setInsuranceProduct($product)
  455.     {
  456.         $this->insuranceProduct $product;
  457.         return $this;
  458.     }
  459.     public function getPartner()
  460.     {
  461.         return $this->partner;
  462.     }
  463.     public function setPartner(?PartnerEntity $partner)
  464.     {
  465.         $this->partner $partner;
  466.         return $this;
  467.     }
  468.     public function getCalculation()
  469.     {
  470.         return $this->calculation;
  471.     }
  472.     public function setCalculation($calculation)
  473.     {
  474.         $this->calculation $calculation;
  475.         return $this;
  476.     }
  477.     public function getCarUsageType()
  478.     {
  479.         return $this->carUsageType;
  480.     }
  481.     public function setCarUsageType($type)
  482.     {
  483.         $this->carUsageType $type;
  484.         return $this;
  485.     }
  486.     public function getCarUsageReason()
  487.     {
  488.         return $this->carUsageReason;
  489.     }
  490.     public function setCarUsageReason($reason)
  491.     {
  492.         $this->carUsageReason $reason;
  493.         return $this;
  494.     }
  495.     public function getPriceUAH()
  496.     {
  497.         return $this->priceUAH;
  498.     }
  499.     public function setPriceUAH($price)
  500.     {
  501.         $this->priceUAH = ($price !== null round($price3) : null);
  502.         return $this;
  503.     }
  504.     public function getCostAdditionalKilometerUAH()
  505.     {
  506.         return $this->costAdditionalKilometerUAH;
  507.     }
  508.     public function setCostAdditionalKilometerUAH($cost)
  509.     {
  510.         $this->costAdditionalKilometerUAH = ($cost !== null round($cost3) : null);
  511.         return $this;
  512.     }
  513.     public function getRating()
  514.     {
  515.         return $this->rating;
  516.     }
  517.     public function setRating($value)
  518.     {
  519.         $this->rating = ($value round($value2) : 0.00);
  520.         return $this;
  521.     }
  522.     public function getRatingReport()
  523.     {
  524.         return $this->ratingReport;
  525.     }
  526.     public function setRatingReport($value)
  527.     {
  528.         $this->ratingReport = ($value round($value2) : 0.00);
  529.         return $this;
  530.     }
  531.     public function getCarNumber()
  532.     {
  533.         return $this->carNumber;
  534.     }
  535.     public function setCarNumber($number)
  536.     {
  537.         $this->carNumber = ($number !== null str_replace(' ',''trim($number)) : null);
  538.         return $this;
  539.     }
  540.     public function setDateProduction($year)
  541.     {
  542.         $this->dateProduction $year;
  543.         return $this;
  544.     }
  545.     public function getDateProduction()
  546.     {
  547.         return $this->dateProduction;
  548.     }
  549.     public function getCarBrand()
  550.     {
  551.         return $this->carBrand;
  552.     }
  553.     public function setCarBrand($brand)
  554.     {
  555.         $this->carBrand $brand;
  556.         return $this;
  557.     }
  558.     public function getCarModel()
  559.     {
  560.         return $this->carModel;
  561.     }
  562.     public function setCarModel($model)
  563.     {
  564.         $this->carModel $model;
  565.         return $this;
  566.     }
  567.     public function getCarPriceUSD()
  568.     {
  569.         return $this->carPriceUSD;
  570.     }
  571.     public function setCarPriceUSD($price)
  572.     {
  573.         $this->carPriceUSD $price;
  574.         return $this;
  575.     }
  576.     public function getCarPriceUAH()
  577.     {
  578.         return $this->carPriceUAH;
  579.     }
  580.     public function setCarPriceUAH($price)
  581.     {
  582.         $this->carPriceUAH $price;
  583.         return $this;
  584.     }
  585.     public function getCarEngineVolume()
  586.     {
  587.         return $this->carEngineVolume;
  588.     }
  589.     public function setCarEngineVolume($value)
  590.     {
  591.         $this->carEngineVolume = ($value !== null round($value3) : null);
  592.         return $this;
  593.     }
  594.     public function getCarFuelType()
  595.     {
  596.         return $this->carFuelType;
  597.     }
  598.     public function setCarFuelType($type)
  599.     {
  600.         $this->carFuelType $type;
  601.         return $this;
  602.     }
  603.     public function getCarType()
  604.     {
  605.         return $this->carType;
  606.     }
  607.     public function setCarType($type)
  608.     {
  609.         $this->carType $type;
  610.         return $this;
  611.     }
  612.     public function getCarColor()
  613.     {
  614.         return $this->carColor;
  615.     }
  616.     public function setCarColor($color)
  617.     {
  618.         $this->carColor $color;
  619.         return $this;
  620.     }
  621.     public function getCarVIN()
  622.     {
  623.         return $this->carVIN;
  624.     }
  625.     public function setCarVIN($VIN)
  626.     {
  627.         $this->carVIN $VIN;
  628.         return $this;
  629.     }
  630.     public function setDateStart(\DateTimeImmutable|null $date)
  631.     {
  632.         $this->dateStart $date;
  633.         return $this;
  634.     }
  635.     public function getDateStart()
  636.     {
  637.         return $this->dateStart;
  638.     }
  639.     public function setDateEnd(\DateTimeImmutable|null $date)
  640.     {
  641.         $this->dateEnd $date;
  642.         return $this;
  643.     }
  644.     public function getDateEnd()
  645.     {
  646.         return $this->dateEnd;
  647.     }
  648.     public function setDateConclusionContract(\DateTimeImmutable|null $date)
  649.     {
  650.         $this->dateConclusionContract $date;
  651.         return $this;
  652.     }
  653.     public function getDateConclusionContract()
  654.     {
  655.         return $this->dateConclusionContract;
  656.     }
  657.     public function getStatus()
  658.     {
  659.         return $this->status;
  660.     }
  661.     public function setStatus($status)
  662.     {
  663.         $this->status $status;
  664.         return $this;
  665.     }
  666.     public function getIsProlongation()
  667.     {
  668.         return $this->isProlongation;
  669.     }
  670.     public function setIsProlongation($value)
  671.     {
  672.         $this->isProlongation $value;
  673.         return $this;
  674.     }
  675.     public function getMainContract()
  676.     {
  677.         return $this->mainContract;
  678.     }
  679.     public function setMainContract($contract)
  680.     {
  681.         $this->mainContract $contract;
  682.         return $this;
  683.     }
  684.     public function getRootContract(): self
  685.     {
  686.         $contract $this;
  687.         while (null !== $contract->getMainContract())
  688.             $contract $contract->getMainContract();
  689.         return $contract;
  690.     }
  691.     public function getIsActiveMainContract()
  692.     {
  693.         return $this->isActiveMainContract;
  694.     }
  695.     public function setIsActiveMainContract($value)
  696.     {
  697.         $this->isActiveMainContract $value;
  698.         return $this;
  699.     }
  700.     public function getLimitKilometers()
  701.     {
  702.         return $this->limitKilometers;
  703.     }
  704.     public function setLimitKilometers($kilometers)
  705.     {
  706.         $this->limitKilometers $kilometers;
  707.         return $this;
  708.     }
  709.     public function getProlongationBalanceKilometers()
  710.     {
  711.         return $this->prolongationBalanceKilometers;
  712.     }
  713.     public function setProlongationBalanceKilometers($kilometers)
  714.     {
  715.         $this->prolongationBalanceKilometers $kilometers;
  716.         return $this;
  717.     }
  718.     public function getProlongationAdditionalCoefficientKilometers()
  719.     {
  720.         return $this->prolongationAdditionalCoefficientKilometers;
  721.     }
  722.     public function setProlongationAdditionalCoefficientKilometers($value)
  723.     {
  724.         $this->prolongationAdditionalCoefficientKilometers $value round($value3) : null;
  725.         return $this;
  726.     }
  727.     public function getCurrentBalanceKilometers()
  728.     {
  729.         return $this->currentBalanceKilometers;
  730.     }
  731.     public function setCurrentBalanceKilometers($kilometers)
  732.     {
  733.         $this->currentBalanceKilometers $kilometers;
  734.         return $this;
  735.     }
  736.     public function getSource()
  737.     {
  738.         return $this->source;
  739.     }
  740.     public function setSource($source)
  741.     {
  742.         $this->source $source;
  743.         return $this;
  744.     }
  745.     // Департамент клиента договора: собственного поля у договора нет
  746.     #[Groups(['read'])]
  747.     public function getDepartment(): ?DepartmentEntity
  748.     {
  749.         return isset($this->client) ? $this->client->getDepartment() : null;
  750.     }
  751.     public function getIsPaid()
  752.     {
  753.         return $this->isPaid;
  754.     }
  755.  
  756.     public function setIsPaid($value)
  757.     {
  758.         $this->isPaid $value;
  759.         return $this;
  760.     }
  761.     public function getIsSentTo1C()
  762.     {
  763.         return $this->isSentTo1C;
  764.     }
  765.     public function setIsSentTo1C($value)
  766.     {
  767.         $this->isSentTo1C $value;
  768.         return $this;
  769.     }
  770.     public function getErrorSentTo1C()
  771.     {
  772.         return $this->errorSentTo1C;
  773.     }
  774.     public function setErrorSentTo1C($error)
  775.     {
  776.         $this->errorSentTo1C $error;
  777.         return $this;
  778.     }
  779.     public function getCodeSigningContract()
  780.     {
  781.         return $this->codeSigningContract;
  782.     }
  783.  
  784.     public function setCodeSigningContract($code)
  785.     {
  786.         $this->codeSigningContract $code;
  787.         return $this;
  788.     }
  789.     public function setDateSigningContract(\DateTimeImmutable|null $date)
  790.     {
  791.         $this->dateSigningContract $date;
  792.         return $this;
  793.     }
  794.     public function getDateSigningContract()
  795.     {
  796.         return $this->dateSigningContract;
  797.     }
  798.     public function getCodeSigningAct()
  799.     {
  800.         return $this->codeSigningAct;
  801.     }
  802.     public function setCodeSigningAct($code)
  803.     {
  804.         $this->codeSigningAct $code;
  805.         return $this;
  806.     }
  807.     public function setDateSigningAct(\DateTimeImmutable|null $date)
  808.     {
  809.         $this->dateSigningAct $date;
  810.         return $this;
  811.     }
  812.     public function getDateSigningAct()
  813.     {
  814.         return $this->dateSigningAct;
  815.     }
  816.     public function getCar()
  817.     {
  818.         return $this->car;
  819.     }
  820.     public function setCar($car)
  821.     {
  822.         $this->car $car;
  823.         return $this;
  824.     }
  825.     public function getIsForbidProlongation()
  826.     {
  827.         return $this->isForbidProlongation;
  828.     }
  829.     public function setIsForbidProlongation($value)
  830.     {
  831.         $this->isForbidProlongation $value;
  832.         return $this;
  833.     }
  834.     public function getIsNotCheckOSCPV()
  835.     {
  836.         return $this->isNotCheckOSCPV;
  837.     }
  838.     public function setIsNotCheckOSCPV($value)
  839.     {
  840.         $this->isNotCheckOSCPV $value;
  841.         return $this;
  842.     }
  843.     public function getIsHide()
  844.     {
  845.         return $this->isHide;
  846.     }
  847.     public function setIsHide($value)
  848.     {
  849.         $this->isHide $value;
  850.         return $this;
  851.     }
  852.     public function getCreatedAt()
  853.     {
  854.         return $this->createdAt;
  855.     }
  856.     public function getUpdatedAt()
  857.     {
  858.         return $this->updatedAt;
  859.     }
  860.     public function setTranslatableLocale($locale)
  861.     {
  862.         $this->locale $locale;
  863.     }
  864. }