|
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 AlternativeConditionPrice extends BaseComponent { |
|
17
|
|
|
|
|
18
|
|
|
const DECIMALS = 2; |
|
19
|
|
|
|
|
20
|
|
|
protected $currencyID; |
|
21
|
|
|
protected $PriceAmount; |
|
22
|
|
|
protected $PriceTypeCode; //@CAT16 |
|
23
|
|
|
protected $validations = [ |
|
24
|
|
|
'currencyID', |
|
25
|
|
|
'PriceTypeCode', |
|
26
|
|
|
'PriceAmount' |
|
27
|
|
|
]; |
|
28
|
|
|
|
|
29
|
|
|
function xmlSerialize(Writer $writer) { |
|
30
|
|
|
$this->validate(); |
|
31
|
|
|
$writer->write([ |
|
32
|
|
|
[ |
|
33
|
|
|
'name' => SchemaNS::CBC . 'PriceAmount', |
|
34
|
|
|
'value' => Operations::formatAmount($this->PriceAmount, self::DECIMALS), |
|
35
|
|
|
'attributes' => [ |
|
36
|
|
|
'currencyID' => $this->currencyID |
|
37
|
|
|
], |
|
38
|
|
|
], |
|
39
|
|
|
[ |
|
40
|
|
|
'name' => SchemaNS::CBC . 'PriceTypeCode', |
|
41
|
|
|
'value' => $this->PriceTypeCode, |
|
42
|
|
|
'attributes' => [ |
|
43
|
|
|
'listName' => 'SUNAT:Indicador de Tipo de Precio', |
|
44
|
|
|
'listAgencyName' => 'PE:SUNAT', |
|
45
|
|
|
'listURI' => 'urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo16' |
|
46
|
|
|
] |
|
47
|
|
|
] |
|
48
|
|
|
]); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getCurrencyID() { |
|
52
|
|
|
return $this->currencyID; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function setCurrencyID($currencyID) { |
|
56
|
|
|
$this->currencyID = $currencyID; |
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getPriceAmount() { |
|
61
|
|
|
return $this->PriceAmount; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function setPriceAmount($PriceAmount) { |
|
65
|
|
|
$this->PriceAmount = $PriceAmount; |
|
66
|
|
|
return $this; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getPriceTypeCode() { |
|
70
|
|
|
return $this->PriceTypeCode; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* |
|
75
|
|
|
* @param string $PriceTypeCode @CAT16 |
|
76
|
|
|
* @return $this |
|
77
|
|
|
*/ |
|
78
|
|
|
public function setPriceTypeCode($PriceTypeCode) { |
|
79
|
|
|
$this->PriceTypeCode = $PriceTypeCode; |
|
80
|
|
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
} |
|
84
|
|
|
|