|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
6
|
|
|
use App\Repository\JournalLineItemRepository; |
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
use Doctrine\Common\Collections\Collection; |
|
9
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
10
|
|
|
|
|
11
|
|
|
#[ORM\Entity(repositoryClass: JournalLineItemRepository::class)] |
|
12
|
|
|
#[ApiResource] |
|
13
|
|
|
class JournalLineItem |
|
14
|
|
|
{ |
|
15
|
|
|
#[ORM\Id] |
|
16
|
|
|
#[ORM\GeneratedValue] |
|
17
|
|
|
#[ORM\Column] |
|
18
|
|
|
private ?int $id = null; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var Collection<int, JournalEntry> |
|
22
|
|
|
*/ |
|
23
|
|
|
#[ORM\OneToMany(targetEntity: JournalEntry::class, mappedBy: 'journalLineItem')] |
|
24
|
|
|
private Collection $JournalEntry; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var Collection<int, Account> |
|
28
|
|
|
*/ |
|
29
|
|
|
#[ORM\OneToMany(targetEntity: Account::class, mappedBy: 'journalLineItem')] |
|
30
|
|
|
private Collection $Account; |
|
31
|
|
|
|
|
32
|
|
|
#[ORM\Column] |
|
33
|
|
|
private ?float $DebitAmount = null; |
|
34
|
|
|
|
|
35
|
|
|
#[ORM\Column] |
|
36
|
|
|
private ?float $CreditAmount = null; |
|
37
|
|
|
|
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->JournalEntry = new ArrayCollection(); |
|
41
|
|
|
$this->Account = new ArrayCollection(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function getId(): ?int |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->id; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return Collection<int, JournalEntry> |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getJournalEntry(): Collection |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->JournalEntry; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function addJournalEntry(JournalEntry $journalEntry): static |
|
58
|
|
|
{ |
|
59
|
|
|
if (!$this->JournalEntry->contains($journalEntry)) { |
|
60
|
|
|
$this->JournalEntry->add($journalEntry); |
|
61
|
|
|
$journalEntry->setJournalLineItem($this); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
return $this; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function removeJournalEntry(JournalEntry $journalEntry): static |
|
68
|
|
|
{ |
|
69
|
|
|
if ($this->JournalEntry->removeElement($journalEntry)) { |
|
70
|
|
|
// set the owning side to null (unless already changed) |
|
71
|
|
|
if ($journalEntry->getJournalLineItem() === $this) { |
|
72
|
|
|
$journalEntry->setJournalLineItem(null); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
return $this; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return Collection<int, Account> |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getAccount(): Collection |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->Account; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function addAccount(Account $account): static |
|
88
|
|
|
{ |
|
89
|
|
|
if (!$this->Account->contains($account)) { |
|
90
|
|
|
$this->Account->add($account); |
|
91
|
|
|
$account->setJournalLineItem($this); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
return $this; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function removeAccount(Account $account): static |
|
98
|
|
|
{ |
|
99
|
|
|
if ($this->Account->removeElement($account)) { |
|
100
|
|
|
// set the owning side to null (unless already changed) |
|
101
|
|
|
if ($account->getJournalLineItem() === $this) { |
|
102
|
|
|
$account->setJournalLineItem(null); |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
return $this; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function getDebitAmount(): ?float |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->DebitAmount; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function setDebitAmount(float $DebitAmount): static |
|
115
|
|
|
{ |
|
116
|
|
|
$this->DebitAmount = $DebitAmount; |
|
117
|
|
|
|
|
118
|
|
|
return $this; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
public function getCreditAmount(): ?float |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->CreditAmount; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
public function setCreditAmount(float $CreditAmount): static |
|
127
|
|
|
{ |
|
128
|
|
|
$this->CreditAmount = $CreditAmount; |
|
129
|
|
|
|
|
130
|
|
|
return $this; |
|
131
|
|
|
} |
|
132
|
|
|
} |
|
133
|
|
|
|