src/Entity/MonthlyCalculation.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MonthlyCalculationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use JMS\Serializer\Annotation as Serializer;
  6. #[ORM\Entity(repositoryClass: MonthlyCalculationRepository::class)]
  7. #[ORM\HasLifecycleCallbacks]
  8. #[Serializer\ExclusionPolicy('ALL')]
  9. class MonthlyCalculation
  10. {
  11.     public const API_SOGEC_ACTION = 'create';
  12.     public const API_SOGEC_CHANNEL = 'FI';
  13.     public const NON_COMPLIANT_DEFINITIVE = 'def';
  14.     public const NON_COMPLIANT_TEMPORARY = 'temp';
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type: 'integer')]
  18.     #[Serializer\SerializedName('participation_id')]
  19.     #[Serializer\Expose]
  20.     private ?int $id = null;
  21.     #[ORM\Column(type: 'integer')]
  22.     private ?int $year = null;
  23.     #[ORM\Column(type: 'integer')]
  24.     private ?int $month = null;
  25.     #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'monthlyCalculations')]
  26.     #[ORM\JoinColumn(nullable: false)]
  27.     private ?User $user;
  28.     #[ORM\Column(type: 'integer')]
  29.     private ?int $exams = null;
  30.     #[ORM\Column(type: 'float')]
  31.     private ?float $euro = null;
  32.     #[ORM\Column(type: 'string', nullable: true)]
  33.     private ?string $num = null;
  34.     #[ORM\Column(type: 'boolean', nullable: true)]
  35.     private ?bool $isConform = null;
  36.     #[ORM\Column(type: 'json', nullable: true)]
  37.     private array $reasonNotConformity = [];
  38.     #[ORM\Column(type: 'string', length: 10, nullable: true)]
  39.     private ?string $nonConformityType = null;
  40.     #[ORM\Column(type: 'string', nullable: true)]
  41.     private ?string $financialStatus = null;
  42.     #[ORM\Column(type: 'date', nullable: true)]
  43.     private ?\DateTimeInterface $financialDate = null;
  44.     #[ORM\Column(type: 'datetime')]
  45.     private ?\DateTimeInterface $createdAt = null;
  46.     #[ORM\Column(type: 'datetime')]
  47.     private ?\DateTimeInterface $updatedAt = null;
  48.     #[ORM\Column(type: 'integer', nullable: true)]
  49.     private ?int $errno = null;
  50.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  51.     private ?string $errmsg = null;
  52.     #[ORM\Column(type: 'integer', nullable: true)]
  53.     private ?int $InvoiceId = null;
  54.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  55.     private ?string $invoiceNumber = null;
  56.     #[Serializer\VirtualProperty]
  57.     #[Serializer\SerializedName('channel')]
  58.     #[Serializer\Groups(['global'])]
  59.     #[Serializer\Expose]
  60.     public function getApiSogecChannel(): string
  61.     {
  62.         return self::API_SOGEC_CHANNEL;
  63.     }
  64.     #[Serializer\VirtualProperty]
  65.     #[Serializer\SerializedName('action')]
  66.     #[Serializer\Groups(['global'])]
  67.     #[Serializer\Expose]
  68.     public function getApiSogecAction(): string
  69.     {
  70.         return self::API_SOGEC_ACTION;
  71.     }
  72.     #[Serializer\VirtualProperty]
  73.     #[Serializer\SerializedName('paiement_request')]
  74.     #[Serializer\Groups(['global'])]
  75.     #[Serializer\Expose]
  76.     public function isPaymentRequest(): int
  77.     {
  78.         return 1;
  79.     }
  80.     public function euroWithVAT(): float
  81.     {
  82.         return round($this->euro * 1.2, 2);
  83.     }
  84.     #[ORM\PrePersist]
  85.     #[ORM\PreUpdate]
  86.     public function updatedTimestamps(): void
  87.     {
  88.         $dateTimeNow = new \DateTime('now');
  89.         $this->setUpdatedAt($dateTimeNow);
  90.         if (null === $this->getCreatedAt()) {
  91.             $this->setCreatedAt($dateTimeNow);
  92.         }
  93.     }
  94.     public function getId(): ?int
  95.     {
  96.         return $this->id;
  97.     }
  98.     public function getYear(): ?int
  99.     {
  100.         return $this->year;
  101.     }
  102.     public function setYear(int $year): self
  103.     {
  104.         $this->year = $year;
  105.         return $this;
  106.     }
  107.     public function getMonth(): ?int
  108.     {
  109.         return $this->month;
  110.     }
  111.     public function getNamedMonth(): string
  112.     {
  113.         $months = [
  114.             1 => 'janvier',
  115.             2 => 'février',
  116.             3 => 'mars',
  117.             4 => 'avril',
  118.             5 => 'mai',
  119.             6 => 'juin',
  120.             7 => 'juillet',
  121.             8 => 'août',
  122.             9 => 'septembre',
  123.             10 => 'octobre',
  124.             11 => 'novembre',
  125.             12 => 'décembre',
  126.         ];
  127.         return $months[$this->month];
  128.     }
  129.     public function setMonth(int $month): self
  130.     {
  131.         $this->month = $month;
  132.         return $this;
  133.     }
  134.     public function getUser(): ?User
  135.     {
  136.         return $this->user;
  137.     }
  138.     public function setUser(?User $user): self
  139.     {
  140.         $this->user = $user;
  141.         return $this;
  142.     }
  143.     public function getExams(): ?int
  144.     {
  145.         return $this->exams;
  146.     }
  147.     public function setExams(int $exams): self
  148.     {
  149.         $this->exams = $exams;
  150.         return $this;
  151.     }
  152.     public function getCreatedAt(): ?\DateTimeInterface
  153.     {
  154.         return $this->createdAt;
  155.     }
  156.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  157.     {
  158.         $this->createdAt = $createdAt;
  159.         return $this;
  160.     }
  161.     public function getUpdatedAt(): ?\DateTimeInterface
  162.     {
  163.         return $this->updatedAt;
  164.     }
  165.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  166.     {
  167.         $this->updatedAt = $updatedAt;
  168.         return $this;
  169.     }
  170.     public function getEuro(): ?float
  171.     {
  172.         return $this->euro;
  173.     }
  174.     public function setEuro(float $euro): self
  175.     {
  176.         $this->euro = $euro;
  177.         return $this;
  178.     }
  179.     public function getNum(): ?string
  180.     {
  181.         return $this->num;
  182.     }
  183.     public function setNum(?string $num): self
  184.     {
  185.         $this->num = $num;
  186.         return $this;
  187.     }
  188.     public function getIsConform(): ?bool
  189.     {
  190.         return $this->isConform;
  191.     }
  192.     public function setIsConform(bool $isConform): self
  193.     {
  194.         $this->isConform = $isConform;
  195.         return $this;
  196.     }
  197.     public function getReasonNotConformity(): ?array
  198.     {
  199.         return $this->reasonNotConformity;
  200.     }
  201.     public function setReasonNotConformity(?array $reasonNotConformity): self
  202.     {
  203.         $this->reasonNotConformity = $reasonNotConformity;
  204.         return $this;
  205.     }
  206.     public function getNonConformityType(): ?string
  207.     {
  208.         return $this->nonConformityType;
  209.     }
  210.     public function setNonConformityType(?string $nonConformityType): self
  211.     {
  212.         $this->nonConformityType = $nonConformityType;
  213.         return $this;
  214.     }
  215.     public function getFinancialStatus(): ?string
  216.     {
  217.         return $this->financialStatus;
  218.     }
  219.     public function setFinancialStatus(?string $financialStatus): self
  220.     {
  221.         $this->financialStatus = $financialStatus;
  222.         return $this;
  223.     }
  224.     public function getFinancialDate(): ?\DateTimeInterface
  225.     {
  226.         return $this->financialDate;
  227.     }
  228.     public function setFinancialDate(?\DateTimeInterface $financialDate): self
  229.     {
  230.         $this->financialDate = $financialDate;
  231.         return $this;
  232.     }
  233.     public function getErrno(): ?int
  234.     {
  235.         return $this->errno;
  236.     }
  237.     public function setErrno(?int $errno): self
  238.     {
  239.         $this->errno = $errno;
  240.         return $this;
  241.     }
  242.     public function getErrmsg(): ?string
  243.     {
  244.         return $this->errmsg;
  245.     }
  246.     public function setErrmsg(?string $errmsg): self
  247.     {
  248.         $this->errmsg = $errmsg;
  249.         return $this;
  250.     }
  251.     public function getInvoiceId(): ?int
  252.     {
  253.         return $this->InvoiceId;
  254.     }
  255.     public function setInvoiceId(?int $InvoiceId): self
  256.     {
  257.         $this->InvoiceId = $InvoiceId;
  258.         return $this;
  259.     }
  260.     public function getInvoiceNumber(): ?string
  261.     {
  262.         return $this->invoiceNumber;
  263.     }
  264.     public function setInvoiceNumber(?string $invoiceNumber): self
  265.     {
  266.         $this->invoiceNumber = $invoiceNumber;
  267.         return $this;
  268.     }
  269. }