|
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 TaxCategory extends BaseComponent { |
|
17
|
|
|
|
|
18
|
|
|
const DECIMALS = 2; |
|
19
|
|
|
|
|
20
|
|
|
protected $ID; |
|
21
|
|
|
protected $IDAttributes; |
|
22
|
|
|
protected $Name; |
|
23
|
|
|
protected $Percent; |
|
24
|
|
|
protected $TaxExemptionReasonCode; |
|
25
|
|
|
protected $TaxExemptionReasonCodeAttributes = []; |
|
26
|
|
|
|
|
27
|
|
|
/** @var TaxScheme */ |
|
28
|
|
|
protected $TaxScheme; |
|
29
|
|
|
|
|
30
|
|
|
function xmlSerialize(Writer $writer) { |
|
31
|
|
|
$writer->write([ |
|
32
|
|
|
'name' => SchemaNS::CBC . 'ID', |
|
33
|
|
|
'value' => $this->ID, |
|
34
|
|
|
'attributes' => $this->IDAttributes |
|
35
|
|
|
]); |
|
36
|
|
|
|
|
37
|
|
|
if (!is_null($this->Name)) { |
|
38
|
|
|
$writer->write([ |
|
39
|
|
|
SchemaNS::CBC . 'Name' => $this->Name |
|
40
|
|
|
]); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
if (!is_null($this->Percent)) { |
|
44
|
|
|
$writer->write([ |
|
45
|
|
|
SchemaNS::CBC . 'Percent' => Operations::formatAmount($this->Percent, self::DECIMALS), |
|
46
|
|
|
]); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
if (!is_null($this->TaxExemptionReasonCode)) { |
|
50
|
|
|
$writer->write([ |
|
51
|
|
|
'name' => SchemaNS::CBC . 'TaxExemptionReasonCode', |
|
52
|
|
|
'value' => $this->TaxExemptionReasonCode, |
|
53
|
|
|
'attributes' => $this->TaxExemptionReasonCodeAttributes |
|
54
|
|
|
]); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
if (!is_null($this->TaxScheme)) { |
|
58
|
|
|
$writer->write([ |
|
59
|
|
|
SchemaNS::CAC . 'TaxScheme' => $this->TaxScheme |
|
60
|
|
|
]); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function getID() { |
|
65
|
|
|
return $this->ID; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setID($ID) { |
|
69
|
|
|
$this->ID = $ID; |
|
70
|
|
|
return $this; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getName() { |
|
74
|
|
|
return $this->Name; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function setName($Name) { |
|
78
|
|
|
$this->Name = $Name; |
|
79
|
|
|
return $this; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getPercent() { |
|
83
|
|
|
return $this->Percent; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function setPercent($Percent) { |
|
87
|
|
|
$this->Percent = $Percent; |
|
88
|
|
|
return $this; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function getTaxExemptionReasonCode() { |
|
92
|
|
|
return $this->TaxExemptionReasonCode; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function setTaxExemptionReasonCode($TaxExemptionReasonCode) { |
|
96
|
|
|
$this->TaxExemptionReasonCode = $TaxExemptionReasonCode; |
|
97
|
|
|
return $this; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getTaxScheme() { |
|
101
|
|
|
return $this->TaxScheme; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function setTaxScheme(TaxScheme $TaxScheme) { |
|
105
|
|
|
$this->TaxScheme = $TaxScheme; |
|
106
|
|
|
return $this; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
} |
|
110
|
|
|
|