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 TaxTotal extends BaseComponent { |
17
|
|
|
|
18
|
|
|
const DECIMALS = 2; |
19
|
|
|
|
20
|
|
|
protected $currencyID; |
21
|
|
|
protected $TaxAmount; |
22
|
|
|
|
23
|
|
|
/** @var TaxSubTotal[] */ |
24
|
|
|
protected $TaxSubTotals = []; |
25
|
|
|
protected $validations = ['TaxAmount', 'currencyID', 'TaxSubTotals']; |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The xmlSerialize method is called during xml writing. |
31
|
|
|
* @param Writer $writer |
32
|
|
|
* @return void |
33
|
|
|
*/ |
34
|
|
|
function xmlSerialize(Writer $writer) { |
35
|
|
|
$this->validate(); |
36
|
|
|
|
37
|
|
|
$writer->write([ |
38
|
|
|
[ |
39
|
|
|
'name' => SchemaNS::CBC . 'TaxAmount', |
40
|
|
|
'value' => Operations::formatAmount($this->TaxAmount, self::DECIMALS), |
41
|
|
|
'attributes' => [ |
42
|
|
|
'currencyID' => $this->currencyID |
43
|
|
|
] |
44
|
|
|
], |
45
|
|
|
]); |
46
|
|
|
|
47
|
|
|
foreach ($this->TaxSubTotals as $taxSubTotal) { |
48
|
|
|
$writer->write([SchemaNS::CAC . 'TaxSubtotal' => $taxSubTotal]); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getCurrencyID() { |
53
|
|
|
return $this->currencyID; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function setCurrencyID($currencyID) { |
57
|
|
|
$this->currencyID = $currencyID; |
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getTaxAmount() { |
62
|
|
|
return $this->TaxAmount; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function setTaxAmount($TaxAmount) { |
66
|
|
|
$this->TaxAmount = $TaxAmount; |
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getTaxSubTotals() { |
71
|
|
|
return $this->TaxSubTotals; |
72
|
|
|
} |
73
|
|
|
public function setTaxSubTotals($TaxSubTotals) { |
74
|
|
|
$this->TaxSubTotals = $TaxSubTotals; |
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function addTaxSubTotal(TaxSubTotal $TaxSubTotal) { |
79
|
|
|
$this->TaxSubTotals[] = $TaxSubTotal; |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
|