1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (C) 2020-2025 Iain Cambridge |
7
|
|
|
* |
8
|
|
|
* This program is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by |
10
|
|
|
* the Free Software Foundation, either version 2.1 of the License, or |
11
|
|
|
* (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU Lesser General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU General Public License |
19
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Parthenon\Billing\Entity; |
23
|
|
|
|
24
|
|
|
use Brick\Money\Money; |
25
|
|
|
|
26
|
|
|
class ReceiptLine implements ReceiptLineInterface |
27
|
|
|
{ |
28
|
|
|
private $id; |
29
|
|
|
|
30
|
|
|
private ReceiptInterface $receipt; |
31
|
|
|
|
32
|
|
|
private string $currency; |
33
|
|
|
|
34
|
|
|
private int $total; |
35
|
|
|
|
36
|
|
|
private int $subTotal; |
37
|
|
|
|
38
|
|
|
private int $vatTotal; |
39
|
|
|
|
40
|
|
|
private ?float $vatPercentage = null; |
41
|
|
|
|
42
|
|
|
private ?string $description = null; |
43
|
|
|
|
44
|
|
|
public function getId() |
45
|
|
|
{ |
46
|
|
|
return $this->id; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function setId($id): void |
50
|
|
|
{ |
51
|
|
|
$this->id = $id; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getReceipt(): ReceiptInterface |
55
|
|
|
{ |
56
|
|
|
return $this->receipt; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setReceipt(ReceiptInterface $receipt): void |
60
|
|
|
{ |
61
|
|
|
$this->receipt = $receipt; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getCurrency(): string |
65
|
|
|
{ |
66
|
|
|
return $this->currency; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setCurrency(string $currency): void |
70
|
|
|
{ |
71
|
|
|
$this->currency = $currency; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getTotal(): int |
75
|
|
|
{ |
76
|
|
|
return $this->total; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function setTotal(int $total): void |
80
|
|
|
{ |
81
|
|
|
$this->total = $total; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getSubTotal(): int |
85
|
|
|
{ |
86
|
|
|
return $this->subTotal; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function setSubTotal(int $subTotal): void |
90
|
|
|
{ |
91
|
|
|
$this->subTotal = $subTotal; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getVatTotal(): int |
95
|
|
|
{ |
96
|
|
|
return $this->vatTotal; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function setVatTotal(int $vatTotal): void |
100
|
|
|
{ |
101
|
|
|
$this->vatTotal = $vatTotal; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getDescription(): string |
105
|
|
|
{ |
106
|
|
|
return $this->description; |
|
|
|
|
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function setDescription(?string $description): void |
110
|
|
|
{ |
111
|
|
|
$this->description = $description; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getTotalMoney(): Money |
115
|
|
|
{ |
116
|
|
|
return Money::ofMinor($this->total, strtoupper($this->currency)); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getVatTotalMoney(): Money |
120
|
|
|
{ |
121
|
|
|
return Money::ofMinor($this->vatTotal, strtoupper($this->currency)); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function getSubTotalMoney(): Money |
125
|
|
|
{ |
126
|
|
|
return Money::ofMinor($this->subTotal, strtoupper($this->currency)); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getVatPercentage(): ?float |
130
|
|
|
{ |
131
|
|
|
return $this->vatPercentage; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function setVatPercentage(?float $vatPercentage): void |
135
|
|
|
{ |
136
|
|
|
$this->vatPercentage = $vatPercentage; |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|