BillAccounting.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539
  1. <?php
  2. namespace AppBundle\Entity\Billing;
  3. use AppBundle\Annotation\ExportTranslate;
  4. use AppBundle\Annotation\ExportSplitFields;
  5. use AppBundle\Entity\AccessAndFunction\Access;
  6. use AppBundle\Entity\Core\File;
  7. use AppBundle\Entity\Core\Tagg;
  8. use AppBundle\Enum\Billing\PaymentStateEnum;
  9. use AppBundle\Enum\Billing\PaymentTypeEnum;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Dunglas\ApiBundle\Annotation\Iri;
  12. use Sabre\VObject\Property\VCard\DateTime;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. use AppBundle\Entity\Traits\TimestampableEntity;
  16. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  17. use AppBundle\Entity\Organization\Organization;
  18. use Doctrine\Common\Collections\ArrayCollection;
  19. use AppBundle\Annotation\DefaultField;
  20. /**
  21. * Facture ou avoir (@see Bill, BillCredit)
  22. *
  23. * @Iri("http://schema.org/BillAccounting")
  24. */
  25. #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Billing\Repository\BillRepository')]
  26. #[ORM\Table(name: 'BillAccounting')]
  27. #[ORM\InheritanceType('SINGLE_TABLE')]
  28. #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
  29. #[ORM\DiscriminatorMap(['billaccounting' => 'BillAccounting', 'bill' => 'Bill', 'billcredit' => 'BillCredit', 'advancepayment' => 'AdvancePayment'])]
  30. class BillAccounting implements BillAccountingInterface
  31. {
  32. use TimestampableEntity;
  33. use CreatorUpdaterEntity;
  34. /**
  35. * @var int
  36. */
  37. #[ORM\Column(type: 'integer')]
  38. #[ORM\Id]
  39. #[ORM\GeneratedValue(strategy: 'AUTO')]
  40. #[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'])]
  41. private $id;
  42. /**
  43. * @var Organization
  44. *
  45. * @DefaultField
  46. */
  47. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization')]
  48. #[ORM\JoinColumn(nullable: true)]
  49. #[Groups(['billaccounting', 'bill', 'billcredit'])]
  50. private $organization;
  51. /**
  52. * @var Access
  53. */
  54. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'bills')]
  55. #[ORM\JoinColumn(nullable: false)]
  56. #[Assert\NotNull]
  57. #[Groups(['billaccounting', 'bill', 'advancepayment', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'billcredit_list', 'advancepayment_list', 'build_bills', 'billcredit_list', 'advancepayment_list'])]
  58. private $access;
  59. /**
  60. * @var BillAccessDetail
  61. */
  62. #[Assert\Valid]
  63. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Billing\BillAccessDetail', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
  64. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'billpayment_list_bill', 'bill_list', 'billcredit_list', 'build_bills'])]
  65. private $accessDetail;
  66. /**
  67. * @var string
  68. *
  69. *
  70. */
  71. #[ORM\Column(type: 'string', nullable: true)]
  72. #[Assert\Type(type: 'string')]
  73. #[Groups(['bill', 'billaccounting'])]
  74. private $reference;
  75. /**
  76. * @var int
  77. */
  78. #[ORM\Column(type: 'integer', nullable: true)]
  79. #[Groups(['bill', 'billaccounting', 'build_bills'])]
  80. private $customerReference;
  81. /**
  82. * @var string
  83. */
  84. #[ORM\Column(type: 'string', nullable: true)]
  85. #[Assert\Type(type: 'string')]
  86. #[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'])]
  87. private $billNumber;
  88. /**
  89. * @var int
  90. */
  91. #[ORM\Column(type: 'integer', nullable: true)]
  92. #[Groups(['bill', 'billaccounting', 'build_bills'])]
  93. private $billNumberInteger;
  94. /**
  95. * @var int
  96. */
  97. #[ORM\Column(type: 'integer', nullable: true)]
  98. #[Groups(['bill', 'billaccounting'])]
  99. private $billCreditInteger;
  100. /**
  101. * @var \DateTime
  102. */
  103. #[ORM\Column(type: 'date', nullable: true)]
  104. #[Assert\Date]
  105. #[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'])]
  106. private $billingDate;
  107. /**
  108. * @var string
  109. *
  110. *
  111. */
  112. #[ORM\Column(type: 'string', nullable: true)]
  113. #[Assert\Type(type: 'string')]
  114. #[Groups(['billaccounting', 'bill'])]
  115. private $object;
  116. /**
  117. * @var string
  118. */
  119. #[ORM\Column(type: 'text', nullable: true)]
  120. #[Assert\Type(type: 'string')]
  121. #[Groups(['billaccounting', 'bill', 'build_bills'])]
  122. private $comments;
  123. /**
  124. * @var ArrayCollection<BillLine>
  125. */
  126. #[Assert\Valid]
  127. #[ORM\OneToMany(targetEntity: 'BillLine', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
  128. #[Groups(['billaccounting', 'bill_billline', 'billaccounting_list', 'billpayment_list_bill', 'bill_list', 'billaccounting_list_bill', 'billcredit_list_bill', 'build_bills'])]
  129. private $billLines;
  130. /**
  131. * @var ArrayCollection<BillCredit>
  132. */
  133. #[Assert\Valid]
  134. #[ORM\OneToMany(targetEntity: 'BillCredit', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
  135. #[Groups(['billaccounting', 'bill_billcredit', 'billaccounting_list', 'bill_list', 'advancepayment_list', 'advance_payment_schoolyear'])]
  136. private $billCredits;
  137. /**
  138. * @var ArrayCollection<BillPayment>
  139. */
  140. #[Assert\Valid]
  141. #[ORM\OneToMany(targetEntity: 'BillPayment', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
  142. #[Groups(['billaccounting', 'bill_billpayment', 'build_bills'])]
  143. private $billPayments;
  144. /**
  145. * @var float
  146. */
  147. #[Assert\Type(type: 'float')]
  148. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'advancepayment_list', 'my_bills_show_bills', 'advancepayment_list', 'build_bills'])]
  149. private $totalAmountSet;
  150. /**
  151. * @var float
  152. */
  153. #[Assert\Type(type: 'float')]
  154. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'advancepayment_list'])]
  155. private $totalPending;
  156. /**
  157. * @var float
  158. */
  159. #[Assert\Type(type: 'float')]
  160. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'my_bills_show', 'build_bills'])]
  161. private $totalRemainingDue;
  162. /**
  163. * @var string
  164. * @ExportTranslate(true)
  165. */
  166. #[Assert\Type(type: 'string')]
  167. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'advancepayment_list'])]
  168. private $paymentState;
  169. /**
  170. * @var array
  171. */
  172. #[ORM\Column(type: 'json_array', nullable: true)]
  173. #[Groups(['billaccounting', 'bill', 'build_bills'])]
  174. private $reductionTotal;
  175. /**
  176. * @var BillPeriod
  177. */
  178. #[Assert\Valid]
  179. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Billing\BillPeriod', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
  180. #[ORM\JoinColumn(nullable: true)]
  181. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'billcredit_list', 'billaccounting_billperiod', 'advancepayment_list', 'build_bills', 'billcredit_list', 'billaccounting_billperiod', 'advancepayment_list'])]
  182. private $billPeriod;
  183. /**
  184. * @var BillTotalDetail
  185. */
  186. #[Assert\Valid]
  187. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Billing\BillTotalDetail', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
  188. #[Groups(['billaccounting', 'bill', 'advancepayment', 'billaccounting_list', 'bill_list', 'my_bills_show_bills', 'billcredit_list', 'build_bills'])]
  189. private $totalDetail;
  190. /**
  191. * @var File
  192. */
  193. #[Assert\Valid]
  194. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Core\File', cascade: ['persist'], fetch: 'EAGER')]
  195. #[ORM\JoinColumn(nullable: true)]
  196. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'billcredit_list', 'my_bills_show_bills'])]
  197. private $file;
  198. /**
  199. * @var string
  200. */
  201. #[Groups(['billaccounting', 'billaccounting_list', 'bill'])]
  202. private $billAccountingNumber;
  203. /**
  204. * @var string
  205. * @ExportTranslate(true)
  206. */
  207. #[Groups(['billaccounting', 'billaccounting_list'])]
  208. private $type;
  209. /**
  210. * @var Bill
  211. */
  212. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BillAccounting', inversedBy: 'billCredits')]
  213. #[ORM\JoinColumn(nullable: true)]
  214. #[Groups(['billaccounting', 'billcredit', 'billaccounting_list', 'billcredit_list', 'advancepayment_list', 'advance_payment_schoolyear'])]
  215. private $bill;
  216. /**
  217. * @var string
  218. */
  219. #[ORM\Column(type: 'text', nullable: true)]
  220. #[Assert\Type(type: 'string')]
  221. #[Groups(['billaccounting', 'billcredit', 'billcredit_list'])]
  222. private $message;
  223. /**
  224. * @var string
  225. */
  226. #[ORM\Column(type: 'string', nullable: true)]
  227. #[Assert\Type(type: 'string')]
  228. #[Groups(['billaccounting', 'billcredit', 'billaccounting_list', 'billcredit_list'])]
  229. private $billCreditNumber;
  230. /**
  231. * @var ArrayCollection<BillingIntangibleExcludeDate>
  232. */
  233. #[Assert\Valid]
  234. #[ORM\OneToMany(targetEntity: 'BillingIntangibleExcludeDate', mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
  235. #[Groups(['billaccounting', 'bill'])]
  236. private $billingIntangibleExcludeDate;
  237. /**
  238. * @var Pes
  239. */
  240. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\Pes', inversedBy: 'bills', cascade: ['persist'])]
  241. #[ORM\JoinColumn(nullable: true)]
  242. #[Groups(['billaccounting_list', 'billaccounting_pes'])]
  243. private $pes;
  244. /**
  245. * @var BergerLevrault
  246. */
  247. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BergerLevrault', inversedBy: 'bills', cascade: ['persist'])]
  248. #[ORM\JoinColumn(nullable: true)]
  249. #[Groups(['billaccounting_list'])]
  250. private $bergerLevrault;
  251. /**
  252. * @var BergerLevrault
  253. */
  254. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\Ciril', inversedBy: 'bills', cascade: ['persist'])]
  255. #[ORM\JoinColumn(nullable: true)]
  256. #[Groups(['billaccounting_list'])]
  257. private $ciril;
  258. /**
  259. * @var Jvs
  260. */
  261. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\Jvs', inversedBy: 'bills', cascade: ['persist'])]
  262. #[ORM\JoinColumn(nullable: true)]
  263. #[Groups(['billaccounting_list', 'billaccounting_jvs'])]
  264. private $jvs;
  265. /**
  266. * @var Jvs
  267. */
  268. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\SddBank', inversedBy: 'bills', cascade: ['persist'])]
  269. #[ORM\JoinColumn(nullable: true)]
  270. #[Groups(['billaccounting_list'])]
  271. private $sddBank;
  272. /**
  273. * @var Jvs
  274. */
  275. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\SddRegie', inversedBy: 'bills', cascade: ['persist'])]
  276. #[ORM\JoinColumn(nullable: true)]
  277. #[Groups(['billaccounting_list'])]
  278. private $sddRegie;
  279. /**
  280. * @var bool
  281. */
  282. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  283. #[Assert\Type(type: 'boolean')]
  284. #[Assert\NotNull]
  285. #[Groups(['billaccounting'])]
  286. private $old = false;
  287. /**
  288. * @var array
  289. */
  290. #[Groups(['billaccounting', 'billaccounting_list', 'billpayment_list_bill', 'bill_list'])]
  291. private $listStudents;
  292. /**
  293. * @var bool
  294. */
  295. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  296. #[Assert\Type(type: 'boolean')]
  297. #[Assert\NotNull]
  298. #[Groups(['billaccounting', 'bill', 'build_bills'])]
  299. private $sepaSampling= false;
  300. /**
  301. * @var \DateTime
  302. */
  303. #[ORM\Column(type: 'date', nullable: true)]
  304. #[Assert\Date]
  305. #[Groups(['billaccounting', 'bill', 'billaccounting_list', 'bill_list', 'billpayment_list_bill', 'build_bills'])]
  306. private $samplingDate;
  307. /**
  308. * @var \DateTime
  309. */
  310. #[ORM\Column(type: 'date', nullable: true)]
  311. #[Assert\Date]
  312. #[Groups(['bill', 'billaccounting', 'billaccounting_list', 'bill_list', 'my_bills_show_bills'])]
  313. private $availabilityDate;
  314. /**
  315. * @var string
  316. */
  317. #[ORM\Column(type: 'string', nullable: true)]
  318. #[Groups(['bill'])]
  319. protected $payfipPaymentToken;
  320. /**
  321. * @var string
  322. */
  323. #[ORM\Column(type: 'string', nullable: true)]
  324. #[Groups(['bill', 'build_bills'])]
  325. protected $enforceableTitle;
  326. /**
  327. * @var \DateTime
  328. */
  329. #[ORM\Column(type: 'date', nullable: true)]
  330. #[Assert\Date]
  331. #[Groups(['bill', 'billaccounting', 'billaccounting_list', 'bill_list', 'my_bills_show_bills'])]
  332. private $limitPaymentDate;
  333. /**
  334. * @var int
  335. */
  336. #[ORM\Column(type: 'integer', nullable: true)]
  337. #[Groups(['advancepayment', 'advancepayment_list'])]
  338. private $startSchoolYear;
  339. /**
  340. * @var string
  341. */
  342. #[ORM\Column(type: 'string', nullable: true)]
  343. #[Assert\Type(type: 'string')]
  344. #[Groups(['advancepayment', 'advancepayment_list'])]
  345. private $label;
  346. /**
  347. * @var bool
  348. */
  349. #[Assert\Type(type: 'boolean')]
  350. #[Groups(['advancepayment_list'])]
  351. private $isApplied;
  352. /**
  353. * @var ArrayCollection<Tagg>
  354. */
  355. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'billAccountings')]
  356. #[Assert\Valid]
  357. #[ORM\JoinTable(name: 'tag_billAccounting', joinColumns: [], inverseJoinColumns: [])]
  358. #[ORM\JoinColumn(name: 'billAccounting_id', referencedColumnName: 'id')]
  359. #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  360. #[Groups(['billaccounting_tags', 'manage_tags', 'billaccounting_list', 'bill_list', 'billcredit_list', 'advancepayment_list'])]
  361. private $tags;
  362. /**
  363. * @var string
  364. *
  365. */
  366. #[Groups(['template', 'billaccounting_list'])]
  367. private $studentsTagsTemplate;
  368. /**
  369. * @var \DateTime
  370. */
  371. #[ORM\Column(type: 'datetime', nullable: true)]
  372. #[Assert\Date]
  373. private $payfipUrlDateTime;
  374. /**
  375. * The constructor
  376. */
  377. public function __construct() {
  378. $this->billLines = new ArrayCollection();
  379. $this->billCredits = new ArrayCollection();
  380. $this->billPayments = new ArrayCollection();
  381. $this->billingIntangibleExcludeDate = new ArrayCollection();
  382. $this->tags = new ArrayCollection();
  383. }
  384. /**
  385. * Get id
  386. *
  387. * @return integer
  388. */
  389. public function getId()
  390. {
  391. return $this->id;
  392. }
  393. /**
  394. * Sets id
  395. *
  396. * @param int $id
  397. * @return this
  398. */
  399. public function setId($id)
  400. {
  401. $this->id = $id;
  402. return $this;
  403. }
  404. /**
  405. * Set reference
  406. *
  407. * @param string $reference
  408. *
  409. * @return Bill
  410. */
  411. public function setReference($reference)
  412. {
  413. $this->reference = $reference;
  414. return $this;
  415. }
  416. /**
  417. * Get reference
  418. *
  419. * @return string
  420. */
  421. public function getReference()
  422. {
  423. return $this->reference;
  424. }
  425. /**
  426. * Set billingDate
  427. *
  428. * @param \DateTime $billingDate
  429. *
  430. * @return Bill
  431. */
  432. public function setBillingDate($billingDate)
  433. {
  434. $this->billingDate = $billingDate;
  435. return $this;
  436. }
  437. /**
  438. * Get billingDate
  439. *
  440. * @return \DateTime
  441. */
  442. public function getBillingDate()
  443. {
  444. return $this->billingDate ? $this->billingDate->format('Y-m-d') : $this->billingDate;
  445. }
  446. /**
  447. * Set object
  448. *
  449. * @param string $object
  450. *
  451. * @return Bill
  452. */
  453. public function setObject($object)
  454. {
  455. $this->object = $object;
  456. return $this;
  457. }
  458. /**
  459. * Get object
  460. *
  461. * @return string
  462. */
  463. public function getObject()
  464. {
  465. return $this->object;
  466. }
  467. /**
  468. * Set comments
  469. *
  470. * @param string $comments
  471. *
  472. * @return Bill
  473. */
  474. public function setComments($comments)
  475. {
  476. $this->comments = $comments;
  477. return $this;
  478. }
  479. /**
  480. * Get comments
  481. *
  482. * @return string
  483. */
  484. public function getComments()
  485. {
  486. return $this->comments;
  487. }
  488. /**
  489. * Set totalPrice
  490. *
  491. * @param float $totalPrice
  492. *
  493. * @return Bill
  494. */
  495. public function setTotalPrice($totalPrice)
  496. {
  497. $this->totalPrice = floatval($totalPrice);
  498. return $this;
  499. }
  500. /**
  501. * Get totalPrice
  502. *
  503. * @return float
  504. */
  505. public function getTotalPrice()
  506. {
  507. return $this->totalPrice;
  508. }
  509. /**
  510. * Add billLine
  511. *
  512. * @param \AppBundle\Entity\Billing\BillLine $billLine
  513. *
  514. * @return BillAccounting
  515. */
  516. public function addBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
  517. {
  518. $billLine->setBill($this);
  519. $this->billLines[] = $billLine;
  520. return $this;
  521. }
  522. /**
  523. * Remove billLine
  524. *
  525. * @param \AppBundle\Entity\Billing\BillLine $billLine
  526. */
  527. public function removeBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
  528. {
  529. $this->billLines->removeElement($billLine);
  530. }
  531. /**
  532. * Get billLines
  533. *
  534. * @return \Doctrine\Common\Collections\Collection
  535. */
  536. public function getBillLines()
  537. {
  538. return $this->billLines;
  539. }
  540. /**
  541. * Set totalVat
  542. *
  543. * @param float $totalVat
  544. *
  545. * @return Bill
  546. */
  547. public function setTotalVat($totalVat)
  548. {
  549. $this->totalVat = floatval($totalVat);
  550. return $this;
  551. }
  552. /**
  553. * Get totalVat
  554. *
  555. * @return float
  556. */
  557. public function getTotalVat()
  558. {
  559. return $this->totalVat;
  560. }
  561. /**
  562. * Set access
  563. *
  564. * @param \AppBundle\Entity\AccessAndFunction\Access $access
  565. *
  566. * @return Bill
  567. */
  568. public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
  569. {
  570. $this->access = $access;
  571. return $this;
  572. }
  573. /**
  574. * Get access
  575. *
  576. * @return \AppBundle\Entity\AccessAndFunction\Access
  577. */
  578. public function getAccess()
  579. {
  580. return $this->access;
  581. }
  582. /**
  583. * Add billCredit
  584. *
  585. * @param \AppBundle\Entity\Billing\BillCredit $billCredit
  586. *
  587. * @return Bill
  588. */
  589. public function addBillCredit(\AppBundle\Entity\Billing\BillCredit $billCredit)
  590. {
  591. $this->billCredits[] = $billCredit;
  592. $billCredit->setBill($this);
  593. return $this;
  594. }
  595. /**
  596. * Remove billCredit
  597. *
  598. * @param \AppBundle\Entity\Billing\BillCredit $billCredit
  599. */
  600. public function removeBillCredit(\AppBundle\Entity\Billing\BillCredit $billCredit)
  601. {
  602. $this->billCredits->removeElement($billCredit);
  603. }
  604. /**
  605. * Get billCredits
  606. *
  607. * @return \Doctrine\Common\Collections\Collection
  608. */
  609. public function getBillCredits()
  610. {
  611. return $this->billCredits;
  612. }
  613. /**
  614. * Add billPayment
  615. *
  616. * @param \AppBundle\Entity\Billing\BillPayment $billPayment
  617. *
  618. * @return Bill
  619. */
  620. public function addBillPayment(\AppBundle\Entity\Billing\BillPayment $billPayment)
  621. {
  622. $billPayment->setBill($this);
  623. $this->billPayments[] = $billPayment;
  624. return $this;
  625. }
  626. /**
  627. * Remove billPayment
  628. *
  629. * @param \AppBundle\Entity\Billing\BillPayment $billPayment
  630. */
  631. public function removeBillPayment(\AppBundle\Entity\Billing\BillPayment $billPayment)
  632. {
  633. $this->billPayments->removeElement($billPayment);
  634. }
  635. /**
  636. * Get billPayments
  637. *
  638. * @return \Doctrine\Common\Collections\Collection
  639. */
  640. public function getBillPayments()
  641. {
  642. return $this->billPayments;
  643. }
  644. /**
  645. * Get totalAmountSet
  646. *
  647. * @return float
  648. */
  649. public function getTotalAmountSet()
  650. {
  651. if(!is_null($this->getBill()) && get_class($this) !== AdvancePayment::class){
  652. return 0;
  653. }
  654. $totalAmountSet = 0;
  655. $billPayments = $this->getBillPayments();
  656. foreach ($billPayments as $billPayment) {
  657. if($billPayment->getIsAcquired()){
  658. $totalAmountSet += $billPayment->getAmount();
  659. }
  660. foreach ($billPayment->getBillDebitBalances() as $billDebitBalances) {
  661. if(!$billDebitBalances->getIsUsed())
  662. $totalAmountSet -= $billDebitBalances->getAmount();
  663. }
  664. }
  665. return $totalAmountSet;
  666. }
  667. /**
  668. * Get totalAmountSet
  669. *
  670. * @return float
  671. */
  672. public function getTotalPending()
  673. {
  674. if(!is_null($this->getBill())){
  675. return 0;
  676. }
  677. $totalPending = 0;
  678. $billPayments = $this->getBillPayments();
  679. foreach ($billPayments as $billPayment) {
  680. if(!$billPayment->getIsAcquired()){
  681. $totalPending += $billPayment->getAmount();
  682. }
  683. }
  684. return $totalPending;
  685. }
  686. /**
  687. * Get totalRemainingDue
  688. *
  689. * @return float
  690. */
  691. public function getTotalRemainingDue()
  692. {
  693. if(!is_null($this->getBill()) || count($this->getBillCredits()) > 0 ){
  694. return 0;
  695. }
  696. $totalRemainingDue = null;
  697. if($this->totalDetail && !is_null($this->totalDetail)){
  698. $totalRemainingDue = round(floatval($this->totalDetail->getTtc()) - $this->getTotalAmountSet(), 2);
  699. }
  700. return $totalRemainingDue;
  701. }
  702. /**
  703. * Gets paymentState.
  704. *
  705. * @return string
  706. */
  707. public function getPaymentState()
  708. {
  709. if(!is_null($this->getBill()) || get_class($this) === AdvancePayment::class){
  710. return PaymentStateEnum::SOLDIER;
  711. }
  712. if(count($this->getBillCredits()) > 0 ){
  713. return PaymentStateEnum::SOLDIER;
  714. }
  715. $today = new \DateTime();
  716. $totalAmountSet = 0;
  717. $delayed = false;
  718. $billPayments = $this->getBillPayments();
  719. foreach ($billPayments as $billPayment) {
  720. /** @var BillPayment $billPayment **/
  721. if($billPayment->getIsAcquired()){
  722. $totalAmountSet += $billPayment->getAmount();
  723. }elseif(new \DateTime($billPayment->getReceiptDate()) < $today){
  724. $delayed = true;
  725. }
  726. foreach ($billPayment->getBillDebitBalances() as $billDebitBalances) {
  727. if(!$billDebitBalances->getIsUsed())
  728. $totalAmountSet -= $billDebitBalances->getAmount();
  729. }
  730. }
  731. if($this->totalDetail && !is_null($this->totalDetail) && number_format(round($totalAmountSet,2),2,'','') >= number_format($this->totalDetail->getTtc(),2,'','')){
  732. return PaymentStateEnum::SOLDIER;
  733. }elseif($delayed){
  734. return PaymentStateEnum::DELAYED;
  735. }
  736. return PaymentStateEnum::TO_CASH_IN;
  737. }
  738. /**
  739. * Set billNumber
  740. *
  741. * @param string $billNumber
  742. *
  743. * @return Bill
  744. */
  745. public function setBillNumber($billNumber)
  746. {
  747. $this->billNumber = $billNumber;
  748. return $this;
  749. }
  750. /**
  751. * Get billNumber
  752. *
  753. * @return string
  754. */
  755. public function getBillNumber()
  756. {
  757. return $this->billNumber;
  758. }
  759. /**
  760. * Set reductionTotal
  761. *
  762. * @param array $reductionTotal
  763. *
  764. * @return Bill
  765. */
  766. public function setReductionTotal($reductionTotal)
  767. {
  768. $this->reductionTotal = $reductionTotal;
  769. return $this;
  770. }
  771. /**
  772. * Get reductionTotal
  773. *
  774. * @return array
  775. */
  776. public function getReductionTotal()
  777. {
  778. return $this->reductionTotal;
  779. }
  780. /**
  781. * Set customerReference
  782. *
  783. * @param integer $customerReference
  784. *
  785. * @return Bill
  786. */
  787. public function setCustomerReference($customerReference)
  788. {
  789. $this->customerReference = $customerReference;
  790. return $this;
  791. }
  792. /**
  793. * Get customerReference
  794. *
  795. * @return integer
  796. */
  797. public function getCustomerReference()
  798. {
  799. return $this->customerReference;
  800. }
  801. /**
  802. * Set file
  803. *
  804. * @param \AppBundle\Entity\Core\File $file
  805. *
  806. * @return Bill
  807. */
  808. public function setFile(\AppBundle\Entity\Core\File $file = null)
  809. {
  810. $this->file = $file;
  811. return $this;
  812. }
  813. /**
  814. * Get file
  815. *
  816. * @return \AppBundle\Entity\Core\File
  817. */
  818. public function getFile()
  819. {
  820. return $this->file;
  821. }
  822. /**
  823. * get billAccountingNumber
  824. *
  825. * @return mixed
  826. */
  827. public function getBillAccountingNumber()
  828. {
  829. $billAccountingNumber = '';
  830. if(get_class($this) === Bill::class || get_class($this) === AdvancePayment::class){
  831. $pes = $this->organization->getSettings() && array_key_exists('Pes', $this->organization->getSettings()->getModules()) ? $this->organization->getSettings()->getModules()['Pes'] : false;
  832. if($pes && $this->getBillNumberInteger()){
  833. $billAccountingNumber = str_pad($this->getBillNumberInteger(), 13, '0', STR_PAD_LEFT);
  834. }else{
  835. $billAccountingNumber = $this->billNumber;
  836. }
  837. }
  838. if(get_class($this) === BillCredit::class){
  839. $billAccountingNumber = $this->billCreditNumber;
  840. }
  841. return $billAccountingNumber;
  842. }
  843. /**
  844. * get billAccountingNumber
  845. *
  846. * @return mixed
  847. */
  848. public function getType()
  849. {
  850. $explodeClass = explode("\\",get_class($this));
  851. return lcfirst(end($explodeClass));
  852. }
  853. /**
  854. * Set organization
  855. *
  856. * @param \AppBundle\Entity\Organization\Organization $organization
  857. *
  858. * @return BillAccounting
  859. */
  860. public function setOrganization(\AppBundle\Entity\Organization\Organization $organization = null)
  861. {
  862. $this->organization = $organization;
  863. return $this;
  864. }
  865. /**
  866. * Get organization
  867. *
  868. * @return \AppBundle\Entity\Organization\Organization
  869. */
  870. public function getOrganization()
  871. {
  872. return $this->organization;
  873. }
  874. /**
  875. * Set message
  876. *
  877. * @param string $message
  878. *
  879. * @return BillCredit
  880. */
  881. public function setMessage($message)
  882. {
  883. $this->message = $message;
  884. return $this;
  885. }
  886. /**
  887. * Get message
  888. *
  889. * @return string
  890. */
  891. public function getMessage()
  892. {
  893. return $this->message;
  894. }
  895. /**
  896. * Set bill
  897. *
  898. * @param \AppBundle\Entity\Billing\BillAccounting $bill
  899. *
  900. * @return BillCredit
  901. */
  902. public function setBill(\AppBundle\Entity\Billing\BillAccounting $bill)
  903. {
  904. $this->bill = $bill;
  905. return $this;
  906. }
  907. /**
  908. * Get bill
  909. *
  910. * @return \AppBundle\Entity\Billing\Bill
  911. */
  912. public function getBill()
  913. {
  914. return $this->bill;
  915. }
  916. /**
  917. * Set billCreditNumber
  918. *
  919. * @param string $billCreditNumber
  920. *
  921. * @return BillCredit
  922. */
  923. public function setBillCreditNumber($billCreditNumber)
  924. {
  925. $this->billCreditNumber = $billCreditNumber;
  926. return $this;
  927. }
  928. /**
  929. * Get billCreditNumber
  930. *
  931. * @return string
  932. */
  933. public function getBillCreditNumber()
  934. {
  935. return $this->billCreditNumber;
  936. }
  937. /**
  938. * Add billingIntangibleExcludeDate
  939. *
  940. * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
  941. *
  942. * @return BillAccounting
  943. */
  944. public function addBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
  945. {
  946. $billingIntangibleExcludeDate->setBill($this);
  947. $this->billingIntangibleExcludeDate[] = $billingIntangibleExcludeDate;
  948. return $this;
  949. }
  950. /**
  951. * Remove billingIntangibleExcludeDate
  952. *
  953. * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
  954. */
  955. public function removeBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
  956. {
  957. $this->billingIntangibleExcludeDate->removeElement($billingIntangibleExcludeDate);
  958. }
  959. /**
  960. * Get billingIntangibleExcludeDate
  961. *
  962. * @return \Doctrine\Common\Collections\Collection
  963. */
  964. public function getBillingIntangibleExcludeDate()
  965. {
  966. return $this->billingIntangibleExcludeDate;
  967. }
  968. /**
  969. * Set pes
  970. *
  971. * @param \AppBundle\Entity\Billing\Pes $pes
  972. *
  973. * @return BillAccounting
  974. */
  975. public function setPes(\AppBundle\Entity\Billing\Pes $pes = null)
  976. {
  977. $this->pes = $pes;
  978. return $this;
  979. }
  980. /**
  981. * Get pes
  982. *
  983. * @return \AppBundle\Entity\Billing\Pes
  984. */
  985. public function getPes()
  986. {
  987. return $this->pes;
  988. }
  989. /**
  990. * Set sddBank
  991. *
  992. * @param \AppBundle\Entity\Billing\SddBank $sddBank
  993. *
  994. * @return BillAccounting
  995. */
  996. public function setSddBank(SddBank $sddBank = null)
  997. {
  998. $this->sddBank = $sddBank;
  999. return $this;
  1000. }
  1001. /**
  1002. * Get SddBank
  1003. *
  1004. * @return \AppBundle\Entity\Billing\SddBank
  1005. */
  1006. public function getSddBank()
  1007. {
  1008. return $this->sddBank;
  1009. }
  1010. /**
  1011. * Set SddRegie
  1012. *
  1013. * @param \AppBundle\Entity\Billing\SddRegie $sddRegie
  1014. *
  1015. * @return BillAccounting
  1016. */
  1017. public function setSddRegie(SddRegie $sddRegie= null)
  1018. {
  1019. $this->sddRegie = $sddRegie;
  1020. return $this;
  1021. }
  1022. /**
  1023. * Get SddRegie
  1024. *
  1025. * @return \AppBundle\Entity\Billing\SddRegie
  1026. */
  1027. public function getSddRegie()
  1028. {
  1029. return $this->sddRegie;
  1030. }
  1031. /**
  1032. * Set old
  1033. *
  1034. * @param boolean $old
  1035. *
  1036. * @return BillAccounting
  1037. */
  1038. public function setOld($old)
  1039. {
  1040. $this->old = $old;
  1041. return $this;
  1042. }
  1043. /**
  1044. * Get old
  1045. *
  1046. * @return boolean
  1047. */
  1048. public function getOld()
  1049. {
  1050. return $this->old;
  1051. }
  1052. /**
  1053. * Set period
  1054. *
  1055. * @param \AppBundle\Entity\Billing\BillPeriod $period
  1056. *
  1057. * @return BillAccounting
  1058. */
  1059. public function setBillPeriod(\AppBundle\Entity\Billing\BillPeriod $billPeriod = null)
  1060. {
  1061. $this->billPeriod = $billPeriod;
  1062. return $this;
  1063. }
  1064. /**
  1065. * Get period
  1066. *
  1067. * @return \AppBundle\Entity\Billing\BillPeriod
  1068. */
  1069. public function getBillPeriod()
  1070. {
  1071. return $this->billPeriod;
  1072. }
  1073. /**
  1074. * Set totalDetail
  1075. *
  1076. * @param \AppBundle\Entity\Billing\BillTotalDetail $totalDetail
  1077. *
  1078. * @return BillAccounting
  1079. */
  1080. public function setTotalDetail(\AppBundle\Entity\Billing\BillTotalDetail $totalDetail = null)
  1081. {
  1082. $this->totalDetail = $totalDetail;
  1083. return $this;
  1084. }
  1085. /**
  1086. * Get totalDetail
  1087. *
  1088. * @return \AppBundle\Entity\Billing\BillTotalDetail
  1089. */
  1090. public function getTotalDetail()
  1091. {
  1092. return $this->totalDetail;
  1093. }
  1094. /**
  1095. * Set accessDetail
  1096. *
  1097. * @param \AppBundle\Entity\Billing\BillAccessDetail $accessDetail
  1098. *
  1099. * @return BillAccounting
  1100. */
  1101. public function setAccessDetail(\AppBundle\Entity\Billing\BillAccessDetail $accessDetail = null)
  1102. {
  1103. $this->accessDetail = $accessDetail;
  1104. return $this;
  1105. }
  1106. /**
  1107. * Get accessDetail
  1108. *
  1109. * @return \AppBundle\Entity\Billing\BillAccessDetail
  1110. */
  1111. public function getAccessDetail()
  1112. {
  1113. return $this->accessDetail;
  1114. }
  1115. /**
  1116. * get listStudents
  1117. *
  1118. * @return array
  1119. */
  1120. public function getListStudents()
  1121. {
  1122. $students = [];
  1123. foreach($this->getBillLines() as $billLine){
  1124. if(!empty($billLine->getAccess()))
  1125. $students[] = $billLine->getAccess()->getPerson()->getFullNameTemplate();
  1126. }
  1127. return array_values(array_unique($students));
  1128. }
  1129. /**
  1130. * Set billNumberInteger
  1131. *
  1132. * @param integer $billNumberInteger
  1133. *
  1134. * @return BillAccounting
  1135. */
  1136. public function setBillNumberInteger($billNumberInteger)
  1137. {
  1138. $this->billNumberInteger = $billNumberInteger;
  1139. return $this;
  1140. }
  1141. /**
  1142. * Get billNumberInteger
  1143. *
  1144. * @return integer
  1145. */
  1146. public function getBillNumberInteger()
  1147. {
  1148. return $this->billNumberInteger;
  1149. }
  1150. /**
  1151. * Set billCreditInteger
  1152. *
  1153. * @param integer $billCreditInteger
  1154. *
  1155. * @return BillAccounting
  1156. */
  1157. public function setBillCreditInteger($billCreditInteger)
  1158. {
  1159. $this->billCreditInteger = $billCreditInteger;
  1160. return $this;
  1161. }
  1162. /**
  1163. * Get billCreditInteger
  1164. *
  1165. * @return integer
  1166. */
  1167. public function getBillCreditInteger()
  1168. {
  1169. return $this->billCreditInteger;
  1170. }
  1171. /**
  1172. * Set sepaSampling
  1173. *
  1174. * @param boolean $sepaSampling
  1175. *
  1176. * @return BillAccounting
  1177. */
  1178. public function setSepaSampling($sepaSampling)
  1179. {
  1180. $this->sepaSampling = $sepaSampling;
  1181. return $this;
  1182. }
  1183. /**
  1184. * Get sepaSampling
  1185. *
  1186. * @return boolean
  1187. */
  1188. public function getSepaSampling()
  1189. {
  1190. return $this->sepaSampling;
  1191. }
  1192. /**
  1193. * Set bergerLevrault
  1194. *
  1195. * @param \AppBundle\Entity\Billing\BergerLevrault $bergerLevrault
  1196. *
  1197. * @return BillAccounting
  1198. */
  1199. public function setBergerLevrault(\AppBundle\Entity\Billing\BergerLevrault $bergerLevrault = null)
  1200. {
  1201. $this->bergerLevrault = $bergerLevrault;
  1202. return $this;
  1203. }
  1204. /**
  1205. * Get bergerLevrault
  1206. *
  1207. * @return \AppBundle\Entity\Billing\BergerLevrault
  1208. */
  1209. public function getBergerLevrault()
  1210. {
  1211. return $this->bergerLevrault;
  1212. }
  1213. /**
  1214. * Set samplingDate
  1215. *
  1216. * @param \DateTime $samplingDate
  1217. *
  1218. * @return BillAccounting
  1219. */
  1220. public function setSamplingDate($samplingDate)
  1221. {
  1222. $this->samplingDate = $samplingDate;
  1223. return $this;
  1224. }
  1225. /**
  1226. * Get samplingDate
  1227. *
  1228. * @return \DateTime
  1229. */
  1230. public function getSamplingDate()
  1231. {
  1232. return $this->samplingDate;
  1233. }
  1234. /**
  1235. * Set availabilityDate
  1236. *
  1237. * @param \DateTime $availabilityDate
  1238. *
  1239. * @return BillAccounting
  1240. */
  1241. public function setAvailabilityDate($availabilityDate)
  1242. {
  1243. $this->availabilityDate = $availabilityDate;
  1244. return $this;
  1245. }
  1246. /**
  1247. * Get availabilityDate
  1248. *
  1249. * @return \DateTime
  1250. */
  1251. public function getAvailabilityDate()
  1252. {
  1253. return $this->availabilityDate;
  1254. }
  1255. /**
  1256. * Set limitPaymentDate
  1257. *
  1258. * @param \DateTime $limitPaymentDate
  1259. *
  1260. * @return BillAccounting
  1261. */
  1262. public function setLimitPaymentDate($limitPaymentDate)
  1263. {
  1264. $this->limitPaymentDate = $limitPaymentDate;
  1265. return $this;
  1266. }
  1267. /**
  1268. * Get limitPaymentDate
  1269. *
  1270. * @return \DateTime
  1271. */
  1272. public function getLimitPaymentDate()
  1273. {
  1274. return $this->limitPaymentDate;
  1275. }
  1276. /**
  1277. * Set payfipPaymentToken
  1278. *
  1279. * @param string $payfipPaymentToken
  1280. *
  1281. * @return BillAccounting
  1282. */
  1283. public function setPayfipPaymentToken($payfipPaymentToken)
  1284. {
  1285. $this->payfipPaymentToken = $payfipPaymentToken;
  1286. return $this;
  1287. }
  1288. /**
  1289. * Get payfipPaymentToken
  1290. *
  1291. * @return string
  1292. */
  1293. public function getPayfipPaymentToken()
  1294. {
  1295. return $this->payfipPaymentToken;
  1296. }
  1297. /**
  1298. * Set jvs
  1299. *
  1300. * @param \AppBundle\Entity\Billing\Jvs $jvs
  1301. *
  1302. * @return BillAccounting
  1303. */
  1304. public function setJvs(\AppBundle\Entity\Billing\Jvs $jvs = null)
  1305. {
  1306. $this->jvs = $jvs;
  1307. return $this;
  1308. }
  1309. /**
  1310. * Get jvs
  1311. *
  1312. * @return \AppBundle\Entity\Billing\Jvs
  1313. */
  1314. public function getJvs()
  1315. {
  1316. return $this->jvs;
  1317. }
  1318. /**
  1319. * Set enforceableTitle
  1320. *
  1321. * @param string $enforceableTitle
  1322. *
  1323. * @return BillAccounting
  1324. */
  1325. public function setEnforceableTitle($enforceableTitle)
  1326. {
  1327. $this->enforceableTitle = $enforceableTitle;
  1328. return $this;
  1329. }
  1330. /**
  1331. * Get enforceableTitle
  1332. *
  1333. * @return string
  1334. */
  1335. public function getEnforceableTitle()
  1336. {
  1337. return $this->enforceableTitle;
  1338. }
  1339. public function setStartSchoolYear($startSchoolYear)
  1340. {
  1341. $this->startSchoolYear = $startSchoolYear;
  1342. return $this;
  1343. }
  1344. /**
  1345. * Get startSchoolYear
  1346. *
  1347. * @return integer
  1348. */
  1349. public function getStartSchoolYear()
  1350. {
  1351. return $this->startSchoolYear;
  1352. }
  1353. /**
  1354. * Set label
  1355. *
  1356. * @param string $label
  1357. *
  1358. * @return BillAccounting
  1359. */
  1360. public function setLabel($label = null)
  1361. {
  1362. $this->label = $label;
  1363. return $this;
  1364. }
  1365. /**
  1366. * Get label
  1367. *
  1368. * @return string
  1369. */
  1370. public function getLabel()
  1371. {
  1372. return $this->label;
  1373. }
  1374. /**
  1375. * Gets paymentState.
  1376. *
  1377. * @return bool
  1378. */
  1379. public function getIsApplied()
  1380. {
  1381. return !empty($this->getBill());
  1382. }
  1383. /**
  1384. * Add tag
  1385. *
  1386. * @param \AppBundle\Entity\Core\Tagg $tag
  1387. *
  1388. * @return BillAccounting
  1389. */
  1390. public function addTag(\AppBundle\Entity\Core\Tagg $tag)
  1391. {
  1392. $this->tags[] = $tag;
  1393. return $this;
  1394. }
  1395. /**
  1396. * Remove tag
  1397. *
  1398. * @param \AppBundle\Entity\Core\Tagg $tag
  1399. */
  1400. public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
  1401. {
  1402. $this->tags->removeElement($tag);
  1403. }
  1404. /**
  1405. * Get tags
  1406. *
  1407. * @return \Doctrine\Common\Collections\Collection
  1408. */
  1409. public function getTags()
  1410. {
  1411. return $this->tags;
  1412. }
  1413. /**
  1414. * Gets students tags.
  1415. *
  1416. * @return array
  1417. */
  1418. public function getStudentsTagsTemplate()
  1419. {
  1420. $tags = [];
  1421. foreach ($this->getBillLines() as $billLine){
  1422. $access = $billLine->getAccess();
  1423. if(!empty($access)){
  1424. foreach ($access->getTags() as $billLineAcesstags){
  1425. $tags[] = $billLineAcesstags->getLabel();
  1426. }
  1427. }
  1428. }
  1429. if(!empty($this->getBill())){
  1430. foreach ($this->getBill()->getBillLines() as $billLine){
  1431. $access = $billLine->getAccess();
  1432. if(!empty($access)){
  1433. foreach ($access->getTags() as $billLineAcesstags){
  1434. $tags[] = $billLineAcesstags->getLabel();
  1435. }
  1436. }
  1437. }
  1438. }
  1439. return array_unique($tags);
  1440. }
  1441. /**
  1442. * Set ciril
  1443. *
  1444. * @param \AppBundle\Entity\Billing\Ciril $ciril
  1445. *
  1446. * @return BillAccounting
  1447. */
  1448. public function setCiril(\AppBundle\Entity\Billing\Ciril $ciril = null)
  1449. {
  1450. $this->ciril = $ciril;
  1451. return $this;
  1452. }
  1453. /**
  1454. * Get ciril
  1455. *
  1456. * @return \AppBundle\Entity\Billing\Ciril
  1457. */
  1458. public function getCiril()
  1459. {
  1460. return $this->ciril;
  1461. }
  1462. /**
  1463. * Set payfipUrlDateTime
  1464. *
  1465. * @param \DateTime $payfipUrlDateTime
  1466. *
  1467. * @return BillAccounting
  1468. */
  1469. public function setPayfipUrlDateTime($payfipUrlDateTime)
  1470. {
  1471. $this->payfipUrlDateTime = $payfipUrlDateTime;
  1472. return $this;
  1473. }
  1474. /**
  1475. * Get payfipUrlDateTime
  1476. *
  1477. * @return \DateTime
  1478. */
  1479. public function getPayfipUrlDateTime()
  1480. {
  1481. return $this->payfipUrlDateTime;
  1482. }
  1483. }