@@ -80,7 +80,7 @@ |
||
80 | 80 | $this->documentId = $this->documentSeries . '-' . $this->documentNumber; |
81 | 81 | $this->issueDate = new DateTime($data['issueDate']); |
82 | 82 | if (isset($data['dueDate'])) { |
83 | - $this->dueDate = new DateTime($data['dueDate']); |
|
83 | + $this->dueDate = new DateTime($data['dueDate']); |
|
84 | 84 | } |
85 | 85 | $this->customerDocType = $data['customerDocType']; |
86 | 86 | $this->customerDocNumber = $data['customerDocNumber']; |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | 'igvPercent' => SunatVars::IGV_PERCENT, |
122 | 122 | 'logo' => LogoMgr::getLogoString(), |
123 | 123 | 'qr' => QrGenerator::getQrString($dataMap), // QR Code |
124 | - 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
125 | - 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
124 | + 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
125 | + 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
126 | 126 | 'unaffectedOperations' => Operations::formatAmount($dataMap->getTotalUnaffectedOperations()), // Total operaciones inafectas |
127 | - 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
128 | - 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
129 | - 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
130 | - 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
131 | - 'payableInWords' => $payableInWords, // Monto en palabras |
|
132 | - 'items' => self::getReadyToPrintDataItems($dataMap), // Items |
|
127 | + 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
128 | + 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
129 | + 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
130 | + 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
131 | + 'payableInWords' => $payableInWords, // Monto en palabras |
|
132 | + 'items' => self::getReadyToPrintDataItems($dataMap), // Items |
|
133 | 133 | 'noteType' => $dataMap->getNoteType(), |
134 | 134 | 'affectedDocumentId' => $dataMap->getNoteAffectedDocId(), |
135 | 135 | 'affectedDocumentOficialName' => Catalogo::getOfficialDocumentName($dataMap->getNoteAffectedDocType()), |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $ln = $Items->getCount(); |
143 | 143 | $items2 = []; |
144 | 144 | for ($i = 0; $i < $ln; $i++) { |
145 | - $items2[]= [ |
|
145 | + $items2[] = [ |
|
146 | 146 | 'productCode' => $Items->getProductCode($i), |
147 | 147 | 'quantity' => $Items->getQunatity($i), |
148 | 148 | 'unitName' => Catalogo::getUnitName($Items->getUnitCode($i)), |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | protected function parseInput(array $in) { |
38 | 38 | $out = $in; |
39 | - $lines = $this->parseInputLines($in['lines']); |
|
39 | + $lines = $this->parseInputLines($in['lines']); |
|
40 | 40 | $out['percent'] = Catalogo::getCatItemFieldValue($this->regimeCatNumber, $in['systemCode'], 'tasa'); |
41 | 41 | $out['lines'] = $lines; |
42 | 42 | // Calculate totals |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // Set amount and netTotalCashed |
58 | 58 | $exchangeCalculationRate = ($out['currencyCode'] == self::LOCAL_CURRENCY_CODE) ? 1 : $out['exchangeRate']; |
59 | 59 | $paymentBase = $out['payment']['paidAmount'] * $exchangeCalculationRate; |
60 | - $opAmount = ($paymentBase * $percent)/100; |
|
60 | + $opAmount = ($paymentBase * $percent) / 100; |
|
61 | 61 | // Percepcion base + amount |
62 | 62 | // Retencion base - amount |
63 | 63 | $operator = $this->isPercepcion ? 1 : -1; |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | |
85 | 85 | private function addDocumentTaxes() { |
86 | 86 | $Invoice = $this->dataMap; |
87 | - $currencyID = $Invoice->getCurrencyCode(); // Tipo de moneda |
|
88 | - $totalTaxableOperations = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas |
|
89 | - $totalTaxes = $Invoice->getTotalTaxes(); // Total operaciones gravadas |
|
90 | - $Igv = $Invoice->getIGV(); // Total IGV |
|
91 | - $totalExemptedOperations = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas |
|
87 | + $currencyID = $Invoice->getCurrencyCode(); // Tipo de moneda |
|
88 | + $totalTaxableOperations = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas |
|
89 | + $totalTaxes = $Invoice->getTotalTaxes(); // Total operaciones gravadas |
|
90 | + $Igv = $Invoice->getIGV(); // Total IGV |
|
91 | + $totalExemptedOperations = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas |
|
92 | 92 | $totalUnaffectedOperations = $Invoice->getTotalUnaffectedOperations(); // Total operaciones inafectas |
93 | - $totalFreeOpertions = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas |
|
93 | + $totalFreeOpertions = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas |
|
94 | 94 | |
95 | 95 | // XML nodes |
96 | 96 | $TaxTotal = new TaxTotal(); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | // Total operaciones exoneradas |
103 | 103 | if ($totalExemptedOperations) { |
104 | - UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO); |
|
104 | + UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO); |
|
105 | 105 | } |
106 | 106 | // Total operaciones inafectas |
107 | 107 | if ($totalUnaffectedOperations) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | // Total operaciones gratuitas |
111 | 111 | if ($totalFreeOpertions) { |
112 | - UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA); |
|
112 | + UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Total impuestos |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | private function addInvoiceLegalMonetaryTotal() { |
272 | 272 | $Invoice = $this->dataMap; |
273 | 273 | $currencyID = $this->getDocumentCurrencyCode(); // Tipo de moneda |
274 | - $totalAllowances = $Invoice->getTotalAllowances(); // Total descuentos |
|
275 | - $payableAmount = $Invoice->getPayableAmount(); // Total a pagar |
|
274 | + $totalAllowances = $Invoice->getTotalAllowances(); // Total descuentos |
|
275 | + $payableAmount = $Invoice->getPayableAmount(); // Total a pagar |
|
276 | 276 | $billableAmount = $Invoice->getBillableValue(); |
277 | 277 | // LegalMonetaryTotal |
278 | 278 | $LegalMonetaryTotal = new LegalMonetaryTotal(); |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | 'igvPercent' => SunatVars::IGV_PERCENT, |
82 | 82 | 'logo' => LogoMgr::getLogoString(), |
83 | 83 | 'qr' => QrGenerator::getQrString($dataMap), // QR Code |
84 | - 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
85 | - 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
84 | + 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
85 | + 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
86 | 86 | 'unaffectedOperations' => Operations::formatAmount($dataMap->getTotalUnaffectedOperations()), // Total operaciones inafectas |
87 | - 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
88 | - 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
89 | - 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
90 | - 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
91 | - 'payableInWords' => $payableInWords, // Monto en palabras |
|
87 | + 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
88 | + 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
89 | + 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
90 | + 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
91 | + 'payableInWords' => $payableInWords, // Monto en palabras |
|
92 | 92 | 'items' => self::getReadyToPrintDataItems($dataMap) // Items |
93 | 93 | ]; |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $ln = $Items->getCount(); |
99 | 99 | $items2 = []; |
100 | 100 | for ($i = 0; $i < $ln; $i++) { |
101 | - $items2[]= [ |
|
101 | + $items2[] = [ |
|
102 | 102 | 'productCode' => $Items->getProductCode($i), |
103 | 103 | 'quantity' => $Items->getQunatity($i), |
104 | 104 | 'unitName' => Catalogo::getUnitName($Items->getUnitCode($i)), |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | 'igvPercent' => SunatVars::IGV_PERCENT, |
121 | 121 | 'logo' => LogoMgr::getLogoString(), |
122 | 122 | 'qr' => QrGenerator::getQrString($dataMap), // QR Code |
123 | - 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
124 | - 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
123 | + 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
124 | + 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
125 | 125 | 'unaffectedOperations' => Operations::formatAmount($dataMap->getTotalUnaffectedOperations()), // Total operaciones inafectas |
126 | - 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
127 | - 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
128 | - 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
129 | - 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
130 | - 'payableInWords' => $payableInWords, // Monto en palabras |
|
131 | - 'items' => self::getReadyToPrintDataItems($dataMap), // Items |
|
126 | + 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
127 | + 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
128 | + 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
129 | + 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
130 | + 'payableInWords' => $payableInWords, // Monto en palabras |
|
131 | + 'items' => self::getReadyToPrintDataItems($dataMap), // Items |
|
132 | 132 | 'noteType' => $dataMap->getNoteType(), |
133 | 133 | 'affectedDocumentId' => $dataMap->getNoteAffectedDocId(), |
134 | 134 | 'affectedDocumentOficialName' => Catalogo::getOfficialDocumentName($dataMap->getNoteAffectedDocType()), |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $ln = $Items->getCount(); |
142 | 142 | $items2 = []; |
143 | 143 | for ($i = 0; $i < $ln; $i++) { |
144 | - $items2[]= [ |
|
144 | + $items2[] = [ |
|
145 | 145 | 'productCode' => $Items->getProductCode($i), |
146 | 146 | 'quantity' => $Items->getQunatity($i), |
147 | 147 | 'unitName' => Catalogo::getUnitName($Items->getUnitCode($i)), |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function __construct(array $data, $type) { |
25 | 25 | $this->data = $data; |
26 | 26 | $this->type = $type; |
27 | - if(is_array($type)){ |
|
27 | + if (is_array($type)) { |
|
28 | 28 | $this->validations = $type; |
29 | 29 | } |
30 | 30 | $this->validate(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | private function validate() { |
42 | - if(!$this->validations){ |
|
42 | + if (!$this->validations) { |
|
43 | 43 | $this->validations = $this->getValidations(); |
44 | 44 | } |
45 | 45 | foreach ($this->validations as $field => $item) { |
@@ -166,7 +166,7 @@ |
||
166 | 166 | public static function getCatItemFieldValue($catNumber, $itemID, $field) { |
167 | 167 | $item = self::getCatItem($catNumber, $itemID); |
168 | 168 | if ($item) { |
169 | - if(isset($item[$field])){ |
|
169 | + if (isset($item[$field])) { |
|
170 | 170 | return $item[$field]; |
171 | 171 | } |
172 | 172 | throw new InvalidArgumentException("Catálogo Error, no existe el campo '$field' en el cátalogo='$catNumber'"); |
@@ -80,16 +80,16 @@ |
||
80 | 80 | |
81 | 81 | private static function saveStatusResponse($response, $documentName) { |
82 | 82 | $xml = simplexml_load_string($response); |
83 | - $status = (array)$xml->xpath("//status")[0]; |
|
83 | + $status = (array) $xml->xpath("//status")[0]; |
|
84 | 84 | |
85 | 85 | // Status code only 0 and 99 |
86 | - if($status['statusCode'] == '0' || $status['statusCode'] == '99') { |
|
86 | + if ($status['statusCode'] == '0' || $status['statusCode'] == '99') { |
|
87 | 87 | $statusContent = $status['content']; |
88 | 88 | $cdr = base64_decode($statusContent); |
89 | 89 | Repository::saveCdr($documentName, $cdr); |
90 | 90 | $status['cdr'] = Repository::getCdrInfo($documentName); |
91 | 91 | $status['message'] = null; |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $status['cdr'] = null; |
94 | 94 | $status['message'] = $status['content']; |
95 | 95 | } |
@@ -89,7 +89,7 @@ |
||
89 | 89 | Repository::saveCdr($documentName, $cdr); |
90 | 90 | $status['cdr'] = Repository::getCdrInfo($documentName); |
91 | 91 | $status['message'] = null; |
92 | - }else{ |
|
92 | + } else{ |
|
93 | 93 | $status['cdr'] = null; |
94 | 94 | $status['message'] = $status['content']; |
95 | 95 | } |