@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $this->documentNumber = str_pad($rawData['documentNumber'], 5, '0', STR_PAD_LEFT); |
| 38 | 38 | $this->issueDate = new DateTime($parsedData['issueDate']); |
| 39 | 39 | $this->referenceDate = new DateTime($parsedData['referenceDate']); |
| 40 | - $this->documentId = $this->documentType.'-' . $this->issueDate->format('Ymd') . '-' . $this->documentNumber; |
|
| 40 | + $this->documentId = $this->documentType . '-' . $this->issueDate->format('Ymd') . '-' . $this->documentNumber; |
|
| 41 | 41 | $this->documentFileName = Company::getRUC() . '-' . $this->documentId; |
| 42 | 42 | $this->rawData = $rawData; |
| 43 | 43 | $this->parsedData = $parsedData; |
@@ -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)), |