Passed
Push — master ( b072a0...cacac0 )
by JAIME ELMER
02:20
created
src/Sunat/Document/BillMixin.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 
83 83
     private function addDocumentTaxes() {
84 84
         $Invoice                   = $this->dataMap;
85
-        $currencyID                = $Invoice->getCurrencyCode();              // Tipo de moneda
86
-        $totalTaxableOperations    = $Invoice->getTotalTaxableOperations();    // Total operaciones gravadas
87
-        $totalTaxes                = $Invoice->getTotalTaxes();                // Total operaciones gravadas
88
-        $Igv                       = $Invoice->getIGV();                       // Total IGV
89
-        $totalExemptedOperations   = $Invoice->getTotalExemptedOperations();   // Total operaciones exoneradas
85
+        $currencyID                = $Invoice->getCurrencyCode(); // Tipo de moneda
86
+        $totalTaxableOperations    = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas
87
+        $totalTaxes                = $Invoice->getTotalTaxes(); // Total operaciones gravadas
88
+        $Igv                       = $Invoice->getIGV(); // Total IGV
89
+        $totalExemptedOperations   = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas
90 90
         $totalUnaffectedOperations = $Invoice->getTotalUnaffectedOperations(); // Total operaciones inafectas
91
-        $totalFreeOpertions        = $Invoice->getTotalFreeOperations();       // Total operaciones gratuitas
91
+        $totalFreeOpertions        = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas
92 92
 
93 93
         // XML nodes
94 94
         $TaxTotal = new TaxTotal();
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
         // Total operaciones exoneradas
101 101
         if ($totalExemptedOperations) {
102
-            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations,   Catalogo::CAT5_EXO);
102
+            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO);
103 103
         }
104 104
         // Total operaciones inafectas
105 105
         if ($totalUnaffectedOperations) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         }
108 108
         // Total operaciones gratuitas solo aplica a FACTURA
109 109
         if ($totalFreeOpertions && $Invoice->getDocumentType() === Catalogo::DOCTYPE_FACTURA) {
110
-            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions,        Catalogo::CAT5_GRA);
110
+            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA);
111 111
         }
112 112
 
113 113
         // Total impuestos
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
     private function addInvoiceLegalMonetaryTotal() {
269 269
         $Invoice            = $this->dataMap;
270 270
         $currencyID         = $this->getDocumentCurrencyCode(); // Tipo de moneda
271
-        $totalAllowances    = $Invoice->getTotalAllowances();   // Total descuentos
272
-        $payableAmount      = $Invoice->getPayableAmount();     // Total a pagar
271
+        $totalAllowances    = $Invoice->getTotalAllowances(); // Total descuentos
272
+        $payableAmount      = $Invoice->getPayableAmount(); // Total a pagar
273 273
         $billableAmount     = $Invoice->getBillableValue();
274 274
         // LegalMonetaryTotal
275 275
         $LegalMonetaryTotal = new LegalMonetaryTotal();
Please login to merge, or discard this patch.
src/Sunat/InvoiceItems.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -73,41 +73,41 @@
 block discarded – undo
73 73
             $grossUnitValue = $item['unitPrice'];
74 74
             $igvIncluded    = $item['igvIncluded'];
75 75
             
76
-            $unitValue         = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded);      // Valor unitario
76
+            $unitValue         = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario
77 77
             $unitTaxedValue    = $this->calcUnitTaxedValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario incluyendo impuestos si son aplicables
78
-            $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType);                     // Valor unitario facturable
78
+            $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType); // Valor unitario facturable
79 79
             $quantity          = $item['quantity']; // Cantidad
80 80
 
81
-            $itemValue            = $unitValue * $quantity;         // Valor de item
81
+            $itemValue            = $unitValue * $quantity; // Valor de item
82 82
             $itemBillableValue    = $unitBillableValue * $quantity; // Valor de item
83 83
             $itemAllowancesAmount = Operations::getTotalAllowances($itemBillableValue, $ac); // Descuentos de item
84
-            $itemChargesAmount    = Operations::getTotalCharges($itemValue, $ac);            // Cargos de item
85
-            $itemTaxableAmount    = $this->calcItemTaxableAmount($itemValue, $priceType, $ac);         // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial!
84
+            $itemChargesAmount    = Operations::getTotalCharges($itemValue, $ac); // Cargos de item
85
+            $itemTaxableAmount    = $this->calcItemTaxableAmount($itemValue, $priceType, $ac); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial!
86 86
             $igvAmount            = $this->calcIgvAmount($igvAffectCode, $itemTaxableAmount); // Afectación al IGV por item
87 87
             
88 88
             $itemPayableAmount    = $itemBillableValue + $igvAmount;
89 89
             
90
-            $this->set(self::COL_PRODUCT_CODE,        $idx, $item['productCode']);
91
-            $this->set(self::COL_UNPSC,               $idx, $item['unspsc']);
92
-            $this->set(self::COL_UNIT_CODE,           $idx, $item['unitCode']);
93
-            $this->set(self::COL_QUANTITY,            $idx, $quantity);
94
-            $this->set(self::COL_DESCRIPTION,         $idx, $item['description']);
95
-            $this->set(self::COL_CURRENCY_CODE,       $idx, $currencyCode);
90
+            $this->set(self::COL_PRODUCT_CODE, $idx, $item['productCode']);
91
+            $this->set(self::COL_UNPSC, $idx, $item['unspsc']);
92
+            $this->set(self::COL_UNIT_CODE, $idx, $item['unitCode']);
93
+            $this->set(self::COL_QUANTITY, $idx, $quantity);
94
+            $this->set(self::COL_DESCRIPTION, $idx, $item['description']);
95
+            $this->set(self::COL_CURRENCY_CODE, $idx, $currencyCode);
96 96
             // Códigos de catálogos predefinidos
97
-            $this->set(self::COL_PRICE_TYPE,          $idx, $priceType);
98
-            $this->set(self::COL_TAX_TYPE,            $idx, $item['taxType']);
99
-            $this->set(self::COL_IGV_AFFECTATION,     $idx, $item['igvAffectationType']);
97
+            $this->set(self::COL_PRICE_TYPE, $idx, $priceType);
98
+            $this->set(self::COL_TAX_TYPE, $idx, $item['taxType']);
99
+            $this->set(self::COL_IGV_AFFECTATION, $idx, $item['igvAffectationType']);
100 100
 
101
-            $this->set(self::COL_UNIT_VALUE,          $idx, $unitValue);
101
+            $this->set(self::COL_UNIT_VALUE, $idx, $unitValue);
102 102
             $this->set(self::COL_UNIT_BILLABLE_VALUE, $idx, $unitBillableValue);
103
-            $this->set(self::COL_UNIT_TAXED_VALUE,    $idx, $unitTaxedValue);
104
-            $this->set(self::COL_ITEM_VALUE,          $idx, $itemValue);
103
+            $this->set(self::COL_UNIT_TAXED_VALUE, $idx, $unitTaxedValue);
104
+            $this->set(self::COL_ITEM_VALUE, $idx, $itemValue);
105 105
             $this->set(self::COL_ITEM_BILLABLE_VALUE, $idx, $itemBillableValue);
106
-            $this->set(self::COL_ALLOWANCES_CHARGES,  $idx, $ac);
107
-            $this->set(self::COL_ALLOWANCES_AMOUNT,   $idx, $itemAllowancesAmount);
108
-            $this->set(self::COL_CHARGES_AMOUNT,      $idx, $itemChargesAmount);
106
+            $this->set(self::COL_ALLOWANCES_CHARGES, $idx, $ac);
107
+            $this->set(self::COL_ALLOWANCES_AMOUNT, $idx, $itemAllowancesAmount);
108
+            $this->set(self::COL_CHARGES_AMOUNT, $idx, $itemChargesAmount);
109 109
             $this->set(self::COL_ITEM_TAXABLE_AMOUNT, $idx, $itemTaxableAmount);
110
-            $this->set(self::COL_IGV,                 $idx, $igvAmount);
110
+            $this->set(self::COL_IGV, $idx, $igvAmount);
111 111
             $this->set(self::COL_ITEM_PAYABLE_AMOUNT, $idx, $itemPayableAmount);
112 112
         }
113 113
     }
Please login to merge, or discard this patch.
src/Sunat/Operations.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         $formatedNumber = self::formatAmount($amount);
23 23
 
24 24
         $parts = explode('.', $formatedNumber);
25
-        $intPart = (int)$parts[0];
25
+        $intPart = (int) $parts[0];
26 26
         $decimalPart = $parts[1];
27 27
         $numberTransformer = (new NumberToWords())->getNumberTransformer('es');
28 28
         $t1 = mb_strtoupper($numberTransformer->toWords($intPart));
Please login to merge, or discard this patch.
src/Sunat/Document/NoteMixin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@
 block discarded – undo
58 58
     private function addRequestedMonetaryTotal() {
59 59
         $dataMap         = $this->dataMap;
60 60
         $currencyID      = $this->getDocumentCurrencyCode(); // Tipo de moneda
61
-        $totalAllowances = $dataMap->getTotalAllowances();   // Total descuentos
62
-        $payableAmount   = $dataMap->getPayableAmount();     // Total a pagar
61
+        $totalAllowances = $dataMap->getTotalAllowances(); // Total descuentos
62
+        $payableAmount   = $dataMap->getPayableAmount(); // Total a pagar
63 63
         $billableAmount  = $dataMap->getBillableValue();
64 64
         // RequestedMonetaryTotal
65 65
         $RequestedMonetaryTotal = new RequestedMonetaryTotal();
Please login to merge, or discard this patch.
src/Sunat/Catalogo.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public static function getDocumentType($shortCode) {
112 112
         switch ($shortCode) {
113
-            case self::DOCTYPE_SC_FACTURA:      return self::DOCTYPE_FACTURA ;
113
+            case self::DOCTYPE_SC_FACTURA:      return self::DOCTYPE_FACTURA;
114 114
             case self::DOCTYPE_SC_BOLETA:       return self::DOCTYPE_BOLETA;
115 115
             case self::DOCTYPE_SC_NOTA_CREDITO: return self::DOCTYPE_NOTA_CREDITO;
116 116
             case self::DOCTYPE_SC_NOTA_DEBITO:  return self::DOCTYPE_NOTA_DEBITO;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
     public static function getCustomListItem($listName, $itemId) {
193 193
         $customList = self::getCustomList($listName);
194
-        if(isset($customList[$itemId])){
194
+        if (isset($customList[$itemId])) {
195 195
             return $customList[$itemId];
196 196
         }
197 197
         throw new ConfigException("El codigó de item $itemId no existe en la lista $listName");
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         // Company customization
205 205
         $customListsPath = Company::getListsPath();
206 206
         $fileName = "$customListsPath/$listName.php";
207
-        if(file_exists($fileName)){
207
+        if (file_exists($fileName)) {
208 208
             $customListsPath = Company::getListsPath();
209 209
             $list = require $fileName;
210 210
             // Cache
Please login to merge, or discard this patch.
src/Tools/PdfGenerator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public static function generatePdf(DataMap $Invoice, $billName) {
30 30
         $dompdf = new Dompdf();
31 31
         $docType = self::getTplFor($Invoice->getDocumentType());
32
-        $html = self::getRenderedHtml($Invoice,$docType);
32
+        $html = self::getRenderedHtml($Invoice, $docType);
33 33
         // Render the HTML as PDF
34 34
         $dompdf->loadHtml($html);
35 35
         $dompdf->render();
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
             'igvPercent'           => SunatVars::IGV_PERCENT,
77 77
             'logo'                 => self::getLogoString(),
78 78
             'qr'                   => self::getQrString($inv), // QR Code
79
-            'taxableOperations'    => $inv->getTotalTaxableOperations(),    // Total operaciones gravadas
80
-            'freeOperations'       => $inv->getTotalFreeOperations(),       // Total operaciones gratuitas
79
+            'taxableOperations'    => $inv->getTotalTaxableOperations(), // Total operaciones gravadas
80
+            'freeOperations'       => $inv->getTotalFreeOperations(), // Total operaciones gratuitas
81 81
             'unaffectedOperations' => $inv->getTotalUnaffectedOperations(), // Total operaciones inafectas
82
-            'exemptedOperations'   => $inv->getTotalExemptedOperations(),   // Total operaciones exoneradas
83
-            'totalAllowances'      => $inv->getTotalAllowances(),           // Total operaciones exoneradas
84
-            'igvAmount'            => $inv->getIGV(),                       // Total a pagar
85
-            'payableAmount'        => $payableAmount,                       // Total a pagar
86
-            'payableInWords'       => $payableInWords,                      // Monto en palabras
82
+            'exemptedOperations'   => $inv->getTotalExemptedOperations(), // Total operaciones exoneradas
83
+            'totalAllowances'      => $inv->getTotalAllowances(), // Total operaciones exoneradas
84
+            'igvAmount'            => $inv->getIGV(), // Total a pagar
85
+            'payableAmount'        => $payableAmount, // Total a pagar
86
+            'payableInWords'       => $payableInWords, // Monto en palabras
87 87
             'items'                => self::getDocumentDataItems($inv)       // Items
88 88
                 
89 89
         ];
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $ln = $Items->getCount();
95 95
         $items2 = [];
96 96
         for ($i = 0; $i < $ln; $i++) {
97
-            $items2[]= [
97
+            $items2[] = [
98 98
                 'productCode'       => $Items->getProductCode($i),
99 99
                 'quantity'          => $Items->getQunatity($i),
100 100
                 'unitName'          => Catalogo::getUnitName($Items->getUnitCode($i)),
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     private static function getQrContent(DataMap $inv) {
130 130
         $ruc               = Company::getRUC();
131 131
         $invoiveType       = $inv->getDocumentType();
132
-        $documentSeries     = $inv->getDocumentSeries();
132
+        $documentSeries = $inv->getDocumentSeries();
133 133
         $seriesNumber      = $inv->getDocumentNumber();
134 134
         $igv               = Operations::formatAmount($inv->getIGV());
135 135
         $payableAmount     = Operations::formatAmount($inv->getPayableAmount());
Please login to merge, or discard this patch.
src/Tools/FSInputGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
         for ($rowIndex = 0; $rowIndex < $ln; $rowIndex++) {
116 116
             $detContent .= implode('|', $json['detalle'][$rowIndex]) . $ENTER;
117 117
         }
118
-        $invoiceId   = $Invoice->getDocumentId();
118
+        $invoiceId = $Invoice->getDocumentId();
119 119
         $documentType = $Invoice->getDocumentType();
120 120
         self::writeFSFile("$companyRUC-$documentType-$invoiceId.CAB", $cabContent);
121 121
         self::writeFSFile("$companyRUC-$documentType-$invoiceId.DET", $detContent);
Please login to merge, or discard this patch.