1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* PHP Billing Library |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/php-billing |
6
|
|
|
* @package php-billing |
7
|
|
|
* @license BSD-3-Clause |
8
|
|
|
* @copyright Copyright (c) 2017-2021, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hiqdev\php\billing\statement; |
12
|
|
|
|
13
|
|
|
use hiqdev\php\billing\bill\Bill; |
14
|
|
|
use hiqdev\php\billing\bill\BillInterface; |
15
|
|
|
use hiqdev\php\billing\bill\BillState; |
16
|
|
|
use hiqdev\php\billing\type\TypeInterface; |
17
|
|
|
use hiqdev\php\billing\customer\CustomerInterface; |
18
|
|
|
use hiqdev\php\billing\target\TargetInterface; |
19
|
|
|
use hiqdev\php\billing\plan\PlanInterface; |
20
|
|
|
use hiqdev\php\units\QuantityInterface; |
21
|
|
|
use DateTimeImmutable; |
22
|
|
|
use Money\Money; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* StatementBill. |
26
|
|
|
* |
27
|
|
|
* @author Yurii Myronchuk <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class StatementBill extends Bill implements StatementBillInterface, BillInterface |
30
|
|
|
{ |
31
|
|
|
/** @var DateTimeImmutable */ |
32
|
|
|
protected $month; |
33
|
|
|
|
34
|
|
|
/** @var Money */ |
35
|
|
|
protected $price; |
36
|
|
|
|
37
|
|
|
/** @var Money */ |
38
|
|
|
protected $overuse; |
39
|
|
|
|
40
|
|
|
/** @var QuantityInterface */ |
41
|
|
|
protected $prepaid; |
42
|
|
|
|
43
|
|
|
/** @var string */ |
44
|
|
|
protected $from; |
45
|
|
|
|
46
|
|
|
/** @var TypeInterface */ |
47
|
|
|
protected $tariff_type; |
48
|
|
|
|
49
|
|
|
public function __construct( |
50
|
|
|
$id, |
51
|
|
|
TypeInterface $type, |
52
|
|
|
DateTimeImmutable $time, |
53
|
|
|
Money $sum, |
54
|
|
|
QuantityInterface $quantity, |
55
|
|
|
CustomerInterface $customer, |
56
|
|
|
DateTimeImmutable $month, |
57
|
|
|
Money $price = null, |
58
|
|
|
Money $overuse = null, |
59
|
|
|
QuantityInterface $prepaid = null, |
60
|
|
|
array $charges = [], |
61
|
|
|
TargetInterface $target = null, |
62
|
|
|
PlanInterface $plan = null, |
63
|
|
|
BillState $state = null, |
64
|
|
|
?string $from = null, |
65
|
|
|
TypeInterface $tariff_type = null |
66
|
|
|
) { |
67
|
|
|
parent::__construct( |
68
|
|
|
$id, |
69
|
|
|
$type, |
70
|
|
|
$time, |
71
|
|
|
$sum, |
72
|
|
|
$quantity, |
73
|
|
|
$customer, |
74
|
|
|
$target, |
75
|
|
|
$plan, |
76
|
|
|
$charges, |
77
|
|
|
$state |
78
|
|
|
); |
79
|
|
|
$this->month = $month; |
80
|
|
|
$this->price = $price; |
81
|
|
|
$this->overuse = $overuse; |
82
|
|
|
$this->prepaid = $prepaid; |
83
|
|
|
$this->from = $from; |
84
|
|
|
$this->tariff_type = $tariff_type; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getMonth(): DateTimeImmutable |
88
|
|
|
{ |
89
|
|
|
return $this->month; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function getFrom(): ?string |
93
|
|
|
{ |
94
|
|
|
return $this->from; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getPrice(): ?Money |
98
|
|
|
{ |
99
|
|
|
return $this->price; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function getOveruse(): ?Money |
103
|
|
|
{ |
104
|
|
|
return $this->overuse; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function getPrepaid(): QuantityInterface |
108
|
|
|
{ |
109
|
|
|
return $this->prepaid; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function getTariffType(): ?TypeInterface |
113
|
|
|
{ |
114
|
|
|
return $this->tariff_type; |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|