@@ -111,21 +111,21 @@ discard block |
||
| 111 | 111 | $name = str_replace('\\', '/', $name);
|
| 112 | 112 | $hexdtime = pack('V', $this->unix2DosTime($time));
|
| 113 | 113 | $fr = "\x50\x4b\x03\x04"; |
| 114 | - $fr .= "\x14\x00"; // ver needed to extract |
|
| 115 | - $fr .= "\x00\x00"; // gen purpose bit flag |
|
| 116 | - $fr .= "\x08\x00"; // compression method |
|
| 117 | - $fr .= $hexdtime; // last mod time and date |
|
| 114 | + $fr .= "\x14\x00"; // ver needed to extract |
|
| 115 | + $fr .= "\x00\x00"; // gen purpose bit flag |
|
| 116 | + $fr .= "\x08\x00"; // compression method |
|
| 117 | + $fr .= $hexdtime; // last mod time and date |
|
| 118 | 118 | // "local file header" segment |
| 119 | 119 | $unc_len = strlen($data); |
| 120 | 120 | $crc = crc32($data); |
| 121 | 121 | $zdata = gzcompress($data); |
| 122 | 122 | $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug |
| 123 | 123 | $c_len = strlen($zdata); |
| 124 | - $fr .= pack('V', $crc); // crc32
|
|
| 125 | - $fr .= pack('V', $c_len); // compressed filesize
|
|
| 126 | - $fr .= pack('V', $unc_len); // uncompressed filesize
|
|
| 127 | - $fr .= pack('v', strlen($name)); // length of filename
|
|
| 128 | - $fr .= pack('v', 0); // extra field length
|
|
| 124 | + $fr .= pack('V', $crc); // crc32
|
|
| 125 | + $fr .= pack('V', $c_len); // compressed filesize
|
|
| 126 | + $fr .= pack('V', $unc_len); // uncompressed filesize
|
|
| 127 | + $fr .= pack('v', strlen($name)); // length of filename
|
|
| 128 | + $fr .= pack('v', 0); // extra field length
|
|
| 129 | 129 | $fr .= $name; |
| 130 | 130 | // "file data" segment |
| 131 | 131 | $fr .= $zdata; |
@@ -137,20 +137,20 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | // now add to central directory record |
| 139 | 139 | $cdrec = "\x50\x4b\x01\x02"; |
| 140 | - $cdrec .= "\x00\x00"; // version made by |
|
| 141 | - $cdrec .= "\x14\x00"; // version needed to extract |
|
| 142 | - $cdrec .= "\x00\x00"; // gen purpose bit flag |
|
| 143 | - $cdrec .= "\x08\x00"; // compression method |
|
| 144 | - $cdrec .= $hexdtime; // last mod time & date |
|
| 145 | - $cdrec .= pack('V', $crc); // crc32
|
|
| 146 | - $cdrec .= pack('V', $c_len); // compressed filesize
|
|
| 147 | - $cdrec .= pack('V', $unc_len); // uncompressed filesize
|
|
| 140 | + $cdrec .= "\x00\x00"; // version made by |
|
| 141 | + $cdrec .= "\x14\x00"; // version needed to extract |
|
| 142 | + $cdrec .= "\x00\x00"; // gen purpose bit flag |
|
| 143 | + $cdrec .= "\x08\x00"; // compression method |
|
| 144 | + $cdrec .= $hexdtime; // last mod time & date |
|
| 145 | + $cdrec .= pack('V', $crc); // crc32
|
|
| 146 | + $cdrec .= pack('V', $c_len); // compressed filesize
|
|
| 147 | + $cdrec .= pack('V', $unc_len); // uncompressed filesize
|
|
| 148 | 148 | $cdrec .= pack('v', strlen($name)); // length of filename
|
| 149 | - $cdrec .= pack('v', 0); // extra field length
|
|
| 150 | - $cdrec .= pack('v', 0); // file comment length
|
|
| 151 | - $cdrec .= pack('v', 0); // disk number start
|
|
| 152 | - $cdrec .= pack('v', 0); // internal file attributes
|
|
| 153 | - $cdrec .= pack('V', 32); // external file attributes
|
|
| 149 | + $cdrec .= pack('v', 0); // extra field length
|
|
| 150 | + $cdrec .= pack('v', 0); // file comment length
|
|
| 151 | + $cdrec .= pack('v', 0); // disk number start
|
|
| 152 | + $cdrec .= pack('v', 0); // internal file attributes
|
|
| 153 | + $cdrec .= pack('V', 32); // external file attributes
|
|
| 154 | 154 | // - 'archive' bit set |
| 155 | 155 | $cdrec .= pack('V', $this->old_offset); // relative offset of local header
|
| 156 | 156 | $this->old_offset += strlen($fr); |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | pack('v', sizeof($this->ctrl_dir)) . //total #of entries overall
|
| 177 | 177 | pack('V', strlen($ctrldir)) . //size of central dir
|
| 178 | 178 | pack('V', $this->old_offset) . //offset to start of central dir
|
| 179 | - "\x00\x00"; //.zip file comment length |
|
| 179 | + "\x00\x00"; //.zip file comment length |
|
| 180 | 180 | if ($this->doWrite) { // Send central directory & end ctrl dir to STDOUT
|
| 181 | 181 | echo $header; |
| 182 | - return ""; // Return empty string |
|
| 182 | + return ""; // Return empty string |
|
| 183 | 183 | } else { // Return entire ZIP archive as string
|
| 184 | 184 | $data = implode('', $this->datasec);
|
| 185 | 185 | return $data . $header; |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | 'igvPercent' => SunatVars::IGV_PERCENT, |
| 105 | 105 | 'logo' => LogoMgr::getLogoString(), |
| 106 | 106 | 'qr' => QrGenerator::getQrString($inv), // QR Code |
| 107 | - 'taxableOperations' => $inv->getTotalTaxableOperations(), // Total operaciones gravadas |
|
| 108 | - 'freeOperations' => $inv->getTotalFreeOperations(), // Total operaciones gratuitas |
|
| 107 | + 'taxableOperations' => $inv->getTotalTaxableOperations(), // Total operaciones gravadas |
|
| 108 | + 'freeOperations' => $inv->getTotalFreeOperations(), // Total operaciones gratuitas |
|
| 109 | 109 | 'unaffectedOperations' => $inv->getTotalUnaffectedOperations(), // Total operaciones inafectas |
| 110 | - 'exemptedOperations' => $inv->getTotalExemptedOperations(), // Total operaciones exoneradas |
|
| 111 | - 'totalAllowances' => $inv->getTotalAllowances(), // Total operaciones exoneradas |
|
| 112 | - 'igvAmount' => $inv->getIGV(), // Total a pagar |
|
| 113 | - 'payableAmount' => $payableAmount, // Total a pagar |
|
| 114 | - 'payableInWords' => $payableInWords, // Monto en palabras |
|
| 110 | + 'exemptedOperations' => $inv->getTotalExemptedOperations(), // Total operaciones exoneradas |
|
| 111 | + 'totalAllowances' => $inv->getTotalAllowances(), // Total operaciones exoneradas |
|
| 112 | + 'igvAmount' => $inv->getIGV(), // Total a pagar |
|
| 113 | + 'payableAmount' => $payableAmount, // Total a pagar |
|
| 114 | + 'payableInWords' => $payableInWords, // Monto en palabras |
|
| 115 | 115 | 'items' => self::getDocumentDataItems($inv) // Items |
| 116 | 116 | ]; |
| 117 | 117 | // For credit and debit notes |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $ln = $Items->getCount(); |
| 135 | 135 | $items2 = []; |
| 136 | 136 | for ($i = 0; $i < $ln; $i++) { |
| 137 | - $items2[]= [ |
|
| 137 | + $items2[] = [ |
|
| 138 | 138 | 'productCode' => $Items->getProductCode($i), |
| 139 | 139 | 'quantity' => $Items->getQunatity($i), |
| 140 | 140 | 'unitName' => Catalogo::getUnitName($Items->getUnitCode($i)), |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | 'igvPercent' => SunatVars::IGV_PERCENT, |
| 84 | 84 | 'logo' => LogoMgr::getLogoString(), |
| 85 | 85 | 'qr' => QrGenerator::getQrString($dataMap), // QR Code |
| 86 | - 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
| 87 | - 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
| 86 | + 'taxableOperations' => Operations::formatAmount($dataMap->getTotalTaxableOperations()), // Total operaciones gravadas |
|
| 87 | + 'freeOperations' => Operations::formatAmount($dataMap->getTotalFreeOperations()), // Total operaciones gratuitas |
|
| 88 | 88 | 'unaffectedOperations' => Operations::formatAmount($dataMap->getTotalUnaffectedOperations()), // Total operaciones inafectas |
| 89 | - 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
| 90 | - 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
| 91 | - 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
| 92 | - 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
| 93 | - 'payableInWords' => $payableInWords, // Monto en palabras |
|
| 89 | + 'exemptedOperations' => Operations::formatAmount($dataMap->getTotalExemptedOperations()), // Total operaciones exoneradas |
|
| 90 | + 'totalAllowances' => Operations::formatAmount($dataMap->getTotalAllowances()), // Total operaciones exoneradas |
|
| 91 | + 'igvAmount' => Operations::formatAmount($dataMap->getIGV()), // Total a pagar |
|
| 92 | + 'payableAmount' => Operations::formatAmount($payableAmount), // Total a pagar |
|
| 93 | + 'payableInWords' => $payableInWords, // Monto en palabras |
|
| 94 | 94 | 'items' => self::getReadyToPrintDataItems($dataMap) // Items |
| 95 | 95 | ]; |
| 96 | 96 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $ln = $Items->getCount(); |
| 101 | 101 | $items2 = []; |
| 102 | 102 | for ($i = 0; $i < $ln; $i++) { |
| 103 | - $items2[]= [ |
|
| 103 | + $items2[] = [ |
|
| 104 | 104 | 'productCode' => $Items->getProductCode($i), |
| 105 | 105 | 'quantity' => $Items->getQunatity($i), |
| 106 | 106 | 'unitName' => Catalogo::getUnitName($Items->getUnitCode($i)), |
@@ -58,8 +58,8 @@ |
||
| 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(); |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | private function addDocumentTaxes() |
| 117 | 117 | { |
| 118 | 118 | $Invoice = $this->dataMap; |
| 119 | - $currencyID = $Invoice->getCurrencyCode(); // Tipo de moneda |
|
| 120 | - $totalTaxableOperations = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas |
|
| 121 | - $totalTaxes = $Invoice->getTotalTaxes(); // Total operaciones gravadas |
|
| 122 | - $Igv = $Invoice->getIGV(); // Total IGV |
|
| 123 | - $totalExemptedOperations = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas |
|
| 119 | + $currencyID = $Invoice->getCurrencyCode(); // Tipo de moneda |
|
| 120 | + $totalTaxableOperations = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas |
|
| 121 | + $totalTaxes = $Invoice->getTotalTaxes(); // Total operaciones gravadas |
|
| 122 | + $Igv = $Invoice->getIGV(); // Total IGV |
|
| 123 | + $totalExemptedOperations = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas |
|
| 124 | 124 | $totalUnaffectedOperations = $Invoice->getTotalUnaffectedOperations(); // Total operaciones inafectas |
| 125 | - $totalFreeOpertions = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas |
|
| 125 | + $totalFreeOpertions = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas |
|
| 126 | 126 | |
| 127 | 127 | // XML nodes |
| 128 | 128 | $TaxTotal = new TaxTotal(); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | // Total operaciones exoneradas |
| 135 | 135 | if ($totalExemptedOperations) { |
| 136 | - UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO); |
|
| 136 | + UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO); |
|
| 137 | 137 | } |
| 138 | 138 | // Total operaciones inafectas |
| 139 | 139 | if ($totalUnaffectedOperations) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | // Total operaciones gratuitas |
| 143 | 143 | if ($totalFreeOpertions) { |
| 144 | - UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA); |
|
| 144 | + UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Total impuestos |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | { |
| 312 | 312 | $Invoice = $this->dataMap; |
| 313 | 313 | $currencyID = $this->getDocumentCurrencyCode(); // Tipo de moneda |
| 314 | - $totalAllowances = $Invoice->getTotalAllowances(); // Total descuentos |
|
| 315 | - $payableAmount = $Invoice->getPayableAmount(); // Total a pagar |
|
| 314 | + $totalAllowances = $Invoice->getTotalAllowances(); // Total descuentos |
|
| 315 | + $payableAmount = $Invoice->getPayableAmount(); // Total a pagar |
|
| 316 | 316 | $billableAmount = $Invoice->getBillableValue(); |
| 317 | 317 | // LegalMonetaryTotal |
| 318 | 318 | $LegalMonetaryTotal = new LegalMonetaryTotal(); |
@@ -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)), |
@@ -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; |
@@ -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)), |
@@ -76,43 +76,43 @@ |
||
| 76 | 76 | $grossUnitValue = $item['unitPrice']; |
| 77 | 77 | $igvIncluded = $item['igvIncluded']; |
| 78 | 78 | |
| 79 | - $unitValue = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario |
|
| 79 | + $unitValue = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario |
|
| 80 | 80 | $unitTaxedValue = $this->calcUnitTaxedValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario incluyendo impuestos si son aplicables |
| 81 | - $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType); // Valor unitario facturable |
|
| 81 | + $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType); // Valor unitario facturable |
|
| 82 | 82 | $quantity = $item['quantity']; // Cantidad |
| 83 | 83 | |
| 84 | - $itemValue = $unitValue * $quantity; // Valor de item |
|
| 84 | + $itemValue = $unitValue * $quantity; // Valor de item |
|
| 85 | 85 | $itemBillableValue = $unitBillableValue * $quantity; // Valor de item |
| 86 | 86 | $itemAllowancesAmount = Operations::getTotalAllowances($itemBillableValue, $ac); // Descuentos de item |
| 87 | - $itemChargesAmount = Operations::getTotalCharges($itemValue, $ac); // Cargos de item |
|
| 88 | - $itemBillableAmount = $this->calcItemBillableAmount($itemValue, $priceType, $ac); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial! |
|
| 89 | - $itemTaxableAmount = $this->calcItemTaxableAmount($itemValue, $priceType, $ac); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial! |
|
| 87 | + $itemChargesAmount = Operations::getTotalCharges($itemValue, $ac); // Cargos de item |
|
| 88 | + $itemBillableAmount = $this->calcItemBillableAmount($itemValue, $priceType, $ac); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial! |
|
| 89 | + $itemTaxableAmount = $this->calcItemTaxableAmount($itemValue, $priceType, $ac); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial! |
|
| 90 | 90 | $igvAmount = $this->calcIgvAmount($igvAffectCode, $itemTaxableAmount); // Afectación al IGV por item |
| 91 | 91 | |
| 92 | 92 | $itemPayableAmount = $itemBillableValue + $igvAmount; |
| 93 | 93 | |
| 94 | - $this->set(self::COL_PRODUCT_CODE, $idx, $item['productCode']); |
|
| 95 | - $this->set(self::COL_UNPSC, $idx, $item['unspsc']); |
|
| 96 | - $this->set(self::COL_UNIT_CODE, $idx, $item['unitCode']); |
|
| 97 | - $this->set(self::COL_QUANTITY, $idx, $quantity); |
|
| 98 | - $this->set(self::COL_DESCRIPTION, $idx, trim($item['description'])); |
|
| 99 | - $this->set(self::COL_CURRENCY_CODE, $idx, $currencyCode); |
|
| 94 | + $this->set(self::COL_PRODUCT_CODE, $idx, $item['productCode']); |
|
| 95 | + $this->set(self::COL_UNPSC, $idx, $item['unspsc']); |
|
| 96 | + $this->set(self::COL_UNIT_CODE, $idx, $item['unitCode']); |
|
| 97 | + $this->set(self::COL_QUANTITY, $idx, $quantity); |
|
| 98 | + $this->set(self::COL_DESCRIPTION, $idx, trim($item['description'])); |
|
| 99 | + $this->set(self::COL_CURRENCY_CODE, $idx, $currencyCode); |
|
| 100 | 100 | // Códigos de catálogos predefinidos |
| 101 | - $this->set(self::COL_PRICE_TYPE, $idx, $priceType); |
|
| 102 | - $this->set(self::COL_TAX_TYPE, $idx, $item['taxType']); |
|
| 103 | - $this->set(self::COL_IGV_AFFECTATION, $idx, $item['igvAffectationType']); |
|
| 101 | + $this->set(self::COL_PRICE_TYPE, $idx, $priceType); |
|
| 102 | + $this->set(self::COL_TAX_TYPE, $idx, $item['taxType']); |
|
| 103 | + $this->set(self::COL_IGV_AFFECTATION, $idx, $item['igvAffectationType']); |
|
| 104 | 104 | |
| 105 | - $this->set(self::COL_UNIT_VALUE, $idx, $unitValue); |
|
| 105 | + $this->set(self::COL_UNIT_VALUE, $idx, $unitValue); |
|
| 106 | 106 | $this->set(self::COL_UNIT_BILLABLE_VALUE, $idx, $unitBillableValue); |
| 107 | - $this->set(self::COL_UNIT_TAXED_VALUE, $idx, $unitTaxedValue); |
|
| 108 | - $this->set(self::COL_ITEM_VALUE, $idx, $itemValue); |
|
| 107 | + $this->set(self::COL_UNIT_TAXED_VALUE, $idx, $unitTaxedValue); |
|
| 108 | + $this->set(self::COL_ITEM_VALUE, $idx, $itemValue); |
|
| 109 | 109 | $this->set(self::COL_ITEM_BILLABLE_VALUE, $idx, $itemBillableValue); |
| 110 | - $this->set(self::COL_ALLOWANCES_CHARGES, $idx, $ac); |
|
| 111 | - $this->set(self::COL_ALLOWANCES_AMOUNT, $idx, $itemAllowancesAmount); |
|
| 112 | - $this->set(self::COL_CHARGES_AMOUNT, $idx, $itemChargesAmount); |
|
| 113 | - $this->set(self::COL_ITEM_BILLABLE_AMOUNT,$idx, $itemBillableAmount); |
|
| 110 | + $this->set(self::COL_ALLOWANCES_CHARGES, $idx, $ac); |
|
| 111 | + $this->set(self::COL_ALLOWANCES_AMOUNT, $idx, $itemAllowancesAmount); |
|
| 112 | + $this->set(self::COL_CHARGES_AMOUNT, $idx, $itemChargesAmount); |
|
| 113 | + $this->set(self::COL_ITEM_BILLABLE_AMOUNT, $idx, $itemBillableAmount); |
|
| 114 | 114 | $this->set(self::COL_ITEM_TAXABLE_AMOUNT, $idx, $itemTaxableAmount); |
| 115 | - $this->set(self::COL_IGV, $idx, $igvAmount); |
|
| 115 | + $this->set(self::COL_IGV, $idx, $igvAmount); |
|
| 116 | 116 | $this->set(self::COL_ITEM_PAYABLE_AMOUNT, $idx, $itemPayableAmount); |
| 117 | 117 | } |
| 118 | 118 | } |