|
@@ -114,21 +114,21 @@ discard block |
|
|
block discarded – undo |
|
114
|
114
|
// Compress Document |
|
115
|
115
|
self::zipInvoice($Document); |
|
116
|
116
|
} |
|
117
|
|
- private static function singInvoice(SunatDocument $Document){ |
|
|
117
|
+ private static function singInvoice(SunatDocument $Document) { |
|
118
|
118
|
$xmlFile = $Document->getFileName(); |
|
119
|
119
|
XmlDSig::sign($xmlFile); |
|
120
|
120
|
} |
|
121
|
|
- private static function zipInvoice(SunatDocument $Document){ |
|
|
121
|
+ private static function zipInvoice(SunatDocument $Document) { |
|
122
|
122
|
$xmlFile = $Document->getFileName(); |
|
123
|
123
|
FileService::doZip($xmlFile); |
|
124
|
124
|
} |
|
125
|
125
|
private static function addLegalMonetaryTotal(SunatDocument $Invoice) { |
|
126
|
126
|
|
|
127
|
127
|
$DOM = $Invoice->getDetailMatrix(); |
|
128
|
|
- $currencyID = $Invoice->getDocumentCurrencyCode(); // Tipo de moneda |
|
129
|
|
- $itemsAllowance = $DOM->getTotalAllowances(); // Total descuentos por item |
|
130
|
|
- $taxableOperations = $DOM->getTotalTaxableOperations(); // Total operaciones gravadas |
|
131
|
|
- $exemptedOperations = $DOM->getTotalExcemptedOperations(); // Total operaciones exoneradas |
|
|
128
|
+ $currencyID = $Invoice->getDocumentCurrencyCode(); // Tipo de moneda |
|
|
129
|
+ $itemsAllowance = $DOM->getTotalAllowances(); // Total descuentos por item |
|
|
130
|
+ $taxableOperations = $DOM->getTotalTaxableOperations(); // Total operaciones gravadas |
|
|
131
|
+ $exemptedOperations = $DOM->getTotalExcemptedOperations(); // Total operaciones exoneradas |
|
132
|
132
|
|
|
133
|
133
|
// Total descuentos globales |
|
134
|
134
|
$gloabalAllowance = 0; |
|
@@ -177,8 +177,8 @@ discard block |
|
|
block discarded – undo |
|
177
|
177
|
} |
|
178
|
178
|
|
|
179
|
179
|
private static function addInvoiceLines(SunatDocument $Invoice, $items) { |
|
180
|
|
- $currencyID = $Invoice->getDocumentCurrencyCode(); // Tipo de moneda |
|
181
|
|
- $DetailMatrix = new DetailMatrix(); // Matriz de calculos |
|
|
180
|
+ $currencyID = $Invoice->getDocumentCurrencyCode(); // Tipo de moneda |
|
|
181
|
+ $DetailMatrix = new DetailMatrix(); // Matriz de calculos |
|
182
|
182
|
$DetailMatrix->populate($items, $currencyID); |
|
183
|
183
|
$Invoice->setDetailMatrix($DetailMatrix); |
|
184
|
184
|
$ln = count($items); |
|
@@ -326,9 +326,9 @@ discard block |
|
|
block discarded – undo |
|
326
|
326
|
|
|
327
|
327
|
private static function addTaxes(SunatDocument $Invoice) { |
|
328
|
328
|
$DOM = $Invoice->getDetailMatrix(); |
|
329
|
|
- $currencyID = $Invoice->getDocumentCurrencyCode(); // Tipo de moneda |
|
330
|
|
- $taxableOperations = $DOM->getTotalTaxableOperations(); // Total operaciones gravadas |
|
331
|
|
- $exemptedOperations = $DOM->getTotalExcemptedOperations(); // Total operaciones exoneradas |
|
|
329
|
+ $currencyID = $Invoice->getDocumentCurrencyCode(); // Tipo de moneda |
|
|
330
|
+ $taxableOperations = $DOM->getTotalTaxableOperations(); // Total operaciones gravadas |
|
|
331
|
+ $exemptedOperations = $DOM->getTotalExcemptedOperations(); // Total operaciones exoneradas |
|
332
|
332
|
$unaffectedOperations = $DOM->getTotalUnaffectedOperations(); // Total operaciones inafectas |
|
333
|
333
|
|
|
334
|
334
|
// XML nodes |
|
@@ -338,11 +338,11 @@ discard block |
|
|
block discarded – undo |
|
338
|
338
|
// Operaciones gravadas - aplicando cargos y descuetos |
|
339
|
339
|
$igvBaseAmount = self::applyAllowancesAndCharges($Invoice, $taxableOperations); |
|
340
|
340
|
$taxAmount = $igvBaseAmount * SunatVars::IGV; |
|
341
|
|
- self::addTaxSubtotal($TaxTotal, $currencyID, $taxAmount, $igvBaseAmount, DetailMatrix::TAX_IGV); |
|
|
341
|
+ self::addTaxSubtotal($TaxTotal, $currencyID, $taxAmount, $igvBaseAmount, DetailMatrix::TAX_IGV); |
|
342
|
342
|
|
|
343
|
343
|
// Total operaciones exoneradas - aplicando cargos y descuetos |
|
344
|
344
|
$exoBaseAmount = self::applyAllowancesAndCharges($Invoice, $exemptedOperations); |
|
345
|
|
- self::addTaxSubtotal($TaxTotal, $currencyID, 0, $exoBaseAmount, DetailMatrix::TAX_EXO); |
|
|
345
|
+ self::addTaxSubtotal($TaxTotal, $currencyID, 0, $exoBaseAmount, DetailMatrix::TAX_EXO); |
|
346
|
346
|
|
|
347
|
347
|
// Total operaciones inafectas |
|
348
|
348
|
self::addTaxSubtotal($TaxTotal, $currencyID, 0, $unaffectedOperations, DetailMatrix::TAX_INA); |