| @@ 2110-2144 (lines=35) @@ | ||
| 2107 | * |
|
| 2108 | * @return string chave |
|
| 2109 | */ |
|
| 2110 | protected function zGeraChaveAdicCont() |
|
| 2111 | { |
|
| 2112 | //cUF tpEmis CNPJ vNF ICMSp ICMSs DD DV |
|
| 2113 | // Quantidade de caracteres 02 01 14 14 01 01 02 01 |
|
| 2114 | $forma = "%02d%d%s%014d%01d%01d%02d"; |
|
| 2115 | $cUF = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue; |
|
| 2116 | $CNPJ = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue; |
|
| 2117 | $CNPJ = substr($CNPJ, -14); |
|
| 2118 | $vCT = number_format($this->pSimpleGetValue($this->vPrest, "vRec"), 2, "", "") * 100; |
|
| 2119 | $ICMS_CST = $this->pSimpleGetValue($this->ICMS, "CST"); |
|
| 2120 | switch ($ICMS_CST) { |
|
| 2121 | case '00': |
|
| 2122 | case '20': |
|
| 2123 | $ICMSp = '1'; |
|
| 2124 | $ICMSs = '2'; |
|
| 2125 | break; |
|
| 2126 | case '40': |
|
| 2127 | case '41': |
|
| 2128 | case '51': |
|
| 2129 | case '90': |
|
| 2130 | $ICMSp = '2'; |
|
| 2131 | $ICMSs = '2'; |
|
| 2132 | break; |
|
| 2133 | case '60': |
|
| 2134 | $ICMSp = '2'; |
|
| 2135 | $ICMSs = '1'; |
|
| 2136 | break; |
|
| 2137 | } |
|
| 2138 | $dd = $this->ide->getElementsByTagName('dEmi')->item(0)->nodeValue; |
|
| 2139 | $rpos = strrpos($dd, '-'); |
|
| 2140 | $dd = substr($dd, $rpos + 1); |
|
| 2141 | $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vCT, $ICMSp, $ICMSs, $dd); |
|
| 2142 | $chave = $chave . $this->pModulo11($chave); |
|
| 2143 | return $chave; |
|
| 2144 | } //fim zGeraChaveAdicCont |
|
| 2145 | ||
| 2146 | /** |
|
| 2147 | * zDocOrig |
|
| @@ 2084-2118 (lines=35) @@ | ||
| 2081 | * |
|
| 2082 | * @return string chave |
|
| 2083 | */ |
|
| 2084 | protected function zGeraChaveAdicCont() |
|
| 2085 | { |
|
| 2086 | //cUF tpEmis CNPJ vNF ICMSp ICMSs DD DV |
|
| 2087 | // Quantidade de caracteres 02 01 14 14 01 01 02 01 |
|
| 2088 | $forma = "%02d%d%s%014d%01d%01d%02d"; |
|
| 2089 | $cUF = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue; |
|
| 2090 | $CNPJ = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue; |
|
| 2091 | $CNPJ = substr($CNPJ, -14); |
|
| 2092 | $vCT = number_format($this->pSimpleGetValue($this->vPrest, "vRec"), 2, "", "") * 100; |
|
| 2093 | $ICMS_CST = $this->pSimpleGetValue($this->ICMS, "CST"); |
|
| 2094 | switch ($ICMS_CST) { |
|
| 2095 | case '00': |
|
| 2096 | case '20': |
|
| 2097 | $ICMSp = '1'; |
|
| 2098 | $ICMSs = '2'; |
|
| 2099 | break; |
|
| 2100 | case '40': |
|
| 2101 | case '41': |
|
| 2102 | case '51': |
|
| 2103 | case '90': |
|
| 2104 | $ICMSp = '2'; |
|
| 2105 | $ICMSs = '2'; |
|
| 2106 | break; |
|
| 2107 | case '60': |
|
| 2108 | $ICMSp = '2'; |
|
| 2109 | $ICMSs = '1'; |
|
| 2110 | break; |
|
| 2111 | } |
|
| 2112 | $dd = $this->ide->getElementsByTagName('dEmi')->item(0)->nodeValue; |
|
| 2113 | $rpos = strrpos($dd, '-'); |
|
| 2114 | $dd = substr($dd, $rpos + 1); |
|
| 2115 | $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vCT, $ICMSp, $ICMSs, $dd); |
|
| 2116 | $chave = $chave . $this->pModulo11($chave); |
|
| 2117 | return $chave; |
|
| 2118 | } //fim zGeraChaveAdicCont |
|
| 2119 | ||
| 2120 | /** |
|
| 2121 | * zDocOrig |
|