src/AdminBundle/Entity/CompanyInvoice.php line 243

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * Company Invoice
  7. */
  8. #[ORM\Table(name: 'company_invoice')]
  9. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\CompanyInvoiceRepository::class)]
  10. class CompanyInvoice extends BaseEntity
  11. {
  12. const PAYMENT_STATUS_PENDING = 0;
  13. const PAYMENT_STATUS_PAID = 1;
  14. const INVOICE_PENDING_APPROVAL = 0;
  15. const INVOICE_APPROVED = 1;
  16. public static $invoiceApproval = array(
  17. self::INVOICE_PENDING_APPROVAL => 'Pending',
  18. self::INVOICE_APPROVED => 'Approved',
  19. );
  20. public static $paymentStatuses = array(
  21. self::PAYMENT_STATUS_PENDING => 'Pending',
  22. self::PAYMENT_STATUS_PAID => 'Paid',
  23. );
  24. /**
  25. * @var int
  26. */
  27. #[ORM\Column(name: 'id', type: 'integer')]
  28. #[ORM\Id]
  29. #[ORM\GeneratedValue(strategy: 'AUTO')]
  30. private $id;
  31. /**
  32. * @var integer
  33. */
  34. #[ORM\Column(name: 'week', type: 'integer')]
  35. protected $week;
  36. /**
  37. * @var integer
  38. */
  39. #[ORM\Column(name: 'invoice_month', type: 'integer')]
  40. protected $invoiceMonth;
  41. /**
  42. * @var \DateTime
  43. */
  44. #[ORM\Column(name: 'creation_date', type: 'datetime', nullable: true)]
  45. protected $creationDate;
  46. /**
  47. * @var \DateTime
  48. */
  49. #[ORM\Column(name: 'start_date', type: 'datetime', nullable: true)]
  50. protected $startDate;
  51. /**
  52. * @var \DateTime
  53. */
  54. #[ORM\Column(name: 'end_date', type: 'datetime', nullable: true)]
  55. protected $endDate;
  56. /**
  57. * @var double
  58. */
  59. #[ORM\Column(name: 'total_invoice_balance', type: 'decimal', scale: 2)]
  60. protected $totalInvoiceBalance=0;
  61. /**
  62. * @var double
  63. */
  64. #[ORM\Column(name: 'total_general_adjustment_amount', type: 'decimal', scale: 2)]
  65. protected $totalGeneralAdjustmentAmount=0;
  66. /**
  67. * @var string
  68. */
  69. #[ORM\Column(name: 'pdf_file', type: 'string', length: 255, nullable: true)]
  70. protected $pdfFile;
  71. /**
  72. * @var \DateTime
  73. */
  74. #[ORM\Column(name: 'pdf_gen_date', type: 'datetime', nullable: true)]
  75. protected $pdfGenDate;
  76. /**
  77. * @var ArrayCollection
  78. */
  79. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\CompanyInvoiceItem::class, mappedBy: 'invoice')]
  80. public $invoiceItems;
  81. /**
  82. * @var Company
  83. */
  84. #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')]
  85. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Company::class, inversedBy: 'companyInvoices')]
  86. private $company;
  87. /**
  88. * @var integer
  89. */
  90. #[ORM\Column(name: 'payment_status', type: 'integer')]
  91. protected $status = self::PAYMENT_STATUS_PENDING;
  92. /**
  93. * @var \DateTime
  94. */
  95. #[ORM\Column(name: 'sent_date', type: 'datetime', nullable: true)]
  96. protected $sentDate;
  97. /**
  98. * @var boolean
  99. */
  100. #[ORM\Column(name: 'ready_to_send', type: 'boolean', options: ['default' => false])]
  101. protected $readyToSend = false;
  102. /**
  103. * @var integer
  104. */
  105. #[ORM\Column(name: 'approval', type: 'integer')]
  106. protected $approval = self::INVOICE_PENDING_APPROVAL;
  107. /**
  108. * Constructor
  109. */
  110. public function __construct()
  111. {
  112. $this->invoiceItems = new \Doctrine\Common\Collections\ArrayCollection();
  113. $this->creationDate = new \DateTime();
  114. }
  115. /**
  116. * @return int
  117. */
  118. public function getId(): int
  119. {
  120. return $this->id;
  121. }
  122. /**
  123. * @return \DateTime
  124. */
  125. public function getCreationDate(): \DateTime
  126. {
  127. return $this->creationDate;
  128. }
  129. /**
  130. * @param \DateTime $creationDate
  131. */
  132. public function setCreationDate(\DateTime $creationDate)
  133. {
  134. $this->creationDate = $creationDate;
  135. }
  136. /**
  137. * @return float
  138. */
  139. public function getTotalInvoiceBalance(): float
  140. {
  141. return $this->totalInvoiceBalance;
  142. }
  143. /**
  144. * @param float $totalInvoiceBalance
  145. */
  146. public function setTotalInvoiceBalance(float $totalInvoiceBalance)
  147. {
  148. $this->totalInvoiceBalance = $totalInvoiceBalance;
  149. }
  150. /**
  151. * @return float
  152. */
  153. public function getTotalGeneralAdjustmentAmount()
  154. {
  155. return $this->totalGeneralAdjustmentAmount;
  156. }
  157. /**
  158. * @param float $totalGeneralAdjustmentAmount
  159. */
  160. public function setTotalGeneralAdjustmentAmount(float $totalGeneralAdjustmentAmount)
  161. {
  162. $this->totalGeneralAdjustmentAmount = $totalGeneralAdjustmentAmount;
  163. }
  164. /**
  165. * @return string
  166. */
  167. public function getPdfFile()
  168. {
  169. return $this->pdfFile;
  170. }
  171. /**
  172. * @param string $pdfFile
  173. */
  174. public function setPdfFile(string $pdfFile)
  175. {
  176. $this->pdfFile = $pdfFile;
  177. }
  178. /**
  179. * @return \DateTime
  180. */
  181. public function getPdfGenDate()
  182. {
  183. return $this->pdfGenDate;
  184. }
  185. /**
  186. * @param \DateTime $pdfGenDate
  187. */
  188. public function setPdfGenDate(\DateTime $pdfGenDate)
  189. {
  190. $this->pdfGenDate = $pdfGenDate;
  191. }
  192. /**
  193. * Set company
  194. *
  195. * @param \AdminBundle\Entity\Company $company
  196. *
  197. * @return CompanyInvoice
  198. */
  199. public function setCompany(\AdminBundle\Entity\Company $company = null)
  200. {
  201. $this->company = $company;
  202. return $this;
  203. }
  204. /**
  205. * Get Company
  206. *
  207. * @return \AdminBundle\Entity\Company
  208. */
  209. public function getCompany()
  210. {
  211. return $this->company;
  212. }
  213. /**
  214. * Add invoiceItem
  215. *
  216. * @param \AdminBundle\Entity\CompanyInvoiceItem $invoiceItem
  217. *
  218. * @return CompanyInvoice
  219. */
  220. public function addInvoiceItem(\AdminBundle\Entity\CompanyInvoiceItem $invoiceItem)
  221. {
  222. $this->invoiceItems[] = $invoiceItem;
  223. return $this;
  224. }
  225. /**
  226. * Remove invoiceItem
  227. *
  228. * @param \AdminBundle\Entity\CompanyInvoiceItem $invoiceItem
  229. */
  230. public function removeInvoiceItem(\AdminBundle\Entity\CompanyInvoiceItem $invoiceItem)
  231. {
  232. $this->invoiceItems->removeElement($invoiceItem);
  233. }
  234. /**
  235. * Get invoiceItems
  236. *
  237. * @return \Doctrine\Common\Collections\Collection
  238. */
  239. public function getInvoiceItems()
  240. {
  241. return $this->invoiceItems;
  242. }
  243. /**
  244. * @return int
  245. */
  246. public function getWeek()
  247. {
  248. return $this->week;
  249. }
  250. /**
  251. * @param int $week
  252. */
  253. public function setWeek(int $week)
  254. {
  255. $this->week = $week;
  256. }
  257. /**
  258. * @return int
  259. */
  260. public function getInvoiceMonth()
  261. {
  262. return $this->invoiceMonth;
  263. }
  264. /**
  265. * @param int $invoiceMonth
  266. */
  267. public function setInvoiceMonth(int $invoiceMonth)
  268. {
  269. $this->invoiceMonth = $invoiceMonth;
  270. }
  271. /**
  272. * @return \DateTime
  273. */
  274. public function getStartDate()
  275. {
  276. return $this->startDate;
  277. }
  278. /**
  279. * @param \DateTime $startDate
  280. */
  281. public function setStartDate(\DateTime $startDate)
  282. {
  283. $this->startDate = $startDate;
  284. }
  285. /**
  286. * @return \DateTime
  287. */
  288. public function getEndDate()
  289. {
  290. return $this->endDate;
  291. }
  292. /**
  293. * @param \DateTime $endDate
  294. */
  295. public function setEndDate(\DateTime $endDate)
  296. {
  297. $this->endDate = $endDate;
  298. }
  299. /**
  300. * @return int
  301. */
  302. public function getStatus(): int
  303. {
  304. return $this->status;
  305. }
  306. /**
  307. * @param int $status
  308. */
  309. public function setStatus(int $status)
  310. {
  311. $this->status = $status;
  312. }
  313. public function getStringStatus($status)
  314. {
  315. return self::$paymentStatuses[$status];
  316. }
  317. /**
  318. * @return \DateTime
  319. */
  320. public function getSentDate(): \DateTime
  321. {
  322. return $this->sentDate;
  323. }
  324. /**
  325. * @param \DateTime $sentDate
  326. */
  327. public function setSentDate(\DateTime $sentDate)
  328. {
  329. $this->sentDate = $sentDate;
  330. }
  331. /**
  332. * @return bool
  333. */
  334. public function isReadyToSend(): bool
  335. {
  336. return $this->readyToSend;
  337. }
  338. /**
  339. * @param bool $readyToSend
  340. */
  341. public function setReadyToSend(bool $readyToSend)
  342. {
  343. $this->readyToSend = $readyToSend;
  344. }
  345. /**
  346. * @return int
  347. */
  348. public function getApproval(): int
  349. {
  350. return $this->approval;
  351. }
  352. /**
  353. * @param int $approval
  354. */
  355. public function setApproval(int $approval)
  356. {
  357. $this->approval = $approval;
  358. }
  359. }