These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace NFePHP\CTe; |
||
4 | |||
5 | /** |
||
6 | * |
||
7 | * @category Library |
||
8 | * @package nfephp-org/sped-cte |
||
9 | * @copyright 2009-2016 NFePHP |
||
10 | * @name Make.php |
||
11 | * @license http://www.gnu.org/licenses/gpl.html GNU/GPL v.3 |
||
12 | * @link http://github.com/nfephp-org/sped-cte for the canonical source repository |
||
13 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
||
14 | */ |
||
15 | |||
16 | use NFePHP\Common\Keys; |
||
17 | use NFePHP\Common\DOMImproved as Dom; |
||
18 | use NFePHP\Common\Strings; |
||
19 | use stdClass; |
||
20 | use RuntimeException; |
||
21 | use DOMElement; |
||
22 | use DateTime; |
||
23 | |||
24 | class Make |
||
25 | { |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | public $erros = []; |
||
30 | |||
31 | /** |
||
32 | * versao |
||
33 | * numero da versão do xml da CTe |
||
34 | * @var string |
||
35 | */ |
||
36 | public $versao = '3.00'; |
||
37 | /** |
||
38 | * mod |
||
39 | * modelo da CTe 57 |
||
40 | * @var integer |
||
41 | */ |
||
42 | public $mod = 57; |
||
43 | /** |
||
44 | * chave da MDFe |
||
45 | * @var string |
||
46 | */ |
||
47 | public $chCTe = ''; |
||
48 | /** |
||
49 | * xml |
||
50 | * String com o xml do documento fiscal montado |
||
51 | * @var string |
||
52 | */ |
||
53 | public $xml = ''; |
||
54 | /** |
||
55 | * dom |
||
56 | * Variável onde será montado o xml do documento fiscal |
||
57 | * @var \NFePHP\Common\Dom\Dom |
||
58 | */ |
||
59 | public $dom; |
||
60 | /** |
||
61 | * tpAmb |
||
62 | * tipo de ambiente |
||
63 | * @var string |
||
64 | */ |
||
65 | public $tpAmb = '2'; |
||
66 | /** |
||
67 | * Modal do Cte |
||
68 | * @var integer |
||
69 | */ |
||
70 | private $modal = 0; |
||
71 | /** |
||
72 | * Tag CTe |
||
73 | * @var \DOMNode |
||
74 | */ |
||
75 | private $CTe = ''; |
||
76 | /** |
||
77 | * Informações do CT-e |
||
78 | * @var \DOMNode |
||
79 | */ |
||
80 | private $infCte = ''; |
||
81 | /** |
||
82 | * Identificação do CT-e |
||
83 | * @var \DOMNode |
||
84 | */ |
||
85 | private $ide = ''; |
||
86 | /** |
||
87 | * Percurso do CT-e OS |
||
88 | * @var \DOMNode |
||
89 | */ |
||
90 | private $infPercurso = []; |
||
91 | /** |
||
92 | * Tipo do Serviço |
||
93 | * @var integer |
||
94 | */ |
||
95 | private $tpServ = 0; |
||
96 | /** |
||
97 | * Indicador do "papel" do tomador do serviço no CT-e |
||
98 | * @var \DOMNode |
||
99 | */ |
||
100 | private $toma3 = ''; |
||
101 | /** |
||
102 | * Indicador do "papel" do tomador do serviço no CT-e |
||
103 | * @var \DOMNode |
||
104 | */ |
||
105 | private $toma4 = ''; |
||
106 | /** |
||
107 | * Indicador do "papel" do tomador do serviço no CT-e OS |
||
108 | * @var \DOMNode |
||
109 | */ |
||
110 | private $toma = ''; |
||
111 | /** |
||
112 | * Dados do endereço |
||
113 | * @var \DOMNode |
||
114 | */ |
||
115 | private $enderToma = ''; |
||
116 | /** |
||
117 | * Dados complementares do CT-e para fins operacionais ou comerciais |
||
118 | * @var \DOMNode |
||
119 | */ |
||
120 | private $compl = ''; |
||
121 | /** |
||
122 | * Previsão do fluxo da carga |
||
123 | * @var \DOMNode |
||
124 | */ |
||
125 | private $fluxo = ''; |
||
126 | /** |
||
127 | * Passagem |
||
128 | * @var array |
||
129 | */ |
||
130 | private $pass = array(); |
||
131 | /** |
||
132 | * Informações ref. a previsão de entrega |
||
133 | * @var \DOMNode |
||
134 | */ |
||
135 | private $entrega = ''; |
||
136 | /** |
||
137 | * Entrega sem data definida |
||
138 | * @var \DOMNode |
||
139 | */ |
||
140 | private $semData = ''; |
||
141 | /** |
||
142 | * Entrega com data definida |
||
143 | * @var \DOMNode |
||
144 | */ |
||
145 | private $comData = ''; |
||
146 | /** |
||
147 | * Entrega no período definido |
||
148 | * @var \DOMNode |
||
149 | */ |
||
150 | private $noPeriodo = ''; |
||
151 | /** |
||
152 | * Entrega sem hora definida |
||
153 | * @var \DOMNode |
||
154 | */ |
||
155 | private $semHora = ''; |
||
156 | /** |
||
157 | * Entrega com hora definida |
||
158 | * @var \DOMNode |
||
159 | */ |
||
160 | private $comHora = ''; |
||
161 | /** |
||
162 | * Entrega no intervalo de horário definido |
||
163 | * @var \DOMNode |
||
164 | */ |
||
165 | private $noInter = ''; |
||
166 | /** |
||
167 | * Campo de uso livre do contribuinte |
||
168 | * @var array |
||
169 | */ |
||
170 | private $obsCont = array(); |
||
171 | /** |
||
172 | * Campo de uso livre do contribuinte |
||
173 | * @var array |
||
174 | */ |
||
175 | private $obsFisco = array(); |
||
176 | /** |
||
177 | * Identificação do Emitente do CT-e |
||
178 | * @var \DOMNode |
||
179 | */ |
||
180 | private $emit = ''; |
||
181 | /** |
||
182 | * Endereço do emitente |
||
183 | * @var \DOMNode |
||
184 | */ |
||
185 | private $enderEmit = ''; |
||
186 | /** |
||
187 | * Informações do Remetente das mercadorias transportadas pelo CT-e |
||
188 | * @var \DOMNode |
||
189 | */ |
||
190 | private $rem = ''; |
||
191 | /** |
||
192 | * Dados do endereço |
||
193 | * @var \DOMNode |
||
194 | */ |
||
195 | private $enderReme = ''; |
||
196 | /** |
||
197 | * Informações do Expedidor da Carga |
||
198 | * @var \DOMNode |
||
199 | */ |
||
200 | private $exped = ''; |
||
201 | /** |
||
202 | * Dados do endereço |
||
203 | * @var \DOMNode |
||
204 | */ |
||
205 | private $enderExped = ''; |
||
206 | /** |
||
207 | * Informações do Recebedor da Carga |
||
208 | * @var \DOMNode |
||
209 | */ |
||
210 | private $receb = ''; |
||
211 | /** |
||
212 | * Dados do endereço |
||
213 | * @var \DOMNode |
||
214 | */ |
||
215 | private $enderReceb = ''; |
||
216 | /** |
||
217 | * Informações do Destinatário do CT-e |
||
218 | * @var \DOMNode |
||
219 | */ |
||
220 | private $dest = ''; |
||
221 | /** |
||
222 | * Dados do endereço |
||
223 | * @var \DOMNode |
||
224 | */ |
||
225 | private $enderDest = ''; |
||
226 | /** |
||
227 | * Valores da Prestação de Serviço |
||
228 | * @var \DOMNode |
||
229 | */ |
||
230 | private $vPrest = ''; |
||
231 | /** |
||
232 | * Componentes do Valor da Prestação |
||
233 | * @var array |
||
234 | */ |
||
235 | private $comp = array(); |
||
236 | /** |
||
237 | * Informações relativas aos Impostos |
||
238 | * @var \DOMNode |
||
239 | */ |
||
240 | private $imp = ''; |
||
241 | /** |
||
242 | * Informações relativas ao ICMS |
||
243 | * @var \DOMNode |
||
244 | */ |
||
245 | private $ICMS = ''; |
||
0 ignored issues
–
show
|
|||
246 | /** |
||
247 | * Prestação sujeito à tributação normal do ICMS |
||
248 | * @var \DOMNode |
||
249 | */ |
||
250 | private $ICMS00 = ''; |
||
0 ignored issues
–
show
|
|||
251 | /** |
||
252 | * Prestação sujeito à tributação com redução de BC do ICMS |
||
253 | * @var \DOMNode |
||
254 | */ |
||
255 | private $ICMS20 = ''; |
||
0 ignored issues
–
show
|
|||
256 | /** |
||
257 | * ICMS Isento, não Tributado ou diferido |
||
258 | * @var \DOMNode |
||
259 | */ |
||
260 | private $ICMS45 = ''; |
||
0 ignored issues
–
show
|
|||
261 | /** |
||
262 | * Tributação pelo ICMS60 - ICMS cobrado por substituição tributária. |
||
263 | * Responsabilidade do recolhimento do ICMS atribuído ao tomador ou 3º por ST |
||
264 | * @var \DOMNode |
||
265 | */ |
||
266 | private $ICMS60 = ''; |
||
0 ignored issues
–
show
|
|||
267 | /** |
||
268 | * ICMS Outros |
||
269 | * @var \DOMNode |
||
270 | */ |
||
271 | private $ICMS90 = ''; |
||
0 ignored issues
–
show
|
|||
272 | /** |
||
273 | * ICMS devido à UF de origem da prestação, quando diferente da UF do emitente |
||
274 | * @var \DOMNode |
||
275 | */ |
||
276 | private $ICMSOutraUF = ''; |
||
0 ignored issues
–
show
|
|||
277 | /** |
||
278 | * Simples Nacional |
||
279 | * @var \DOMNode |
||
280 | */ |
||
281 | private $ICMSSN = ''; |
||
0 ignored issues
–
show
|
|||
282 | /** |
||
283 | * Observações adicionais da CT-e |
||
284 | * @var string |
||
285 | */ |
||
286 | private $xObs = ''; |
||
0 ignored issues
–
show
|
|||
287 | /** |
||
288 | * Grupo de informações do CT-e Normal e Substituto |
||
289 | * @var \DOMNode |
||
290 | */ |
||
291 | private $infCTeNorm = ''; |
||
292 | /** |
||
293 | * Informações da Carga do CT-e |
||
294 | * @var \DOMNode |
||
295 | */ |
||
296 | private $infCarga = ''; |
||
297 | /** |
||
298 | * Informações da Prestação do Serviço |
||
299 | * @var \DOMNode |
||
300 | */ |
||
301 | private $infServico = ''; |
||
302 | /** |
||
303 | * Informações de quantidades da Carga do CT-e |
||
304 | * @var \DOMNode |
||
305 | */ |
||
306 | private $infQ = array(); |
||
307 | /** |
||
308 | * Informações dos documentos transportados pelo CT-e Opcional para Redespacho Intermediario |
||
309 | * e Serviço vinculado a multimodal. |
||
310 | * @var \DOMNode |
||
311 | */ |
||
312 | private $infDoc = array(); |
||
313 | /** |
||
314 | * Informações das NF |
||
315 | * @var array |
||
316 | */ |
||
317 | private $infNF = array(); |
||
318 | /** |
||
319 | * Informações das NF-e |
||
320 | * @var array |
||
321 | */ |
||
322 | private $infNFe = array(); |
||
323 | /** |
||
324 | * Informações dos demais documentos |
||
325 | * @var array |
||
326 | */ |
||
327 | private $infOutros = array(); |
||
328 | /** |
||
329 | * Informações dos demais documentos |
||
330 | * @var array |
||
331 | */ |
||
332 | private $infDocRef = array(); |
||
333 | /** |
||
334 | * Informações das Unidades de Transporte (Carreta/Reboque/Vagão) |
||
335 | * @var array |
||
336 | */ |
||
337 | private $infUnidTransp = array(); |
||
0 ignored issues
–
show
|
|||
338 | /** |
||
339 | * Lacres das Unidades de Transporte |
||
340 | * @var array |
||
341 | */ |
||
342 | private $lacUnidTransp = array(); |
||
0 ignored issues
–
show
|
|||
343 | /** |
||
344 | * Informações das Unidades de Carga (Containeres/ULD/Outros) |
||
345 | * @var array |
||
346 | */ |
||
347 | private $infUnidCarga = array(); |
||
0 ignored issues
–
show
|
|||
348 | /** |
||
349 | * Lacres das Unidades de Carga |
||
350 | * @var array |
||
351 | */ |
||
352 | private $lacUnidCarga = array(); |
||
0 ignored issues
–
show
|
|||
353 | /** |
||
354 | * Documentos de Transporte Anterior |
||
355 | * @var \DOMNode |
||
356 | */ |
||
357 | private $docAnt = array(); |
||
358 | /** |
||
359 | * Emissor do documento anterior |
||
360 | * @var array |
||
361 | */ |
||
362 | private $emiDocAnt = array(); |
||
363 | /** |
||
364 | * Informações de identificação dos documentos de Transporte Anterior |
||
365 | * @var array |
||
366 | */ |
||
367 | private $idDocAnt = array(); |
||
368 | /** |
||
369 | * Documentos de transporte anterior em papel |
||
370 | * @var array |
||
371 | */ |
||
372 | private $idDocAntPap = array(); |
||
0 ignored issues
–
show
|
|||
373 | /** |
||
374 | * Documentos de transporte anterior eletrônicos |
||
375 | * @var array |
||
376 | */ |
||
377 | private $idDocAntEle = array(); |
||
378 | /** |
||
379 | * Informações de Seguro da Carga |
||
380 | * @var array |
||
381 | */ |
||
382 | private $seg = array(); |
||
383 | /** |
||
384 | * Informações do modal |
||
385 | * @var \DOMNode |
||
386 | */ |
||
387 | private $infModal = ''; |
||
388 | /** |
||
389 | * Preenchido quando for transporte de produtos classificados pela ONU como perigosos. |
||
390 | * @var array |
||
391 | */ |
||
392 | private $peri = array(); |
||
0 ignored issues
–
show
|
|||
393 | /** |
||
394 | * informações dos veículos transportados |
||
395 | * @var array |
||
396 | */ |
||
397 | private $veicNovos = array(); |
||
0 ignored issues
–
show
|
|||
398 | /** |
||
399 | * Dados da cobrança do CT-e |
||
400 | * @var \DOMNode |
||
401 | */ |
||
402 | private $cobr = ''; |
||
0 ignored issues
–
show
|
|||
403 | /** |
||
404 | * Dados da fatura |
||
405 | * @var \DOMNode |
||
406 | */ |
||
407 | private $fat = ''; |
||
0 ignored issues
–
show
|
|||
408 | /** |
||
409 | * Dados das duplicatas |
||
410 | * @var array |
||
411 | */ |
||
412 | private $dup = array(); |
||
0 ignored issues
–
show
|
|||
413 | /** |
||
414 | * Informações do CT-e de substituição |
||
415 | * @var \DOMNode |
||
416 | */ |
||
417 | private $infCteSub = ''; |
||
418 | /** |
||
419 | * Tomador é contribuinte do ICMS |
||
420 | * @var \DOMNode |
||
421 | */ |
||
422 | private $tomaICMS = ''; |
||
423 | /** |
||
424 | * Informação da NFe emitida pelo Tomador |
||
425 | * @var \DOMNode |
||
426 | */ |
||
427 | private $refNFe = ''; |
||
0 ignored issues
–
show
|
|||
428 | /** |
||
429 | * Informação da NF ou CT emitido pelo Tomador |
||
430 | * @var \DOMNode |
||
431 | */ |
||
432 | private $refNF = ''; |
||
433 | /** |
||
434 | * Informação do CTe emitido pelo Tomador |
||
435 | * @var \DOMNode |
||
436 | */ |
||
437 | private $refCte = ''; |
||
0 ignored issues
–
show
|
|||
438 | /** |
||
439 | * Informação da NF ou CT emitido pelo Tomador |
||
440 | * @var \DOMNode |
||
441 | */ |
||
442 | private $infCteComp = ''; |
||
443 | /** |
||
444 | * Detalhamento do CT-e do tipo Anulação |
||
445 | * @var \DOMNode |
||
446 | */ |
||
447 | private $infCteAnu = ''; |
||
448 | /** |
||
449 | * Informações do modal Rodoviário |
||
450 | * @var \DOMNode |
||
451 | */ |
||
452 | private $rodo = ''; |
||
453 | /** |
||
454 | * Ordens de Coleta associados |
||
455 | * @var array |
||
456 | */ |
||
457 | private $occ = array(); |
||
0 ignored issues
–
show
|
|||
458 | /** |
||
459 | * @var \DOMNode |
||
460 | */ |
||
461 | private $emiOcc = array(); |
||
0 ignored issues
–
show
|
|||
462 | /** |
||
463 | * Informações de Vale Pedágio |
||
464 | * @var array |
||
465 | */ |
||
466 | private $valePed = array(); |
||
0 ignored issues
–
show
|
|||
467 | /** |
||
468 | * Dados dos Veículos |
||
469 | * @var array |
||
470 | */ |
||
471 | private $veic = array(); |
||
472 | /** |
||
473 | * Proprietários do Veículo. Só preenchido quando o veículo não pertencer à empresa emitente do CT-e |
||
474 | * @var array |
||
475 | */ |
||
476 | private $prop = array(); |
||
477 | /** |
||
478 | * Dados dos Veículos |
||
479 | * @var array |
||
480 | */ |
||
481 | private $lacRodo = array(); |
||
0 ignored issues
–
show
|
|||
482 | /** |
||
483 | * Informações do(s) Motorista(s) |
||
484 | * @var array |
||
485 | */ |
||
486 | private $moto = array(); |
||
0 ignored issues
–
show
|
|||
487 | |||
488 | 1 | public function __construct() |
|
489 | { |
||
490 | 1 | $this->dom = new Dom('1.0', 'UTF-8'); |
|
0 ignored issues
–
show
It seems like
new \NFePHP\Common\DOMImproved('1.0', 'UTF-8') of type object<NFePHP\Common\DOMImproved> is incompatible with the declared type object<NFePHP\Common\Dom\Dom> of property $dom .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Loading history...
|
|||
491 | 1 | $this->dom->preserveWhiteSpace = false; |
|
492 | 1 | $this->dom->formatOutput = false; |
|
493 | 1 | } |
|
494 | |||
495 | /** |
||
496 | * Returns xml string and assembly it is necessary |
||
497 | * @return string |
||
498 | */ |
||
499 | public function getXML() |
||
500 | { |
||
501 | if (empty($this->xml)) { |
||
502 | $this->montaCTe(); |
||
503 | } |
||
504 | return $this->xml; |
||
505 | } |
||
506 | |||
507 | /** |
||
508 | * Retorns the key number of NFe (44 digits) |
||
509 | * @return string |
||
510 | */ |
||
511 | public function getChave() |
||
512 | { |
||
513 | return $this->chCTe; |
||
514 | } |
||
515 | |||
516 | /** |
||
517 | * Returns the model of CTe 57 or 67 |
||
518 | * @return int |
||
519 | */ |
||
520 | public function getModelo() |
||
521 | { |
||
522 | return $this->mod; |
||
523 | } |
||
524 | |||
525 | /** |
||
526 | * Call method of xml assembly. For compatibility only. |
||
527 | * @return boolean |
||
528 | */ |
||
529 | public function montaCTe() |
||
530 | { |
||
531 | return $this->monta(); |
||
532 | } |
||
533 | |||
534 | /** |
||
535 | * Monta o arquivo XML usando as tag's já preenchidas |
||
536 | * |
||
537 | * @return bool |
||
538 | */ |
||
539 | public function monta() |
||
540 | { |
||
541 | if (count($this->erros) > 0) { |
||
542 | return false; |
||
543 | } |
||
544 | if ($this->mod == 57) { |
||
545 | $this->buildCTe(); |
||
546 | } else { |
||
547 | return $this->montaCTeOS(); |
||
548 | } |
||
549 | if ($this->toma3 != '') { |
||
550 | $this->dom->appChild($this->ide, $this->toma3, 'Falta tag "ide"'); |
||
551 | } else { |
||
552 | $this->dom->appChild($this->ide, $this->toma4, 'Falta tag "ide"'); |
||
553 | } |
||
554 | $this->dom->appChild($this->infCte, $this->ide, 'Falta tag "infCte"'); |
||
555 | if ($this->semData != '') { |
||
556 | $this->tagEntrega(); |
||
557 | $this->dom->appChild($this->entrega, $this->semData, 'Falta tag "Entrega"'); |
||
558 | } |
||
559 | if ($this->comData != '') { |
||
560 | $this->tagEntrega(); |
||
561 | $this->dom->appChild($this->entrega, $this->comData, 'Falta tag "Entrega"'); |
||
562 | } |
||
563 | if ($this->noPeriodo != '') { |
||
564 | $this->tagEntrega(); |
||
565 | $this->dom->appChild($this->entrega, $this->noPeriodo, 'Falta tag "Entrega"'); |
||
566 | } |
||
567 | if ($this->semHora != '') { |
||
568 | $this->tagEntrega(); |
||
569 | $this->dom->appChild($this->entrega, $this->semHora, 'Falta tag "Entrega"'); |
||
570 | } |
||
571 | if ($this->comHora != '') { |
||
572 | $this->tagEntrega(); |
||
573 | $this->dom->appChild($this->entrega, $this->comHora, 'Falta tag "Entrega"'); |
||
574 | } |
||
575 | if ($this->noInter != '') { |
||
576 | $this->tagEntrega(); |
||
577 | $this->dom->appChild($this->entrega, $this->noInter, 'Falta tag "Entrega"'); |
||
578 | } |
||
579 | if ($this->compl != '') { |
||
580 | if ($this->fluxo != '') { |
||
581 | foreach ($this->pass as $pass) { |
||
582 | $this->dom->appChild($this->fluxo, $pass, 'Falta tag "fluxo"'); |
||
583 | } |
||
584 | $this->dom->appChild($this->compl, $this->fluxo, 'Falta tag "infCte"'); |
||
585 | } |
||
586 | foreach ($this->obsCont as $obsCont) { |
||
587 | $this->dom->appChild($this->compl, $obsCont, 'Falta tag "compl"'); |
||
588 | } |
||
589 | foreach ($this->obsFisco as $obsFisco) { |
||
590 | $this->dom->appChild($this->compl, $obsFisco, 'Falta tag "compl"'); |
||
591 | } |
||
592 | $this->dom->appChild($this->infCte, $this->compl, 'Falta tag "infCte"'); |
||
593 | } |
||
594 | $this->dom->appChild($this->emit, $this->enderEmit, 'Falta tag "emit"'); |
||
595 | $this->dom->appChild($this->infCte, $this->emit, 'Falta tag "infCte"'); |
||
596 | if ($this->rem != '') { |
||
597 | $this->dom->appChild($this->infCte, $this->rem, 'Falta tag "infCte"'); |
||
598 | } |
||
599 | if ($this->exped != '') { |
||
600 | $this->dom->appChild($this->infCte, $this->exped, 'Falta tag "infCte"'); |
||
601 | } |
||
602 | if ($this->receb != '') { |
||
603 | $this->dom->appChild($this->infCte, $this->receb, 'Falta tag "infCte"'); |
||
604 | } |
||
605 | if ($this->dest != '') { |
||
606 | $this->dom->appChild($this->infCte, $this->dest, 'Falta tag "infCte"'); |
||
607 | } |
||
608 | foreach ($this->comp as $comp) { |
||
609 | $this->dom->appChild($this->vPrest, $comp, 'Falta tag "vPrest"'); |
||
610 | } |
||
611 | $this->dom->appChild($this->infCte, $this->vPrest, 'Falta tag "infCte"'); |
||
612 | $this->dom->appChild($this->infCte, $this->imp, 'Falta tag "imp"'); |
||
613 | if ($this->infCteComp != '') { // Caso seja um CTe tipo complemento de valores |
||
614 | $this->dom->appChild($this->infCte, $this->infCteComp, 'Falta tag "infCteComp"'); |
||
615 | } |
||
616 | if ($this->infCteAnu != '') { // Caso seja um CTe tipo anulação |
||
617 | $this->dom->appChild($this->infCte, $this->infCteAnu, 'Falta tag "infCteAnu"'); |
||
618 | } |
||
619 | if ($this->infCTeNorm != '') { // Caso seja um CTe tipo normal |
||
620 | $this->dom->appChild($this->infCte, $this->infCTeNorm, 'Falta tag "infCTeNorm"'); |
||
621 | $this->dom->appChild($this->infCTeNorm, $this->infCarga, 'Falta tag "infCarga"'); |
||
622 | foreach ($this->infQ as $infQ) { |
||
0 ignored issues
–
show
|
|||
623 | $this->dom->appChild($this->infCarga, $infQ, 'Falta tag "infQ"'); |
||
624 | } |
||
625 | |||
626 | $this->dom->appChild($this->infCTeNorm, $this->infDoc, 'Falta tag "infDoc"'); |
||
627 | foreach ($this->infNF as $infNF) { |
||
628 | $this->dom->appChild($this->infDoc, $infNF, 'Falta tag "infNF"'); |
||
629 | } |
||
630 | foreach ($this->infNFe as $infNFe) { |
||
631 | $this->dom->appChild($this->infDoc, $infNFe, 'Falta tag "infNFe"'); |
||
632 | } |
||
633 | foreach ($this->infOutros as $infOutros) { |
||
634 | $this->dom->appChild($this->infDoc, $infOutros, 'Falta tag "infOutros"'); |
||
635 | } |
||
636 | |||
637 | if ($this->idDocAntEle != []) { //Caso tenha CT-es Anteriores viculados |
||
638 | $this->dom->appChild($this->infCTeNorm, $this->docAnt, 'Falta tag "docAnt"'); |
||
639 | |||
640 | foreach ($this->emiDocAnt as $emiDocAnt) { |
||
641 | $this->dom->appChild($this->docAnt, $emiDocAnt, 'Falta tag "emiDocAnt"'); |
||
642 | $this->dom->appChild($emiDocAnt, $this->idDocAnt, 'Falta tag "idDocAnt"'); |
||
643 | |||
644 | foreach ($this->idDocAntEle as $idDocAntEle) { |
||
645 | $this->dom->appChild($this->idDocAnt, $idDocAntEle, 'Falta tag "emiDocAnt"'); |
||
646 | } |
||
647 | } |
||
648 | } |
||
649 | |||
650 | foreach ($this->seg as $seg) { |
||
651 | $this->dom->appChild($this->infCTeNorm, $seg, 'Falta tag "seg"'); |
||
652 | } |
||
653 | |||
654 | $this->dom->appChild($this->infCTeNorm, $this->infModal, 'Falta tag "infModal"'); |
||
655 | $this->dom->appChild($this->infModal, $this->rodo, 'Falta tag "rodo"'); |
||
656 | } |
||
657 | foreach ($this->veic as $veic) { |
||
658 | $this->dom->appChild($this->rodo, $veic, 'Falta tag "veic"'); |
||
659 | } |
||
660 | //[1] tag infCTe |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
661 | $this->dom->appChild($this->CTe, $this->infCte, 'Falta tag "CTe"'); |
||
662 | //[0] tag CTe |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
663 | $this->dom->appendChild($this->CTe); |
||
664 | |||
665 | // testa da chave |
||
666 | $this->checkCTeKey($this->dom); |
||
667 | $this->xml = $this->dom->saveXML(); |
||
668 | return true; |
||
669 | } |
||
670 | |||
671 | /** |
||
672 | * Monta o arquivo XML usando as tag's já preenchidas |
||
673 | * |
||
674 | * @return bool |
||
675 | */ |
||
676 | public function montaCTeOS() |
||
677 | { |
||
678 | if (count($this->erros) > 0) { |
||
679 | return false; |
||
680 | } |
||
681 | $this->buildCTeOS(); |
||
682 | |||
683 | if ($this->infPercurso != '') { |
||
684 | foreach ($this->infPercurso as $perc) { |
||
0 ignored issues
–
show
|
|||
685 | $this->dom->appChild($this->ide, $perc, 'Falta tag "infPercurso"'); |
||
686 | } |
||
687 | } |
||
688 | $this->dom->appChild($this->infCte, $this->ide, 'Falta tag "infCte"'); |
||
689 | if ($this->compl != '') { |
||
690 | $this->dom->appChild($this->infCte, $this->compl, 'Falta tag "infCte"'); |
||
691 | } |
||
692 | $this->dom->appChild($this->emit, $this->enderEmit, 'Falta tag "emit"'); |
||
693 | $this->dom->appChild($this->infCte, $this->emit, 'Falta tag "infCte"'); |
||
694 | |||
695 | if ($this->toma != '') { |
||
696 | //$this->dom->appChild($this->toma, $this->enderToma, 'Falta tag "toma"'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
69% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
697 | $this->dom->appChild($this->infCte, $this->toma, 'Falta tag "infCte"'); |
||
698 | } |
||
699 | |||
700 | foreach ($this->comp as $comp) { |
||
701 | $this->dom->appChild($this->vPrest, $comp, 'Falta tag "vPrest"'); |
||
702 | } |
||
703 | $this->dom->appChild($this->infCte, $this->vPrest, 'Falta tag "infCte"'); |
||
704 | $this->dom->appChild($this->infCte, $this->imp, 'Falta tag "imp"'); |
||
705 | if ($this->infCteComp != '') { // Caso seja um CTe tipo complemento de valores |
||
706 | $this->dom->appChild($this->infCte, $this->infCteComp, 'Falta tag "infCteComp"'); |
||
707 | } elseif ($this->infCteAnu != '') { // Caso seja um CTe tipo anulação |
||
708 | $this->dom->appChild($this->infCte, $this->infCteAnu, 'Falta tag "infCteAnu"'); |
||
709 | } elseif ($this->infCTeNorm != '') { // Caso seja um CTe tipo normal |
||
710 | $this->dom->appChild($this->infCte, $this->infCTeNorm, 'Falta tag "infCTeNorm"'); |
||
711 | $this->dom->appChild($this->infCTeNorm, $this->infServico, 'Falta tag "infServico"'); |
||
712 | |||
713 | foreach ($this->infDocRef as $infDocRef) { |
||
714 | $this->dom->appChild($this->infCTeNorm, $infDocRef, 'Falta tag "infDocRef"'); |
||
715 | } |
||
716 | |||
717 | foreach ($this->seg as $seg) { |
||
718 | $this->dom->appChild($this->infCTeNorm, $seg, 'Falta tag "seg"'); |
||
719 | } |
||
720 | |||
721 | if ($this->infModal != '') { |
||
722 | $this->dom->appChild($this->infCTeNorm, $this->infModal, 'Falta tag "infModal"'); |
||
723 | $this->dom->appChild($this->rodo, $this->veic, 'Falta tag "veic"'); |
||
724 | $this->dom->appChild($this->infModal, $this->rodo, 'Falta tag "rodo"'); |
||
725 | } |
||
726 | } |
||
727 | |||
728 | $this->dom->appChild($this->CTe, $this->infCte, 'Falta tag "CTe"'); |
||
729 | //$this->dom->appChild($this->dom, $this->CTe, 'Falta tag "DOMDocument"'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
69% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
730 | $this->dom->appendChild($this->CTe); |
||
731 | |||
732 | // testa da chave |
||
733 | $this->checkCTeKey($this->dom); |
||
734 | $this->xml = $this->dom->saveXML(); |
||
735 | return true; |
||
736 | } |
||
737 | |||
738 | /** |
||
739 | * Gera o grupo básico: Informações do CT-e |
||
740 | * #1 |
||
741 | * Nível: 0 |
||
742 | * @param stdClass $std |
||
743 | * @return \DOMElement |
||
744 | */ |
||
745 | 1 | public function taginfCTe($std) |
|
746 | { |
||
747 | 1 | $chave = preg_replace('/[^0-9]/', '', $std->Id); |
|
748 | 1 | $this->infCte = $this->dom->createElement('infCte'); |
|
749 | 1 | $this->infCte->setAttribute('Id', 'CTe' . $chave); |
|
750 | 1 | $this->infCte->setAttribute('versao', $std->versao); |
|
751 | 1 | return $this->infCte; |
|
752 | } |
||
753 | |||
754 | /** |
||
755 | * Gera as tags para o elemento: Identificação do CT-e |
||
756 | * #4 |
||
757 | * Nível: 1 |
||
758 | * @param stdClass $std |
||
759 | * @return DOMElement|\DOMNode |
||
760 | */ |
||
761 | public function tagide($std) |
||
762 | { |
||
763 | $this->tpAmb = $std->tpAmb; |
||
764 | $this->mod = $std->mod; |
||
765 | $identificador = '#4 <ide> - '; |
||
766 | $this->ide = $this->dom->createElement('ide'); |
||
767 | $this->dom->addChild( |
||
768 | $this->ide, |
||
769 | 'cUF', |
||
770 | $std->cUF, |
||
771 | true, |
||
772 | $identificador . 'Código da UF do emitente do CT-e' |
||
773 | ); |
||
774 | $this->dom->addChild( |
||
775 | $this->ide, |
||
776 | 'cCT', |
||
777 | str_pad($std->cCT, 8, '0', STR_PAD_LEFT), |
||
778 | true, |
||
779 | $identificador . 'Código numérico que compõe a Chave de Acesso' |
||
780 | ); |
||
781 | $this->dom->addChild( |
||
782 | $this->ide, |
||
783 | 'CFOP', |
||
784 | $std->CFOP, |
||
785 | true, |
||
786 | $identificador . 'Código Fiscal de Operações e Prestações' |
||
787 | ); |
||
788 | $this->dom->addChild( |
||
789 | $this->ide, |
||
790 | 'natOp', |
||
791 | Strings::replaceSpecialsChars(substr(trim($std->natOp), 0, 60)), |
||
792 | true, |
||
793 | $identificador . 'Natureza da Operação' |
||
794 | ); |
||
795 | $this->dom->addChild( |
||
796 | $this->ide, |
||
797 | 'mod', |
||
798 | $std->mod, |
||
799 | true, |
||
800 | $identificador . 'Modelo do documento fiscal' |
||
801 | ); |
||
802 | $this->dom->addChild( |
||
803 | $this->ide, |
||
804 | 'serie', |
||
805 | $std->serie, |
||
806 | true, |
||
807 | $identificador . 'Série do CT-e' |
||
808 | ); |
||
809 | $this->dom->addChild( |
||
810 | $this->ide, |
||
811 | 'nCT', |
||
812 | $std->nCT, |
||
813 | true, |
||
814 | $identificador . 'Número do CT-e' |
||
815 | ); |
||
816 | $this->dom->addChild( |
||
817 | $this->ide, |
||
818 | 'dhEmi', |
||
819 | $std->dhEmi, |
||
820 | true, |
||
821 | $identificador . 'Data e hora de emissão do CT-e' |
||
822 | ); |
||
823 | $this->dom->addChild( |
||
824 | $this->ide, |
||
825 | 'tpImp', |
||
826 | $std->tpImp, |
||
827 | true, |
||
828 | $identificador . 'Formato de impressão do DACTE' |
||
829 | ); |
||
830 | $this->dom->addChild( |
||
831 | $this->ide, |
||
832 | 'tpEmis', |
||
833 | $std->tpEmis, |
||
834 | true, |
||
835 | $identificador . 'Forma de emissão do CT-e' |
||
836 | ); |
||
837 | $this->dom->addChild( |
||
838 | $this->ide, |
||
839 | 'cDV', |
||
840 | $std->cDV, |
||
841 | true, |
||
842 | $identificador . 'Digito Verificador da chave de acesso do CT-e' |
||
843 | ); |
||
844 | $this->dom->addChild( |
||
845 | $this->ide, |
||
846 | 'tpAmb', |
||
847 | $std->tpAmb, |
||
848 | true, |
||
849 | $identificador . 'Tipo do Ambiente' |
||
850 | ); |
||
851 | $this->dom->addChild( |
||
852 | $this->ide, |
||
853 | 'tpCTe', |
||
854 | $std->tpCTe, |
||
855 | true, |
||
856 | $identificador . 'Tipo do CT-e' |
||
857 | ); |
||
858 | $this->dom->addChild( |
||
859 | $this->ide, |
||
860 | 'procEmi', |
||
861 | $std->procEmi, |
||
862 | true, |
||
863 | $identificador . 'Identificador do processo de emissão do CT-e' |
||
864 | ); |
||
865 | $this->dom->addChild( |
||
866 | $this->ide, |
||
867 | 'verProc', |
||
868 | $std->verProc, |
||
869 | true, |
||
870 | $identificador . 'Versão do processo de emissão' |
||
871 | ); |
||
872 | $this->dom->addChild( |
||
873 | $this->ide, |
||
874 | 'indGlobalizado', |
||
875 | $std->indGlobalizado, |
||
876 | false, |
||
877 | $identificador . 'Indicador de CT-e Globalizado' |
||
878 | ); |
||
879 | $this->dom->addChild( |
||
880 | $this->ide, |
||
881 | 'cMunEnv', |
||
882 | $std->cMunEnv, |
||
883 | true, |
||
884 | $identificador . 'Código do Município de envio do CT-e (de onde o documento foi transmitido)' |
||
885 | ); |
||
886 | $this->dom->addChild( |
||
887 | $this->ide, |
||
888 | 'xMunEnv', |
||
889 | $std->xMunEnv, |
||
890 | true, |
||
891 | $identificador . 'Nome do Município de envio do CT-e (de onde o documento foi transmitido)' |
||
892 | ); |
||
893 | $this->dom->addChild( |
||
894 | $this->ide, |
||
895 | 'UFEnv', |
||
896 | $std->UFEnv, |
||
897 | true, |
||
898 | $identificador . 'Sigla da UF de envio do CT-e (de onde o documento foi transmitido)' |
||
899 | ); |
||
900 | $this->dom->addChild( |
||
901 | $this->ide, |
||
902 | 'modal', |
||
903 | $std->modal, |
||
904 | true, |
||
905 | $identificador . 'Modal' |
||
906 | ); |
||
907 | $this->modal = $std->modal; |
||
908 | $this->dom->addChild( |
||
909 | $this->ide, |
||
910 | 'tpServ', |
||
911 | $std->tpServ, |
||
912 | true, |
||
913 | $identificador . 'Tipo do Serviço' |
||
914 | ); |
||
915 | $this->dom->addChild( |
||
916 | $this->ide, |
||
917 | 'cMunIni', |
||
918 | $std->cMunIni, |
||
919 | true, |
||
920 | $identificador . 'Nome do Município do início da prestação' |
||
921 | ); |
||
922 | $this->dom->addChild( |
||
923 | $this->ide, |
||
924 | 'xMunIni', |
||
925 | $std->xMunIni, |
||
926 | true, |
||
927 | $identificador . 'Nome do Município do início da prestação' |
||
928 | ); |
||
929 | $this->dom->addChild( |
||
930 | $this->ide, |
||
931 | 'UFIni', |
||
932 | $std->UFIni, |
||
933 | true, |
||
934 | $identificador . 'UF do início da prestação' |
||
935 | ); |
||
936 | $this->dom->addChild( |
||
937 | $this->ide, |
||
938 | 'cMunFim', |
||
939 | $std->cMunFim, |
||
940 | true, |
||
941 | $identificador . 'Código do Município de término da prestação' |
||
942 | ); |
||
943 | $this->dom->addChild( |
||
944 | $this->ide, |
||
945 | 'xMunFim', |
||
946 | $std->xMunFim, |
||
947 | true, |
||
948 | $identificador . 'Nome do Município do término da prestação' |
||
949 | ); |
||
950 | $this->dom->addChild( |
||
951 | $this->ide, |
||
952 | 'UFFim', |
||
953 | $std->UFFim, |
||
954 | true, |
||
955 | $identificador . 'UF do término da prestação' |
||
956 | ); |
||
957 | $this->dom->addChild( |
||
958 | $this->ide, |
||
959 | 'retira', |
||
960 | $std->retira, |
||
961 | true, |
||
962 | $identificador . 'Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino' |
||
963 | ); |
||
964 | $this->dom->addChild( |
||
965 | $this->ide, |
||
966 | 'xDetRetira', |
||
967 | $std->xDetRetira, |
||
968 | false, |
||
969 | $identificador . 'Detalhes do retira' |
||
970 | ); |
||
971 | $this->dom->addChild( |
||
972 | $this->ide, |
||
973 | 'indIEToma', |
||
974 | $std->indIEToma, |
||
975 | true, |
||
976 | $identificador . 'Indicador do papel do tomador na prestação do serviço' |
||
977 | ); |
||
978 | $this->dom->addChild( |
||
979 | $this->ide, |
||
980 | 'dhCont', |
||
981 | $std->dhCont, |
||
982 | false, |
||
983 | $identificador . 'Data e Hora da entrada em contingência' |
||
984 | ); |
||
985 | $this->dom->addChild( |
||
986 | $this->ide, |
||
987 | 'xJust', |
||
988 | Strings::replaceSpecialsChars(substr(trim($std->xJust), 0, 256)), |
||
989 | false, |
||
990 | $identificador . 'Justificativa da entrada em contingência' |
||
991 | ); |
||
992 | $this->tpServ = $std->tpServ; |
||
993 | return $this->ide; |
||
994 | } |
||
995 | |||
996 | /** |
||
997 | * Gera as tags para o elemento: Identificação do CT-e OS |
||
998 | * #4 |
||
999 | * Nível: 1 |
||
1000 | * Os parâmetros para esta função são todos os elementos da tag "ide" do tipo elemento (Ele = E|CE|A) e nível 2 |
||
1001 | * |
||
1002 | * @return DOMElement|\DOMNode |
||
1003 | */ |
||
1004 | public function tagideCTeOS($std) |
||
1005 | { |
||
1006 | $this->tpAmb = $std->tpAmb; |
||
1007 | $identificador = '#4 <ide> - '; |
||
1008 | $this->ide = $this->dom->createElement('ide'); |
||
1009 | $this->dom->addChild( |
||
1010 | $this->ide, |
||
1011 | 'cUF', |
||
1012 | $std->cUF, |
||
1013 | true, |
||
1014 | $identificador . 'Código da UF do emitente do CT-e' |
||
1015 | ); |
||
1016 | $this->dom->addChild( |
||
1017 | $this->ide, |
||
1018 | 'cCT', |
||
1019 | $std->cCT, |
||
1020 | true, |
||
1021 | $identificador . 'Código numérico que compõe a Chave de Acesso' |
||
1022 | ); |
||
1023 | $this->dom->addChild( |
||
1024 | $this->ide, |
||
1025 | 'CFOP', |
||
1026 | $std->CFOP, |
||
1027 | true, |
||
1028 | $identificador . 'Código Fiscal de Operações e Prestações' |
||
1029 | ); |
||
1030 | $this->dom->addChild( |
||
1031 | $this->ide, |
||
1032 | 'natOp', |
||
1033 | $std->natOp, |
||
1034 | true, |
||
1035 | $identificador . 'Natureza da Operação' |
||
1036 | ); |
||
1037 | $this->dom->addChild( |
||
1038 | $this->ide, |
||
1039 | 'mod', |
||
1040 | $std->mod, |
||
1041 | true, |
||
1042 | $identificador . 'Modelo do documento fiscal' |
||
1043 | ); |
||
1044 | $this->mod = $std->mod; |
||
1045 | $this->dom->addChild( |
||
1046 | $this->ide, |
||
1047 | 'serie', |
||
1048 | $std->serie, |
||
1049 | true, |
||
1050 | $identificador . 'Série do CT-e' |
||
1051 | ); |
||
1052 | $this->dom->addChild( |
||
1053 | $this->ide, |
||
1054 | 'nCT', |
||
1055 | $std->nCT, |
||
1056 | true, |
||
1057 | $identificador . 'Número do CT-e' |
||
1058 | ); |
||
1059 | $this->dom->addChild( |
||
1060 | $this->ide, |
||
1061 | 'dhEmi', |
||
1062 | $std->dhEmi, |
||
1063 | true, |
||
1064 | $identificador . 'Data e hora de emissão do CT-e' |
||
1065 | ); |
||
1066 | $this->dom->addChild( |
||
1067 | $this->ide, |
||
1068 | 'tpImp', |
||
1069 | $std->tpImp, |
||
1070 | true, |
||
1071 | $identificador . 'Formato de impressão do DACTE' |
||
1072 | ); |
||
1073 | $this->dom->addChild( |
||
1074 | $this->ide, |
||
1075 | 'tpEmis', |
||
1076 | $std->tpEmis, |
||
1077 | true, |
||
1078 | $identificador . 'Forma de emissão do CT-e' |
||
1079 | ); |
||
1080 | $this->dom->addChild( |
||
1081 | $this->ide, |
||
1082 | 'cDV', |
||
1083 | $std->cDV, |
||
1084 | true, |
||
1085 | $identificador . 'Digito Verificador da chave de acesso do CT-e' |
||
1086 | ); |
||
1087 | $this->dom->addChild( |
||
1088 | $this->ide, |
||
1089 | 'tpAmb', |
||
1090 | $std->tpAmb, |
||
1091 | true, |
||
1092 | $identificador . 'Tipo do Ambiente' |
||
1093 | ); |
||
1094 | $this->dom->addChild( |
||
1095 | $this->ide, |
||
1096 | 'tpCTe', |
||
1097 | $std->tpCTe, |
||
1098 | true, |
||
1099 | $identificador . 'Tipo do CT-e' |
||
1100 | ); |
||
1101 | $this->dom->addChild( |
||
1102 | $this->ide, |
||
1103 | 'procEmi', |
||
1104 | $std->procEmi, |
||
1105 | true, |
||
1106 | $identificador . 'Identificador do processo de emissão do CT-e' |
||
1107 | ); |
||
1108 | $this->dom->addChild( |
||
1109 | $this->ide, |
||
1110 | 'verProc', |
||
1111 | $std->verProc, |
||
1112 | true, |
||
1113 | $identificador . 'Versão do processo de emissão' |
||
1114 | ); |
||
1115 | $this->dom->addChild( |
||
1116 | $this->ide, |
||
1117 | 'cMunEnv', |
||
1118 | $std->cMunEnv, |
||
1119 | true, |
||
1120 | $identificador . 'Código do Município de envio do CT-e (de onde o documento foi transmitido)' |
||
1121 | ); |
||
1122 | $this->dom->addChild( |
||
1123 | $this->ide, |
||
1124 | 'xMunEnv', |
||
1125 | $std->xMunEnv, |
||
1126 | true, |
||
1127 | $identificador . 'Nome do Município de envio do CT-e (de onde o documento foi transmitido)' |
||
1128 | ); |
||
1129 | $this->dom->addChild( |
||
1130 | $this->ide, |
||
1131 | 'UFEnv', |
||
1132 | $std->UFEnv, |
||
1133 | true, |
||
1134 | $identificador . 'Sigla da UF de envio do CT-e (de onde o documento foi transmitido)' |
||
1135 | ); |
||
1136 | $this->dom->addChild( |
||
1137 | $this->ide, |
||
1138 | 'modal', |
||
1139 | $std->modal, |
||
1140 | true, |
||
1141 | $identificador . 'Modal' |
||
1142 | ); |
||
1143 | $this->modal = $std->modal; |
||
1144 | $this->dom->addChild( |
||
1145 | $this->ide, |
||
1146 | 'tpServ', |
||
1147 | $std->tpServ, |
||
1148 | true, |
||
1149 | $identificador . 'Tipo do Serviço' |
||
1150 | ); |
||
1151 | $this->dom->addChild( |
||
1152 | $this->ide, |
||
1153 | 'indIEToma', |
||
1154 | $std->indIEToma, |
||
1155 | true, |
||
1156 | $identificador . 'Indicador do papel do tomador na prestação do serviço' |
||
1157 | ); |
||
1158 | $this->dom->addChild( |
||
1159 | $this->ide, |
||
1160 | 'cMunIni', |
||
1161 | $std->cMunIni, |
||
1162 | false, |
||
1163 | $identificador . 'Nome do Município do início da prestação' |
||
1164 | ); |
||
1165 | $this->dom->addChild( |
||
1166 | $this->ide, |
||
1167 | 'xMunIni', |
||
1168 | $std->xMunIni, |
||
1169 | false, |
||
1170 | $identificador . 'Nome do Município do início da prestação' |
||
1171 | ); |
||
1172 | $this->dom->addChild( |
||
1173 | $this->ide, |
||
1174 | 'UFIni', |
||
1175 | $std->UFIni, |
||
1176 | false, |
||
1177 | $identificador . 'UF do início da prestação' |
||
1178 | ); |
||
1179 | $this->dom->addChild( |
||
1180 | $this->ide, |
||
1181 | 'cMunFim', |
||
1182 | $std->cMunFim, |
||
1183 | false, |
||
1184 | $identificador . 'Código do Município de término da prestação' |
||
1185 | ); |
||
1186 | $this->dom->addChild( |
||
1187 | $this->ide, |
||
1188 | 'xMunFim', |
||
1189 | $std->xMunFim, |
||
1190 | false, |
||
1191 | $identificador . 'Nome do Município do término da prestação' |
||
1192 | ); |
||
1193 | $this->dom->addChild( |
||
1194 | $this->ide, |
||
1195 | 'UFFim', |
||
1196 | $std->UFFim, |
||
1197 | false, |
||
1198 | $identificador . 'UF do término da prestação' |
||
1199 | ); |
||
1200 | |||
1201 | $this->dom->addChild( |
||
1202 | $this->ide, |
||
1203 | 'dhCont', |
||
1204 | $std->dhCont, |
||
1205 | false, |
||
1206 | $identificador . 'Data e Hora da entrada em contingência' |
||
1207 | ); |
||
1208 | $this->dom->addChild( |
||
1209 | $this->ide, |
||
1210 | 'xJust', |
||
1211 | $std->xJust, |
||
1212 | false, |
||
1213 | $identificador . 'Justificativa da entrada em contingência' |
||
1214 | ); |
||
1215 | $this->tpServ = $std->tpServ; |
||
1216 | return $this->ide; |
||
1217 | } |
||
1218 | |||
1219 | public function taginfPercurso($std) |
||
1220 | { |
||
1221 | $identificador = '#4 <infPercurso> - '; |
||
1222 | $this->infPercurso[] = $this->dom->createElement('infPercurso'); |
||
1223 | $posicao = (integer)count($this->infPercurso) - 1; |
||
1224 | $this->dom->addChild( |
||
1225 | $this->infPercurso[$posicao], |
||
1226 | 'UFPer', |
||
1227 | $std->uf, |
||
1228 | true, |
||
1229 | $identificador . 'Código da UF do percurso' |
||
1230 | ); |
||
1231 | |||
1232 | return $this->infPercurso[$posicao]; |
||
1233 | } |
||
1234 | |||
1235 | /** |
||
1236 | * Gera as tags para o elemento: toma3 (Indicador do "papel" do tomador do serviço no CT-e) |
||
1237 | * e adiciona ao grupo ide |
||
1238 | * #35 |
||
1239 | * Nível: 2 |
||
1240 | * @param string $toma Tomador do Serviço |
||
0 ignored issues
–
show
There is no parameter named
$toma . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not.
Loading history...
|
|||
1241 | * @param stdClass $std |
||
1242 | * @return \DOMElement |
||
1243 | */ |
||
1244 | public function tagtoma3($std) |
||
1245 | { |
||
1246 | $identificador = '#35 <toma3> - '; |
||
1247 | $this->toma3 = $this->dom->createElement('toma3'); |
||
1248 | $this->dom->addChild( |
||
1249 | $this->toma3, |
||
1250 | 'toma', |
||
1251 | $std->toma, |
||
1252 | true, |
||
1253 | $identificador . 'Tomador do Serviço' |
||
1254 | ); |
||
1255 | return $this->toma3; |
||
1256 | } |
||
1257 | |||
1258 | /** |
||
1259 | * Gera as tags para o elemento: toma4 (Indicador do "papel" do tomador |
||
1260 | * do serviço no CT-e) e adiciona ao grupo ide |
||
1261 | * #37 |
||
1262 | * Nível: 2 |
||
1263 | * @param stdClass $std |
||
1264 | * @return \DOMElement |
||
1265 | */ |
||
1266 | public function tagtoma4($std) |
||
1267 | { |
||
1268 | $identificador = '#37 <toma4> - '; |
||
1269 | $this->toma4 = $this->dom->createElement('toma4'); |
||
1270 | $this->dom->addChild( |
||
1271 | $this->toma4, |
||
1272 | 'toma', |
||
1273 | $std->toma, |
||
1274 | true, |
||
1275 | $identificador . 'Tomador do Serviço' |
||
1276 | ); |
||
1277 | if ($std->CNPJ != '') { |
||
1278 | $this->dom->addChild( |
||
1279 | $this->toma4, |
||
1280 | 'CNPJ', |
||
1281 | $std->CNPJ, |
||
1282 | true, |
||
1283 | $identificador . 'Número do CNPJ' |
||
1284 | ); |
||
1285 | } elseif ($std->CPF != '') { |
||
1286 | $this->dom->addChild( |
||
1287 | $this->toma4, |
||
1288 | 'CPF', |
||
1289 | $std->CPF, |
||
1290 | true, |
||
1291 | $identificador . 'Número do CPF' |
||
1292 | ); |
||
1293 | } else { |
||
1294 | $this->dom->addChild( |
||
1295 | $this->toma4, |
||
1296 | 'CNPJ', |
||
1297 | $std->CNPJ, |
||
1298 | true, |
||
1299 | $identificador . 'Número do CNPJ' |
||
1300 | ); |
||
1301 | $this->dom->addChild( |
||
1302 | $this->toma4, |
||
1303 | 'CPF', |
||
1304 | $std->CPF, |
||
1305 | true, |
||
1306 | $identificador . 'Número do CPF' |
||
1307 | ); |
||
1308 | } |
||
1309 | $this->dom->addChild( |
||
1310 | $this->toma4, |
||
1311 | 'IE', |
||
1312 | $std->IE, |
||
1313 | false, |
||
1314 | $identificador . 'Inscrição Estadual' |
||
1315 | ); |
||
1316 | $this->dom->addChild( |
||
1317 | $this->toma4, |
||
1318 | 'xNome', |
||
1319 | $std->xNome, |
||
1320 | true, |
||
1321 | $identificador . 'Razão Social ou Nome' |
||
1322 | ); |
||
1323 | $this->dom->addChild( |
||
1324 | $this->toma4, |
||
1325 | 'xFant', |
||
1326 | $std->xFant, |
||
1327 | false, |
||
1328 | $identificador . 'Nome Fantasia' |
||
1329 | ); |
||
1330 | $this->dom->addChild( |
||
1331 | $this->toma4, |
||
1332 | 'fone', |
||
1333 | $std->fone, |
||
1334 | false, |
||
1335 | $identificador . 'Telefone' |
||
1336 | ); |
||
1337 | $this->dom->addChild( |
||
1338 | $this->toma4, |
||
1339 | 'email', |
||
1340 | $std->email, |
||
1341 | false, |
||
1342 | $identificador . 'Endereço de email' |
||
1343 | ); |
||
1344 | return $this->toma4; |
||
1345 | } |
||
1346 | |||
1347 | /** |
||
1348 | * Gera as tags para o elemento: toma4 (Indicador do "papel" do tomador |
||
1349 | * do serviço no CT-e OS) e adiciona ao grupo ide |
||
1350 | * #37 |
||
1351 | * Nível: 2 |
||
1352 | * |
||
1353 | * @return \DOMElement |
||
1354 | */ |
||
1355 | public function tagtoma4CTeOS($std) |
||
1356 | { |
||
1357 | $identificador = '#37 <toma> - '; |
||
1358 | $this->toma = $this->dom->createElement('toma'); |
||
1359 | if ($std->CNPJ != '') { |
||
1360 | $this->dom->addChild( |
||
1361 | $this->toma, |
||
1362 | 'CNPJ', |
||
1363 | $std->CNPJ, |
||
1364 | true, |
||
1365 | $identificador . 'Número do CNPJ' |
||
1366 | ); |
||
1367 | } elseif ($std->CPF != '') { |
||
1368 | $this->dom->addChild( |
||
1369 | $this->toma, |
||
1370 | 'CPF', |
||
1371 | $std->CPF, |
||
1372 | true, |
||
1373 | $identificador . 'Número do CPF' |
||
1374 | ); |
||
1375 | } else { |
||
1376 | $this->dom->addChild( |
||
1377 | $this->toma, |
||
1378 | 'CNPJ', |
||
1379 | $std->CNPJ, |
||
1380 | true, |
||
1381 | $identificador . 'Número do CNPJ' |
||
1382 | ); |
||
1383 | $this->dom->addChild( |
||
1384 | $this->toma, |
||
1385 | 'CPF', |
||
1386 | $std->CPF, |
||
1387 | true, |
||
1388 | $identificador . 'Número do CPF' |
||
1389 | ); |
||
1390 | } |
||
1391 | $this->dom->addChild( |
||
1392 | $this->toma, |
||
1393 | 'IE', |
||
1394 | $std->IE, |
||
1395 | false, |
||
1396 | $identificador . 'Inscrição Estadual' |
||
1397 | ); |
||
1398 | $this->dom->addChild( |
||
1399 | $this->toma, |
||
1400 | 'xNome', |
||
1401 | $std->xNome, |
||
1402 | true, |
||
1403 | $identificador . 'Razão Social ou Nome' |
||
1404 | ); |
||
1405 | $this->dom->addChild( |
||
1406 | $this->toma, |
||
1407 | 'xFant', |
||
1408 | $std->xFant, |
||
1409 | false, |
||
1410 | $identificador . 'Nome Fantasia' |
||
1411 | ); |
||
1412 | $this->dom->addChild( |
||
1413 | $this->toma, |
||
1414 | 'fone', |
||
1415 | $std->fone, |
||
1416 | false, |
||
1417 | $identificador . 'Telefone' |
||
1418 | ); |
||
1419 | |||
1420 | |||
1421 | //Endereço Tomador |
||
1422 | $this->enderToma = $this->dom->createElement('enderToma'); |
||
1423 | $this->dom->addChild( |
||
1424 | $this->enderToma, |
||
1425 | 'xLgr', |
||
1426 | $std->xLgr, |
||
1427 | true, |
||
1428 | $identificador . 'Logradouro' |
||
1429 | ); |
||
1430 | $this->dom->addChild( |
||
1431 | $this->enderToma, |
||
1432 | 'nro', |
||
1433 | $std->nro, |
||
1434 | true, |
||
1435 | $identificador . 'Número' |
||
1436 | ); |
||
1437 | $this->dom->addChild( |
||
1438 | $this->enderToma, |
||
1439 | 'xCpl', |
||
1440 | $std->xCpl, |
||
1441 | false, |
||
1442 | $identificador . 'Complemento' |
||
1443 | ); |
||
1444 | $this->dom->addChild( |
||
1445 | $this->enderToma, |
||
1446 | 'xBairro', |
||
1447 | $std->xBairro, |
||
1448 | true, |
||
1449 | $identificador . 'Bairro' |
||
1450 | ); |
||
1451 | $this->dom->addChild( |
||
1452 | $this->enderToma, |
||
1453 | 'cMun', |
||
1454 | $std->cMun, |
||
1455 | true, |
||
1456 | $identificador . 'Código do município (utilizar a tabela do IBGE)' |
||
1457 | ); |
||
1458 | $this->dom->addChild( |
||
1459 | $this->enderToma, |
||
1460 | 'xMun', |
||
1461 | $std->xMun, |
||
1462 | true, |
||
1463 | $identificador . 'Nome do município' |
||
1464 | ); |
||
1465 | $this->dom->addChild( |
||
1466 | $this->enderToma, |
||
1467 | 'CEP', |
||
1468 | $std->CEP, |
||
1469 | false, |
||
1470 | $identificador . 'CEP' |
||
1471 | ); |
||
1472 | $this->dom->addChild( |
||
1473 | $this->enderToma, |
||
1474 | 'UF', |
||
1475 | $std->UF, |
||
1476 | true, |
||
1477 | $identificador . 'Sigla da UF' |
||
1478 | ); |
||
1479 | $this->dom->addChild( |
||
1480 | $this->enderToma, |
||
1481 | 'cPais', |
||
1482 | $std->cPais, |
||
1483 | false, |
||
1484 | $identificador . 'Código do país' |
||
1485 | ); |
||
1486 | $this->dom->addChild( |
||
1487 | $this->enderToma, |
||
1488 | 'xPais', |
||
1489 | $std->xPais, |
||
1490 | false, |
||
1491 | $identificador . 'Nome do país' |
||
1492 | ); |
||
1493 | |||
1494 | $this->dom->appChild($this->toma, $this->enderToma, 'Falta tag "enderToma"'); |
||
1495 | |||
1496 | |||
1497 | $this->dom->addChild( |
||
1498 | $this->toma, |
||
1499 | 'email', |
||
1500 | $std->email, |
||
1501 | false, |
||
1502 | $identificador . 'Endereço de email' |
||
1503 | ); |
||
1504 | return $this->toma; |
||
1505 | } |
||
1506 | |||
1507 | /** |
||
1508 | * Gera as tags para o elemento: "enderToma" (Dados do endereço) e adiciona ao grupo "toma4" |
||
1509 | * #45 |
||
1510 | * Nível: 3 |
||
1511 | * |
||
1512 | * @return \DOMElement |
||
1513 | */ |
||
1514 | public function tagenderToma($std) |
||
1515 | { |
||
1516 | $identificador = '#45 <enderToma> - '; |
||
1517 | $this->enderToma = $this->dom->createElement('enderToma'); |
||
1518 | $this->dom->addChild( |
||
1519 | $this->enderToma, |
||
1520 | 'xLgr', |
||
1521 | $std->xLgr, |
||
1522 | true, |
||
1523 | $identificador . 'Logradouro' |
||
1524 | ); |
||
1525 | $this->dom->addChild( |
||
1526 | $this->enderToma, |
||
1527 | 'nro', |
||
1528 | $std->nro, |
||
1529 | true, |
||
1530 | $identificador . 'Número' |
||
1531 | ); |
||
1532 | $this->dom->addChild( |
||
1533 | $this->enderToma, |
||
1534 | 'xCpl', |
||
1535 | $std->xCpl, |
||
1536 | false, |
||
1537 | $identificador . 'Complemento' |
||
1538 | ); |
||
1539 | $this->dom->addChild( |
||
1540 | $this->enderToma, |
||
1541 | 'xBairro', |
||
1542 | $std->xBairro, |
||
1543 | true, |
||
1544 | $identificador . 'Bairro' |
||
1545 | ); |
||
1546 | $this->dom->addChild( |
||
1547 | $this->enderToma, |
||
1548 | 'cMun', |
||
1549 | $std->cMun, |
||
1550 | true, |
||
1551 | $identificador . 'Código do município (utilizar a tabela do IBGE)' |
||
1552 | ); |
||
1553 | $this->dom->addChild( |
||
1554 | $this->enderToma, |
||
1555 | 'xMun', |
||
1556 | $std->xMun, |
||
1557 | true, |
||
1558 | $identificador . 'Nome do município' |
||
1559 | ); |
||
1560 | $this->dom->addChild( |
||
1561 | $this->enderToma, |
||
1562 | 'CEP', |
||
1563 | $std->CEP, |
||
1564 | false, |
||
1565 | $identificador . 'CEP' |
||
1566 | ); |
||
1567 | $this->dom->addChild( |
||
1568 | $this->enderToma, |
||
1569 | 'UF', |
||
1570 | $std->UF, |
||
1571 | true, |
||
1572 | $identificador . 'Sigla da UF' |
||
1573 | ); |
||
1574 | $this->dom->addChild( |
||
1575 | $this->enderToma, |
||
1576 | 'cPais', |
||
1577 | $std->cPais, |
||
1578 | false, |
||
1579 | $identificador . 'Código do país' |
||
1580 | ); |
||
1581 | $this->dom->addChild( |
||
1582 | $this->enderToma, |
||
1583 | 'xPais', |
||
1584 | $std->xPais, |
||
1585 | false, |
||
1586 | $identificador . 'Nome do país' |
||
1587 | ); |
||
1588 | |||
1589 | $node = $this->toma4->getElementsByTagName("email")->item(0); |
||
1590 | $this->toma4->insertBefore($this->enderToma, $node); |
||
1591 | return $this->enderToma; |
||
1592 | } |
||
1593 | |||
1594 | /** |
||
1595 | * Gera as tags para o elemento: "compl" (Dados complementares do CT-e para fins operacionais ou comerciais) |
||
1596 | * #59 |
||
1597 | * Nível: 1 |
||
1598 | * |
||
1599 | * @return \DOMElement |
||
1600 | */ |
||
1601 | public function tagcompl($std) |
||
1602 | { |
||
1603 | $identificador = '#59 <compl> - '; |
||
1604 | if ($this->compl == '') { |
||
1605 | $this->compl = $this->dom->createElement('compl'); |
||
1606 | } |
||
1607 | $this->dom->addChild( |
||
1608 | $this->compl, |
||
1609 | 'xCaracAd', |
||
1610 | $std->xCaracAd, |
||
1611 | false, |
||
1612 | $identificador . 'Característica adicional do transporte' |
||
1613 | ); |
||
1614 | $this->dom->addChild( |
||
1615 | $this->compl, |
||
1616 | 'xCaracSer', |
||
1617 | $std->xCaracSer, |
||
1618 | false, |
||
1619 | $identificador . 'Característica adicional do serviço' |
||
1620 | ); |
||
1621 | $this->dom->addChild( |
||
1622 | $this->compl, |
||
1623 | 'xEmi', |
||
1624 | $std->xEmi, |
||
1625 | false, |
||
1626 | $identificador . 'Funcionário emissor do CTe' |
||
1627 | ); |
||
1628 | $this->dom->addChild( |
||
1629 | $this->compl, |
||
1630 | 'origCalc', |
||
1631 | $std->origCalc, |
||
1632 | false, |
||
1633 | $identificador . 'Município de origem para efeito de cálculo do frete' |
||
1634 | ); |
||
1635 | $this->dom->addChild( |
||
1636 | $this->compl, |
||
1637 | 'destCalc', |
||
1638 | $std->destCalc, |
||
1639 | false, |
||
1640 | $identificador . 'Município de destino para efeito de cálculo do frete' |
||
1641 | ); |
||
1642 | $this->dom->addChild( |
||
1643 | $this->compl, |
||
1644 | 'xObs', |
||
1645 | $std->xObs, |
||
1646 | false, |
||
1647 | $identificador . 'Observações Gerais' |
||
1648 | ); |
||
1649 | return $this->compl; |
||
1650 | } |
||
1651 | |||
1652 | /** |
||
1653 | * Gera as tags para o elemento: "compl" (Dados complementares do CT-e OS para fins operacionais ou comerciais) |
||
1654 | * #59 |
||
1655 | * Nível: 1 |
||
1656 | * |
||
1657 | * @return \DOMElement |
||
1658 | */ |
||
1659 | public function tagcomplCTeOs($std) |
||
1660 | { |
||
1661 | $identificador = '#59 <compl> - '; |
||
1662 | $this->compl = $this->dom->createElement('compl'); |
||
1663 | $this->dom->addChild( |
||
1664 | $this->compl, |
||
1665 | 'xCaracAd', |
||
1666 | $std->xCaracAd, |
||
1667 | false, |
||
1668 | $identificador . 'Característica adicional do transporte' |
||
1669 | ); |
||
1670 | $this->dom->addChild( |
||
1671 | $this->compl, |
||
1672 | 'xCaracSer', |
||
1673 | $std->xCaracSer, |
||
1674 | false, |
||
1675 | $identificador . 'Característica adicional do serviço' |
||
1676 | ); |
||
1677 | $this->dom->addChild( |
||
1678 | $this->compl, |
||
1679 | 'xEmi', |
||
1680 | $std->xEmi, |
||
1681 | false, |
||
1682 | $identificador . 'Funcionário emissor do CTe' |
||
1683 | ); |
||
1684 | $this->dom->addChild( |
||
1685 | $this->compl, |
||
1686 | 'xObs', |
||
1687 | $std->xObs, |
||
1688 | false, |
||
1689 | $identificador . 'Observações Gerais' |
||
1690 | ); |
||
1691 | return $this->compl; |
||
1692 | } |
||
1693 | |||
1694 | /** |
||
1695 | * Gera as tags para o elemento: "fluxo" (Previsão do fluxo da carga) |
||
1696 | * #63 |
||
1697 | * Nível: 2 |
||
1698 | * Os parâmetros para esta função são todos os elementos da tag "fluxo" do |
||
1699 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
1700 | * |
||
1701 | * @return \DOMElement |
||
1702 | */ |
||
1703 | public function tagfluxo($std) |
||
1704 | { |
||
1705 | $identificador = '#63 <fluxo> - '; |
||
1706 | $this->fluxo = $this->dom->createElement('fluxo'); |
||
1707 | $this->dom->addChild( |
||
1708 | $this->fluxo, |
||
1709 | 'xOrig', |
||
1710 | $std->xOrig, |
||
1711 | false, |
||
1712 | $identificador . 'Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem' |
||
1713 | ); |
||
1714 | $this->dom->addChild( |
||
1715 | $this->fluxo, |
||
1716 | 'xDest', |
||
1717 | $std->xDest, |
||
1718 | false, |
||
1719 | $identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino' |
||
1720 | ); |
||
1721 | $this->dom->addChild( |
||
1722 | $this->fluxo, |
||
1723 | 'xRota', |
||
1724 | $std->xRota, |
||
1725 | false, |
||
1726 | $identificador . 'Código da Rota de Entrega' |
||
1727 | ); |
||
1728 | return $this->fluxo; |
||
1729 | } |
||
1730 | |||
1731 | /** |
||
1732 | * Gera as tags para o elemento: "pass" |
||
1733 | * #65 |
||
1734 | * Nível: 3 |
||
1735 | * |
||
1736 | * @return \DOMElement |
||
1737 | */ |
||
1738 | public function tagpass($std) |
||
1739 | { |
||
1740 | $identificador = '#65 <pass> - '; |
||
1741 | $this->pass[] = $this->dom->createElement('pass'); |
||
1742 | $posicao = (integer) count($this->pass) - 1; |
||
1743 | $this->dom->addChild( |
||
1744 | $this->pass[$posicao], |
||
1745 | 'xPass', |
||
1746 | $std->xPass, |
||
1747 | false, |
||
1748 | $identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem' |
||
1749 | ); |
||
1750 | return $this->pass[$posicao]; |
||
1751 | } |
||
1752 | |||
1753 | /** |
||
1754 | * Gera as tags para o elemento: "semData" (Entrega sem data definida) |
||
1755 | * #70 |
||
1756 | * Nível: 3 |
||
1757 | * |
||
1758 | * @return \DOMElement |
||
1759 | */ |
||
1760 | public function tagsemData($std) |
||
1761 | { |
||
1762 | $identificador = '#70 <semData> - '; |
||
1763 | $this->semData = $this->dom->createElement('semData'); |
||
1764 | $this->dom->addChild( |
||
1765 | $this->semData, |
||
1766 | 'tpPer', |
||
1767 | $std->tpPer, |
||
1768 | true, |
||
1769 | $identificador . 'Tipo de data/período programado para entrega' |
||
1770 | ); |
||
1771 | return $this->semData; |
||
1772 | } |
||
1773 | |||
1774 | /** |
||
1775 | * Gera as tags para o elemento: "comData" (Entrega com data definida) |
||
1776 | * #72 |
||
1777 | * Nível: 3 |
||
1778 | * |
||
1779 | * @return \DOMElement |
||
1780 | */ |
||
1781 | public function tagcomData($std) |
||
1782 | { |
||
1783 | $identificador = '#72 <comData> - '; |
||
1784 | $this->comData = $this->dom->createElement('comData'); |
||
1785 | $this->dom->addChild( |
||
1786 | $this->comData, |
||
1787 | 'tpPer', |
||
1788 | $std->tpPer, |
||
1789 | true, |
||
1790 | $identificador . 'Tipo de data/período programado para entrega' |
||
1791 | ); |
||
1792 | $this->dom->addChild( |
||
1793 | $this->comData, |
||
1794 | 'dProg', |
||
1795 | $std->dProg, |
||
1796 | true, |
||
1797 | $identificador . 'Data programada' |
||
1798 | ); |
||
1799 | return $this->comData; |
||
1800 | } |
||
1801 | |||
1802 | /** |
||
1803 | * Gera as tags para o elemento: "noPeriodo" (Entrega no período definido) |
||
1804 | * #75 |
||
1805 | * Nível: 3 |
||
1806 | * |
||
1807 | * @return \DOMElement |
||
1808 | */ |
||
1809 | public function tagnoPeriodo($std) |
||
1810 | { |
||
1811 | $identificador = '#75 <noPeriodo> - '; |
||
1812 | $this->noPeriodo = $this->dom->createElement('noPeriodo'); |
||
1813 | $this->dom->addChild( |
||
1814 | $this->noPeriodo, |
||
1815 | 'tpPer', |
||
1816 | $std->tpPer, |
||
1817 | true, |
||
1818 | $identificador . 'Tipo de data/período programado para entrega' |
||
1819 | ); |
||
1820 | $this->dom->addChild( |
||
1821 | $this->noPeriodo, |
||
1822 | 'dIni', |
||
1823 | $std->dIni, |
||
1824 | true, |
||
1825 | $identificador . 'Data inicial' |
||
1826 | ); |
||
1827 | $this->dom->addChild( |
||
1828 | $this->noPeriodo, |
||
1829 | 'dFim', |
||
1830 | $std->dFim, |
||
1831 | true, |
||
1832 | $identificador . 'Data final' |
||
1833 | ); |
||
1834 | return $this->noPeriodo; |
||
1835 | } |
||
1836 | |||
1837 | /** |
||
1838 | * Gera as tags para o elemento: "semHora" (Entrega sem hora definida) |
||
1839 | * #79 |
||
1840 | * Nível: 3 |
||
1841 | * Os parâmetros para esta função são todos os elementos da tag "semHora" do |
||
1842 | * tipo elemento (Ele = E|CE|A) e nível 4 |
||
1843 | * |
||
1844 | * @return \DOMElement |
||
1845 | */ |
||
1846 | public function tagsemHora($std) |
||
1847 | { |
||
1848 | $identificador = '#79 <semHora> - '; |
||
1849 | $this->semHora = $this->dom->createElement('semHora'); |
||
1850 | $this->dom->addChild( |
||
1851 | $this->semHora, |
||
1852 | 'tpHor', |
||
1853 | $std->tpHor, |
||
1854 | true, |
||
1855 | $identificador . 'Tipo de hora' |
||
1856 | ); |
||
1857 | return $this->semHora; |
||
1858 | } |
||
1859 | |||
1860 | /** |
||
1861 | * Gera as tags para o elemento: "comHora" (Entrega sem hora definida) |
||
1862 | * # = 81 |
||
1863 | * Nível = 3 |
||
1864 | * Os parâmetros para esta função são todos os elementos da tag "comHora" do |
||
1865 | * tipo elemento (Ele = E|CE|A) e nível 4 |
||
1866 | * |
||
1867 | * @return \DOMElement |
||
1868 | */ |
||
1869 | public function tagcomHora($std) |
||
1870 | { |
||
1871 | $identificador = '#81 <comHora> - '; |
||
1872 | $this->comHora = $this->dom->createElement('comHora'); |
||
1873 | $this->dom->addChild( |
||
1874 | $this->comHora, |
||
1875 | 'tpHor', |
||
1876 | $std->tpHor, |
||
1877 | true, |
||
1878 | $identificador . 'Tipo de hora' |
||
1879 | ); |
||
1880 | $this->dom->addChild( |
||
1881 | $this->comHora, |
||
1882 | 'hProg', |
||
1883 | $std->hProg, |
||
1884 | true, |
||
1885 | $identificador . 'Hora programada' |
||
1886 | ); |
||
1887 | return $this->comHora; |
||
1888 | } |
||
1889 | |||
1890 | /** |
||
1891 | * Gera as tags para o elemento: "noInter" (Entrega no intervalo de horário definido) |
||
1892 | * #84 |
||
1893 | * Nível: 3 |
||
1894 | * Os parâmetros para esta função são todos os elementos da tag "noInter" do |
||
1895 | * tipo elemento (Ele = E|CE|A) e nível 4 |
||
1896 | * |
||
1897 | * @return \DOMElement |
||
1898 | */ |
||
1899 | public function tagnoInter($std) |
||
1900 | { |
||
1901 | $identificador = '#84 <noInter> - '; |
||
1902 | $this->noInter = $this->dom->createElement('noInter'); |
||
1903 | $this->dom->addChild( |
||
1904 | $this->noInter, |
||
1905 | 'tpHor', |
||
1906 | $std->tpHor, |
||
1907 | true, |
||
1908 | $identificador . 'Tipo de hora' |
||
1909 | ); |
||
1910 | $this->dom->addChild( |
||
1911 | $this->noInter, |
||
1912 | 'hIni', |
||
1913 | $std->hIni, |
||
1914 | true, |
||
1915 | $identificador . 'Hora inicial' |
||
1916 | ); |
||
1917 | $this->dom->addChild( |
||
1918 | $this->noInter, |
||
1919 | 'hFim', |
||
1920 | $std->hFim, |
||
1921 | true, |
||
1922 | $identificador . 'Hora final' |
||
1923 | ); |
||
1924 | return $this->noInter; |
||
1925 | } |
||
1926 | |||
1927 | /** |
||
1928 | * Gera as tags para o elemento: "ObsCont" (Campo de uso livre do contribuinte) |
||
1929 | * #91 |
||
1930 | * Nível: 2 |
||
1931 | * Os parâmetros para esta função são todos os elementos da tag "ObsCont" do |
||
1932 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
1933 | * |
||
1934 | * @return boolean |
||
1935 | */ |
||
1936 | public function tagobsCont($std) |
||
1937 | { |
||
1938 | $identificador = '#91 <ObsCont> - '; |
||
1939 | if (count($this->obsCont) <= 10) { |
||
1940 | $this->obsCont[] = $this->dom->createElement('ObsCont'); |
||
1941 | $posicao = (integer) count($this->obsCont) - 1; |
||
1942 | $this->obsCont[$posicao]->setAttribute('xCampo', $std->xCampo); |
||
1943 | $this->dom->addChild( |
||
1944 | $this->obsCont[$posicao], |
||
1945 | 'xTexto', |
||
1946 | $std->xTexto, |
||
1947 | true, |
||
1948 | $identificador . 'Conteúdo do campo' |
||
1949 | ); |
||
1950 | return true; |
||
1951 | } |
||
1952 | $this->erros[] = array( |
||
1953 | 'tag' => (string) '<ObsCont>', |
||
1954 | 'desc' => (string) 'Campo de uso livre do contribuinte', |
||
1955 | 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
||
1956 | ); |
||
1957 | return false; |
||
1958 | } |
||
1959 | |||
1960 | /** |
||
1961 | * Gera as tags para o elemento: "ObsFisco" (Campo de uso livre do contribuinte) |
||
1962 | * #94 |
||
1963 | * Nível: 2 |
||
1964 | * Os parâmetros para esta função são todos os elementos da tag "ObsFisco" do tipo |
||
1965 | * elemento (Ele = E|CE|A) e nível 3 |
||
1966 | * |
||
1967 | * @return boolean |
||
1968 | */ |
||
1969 | public function tagobsFisco($std) |
||
1970 | { |
||
1971 | $identificador = '#94 <ObsFisco> - '; |
||
1972 | $posicao = (integer) count($this->obsFisco) - 1; |
||
1973 | if (count($this->obsFisco) <= 10) { |
||
1974 | $this->obsFisco[] = $this->dom->createElement('obsFisco'); |
||
1975 | $this->obsFisco[$posicao]->setAttribute('xCampo', $std->xCampo); |
||
1976 | $this->dom->addChild( |
||
1977 | $this->obsFisco[$posicao], |
||
1978 | 'xTexto', |
||
1979 | $std->xTexto, |
||
1980 | true, |
||
1981 | $identificador . 'Conteúdo do campo' |
||
1982 | ); |
||
1983 | return true; |
||
1984 | } |
||
1985 | $this->erros[] = array( |
||
1986 | 'tag' => (string) '<ObsFisco>', |
||
1987 | 'desc' => (string) 'Campo de uso livre do contribuinte', |
||
1988 | 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
||
1989 | ); |
||
1990 | return false; |
||
1991 | } |
||
1992 | |||
1993 | /** |
||
1994 | * Gera as tags para o elemento: "emit" (Identificação do Emitente do CT-e) |
||
1995 | * #97 |
||
1996 | * Nível: 1 |
||
1997 | * Os parâmetros para esta função são todos os elementos da tag "emit" do |
||
1998 | * tipo elemento (Ele = E|CE|A) e nível 2 |
||
1999 | * |
||
2000 | * @return \DOMElement |
||
2001 | */ |
||
2002 | public function tagemit($std) |
||
2003 | { |
||
2004 | $identificador = '#97 <emit> - '; |
||
2005 | $this->emit = $this->dom->createElement('emit'); |
||
2006 | $this->dom->addChild( |
||
2007 | $this->emit, |
||
2008 | 'CNPJ', |
||
2009 | $std->CNPJ, |
||
2010 | true, |
||
2011 | $identificador . 'CNPJ do emitente' |
||
2012 | ); |
||
2013 | $this->dom->addChild( |
||
2014 | $this->emit, |
||
2015 | 'IE', |
||
2016 | Strings::onlyNumbers($std->IE), |
||
2017 | true, |
||
2018 | $identificador . 'Inscrição Estadual do Emitente' |
||
2019 | ); |
||
2020 | $this->dom->addChild( |
||
2021 | $this->emit, |
||
2022 | 'IEST', |
||
2023 | Strings::onlyNumbers($std->IEST), |
||
2024 | false, |
||
2025 | $identificador . 'Inscrição Estadual do Substituto Tributário' |
||
2026 | ); |
||
2027 | $this->dom->addChild( |
||
2028 | $this->emit, |
||
2029 | 'xNome', |
||
2030 | $std->xNome, |
||
2031 | true, |
||
2032 | $identificador . 'Razão social ou Nome do emitente' |
||
2033 | ); |
||
2034 | $this->dom->addChild( |
||
2035 | $this->emit, |
||
2036 | 'xFant', |
||
2037 | $std->xFant, |
||
2038 | false, |
||
2039 | $identificador . 'Nome fantasia' |
||
2040 | ); |
||
2041 | return $this->emit; |
||
2042 | } |
||
2043 | |||
2044 | /** |
||
2045 | * Gera as tags para o elemento: "enderEmit" (Endereço do emitente) |
||
2046 | * #102 |
||
2047 | * Nível: 2 |
||
2048 | * Os parâmetros para esta função são todos os elementos da tag "enderEmit" do |
||
2049 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
2050 | * |
||
2051 | * @return \DOMElement |
||
2052 | */ |
||
2053 | public function tagenderEmit($std) |
||
2054 | { |
||
2055 | $identificador = '#102 <enderEmit> - '; |
||
2056 | $this->enderEmit = $this->dom->createElement('enderEmit'); |
||
2057 | $this->dom->addChild( |
||
2058 | $this->enderEmit, |
||
2059 | 'xLgr', |
||
2060 | $std->xLgr, |
||
2061 | true, |
||
2062 | $identificador . 'Logradouro' |
||
2063 | ); |
||
2064 | $this->dom->addChild( |
||
2065 | $this->enderEmit, |
||
2066 | 'nro', |
||
2067 | $std->nro, |
||
2068 | true, |
||
2069 | $identificador . 'Número' |
||
2070 | ); |
||
2071 | $this->dom->addChild( |
||
2072 | $this->enderEmit, |
||
2073 | 'xCpl', |
||
2074 | $std->xCpl, |
||
2075 | false, |
||
2076 | $identificador . 'Complemento' |
||
2077 | ); |
||
2078 | $this->dom->addChild( |
||
2079 | $this->enderEmit, |
||
2080 | 'xBairro', |
||
2081 | $std->xBairro, |
||
2082 | true, |
||
2083 | $identificador . 'Bairro' |
||
2084 | ); |
||
2085 | $this->dom->addChild( |
||
2086 | $this->enderEmit, |
||
2087 | 'cMun', |
||
2088 | $std->cMun, |
||
2089 | true, |
||
2090 | $identificador . 'Código do município' |
||
2091 | ); |
||
2092 | $this->dom->addChild( |
||
2093 | $this->enderEmit, |
||
2094 | 'xMun', |
||
2095 | $std->xMun, |
||
2096 | true, |
||
2097 | $identificador . 'Nome do município' |
||
2098 | ); |
||
2099 | $this->dom->addChild( |
||
2100 | $this->enderEmit, |
||
2101 | 'CEP', |
||
2102 | $std->CEP, |
||
2103 | false, |
||
2104 | $identificador . 'CEP' |
||
2105 | ); |
||
2106 | $this->dom->addChild( |
||
2107 | $this->enderEmit, |
||
2108 | 'UF', |
||
2109 | $std->UF, |
||
2110 | true, |
||
2111 | $identificador . 'Sigla da UF' |
||
2112 | ); |
||
2113 | $this->dom->addChild( |
||
2114 | $this->enderEmit, |
||
2115 | 'fone', |
||
2116 | $std->fone, |
||
2117 | false, |
||
2118 | $identificador . 'Telefone' |
||
2119 | ); |
||
2120 | return $this->enderEmit; |
||
2121 | } |
||
2122 | |||
2123 | /** |
||
2124 | * Gera as tags para o elemento: "rem" (Informações do Remetente das mercadorias |
||
2125 | * transportadas pelo CT-e) |
||
2126 | * #112 |
||
2127 | * Nível = 1 |
||
2128 | * Os parâmetros para esta função são todos os elementos da tag "rem" do |
||
2129 | * tipo elemento (Ele = E|CE|A) e nível 2 |
||
2130 | * |
||
2131 | * @return \DOMElement |
||
2132 | */ |
||
2133 | public function tagrem($std) |
||
2134 | { |
||
2135 | $identificador = '#97 <rem> - '; |
||
2136 | $this->rem = $this->dom->createElement('rem'); |
||
2137 | if ($std->CNPJ != '') { |
||
2138 | $this->dom->addChild( |
||
2139 | $this->rem, |
||
2140 | 'CNPJ', |
||
2141 | $std->CNPJ, |
||
2142 | true, |
||
2143 | $identificador . 'CNPJ do Remente' |
||
2144 | ); |
||
2145 | } elseif ($std->CPF != '') { |
||
2146 | $this->dom->addChild( |
||
2147 | $this->rem, |
||
2148 | 'CPF', |
||
2149 | $std->CPF, |
||
2150 | true, |
||
2151 | $identificador . 'CPF do Remente' |
||
2152 | ); |
||
2153 | } else { |
||
2154 | $this->dom->addChild( |
||
2155 | $this->rem, |
||
2156 | 'CNPJ', |
||
2157 | $std->CNPJ, |
||
2158 | true, |
||
2159 | $identificador . 'CNPJ do Remente' |
||
2160 | ); |
||
2161 | $this->dom->addChild( |
||
2162 | $this->rem, |
||
2163 | 'CPF', |
||
2164 | $std->CPF, |
||
2165 | true, |
||
2166 | $identificador . 'CPF do remente' |
||
2167 | ); |
||
2168 | } |
||
2169 | $this->dom->addChild( |
||
2170 | $this->rem, |
||
2171 | 'IE', |
||
2172 | $std->IE, |
||
2173 | true, |
||
2174 | $identificador . 'Inscrição Estadual do remente' |
||
2175 | ); |
||
2176 | $xNome = $std->xNome; |
||
2177 | if ($this->tpAmb == '2') { |
||
2178 | $xNome = 'CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL'; |
||
2179 | } |
||
2180 | $this->dom->addChild( |
||
2181 | $this->rem, |
||
2182 | 'xNome', |
||
2183 | Strings::replaceSpecialsChars(substr(trim($xNome), 0, 60)), |
||
2184 | true, |
||
2185 | $identificador . 'Razão social ou Nome do remente' |
||
2186 | ); |
||
2187 | $this->dom->addChild( |
||
2188 | $this->rem, |
||
2189 | 'xFant', |
||
2190 | $std->xFant, |
||
2191 | false, |
||
2192 | $identificador . 'Nome fantasia' |
||
2193 | ); |
||
2194 | $this->dom->addChild( |
||
2195 | $this->rem, |
||
2196 | 'fone', |
||
2197 | $std->fone, |
||
2198 | false, |
||
2199 | $identificador . 'Telefone' |
||
2200 | ); |
||
2201 | $this->dom->addChild( |
||
2202 | $this->rem, |
||
2203 | 'email', |
||
2204 | $std->email, |
||
2205 | false, |
||
2206 | $identificador . 'Endereço de email' |
||
2207 | ); |
||
2208 | return $this->rem; |
||
2209 | } |
||
2210 | |||
2211 | /** |
||
2212 | * Gera as tags para o elemento: "enderReme" (Dados do endereço) |
||
2213 | * #120 |
||
2214 | * Nível: 2 |
||
2215 | * Os parâmetros para esta função são todos os elementos da tag "enderReme" do |
||
2216 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
2217 | * |
||
2218 | * @return \DOMElement |
||
2219 | */ |
||
2220 | public function tagenderReme($std) |
||
2221 | { |
||
2222 | $identificador = '#119 <enderReme> - '; |
||
2223 | $this->enderReme = $this->dom->createElement('enderReme'); |
||
2224 | $this->dom->addChild( |
||
2225 | $this->enderReme, |
||
2226 | 'xLgr', |
||
2227 | $std->xLgr, |
||
2228 | true, |
||
2229 | $identificador . 'Logradouro' |
||
2230 | ); |
||
2231 | $this->dom->addChild( |
||
2232 | $this->enderReme, |
||
2233 | 'nro', |
||
2234 | $std->nro, |
||
2235 | true, |
||
2236 | $identificador . 'Número' |
||
2237 | ); |
||
2238 | $this->dom->addChild( |
||
2239 | $this->enderReme, |
||
2240 | 'xCpl', |
||
2241 | $std->xCpl, |
||
2242 | false, |
||
2243 | $identificador . 'Complemento' |
||
2244 | ); |
||
2245 | $this->dom->addChild( |
||
2246 | $this->enderReme, |
||
2247 | 'xBairro', |
||
2248 | $std->xBairro, |
||
2249 | true, |
||
2250 | $identificador . 'Bairro' |
||
2251 | ); |
||
2252 | $this->dom->addChild( |
||
2253 | $this->enderReme, |
||
2254 | 'cMun', |
||
2255 | $std->cMun, |
||
2256 | true, |
||
2257 | $identificador . 'Código do município (utilizar a tabela do IBGE)' |
||
2258 | ); |
||
2259 | $this->dom->addChild( |
||
2260 | $this->enderReme, |
||
2261 | 'xMun', |
||
2262 | $std->xMun, |
||
2263 | true, |
||
2264 | $identificador . 'Nome do município' |
||
2265 | ); |
||
2266 | $this->dom->addChild( |
||
2267 | $this->enderReme, |
||
2268 | 'CEP', |
||
2269 | $std->CEP, |
||
2270 | false, |
||
2271 | $identificador . 'CEP' |
||
2272 | ); |
||
2273 | $this->dom->addChild( |
||
2274 | $this->enderReme, |
||
2275 | 'UF', |
||
2276 | $std->UF, |
||
2277 | true, |
||
2278 | $identificador . 'Sigla da UF' |
||
2279 | ); |
||
2280 | $this->dom->addChild( |
||
2281 | $this->enderReme, |
||
2282 | 'cPais', |
||
2283 | $std->cPais, |
||
2284 | false, |
||
2285 | $identificador . 'Código do país' |
||
2286 | ); |
||
2287 | $this->dom->addChild( |
||
2288 | $this->enderReme, |
||
2289 | 'xPais', |
||
2290 | $std->xPais, |
||
2291 | false, |
||
2292 | $identificador . 'Nome do país' |
||
2293 | ); |
||
2294 | |||
2295 | $node = $this->rem->getElementsByTagName("email")->item(0); |
||
2296 | $this->rem->insertBefore($this->enderReme, $node); |
||
2297 | return $this->enderReme; |
||
2298 | } |
||
2299 | |||
2300 | /** |
||
2301 | * Gera as tags para o elemento: "exped" (Informações do Expedidor da Carga) |
||
2302 | * #132 |
||
2303 | * Nível: 1 |
||
2304 | * Os parâmetros para esta função são todos os elementos da tag "exped" do |
||
2305 | * tipo elemento (Ele = E|CE|A) e nível 2 |
||
2306 | * |
||
2307 | * @return \DOMElement |
||
2308 | */ |
||
2309 | public function tagexped($std) |
||
2310 | { |
||
2311 | $identificador = '#142 <exped> - '; |
||
2312 | $this->exped = $this->dom->createElement('exped'); |
||
2313 | if ($std->CNPJ != '') { |
||
2314 | $this->dom->addChild( |
||
2315 | $this->exped, |
||
2316 | 'CNPJ', |
||
2317 | $std->CNPJ, |
||
2318 | true, |
||
2319 | $identificador . 'Número do CNPJ' |
||
2320 | ); |
||
2321 | } elseif ($std->CPF != '') { |
||
2322 | $this->dom->addChild( |
||
2323 | $this->exped, |
||
2324 | 'CPF', |
||
2325 | $std->CPF, |
||
2326 | true, |
||
2327 | $identificador . 'Número do CPF' |
||
2328 | ); |
||
2329 | } else { |
||
2330 | $this->dom->addChild( |
||
2331 | $this->exped, |
||
2332 | 'CNPJ', |
||
2333 | $std->CNPJ, |
||
2334 | true, |
||
2335 | $identificador . 'Número do CNPJ' |
||
2336 | ); |
||
2337 | $this->dom->addChild( |
||
2338 | $this->exped, |
||
2339 | 'CPF', |
||
2340 | $std->CPF, |
||
2341 | true, |
||
2342 | $identificador . 'Número do CPF' |
||
2343 | ); |
||
2344 | } |
||
2345 | if (!empty($std->IE)) { |
||
2346 | $this->dom->addChild( |
||
2347 | $this->exped, |
||
2348 | 'IE', |
||
2349 | $std->IE, |
||
2350 | true, |
||
2351 | $identificador . 'Inscrição Estadual' |
||
2352 | ); |
||
2353 | } |
||
2354 | $xNome = $std->xNome; |
||
2355 | if ($this->tpAmb == '2') { |
||
2356 | $xNome = 'CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL'; |
||
2357 | } |
||
2358 | $this->dom->addChild( |
||
2359 | $this->exped, |
||
2360 | 'xNome', |
||
2361 | Strings::replaceSpecialsChars(substr(trim($xNome), 0, 60)), |
||
2362 | true, |
||
2363 | $identificador . 'Razão social ou Nome' |
||
2364 | ); |
||
2365 | $this->dom->addChild( |
||
2366 | $this->exped, |
||
2367 | 'fone', |
||
2368 | $std->fone, |
||
2369 | false, |
||
2370 | $identificador . 'Telefone' |
||
2371 | ); |
||
2372 | $this->dom->addChild( |
||
2373 | $this->exped, |
||
2374 | 'email', |
||
2375 | $std->email, |
||
2376 | false, |
||
2377 | $identificador . 'Endereço de email' |
||
2378 | ); |
||
2379 | return $this->exped; |
||
2380 | } |
||
2381 | |||
2382 | /** |
||
2383 | * Gera as tags para o elemento: "enderExped" (Dados do endereço) |
||
2384 | * #138 |
||
2385 | * Nível: 2 |
||
2386 | * Os parâmetros para esta função são todos os elementos da tag "enderExped" do |
||
2387 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
2388 | * |
||
2389 | * @return \DOMElement |
||
2390 | */ |
||
2391 | public function tagenderExped($std) |
||
2392 | { |
||
2393 | $identificador = '#148 <enderExped> - '; |
||
2394 | $this->enderExped = $this->dom->createElement('enderExped'); |
||
2395 | $this->dom->addChild( |
||
2396 | $this->enderExped, |
||
2397 | 'xLgr', |
||
2398 | $std->xLgr, |
||
2399 | true, |
||
2400 | $identificador . 'Logradouro' |
||
2401 | ); |
||
2402 | $this->dom->addChild( |
||
2403 | $this->enderExped, |
||
2404 | 'nro', |
||
2405 | $std->nro, |
||
2406 | true, |
||
2407 | $identificador . 'Número' |
||
2408 | ); |
||
2409 | $this->dom->addChild( |
||
2410 | $this->enderExped, |
||
2411 | 'xCpl', |
||
2412 | $std->xCpl, |
||
2413 | false, |
||
2414 | $identificador . 'Complemento' |
||
2415 | ); |
||
2416 | $this->dom->addChild( |
||
2417 | $this->enderExped, |
||
2418 | 'xBairro', |
||
2419 | $std->xBairro, |
||
2420 | true, |
||
2421 | $identificador . 'Bairro' |
||
2422 | ); |
||
2423 | $this->dom->addChild( |
||
2424 | $this->enderExped, |
||
2425 | 'cMun', |
||
2426 | $std->cMun, |
||
2427 | true, |
||
2428 | $identificador . 'Código do município (utilizar a tabela do IBGE)' |
||
2429 | ); |
||
2430 | $this->dom->addChild( |
||
2431 | $this->enderExped, |
||
2432 | 'xMun', |
||
2433 | $std->xMun, |
||
2434 | true, |
||
2435 | $identificador . 'Nome do município' |
||
2436 | ); |
||
2437 | $this->dom->addChild( |
||
2438 | $this->enderExped, |
||
2439 | 'CEP', |
||
2440 | $std->CEP, |
||
2441 | false, |
||
2442 | $identificador . 'CEP' |
||
2443 | ); |
||
2444 | $this->dom->addChild( |
||
2445 | $this->enderExped, |
||
2446 | 'UF', |
||
2447 | $std->UF, |
||
2448 | true, |
||
2449 | $identificador . 'Sigla da UF' |
||
2450 | ); |
||
2451 | $this->dom->addChild( |
||
2452 | $this->enderExped, |
||
2453 | 'cPais', |
||
2454 | $std->cPais, |
||
2455 | false, |
||
2456 | $identificador . 'Código do país' |
||
2457 | ); |
||
2458 | $this->dom->addChild( |
||
2459 | $this->enderExped, |
||
2460 | 'xPais', |
||
2461 | $std->xPais, |
||
2462 | false, |
||
2463 | $identificador . 'Nome do país' |
||
2464 | ); |
||
2465 | $node = $this->exped->getElementsByTagName("email")->item(0); |
||
2466 | $this->exped->insertBefore($this->enderExped, $node); |
||
2467 | return $this->enderExped; |
||
2468 | } |
||
2469 | |||
2470 | /** |
||
2471 | * Gera as tags para o elemento: "receb" (Informações do Recebedor da Carga) |
||
2472 | * #150 |
||
2473 | * Nível: 1 |
||
2474 | * Os parâmetros para esta função são todos os elementos da tag "receb" do |
||
2475 | * tipo elemento (Ele = E|CE|A) e nível 2 |
||
2476 | * |
||
2477 | * @return \DOMElement |
||
2478 | */ |
||
2479 | public function tagreceb($std) |
||
2480 | { |
||
2481 | $identificador = '#160 <receb> - '; |
||
2482 | $this->receb = $this->dom->createElement('receb'); |
||
2483 | if ($std->CNPJ != '') { |
||
2484 | $this->dom->addChild( |
||
2485 | $this->receb, |
||
2486 | 'CNPJ', |
||
2487 | $std->CNPJ, |
||
2488 | true, |
||
2489 | $identificador . 'Número do CNPJ' |
||
2490 | ); |
||
2491 | } elseif ($std->CPF != '') { |
||
2492 | $this->dom->addChild( |
||
2493 | $this->receb, |
||
2494 | 'CPF', |
||
2495 | $std->CPF, |
||
2496 | true, |
||
2497 | $identificador . 'Número do CPF' |
||
2498 | ); |
||
2499 | } else { |
||
2500 | $this->dom->addChild( |
||
2501 | $this->receb, |
||
2502 | 'CNPJ', |
||
2503 | $std->CNPJ, |
||
2504 | true, |
||
2505 | $identificador . 'Número do CNPJ' |
||
2506 | ); |
||
2507 | $this->dom->addChild( |
||
2508 | $this->receb, |
||
2509 | 'CPF', |
||
2510 | $std->CPF, |
||
2511 | true, |
||
2512 | $identificador . 'Número do CPF' |
||
2513 | ); |
||
2514 | } |
||
2515 | if (!empty($std->IE)) { |
||
2516 | $this->dom->addChild( |
||
2517 | $this->receb, |
||
2518 | 'IE', |
||
2519 | $std->IE, |
||
2520 | true, |
||
2521 | $identificador . 'Inscrição Estadual' |
||
2522 | ); |
||
2523 | } |
||
2524 | $xNome = $std->xNome; |
||
2525 | if ($this->tpAmb == '2') { |
||
2526 | $xNome = 'CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL'; |
||
2527 | } |
||
2528 | $this->dom->addChild( |
||
2529 | $this->receb, |
||
2530 | 'xNome', |
||
2531 | Strings::replaceSpecialsChars(substr(trim($xNome), 0, 60)), |
||
2532 | true, |
||
2533 | $identificador . 'Razão social ou Nome' |
||
2534 | ); |
||
2535 | $this->dom->addChild( |
||
2536 | $this->receb, |
||
2537 | 'fone', |
||
2538 | $std->fone, |
||
2539 | false, |
||
2540 | $identificador . 'Telefone' |
||
2541 | ); |
||
2542 | $this->dom->addChild( |
||
2543 | $this->receb, |
||
2544 | 'email', |
||
2545 | $std->email, |
||
2546 | false, |
||
2547 | $identificador . 'Endereço de email' |
||
2548 | ); |
||
2549 | return $this->receb; |
||
2550 | } |
||
2551 | |||
2552 | /** |
||
2553 | * Gera as tags para o elemento: "enderReceb" (Informações do Recebedor da Carga) |
||
2554 | * #156 |
||
2555 | * Nível: 2 |
||
2556 | * Os parâmetros para esta função são todos os elementos da tag "enderReceb" do |
||
2557 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
2558 | * |
||
2559 | * @return \DOMElement |
||
2560 | */ |
||
2561 | public function tagenderReceb($std) |
||
2562 | { |
||
2563 | $identificador = '#160 <enderReceb> - '; |
||
2564 | $this->enderReceb = $this->dom->createElement('enderReceb'); |
||
2565 | $this->dom->addChild( |
||
2566 | $this->enderReceb, |
||
2567 | 'xLgr', |
||
2568 | $std->xLgr, |
||
2569 | true, |
||
2570 | $identificador . 'Logradouro' |
||
2571 | ); |
||
2572 | $this->dom->addChild( |
||
2573 | $this->enderReceb, |
||
2574 | 'nro', |
||
2575 | $std->nro, |
||
2576 | true, |
||
2577 | $identificador . 'Número' |
||
2578 | ); |
||
2579 | $this->dom->addChild( |
||
2580 | $this->enderReceb, |
||
2581 | 'xCpl', |
||
2582 | $std->xCpl, |
||
2583 | false, |
||
2584 | $identificador . 'Complemento' |
||
2585 | ); |
||
2586 | $this->dom->addChild( |
||
2587 | $this->enderReceb, |
||
2588 | 'xBairro', |
||
2589 | $std->xBairro, |
||
2590 | true, |
||
2591 | $identificador . 'Bairro' |
||
2592 | ); |
||
2593 | $this->dom->addChild( |
||
2594 | $this->enderReceb, |
||
2595 | 'cMun', |
||
2596 | $std->cMun, |
||
2597 | true, |
||
2598 | $identificador . 'Código do município (utilizar a tabela do IBGE)' |
||
2599 | ); |
||
2600 | $this->dom->addChild( |
||
2601 | $this->enderReceb, |
||
2602 | 'xMun', |
||
2603 | $std->xMun, |
||
2604 | true, |
||
2605 | $identificador . 'Nome do município' |
||
2606 | ); |
||
2607 | $this->dom->addChild( |
||
2608 | $this->enderReceb, |
||
2609 | 'CEP', |
||
2610 | $std->CEP, |
||
2611 | false, |
||
2612 | $identificador . 'CEP' |
||
2613 | ); |
||
2614 | $this->dom->addChild( |
||
2615 | $this->enderReceb, |
||
2616 | 'UF', |
||
2617 | $std->UF, |
||
2618 | true, |
||
2619 | $identificador . 'Sigla da UF' |
||
2620 | ); |
||
2621 | $this->dom->addChild( |
||
2622 | $this->enderReceb, |
||
2623 | 'cPais', |
||
2624 | $std->cPais, |
||
2625 | false, |
||
2626 | $identificador . 'Código do país' |
||
2627 | ); |
||
2628 | $this->dom->addChild( |
||
2629 | $this->enderReceb, |
||
2630 | 'xPais', |
||
2631 | $std->xPais, |
||
2632 | false, |
||
2633 | $identificador . 'Nome do país' |
||
2634 | ); |
||
2635 | $node = $this->receb->getElementsByTagName("email")->item(0); |
||
2636 | $this->receb->insertBefore($this->enderReceb, $node); |
||
2637 | return $this->enderReceb; |
||
2638 | } |
||
2639 | |||
2640 | /** |
||
2641 | * Gera as tags para o elemento: "dest" (Informações do Destinatário do CT-e) |
||
2642 | * #168 |
||
2643 | * Nível: 1 |
||
2644 | * Os parâmetros para esta função são todos os elementos da tag "dest" do |
||
2645 | * tipo elemento (Ele = E|CE|A) e nível 2 |
||
2646 | * |
||
2647 | * @return \DOMElement |
||
2648 | */ |
||
2649 | public function tagdest($std) |
||
2650 | { |
||
2651 | $identificador = '#178 <dest> - '; |
||
2652 | $this->dest = $this->dom->createElement('dest'); |
||
2653 | if ($std->CNPJ != '') { |
||
2654 | $this->dom->addChild( |
||
2655 | $this->dest, |
||
2656 | 'CNPJ', |
||
2657 | $std->CNPJ, |
||
2658 | true, |
||
2659 | $identificador . 'Número do CNPJ' |
||
2660 | ); |
||
2661 | } elseif ($std->CPF != '') { |
||
2662 | $this->dom->addChild( |
||
2663 | $this->dest, |
||
2664 | 'CPF', |
||
2665 | $std->CPF, |
||
2666 | true, |
||
2667 | $identificador . 'Número do CPF' |
||
2668 | ); |
||
2669 | } else { |
||
2670 | $this->dom->addChild( |
||
2671 | $this->dest, |
||
2672 | 'CNPJ', |
||
2673 | $std->CNPJ, |
||
2674 | true, |
||
2675 | $identificador . 'Número do CNPJ' |
||
2676 | ); |
||
2677 | $this->dom->addChild( |
||
2678 | $this->dest, |
||
2679 | 'CPF', |
||
2680 | $std->CPF, |
||
2681 | true, |
||
2682 | $identificador . 'Número do CPF' |
||
2683 | ); |
||
2684 | } |
||
2685 | if (!empty($std->IE)) { |
||
2686 | $this->dom->addChild( |
||
2687 | $this->dest, |
||
2688 | 'IE', |
||
2689 | $std->IE, |
||
2690 | true, |
||
2691 | $identificador . 'Inscrição Estadual' |
||
2692 | ); |
||
2693 | } |
||
2694 | $xNome = $std->xNome; |
||
2695 | if ($this->tpAmb == '2') { |
||
2696 | $xNome = 'CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL'; |
||
2697 | } |
||
2698 | $this->dom->addChild( |
||
2699 | $this->dest, |
||
2700 | 'xNome', |
||
2701 | Strings::replaceSpecialsChars(substr(trim($xNome), 0, 60)), |
||
2702 | true, |
||
2703 | $identificador . 'Razão social ou Nome' |
||
2704 | ); |
||
2705 | $this->dom->addChild( |
||
2706 | $this->dest, |
||
2707 | 'fone', |
||
2708 | $std->fone, |
||
2709 | false, |
||
2710 | $identificador . 'Telefone' |
||
2711 | ); |
||
2712 | $this->dom->addChild( |
||
2713 | $this->dest, |
||
2714 | 'ISUF', |
||
2715 | $std->ISUF, |
||
2716 | false, |
||
2717 | $identificador . 'Inscrição na SUFRAMA' |
||
2718 | ); |
||
2719 | $this->dom->addChild( |
||
2720 | $this->dest, |
||
2721 | 'email', |
||
2722 | $std->email, |
||
2723 | false, |
||
2724 | $identificador . 'Endereço de email' |
||
2725 | ); |
||
2726 | return $this->dest; |
||
2727 | } |
||
2728 | |||
2729 | /** |
||
2730 | * Gera as tags para o elemento: "enderDest" (Informações do Recebedor da Carga) |
||
2731 | * # = 175 |
||
2732 | * Nível = 2 |
||
2733 | * Os parâmetros para esta função são todos os elementos da tag "enderDest" do |
||
2734 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
2735 | * |
||
2736 | * @return \DOMElement |
||
2737 | */ |
||
2738 | public function tagenderDest($std) |
||
2739 | { |
||
2740 | $identificador = '#185 <enderDest> - '; |
||
2741 | $this->enderDest = $this->dom->createElement('enderDest'); |
||
2742 | $this->dom->addChild( |
||
2743 | $this->enderDest, |
||
2744 | 'xLgr', |
||
2745 | $std->xLgr, |
||
2746 | true, |
||
2747 | $identificador . 'Logradouro' |
||
2748 | ); |
||
2749 | $this->dom->addChild( |
||
2750 | $this->enderDest, |
||
2751 | 'nro', |
||
2752 | $std->nro, |
||
2753 | true, |
||
2754 | $identificador . 'Número' |
||
2755 | ); |
||
2756 | $this->dom->addChild( |
||
2757 | $this->enderDest, |
||
2758 | 'xCpl', |
||
2759 | $std->xCpl, |
||
2760 | false, |
||
2761 | $identificador . 'Complemento' |
||
2762 | ); |
||
2763 | $this->dom->addChild( |
||
2764 | $this->enderDest, |
||
2765 | 'xBairro', |
||
2766 | $std->xBairro, |
||
2767 | true, |
||
2768 | $identificador . 'Bairro' |
||
2769 | ); |
||
2770 | $this->dom->addChild( |
||
2771 | $this->enderDest, |
||
2772 | 'cMun', |
||
2773 | $std->cMun, |
||
2774 | true, |
||
2775 | $identificador . 'Código do município (utilizar a tabela do IBGE)' |
||
2776 | ); |
||
2777 | $this->dom->addChild( |
||
2778 | $this->enderDest, |
||
2779 | 'xMun', |
||
2780 | $std->xMun, |
||
2781 | true, |
||
2782 | $identificador . 'Nome do município' |
||
2783 | ); |
||
2784 | $this->dom->addChild( |
||
2785 | $this->enderDest, |
||
2786 | 'CEP', |
||
2787 | $std->CEP, |
||
2788 | false, |
||
2789 | $identificador . 'CEP' |
||
2790 | ); |
||
2791 | $this->dom->addChild( |
||
2792 | $this->enderDest, |
||
2793 | 'UF', |
||
2794 | $std->UF, |
||
2795 | true, |
||
2796 | $identificador . 'Sigla da UF' |
||
2797 | ); |
||
2798 | $this->dom->addChild( |
||
2799 | $this->enderDest, |
||
2800 | 'cPais', |
||
2801 | $std->cPais, |
||
2802 | false, |
||
2803 | $identificador . 'Código do país' |
||
2804 | ); |
||
2805 | $this->dom->addChild( |
||
2806 | $this->enderDest, |
||
2807 | 'xPais', |
||
2808 | $std->xPais, |
||
2809 | false, |
||
2810 | $identificador . 'Nome do país' |
||
2811 | ); |
||
2812 | $node = $this->dest->getElementsByTagName("email")->item(0); |
||
2813 | $this->dest->insertBefore($this->enderDest, $node); |
||
2814 | return $this->enderDest; |
||
2815 | } |
||
2816 | |||
2817 | /** |
||
2818 | * Gera as tags para o elemento: "vPrest" (Valores da Prestação de Serviço) |
||
2819 | * #187 |
||
2820 | * Nível: 1 |
||
2821 | * Os parâmetros para esta função são todos os elementos da tag "vPrest" do |
||
2822 | * tipo elemento (Ele = E|CE|A) e nível 2 |
||
2823 | * |
||
2824 | * @return \DOMElement |
||
2825 | */ |
||
2826 | public function tagvPrest($std) |
||
2827 | { |
||
2828 | $identificador = '#208 <vPrest> - '; |
||
2829 | $this->vPrest = $this->dom->createElement('vPrest'); |
||
2830 | $this->dom->addChild( |
||
2831 | $this->vPrest, |
||
2832 | 'vTPrest', |
||
2833 | $std->vTPrest, |
||
2834 | true, |
||
2835 | $identificador . 'Valor Total da Prestação do Serviço' |
||
2836 | ); |
||
2837 | $this->dom->addChild( |
||
2838 | $this->vPrest, |
||
2839 | 'vRec', |
||
2840 | $std->vRec, |
||
2841 | true, |
||
2842 | $identificador . 'Valor a Receber' |
||
2843 | ); |
||
2844 | return $this->vPrest; |
||
2845 | } |
||
2846 | |||
2847 | /** |
||
2848 | * Gera as tags para o elemento: "Comp" (Componentes do Valor da Prestação) |
||
2849 | * #211 |
||
2850 | * Nível: 2 |
||
2851 | * Os parâmetros para esta função são todos os elementos da tag "Comp" do |
||
2852 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
2853 | * |
||
2854 | * @return \DOMElement |
||
2855 | */ |
||
2856 | public function tagComp($std) |
||
2857 | { |
||
2858 | $identificador = '#65 <pass> - '; |
||
2859 | $this->comp[] = $this->dom->createElement('Comp'); |
||
2860 | $posicao = (integer)count($this->comp) - 1; |
||
2861 | $this->dom->addChild( |
||
2862 | $this->comp[$posicao], |
||
2863 | 'xNome', |
||
2864 | $std->xNome, |
||
2865 | false, |
||
2866 | $identificador . 'Nome do componente' |
||
2867 | ); |
||
2868 | $this->dom->addChild( |
||
2869 | $this->comp[$posicao], |
||
2870 | 'vComp', |
||
2871 | $std->vComp, |
||
2872 | false, |
||
2873 | $identificador . 'Valor do componente' |
||
2874 | ); |
||
2875 | return $this->comp[$posicao]; |
||
2876 | } |
||
2877 | |||
2878 | /** |
||
2879 | * tagICMS |
||
2880 | * Informações relativas ao ICMS |
||
2881 | * #194 |
||
2882 | * |
||
2883 | * @return DOMElement |
||
2884 | */ |
||
2885 | public function tagicms($std) |
||
2886 | { |
||
2887 | $identificador = 'N01 <ICMSxx> - '; |
||
2888 | switch ($std->cst) { |
||
2889 | case '00': |
||
2890 | $icms = $this->dom->createElement("ICMS00"); |
||
2891 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 00"); |
||
2892 | $this->dom->addChild($icms, 'vBC', $std->vBC, true, "$identificador Valor da BC do ICMS"); |
||
2893 | $this->dom->addChild($icms, 'pICMS', $std->pICMS, true, "$identificador Alíquota do imposto"); |
||
2894 | $this->dom->addChild($icms, 'vICMS', $std->vICMS, true, "$identificador Valor do ICMS"); |
||
2895 | break; |
||
2896 | case '20': |
||
2897 | $icms = $this->dom->createElement("ICMS20"); |
||
2898 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 20"); |
||
2899 | $this->dom->addChild( |
||
2900 | $icms, |
||
2901 | 'pRedBC', |
||
2902 | $std->pRedBC, |
||
2903 | true, |
||
2904 | "$identificador Percentual da Redução de BC" |
||
2905 | ); |
||
2906 | $this->dom->addChild($icms, 'vBC', $std->vBC, true, "$identificador Valor da BC do ICMS"); |
||
2907 | $this->dom->addChild($icms, 'pICMS', $std->pICMS, true, "$identificador Alíquota do imposto"); |
||
2908 | $this->dom->addChild($icms, 'vICMS', $std->vICMS, true, "$identificador Valor do ICMS"); |
||
2909 | break; |
||
2910 | case '40': |
||
2911 | $icms = $this->dom->createElement("ICMS45"); |
||
2912 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 40"); |
||
2913 | break; |
||
2914 | case '41': |
||
2915 | $icms = $this->dom->createElement("ICMS45"); |
||
2916 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 41"); |
||
2917 | break; |
||
2918 | case '51': |
||
2919 | $icms = $this->dom->createElement("ICMS45"); |
||
2920 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 51"); |
||
2921 | break; |
||
2922 | case '60': |
||
2923 | $icms = $this->dom->createElement("ICMS60"); |
||
2924 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 60"); |
||
2925 | $this->dom->addChild( |
||
2926 | $icms, |
||
2927 | 'vBCSTRet', |
||
2928 | $std->vBCSTRet, |
||
2929 | true, |
||
2930 | "$identificador Valor BC do ICMS ST retido" |
||
2931 | ); |
||
2932 | $this->dom->addChild( |
||
2933 | $icms, |
||
2934 | 'vICMSSTRet', |
||
2935 | $std->vICMSSTRet, |
||
2936 | true, |
||
2937 | "$identificador Valor do ICMS ST retido" |
||
2938 | ); |
||
2939 | $this->dom->addChild( |
||
2940 | $icms, |
||
2941 | 'pICMSSTRet', |
||
2942 | $std->pICMSSTRet, |
||
2943 | true, |
||
2944 | "$identificador Valor do ICMS ST retido" |
||
2945 | ); |
||
2946 | if ($vCred > 0) { |
||
0 ignored issues
–
show
|
|||
2947 | $this->dom->addChild($icms, 'vCred', $std->vCred, false, "$identificador Valor do Crédito"); |
||
2948 | } |
||
2949 | break; |
||
2950 | case '90': |
||
2951 | if ($outraUF == true) { |
||
0 ignored issues
–
show
|
|||
2952 | $icms = $this->dom->createElement("ICMSOutraUF"); |
||
2953 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 90"); |
||
2954 | if ($pRedBC > 0) { |
||
0 ignored issues
–
show
|
|||
2955 | $this->dom->addChild( |
||
2956 | $icms, |
||
2957 | 'pRedBCOutraUF', |
||
2958 | $std->pRedBC, |
||
2959 | false, |
||
2960 | "$identificador Percentual Red " |
||
2961 | . "BC Outra UF" |
||
2962 | ); |
||
2963 | } |
||
2964 | $this->dom->addChild($icms, 'vBCOutraUF', $std->vBC, true, "$identificador Valor BC ICMS Outra UF"); |
||
2965 | $this->dom->addChild($icms, 'pICMSOutraUF', $std->pICMS, true, "$identificador Alíquota do " |
||
2966 | . "imposto Outra UF"); |
||
2967 | $this->dom->addChild( |
||
2968 | $icms, |
||
2969 | 'vICMSOutraUF', |
||
2970 | $std->vICMS, |
||
2971 | true, |
||
2972 | "$identificador Valor ICMS Outra UF" |
||
2973 | ); |
||
2974 | } else { |
||
2975 | $icms = $this->dom->createElement("ICMS90"); |
||
2976 | $this->dom->addChild($icms, 'CST', $std->cst, true, "$identificador Tributação do ICMS = 90"); |
||
2977 | if ($pRedBC > 0) { |
||
2978 | $this->dom->addChild( |
||
2979 | $icms, |
||
2980 | 'pRedBC', |
||
2981 | $std->pRedBC, |
||
2982 | false, |
||
2983 | "$identificador Percentual Redução BC" |
||
2984 | ); |
||
2985 | } |
||
2986 | $this->dom->addChild($icms, 'vBC', $std->vBC, true, "$identificador Valor da BC do ICMS"); |
||
2987 | $this->dom->addChild($icms, 'pICMS', $std->pICMS, true, "$identificador Alíquota do imposto"); |
||
2988 | $this->dom->addChild($icms, 'vICMS', $std->vICMS, true, "$identificador Valor do ICMS"); |
||
2989 | if ($vCred > 0) { |
||
2990 | $this->dom->addChild($icms, 'vCred', $std->vCred, false, "$identificador Valor do Crédido"); |
||
2991 | } |
||
2992 | } |
||
2993 | break; |
||
2994 | case 'SN': |
||
2995 | $icms = $this->dom->createElement("ICMSSN"); |
||
2996 | $this->dom->addChild($icms, 'CST', 90, true, "$identificador Tributação do ICMS = 90"); |
||
2997 | $this->dom->addChild($icms, 'indSN', '1', true, "$identificador Indica se contribuinte é SN"); |
||
2998 | break; |
||
2999 | } |
||
3000 | $this->imp = $this->dom->createElement('imp'); |
||
3001 | $tagIcms = $this->dom->createElement('ICMS'); |
||
3002 | if (isset($icms)) { |
||
3003 | $this->imp->appendChild($tagIcms); |
||
3004 | } |
||
3005 | if (isset($icms)) { |
||
3006 | $tagIcms->appendChild($icms); |
||
3007 | } |
||
3008 | if ($std->vTotTrib > 0) { |
||
3009 | $this->dom->addChild( |
||
3010 | $this->imp, |
||
3011 | 'vTotTrib', |
||
3012 | $std->vTotTrib, |
||
3013 | false, |
||
3014 | "$identificador Valor Total dos Tributos" |
||
3015 | ); |
||
3016 | } |
||
3017 | |||
3018 | if ($std->vICMSUFFim != '' || $std->vICMSUFIni != '') { |
||
3019 | $icmsDifal = $this->dom->createElement("ICMSUFFim"); |
||
3020 | $this->dom->addChild( |
||
3021 | $icmsDifal, |
||
3022 | 'vBCUFFim', |
||
3023 | $std->vBCUFFim, |
||
3024 | true, |
||
3025 | "$identificador Valor da BC do ICMS na UF |
||
3026 | de término da prestação do serviço de transporte" |
||
3027 | ); |
||
3028 | $this->dom->addChild( |
||
3029 | $icmsDifal, |
||
3030 | 'pFCPUFFim', |
||
3031 | $std->pFCPUFFim, |
||
3032 | true, |
||
3033 | "$identificador Percentual do ICMS |
||
3034 | relativo ao Fundo de Combate à pobreza (FCP) na UF de término da prestação do serviço de |
||
3035 | transporte" |
||
3036 | ); |
||
3037 | $this->dom->addChild( |
||
3038 | $icmsDifal, |
||
3039 | 'pICMSUFFim', |
||
3040 | $std->pICMSUFFim, |
||
3041 | true, |
||
3042 | "$identificador Alíquota interna da UF |
||
3043 | de término da prestação do serviço de transporte" |
||
3044 | ); |
||
3045 | $this->dom->addChild( |
||
3046 | $icmsDifal, |
||
3047 | 'pICMSInter', |
||
3048 | $std->pICMSInter, |
||
3049 | true, |
||
3050 | "$identificador Alíquota interestadual |
||
3051 | das UF envolvidas" |
||
3052 | ); |
||
3053 | $this->dom->addChild( |
||
3054 | $icmsDifal, |
||
3055 | 'pICMSInterPart', |
||
3056 | $std->pICMSInterPart, |
||
3057 | true, |
||
3058 | "$identificador Percentual |
||
3059 | provisório de partilha entre os estados" |
||
3060 | ); |
||
3061 | $this->dom->addChild( |
||
3062 | $icmsDifal, |
||
3063 | 'vFCPUFFim', |
||
3064 | $std->vFCPUFFim, |
||
3065 | true, |
||
3066 | "$identificador Valor do ICMS relativo |
||
3067 | ao Fundo de Combate á Pobreza (FCP) da UF de término da prestação" |
||
3068 | ); |
||
3069 | $this->dom->addChild( |
||
3070 | $icmsDifal, |
||
3071 | 'vICMSUFFim', |
||
3072 | $std->vICMSUFFim, |
||
3073 | true, |
||
3074 | "$identificador Valor do ICMS de |
||
3075 | partilha para a UF de término da prestação do serviço de transporte" |
||
3076 | ); |
||
3077 | $this->dom->addChild( |
||
3078 | $icmsDifal, |
||
3079 | 'vICMSUFIni', |
||
3080 | $std->vICMSUFIni, |
||
3081 | true, |
||
3082 | "$identificador Valor do ICMS de |
||
3083 | partilha para a UF de início da prestação do serviço de transporte" |
||
3084 | ); |
||
3085 | |||
3086 | $this->imp->appendChild($icmsDifal); |
||
3087 | } |
||
3088 | |||
3089 | return $tagIcms; |
||
3090 | } |
||
3091 | |||
3092 | /** |
||
3093 | * tagInfTribFed |
||
3094 | * Informações do Impostos Federais |
||
3095 | * CTe OS |
||
3096 | * @return DOMElement |
||
3097 | */ |
||
3098 | public function taginfTribFed($std) |
||
3099 | { |
||
3100 | $identificador = 'N02 <imp> - '; |
||
3101 | $tagInfTribFed = $this->dom->createElement('infTribFed'); |
||
3102 | |||
3103 | $this->dom->addChild($tagInfTribFed, 'vPIS', $std->vPIS, false, "$identificador Valor de PIS"); |
||
3104 | $this->dom->addChild($tagInfTribFed, 'vCOFINS', $std->vCOFINS, false, "$identificador Valor de COFINS"); |
||
3105 | $this->dom->addChild($tagInfTribFed, 'vIR', $std->vIR, false, "$identificador Valor de IR"); |
||
3106 | $this->dom->addChild($tagInfTribFed, 'vINSS', $std->vINSS, false, "$identificador Valor de INSS"); |
||
3107 | $this->dom->addChild($tagInfTribFed, 'vCSLL', $std->vCSLL, false, "$identificador Valor de CSLL"); |
||
3108 | |||
3109 | $this->imp->appendChild($tagInfTribFed); |
||
3110 | } |
||
3111 | |||
3112 | |||
3113 | /** |
||
3114 | * Tag raiz do documento xml |
||
3115 | * Função chamada pelo método [ monta ] |
||
3116 | * @return \DOMElement |
||
3117 | */ |
||
3118 | private function buildCTe() |
||
3119 | { |
||
3120 | if (empty($this->CTe)) { |
||
3121 | $this->CTe = $this->dom->createElement('CTe'); |
||
3122 | $this->CTe->setAttribute('xmlns', 'http://www.portalfiscal.inf.br/cte'); |
||
3123 | } |
||
3124 | return $this->CTe; |
||
3125 | } |
||
3126 | |||
3127 | /** |
||
3128 | * Tag raiz do documento xml |
||
3129 | * Função chamada pelo método [ monta ] |
||
3130 | * @return \DOMElement |
||
3131 | */ |
||
3132 | private function buildCTeOS() |
||
3133 | { |
||
3134 | if (empty($this->CTe)) { |
||
3135 | $this->CTe = $this->dom->createElement('CTeOS'); |
||
3136 | $this->CTe->setAttribute('versao', '3.00'); |
||
3137 | $this->CTe->setAttribute('xmlns', 'http://www.portalfiscal.inf.br/cte'); |
||
3138 | } |
||
3139 | return $this->CTe; |
||
3140 | } |
||
3141 | |||
3142 | /** |
||
3143 | * Gera as tags para o elemento: "Entrega" (Informações ref. a previsão de entrega) |
||
3144 | * #69 |
||
3145 | * Nível: 2 |
||
3146 | * Os parâmetros para esta função são todos os elementos da tag "Entrega" do |
||
3147 | * tipo elemento (Ele = E|CE|A) e nível 3 |
||
3148 | * |
||
3149 | * @return \DOMElement |
||
3150 | */ |
||
3151 | private function tagEntrega() |
||
3152 | { |
||
3153 | if ($this->compl == '') { |
||
3154 | $this->compl = $this->dom->createElement('compl'); |
||
3155 | } |
||
3156 | if ($this->entrega == '') { |
||
3157 | $this->entrega = $this->dom->createElement('Entrega'); |
||
3158 | $this->dom->appChild($this->compl, $this->entrega, 'Falta tag "compl"'); |
||
3159 | } |
||
3160 | return $this->entrega; |
||
3161 | } |
||
3162 | |||
3163 | /** |
||
3164 | * #241 |
||
3165 | * @return type |
||
3166 | */ |
||
3167 | public function taginfCTeNorm() |
||
3168 | { |
||
3169 | $this->infCTeNorm = $this->dom->createElement('infCTeNorm'); |
||
3170 | return $this->infCTeNorm; |
||
3171 | } |
||
3172 | |||
3173 | /** |
||
3174 | * Gera as tags para o elemento: "infCarga" (Informações da Carga do CT-e) |
||
3175 | * #242 |
||
3176 | * Nível: 2 |
||
3177 | * |
||
3178 | * @return \DOMElement |
||
3179 | */ |
||
3180 | public function taginfCarga($std) |
||
3181 | { |
||
3182 | $identificador = '#242 <infCarga> - '; |
||
3183 | $this->infCarga = $this->dom->createElement('infCarga'); |
||
3184 | $this->dom->addChild( |
||
3185 | $this->infCarga, |
||
3186 | 'vCarga', |
||
3187 | $std->vCarga, |
||
3188 | false, |
||
3189 | $identificador . 'Valor Total da Carga' |
||
3190 | ); |
||
3191 | $this->dom->addChild( |
||
3192 | $this->infCarga, |
||
3193 | 'proPred', |
||
3194 | $std->proPred, |
||
3195 | true, |
||
3196 | $identificador . 'Produto Predominante' |
||
3197 | ); |
||
3198 | $this->dom->addChild( |
||
3199 | $this->infCarga, |
||
3200 | 'xOutCat', |
||
3201 | $std->xOutCat, |
||
3202 | false, |
||
3203 | $identificador . 'Outras Caract. da Carga' |
||
3204 | ); |
||
3205 | $this->dom->addChild( |
||
3206 | $this->infCarga, |
||
3207 | 'vCargaAverb', |
||
3208 | $std->vCargaAverb, |
||
3209 | false, |
||
3210 | $identificador . 'Valor da Carga para |
||
3211 | efeito de averbação' |
||
3212 | ); |
||
3213 | |||
3214 | return $this->infCarga; |
||
3215 | } |
||
3216 | |||
3217 | /** |
||
3218 | * Gera as tags para o elemento: "infCTeNorm" (Informações da Carga do CT-e OS) |
||
3219 | * #253 |
||
3220 | * Nível: 2 |
||
3221 | * Os parâmetros para esta função são todos os elementos da tag "infServico" |
||
3222 | * |
||
3223 | * @return \DOMElement |
||
3224 | */ |
||
3225 | public function taginfServico($std) |
||
3226 | { |
||
3227 | $identificador = '#253 <infServico> - '; |
||
3228 | |||
3229 | $this->infServico = $this->dom->createElement('infServico'); |
||
3230 | $this->dom->addChild( |
||
3231 | $this->infServico, |
||
3232 | 'xDescServ', |
||
3233 | $std->xDescServ, |
||
3234 | true, |
||
3235 | $identificador . 'Descrição do Serviço Prestado' |
||
3236 | ); |
||
3237 | $infQ = $this->dom->createElement('infQ'); |
||
3238 | $this->dom->addChild($infQ, 'qCarga', $std->qCarga, false, $identificador . 'Quantidade'); |
||
3239 | |||
3240 | $this->infServico->appendChild($infQ); |
||
3241 | |||
3242 | return $this->infServico; |
||
3243 | } |
||
3244 | |||
3245 | /** |
||
3246 | * Gera as tags para o elemento: "infQ" (Informações de quantidades da Carga do CT-e) |
||
3247 | * #246 |
||
3248 | * Nível: 3 |
||
3249 | * Os parâmetros para esta função são todos os elementos da tag "infQ" |
||
3250 | * |
||
3251 | * @return mixed |
||
3252 | */ |
||
3253 | public function taginfQ($std) |
||
3254 | { |
||
3255 | $identificador = '#257 <infQ> - '; |
||
3256 | $this->infQ[] = $this->dom->createElement('infQ'); |
||
3257 | $posicao = (integer)count($this->infQ) - 1; |
||
3258 | $this->dom->addChild($this->infQ[$posicao], 'cUnid', $std->cUnid, true, $identificador . 'Código da |
||
3259 | Unidade de Medida'); |
||
3260 | $this->dom->addChild($this->infQ[$posicao], 'tpMed', $std->tpMed, true, $identificador . 'Tipo da Medida'); |
||
3261 | $this->dom->addChild($this->infQ[$posicao], 'qCarga', $std->qCarga, true, $identificador . 'Quantidade'); |
||
3262 | |||
3263 | return $this->infQ[$posicao]; |
||
3264 | } |
||
3265 | |||
3266 | public function taginfDoc() |
||
3267 | { |
||
3268 | $this->infDoc = $this->dom->createElement('infDoc'); |
||
3269 | return $this->infDoc; |
||
3270 | } |
||
3271 | |||
3272 | /** |
||
3273 | * Documentos de Transporte Anterior |
||
3274 | * @return DOMElement|\DOMNode |
||
3275 | */ |
||
3276 | public function tagdocAnt() |
||
3277 | { |
||
3278 | $this->docAnt = $this->dom->createElement('docAnt'); |
||
3279 | return $this->docAnt; |
||
3280 | } |
||
3281 | |||
3282 | /** |
||
3283 | * Informações de identificação dos documentos de Transporte Anterior |
||
3284 | * @return array|DOMElement |
||
3285 | */ |
||
3286 | public function tagidDocAnt() |
||
3287 | { |
||
3288 | $this->idDocAnt = $this->dom->createElement('idDocAnt'); |
||
3289 | return $this->idDocAnt; |
||
3290 | } |
||
3291 | |||
3292 | /** |
||
3293 | * Gera as tags para o elemento: "infNF" (Informações das NF) |
||
3294 | * #262 |
||
3295 | * Nível: 3 |
||
3296 | * @return mixed |
||
3297 | */ |
||
3298 | public function taginfNF($std) |
||
3299 | { |
||
3300 | $identificador = '#262 <infNF> - '; |
||
3301 | $this->infNF[] = $this->dom->createElement('infNF'); |
||
3302 | $posicao = (integer)count($this->infNF) - 1; |
||
3303 | |||
3304 | $this->dom->addChild($this->infNF[$posicao], 'nRoma', $std->nRoma, false, $identificador . 'Número do |
||
3305 | Romaneio da NF'); |
||
3306 | $this->dom->addChild($this->infNF[$posicao], 'nPed', $std->nPed, false, $identificador . 'Número do |
||
3307 | Pedido da NF'); |
||
3308 | $this->dom->addChild($this->infNF[$posicao], 'mod', $std->mod, true, $identificador . 'Modelo da |
||
3309 | Nota Fiscal'); |
||
3310 | $this->dom->addChild($this->infNF[$posicao], 'serie', $std->serie, true, $identificador . 'Série'); |
||
3311 | $this->dom->addChild($this->infNF[$posicao], 'nDoc', $std->nDoc, true, $identificador . 'Número'); |
||
3312 | $this->dom->addChild($this->infNF[$posicao], 'dEmi', $std->dEmi, true, $identificador . 'Data de Emissão'); |
||
3313 | $this->dom->addChild($this->infNF[$posicao], 'vBC', $std->vBC, true, $identificador . 'Valor da Base |
||
3314 | de Cálculo do ICMS'); |
||
3315 | $this->dom->addChild($this->infNF[$posicao], 'vICMS', $std->vICMS, true, $identificador . 'Valor Total |
||
3316 | do ICMS'); |
||
3317 | $this->dom->addChild($this->infNF[$posicao], 'vBCST', $std->vBCST, true, $identificador . 'Valor da |
||
3318 | Base de Cálculo do ICMS ST'); |
||
3319 | $this->dom->addChild($this->infNF[$posicao], 'vST', $std->vST, true, $identificador . 'Valor Total |
||
3320 | do ICMS ST'); |
||
3321 | $this->dom->addChild($this->infNF[$posicao], 'vProd', $std->vProd, true, $identificador . 'Valor Total |
||
3322 | dos Produtos'); |
||
3323 | $this->dom->addChild($this->infNF[$posicao], 'vNF', $std->vNF, true, $identificador . 'Valor Total da NF'); |
||
3324 | $this->dom->addChild($this->infNF[$posicao], 'nCFOP', $std->nCFOP, true, $identificador . 'CFOP Predominante'); |
||
3325 | $this->dom->addChild($this->infNF[$posicao], 'nPeso', $std->nPeso, false, $identificador . 'Peso total em Kg'); |
||
3326 | $this->dom->addChild($this->infNF[$posicao], 'PIN', $std->PIN, false, $identificador . 'PIN SUFRAMA'); |
||
3327 | $this->dom->addChild($this->infNF[$posicao], 'dPrev', $std->dPrev, false, $identificador . 'Data prevista |
||
3328 | de entrega'); |
||
3329 | |||
3330 | return $this->infNF[$posicao]; |
||
3331 | } |
||
3332 | |||
3333 | /** |
||
3334 | * Gera as tags para o elemento: "infNFe" (Informações das NF-e) |
||
3335 | * #297 |
||
3336 | * Nível: 3 |
||
3337 | * @return mixed |
||
3338 | */ |
||
3339 | public function taginfNFe($std) |
||
3340 | { |
||
3341 | $identificador = '#297 <infNFe> - '; |
||
3342 | $this->infNFe[] = $this->dom->createElement('infNFe'); |
||
3343 | $posicao = (integer)count($this->infNFe) - 1; |
||
3344 | $this->dom->addChild( |
||
3345 | $this->infNFe[$posicao], |
||
3346 | 'chave', |
||
3347 | $std->chave, |
||
3348 | true, |
||
3349 | $identificador . 'Chave de acesso da NF-e' |
||
3350 | ); |
||
3351 | $this->dom->addChild( |
||
3352 | $this->infNFe[$posicao], |
||
3353 | 'PIN', |
||
3354 | $std->PIN, |
||
3355 | false, |
||
3356 | $identificador . 'PIN SUFRAMA' |
||
3357 | ); |
||
3358 | $this->dom->addChild( |
||
3359 | $this->infNFe[$posicao], |
||
3360 | 'dPrev', |
||
3361 | $std->dPrev, |
||
3362 | false, |
||
3363 | $identificador . 'Data prevista de entrega' |
||
3364 | ); |
||
3365 | return $this->infNFe[$posicao]; |
||
3366 | } |
||
3367 | |||
3368 | /** |
||
3369 | * Gera as tags para o elemento: "infOutros" (Informações dos demais documentos) |
||
3370 | * #319 |
||
3371 | * Nível: 3 |
||
3372 | * @return mixed |
||
3373 | */ |
||
3374 | public function taginfOutros($std) |
||
3375 | { |
||
3376 | $ident = '#319 <infOutros> - '; |
||
3377 | $this->infOutros[] = $this->dom->createElement('infOutros'); |
||
3378 | $posicao = (integer)count($this->infOutros) - 1; |
||
3379 | $this->dom->addChild($this->infOutros[$posicao], 'tpDoc', $std->tpDoc, true, $ident . 'Tipo ' |
||
3380 | . 'de documento originário'); |
||
3381 | $this->dom->addChild($this->infOutros[$posicao], 'descOutros', $std->descOutros, false, $ident . 'Descrição ' |
||
3382 | . 'do documento'); |
||
3383 | $this->dom->addChild($this->infOutros[$posicao], 'nDoc', $std->nDoc, false, $ident . 'Número ' |
||
3384 | . 'do documento'); |
||
3385 | $this->dom->addChild($this->infOutros[$posicao], 'dEmi', $std->dEmi, false, $ident . 'Data de Emissão'); |
||
3386 | $this->dom->addChild($this->infOutros[$posicao], 'vDocFisc', $std->vDocFisc, false, $ident . 'Valor ' |
||
3387 | . 'do documento'); |
||
3388 | $this->dom->addChild($this->infOutros[$posicao], 'dPrev', $std->dPrev, false, $ident . 'Data ' |
||
3389 | . 'prevista de entrega'); |
||
3390 | return $this->infOutros[$posicao]; |
||
3391 | } |
||
3392 | |||
3393 | /** |
||
3394 | * Gera as tags para o elemento: "infDocRef" (Informações dos demais documentos) |
||
3395 | * #319 |
||
3396 | * Nível: 3 |
||
3397 | * @return mixed |
||
3398 | */ |
||
3399 | public function taginfDocRef($std) |
||
3400 | { |
||
3401 | $ident = '#319 <infDocRef> - '; |
||
3402 | $this->infDocRef[] = $this->dom->createElement('infDocRef'); |
||
3403 | $posicao = (integer)count($this->infDocRef) - 1; |
||
3404 | $this->dom->addChild($this->infDocRef[$posicao], 'nDoc', $std->nDoc, false, $ident . 'Número ' |
||
3405 | . 'do documento'); |
||
3406 | $this->dom->addChild($this->infDocRef[$posicao], 'serie', $std->serie, false, $ident . 'Série ' |
||
3407 | . 'do documento'); |
||
3408 | $this->dom->addChild($this->infDocRef[$posicao], 'subserie', $std->subserie, false, $ident . 'Subserie ' |
||
3409 | . 'do documento'); |
||
3410 | $this->dom->addChild($this->infDocRef[$posicao], 'dEmi', $std->dEmi, false, $ident . 'Data de Emissão'); |
||
3411 | $this->dom->addChild($this->infDocRef[$posicao], 'vDoc', $std->vDoc, false, $ident . 'Valor ' |
||
3412 | . 'do documento'); |
||
3413 | return $this->infDocRef[$posicao]; |
||
3414 | } |
||
3415 | |||
3416 | /** |
||
3417 | * Gera as tags para o elemento: "emiDocAnt" (Informações dos CT-es Anteriores) |
||
3418 | * #345 |
||
3419 | * Nível: 3 |
||
3420 | * @return mixed |
||
3421 | */ |
||
3422 | public function tagemiDocAnt($std) |
||
3423 | { |
||
3424 | $identificador = '#345 <emiDocAnt> - '; |
||
3425 | $this->emiDocAnt[] = $this->dom->createElement('emiDocAnt'); |
||
3426 | $posicao = (integer)count($this->emiDocAnt) - 1; |
||
3427 | if ($std->CNPJ != '') { |
||
3428 | $this->dom->addChild( |
||
3429 | $this->emiDocAnt[$posicao], |
||
3430 | 'CNPJ', |
||
3431 | $std->CNPJ, |
||
3432 | true, |
||
3433 | $identificador . 'Número do CNPJ' |
||
3434 | ); |
||
3435 | $this->dom->addChild( |
||
3436 | $this->emiDocAnt[$posicao], |
||
3437 | 'IE', |
||
3438 | Strings::onlyNumbers($std->IE), |
||
3439 | true, |
||
3440 | $identificador . 'Inscrição Estadual' |
||
3441 | ); |
||
3442 | $this->dom->addChild($this->emiDocAnt[$posicao], 'UF', $std->UF, true, $identificador . 'Sigla da UF'); |
||
3443 | } else { |
||
3444 | $this->dom->addChild($this->emiDocAnt[$posicao], 'CPF', $std->CPF, true, $identificador . 'Número do CPF'); |
||
3445 | } |
||
3446 | $this->dom->addChild( |
||
3447 | $this->emiDocAnt[$posicao], |
||
3448 | 'xNome', |
||
3449 | $std->xNome, |
||
3450 | true, |
||
3451 | $identificador . 'Razão Social ou Nome do Expedidor' |
||
3452 | ); |
||
3453 | |||
3454 | return $this->emiDocAnt[$posicao]; |
||
3455 | } |
||
3456 | |||
3457 | /** |
||
3458 | * Gera as tags para o elemento: "idDocAntEle" (Informações dos CT-es Anteriores) |
||
3459 | * #348 |
||
3460 | * Nível: 4 |
||
3461 | * @return mixed |
||
3462 | */ |
||
3463 | public function tagidDocAntEle($std) |
||
3464 | { |
||
3465 | $identificador = '#358 <idDocAntEle> - '; |
||
3466 | $this->idDocAntEle[] = $this->dom->createElement('idDocAntEle'); |
||
3467 | $posicao = (integer)count($this->idDocAntEle) - 1; |
||
3468 | $this->dom->addChild($this->idDocAntEle[$posicao], 'chCTe', $std->chCTe, true, $identificador . 'Chave de ' |
||
3469 | . 'Acesso do CT-e'); |
||
3470 | |||
3471 | return $this->idDocAntEle[$posicao]; |
||
3472 | } |
||
3473 | |||
3474 | |||
3475 | /** |
||
3476 | * Gera as tags para o elemento: "seg" (Informações de Seguro da Carga) |
||
3477 | * #360 |
||
3478 | * Nível: 2 |
||
3479 | * @return mixed |
||
3480 | */ |
||
3481 | public function tagseg($std) |
||
3482 | { |
||
3483 | $identificador = '#360 <seg> - '; |
||
3484 | $this->seg[] = $this->dom->createElement('seg'); |
||
3485 | $posicao = (integer)count($this->seg) - 1; |
||
3486 | |||
3487 | $this->dom->addChild($this->seg[$posicao], 'respSeg', $std->respSeg, true, $identificador . 'Responsável |
||
3488 | pelo Seguro'); |
||
3489 | $this->dom->addChild($this->seg[$posicao], 'xSeg', $std->xSeg, false, $identificador . 'Nome da |
||
3490 | Seguradora'); |
||
3491 | $this->dom->addChild($this->seg[$posicao], 'nApol', $std->nApol, false, $identificador . 'Número da Apólice'); |
||
3492 | return $this->seg[$posicao]; |
||
3493 | } |
||
3494 | |||
3495 | /** |
||
3496 | * Gera as tags para o elemento: "infModal" (Informações do modal) |
||
3497 | * #366 |
||
3498 | * Nível: 2 |
||
3499 | * @param string $versaoModal |
||
0 ignored issues
–
show
There is no parameter named
$versaoModal . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not.
Loading history...
|
|||
3500 | * @return DOMElement|\DOMNode |
||
3501 | */ |
||
3502 | public function taginfModal($std) |
||
3503 | { |
||
3504 | $identificador = '#366 <infModal> - '; |
||
0 ignored issues
–
show
$identificador is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the
Loading history...
|
|||
3505 | $this->infModal = $this->dom->createElement('infModal'); |
||
3506 | $this->infModal->setAttribute('versaoModal', $std->versaoModal); |
||
3507 | return $this->infModal; |
||
3508 | } |
||
3509 | |||
3510 | /** |
||
3511 | * Leiaute - Rodoviário |
||
3512 | * Gera as tags para o elemento: "rodo" (Informações do modal Rodoviário) |
||
3513 | * #1 |
||
3514 | * Nível: 0 |
||
3515 | * @return DOMElement|\DOMNode |
||
3516 | */ |
||
3517 | public function tagrodo($std) |
||
3518 | { |
||
3519 | $identificador = '#1 <rodo> - '; |
||
3520 | $this->rodo = $this->dom->createElement('rodo'); |
||
3521 | $this->dom->addChild( |
||
3522 | $this->rodo, |
||
3523 | 'RNTRC', |
||
3524 | $std->RNTRC, |
||
3525 | true, |
||
3526 | $identificador . 'Registro nacional de transportadores |
||
3527 | rodoviários de carga' |
||
3528 | ); |
||
3529 | |||
3530 | return $this->rodo; |
||
3531 | } |
||
3532 | |||
3533 | /** |
||
3534 | * Leiaute - Rodoviário |
||
3535 | * Gera as tags para o elemento: "rodo" (Informações do modal Rodoviário) CT-e OS |
||
3536 | * #1 |
||
3537 | * Nível: 0 |
||
3538 | * @return DOMElement|\DOMNode |
||
3539 | */ |
||
3540 | public function tagrodoOS($std) |
||
3541 | { |
||
3542 | $identificador = '#1 <rodoOS> - '; |
||
3543 | $this->rodo = $this->dom->createElement('rodoOS'); |
||
3544 | $this->dom->addChild($this->rodo, 'TAF', $std->TAF, false, $identificador . |
||
3545 | 'Termo de Autorização de Fretamento - TAF'); |
||
3546 | $this->dom->addChild($this->rodo, 'NroRegEstadual', $std->nroRegEstadual, false, $identificador . |
||
3547 | 'Número do Registro Estadual'); |
||
3548 | |||
3549 | return $this->rodo; |
||
3550 | } |
||
3551 | |||
3552 | /** |
||
3553 | * CT-e de substituição |
||
3554 | * @param type $std |
||
3555 | * @return type |
||
3556 | */ |
||
3557 | public function taginfCteSub($std) |
||
3558 | { |
||
3559 | $identificador = '#149 <infCteSub> - '; |
||
3560 | $this->infCteSub = $this->dom->createElement('infCteSub'); |
||
3561 | |||
3562 | $this->dom->addChild( |
||
3563 | $this->infCteSub, |
||
3564 | 'chCTe', |
||
3565 | $std->chCTe, |
||
3566 | false, |
||
3567 | "$identificador Chave de acesso do CTe a ser substituído (original)" |
||
3568 | ); |
||
3569 | $this->dom->addChild( |
||
3570 | $this->infCteSub, |
||
3571 | 'retCteAnu', |
||
3572 | $std->retCteAnu, |
||
3573 | false, |
||
3574 | "$identificador Chave de acesso do CT-e de Anulação" |
||
3575 | ); |
||
3576 | return $this->infCteSub; |
||
3577 | } |
||
3578 | |||
3579 | |||
3580 | /** |
||
3581 | * CT-e de substituição - tomaICMS |
||
3582 | * @param type $std |
||
0 ignored issues
–
show
There is no parameter named
$std . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not.
Loading history...
|
|||
3583 | * @return type |
||
3584 | */ |
||
3585 | public function tagtomaICMS() |
||
3586 | { |
||
3587 | $this->tomaICMS = $this->dom->createElement('tomaICMS'); |
||
3588 | |||
3589 | return $this->tomaICMS; |
||
3590 | } |
||
3591 | |||
3592 | /** |
||
3593 | * CT-e de substituição - NF-e |
||
3594 | * @param type $std |
||
3595 | * @return type |
||
3596 | */ |
||
3597 | public function tagrefNFe($std) |
||
3598 | { |
||
3599 | if (empty($this->tomICMS)) { |
||
0 ignored issues
–
show
The property
tomICMS does not seem to exist. Did you mean tomaICMS ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.
Loading history...
|
|||
3600 | $this->tomaICMS = $this->dom->createElement('tomaICMS'); |
||
3601 | } |
||
3602 | $identificador = '#153 <refNFe> - '; |
||
3603 | $this->dom->addChild( |
||
3604 | $this->tomaICMS, |
||
3605 | 'refNFe', |
||
3606 | $std->refNFe, |
||
3607 | false, |
||
3608 | "$identificador Chave de acesso da NF-e emitida pelo tomador" |
||
3609 | ); |
||
3610 | |||
3611 | return $this->tomaICMS; |
||
3612 | } |
||
3613 | |||
3614 | /** |
||
3615 | * CT-e de substituição - NF |
||
3616 | * @param type $std |
||
3617 | * @return type |
||
3618 | */ |
||
3619 | public function tagrefNF($std) |
||
3620 | { |
||
3621 | $identificador = '#154 <refNFe> - '; |
||
3622 | if (empty($this->tomICMS)) { |
||
0 ignored issues
–
show
The property
tomICMS does not seem to exist. Did you mean tomaICMS ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.
Loading history...
|
|||
3623 | $this->tomaICMS = $this->dom->createElement('tomaICMS'); |
||
3624 | } |
||
3625 | $this->refNF = $this->dom->createElement('refNF'); |
||
3626 | if ($std->CNPJ != '') { |
||
3627 | $this->dom->addChild( |
||
3628 | $this->refNF, |
||
3629 | 'CNPJ', |
||
3630 | $std->CNPJ, |
||
3631 | true, |
||
3632 | $identificador . 'CNPJ do emitente' |
||
3633 | ); |
||
3634 | } elseif ($CPF != '') { |
||
0 ignored issues
–
show
|
|||
3635 | $this->dom->addChild( |
||
3636 | $this->refNF, |
||
3637 | 'CPF', |
||
3638 | $std->CPF, |
||
3639 | true, |
||
3640 | $identificador . 'CPF do emitente' |
||
3641 | ); |
||
3642 | } |
||
3643 | $this->dom->addChild($this->refNF, 'mod', $std->mod, false, $identificador . 'Modelo'); |
||
3644 | $this->dom->addChild($this->refNF, 'serie', $std->serie, false, $identificador . 'Série ' |
||
3645 | . 'do documento'); |
||
3646 | $this->dom->addChild($this->refNF, 'subserie', $std->subserie, false, $identificador . 'Subserie ' |
||
3647 | . 'do documento'); |
||
3648 | $this->dom->addChild($this->refNF, 'nro', $std->nro, false, $identificador . 'Número'); |
||
3649 | $this->dom->addChild($this->refNF, 'valor', $std->valor, false, $identificador . 'Valor'); |
||
3650 | $this->dom->addChild($this->refNF, 'dEmi', $std->dEmi, false, $identificador . 'Emissão'); |
||
3651 | |||
3652 | $this->tomaICMS->appendChild($this->refNF); |
||
3653 | |||
3654 | return $this->tomaICMS; |
||
3655 | } |
||
3656 | |||
3657 | /** |
||
3658 | * CT-e de substituição - CT-e |
||
3659 | * @param type $std |
||
3660 | * @return type |
||
3661 | */ |
||
3662 | public function tagrefCTe($std) |
||
3663 | { |
||
3664 | if (empty($this->tomICMS)) { |
||
0 ignored issues
–
show
The property
tomICMS does not seem to exist. Did you mean tomaICMS ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.
Loading history...
|
|||
3665 | $this->tomaICMS = $this->dom->createElement('tomaICMS'); |
||
3666 | } |
||
3667 | $identificador = '#163 <refCTe> - '; |
||
3668 | $this->dom->addChild( |
||
3669 | $this->tomaICMS, |
||
3670 | 'refCTe', |
||
3671 | $std->refCTe, |
||
3672 | false, |
||
3673 | "$identificador Chave de acesso do CT-e emitida pelo tomador" |
||
3674 | ); |
||
3675 | |||
3676 | return $this->tomaICMS; |
||
3677 | } |
||
3678 | |||
3679 | |||
3680 | /** |
||
3681 | * Leiaute - Rodoviário CTe OS |
||
3682 | * Gera as tags para o elemento: "veic" (Dados dos Veículos) |
||
3683 | * #21 |
||
3684 | * Nível: 1 |
||
3685 | * @return mixed |
||
3686 | */ |
||
3687 | public function tagveic($std) |
||
3688 | { |
||
3689 | $identificador = '#21 <veic> - '; |
||
3690 | $this->veic[] = $this->dom->createElement('veic'); |
||
3691 | $posicao = (integer)count($this->veic) - 1; |
||
3692 | if ($std->cInt != '') { |
||
3693 | $this->dom->addChild( |
||
3694 | $this->veic[$posicao], |
||
3695 | 'cInt', |
||
3696 | $std->cInt, |
||
3697 | false, |
||
3698 | $identificador . 'Código interno do veículo' |
||
3699 | ); |
||
3700 | } |
||
3701 | $this->dom->addChild( |
||
3702 | $this->veic[$posicao], |
||
3703 | 'RENAVAM', |
||
3704 | $std->RENAVAM, |
||
3705 | false, |
||
3706 | $identificador . 'RENAVAM do veículo' |
||
3707 | ); |
||
3708 | $this->dom->addChild( |
||
3709 | $this->veic[$posicao], |
||
3710 | 'placa', |
||
3711 | $std->placa, |
||
3712 | false, |
||
3713 | $identificador . 'Placa do veículo' |
||
3714 | ); |
||
3715 | $this->dom->addChild( |
||
3716 | $this->veic[$posicao], |
||
3717 | 'tara', |
||
3718 | $std->tara, |
||
3719 | false, |
||
3720 | $identificador . 'Tara em KG' |
||
3721 | ); |
||
3722 | $this->dom->addChild( |
||
3723 | $this->veic[$posicao], |
||
3724 | 'capKG', |
||
3725 | $std->capKG, |
||
3726 | false, |
||
3727 | $identificador . 'Capacidade em KG' |
||
3728 | ); |
||
3729 | $this->dom->addChild( |
||
3730 | $this->veic[$posicao], |
||
3731 | 'capM3', |
||
3732 | $std->capM3, |
||
3733 | false, |
||
3734 | $identificador . 'Capacidade em M3' |
||
3735 | ); |
||
3736 | $this->dom->addChild( |
||
3737 | $this->veic[$posicao], |
||
3738 | 'tpProp', |
||
3739 | $std->tpProp, |
||
3740 | false, |
||
3741 | $identificador . 'Tipo de Propriedade de veículo' |
||
3742 | ); |
||
3743 | $this->dom->addChild( |
||
3744 | $this->veic[$posicao], |
||
3745 | 'tpVeic', |
||
3746 | $std->tpVeic, |
||
3747 | false, |
||
3748 | $identificador . 'Tipo do veículo' |
||
3749 | ); |
||
3750 | $this->dom->addChild( |
||
3751 | $this->veic[$posicao], |
||
3752 | 'tpRod', |
||
3753 | $std->tpRod, |
||
3754 | false, |
||
3755 | $identificador . 'Tipo do Rodado' |
||
3756 | ); |
||
3757 | $this->dom->addChild( |
||
3758 | $this->veic[$posicao], |
||
3759 | 'tpCar', |
||
3760 | $std->tpCar, |
||
3761 | false, |
||
3762 | $identificador . 'Tipo de Carroceria' |
||
3763 | ); |
||
3764 | $this->dom->addChild( |
||
3765 | $this->veic[$posicao], |
||
3766 | 'UF', |
||
3767 | $std->UF, |
||
3768 | false, |
||
3769 | $identificador . 'UF em que veículo está licenciado' |
||
3770 | ); |
||
3771 | if ($std->tpProp == 'T') { // CASO FOR VEICULO DE TERCEIRO |
||
3772 | $this->prop[] = $this->dom->createElement('prop'); |
||
3773 | $p = (integer)count($this->prop) - 1; |
||
3774 | if ($std->CNPJ != '') { |
||
3775 | $this->dom->addChild( |
||
3776 | $this->prop[$p], |
||
3777 | 'CNPJ', |
||
3778 | $std->CNPJ, |
||
3779 | true, |
||
3780 | $identificador . 'CNPJ do proprietario' |
||
3781 | ); |
||
3782 | } elseif ($CPF != '') { |
||
0 ignored issues
–
show
|
|||
3783 | $this->dom->addChild( |
||
3784 | $this->prop[$p], |
||
3785 | 'CPF', |
||
3786 | $CPF, |
||
3787 | true, |
||
3788 | $identificador . 'CPF do proprietario' |
||
3789 | ); |
||
3790 | } |
||
3791 | $this->dom->addChild( |
||
3792 | $this->prop[$p], |
||
3793 | 'RNTRC', |
||
3794 | $std->RNTRC, |
||
3795 | true, |
||
3796 | $identificador . 'RNTRC do proprietario' |
||
3797 | ); |
||
3798 | $this->dom->addChild( |
||
3799 | $this->prop[$p], |
||
3800 | 'xNome', |
||
3801 | $std->xNome, |
||
3802 | true, |
||
3803 | $identificador . 'Nome do proprietario' |
||
3804 | ); |
||
3805 | $this->dom->addChild( |
||
3806 | $this->prop[$p], |
||
3807 | 'IE', |
||
3808 | Strings::onlyNumbers($std->IE), |
||
3809 | true, |
||
3810 | $identificador . 'IE do proprietario' |
||
3811 | ); |
||
3812 | $this->dom->addChild( |
||
3813 | $this->prop[$p], |
||
3814 | 'UF', |
||
3815 | $std->propUF, |
||
3816 | true, |
||
3817 | $identificador . 'UF do proprietario' |
||
3818 | ); |
||
3819 | $this->dom->addChild( |
||
3820 | $this->prop[$p], |
||
3821 | 'tpProp', |
||
3822 | $std->tpPropProp, |
||
3823 | true, |
||
3824 | $identificador . 'Tipo Proprietário' |
||
3825 | ); |
||
3826 | $this->dom->appChild($this->veic[$posicao], $this->prop[$p], 'Falta tag "prop"'); |
||
3827 | } |
||
3828 | return $this->veic[$posicao]; |
||
3829 | } |
||
3830 | |||
3831 | /** |
||
3832 | * Leiaute - Rodoviário |
||
3833 | * Gera as tags para o elemento: "veic" (Dados dos Veículos) |
||
3834 | * #21 |
||
3835 | * Nível: 1 |
||
3836 | * @return mixed |
||
3837 | */ |
||
3838 | public function tagveicCTeOS($std) |
||
3839 | { |
||
3840 | $identificador = '#21 <veic> - '; |
||
3841 | $this->veic = $this->dom->createElement('veic'); |
||
3842 | |||
3843 | $this->dom->addChild( |
||
3844 | $this->veic, |
||
3845 | 'placa', |
||
3846 | $std->placa, |
||
3847 | false, |
||
3848 | $identificador . 'Placa do veículo' |
||
3849 | ); |
||
3850 | $this->dom->addChild( |
||
3851 | $this->veic, |
||
3852 | 'RENAVAM', |
||
3853 | $std->RENAVAM, |
||
3854 | false, |
||
3855 | $identificador . 'RENAVAM do veículo' |
||
3856 | ); |
||
3857 | if ($std->xNome != '') { // CASO FOR VEICULO DE TERCEIRO |
||
3858 | $this->prop = $this->dom->createElement('prop'); |
||
3859 | if ($std->CNPJ != '') { |
||
3860 | $this->dom->addChild( |
||
3861 | $this->prop, |
||
3862 | 'CNPJ', |
||
3863 | $std->CNPJ, |
||
3864 | true, |
||
3865 | $identificador . 'CNPJ do proprietario' |
||
3866 | ); |
||
3867 | } elseif ($CPF != '') { |
||
0 ignored issues
–
show
|
|||
3868 | $this->dom->addChild( |
||
3869 | $this->prop, |
||
3870 | 'CPF', |
||
3871 | $std->CPF, |
||
3872 | true, |
||
3873 | $identificador . 'CPF do proprietario' |
||
3874 | ); |
||
3875 | } |
||
3876 | $this->dom->addChild( |
||
3877 | $this->prop, |
||
3878 | 'TAF', |
||
3879 | $std->taf, |
||
3880 | false, |
||
3881 | $identificador . 'TAF' |
||
3882 | ); |
||
3883 | $this->dom->addChild( |
||
3884 | $this->prop, |
||
3885 | 'NroRegEstadual', |
||
3886 | $std->nroRegEstadual, |
||
3887 | false, |
||
3888 | $identificador . 'Número do Registro Estadual' |
||
3889 | ); |
||
3890 | $this->dom->addChild( |
||
3891 | $this->prop, |
||
3892 | 'xNome', |
||
3893 | $std->xNome, |
||
3894 | true, |
||
3895 | $identificador . 'Nome do proprietario' |
||
3896 | ); |
||
3897 | $this->dom->addChild( |
||
3898 | $this->prop, |
||
3899 | 'IE', |
||
3900 | Strings::onlyNumbers($std->IE), |
||
3901 | true, |
||
3902 | $identificador . 'IE do proprietario' |
||
3903 | ); |
||
3904 | $this->dom->addChild( |
||
3905 | $this->prop, |
||
3906 | 'UF', |
||
3907 | $std->ufProp, |
||
3908 | true, |
||
3909 | $identificador . 'UF do proprietario' |
||
3910 | ); |
||
3911 | $this->dom->addChild( |
||
3912 | $this->prop, |
||
3913 | 'tpProp', |
||
3914 | $std->tpProp, |
||
3915 | true, |
||
3916 | $identificador . 'Tipo Proprietário' |
||
3917 | ); |
||
3918 | $this->dom->appChild($this->veic, $this->prop, 'Falta tag "prop"'); |
||
3919 | } |
||
3920 | $this->dom->addChild( |
||
3921 | $this->veic, |
||
3922 | 'UF', |
||
3923 | $std->uf, |
||
3924 | false, |
||
3925 | $identificador . 'UF em que veículo está licenciado' |
||
3926 | ); |
||
3927 | return $this->veic; |
||
3928 | } |
||
3929 | |||
3930 | /** |
||
3931 | * Gera as tags para o elemento: "infCteComp" (Detalhamento do CT-e complementado) |
||
3932 | * #410 |
||
3933 | * Nível: 1 |
||
3934 | * @return DOMElement|\DOMNode |
||
3935 | */ |
||
3936 | public function taginfCTeComp($std) |
||
3937 | { |
||
3938 | $identificador = '#410 <infCteComp> - '; |
||
3939 | $this->infCteComp = $this->dom->createElement('infCteComp'); |
||
3940 | $this->dom->addChild( |
||
3941 | $this->infCteComp, |
||
3942 | 'chave', |
||
3943 | $std->chave, |
||
3944 | true, |
||
3945 | $identificador . ' Chave do CT-e complementado' |
||
3946 | ); |
||
3947 | return $this->infCteComp; |
||
3948 | } |
||
3949 | |||
3950 | /** |
||
3951 | * Gera as tags para o elemento: "infCteAnu" (Detalhamento do CT-e de Anulação) |
||
3952 | * #411 |
||
3953 | * Nível: 1 |
||
3954 | * @return DOMElement|\DOMNode |
||
3955 | */ |
||
3956 | public function taginfCteAnu($std) |
||
3957 | { |
||
3958 | $identificador = '#411 <infCteAnu> - '; |
||
3959 | $this->infCteAnu = $this->dom->createElement('infCteAnu'); |
||
3960 | $this->dom->addChild( |
||
3961 | $this->infCteAnu, |
||
3962 | 'chCte', |
||
3963 | $std->chave, |
||
3964 | true, |
||
3965 | $identificador . ' Chave do CT-e anulado' |
||
3966 | ); |
||
3967 | $this->dom->addChild( |
||
3968 | $this->infCteAnu, |
||
3969 | 'dEmi', |
||
3970 | $std->data, |
||
3971 | true, |
||
3972 | $identificador . ' Data de Emissão do CT-e anulado' |
||
3973 | ); |
||
3974 | return $this->infCteAnu; |
||
3975 | } |
||
3976 | |||
3977 | protected function checkCTeKey(Dom $dom) |
||
3978 | { |
||
3979 | $infCTe = $dom->getElementsByTagName("infCte")->item(0); |
||
3980 | $ide = $dom->getElementsByTagName("ide")->item(0); |
||
3981 | $emit = $dom->getElementsByTagName("emit")->item(0); |
||
3982 | $cUF = $ide->getElementsByTagName('cUF')->item(0)->nodeValue; |
||
3983 | $dhEmi = $ide->getElementsByTagName('dhEmi')->item(0)->nodeValue; |
||
3984 | $cnpj = $emit->getElementsByTagName('CNPJ')->item(0)->nodeValue; |
||
3985 | $mod = $ide->getElementsByTagName('mod')->item(0)->nodeValue; |
||
3986 | $serie = $ide->getElementsByTagName('serie')->item(0)->nodeValue; |
||
3987 | $nNF = $ide->getElementsByTagName('nCT')->item(0)->nodeValue; |
||
3988 | $tpEmis = $ide->getElementsByTagName('tpEmis')->item(0)->nodeValue; |
||
3989 | $cCT = $ide->getElementsByTagName('cCT')->item(0)->nodeValue; |
||
3990 | $chave = str_replace('CTe', '', $infCTe->getAttribute("Id")); |
||
3991 | |||
3992 | $dt = new DateTime($dhEmi); |
||
3993 | |||
3994 | $chaveMontada = Keys::build( |
||
3995 | $cUF, |
||
3996 | $dt->format('y'), |
||
3997 | $dt->format('m'), |
||
3998 | $cnpj, |
||
3999 | $mod, |
||
4000 | $serie, |
||
4001 | $nNF, |
||
4002 | $tpEmis, |
||
4003 | $cCT |
||
4004 | ); |
||
4005 | //caso a chave contida no CTe esteja errada |
||
4006 | //substituir a chave |
||
4007 | if ($chaveMontada != $chave) { |
||
4008 | $ide->getElementsByTagName('cDV')->item(0)->nodeValue = substr($chaveMontada, -1); |
||
4009 | $infCTe = $dom->getElementsByTagName("infCte")->item(0); |
||
4010 | $infCTe->setAttribute("Id", "CTe" . $chaveMontada); |
||
4011 | $this->chCTe = $chaveMontada; |
||
4012 | } |
||
4013 | } |
||
4014 | } |
||
4015 |
This check marks private properties in classes that are never used. Those properties can be removed.