| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539 |
- <?php
- namespace AppBundle\Entity\Billing;
- use AppBundle\Annotation\ExportTranslate;
- use AppBundle\Annotation\ExportSplitFields;
- use AppBundle\Entity\AccessAndFunction\Access;
- use AppBundle\Entity\Core\File;
- use AppBundle\Entity\Core\Tagg;
- use AppBundle\Enum\Billing\PaymentStateEnum;
- use AppBundle\Enum\Billing\PaymentTypeEnum;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Sabre\VObject\Property\VCard\DateTime;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- use AppBundle\Entity\Organization\Organization;
- use Doctrine\Common\Collections\ArrayCollection;
- use AppBundle\Annotation\DefaultField;
- /**
- * Facture ou avoir (@see Bill, BillCredit)
- *
- * @Iri("http://schema.org/BillAccounting")
- */
- #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Billing\Repository\BillRepository')]
- #[ORM\Table(name: 'BillAccounting')]
- #[ORM\InheritanceType('SINGLE_TABLE')]
- #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
- #[ORM\DiscriminatorMap(['billaccounting' => 'BillAccounting', 'bill' => 'Bill', 'billcredit' => 'BillCredit', 'advancepayment' => 'AdvancePayment'])]
- class BillAccounting implements BillAccountingInterface
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['bill', 'billaccounting', 'billaccounting_list', 'bill_list', 'billcredit_list', 'billpayment_list', 'my_bills_show', 'advancepayment_list', 'advance_payment_schoolyear', 'build_bills', 'my_bills_show', 'advancepayment_list', 'advance_payment_schoolyear'])]
- private $id;
- /**
- * @var Organization
- *
- * @DefaultField
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization')]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting', 'bill', 'billcredit'])]
- private $organization;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'bills')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['billaccounting', 'bill', 'advancepayment', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'billcredit_list', 'advancepayment_list', 'build_bills', 'billcredit_list', 'advancepayment_list'])]
- private $access;
- /**
- * @var BillAccessDetail
- */
- #[Assert\Valid]
- #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Billing\BillAccessDetail', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'billpayment_list_bill', 'bill_list', 'billcredit_list', 'build_bills'])]
- private $accessDetail;
- /**
- * @var string
- *
- *
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['bill', 'billaccounting'])]
- private $reference;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Groups(['bill', 'billaccounting', 'build_bills'])]
- private $customerReference;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billaccounting', 'bill', 'advancepayment', 'billaccounting_list', 'bill_list', 'billaccounting_list_bill', 'billcredit_list', 'billpayment_list_bill', 'my_bills_show_bills', 'advancepayment_list', 'advancepayment_list_bill', 'build_bills', 'my_bills_show_bills', 'advancepayment_list', 'advancepayment_list_bill'])]
- private $billNumber;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Groups(['bill', 'billaccounting', 'build_bills'])]
- private $billNumberInteger;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Groups(['bill', 'billaccounting'])]
- private $billCreditInteger;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['billaccounting', 'bill', 'advancepayment', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'my_bills_show_bills', 'billcredit_list', 'advancepayment_list', 'build_bills', 'billcredit_list', 'advancepayment_list'])]
- private $billingDate;
- /**
- * @var string
- *
- *
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billaccounting', 'bill'])]
- private $object;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billaccounting', 'bill', 'build_bills'])]
- private $comments;
- /**
- * @var ArrayCollection<BillLine>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'BillLine', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['billaccounting', 'bill_billline', 'billaccounting_list', 'billpayment_list_bill', 'bill_list', 'billaccounting_list_bill', 'billcredit_list_bill', 'build_bills'])]
- private $billLines;
- /**
- * @var ArrayCollection<BillCredit>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'BillCredit', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['billaccounting', 'bill_billcredit', 'billaccounting_list', 'bill_list', 'advancepayment_list', 'advance_payment_schoolyear'])]
- private $billCredits;
- /**
- * @var ArrayCollection<BillPayment>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'BillPayment', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['billaccounting', 'bill_billpayment', 'build_bills'])]
- private $billPayments;
- /**
- * @var float
- */
- #[Assert\Type(type: 'float')]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'advancepayment_list', 'my_bills_show_bills', 'advancepayment_list', 'build_bills'])]
- private $totalAmountSet;
- /**
- * @var float
- */
- #[Assert\Type(type: 'float')]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'advancepayment_list'])]
- private $totalPending;
- /**
- * @var float
- */
- #[Assert\Type(type: 'float')]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'my_bills_show', 'build_bills'])]
- private $totalRemainingDue;
- /**
- * @var string
- * @ExportTranslate(true)
- */
- #[Assert\Type(type: 'string')]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'advancepayment_list'])]
- private $paymentState;
- /**
- * @var array
- */
- #[ORM\Column(type: 'json_array', nullable: true)]
- #[Groups(['billaccounting', 'bill', 'build_bills'])]
- private $reductionTotal;
- /**
- * @var BillPeriod
- */
- #[Assert\Valid]
- #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Billing\BillPeriod', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'billcredit_list', 'billaccounting_billperiod', 'advancepayment_list', 'build_bills', 'billcredit_list', 'billaccounting_billperiod', 'advancepayment_list'])]
- private $billPeriod;
- /**
- * @var BillTotalDetail
- */
- #[Assert\Valid]
- #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Billing\BillTotalDetail', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
- #[Groups(['billaccounting', 'bill', 'advancepayment', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'billcredit_list', 'build_bills'])]
- private $totalDetail;
- /**
- * @var File
- */
- #[Assert\Valid]
- #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Core\File', cascade: ['persist'], fetch: 'EAGER')]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'billcredit_list', 'my_bills_show_bills'])]
- private $file;
- /**
- * @var string
- */
- #[Groups(['billaccounting', 'billaccounting_list', 'bill'])]
- private $billAccountingNumber;
- /**
- * @var string
- * @ExportTranslate(true)
- */
- #[Groups(['billaccounting', 'billaccounting_list'])]
- private $type;
- /**
- * @var Bill
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BillAccounting', inversedBy: 'billCredits')]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting', 'billcredit', 'billaccounting_list', 'billcredit_list', 'advancepayment_list', 'advance_payment_schoolyear'])]
- private $bill;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billaccounting', 'billcredit', 'billcredit_list'])]
- private $message;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['billaccounting', 'billcredit', 'billaccounting_list', 'billcredit_list'])]
- private $billCreditNumber;
- /**
- * @var ArrayCollection<BillingIntangibleExcludeDate>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'BillingIntangibleExcludeDate', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['billaccounting', 'bill'])]
- private $billingIntangibleExcludeDate;
- /**
- * @var Pes
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\Pes', inversedBy: 'bills', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting_list', 'billaccounting_pes'])]
- private $pes;
- /**
- * @var BergerLevrault
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BergerLevrault', inversedBy: 'bills', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting_list'])]
- private $bergerLevrault;
- /**
- * @var BergerLevrault
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\Ciril', inversedBy: 'bills', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting_list'])]
- private $ciril;
- /**
- * @var Jvs
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\Jvs', inversedBy: 'bills', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting_list', 'billaccounting_jvs'])]
- private $jvs;
- /**
- * @var Jvs
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\SddBank', inversedBy: 'bills', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting_list'])]
- private $sddBank;
- /**
- * @var Jvs
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\SddRegie', inversedBy: 'bills', cascade: ['persist'])]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['billaccounting_list'])]
- private $sddRegie;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => false])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['billaccounting'])]
- private $old = false;
- /**
- * @var array
- */
- #[Groups(['billaccounting', 'billaccounting_list', 'billpayment_list_bill', 'bill_list'])]
- private $listStudents;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => false])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['billaccounting', 'bill', 'build_bills'])]
- private $sepaSampling= false;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'build_bills'])]
- private $samplingDate;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['bill', 'billaccounting', 'billaccounting_list', 'bill_list', 'my_bills_show_bills'])]
- private $availabilityDate;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Groups(['bill'])]
- protected $payfipPaymentToken;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Groups(['bill', 'build_bills'])]
- protected $enforceableTitle;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['bill', 'billaccounting', 'billaccounting_list', 'bill_list', 'my_bills_show_bills'])]
- private $limitPaymentDate;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Groups(['advancepayment', 'advancepayment_list'])]
- private $startSchoolYear;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['advancepayment', 'advancepayment_list'])]
- private $label;
- /**
- * @var bool
- */
- #[Assert\Type(type: 'boolean')]
- #[Groups(['advancepayment_list'])]
- private $isApplied;
- /**
- * @var ArrayCollection<Tagg>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'billAccountings')]
- #[Assert\Valid]
- #[ORM\JoinTable(name: 'tag_billAccounting', joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'billAccounting_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- #[Groups(['billaccounting_tags', 'manage_tags', 'billaccounting_list', 'bill_list', 'billcredit_list', 'advancepayment_list'])]
- private $tags;
- /**
- * @var string
- *
- */
- #[Groups(['template', 'billaccounting_list'])]
- private $studentsTagsTemplate;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime', nullable: true)]
- #[Assert\Date]
- private $payfipUrlDateTime;
- /**
- * The constructor
- */
- public function __construct() {
- $this->billLines = new ArrayCollection();
- $this->billCredits = new ArrayCollection();
- $this->billPayments = new ArrayCollection();
- $this->billingIntangibleExcludeDate = new ArrayCollection();
- $this->tags = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Sets id
- *
- * @param int $id
- * @return this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Set reference
- *
- * @param string $reference
- *
- * @return Bill
- */
- public function setReference($reference)
- {
- $this->reference = $reference;
- return $this;
- }
- /**
- * Get reference
- *
- * @return string
- */
- public function getReference()
- {
- return $this->reference;
- }
- /**
- * Set billingDate
- *
- * @param \DateTime $billingDate
- *
- * @return Bill
- */
- public function setBillingDate($billingDate)
- {
- $this->billingDate = $billingDate;
- return $this;
- }
- /**
- * Get billingDate
- *
- * @return \DateTime
- */
- public function getBillingDate()
- {
- return $this->billingDate ? $this->billingDate->format('Y-m-d') : $this->billingDate;
- }
- /**
- * Set object
- *
- * @param string $object
- *
- * @return Bill
- */
- public function setObject($object)
- {
- $this->object = $object;
- return $this;
- }
- /**
- * Get object
- *
- * @return string
- */
- public function getObject()
- {
- return $this->object;
- }
- /**
- * Set comments
- *
- * @param string $comments
- *
- * @return Bill
- */
- public function setComments($comments)
- {
- $this->comments = $comments;
- return $this;
- }
- /**
- * Get comments
- *
- * @return string
- */
- public function getComments()
- {
- return $this->comments;
- }
- /**
- * Set totalPrice
- *
- * @param float $totalPrice
- *
- * @return Bill
- */
- public function setTotalPrice($totalPrice)
- {
- $this->totalPrice = floatval($totalPrice);
- return $this;
- }
- /**
- * Get totalPrice
- *
- * @return float
- */
- public function getTotalPrice()
- {
- return $this->totalPrice;
- }
- /**
- * Add billLine
- *
- * @param \AppBundle\Entity\Billing\BillLine $billLine
- *
- * @return BillAccounting
- */
- public function addBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
- {
- $billLine->setBill($this);
- $this->billLines[] = $billLine;
- return $this;
- }
- /**
- * Remove billLine
- *
- * @param \AppBundle\Entity\Billing\BillLine $billLine
- */
- public function removeBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
- {
- $this->billLines->removeElement($billLine);
- }
- /**
- * Get billLines
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getBillLines()
- {
- return $this->billLines;
- }
- /**
- * Set totalVat
- *
- * @param float $totalVat
- *
- * @return Bill
- */
- public function setTotalVat($totalVat)
- {
- $this->totalVat = floatval($totalVat);
- return $this;
- }
- /**
- * Get totalVat
- *
- * @return float
- */
- public function getTotalVat()
- {
- return $this->totalVat;
- }
- /**
- * Set access
- *
- * @param \AppBundle\Entity\AccessAndFunction\Access $access
- *
- * @return Bill
- */
- public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
- {
- $this->access = $access;
- return $this;
- }
- /**
- * Get access
- *
- * @return \AppBundle\Entity\AccessAndFunction\Access
- */
- public function getAccess()
- {
- return $this->access;
- }
- /**
- * Add billCredit
- *
- * @param \AppBundle\Entity\Billing\BillCredit $billCredit
- *
- * @return Bill
- */
- public function addBillCredit(\AppBundle\Entity\Billing\BillCredit $billCredit)
- {
- $this->billCredits[] = $billCredit;
- $billCredit->setBill($this);
- return $this;
- }
- /**
- * Remove billCredit
- *
- * @param \AppBundle\Entity\Billing\BillCredit $billCredit
- */
- public function removeBillCredit(\AppBundle\Entity\Billing\BillCredit $billCredit)
- {
- $this->billCredits->removeElement($billCredit);
- }
- /**
- * Get billCredits
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getBillCredits()
- {
- return $this->billCredits;
- }
- /**
- * Add billPayment
- *
- * @param \AppBundle\Entity\Billing\BillPayment $billPayment
- *
- * @return Bill
- */
- public function addBillPayment(\AppBundle\Entity\Billing\BillPayment $billPayment)
- {
- $billPayment->setBill($this);
- $this->billPayments[] = $billPayment;
- return $this;
- }
- /**
- * Remove billPayment
- *
- * @param \AppBundle\Entity\Billing\BillPayment $billPayment
- */
- public function removeBillPayment(\AppBundle\Entity\Billing\BillPayment $billPayment)
- {
- $this->billPayments->removeElement($billPayment);
- }
- /**
- * Get billPayments
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getBillPayments()
- {
- return $this->billPayments;
- }
- /**
- * Get totalAmountSet
- *
- * @return float
- */
- public function getTotalAmountSet()
- {
- if(!is_null($this->getBill()) && get_class($this) !== AdvancePayment::class){
- return 0;
- }
- $totalAmountSet = 0;
- $billPayments = $this->getBillPayments();
- foreach ($billPayments as $billPayment) {
- if($billPayment->getIsAcquired()){
- $totalAmountSet += $billPayment->getAmount();
- }
- foreach ($billPayment->getBillDebitBalances() as $billDebitBalances) {
- if(!$billDebitBalances->getIsUsed())
- $totalAmountSet -= $billDebitBalances->getAmount();
- }
- }
- return $totalAmountSet;
- }
- /**
- * Get totalAmountSet
- *
- * @return float
- */
- public function getTotalPending()
- {
- if(!is_null($this->getBill())){
- return 0;
- }
- $totalPending = 0;
- $billPayments = $this->getBillPayments();
- foreach ($billPayments as $billPayment) {
- if(!$billPayment->getIsAcquired()){
- $totalPending += $billPayment->getAmount();
- }
- }
- return $totalPending;
- }
- /**
- * Get totalRemainingDue
- *
- * @return float
- */
- public function getTotalRemainingDue()
- {
- if(!is_null($this->getBill()) || count($this->getBillCredits()) > 0 ){
- return 0;
- }
- $totalRemainingDue = null;
- if($this->totalDetail && !is_null($this->totalDetail)){
- $totalRemainingDue = round(floatval($this->totalDetail->getTtc()) - $this->getTotalAmountSet(), 2);
- }
- return $totalRemainingDue;
- }
- /**
- * Gets paymentState.
- *
- * @return string
- */
- public function getPaymentState()
- {
- if(!is_null($this->getBill()) || get_class($this) === AdvancePayment::class){
- return PaymentStateEnum::SOLDIER;
- }
- if(count($this->getBillCredits()) > 0 ){
- return PaymentStateEnum::SOLDIER;
- }
- $today = new \DateTime();
- $totalAmountSet = 0;
- $delayed = false;
- $billPayments = $this->getBillPayments();
- foreach ($billPayments as $billPayment) {
- /** @var BillPayment $billPayment **/
- if($billPayment->getIsAcquired()){
- $totalAmountSet += $billPayment->getAmount();
- }elseif(new \DateTime($billPayment->getReceiptDate()) < $today){
- $delayed = true;
- }
- foreach ($billPayment->getBillDebitBalances() as $billDebitBalances) {
- if(!$billDebitBalances->getIsUsed())
- $totalAmountSet -= $billDebitBalances->getAmount();
- }
- }
- if($this->totalDetail && !is_null($this->totalDetail) && number_format(round($totalAmountSet,2),2,'','') >= number_format($this->totalDetail->getTtc(),2,'','')){
- return PaymentStateEnum::SOLDIER;
- }elseif($delayed){
- return PaymentStateEnum::DELAYED;
- }
- return PaymentStateEnum::TO_CASH_IN;
- }
- /**
- * Set billNumber
- *
- * @param string $billNumber
- *
- * @return Bill
- */
- public function setBillNumber($billNumber)
- {
- $this->billNumber = $billNumber;
- return $this;
- }
- /**
- * Get billNumber
- *
- * @return string
- */
- public function getBillNumber()
- {
- return $this->billNumber;
- }
- /**
- * Set reductionTotal
- *
- * @param array $reductionTotal
- *
- * @return Bill
- */
- public function setReductionTotal($reductionTotal)
- {
- $this->reductionTotal = $reductionTotal;
- return $this;
- }
- /**
- * Get reductionTotal
- *
- * @return array
- */
- public function getReductionTotal()
- {
- return $this->reductionTotal;
- }
- /**
- * Set customerReference
- *
- * @param integer $customerReference
- *
- * @return Bill
- */
- public function setCustomerReference($customerReference)
- {
- $this->customerReference = $customerReference;
- return $this;
- }
- /**
- * Get customerReference
- *
- * @return integer
- */
- public function getCustomerReference()
- {
- return $this->customerReference;
- }
- /**
- * Set file
- *
- * @param \AppBundle\Entity\Core\File $file
- *
- * @return Bill
- */
- public function setFile(\AppBundle\Entity\Core\File $file = null)
- {
- $this->file = $file;
- return $this;
- }
- /**
- * Get file
- *
- * @return \AppBundle\Entity\Core\File
- */
- public function getFile()
- {
- return $this->file;
- }
- /**
- * get billAccountingNumber
- *
- * @return mixed
- */
- public function getBillAccountingNumber()
- {
- $billAccountingNumber = '';
- if(get_class($this) === Bill::class || get_class($this) === AdvancePayment::class){
- $pes = $this->organization->getSettings() && array_key_exists('Pes', $this->organization->getSettings()->getModules()) ? $this->organization->getSettings()->getModules()['Pes'] : false;
- if($pes && $this->getBillNumberInteger()){
- $billAccountingNumber = str_pad($this->getBillNumberInteger(), 13, '0', STR_PAD_LEFT);
- }else{
- $billAccountingNumber = $this->billNumber;
- }
- }
- if(get_class($this) === BillCredit::class){
- $billAccountingNumber = $this->billCreditNumber;
- }
- return $billAccountingNumber;
- }
- /**
- * get billAccountingNumber
- *
- * @return mixed
- */
- public function getType()
- {
- $explodeClass = explode("\\",get_class($this));
- return lcfirst(end($explodeClass));
- }
- /**
- * Set organization
- *
- * @param \AppBundle\Entity\Organization\Organization $organization
- *
- * @return BillAccounting
- */
- public function setOrganization(\AppBundle\Entity\Organization\Organization $organization = null)
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * Get organization
- *
- * @return \AppBundle\Entity\Organization\Organization
- */
- public function getOrganization()
- {
- return $this->organization;
- }
- /**
- * Set message
- *
- * @param string $message
- *
- * @return BillCredit
- */
- public function setMessage($message)
- {
- $this->message = $message;
- return $this;
- }
- /**
- * Get message
- *
- * @return string
- */
- public function getMessage()
- {
- return $this->message;
- }
- /**
- * Set bill
- *
- * @param \AppBundle\Entity\Billing\BillAccounting $bill
- *
- * @return BillCredit
- */
- public function setBill(\AppBundle\Entity\Billing\BillAccounting $bill)
- {
- $this->bill = $bill;
- return $this;
- }
- /**
- * Get bill
- *
- * @return \AppBundle\Entity\Billing\Bill
- */
- public function getBill()
- {
- return $this->bill;
- }
- /**
- * Set billCreditNumber
- *
- * @param string $billCreditNumber
- *
- * @return BillCredit
- */
- public function setBillCreditNumber($billCreditNumber)
- {
- $this->billCreditNumber = $billCreditNumber;
- return $this;
- }
- /**
- * Get billCreditNumber
- *
- * @return string
- */
- public function getBillCreditNumber()
- {
- return $this->billCreditNumber;
- }
- /**
- * Add billingIntangibleExcludeDate
- *
- * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
- *
- * @return BillAccounting
- */
- public function addBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
- {
- $billingIntangibleExcludeDate->setBill($this);
- $this->billingIntangibleExcludeDate[] = $billingIntangibleExcludeDate;
- return $this;
- }
- /**
- * Remove billingIntangibleExcludeDate
- *
- * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
- */
- public function removeBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
- {
- $this->billingIntangibleExcludeDate->removeElement($billingIntangibleExcludeDate);
- }
- /**
- * Get billingIntangibleExcludeDate
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getBillingIntangibleExcludeDate()
- {
- return $this->billingIntangibleExcludeDate;
- }
- /**
- * Set pes
- *
- * @param \AppBundle\Entity\Billing\Pes $pes
- *
- * @return BillAccounting
- */
- public function setPes(\AppBundle\Entity\Billing\Pes $pes = null)
- {
- $this->pes = $pes;
- return $this;
- }
- /**
- * Get pes
- *
- * @return \AppBundle\Entity\Billing\Pes
- */
- public function getPes()
- {
- return $this->pes;
- }
- /**
- * Set sddBank
- *
- * @param \AppBundle\Entity\Billing\SddBank $sddBank
- *
- * @return BillAccounting
- */
- public function setSddBank(SddBank $sddBank = null)
- {
- $this->sddBank = $sddBank;
- return $this;
- }
- /**
- * Get SddBank
- *
- * @return \AppBundle\Entity\Billing\SddBank
- */
- public function getSddBank()
- {
- return $this->sddBank;
- }
- /**
- * Set SddRegie
- *
- * @param \AppBundle\Entity\Billing\SddRegie $sddRegie
- *
- * @return BillAccounting
- */
- public function setSddRegie(SddRegie $sddRegie= null)
- {
- $this->sddRegie = $sddRegie;
- return $this;
- }
- /**
- * Get SddRegie
- *
- * @return \AppBundle\Entity\Billing\SddRegie
- */
- public function getSddRegie()
- {
- return $this->sddRegie;
- }
- /**
- * Set old
- *
- * @param boolean $old
- *
- * @return BillAccounting
- */
- public function setOld($old)
- {
- $this->old = $old;
- return $this;
- }
- /**
- * Get old
- *
- * @return boolean
- */
- public function getOld()
- {
- return $this->old;
- }
- /**
- * Set period
- *
- * @param \AppBundle\Entity\Billing\BillPeriod $period
- *
- * @return BillAccounting
- */
- public function setBillPeriod(\AppBundle\Entity\Billing\BillPeriod $billPeriod = null)
- {
- $this->billPeriod = $billPeriod;
- return $this;
- }
- /**
- * Get period
- *
- * @return \AppBundle\Entity\Billing\BillPeriod
- */
- public function getBillPeriod()
- {
- return $this->billPeriod;
- }
- /**
- * Set totalDetail
- *
- * @param \AppBundle\Entity\Billing\BillTotalDetail $totalDetail
- *
- * @return BillAccounting
- */
- public function setTotalDetail(\AppBundle\Entity\Billing\BillTotalDetail $totalDetail = null)
- {
- $this->totalDetail = $totalDetail;
- return $this;
- }
- /**
- * Get totalDetail
- *
- * @return \AppBundle\Entity\Billing\BillTotalDetail
- */
- public function getTotalDetail()
- {
- return $this->totalDetail;
- }
- /**
- * Set accessDetail
- *
- * @param \AppBundle\Entity\Billing\BillAccessDetail $accessDetail
- *
- * @return BillAccounting
- */
- public function setAccessDetail(\AppBundle\Entity\Billing\BillAccessDetail $accessDetail = null)
- {
- $this->accessDetail = $accessDetail;
- return $this;
- }
- /**
- * Get accessDetail
- *
- * @return \AppBundle\Entity\Billing\BillAccessDetail
- */
- public function getAccessDetail()
- {
- return $this->accessDetail;
- }
- /**
- * get listStudents
- *
- * @return array
- */
- public function getListStudents()
- {
- $students = [];
- foreach($this->getBillLines() as $billLine){
- if(!empty($billLine->getAccess()))
- $students[] = $billLine->getAccess()->getPerson()->getFullNameTemplate();
- }
- return array_values(array_unique($students));
- }
- /**
- * Set billNumberInteger
- *
- * @param integer $billNumberInteger
- *
- * @return BillAccounting
- */
- public function setBillNumberInteger($billNumberInteger)
- {
- $this->billNumberInteger = $billNumberInteger;
- return $this;
- }
- /**
- * Get billNumberInteger
- *
- * @return integer
- */
- public function getBillNumberInteger()
- {
- return $this->billNumberInteger;
- }
- /**
- * Set billCreditInteger
- *
- * @param integer $billCreditInteger
- *
- * @return BillAccounting
- */
- public function setBillCreditInteger($billCreditInteger)
- {
- $this->billCreditInteger = $billCreditInteger;
- return $this;
- }
- /**
- * Get billCreditInteger
- *
- * @return integer
- */
- public function getBillCreditInteger()
- {
- return $this->billCreditInteger;
- }
- /**
- * Set sepaSampling
- *
- * @param boolean $sepaSampling
- *
- * @return BillAccounting
- */
- public function setSepaSampling($sepaSampling)
- {
- $this->sepaSampling = $sepaSampling;
- return $this;
- }
- /**
- * Get sepaSampling
- *
- * @return boolean
- */
- public function getSepaSampling()
- {
- return $this->sepaSampling;
- }
- /**
- * Set bergerLevrault
- *
- * @param \AppBundle\Entity\Billing\BergerLevrault $bergerLevrault
- *
- * @return BillAccounting
- */
- public function setBergerLevrault(\AppBundle\Entity\Billing\BergerLevrault $bergerLevrault = null)
- {
- $this->bergerLevrault = $bergerLevrault;
- return $this;
- }
- /**
- * Get bergerLevrault
- *
- * @return \AppBundle\Entity\Billing\BergerLevrault
- */
- public function getBergerLevrault()
- {
- return $this->bergerLevrault;
- }
- /**
- * Set samplingDate
- *
- * @param \DateTime $samplingDate
- *
- * @return BillAccounting
- */
- public function setSamplingDate($samplingDate)
- {
- $this->samplingDate = $samplingDate;
- return $this;
- }
- /**
- * Get samplingDate
- *
- * @return \DateTime
- */
- public function getSamplingDate()
- {
- return $this->samplingDate;
- }
- /**
- * Set availabilityDate
- *
- * @param \DateTime $availabilityDate
- *
- * @return BillAccounting
- */
- public function setAvailabilityDate($availabilityDate)
- {
- $this->availabilityDate = $availabilityDate;
- return $this;
- }
- /**
- * Get availabilityDate
- *
- * @return \DateTime
- */
- public function getAvailabilityDate()
- {
- return $this->availabilityDate;
- }
- /**
- * Set limitPaymentDate
- *
- * @param \DateTime $limitPaymentDate
- *
- * @return BillAccounting
- */
- public function setLimitPaymentDate($limitPaymentDate)
- {
- $this->limitPaymentDate = $limitPaymentDate;
- return $this;
- }
- /**
- * Get limitPaymentDate
- *
- * @return \DateTime
- */
- public function getLimitPaymentDate()
- {
- return $this->limitPaymentDate;
- }
- /**
- * Set payfipPaymentToken
- *
- * @param string $payfipPaymentToken
- *
- * @return BillAccounting
- */
- public function setPayfipPaymentToken($payfipPaymentToken)
- {
- $this->payfipPaymentToken = $payfipPaymentToken;
- return $this;
- }
- /**
- * Get payfipPaymentToken
- *
- * @return string
- */
- public function getPayfipPaymentToken()
- {
- return $this->payfipPaymentToken;
- }
- /**
- * Set jvs
- *
- * @param \AppBundle\Entity\Billing\Jvs $jvs
- *
- * @return BillAccounting
- */
- public function setJvs(\AppBundle\Entity\Billing\Jvs $jvs = null)
- {
- $this->jvs = $jvs;
- return $this;
- }
- /**
- * Get jvs
- *
- * @return \AppBundle\Entity\Billing\Jvs
- */
- public function getJvs()
- {
- return $this->jvs;
- }
- /**
- * Set enforceableTitle
- *
- * @param string $enforceableTitle
- *
- * @return BillAccounting
- */
- public function setEnforceableTitle($enforceableTitle)
- {
- $this->enforceableTitle = $enforceableTitle;
- return $this;
- }
- /**
- * Get enforceableTitle
- *
- * @return string
- */
- public function getEnforceableTitle()
- {
- return $this->enforceableTitle;
- }
- public function setStartSchoolYear($startSchoolYear)
- {
- $this->startSchoolYear = $startSchoolYear;
- return $this;
- }
- /**
- * Get startSchoolYear
- *
- * @return integer
- */
- public function getStartSchoolYear()
- {
- return $this->startSchoolYear;
- }
- /**
- * Set label
- *
- * @param string $label
- *
- * @return BillAccounting
- */
- public function setLabel($label = null)
- {
- $this->label = $label;
- return $this;
- }
- /**
- * Get label
- *
- * @return string
- */
- public function getLabel()
- {
- return $this->label;
- }
- /**
- * Gets paymentState.
- *
- * @return bool
- */
- public function getIsApplied()
- {
- return !empty($this->getBill());
- }
- /**
- * Add tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- *
- * @return BillAccounting
- */
- 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;
- }
- /**
- * Gets students tags.
- *
- * @return array
- */
- public function getStudentsTagsTemplate()
- {
- $tags = [];
- foreach ($this->getBillLines() as $billLine){
- $access = $billLine->getAccess();
- if(!empty($access)){
- foreach ($access->getTags() as $billLineAcesstags){
- $tags[] = $billLineAcesstags->getLabel();
- }
- }
- }
- if(!empty($this->getBill())){
- foreach ($this->getBill()->getBillLines() as $billLine){
- $access = $billLine->getAccess();
- if(!empty($access)){
- foreach ($access->getTags() as $billLineAcesstags){
- $tags[] = $billLineAcesstags->getLabel();
- }
- }
- }
- }
- return array_unique($tags);
- }
- /**
- * Set ciril
- *
- * @param \AppBundle\Entity\Billing\Ciril $ciril
- *
- * @return BillAccounting
- */
- public function setCiril(\AppBundle\Entity\Billing\Ciril $ciril = null)
- {
- $this->ciril = $ciril;
- return $this;
- }
- /**
- * Get ciril
- *
- * @return \AppBundle\Entity\Billing\Ciril
- */
- public function getCiril()
- {
- return $this->ciril;
- }
- /**
- * Set payfipUrlDateTime
- *
- * @param \DateTime $payfipUrlDateTime
- *
- * @return BillAccounting
- */
- public function setPayfipUrlDateTime($payfipUrlDateTime)
- {
- $this->payfipUrlDateTime = $payfipUrlDateTime;
- return $this;
- }
- /**
- * Get payfipUrlDateTime
- *
- * @return \DateTime
- */
- public function getPayfipUrlDateTime()
- {
- return $this->payfipUrlDateTime;
- }
- }
|