src/Entity/Transaction.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: parcel
  5. * Date: 10/16/18
  6. * Time: 3:36 PM
  7. */
  8. namespace App\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use JMS\Serializer\Annotation as Serializer;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13. * @ORM\Entity(repositoryClass="App\Repository\TransactionRepository")
  14. * @ORM\Table(name="transaction", uniqueConstraints={
  15. * @ORM\UniqueConstraint(name="way_bill_id", columns={"way_bill_id"})})
  16. */
  17. class Transaction
  18. {
  19. /**
  20. * @ORM\Id
  21. * @ORM\GeneratedValue(strategy="AUTO")
  22. * @ORM\Column(type="integer")
  23. */
  24. private $id;
  25. /**
  26. * @var WayBill
  27. * @ORM\OneToOne(targetEntity="App\Entity\WayBill", inversedBy="transaction")
  28. * @ORM\JoinColumns({
  29. * @ORM\JoinColumn(name="way_bill_id", referencedColumnName="id")
  30. * })
  31. */
  32. private $wayBill;
  33. /**
  34. * @Assert\NotNull(message="Please enter an amount")
  35. * @Assert\GreaterThanOrEqual (value="99", message="Please check the value ie it should not be less than 100")
  36. * @Assert\LessThan(value="100000", message="Please check the value ie it should not be more than 20,000")
  37. * @ORM\Column(type="float")
  38. */
  39. private $amount;
  40. /** @ORM\Column(type="float", options={"default": 0}) */
  41. private $cashAmount;
  42. /** @ORM\Column(type="float", options={"default": 0}) */
  43. private $mpesaAmount;
  44. /**
  45. * @ORM\Column(type="float")
  46. */
  47. private $taxPercentage;
  48. /**
  49. * @ORM\Column(type="float")
  50. */
  51. private $taxAmount;
  52. /**
  53. * @ORM\Column(type="float")
  54. */
  55. private $grossAmount;
  56. /**
  57. * @ORM\Column(type="float")
  58. */
  59. private $stationExpenses;
  60. /**
  61. * @ORM\Column(type="float")
  62. */
  63. private $stationBalance;
  64. /**
  65. * @ORM\Column(type="float")
  66. */
  67. private $expenses;
  68. /**
  69. * @Serializer\Type("ArrayCollection<App\Entity\TransactionExpense>")
  70. * @ORM\OneToMany(targetEntity="TransactionExpense", mappedBy="transaction", cascade={"persist", "remove"})
  71. */
  72. private $wayBillExpenses;
  73. /**
  74. * @ORM\Column(type="float")
  75. */
  76. private $balance;
  77. /**
  78. * @Serializer\Type("DateTime<'d/m/Y'>")
  79. * @ORM\Column(type="datetime")
  80. */
  81. private $createdAt;
  82. /**
  83. * @var User
  84. * @ORM\ManyToOne(targetEntity="User")
  85. * @ORM\JoinColumns({
  86. * @ORM\JoinColumn(name="created_by", referencedColumnName="id")
  87. * })
  88. */
  89. private $createdBy;
  90. /**
  91. * @var Organization
  92. * @ORM\ManyToOne(targetEntity="App\Entity\Organization")
  93. * @ORM\JoinColumns({
  94. * @ORM\JoinColumn(name="organization_id", referencedColumnName="id")
  95. * })
  96. */
  97. private $organization;
  98. /**
  99. * @var \App\Entity\DailyAccount
  100. * @Serializer\Type("App\Entity\DailyAccount")
  101. * @ORM\ManyToOne(targetEntity="App\Entity\DailyAccount")
  102. * @ORM\JoinColumns({
  103. * @ORM\JoinColumn(name="daily_account_id", referencedColumnName="id")
  104. * })
  105. */
  106. private $dailyAccount;
  107. /**
  108. * @ORM\Column(type="boolean")
  109. */
  110. private $isCancelled;
  111. /**
  112. * @ORM\Column(type="boolean", nullable=false)
  113. */
  114. private $isComplete;
  115. /**
  116. * @ORM\Column(type="boolean", nullable=false)
  117. */
  118. private $isPaid;
  119. /** @ORM\Column(type="string", nullable=true) */
  120. private $paid_by;
  121. /** @ORM\Column(type="string", nullable=true) */
  122. private $mpesaPaymentPhone;
  123. /** @ORM\Column(type="string", name="payment_method") */
  124. private $paymentMethod;
  125. /**
  126. * @Assert\Length(max=11, maxMessage="KRA Pin should be 11 Characters", min="11", minMessage="KRA Pin should be 11 Characters" )
  127. * @ORM\Column(type="string", nullable=true)
  128. */
  129. private $pinNumber;
  130. /**
  131. * @ORM\Column(type="string", nullable=true)
  132. */
  133. private $cuInvoiceNumber;
  134. /**
  135. * @ORM\Column(type="string", nullable=true)
  136. */
  137. private $cuInvoiceNumberCredit;
  138. /**
  139. * @ORM\Column(type="string", nullable=true)
  140. */
  141. private $cuSerialNumber;
  142. /**
  143. * @ORM\Column(type="boolean", nullable=false)
  144. */
  145. private $isFinal;
  146. /**
  147. * @return mixed
  148. */
  149. public function getId()
  150. {
  151. return $this->id;
  152. }
  153. /**
  154. * @param mixed $id
  155. */
  156. public function setId($id)
  157. {
  158. $this->id = $id;
  159. }
  160. /**
  161. * @return WayBill
  162. */
  163. public function getWayBill()
  164. {
  165. return $this->wayBill;
  166. }
  167. /**
  168. * @param WayBill $wayBill
  169. */
  170. public function setWayBill($wayBill)
  171. {
  172. $this->wayBill = $wayBill;
  173. }
  174. /**
  175. * @return mixed
  176. */
  177. public function getAmount()
  178. {
  179. return $this->amount;
  180. }
  181. /**
  182. * @param mixed $amount
  183. */
  184. public function setAmount($amount)
  185. {
  186. $this->amount = $amount;
  187. }
  188. /**
  189. * @return mixed
  190. */
  191. public function getTaxPercentage()
  192. {
  193. return $this->taxPercentage;
  194. }
  195. /**
  196. * @param mixed $taxPercentage
  197. */
  198. public function setTaxPercentage($taxPercentage)
  199. {
  200. $this->taxPercentage = $taxPercentage;
  201. }
  202. /**
  203. * @return mixed
  204. */
  205. public function getTaxAmount()
  206. {
  207. return $this->taxAmount;
  208. }
  209. /**
  210. * @param mixed $taxAmount
  211. */
  212. public function setTaxAmount($taxAmount)
  213. {
  214. $this->taxAmount = $taxAmount;
  215. }
  216. /**
  217. * @return mixed
  218. */
  219. public function getGrossAmount()
  220. {
  221. return $this->grossAmount;
  222. }
  223. /**
  224. * @param mixed $grossAmount
  225. */
  226. public function setGrossAmount($grossAmount)
  227. {
  228. $this->grossAmount = $grossAmount;
  229. }
  230. /**
  231. * @return mixed
  232. */
  233. public function getStationExpenses()
  234. {
  235. return $this->stationExpenses;
  236. }
  237. /**
  238. * @param mixed $stationExpenses
  239. */
  240. public function setStationExpenses($stationExpenses)
  241. {
  242. $this->stationExpenses = $stationExpenses;
  243. }
  244. /**
  245. * @return mixed
  246. */
  247. public function getStationBalance()
  248. {
  249. return $this->stationBalance;
  250. }
  251. /**
  252. * @param mixed $stationBalance
  253. */
  254. public function setStationBalance($stationBalance)
  255. {
  256. $this->stationBalance = $stationBalance;
  257. }
  258. /**
  259. * @return mixed
  260. */
  261. public function getExpenses()
  262. {
  263. return $this->expenses;
  264. }
  265. /**
  266. * @param mixed $expenses
  267. */
  268. public function setExpenses($expenses)
  269. {
  270. $this->expenses = $expenses;
  271. }
  272. /**
  273. * @return mixed
  274. */
  275. public function getWayBillExpenses()
  276. {
  277. return $this->wayBillExpenses;
  278. }
  279. /**
  280. * @param mixed $wayBillExpenses
  281. */
  282. public function setWayBillExpenses($wayBillExpenses)
  283. {
  284. $this->wayBillExpenses = $wayBillExpenses;
  285. }
  286. /**
  287. * @return mixed
  288. */
  289. public function getBalance()
  290. {
  291. return $this->balance;
  292. }
  293. /**
  294. * @param mixed $balance
  295. */
  296. public function setBalance($balance)
  297. {
  298. $this->balance = $balance;
  299. }
  300. /**
  301. * @return mixed
  302. */
  303. public function getCreatedAt()
  304. {
  305. return $this->createdAt;
  306. }
  307. /**
  308. * @param mixed $createdAt
  309. */
  310. public function setCreatedAt($createdAt)
  311. {
  312. $this->createdAt = $createdAt;
  313. }
  314. /**
  315. * @return User
  316. */
  317. public function getCreatedBy()
  318. {
  319. return $this->createdBy;
  320. }
  321. /**
  322. * @param User $createdBy
  323. */
  324. public function setCreatedBy($createdBy)
  325. {
  326. $this->createdBy = $createdBy;
  327. }
  328. /**
  329. * @return Organization
  330. */
  331. public function getOrganization()
  332. {
  333. return $this->organization;
  334. }
  335. /**
  336. * @param Organization $organization
  337. */
  338. public function setOrganization($organization)
  339. {
  340. $this->organization = $organization;
  341. }
  342. /**
  343. * @return DailyAccount
  344. */
  345. public function getDailyAccount()
  346. {
  347. return $this->dailyAccount;
  348. }
  349. /**
  350. * @param DailyAccount $dailyAccount
  351. */
  352. public function setDailyAccount($dailyAccount)
  353. {
  354. $this->dailyAccount = $dailyAccount;
  355. }
  356. /**
  357. * @return mixed
  358. */
  359. public function getisCancelled()
  360. {
  361. return $this->isCancelled;
  362. }
  363. /**
  364. * @param mixed $isCancelled
  365. */
  366. public function setIsCancelled($isCancelled)
  367. {
  368. $this->isCancelled = $isCancelled;
  369. }
  370. /**
  371. * @return mixed
  372. */
  373. public function getIsComplete()
  374. {
  375. return $this->isComplete;
  376. }
  377. /**
  378. * @param mixed $isComplete
  379. */
  380. public function setIsComplete($isComplete)
  381. {
  382. $this->isComplete = $isComplete;
  383. }
  384. /**
  385. * @return mixed
  386. */
  387. public function getPaidBy()
  388. {
  389. return $this->paid_by;
  390. }
  391. /**
  392. * @param mixed $paid_by
  393. */
  394. public function setPaidBy($paid_by): void
  395. {
  396. $this->paid_by = $paid_by;
  397. }
  398. /**
  399. * @return mixed
  400. */
  401. public function getIsPaid()
  402. {
  403. return $this->isPaid;
  404. }
  405. /**
  406. * @param mixed $isPaid
  407. */
  408. public function setIsPaid($isPaid)
  409. {
  410. $this->isPaid = $isPaid;
  411. }
  412. /**
  413. * @return mixed
  414. */
  415. public function getPaymentMethod()
  416. {
  417. return $this->paymentMethod;
  418. }
  419. /**
  420. * @param mixed $paymentMethod
  421. */
  422. public function setPaymentMethod($paymentMethod): void
  423. {
  424. $this->paymentMethod = $paymentMethod;
  425. }
  426. /**
  427. * @return mixed
  428. */
  429. public function getMpesaPaymentPhone()
  430. {
  431. return $this->mpesaPaymentPhone;
  432. }
  433. /**
  434. * @param mixed $mpesaPaymentPhone
  435. */
  436. public function setMpesaPaymentPhone($mpesaPaymentPhone): void
  437. {
  438. $this->mpesaPaymentPhone = $mpesaPaymentPhone;
  439. }
  440. /**
  441. * @return mixed
  442. */
  443. public function getCashAmount()
  444. {
  445. return $this->cashAmount;
  446. }
  447. /**
  448. * @param mixed $cashAmount
  449. */
  450. public function setCashAmount($cashAmount): void
  451. {
  452. $this->cashAmount = $cashAmount;
  453. }
  454. /**
  455. * @return mixed
  456. */
  457. public function getMpesaAmount()
  458. {
  459. return $this->mpesaAmount;
  460. }
  461. /**
  462. * @param mixed $mpesaAmount
  463. */
  464. public function setMpesaAmount($mpesaAmount): void
  465. {
  466. $this->mpesaAmount = $mpesaAmount;
  467. }
  468. /**
  469. * @return mixed
  470. */
  471. public function getPinNumber()
  472. {
  473. return $this->pinNumber;
  474. }
  475. /**
  476. * @param mixed $pinNumber
  477. */
  478. public function setPinNumber($pinNumber): void
  479. {
  480. $this->pinNumber = $pinNumber;
  481. }
  482. /**
  483. * @return mixed
  484. */
  485. public function getCuInvoiceNumber()
  486. {
  487. return $this->cuInvoiceNumber;
  488. }
  489. /**
  490. * @param mixed $cuInvoiceNumber
  491. */
  492. public function setCuInvoiceNumber($cuInvoiceNumber): void
  493. {
  494. $this->cuInvoiceNumber = $cuInvoiceNumber;
  495. }
  496. /**
  497. * @return mixed
  498. */
  499. public function getCuSerialNumber()
  500. {
  501. return $this->cuSerialNumber;
  502. }/**
  503. * @param mixed $cuSerialNumber
  504. */
  505. public function setCuSerialNumber($cuSerialNumber): void
  506. {
  507. $this->cuSerialNumber = $cuSerialNumber;
  508. }
  509. /**
  510. * @return mixed
  511. */
  512. public function getIsFinal()
  513. {
  514. return $this->isFinal;
  515. }
  516. /**
  517. * @param mixed $isFinal
  518. */
  519. public function setIsFinal($isFinal): void
  520. {
  521. $this->isFinal = $isFinal;
  522. }
  523. /**
  524. * @return mixed
  525. */
  526. public function getCuInvoiceNumberCredit()
  527. {
  528. return $this->cuInvoiceNumberCredit;
  529. }
  530. /**
  531. * @param mixed $cuInvoiceNumberCredit
  532. */
  533. public function setCuInvoiceNumberCredit($cuInvoiceNumberCredit): void
  534. {
  535. $this->cuInvoiceNumberCredit = $cuInvoiceNumberCredit;
  536. }
  537. }