Test Failed
Push — master ( d3c8d8...d4fc42 )
by JAIME ELMER
02:02
created
src/Sunat/Document/SunatDocument.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@
 block discarded – undo
84 84
             $amount = $baseAmount * $k;
85 85
             UblHelper::addAllowanceCharge($this, $currencyType, 'false', $item['reasonCode'], $item['multiplierFactor'], $amount, $baseAmount);
86 86
         }
87
-       // Totales
88
-       $this->addInvoiceLegalMonetaryTotal();
87
+        // Totales
88
+        $this->addInvoiceLegalMonetaryTotal();
89 89
         
90 90
     }
91 91
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             self::addInvoiceItem($i);
115 115
         }
116 116
     }
117
-    private function addInvoiceOrderReference(){
117
+    private function addInvoiceOrderReference() {
118 118
         $orderNumer = $this->invoiceDocument->getPurchaseOrder();
119 119
         if ($orderNumer) {
120 120
             // Xml Node
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
     }
127 127
     private function addInvoiceTaxes() {
128 128
         $Invoice                   = $this->invoiceDocument;
129
-        $currencyID                = $Invoice->getCurrencyType();              // Tipo de moneda
130
-        $totalTaxableOperations    = $Invoice->getTotalTaxableOperations();    // Total operaciones gravadas
131
-        $totalTaxes                = $Invoice->getTotalTaxes();                // Total operaciones gravadas
132
-        $Igv                       = $Invoice->getIGV();                       // Total IGV
133
-        $totalExemptedOperations   = $Invoice->getTotalExemptedOperations();   // Total operaciones exoneradas
129
+        $currencyID                = $Invoice->getCurrencyType(); // Tipo de moneda
130
+        $totalTaxableOperations    = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas
131
+        $totalTaxes                = $Invoice->getTotalTaxes(); // Total operaciones gravadas
132
+        $Igv                       = $Invoice->getIGV(); // Total IGV
133
+        $totalExemptedOperations   = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas
134 134
         $totalUnaffectedOperations = $Invoice->getTotalUnaffectedOperations(); // Total operaciones inafectas
135
-        $totalFreeOpertions        = $Invoice->getTotalFreeOperations();       // Total operaciones gratuitas
135
+        $totalFreeOpertions        = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas
136 136
 
137 137
         // XML nodes
138 138
         $TaxTotal = new TaxTotal();
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         }
144 144
         // Total operaciones exoneradas
145 145
         if ($totalExemptedOperations) {
146
-            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations,   Catalogo::CAT5_EXO);
146
+            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO);
147 147
         }
148 148
         // Total operaciones inafectas
149 149
         if ($totalUnaffectedOperations) {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         }
152 152
         // Total operaciones gratuitas solo aplica a FACTURA
153 153
         if ($totalFreeOpertions && $Invoice->getInvoiceType() === Catalogo::CAT1_FACTURA) {
154
-            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions,        Catalogo::CAT5_GRA);
154
+            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA);
155 155
         }
156 156
 
157 157
         // Total impuestos
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
         $Invoice            = $this->invoiceDocument;
278 278
         $Items              = $this->getItems();
279 279
         $currencyID         = $this->getDocumentCurrencyCode(); // Tipo de moneda
280
-        $totalAllowances    = $Invoice->getTotalAllowances();   // Total descuentos
281
-        $payableAmount      = $Invoice->getPayableAmount();     // Total a pagar
280
+        $totalAllowances    = $Invoice->getTotalAllowances(); // Total descuentos
281
+        $payableAmount      = $Invoice->getPayableAmount(); // Total a pagar
282 282
         $billableAmount     = $Invoice->getBillableValue();
283 283
         // LegalMonetaryTotal
284 284
         $LegalMonetaryTotal = new LegalMonetaryTotal();
Please login to merge, or discard this patch.
src/Sunat/InvoiceItems.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -75,51 +75,51 @@
 block discarded – undo
75 75
         'COL_ITEM_PAYABLE_AMOUNT [base_imponible+IGV]'
76 76
     ];
77 77
 
78
-    public function populate($items,  $currencyCode) {
78
+    public function populate($items, $currencyCode) {
79 79
         foreach ($items as $idx => $item) {
80 80
             $allowances     = isset($item['allowances']) ? $item['allowances'] : [];
81 81
             $charges        = isset($item['charges']) ? $item['charges'] : [];
82 82
             $igvAffectCode  = $item['igvAffectationCode'];
83
-            $priceType      = $item['priceType'];   // Tipo de precio
83
+            $priceType      = $item['priceType']; // Tipo de precio
84 84
             $grossUnitValue = $item['unitValue'];
85 85
             $igvIncluded    = $item['igvIncluded'];
86 86
             
87
-            $unitValue         = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded);      // Valor unitario
87
+            $unitValue         = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario
88 88
             $unitTaxedValue    = $this->calcUnitTaxedValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario incluyendo impuestos si son aplicables
89
-            $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType);                     // Valor unitario facturable
90
-            $quantity          = $item['quantity'];  // Cantidad
89
+            $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType); // Valor unitario facturable
90
+            $quantity          = $item['quantity']; // Cantidad
91 91
 
92
-            $itemValue            = $unitValue * $quantity;         // Valor de item
92
+            $itemValue            = $unitValue * $quantity; // Valor de item
93 93
             $itemBillableValue    = $unitBillableValue * $quantity; // Valor de item
94 94
             $itemAllowancesAmount = Operations::getTotalAllowanceCharge($itemBillableValue, $allowances); // Descuentos de item
95
-            $itemChargesAmount    = Operations::getTotalAllowanceCharge($itemValue, $charges);            // Cargos de item
96
-            $itemTaxableAmount    = $this->calcItemTaxableAmount($itemValue, $priceType, $allowances, $charges);         // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial!
95
+            $itemChargesAmount    = Operations::getTotalAllowanceCharge($itemValue, $charges); // Cargos de item
96
+            $itemTaxableAmount    = $this->calcItemTaxableAmount($itemValue, $priceType, $allowances, $charges); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial!
97 97
             $igvAmount            = $this->calcIgvAmount($igvAffectCode, $itemTaxableAmount); // Afectación al IGV por item
98 98
             
99 99
             $itemIgvTaxed         = $itemBillableValue + $igvAmount;
100 100
             
101
-            $this->set(self::COL_PRODUCT_CODE,        $idx, $item['productCode']);
102
-            $this->set(self::COL_UNPSC,               $idx, $item['sunatProductCode']);
103
-            $this->set(self::COL_UNIT_CODE,           $idx, $item['unitCode']);
104
-            $this->set(self::COL_QUANTITY,            $idx, $quantity);
105
-            $this->set(self::COL_DESCRIPTION,         $idx, $item['description']);
106
-            $this->set(self::COL_CURRENCY_CODE,       $idx, $currencyCode);
101
+            $this->set(self::COL_PRODUCT_CODE, $idx, $item['productCode']);
102
+            $this->set(self::COL_UNPSC, $idx, $item['sunatProductCode']);
103
+            $this->set(self::COL_UNIT_CODE, $idx, $item['unitCode']);
104
+            $this->set(self::COL_QUANTITY, $idx, $quantity);
105
+            $this->set(self::COL_DESCRIPTION, $idx, $item['description']);
106
+            $this->set(self::COL_CURRENCY_CODE, $idx, $currencyCode);
107 107
             // Códigos de catálogos predefinidos
108
-            $this->set(self::COL_PRICE_TYPE,          $idx, $priceType);
109
-            $this->set(self::COL_TAX_TYPE,            $idx, $item['taxType']);
110
-            $this->set(self::COL_IGV_AFFECTATION,     $idx, $item['igvAffectationCode']);
108
+            $this->set(self::COL_PRICE_TYPE, $idx, $priceType);
109
+            $this->set(self::COL_TAX_TYPE, $idx, $item['taxType']);
110
+            $this->set(self::COL_IGV_AFFECTATION, $idx, $item['igvAffectationCode']);
111 111
 
112
-            $this->set(self::COL_UNIT_VALUE,          $idx, $unitValue);
112
+            $this->set(self::COL_UNIT_VALUE, $idx, $unitValue);
113 113
             $this->set(self::COL_UNIT_BILLABLE_VALUE, $idx, $unitBillableValue);
114
-            $this->set(self::COL_UNIT_TAXED_VALUE,    $idx, $unitTaxedValue);
115
-            $this->set(self::COL_ITEM_VALUE,          $idx, $itemValue);
114
+            $this->set(self::COL_UNIT_TAXED_VALUE, $idx, $unitTaxedValue);
115
+            $this->set(self::COL_ITEM_VALUE, $idx, $itemValue);
116 116
             $this->set(self::COL_ITEM_BILLABLE_VALUE, $idx, $itemBillableValue);
117
-            $this->set(self::COL_ALLOWANCES,          $idx, $allowances);
118
-            $this->set(self::COL_ALLOWANCES_AMOUNT,   $idx, $itemAllowancesAmount);
119
-            $this->set(self::COL_CHARGES,             $idx, $charges);
120
-            $this->set(self::COL_CHARGES_AMOUNT,      $idx, $itemChargesAmount);
117
+            $this->set(self::COL_ALLOWANCES, $idx, $allowances);
118
+            $this->set(self::COL_ALLOWANCES_AMOUNT, $idx, $itemAllowancesAmount);
119
+            $this->set(self::COL_CHARGES, $idx, $charges);
120
+            $this->set(self::COL_CHARGES_AMOUNT, $idx, $itemChargesAmount);
121 121
             $this->set(self::COL_ITEM_TAXABLE_AMOUNT, $idx, $itemTaxableAmount);
122
-            $this->set(self::COL_IGV,                 $idx, $igvAmount);
122
+            $this->set(self::COL_IGV, $idx, $igvAmount);
123 123
             $this->set(self::COL_ITEM_PAYABLE_AMOUNT, $idx, $itemIgvTaxed);
124 124
         }
125 125
     }
Please login to merge, or discard this patch.
src/Sunat/SunatVars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     const SUNAT_SERVICE_URL_BETA = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService';
16 16
     const SUNAT_SOL_USER_BETA    = 'MODDATOS';
17 17
     const SUNAT_SOL_KEY_BETA     = 'moddatos';
18
-    const DIR_CATS               = __DIR__.'/catalogo';
18
+    const DIR_CATS               = __DIR__ . '/catalogo';
19 19
     const IGV         = 0.18;
20 20
     const IGV_PERCENT = 18.00;
21 21
 
Please login to merge, or discard this patch.
src/Tools/FSInputGenerator.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
         for ($rowIndex = 0; $rowIndex < $ln; $rowIndex++) {
62 62
             $cat5Item = Catalogo::getCatItem(5, $Items->getTaxTypeCode($rowIndex));
63 63
             // IGV percent
64
-            if($cat5Item['id'] === Catalogo::CAT5_IGV){
64
+            if ($cat5Item['id'] === Catalogo::CAT5_IGV) {
65 65
                 $porIgvItem = Operations::formatAmount(SunatVars::IGV_PERCENT);
66
-            }else{
66
+            } else {
67 67
                 $porIgvItem = '0.00';
68 68
             }
69 69
             if ($Items->getPriceTypeCode($rowIndex) === Catalogo::CAT16_REF_VALUE) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         self::writeFSFile("$companyRUC-$invoiceType-$voucherId.CAB", $cabContent);
121 121
         self::writeFSFile("$companyRUC-$invoiceType-$voucherId.DET", $detContent);
122 122
         //CABECERA VARIABLE
123
-        if(!empty($json['variablesGlobales'])){
123
+        if (!empty($json['variablesGlobales'])) {
124 124
             $glovalVars = $json['variablesGlobales'];
125 125
             $varGlobalContent = '';
126 126
             foreach ($glovalVars as $row) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 
139 139
     private static function getVariablesGlobales(InvoiceDocument $Invoice) {
140
-        $data=[];
140
+        $data = [];
141 141
         $currencyType = $Invoice->getCurrencyType();
142 142
         $allowances = $Invoice->getAllowances();
143 143
         $charges = $Invoice->getCharges();
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
             // IGV percent
64 64
             if($cat5Item['id'] === Catalogo::CAT5_IGV){
65 65
                 $porIgvItem = Operations::formatAmount(SunatVars::IGV_PERCENT);
66
-            }else{
66
+            } else{
67 67
                 $porIgvItem = '0.00';
68 68
             }
69 69
             if ($Items->getPriceTypeCode($rowIndex) === Catalogo::CAT16_REF_VALUE) {
Please login to merge, or discard this patch.