| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- <?php
- namespace App\Entity\Billing;
- use AppBundle\Entity\AccessAndFunction\Access;
- use AppBundle\Entity\Core\Tagg;
- use AppBundle\Enum\Billing\PaymentChoiceEnum;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- /**
- * Données de paiement d'une facture BillAccounting
- * NB: il peut y avoir plusieurs lignes pour une facture en cas de paiement en plusieurs fois
- *
- * @Iri("http://schema.org/BillPayment")
- */
- #[ORM\Entity]
- class BillPayment
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['billpayment', 'billpayment_list', 'build_bills', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $id;
- /**
- * @var BillAccounting
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BillAccounting', inversedBy: 'billPayments', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billpayment', 'billpayment_list'])]
- private $bill;
- /**
- * @var AccessBilling
- */
- #[ORM\ManyToOne(targetEntity: 'AccessBilling', inversedBy: 'billDetachedPayments', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billpayment'])]
- private $accessBilling;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['billpayment', 'billpayment_list', 'build_bills_billpayments'])]
- private $receiptDate;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['billpayment', 'billpayment_list', 'build_bills_billpayments', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $effectiveReceiptDate;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PaymentChoiceEnum', 'toArray'])]
- #[Groups(['billpayment', 'billpayment_list', 'build_bills_billpayments', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $paymentChoice;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\BankEnum', 'toArray'])]
- #[Groups(['billpayment', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $bank;
- /**
- * @var string
- *
- *
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billpayment', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $agency;
- /**
- * @var string
- *
- *
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billpayment', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $checkNumber;
- /**
- * @var string
- *
- *
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billpayment', 'billpayment_list', 'account_balance_reimbursements_accessbilling'])]
- private $reference;
- /**
- * @var float
- */
- #[ORM\Column(type: 'float', nullable: true)]
- #[Assert\Type(type: 'float')]
- #[Groups(['billpayment', 'billpayment_list', 'account_balance_reimbursements_accessbilling', 'billpayment_list', 'build_bills_billpayments'])]
- private $amount;
- /**
- * @var BillDebitBalance
- */
- #[ORM\OneToMany(targetEntity: 'BillDebitBalance', mappedBy: 'billPayment', cascade: ['persist'], orphanRemoval: true)]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billpayment_billdebitbalance'])]
- private $billDebitBalances;
- /**
- * @var AccessBilling
- */
- #[ORM\ManyToOne(targetEntity: 'AccessBilling', inversedBy: 'accountBalanceReimbursements', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billpayment', 'billpayment_list'])]
- private $accessBillingAccountBalanceReimbursement;
- /**
- * @var boolean
- */
- #[Groups(['billpayment', 'billpayment_list'])]
- private $isAcquired;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', options: ['default' => 'PAYMENT'])]
- #[Assert\Type(type: 'string')]
- #[Assert\NotNull]
- #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PaymentTypeEnum', 'toArray'])]
- #[Groups(['billpayment', 'billpayment_list', 'account_balance_reimbursements_accessbilling', 'build_bills_billpayments'])]
- private $type= 'PAYMENT';
- /**
- * @var ArrayCollection<Tagg>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'payments')]
- #[Assert\Valid]
- #[ORM\JoinTable(name: 'tag_billPayment', joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'billPayment_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- #[Groups(['billpayment_tags', 'manage_tags', 'billpayment_list'])]
- private $tags;
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->billDebitBalances = new ArrayCollection();
- $this->tags = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set receiptDate
- *
- * @param \DateTime $receiptDate
- *
- * @return BillPayment
- */
- public function setReceiptDate($receiptDate)
- {
- $this->receiptDate = $receiptDate;
- return $this;
- }
- /**
- * Get receiptDate
- *
- * @return \DateTime
- */
- public function getReceiptDate()
- {
- return $this->receiptDate ? $this->receiptDate->format('Y-m-d') : $this->receiptDate;
- }
- /**
- * Set effectiveReceiptDate
- *
- * @param \DateTime $effectiveReceiptDate
- *
- * @return BillPayment
- */
- public function setEffectiveReceiptDate($effectiveReceiptDate)
- {
- $this->effectiveReceiptDate = $effectiveReceiptDate;
- return $this;
- }
- /**
- * Get effectiveReceiptDate
- *
- * @return \DateTime
- */
- public function getEffectiveReceiptDate()
- {
- return $this->effectiveReceiptDate ? $this->effectiveReceiptDate->format('Y-m-d') : $this->effectiveReceiptDate;
- }
- /**
- * Set paymentChoice
- *
- * @param string $paymentChoice
- *
- * @return BillPayment
- */
- public function setPaymentChoice($paymentChoice)
- {
- $this->paymentChoice = $paymentChoice;
- return $this;
- }
- /**
- * Get paymentChoice
- *
- * @return string
- */
- public function getPaymentChoice()
- {
- return $this->paymentChoice;
- }
- /**
- * Set bank
- *
- * @param string $bank
- *
- * @return BillPayment
- */
- public function setBank($bank)
- {
- $this->bank = $bank;
- return $this;
- }
- /**
- * Get bank
- *
- * @return string
- */
- public function getBank()
- {
- return $this->bank;
- }
- /**
- * Set agency
- *
- * @param string $agency
- *
- * @return BillPayment
- */
- public function setAgency($agency)
- {
- $this->agency = $agency;
- return $this;
- }
- /**
- * Get agency
- *
- * @return string
- */
- public function getAgency()
- {
- return $this->agency;
- }
- /**
- * Set checkNumber
- *
- * @param string $checkNumber
- *
- * @return BillPayment
- */
- public function setCheckNumber($checkNumber)
- {
- $this->checkNumber = $checkNumber;
- return $this;
- }
- /**
- * Get checkNumber
- *
- * @return string
- */
- public function getCheckNumber()
- {
- return $this->checkNumber;
- }
- /**
- * Set reference
- *
- * @param string $reference
- *
- * @return BillPayment
- */
- public function setReference($reference)
- {
- $this->reference = $reference;
- return $this;
- }
- /**
- * Get reference
- *
- * @return string
- */
- public function getReference()
- {
- return $this->reference;
- }
- /**
- * Set amount
- *
- * @param float $amount
- *
- * @return BillPayment
- */
- public function setAmount($amount)
- {
- $this->amount = floatval($amount);
- return $this;
- }
- /**
- * Get amount
- *
- * @return float
- */
- public function getAmount()
- {
- return $this->amount;
- }
- /**
- * Set bill
- *
- * @param \AppBundle\Entity\Billing\BillAccounting $bill
- *
- * @return BillPayment
- */
- public function setBill($bill = null)
- {
- $this->bill = $bill;
- return $this;
- }
- /**
- * Get bill
- *
- * @return \AppBundle\Entity\Billing\BillAccounting
- */
- public function getBill()
- {
- return $this->bill;
- }
- /**
- * Gets isAcquired.
- *
- * @return boolean
- */
- public function getIsAcquired()
- {
- $isAcquired = false;
- if($this->getAmount() && !is_null($this->getEffectiveReceiptDate())){
- $isAcquired = true;
- }
- return $isAcquired;
- }
- /**
- * Set accessBilling
- *
- * @param \AppBundle\Entity\Billing\AccessBilling $accessBilling
- *
- * @return BillPayment
- */
- public function setAccessBilling(\AppBundle\Entity\Billing\AccessBilling $accessBilling = null)
- {
- $this->accessBilling = $accessBilling;
- return $this;
- }
- /**
- * Get accessBilling
- *
- * @return \AppBundle\Entity\Billing\AccessBilling
- */
- public function getAccessBilling()
- {
- return $this->accessBilling;
- }
- /**
- * Add billDebitBalance
- *
- * @param \AppBundle\Entity\Billing\BillDebitBalance $billDebitBalance
- *
- * @return BillPayment
- */
- public function addBillDebitBalance(\AppBundle\Entity\Billing\BillDebitBalance $billDebitBalance)
- {
- $billDebitBalance->setBillPayment($this);
- $this->billDebitBalances[] = $billDebitBalance;
- return $this;
- }
- /**
- * Remove billDebitBalance
- *
- * @param \AppBundle\Entity\Billing\BillDebitBalance $billDebitBalance
- */
- public function removeBillDebitBalance(\AppBundle\Entity\Billing\BillDebitBalance $billDebitBalance)
- {
- $this->billDebitBalances->removeElement($billDebitBalance);
- }
- /**
- * Get billDebitBalances
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getBillDebitBalances()
- {
- return $this->billDebitBalances;
- }
- /**
- * Set type
- *
- * @param string $type
- *
- * @return BillPayment
- */
- public function setType($type)
- {
- $this->type = $type;
- return $this;
- }
- /**
- * Get type
- *
- * @return string
- */
- public function getType()
- {
- return $this->type;
- }
- /**
- * Add tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- *
- * @return BillPayment
- */
- public function addTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags[] = $tag;
- return $this;
- }
- /**
- * Remove tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- */
- public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags->removeElement($tag);
- }
- /**
- * Get tags
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getTags()
- {
- return $this->tags;
- }
- /**
- * Set accessBillingAccountBalanceReimbursement
- *
- * @param \AppBundle\Entity\Billing\AccessBilling $accessBillingAccountBalanceReimbursement
- *
- * @return BillPayment
- */
- public function setAccessBillingAccountBalanceReimbursement(\AppBundle\Entity\Billing\AccessBilling $accessBillingAccountBalanceReimbursement = null)
- {
- $this->accessBillingAccountBalanceReimbursement = $accessBillingAccountBalanceReimbursement;
- return $this;
- }
- /**
- * Get accessBillingAccountBalanceReimbursement
- *
- * @return \AppBundle\Entity\Billing\AccessBilling
- */
- public function getAccessBillingAccountBalanceReimbursement()
- {
- return $this->accessBillingAccountBalanceReimbursement;
- }
- }
|