1 | <?php |
||
18 | class TaxModifier extends PriceModifier |
||
19 | { |
||
20 | /** |
||
21 | * Set the tax rate as a percentage |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | private static $tax_rate = 21; |
||
26 | |||
27 | /** |
||
28 | * Set if the tax rate is inclusive or exclusive |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private static $inclusive = false; |
||
33 | |||
34 | /** |
||
35 | * Set the default sort value to a large int so it always shows and calculates as last |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | private static $defaults = array( |
||
|
|||
40 | 'Title' => 'Tax modifier', |
||
41 | 'Sort' => 9999 |
||
42 | ); |
||
43 | |||
44 | /** |
||
45 | * Update the total, if the tax is not inclusive the total gets altered |
||
46 | * |
||
47 | * @param float $total |
||
48 | * @param Reservation $reservation |
||
49 | */ |
||
50 | public function updateTotal(&$total, Reservation $reservation) { |
||
58 | |||
59 | /** |
||
60 | * Show the used tax rate in the table title |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getTableTitle() |
||
82 | |||
83 | /** |
||
84 | * Show the calculated tax value as a positive value |
||
85 | * |
||
86 | * @return float |
||
87 | */ |
||
88 | public function getTableValue() |
||
92 | |||
93 | /** |
||
94 | * Create a tax modifier if it does not already exists |
||
95 | * |
||
96 | * @param Reservation $reservation |
||
97 | * |
||
98 | * @return TaxModifier|\DataObject|null|static |
||
99 | */ |
||
100 | public static function findOrMake(Reservation $reservation) |
||
109 | } |
||
110 |