1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MÓDULO DE EMISIÓN ELECTRÓNICA F72X |
5
|
|
|
* UBL 2.1 |
6
|
|
|
* Version 1.0 |
7
|
|
|
* |
8
|
|
|
* Copyright 2019, Jaime Cruz |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace F72X\UblComponent; |
12
|
|
|
|
13
|
|
|
use F72X\Sunat\Operations; |
14
|
|
|
use Sabre\Xml\Writer; |
15
|
|
|
|
16
|
|
|
class CreditNoteLine extends BaseComponent { |
17
|
|
|
|
18
|
|
|
const DECIMALS = 2; |
19
|
|
|
|
20
|
|
|
protected $ID; |
21
|
|
|
protected $CreditedQuantity; |
22
|
|
|
protected $unitCode; |
23
|
|
|
protected $LineExtensionAmount; |
24
|
|
|
protected $currencyID; |
25
|
|
|
|
26
|
|
|
/** @var PricingReference */ |
27
|
|
|
protected $PricingReference; |
28
|
|
|
|
29
|
|
|
/** @var TaxTotal */ |
30
|
|
|
protected $TaxTotal; |
31
|
|
|
|
32
|
|
|
/** @var Item */ |
33
|
|
|
protected $Item; |
34
|
|
|
|
35
|
|
|
/** @var Price */ |
36
|
|
|
protected $Price; |
37
|
|
|
|
38
|
|
|
protected $validations = [ |
39
|
|
|
'currencyID', |
40
|
|
|
'ID', |
41
|
|
|
'CreditedQuantity', |
42
|
|
|
'unitCode', |
43
|
|
|
'LineExtensionAmount', |
44
|
|
|
'PricingReference', |
45
|
|
|
'TaxTotal', |
46
|
|
|
'Item', |
47
|
|
|
'Price' |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
function xmlSerialize(Writer $writer) { |
51
|
|
|
$this->validate(); |
52
|
|
|
$writer->write([ |
53
|
|
|
SchemaNS::CBC . 'ID' => $this->ID, |
54
|
|
|
[ |
55
|
|
|
'name' => SchemaNS::CBC . 'CreditedQuantity', |
56
|
|
|
'value' => $this->CreditedQuantity, |
57
|
|
|
'attributes' => [ |
58
|
|
|
'unitCode' => $this->unitCode, |
59
|
|
|
'unitCodeListID' => 'UN/ECE rec 20', |
60
|
|
|
'unitCodeListAgencyName' => 'United Nations Economic Commission for Europe' |
61
|
|
|
] |
62
|
|
|
], |
63
|
|
|
[ |
64
|
|
|
'name' => SchemaNS::CBC . 'LineExtensionAmount', |
65
|
|
|
'value' => Operations::formatAmount($this->LineExtensionAmount, self::DECIMALS), |
66
|
|
|
'attributes' => [ |
67
|
|
|
'currencyID' => $this->currencyID |
68
|
|
|
] |
69
|
|
|
], |
70
|
|
|
SchemaNS::CAC . 'PricingReference' => $this->PricingReference |
71
|
|
|
]); |
72
|
|
|
$writer->write([ |
73
|
|
|
SchemaNS::CAC . 'TaxTotal' => $this->TaxTotal, |
74
|
|
|
SchemaNS::CAC . 'Item' => $this->Item, |
75
|
|
|
SchemaNS::CAC . 'Price' => $this->Price |
76
|
|
|
]); |
77
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getCurrencyID() { |
81
|
|
|
return $this->currencyID; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function setCurrencyID($currencyID) { |
85
|
|
|
$this->currencyID = $currencyID; |
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getID() { |
90
|
|
|
return $this->ID; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function setID($ID) { |
94
|
|
|
$this->ID = $ID; |
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
public function getUnitCode() { |
98
|
|
|
return $this->unitCode; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function setUnitCode($unitCode) { |
102
|
|
|
$this->unitCode = $unitCode; |
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function getCreditedQuantity() { |
107
|
|
|
return $this->CreditedQuantity; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function setCreditedQuantity($CreditedQuantity) { |
111
|
|
|
$this->CreditedQuantity = $CreditedQuantity; |
112
|
|
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function getLineExtensionAmount() { |
116
|
|
|
return $this->LineExtensionAmount; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setLineExtensionAmount($LineExtensionAmount) { |
120
|
|
|
$this->LineExtensionAmount = $LineExtensionAmount; |
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
public function getPricingReference() { |
124
|
|
|
return $this->PricingReference; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function setPricingReference(PricingReference $PricingReference) { |
128
|
|
|
$this->PricingReference = $PricingReference; |
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getTaxTotal() { |
133
|
|
|
return $this->TaxTotal; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function setTaxTotal(TaxTotal $TaxTotal) { |
137
|
|
|
$this->TaxTotal = $TaxTotal; |
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function getItem() { |
142
|
|
|
return $this->Item; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function setItem(Item $Item) { |
146
|
|
|
$this->Item = $Item; |
147
|
|
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function getPrice() { |
151
|
|
|
return $this->Price; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function setPrice(Price $Price) { |
155
|
|
|
$this->Price = $Price; |
156
|
|
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
} |
160
|
|
|
|