Completed
Push — master ( 5f2082...2ea8e4 )
by
unknown
9s
created

Make::infCTeComp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 10
nc 1
nop 1
crap 2
1
<?php
2
namespace NFePHP\CTe;
3
4
/**
5
 *
6
 * @category  Library
7
 * @package   nfephp-org/sped-cte
8
 * @copyright 2009-2016 NFePHP
9
 * @name      Make .php
10
 * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL v.3
11
 * @link      http://github.com/nfephp-org/sped-cte for the canonical source repository
12
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
13
 */
14
15
use NFePHP\Common\Base\BaseMake;
16
use \DOMElement;
17
18
class Make extends BaseMake
19
{
20
    /**
21
     * versao
22
     * numero da versão do xml da CTe
23
     * @var string
24
     */
25
    public $versao = '2.00';
26
    /**
27
     * mod
28
     * modelo da CTe 57
29
     * @var integer
30
     */
31
    public $mod = 57;
32
    /**
33
     * chave da MDFe
34
     * @var string
35
     */
36
    public $chCTe = '';
37
    /**
38
     * xml
39
     * String com o xml do documento fiscal montado
40
     * @var string
41
     */
42
    public $xml = '';
43
    /**
44
     * dom
45
     * Variável onde será montado o xml do documento fiscal
46
     * @var \NFePHP\Common\Dom\Dom
47
     */
48
    public $dom;
49
    /**
50
     * tpAmb
51
     * tipo de ambiente
52
     * @var string
53
     */
54
    public $tpAmb = '2';
55
    /**
56
     * Modal do Cte
57
     * @var integer
58
     */
59
    private $modal = 0;
60
    /**
61
     * Tag CTe
62
     * @var \DOMNode
63
     */
64
    private $CTe = '';
65
    /**
66
     * Informações do CT-e
67
     * @var \DOMNode
68
     */
69
    private $infCte = '';
70
    /**
71
     * Identificação do CT-e
72
     * @var \DOMNode
73
     */
74
    private $ide = '';
75
    /**
76
     * Tipo do Serviço
77
     * @var integer
78
     */
79
    private $tpServ = 0;
80
    /**
81
     * Indicador do "papel" do tomador do serviço no CT-e
82
     * @var \DOMNode
83
     */
84
    private $toma03 = '';
85
    /**
86
     * Indicador do "papel" do tomador do serviço no CT-e
87
     * @var \DOMNode
88
     */
89
    private $toma4 = '';
90
    /**
91
     * Dados do endereço
92
     * @var \DOMNode
93
     */
94
    private $enderToma = '';
95
    /**
96
     * Dados complementares do CT-e para fins operacionais ou comerciais
97
     * @var \DOMNode
98
     */
99
    private $compl = '';
100
    /**
101
     * Previsão do fluxo da carga
102
     * @var \DOMNode
103
     */
104
    private $fluxo = '';
105
    /**
106
     * Passagem
107
     * @var array
108
     */
109
    private $pass = array();
110
    /**
111
     * Informações ref. a previsão de entrega
112
     * @var \DOMNode
113
     */
114
    private $entrega = '';
115
    /**
116
     * Entrega sem data definida
117
     * @var \DOMNode
118
     */
119
    private $semData = '';
120
    /**
121
     * Entrega com data definida
122
     * @var \DOMNode
123
     */
124
    private $comData = '';
125
    /**
126
     * Entrega no período definido
127
     * @var \DOMNode
128
     */
129
    private $noPeriodo = '';
130
    /**
131
     * Entrega sem hora definida
132
     * @var \DOMNode
133
     */
134
    private $semHora = '';
135
    /**
136
     * Entrega com hora definida
137
     * @var \DOMNode
138
     */
139
    private $comHora = '';
140
    /**
141
     * Entrega no intervalo de horário definido
142
     * @var \DOMNode
143
     */
144
    private $noInter = '';
145
    /**
146
     * Campo de uso livre do contribuinte
147
     * @var array
148
     */
149
    private $obsCont = array();
150
    /**
151
     * Campo de uso livre do contribuinte
152
     * @var array
153
     */
154
    private $obsFisco = array();
155
    /**
156
     * Identificação do Emitente do CT-e
157
     * @var \DOMNode
158
     */
159
    private $emit = '';
160
    /**
161
     * Endereço do emitente
162
     * @var \DOMNode
163
     */
164
    private $enderEmit = '';
165
    /**
166
     * Informações do Remetente das mercadorias transportadas pelo CT-e
167
     * @var \DOMNode
168
     */
169
    private $rem = '';
170
    /**
171
     * Dados do endereço
172
     * @var \DOMNode
173
     */
174
    private $enderReme = '';
175
    /**
176
     * Informações do Expedidor da Carga
177
     * @var \DOMNode
178
     */
179
    private $exped = '';
180
    /**
181
     * Dados do endereço
182
     * @var \DOMNode
183
     */
184
    private $enderExped = '';
185
    /**
186
     * Informações do Recebedor da Carga
187
     * @var \DOMNode
188
     */
189
    private $receb = '';
190
    /**
191
     * Dados do endereço
192
     * @var \DOMNode
193
     */
194
    private $enderReceb = '';
195
    /**
196
     * Informações do Destinatário do CT-e
197
     * @var \DOMNode
198
     */
199
    private $dest = '';
200
    /**
201
     * Dados do endereço
202
     * @var \DOMNode
203
     */
204
    private $enderDest = '';
205
    /**
206
     * Valores da Prestação de Serviço
207
     * @var \DOMNode
208
     */
209
    private $vPrest = '';
210
    /**
211
     * Componentes do Valor da Prestação
212
     * @var array
213
     */
214
    private $comp = array();
215
    /**
216
     * Informações relativas aos Impostos
217
     * @var \DOMNode
218
     */
219
    private $imp = '';
220
    /**
221
     * Informações relativas ao ICMS
222
     * @var \DOMNode
223
     */
224
    private $ICMS = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
225
    /**
226
     * Prestação sujeito à tributação normal do ICMS
227
     * @var \DOMNode
228
     */
229
    private $ICMS00 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS00 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
230
    /**
231
     * Prestação sujeito à tributação com redução de BC do ICMS
232
     * @var \DOMNode
233
     */
234
    private $ICMS20 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS20 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
235
    /**
236
     * ICMS Isento, não Tributado ou diferido
237
     * @var \DOMNode
238
     */
239
    private $ICMS45 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS45 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
240
    /**
241
     * Tributação pelo ICMS60 - ICMS cobrado por substituição tributária.
242
     * Responsabilidade do recolhimento do ICMS atribuído ao tomador ou 3º por ST
243
     * @var \DOMNode
244
     */
245
    private $ICMS60 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS60 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
246
    /**
247
     * ICMS Outros
248
     * @var \DOMNode
249
     */
250
    private $ICMS90 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS90 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
251
    /**
252
     * ICMS devido à UF de origem da prestação, quando diferente da UF do emitente
253
     * @var \DOMNode
254
     */
255
    private $ICMSOutraUF = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMSOutraUF is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
256
    /**
257
     * Simples Nacional
258
     * @var \DOMNode
259
     */
260
    private $ICMSSN = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMSSN is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
261
    /**
262
     * Observações adicionais da CT-e
263
     * @var string
264
     */
265
    private $xObs = '';
0 ignored issues
show
Unused Code introduced by
The property $xObs is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
266
    /**
267
     * Grupo de informações do CT-e Normal e Substituto
268
     * @var \DOMNode
269
     */
270
    private $infCTeNorm = '';
271
    /**
272
     * Informações da Carga do CT-e
273
     * @var \DOMNode
274
     */
275
    private $infCarga = '';
276
    /**
277
     * Informações de quantidades da Carga do CT-e
278
     * @var \DOMNode
279
     */
280
    private $infQ = array();
281
    /**
282
     * Informações dos documentos transportados pelo CT-e Opcional para Redespacho Intermediario
283
     * e Serviço vinculado a multimodal.
284
     * @var \DOMNode
285
     */
286
    private $infDoc = array();
287
    /**
288
     * Informações das NF
289
     * @var array
290
     */
291
    private $infNF = array();
292
    /**
293
     * Informações das NF-e
294
     * @var array
295
     */
296
    private $infNFe = array();
297
    /**
298
     * Informações dos demais documentos
299
     * @var array
300
     */
301
    private $infOutros = array();
302
    /**
303
     * Informações das Unidades de Transporte (Carreta/Reboque/Vagão)
304
     * @var array
305
     */
306
    private $infUnidTransp = array();
0 ignored issues
show
Unused Code introduced by
The property $infUnidTransp is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
307
    /**
308
     * Lacres das Unidades de Transporte
309
     * @var array
310
     */
311
    private $lacUnidTransp = array();
0 ignored issues
show
Unused Code introduced by
The property $lacUnidTransp is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
312
    /**
313
     * Informações das Unidades de Carga (Containeres/ULD/Outros)
314
     * @var array
315
     */
316
    private $infUnidCarga = array();
0 ignored issues
show
Unused Code introduced by
The property $infUnidCarga is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
317
    /**
318
     * Lacres das Unidades de Carga
319
     * @var array
320
     */
321
    private $lacUnidCarga = array();
0 ignored issues
show
Unused Code introduced by
The property $lacUnidCarga is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
322
    /**
323
     * Documentos de Transporte Anterior
324
     * @var \DOMNode
325
     */
326
    private $docAnt = array();
327
    /**
328
     * Emissor do documento anterior
329
     * @var array
330
     */
331
    private $emiDocAnt = array();
332
    /**
333
     * Informações de identificação dos documentos de Transporte Anterior
334
     * @var array
335
     */
336
    private $idDocAnt = array();
337
    /**
338
     * Documentos de transporte anterior em papel
339
     * @var array
340
     */
341
    private $idDocAntPap = array();
0 ignored issues
show
Unused Code introduced by
The property $idDocAntPap is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
342
    /**
343
     * Documentos de transporte anterior eletrônicos
344
     * @var array
345
     */
346
    private $idDocAntEle = array();
347
    /**
348
     * Informações de Seguro da Carga
349
     * @var array
350
     */
351
    private $seg = array();
352
    /**
353
     * Informações do modal
354
     * @var \DOMNode
355
     */
356
    private $infModal = '';
357
    /**
358
     * Preenchido quando for transporte de produtos classificados pela ONU como perigosos.
359
     * @var array
360
     */
361
    private $peri = array();
0 ignored issues
show
Unused Code introduced by
The property $peri is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
362
    /**
363
     * informações dos veículos transportados
364
     * @var array
365
     */
366
    private $veicNovos = array();
0 ignored issues
show
Unused Code introduced by
The property $veicNovos is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
367
    /**
368
     * Dados da cobrança do CT-e
369
     * @var \DOMNode
370
     */
371
    private $cobr = '';
0 ignored issues
show
Unused Code introduced by
The property $cobr is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
372
    /**
373
     * Dados da fatura
374
     * @var \DOMNode
375
     */
376
    private $fat = '';
0 ignored issues
show
Unused Code introduced by
The property $fat is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
377
    /**
378
     * Dados das duplicatas
379
     * @var array
380
     */
381
    private $dup = array();
0 ignored issues
show
Unused Code introduced by
The property $dup is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
382
    /**
383
     * Informações do CT-e de substituição
384
     * @var \DOMNode
385
     */
386
    private $infCteSub = '';
0 ignored issues
show
Unused Code introduced by
The property $infCteSub is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
387
    /**
388
     * Tomador é contribuinte do ICMS
389
     * @var \DOMNode
390
     */
391
    private $tomaICMS = '';
0 ignored issues
show
Unused Code introduced by
The property $tomaICMS is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
392
    /**
393
     * Tomador não é contribuinte do ICMS
394
     * @var \DOMNode
395
     */
396
    private $tomaNaoICMS = '';
0 ignored issues
show
Unused Code introduced by
The property $tomaNaoICMS is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
397
    /**
398
     * Informação da NF ou CT emitido pelo Tomador
399
     * @var \DOMNode
400
     */
401
    private $refNF = '';
0 ignored issues
show
Unused Code introduced by
The property $refNF is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
402
    /**
403
     * Informação do CTe emitido pelo Tomador
404
     * @var \DOMNode
405
     */
406
    private $refCte = '';
0 ignored issues
show
Unused Code introduced by
The property $refCte is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
407
    /**
408
     * Informação da NF ou CT emitido pelo Tomador
409
     * @var \DOMNode
410
     */
411
    private $infCteComp = '';
412
    /**
413
     * Detalhamento do CT-e do tipo Anulação
414
     * @var \DOMNode
415
     */
416
    private $infCteAnu = '';
0 ignored issues
show
Unused Code introduced by
The property $infCteAnu is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
417
    /**
418
     * Informações do modal Rodoviário
419
     * @var \DOMNode
420
     */
421
    private $rodo = '';
422
    /**
423
     * Ordens de Coleta associados
424
     * @var array
425
     */
426
    private $occ = array();
0 ignored issues
show
Unused Code introduced by
The property $occ is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
427
    /**
428
     * @var \DOMNode
429
     */
430
    private $emiOcc = array();
0 ignored issues
show
Unused Code introduced by
The property $emiOcc is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
431
    /**
432
     * Informações de Vale Pedágio
433
     * @var array
434
     */
435
    private $valePed = array();
0 ignored issues
show
Unused Code introduced by
The property $valePed is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
436
    /**
437
     * Dados dos Veículos
438
     * @var array
439
     */
440
    private $veic = array();
441
    /**
442
     * Proprietários do Veículo. Só preenchido quando o veículo não pertencer à empresa emitente do CT-e
443
     * @var array
444
     */
445
    private $prop = array();
446
    /**
447
     * Dados dos Veículos
448
     * @var array
449
     */
450
    private $lacRodo = array();
0 ignored issues
show
Unused Code introduced by
The property $lacRodo is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
451
    /**
452
     * Informações do(s) Motorista(s)
453
     * @var array
454
     */
455
    private $moto = array();
456
457
    /**
458
     * Monta o arquivo XML usando as tag's já preenchidas
459
     *
460
     * @return bool
461
     */
462
    public function montaCTe()
463
    {
464
        if (count($this->erros) > 0) {
465
            return false;
466
        }
467
        $this->zCTeTag();
468
        if ($this->toma03 != '') {
469
            $this->dom->appChild($this->ide, $this->toma03, 'Falta tag "ide"');
470
        } else {
471
            $this->dom->appChild($this->toma4, $this->enderToma, 'Falta tag "toma4"');
472
            $this->dom->appChild($this->ide, $this->toma4, 'Falta tag "ide"');
473
        }
474
        $this->dom->appChild($this->infCte, $this->ide, 'Falta tag "infCte"');
475
        if ($this->compl != '') {
476
            if ($this->fluxo != '') {
477
                foreach ($this->pass as $pass) {
478
                    $this->dom->appChild($this->fluxo, $pass, 'Falta tag "fluxo"');
479
                }
480
                $this->dom->appChild($this->compl, $this->fluxo, 'Falta tag "infCte"');
481
            }
482
            if ($this->semData != '') {
483
                $this->zEntregaTag();
484
                $this->dom->appChild($this->entrega, $this->semData, 'Falta tag "Entrega"');
485
            } elseif ($this->comData != '') {
486
                $this->zEntregaTag();
487
                $this->dom->appChild($this->entrega, $this->comData, 'Falta tag "Entrega"');
488
            } elseif ($this->noPeriodo != '') {
489
                $this->zEntregaTag();
490
                $this->dom->appChild($this->entrega, $this->noPeriodo, 'Falta tag "Entrega"');
491
            } elseif ($this->semHora != '') {
492
                $this->zEntregaTag();
493
                $this->dom->appChild($this->entrega, $this->semHora, 'Falta tag "Entrega"');
494
            } elseif ($this->comHora != '') {
495
                $this->zEntregaTag();
496
                $this->dom->appChild($this->entrega, $this->comHora, 'Falta tag "Entrega"');
497
            } elseif ($this->noInter != '') {
498
                $this->zEntregaTag();
499
                $this->dom->appChild($this->entrega, $this->noInter, 'Falta tag "Entrega"');
500
            }
501
            foreach ($this->obsCont as $obsCont) {
502
                $this->dom->appChild($this->compl, $obsCont, 'Falta tag "compl"');
503
            }
504
            foreach ($this->obsFisco as $obsFisco) {
505
                $this->dom->appChild($this->compl, $obsFisco, 'Falta tag "compl"');
506
            }
507
            $this->dom->appChild($this->infCte, $this->compl, 'Falta tag "infCte"');
508
        }
509
        $this->dom->appChild($this->emit, $this->enderEmit, 'Falta tag "emit"');
510
        $this->dom->appChild($this->infCte, $this->emit, 'Falta tag "infCte"');
511
        if ($this->rem != '') {
512
            //    $this->dom->appChild($this->rem, $this->enderReme, 'Falta tag "rem"');
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
513
            $this->dom->appChild($this->infCte, $this->rem, 'Falta tag "infCte"');
514
        }
515
        if ($this->exped != '') {
516
//            $this->dom->appChild($this->exped, $this->enderExped, 'Falta tag "exped"');
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
517
            $this->dom->appChild($this->infCte, $this->exped, 'Falta tag "infCte"');
518
        }
519
        if ($this->receb != '') {
520
//            $this->dom->appChild($this->receb, $this->enderReceb, 'Falta tag "receb"');
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
521
            $this->dom->appChild($this->infCte, $this->receb, 'Falta tag "infCte"');
522
        }
523
        if ($this->dest != '') {
524
            //    $this->dom->appChild($this->dest, $this->enderDest, 'Falta tag "dest"');
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
525
            $this->dom->appChild($this->infCte, $this->dest, 'Falta tag "infCte"');
526
        }
527
        foreach ($this->comp as $comp) {
528
            $this->dom->appChild($this->vPrest, $comp, 'Falta tag "vPrest"');
529
        }
530
        $this->dom->appChild($this->infCte, $this->vPrest, 'Falta tag "infCte"');
531
        $this->dom->appChild($this->infCte, $this->imp, 'Falta tag "imp"');
532
        if ($this->infCteComp != '') { // Caso seja um CTe tipo complemento de valores
533
            $this->dom->appChild($this->infCte, $this->infCteComp, 'Falta tag "infCteComp"');
534
        }
535
        if ($this->infCTeNorm != '') { // Caso seja um CTe tipo normal
536
            $this->dom->appChild($this->infCte, $this->infCTeNorm, 'Falta tag "infCTeNorm"');
537
            $this->dom->appChild($this->infCTeNorm, $this->infCarga, 'Falta tag "infCarga"');
538
            foreach ($this->infQ as $infQ) {
0 ignored issues
show
Bug introduced by
The expression $this->infQ of type object<DOMNode> is not traversable.
Loading history...
539
                $this->dom->appChild($this->infCarga, $infQ, 'Falta tag "infQ"');
540
            }
541
542
            $this->dom->appChild($this->infCTeNorm, $this->infDoc, 'Falta tag "infDoc"');
543
            foreach ($this->infNF as $infNF) {
544
                $this->dom->appChild($this->infDoc, $infNF, 'Falta tag "infNF"');
545
            }
546
            foreach ($this->infNFe as $infNFe) {
547
                $this->dom->appChild($this->infDoc, $infNFe, 'Falta tag "infNFe"');
548
            }
549
            foreach ($this->infOutros as $infOutros) {
550
                $this->dom->appChild($this->infDoc, $infOutros, 'Falta tag "infOutros"');
551
            }
552
553
            if ($this->idDocAntEle != []) { //Caso tenha CT-es Anteriores viculados
554
                $this->dom->appChild($this->infCTeNorm, $this->docAnt, 'Falta tag "docAnt"');
555
556
                foreach ($this->emiDocAnt as $emiDocAnt) {
557
                    $this->dom->appChild($this->docAnt, $emiDocAnt, 'Falta tag "emiDocAnt"');
558
                    $this->dom->appChild($emiDocAnt, $this->idDocAnt, 'Falta tag "idDocAnt"');
559
560
                    foreach ($this->idDocAntEle as $idDocAntEle) {
561
                        $this->dom->appChild($this->idDocAnt, $idDocAntEle, 'Falta tag "emiDocAnt"');
562
                    }
563
                }
564
            }
565
566
            foreach ($this->seg as $seg) {
567
                $this->dom->appChild($this->infCTeNorm, $seg, 'Falta tag "seg"');
568
            }
569
570
            $this->dom->appChild($this->infCTeNorm, $this->infModal, 'Falta tag "infModal"');
571
            $this->dom->appChild($this->infModal, $this->rodo, 'Falta tag "rodo"');
572
        }
573
        foreach ($this->veic as $veic) {
574
            $this->dom->appChild($this->rodo, $veic, 'Falta tag "veic"');
575
        }
576
        foreach ($this->moto as $moto) {
577
            $this->dom->appChild($this->rodo, $moto, 'Falta tag "moto"');
578
        }
579
580
        $this->dom->appChild($this->CTe, $this->infCte, 'Falta tag "CTe"');
581
        $this->dom->appChild($this->dom, $this->CTe, 'Falta tag "DOMDocument"');
582
        $this->xml = $this->dom->saveXML();
583
        return true;
584
    }
585
586
    /**
587
     * Gera o grupo básico: Informações do CT-e
588
     * #1
589
     * Nível: 0
590
     * @param string $chave
591
     * @param string $versao
592
     * @return DOMElement|\DOMNode
593
     */
594
    public function infCteTag($chave = '', $versao = '')
595
    {
596
        $this->infCte = $this->dom->createElement('infCte');
597
        $this->infCte->setAttribute('Id', 'CTe' . $chave);
598
        $this->infCte->setAttribute('versao', $versao);
599
        return $this->infCte;
600
    }
601
602
    /**
603
     * Gera as tags para o elemento: Identificação do CT-e
604
     * #4
605
     * Nível: 1
606
     * 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
607
     * @param string $cUF Código da UF do emitente do CT-e
608
     * @param string $cCT Código numérico que compõe a Chave de Acesso
609
     * @param string $CFOP Código Fiscal de Operações e Prestações
610
     * @param string $natOp Natureza da Operação
611
     * @param string $forPag Forma de pagamento do serviço
612
     * @param string $mod Modelo do documento fiscal
613
     * @param string $serie Série do CT-e
614
     * @param string $nCT Número do CT-e
615
     * @param string $dhEmi Data e hora de emissão do CT-e
616
     * @param string $tpImp Formato de impressão do DACTE
617
     * @param string $tpEmis Forma de emissão do CT-e
618
     * @param string $cDV Digito Verificador da chave de acesso do CT-e
619
     * @param string $tpAmb Tipo do Ambiente
620
     * @param string $tpCTe Tipo do CT-e
621
     * @param string $procEmi Identificador do processo de emissão do CT-e
622
     * @param string $verProc Versão do processo de emissão
623
     * @param string $refCTE Chave de acesso do CT-e referenciado
624
     * @param string $cMunEnv Código do Município de envio do CT-e (de onde o documento foi transmitido)
625
     * @param string $xMunEnv Nome do Município de envio do CT-e (de onde o documento foi transmitido)
626
     * @param string $UFEnv Sigla da UF de envio do CT-e (de onde o documento foi transmitido)
627
     * @param string $modal Modal
628
     * @param string $tpServ Tipo do Serviço
629
     * @param string $cMunIni Código do Município de início da prestação
630
     * @param string $xMunIni Nome do Município do início da prestação
631
     * @param string $UFIni UF do início da prestação
632
     * @param string $cMunFim Código do Município de término da prestação
633
     * @param string $xMunFim Nome do Município do término da prestação
634
     * @param string $UFFim UF do término da prestação
635
     * @param string $retira Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino?
636
     * @param string $xDetRetira Detalhes do retira
637
     * @param string $dhCont Data e Hora da entrada em contingência
638
     * @param string $xJust Justificativa da entrada em contingência
639
     * @return DOMElement|\DOMNode
640
     */
641
    public function ideTag(
642
        $cUF = '',
643
        $cCT = '',
644
        $CFOP = '',
645
        $natOp = '',
646
        $forPag = '',
647
        $mod = '',
648
        $serie = '',
649
        $nCT = '',
650
        $dhEmi = '',
651
        $tpImp = '',
652
        $tpEmis = '',
653
        $cDV = '',
654
        $tpAmb = '',
655
        $tpCTe = '',
656
        $procEmi = '',
657
        $verProc = '',
658
        $refCTE = '',
659
        $cMunEnv = '',
660
        $xMunEnv = '',
661
        $UFEnv = '',
662
        $modal = '',
663
        $tpServ = '',
664
        $cMunIni = '',
665
        $xMunIni = '',
666
        $UFIni = '',
667
        $cMunFim = '',
668
        $xMunFim = '',
669
        $UFFim = '',
670
        $retira = '',
671
        $xDetRetira = '',
672
        $dhCont = '',
673
        $xJust = ''
674
    ) {
675
        $this->tpAmb = $tpAmb;
676
        $identificador = '#4 <ide> - ';
677
        $this->ide = $this->dom->createElement('ide');
678
        $this->dom->addChild(
679
            $this->ide,
680
            'cUF',
681
            $cUF,
682
            true,
683
            $identificador . 'Código da UF do emitente do CT-e'
684
        );
685
        $this->dom->addChild(
686
            $this->ide,
687
            'cCT',
688
            $cCT,
689
            true,
690
            $identificador . 'Código numérico que compõe a Chave de Acesso'
691
        );
692
        $this->dom->addChild(
693
            $this->ide,
694
            'CFOP',
695
            $CFOP,
696
            true,
697
            $identificador . 'Código Fiscal de Operações e Prestações'
698
        );
699
        $this->dom->addChild(
700
            $this->ide,
701
            'natOp',
702
            $natOp,
703
            true,
704
            $identificador . 'Natureza da Operação'
705
        );
706
        $this->dom->addChild(
707
            $this->ide,
708
            'forPag',
709
            $forPag,
710
            true,
711
            $identificador . 'Forma de pagamento do serviço'
712
        );
713
        $this->dom->addChild(
714
            $this->ide,
715
            'mod',
716
            $mod,
717
            true,
718
            $identificador . 'Modelo do documento fiscal'
719
        );
720
        $this->mod = $mod;
0 ignored issues
show
Documentation Bug introduced by
The property $mod was declared of type integer, but $mod is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
721
        $this->dom->addChild(
722
            $this->ide,
723
            'serie',
724
            $serie,
725
            true,
726
            $identificador . 'Série do CT-e'
727
        );
728
        $this->dom->addChild(
729
            $this->ide,
730
            'nCT',
731
            $nCT,
732
            true,
733
            $identificador . 'Número do CT-e'
734
        );
735
        $this->dom->addChild(
736
            $this->ide,
737
            'dhEmi',
738
            $dhEmi,
739
            true,
740
            $identificador . 'Data e hora de emissão do CT-e'
741
        );
742
        $this->dom->addChild(
743
            $this->ide,
744
            'tpImp',
745
            $tpImp,
746
            true,
747
            $identificador . 'Formato de impressão do DACTE'
748
        );
749
        $this->dom->addChild(
750
            $this->ide,
751
            'tpEmis',
752
            $tpEmis,
753
            true,
754
            $identificador . 'Forma de emissão do CT-e'
755
        );
756
        $this->dom->addChild(
757
            $this->ide,
758
            'cDV',
759
            $cDV,
760
            true,
761
            $identificador . 'Digito Verificador da chave de acesso do CT-e'
762
        );
763
        $this->dom->addChild(
764
            $this->ide,
765
            'tpAmb',
766
            $tpAmb,
767
            true,
768
            $identificador . 'Tipo do Ambiente'
769
        );
770
        $this->dom->addChild(
771
            $this->ide,
772
            'tpCTe',
773
            $tpCTe,
774
            true,
775
            $identificador . 'Tipo do CT-e'
776
        );
777
        $this->dom->addChild(
778
            $this->ide,
779
            'procEmi',
780
            $procEmi,
781
            true,
782
            $identificador . 'Identificador do processo de emissão do CT-e'
783
        );
784
        $this->dom->addChild(
785
            $this->ide,
786
            'verProc',
787
            $verProc,
788
            true,
789
            $identificador . 'Versão do processo de emissão'
790
        );
791
        $this->dom->addChild(
792
            $this->ide,
793
            'refCTE',
794
            $refCTE,
795
            false,
796
            $identificador . 'Chave de acesso do CT-e referenciado'
797
        );
798
        $this->dom->addChild(
799
            $this->ide,
800
            'cMunEnv',
801
            $cMunEnv,
802
            true,
803
            $identificador . 'Código do Município de envio do CT-e (de onde o documento foi transmitido)'
804
        );
805
        $this->dom->addChild(
806
            $this->ide,
807
            'xMunEnv',
808
            $xMunEnv,
809
            true,
810
            $identificador . 'Nome do Município de envio do CT-e (de onde o documento foi transmitido)'
811
        );
812
        $this->dom->addChild(
813
            $this->ide,
814
            'UFEnv',
815
            $UFEnv,
816
            true,
817
            $identificador . 'Sigla da UF de envio do CT-e (de onde o documento foi transmitido)'
818
        );
819
        $this->dom->addChild(
820
            $this->ide,
821
            'modal',
822
            $modal,
823
            true,
824
            $identificador . 'Modal'
825
        );
826
        $this->modal = $modal;
0 ignored issues
show
Documentation Bug introduced by
The property $modal was declared of type integer, but $modal is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
827
        $this->dom->addChild(
828
            $this->ide,
829
            'tpServ',
830
            $tpServ,
831
            true,
832
            $identificador . 'Tipo do Serviço'
833
        );
834
        $this->dom->addChild(
835
            $this->ide,
836
            'cMunIni',
837
            $cMunIni,
838
            true,
839
            $identificador . 'Nome do Município do início da prestação'
840
        );
841
        $this->dom->addChild(
842
            $this->ide,
843
            'xMunIni',
844
            $xMunIni,
845
            true,
846
            $identificador . 'Nome do Município do início da prestação'
847
        );
848
        $this->dom->addChild(
849
            $this->ide,
850
            'UFIni',
851
            $UFIni,
852
            true,
853
            $identificador . 'UF do início da prestação'
854
        );
855
        $this->dom->addChild(
856
            $this->ide,
857
            'cMunFim',
858
            $cMunFim,
859
            true,
860
            $identificador . 'Código do Município de término da prestação'
861
        );
862
        $this->dom->addChild(
863
            $this->ide,
864
            'xMunFim',
865
            $xMunFim,
866
            true,
867
            $identificador . 'Nome do Município do término da prestação'
868
        );
869
        $this->dom->addChild(
870
            $this->ide,
871
            'UFFim',
872
            $UFFim,
873
            true,
874
            $identificador . 'UF do término da prestação'
875
        );
876
        $this->dom->addChild(
877
            $this->ide,
878
            'retira',
879
            $retira,
880
            true,
881
            $identificador . 'Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino'
882
        );
883
        $this->dom->addChild(
884
            $this->ide,
885
            'xDetRetira',
886
            $xDetRetira,
887
            false,
888
            $identificador . 'Detalhes do retira'
889
        );
890
        $this->dom->addChild(
891
            $this->ide,
892
            'dhCont',
893
            $dhCont,
894
            false,
895
            $identificador . 'Data e Hora da entrada em contingência'
896
        );
897
        $this->dom->addChild(
898
            $this->ide,
899
            'xJust',
900
            $xJust,
901
            false,
902
            $identificador . 'Justificativa da entrada em contingência'
903
        );
904
        $this->tpServ = $tpServ;
0 ignored issues
show
Documentation Bug introduced by
The property $tpServ was declared of type integer, but $tpServ is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
905
        return $this->ide;
906
    }
907
908
    /**
909
     * Gera as tags para o elemento: toma03 (Indicador do "papel" do tomador do serviço no CT-e)
910
     * e adiciona ao grupo ide
911
     * #35
912
     * Nível: 2
913
     * Os parâmetros para esta função são todos os elementos da tag "toma03" do
914
     * tipo elemento (Ele = E|CE|A) e nível 3
915
     *
916
     * @param string $toma Tomador do Serviço
917
     *
918
     * @return \DOMElement
919
     */
920
    public function toma03Tag($toma = '')
921
    {
922
        $identificador = '#35 <toma03> - ';
923
        $this->toma03 = $this->dom->createElement('toma03');
924
        $this->dom->addChild(
925
            $this->toma03,
926
            'toma',
927
            $toma,
928
            true,
929
            $identificador . 'Tomador do Serviço'
930
        );
931
        return $this->toma03;
932
    }
933
934
    /**
935
     * Gera as tags para o elemento: toma4 (Indicador do "papel" do tomador
936
     * do serviço no CT-e) e adiciona ao grupo ide
937
     * #37
938
     * Nível: 2
939
     * Os parâmetros para esta função são todos os elementos da tag "toma4" do
940
     * tipo elemento (Ele = E|CE|A) e nível 3
941
     *
942
     * @param string $toma Tomador do Serviço
943
     * @param string $CNPJ Número do CNPJ
944
     * @param string $CPF Número do CPF
945
     * @param string $IE Inscrição Estadual
946
     * @param string $xNome Razão Social ou Nome
947
     * @param string $xFant Nome Fantasia
948
     * @param string $fone Telefone
949
     * @param string $email Endereço de email
950
     *
951
     * @return \DOMElement
952
     */
953
    public function toma4Tag(
954
        $toma = '',
955
        $CNPJ = '',
956
        $CPF = '',
957
        $IE = '',
958
        $xNome = '',
959
        $xFant = '',
960
        $fone = '',
961
        $email = ''
962
    ) {
963
        $identificador = '#37 <toma4> - ';
964
        $this->toma4 = $this->dom->createElement('toma4');
965
        $this->dom->addChild(
966
            $this->toma4,
967
            'toma',
968
            $toma,
969
            true,
970
            $identificador . 'Tomador do Serviço'
971
        );
972
        if ($CNPJ != '') {
973
            $this->dom->addChild(
974
                $this->toma4,
975
                'CNPJ',
976
                $CNPJ,
977
                true,
978
                $identificador . 'Número do CNPJ'
979
            );
980
        } elseif ($CPF != '') {
981
            $this->dom->addChild(
982
                $this->toma4,
983
                'CPF',
984
                $CPF,
985
                true,
986
                $identificador . 'Número do CPF'
987
            );
988
        } else {
989
            $this->dom->addChild(
990
                $this->toma4,
991
                'CNPJ',
992
                $CNPJ,
993
                true,
994
                $identificador . 'Número do CNPJ'
995
            );
996
            $this->dom->addChild(
997
                $this->toma4,
998
                'CPF',
999
                $CPF,
1000
                true,
1001
                $identificador . 'Número do CPF'
1002
            );
1003
        }
1004
        if ($IE !== '') {
1005
            $this->dom->addChild(
1006
                $this->toma4,
1007
                'IE',
1008
                $IE,
1009
                false,
1010
                $identificador . 'Inscrição Estadual'
1011
            );
1012
        }
1013
        $this->dom->addChild(
1014
            $this->toma4,
1015
            'xNome',
1016
            $xNome,
1017
            true,
1018
            $identificador . 'Razão Social ou Nome'
1019
        );
1020
        $this->dom->addChild(
1021
            $this->toma4,
1022
            'xFant',
1023
            $xFant,
1024
            false,
1025
            $identificador . 'Nome Fantasia'
1026
        );
1027
        $this->dom->addChild(
1028
            $this->toma4,
1029
            'fone',
1030
            $fone,
1031
            false,
1032
            $identificador . 'Telefone'
1033
        );
1034
        $this->dom->addChild(
1035
            $this->toma4,
1036
            'email',
1037
            $email,
1038
            false,
1039
            $identificador . 'Endereço de email'
1040
        );
1041
        return $this->toma4;
1042
    }
1043
1044
    /**
1045
     * Gera as tags para o elemento: "enderToma" (Dados do endereço) e adiciona ao grupo "toma4"
1046
     * #45
1047
     * Nível: 3
1048
     * Os parâmetros para esta função são todos os elementos da tag "enderToma"
1049
     * do tipo elemento (Ele = E|CE|A) e nível 4
1050
     *
1051
     * @param string $xLgr Logradouro
1052
     * @param string $nro Número
1053
     * @param string $xCpl Complemento
1054
     * @param string $xBairro Bairro
1055
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
1056
     * @param string $xMun Nome do município
1057
     * @param string $CEP CEP
1058
     * @param string $UF Sigla da UF
1059
     * @param string $cPais Código do país
1060
     * @param string $xPais Nome do país
1061
     *
1062
     * @return \DOMElement
1063
     */
1064
    public function enderTomaTag(
1065
        $xLgr = '',
1066
        $nro = '',
1067
        $xCpl = '',
1068
        $xBairro = '',
1069
        $cMun = '',
1070
        $xMun = '',
1071
        $CEP = '',
1072
        $UF = '',
1073
        $cPais = '',
1074
        $xPais = ''
1075
    ) {
1076
        $identificador = '#45 <enderToma> - ';
1077
        $this->enderToma = $this->dom->createElement('enderToma');
1078
        $this->dom->addChild(
1079
            $this->enderToma,
1080
            'xLgr',
1081
            $xLgr,
1082
            true,
1083
            $identificador . 'Logradouro'
1084
        );
1085
        $this->dom->addChild(
1086
            $this->enderToma,
1087
            'nro',
1088
            $nro,
1089
            true,
1090
            $identificador . 'Número'
1091
        );
1092
        $this->dom->addChild(
1093
            $this->enderToma,
1094
            'xCpl',
1095
            $xCpl,
1096
            false,
1097
            $identificador . 'Complemento'
1098
        );
1099
        $this->dom->addChild(
1100
            $this->enderToma,
1101
            'xBairro',
1102
            $xBairro,
1103
            true,
1104
            $identificador . 'Bairro'
1105
        );
1106
        $this->dom->addChild(
1107
            $this->enderToma,
1108
            'cMun',
1109
            $cMun,
1110
            true,
1111
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
1112
        );
1113
        $this->dom->addChild(
1114
            $this->enderToma,
1115
            'xMun',
1116
            $xMun,
1117
            true,
1118
            $identificador . 'Nome do município'
1119
        );
1120
        $this->dom->addChild(
1121
            $this->enderToma,
1122
            'CEP',
1123
            $CEP,
1124
            false,
1125
            $identificador . 'CEP'
1126
        );
1127
        $this->dom->addChild(
1128
            $this->enderToma,
1129
            'UF',
1130
            $UF,
1131
            true,
1132
            $identificador . 'Sigla da UF'
1133
        );
1134
        $this->dom->addChild(
1135
            $this->enderToma,
1136
            'cPais',
1137
            $cPais,
1138
            false,
1139
            $identificador . 'Código do país'
1140
        );
1141
        $this->dom->addChild(
1142
            $this->enderToma,
1143
            'xPais',
1144
            $xPais,
1145
            false,
1146
            $identificador . 'Nome do país'
1147
        );
1148
        return $this->enderToma;
1149
    }
1150
1151
    /**
1152
     * Gera as tags para o elemento: "compl" (Dados complementares do CT-e para fins operacionais ou comerciais)
1153
     * #59
1154
     * Nível: 1
1155
     * Os parâmetros para esta função são todos os elementos da tag "compl" do
1156
     * tipo elemento (Ele = E|CE|A) e nível 2
1157
     *
1158
     * @param string $xCaracAd Característica adicional do transporte
1159
     * @param string $xCaracSer Característica adicional do serviço
1160
     * @param string $xEmi Funcionário emissor do CTe
1161
     * @param string $origCalc Município de origem para efeito de cálculo do frete
1162
     * @param string $destCalc Município de destino para efeito de cálculo do frete
1163
     * @param string $xObs Observações Gerais
1164
     *
1165
     * @return \DOMElement
1166
     */
1167
    public function complTag($xCaracAd = '', $xCaracSer = '', $xEmi = '', $origCalc = '', $destCalc = '', $xObs = '')
1168
    {
1169
        $identificador = '#59 <compl> - ';
1170
        $this->compl = $this->dom->createElement('compl');
1171
        $this->dom->addChild(
1172
            $this->compl,
1173
            'xCaracAd',
1174
            $xCaracAd,
1175
            false,
1176
            $identificador . 'Característica adicional do transporte'
1177
        );
1178
        $this->dom->addChild(
1179
            $this->compl,
1180
            'xCaracSer',
1181
            $xCaracSer,
1182
            false,
1183
            $identificador . 'Característica adicional do serviço'
1184
        );
1185
        $this->dom->addChild(
1186
            $this->compl,
1187
            'xEmi',
1188
            $xEmi,
1189
            false,
1190
            $identificador . 'Funcionário emissor do CTe'
1191
        );
1192
        $this->dom->addChild(
1193
            $this->compl,
1194
            'origCalc',
1195
            $origCalc,
1196
            false,
1197
            $identificador . 'Município de origem para efeito de cálculo do frete'
1198
        );
1199
        $this->dom->addChild(
1200
            $this->compl,
1201
            'destCalc',
1202
            $destCalc,
1203
            false,
1204
            $identificador . 'Município de destino para efeito de cálculo do frete'
1205
        );
1206
        $this->dom->addChild(
1207
            $this->compl,
1208
            'xObs',
1209
            $xObs,
1210
            false,
1211
            $identificador . 'Observações Gerais'
1212
        );
1213
        return $this->compl;
1214
    }
1215
1216
    /**
1217
     * Gera as tags para o elemento: "fluxo" (Previsão do fluxo da carga)
1218
     * #63
1219
     * Nível: 2
1220
     * Os parâmetros para esta função são todos os elementos da tag "fluxo" do
1221
     * tipo elemento (Ele = E|CE|A) e nível 3
1222
     *
1223
     * @param string $xOrig Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem
1224
     * @param string $xDest Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino
1225
     * @param string $xRota Código da Rota de Entrega
1226
     *
1227
     * @return \DOMElement
1228
     */
1229
    public function fluxoTag($xOrig = '', $xDest = '', $xRota = '')
1230
    {
1231
        $identificador = '#63 <fluxo> - ';
1232
        $this->fluxo = $this->dom->createElement('fluxo');
1233
        $this->dom->addChild(
1234
            $this->fluxo,
1235
            'xOrig',
1236
            $xOrig,
1237
            false,
1238
            $identificador . 'Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem'
1239
        );
1240
        $this->dom->addChild(
1241
            $this->fluxo,
1242
            'xDest',
1243
            $xDest,
1244
            false,
1245
            $identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino'
1246
        );
1247
        $this->dom->addChild(
1248
            $this->fluxo,
1249
            'xRota',
1250
            $xRota,
1251
            false,
1252
            $identificador . 'Código da Rota de Entrega'
1253
        );
1254
        return $this->fluxo;
1255
    }
1256
1257
    /**
1258
     * Gera as tags para o elemento: "pass"
1259
     * #65
1260
     * Nível: 3
1261
     * Os parâmetros para esta função são todos os elementos da tag "pass" do
1262
     * tipo elemento (Ele = E|CE|A) e nível 4
1263
     *
1264
     * @param string $xPass Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem
1265
     *
1266
     * @return \DOMElement
1267
     */
1268 View Code Duplication
    public function passTag($xPass = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1269
    {
1270
        $identificador = '#65 <pass> - ';
1271
        $this->pass[] = $this->dom->createElement('pass');
1272
        $posicao = (integer)count($this->pass) - 1;
1273
        $this->dom->addChild(
1274
            $this->pass[$posicao],
1275
            'xPass',
1276
            $xPass,
1277
            false,
1278
            $identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem'
1279
        );
1280
        return $this->pass[$posicao];
1281
    }
1282
1283
    /**
1284
     * Gera as tags para o elemento: "semData" (Entrega sem data definida)
1285
     * #70
1286
     * Nível: 3
1287
     * Os parâmetros para esta função são todos os elementos da tag "semData" do
1288
     * tipo elemento (Ele = E|CE|A) e nível 4
1289
     *
1290
     * @param string $tpPer Tipo de data/período programado para entrega
1291
     *
1292
     * @return \DOMElement
1293
     */
1294
    public function semDataTag($tpPer = '')
1295
    {
1296
        $identificador = '#70 <semData> - ';
1297
        $this->semData = $this->dom->createElement('semData');
1298
        $this->dom->addChild(
1299
            $this->semData,
1300
            'tpPer',
1301
            $tpPer,
1302
            true,
1303
            $identificador . 'Tipo de data/período programado para entrega'
1304
        );
1305
        return $this->semData;
1306
    }
1307
1308
    /**
1309
     * Gera as tags para o elemento: "comData" (Entrega com data definida)
1310
     * #72
1311
     * Nível: 3
1312
     * Os parâmetros para esta função são todos os elementos da tag "comData" do
1313
     * tipo elemento (Ele = E|CE|A) e nível 4
1314
     *
1315
     * @param string $tpPer Tipo de data/período programado para entrega
1316
     * @param string $dProg Data programada
1317
     *
1318
     * @return \DOMElement
1319
     */
1320
    public function comDataTag($tpPer = '', $dProg = '')
1321
    {
1322
        $identificador = '#72 <comData> - ';
1323
        $this->comData = $this->dom->createElement('comData');
1324
        $this->dom->addChild(
1325
            $this->comData,
1326
            'tpPer',
1327
            $tpPer,
1328
            true,
1329
            $identificador . 'Tipo de data/período programado para entrega'
1330
        );
1331
        $this->dom->addChild(
1332
            $this->comData,
1333
            'dProg',
1334
            $dProg,
1335
            true,
1336
            $identificador . 'Data programada'
1337
        );
1338
        return $this->comData;
1339
    }
1340
1341
    /**
1342
     * Gera as tags para o elemento: "noPeriodo" (Entrega no período definido)
1343
     * #75
1344
     * Nível: 3
1345
     * Os parâmetros para esta função são todos os elementos da tag "noPeriodo" do tipo
1346
     * elemento (Ele = E|CE|A) e nível 4
1347
     *
1348
     * @param string $tpPer Tipo de data/período programado para entrega
1349
     * @param string $dIni Data inicial
1350
     * @param string $dFim Data final
1351
     *
1352
     * @return \DOMElement
1353
     */
1354 View Code Duplication
    public function noPeriodoTag($tpPer = '', $dIni = '', $dFim = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1355
    {
1356
        $identificador = '#75 <noPeriodo> - ';
1357
        $this->noPeriodo = $this->dom->createElement('noPeriodo');
1358
        $this->dom->addChild(
1359
            $this->noPeriodo,
1360
            'tpPer',
1361
            $tpPer,
1362
            true,
1363
            $identificador . 'Tipo de data/período programado para entrega'
1364
        );
1365
        $this->dom->addChild(
1366
            $this->noPeriodo,
1367
            'dIni',
1368
            $dIni,
1369
            true,
1370
            $identificador . 'Data inicial'
1371
        );
1372
        $this->dom->addChild(
1373
            $this->noPeriodo,
1374
            'dFim',
1375
            $dFim,
1376
            true,
1377
            $identificador . 'Data final'
1378
        );
1379
        return $this->noPeriodo;
1380
    }
1381
1382
    /**
1383
     * Gera as tags para o elemento: "semHora" (Entrega sem hora definida)
1384
     * #79
1385
     * Nível: 3
1386
     * Os parâmetros para esta função são todos os elementos da tag "semHora" do
1387
     * tipo elemento (Ele = E|CE|A) e nível 4
1388
     *
1389
     * @param string $tpHor Tipo de hora
1390
     *
1391
     * @return \DOMElement
1392
     */
1393
    public function semHoraTag($tpHor = '')
1394
    {
1395
        $identificador = '#79 <semHora> - ';
1396
        $this->semHora = $this->dom->createElement('semHora');
1397
        $this->dom->addChild(
1398
            $this->semHora,
1399
            'tpHor',
1400
            $tpHor,
1401
            true,
1402
            $identificador . 'Tipo de hora'
1403
        );
1404
        return $this->semHora;
1405
    }
1406
1407
    /**
1408
     * Gera as tags para o elemento: "comHora" (Entrega sem hora definida)
1409
     * # = 81
1410
     * Nível = 3
1411
     * Os parâmetros para esta função são todos os elementos da tag "comHora" do
1412
     * tipo elemento (Ele = E|CE|A) e nível 4
1413
     *
1414
     * @param string $tpHor Tipo de hora
1415
     * @param string $hProg Hora programada
1416
     *
1417
     * @return \DOMElement
1418
     */
1419
    public function comHoraTag($tpHor = '', $hProg = '')
1420
    {
1421
        $identificador = '#81 <comHora> - ';
1422
        $this->comHora = $this->dom->createElement('comHora');
1423
        $this->dom->addChild(
1424
            $this->comHora,
1425
            'tpHor',
1426
            $tpHor,
1427
            true,
1428
            $identificador . 'Tipo de hora'
1429
        );
1430
        $this->dom->addChild(
1431
            $this->comHora,
1432
            'hProg',
1433
            $hProg,
1434
            true,
1435
            $identificador . 'Hora programada'
1436
        );
1437
        return $this->comHora;
1438
    }
1439
1440
    /**
1441
     * Gera as tags para o elemento: "noInter" (Entrega no intervalo de horário definido)
1442
     * #84
1443
     * Nível: 3
1444
     * Os parâmetros para esta função são todos os elementos da tag "noInter" do
1445
     * tipo elemento (Ele = E|CE|A) e nível 4
1446
     *
1447
     * @param string $tpHor Tipo de hora
1448
     * @param string $hIni Hora inicial
1449
     * @param string $hFim Hora final
1450
     *
1451
     * @return \DOMElement
1452
     */
1453 View Code Duplication
    public function noInterTag($tpHor = '', $hIni = '', $hFim = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1454
    {
1455
        $identificador = '#84 <noInter> - ';
1456
        $this->noInter = $this->dom->createElement('noInter');
1457
        $this->dom->addChild(
1458
            $this->noInter,
1459
            'tpHor',
1460
            $tpHor,
1461
            true,
1462
            $identificador . 'Tipo de hora'
1463
        );
1464
        $this->dom->addChild(
1465
            $this->noInter,
1466
            'hIni',
1467
            $hIni,
1468
            true,
1469
            $identificador . 'Hora inicial'
1470
        );
1471
        $this->dom->addChild(
1472
            $this->noInter,
1473
            'hFim',
1474
            $hFim,
1475
            true,
1476
            $identificador . 'Hora final'
1477
        );
1478
        return $this->noInter;
1479
    }
1480
1481
    /**
1482
     * Gera as tags para o elemento: "ObsCont" (Campo de uso livre do contribuinte)
1483
     * #91
1484
     * Nível: 2
1485
     * Os parâmetros para esta função são todos os elementos da tag "ObsCont" do
1486
     * tipo elemento (Ele = E|CE|A) e nível 3
1487
     *
1488
     * @param string $xCampo Identificação do campo
1489
     * @param string $xTexto Conteúdo do campo
1490
     *
1491
     * @return boolean
1492
     */
1493 View Code Duplication
    public function obsContTag($xCampo = '', $xTexto = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1494
    {
1495
        $identificador = '#91 <ObsCont> - ';
1496
        $posicao = (integer)count($this->obsCont) - 1;
1497
        if (count($this->obsCont) <= 10) {
1498
            $this->obsCont[] = $this->dom->createElement('ObsCont');
1499
            $this->obsCont[$posicao]->setAttribute('xCampo', $xCampo);
1500
            $this->dom->addChild(
1501
                $this->obsCont[$posicao],
1502
                'xTexto',
1503
                $xTexto,
1504
                true,
1505
                $identificador . 'Conteúdo do campo'
1506
            );
1507
            return true;
1508
        }
1509
        $this->erros[] = array(
1510
            'tag' => (string)'<ObsCont>',
1511
            'desc' => (string)'Campo de uso livre do contribuinte',
1512
            'erro' => (string)'Tag deve aparecer de 0 a 10 vezes'
1513
        );
1514
        return false;
1515
    }
1516
1517
    /**
1518
     * Gera as tags para o elemento: "ObsFisco" (Campo de uso livre do contribuinte)
1519
     * #94
1520
     * Nível: 2
1521
     * Os parâmetros para esta função são todos os elementos da tag "ObsFisco" do tipo
1522
     * elemento (Ele = E|CE|A) e nível 3
1523
     * @param string $xCampo Identificação do campo
1524
     * @param string $xTexto Conteúdo do campo
1525
     * @return bool
1526
     */
1527 View Code Duplication
    public function obsFiscoTag($xCampo = '', $xTexto = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1528
    {
1529
        $identificador = '#94 <ObsFisco> - ';
1530
        $posicao = (integer)count($this->obsFisco) - 1;
1531
        if (count($this->obsFisco) <= 10) {
1532
            $this->obsFisco[] = $this->dom->createElement('obsFisco');
1533
            $this->obsFisco[$posicao]->setAttribute('xCampo', $xCampo);
1534
            $this->dom->addChild(
1535
                $this->obsFisco[$posicao],
1536
                'xTexto',
1537
                $xTexto,
1538
                true,
1539
                $identificador . 'Conteúdo do campo'
1540
            );
1541
            return true;
1542
        }
1543
        $this->erros[] = array(
1544
            'tag' => (string)'<ObsFisco>',
1545
            'desc' => (string)'Campo de uso livre do contribuinte',
1546
            'erro' => (string)'Tag deve aparecer de 0 a 10 vezes'
1547
        );
1548
        return false;
1549
    }
1550
1551
    /**
1552
     * Gera as tags para o elemento: "emit" (Identificação do Emitente do CT-e)
1553
     * #97
1554
     * Nível: 1
1555
     * Os parâmetros para esta função são todos os elementos da tag "emit" do
1556
     * tipo elemento (Ele = E|CE|A) e nível 2
1557
     * @param string $CNPJ CNPJ do emitente
1558
     * @param string $IE Inscrição Estadual do Emitente
1559
     * @param string $xNome Razão social ou Nome do emitente
1560
     * @param string $xFant Nome fantasia
1561
     * @return DOMElement|\DOMNode
1562
     */
1563
    public function emitTag($CNPJ = '', $IE = '', $xNome = '', $xFant = '')
1564
    {
1565
        $identificador = '#97 <emit> - ';
1566
        $this->emit = $this->dom->createElement('emit');
1567
        $this->dom->addChild(
1568
            $this->emit,
1569
            'CNPJ',
1570
            $CNPJ,
1571
            true,
1572
            $identificador . 'CNPJ do emitente'
1573
        );
1574
        if ($IE !== '') {
1575
            $this->dom->addChild(
1576
                $this->emit,
1577
                'IE',
1578
                $IE,
1579
                true,
1580
                $identificador . 'Inscrição Estadual do Emitente'
1581
            );
1582
        }
1583
        $this->dom->addChild(
1584
            $this->emit,
1585
            'xNome',
1586
            $xNome,
1587
            true,
1588
            $identificador . 'Razão social ou Nome do emitente'
1589
        );
1590
        $this->dom->addChild(
1591
            $this->emit,
1592
            'xFant',
1593
            $xFant,
1594
            true,
1595
            $identificador . 'Nome fantasia'
1596
        );
1597
        return $this->emit;
1598
    }
1599
1600
    /**
1601
     * Gera as tags para o elemento: "enderEmit" (Endereço do emitente)
1602
     * #102
1603
     * Nível: 2
1604
     * Os parâmetros para esta função são todos os elementos da tag "enderEmit" do
1605
     * tipo elemento (Ele = E|CE|A) e nível 3
1606
     *
1607
     * @param string $xLgr Logradouro
1608
     * @param string $nro Número
1609
     * @param string $xCpl Complemento
1610
     * @param string $xBairro Bairro
1611
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
1612
     * @param string $xMun Nome do município
1613
     * @param string $CEP CEP
1614
     * @param string $UF Sigla da UF
1615
     * @param string $fone Telefone
1616
     *
1617
     * @return \DOMElement
1618
     */
1619
    public function enderEmitTag(
1620
        $xLgr = '',
1621
        $nro = '',
1622
        $xCpl = '',
1623
        $xBairro = '',
1624
        $cMun = '',
1625
        $xMun = '',
1626
        $CEP = '',
1627
        $UF = '',
1628
        $fone = ''
1629
    ) {
1630
        $identificador = '#102 <enderEmit> - ';
1631
        $this->enderEmit = $this->dom->createElement('enderEmit');
1632
        $this->dom->addChild(
1633
            $this->enderEmit,
1634
            'xLgr',
1635
            $xLgr,
1636
            true,
1637
            $identificador . 'Logradouro'
1638
        );
1639
        $this->dom->addChild(
1640
            $this->enderEmit,
1641
            'nro',
1642
            $nro,
1643
            true,
1644
            $identificador . 'Número'
1645
        );
1646
        $this->dom->addChild(
1647
            $this->enderEmit,
1648
            'xCpl',
1649
            $xCpl,
1650
            false,
1651
            $identificador . 'Complemento'
1652
        );
1653
        $this->dom->addChild(
1654
            $this->enderEmit,
1655
            'xBairro',
1656
            $xBairro,
1657
            true,
1658
            $identificador . 'Bairro'
1659
        );
1660
        $this->dom->addChild(
1661
            $this->enderEmit,
1662
            'cMun',
1663
            $cMun,
1664
            true,
1665
            $identificador . 'Código do município'
1666
        );
1667
        $this->dom->addChild(
1668
            $this->enderEmit,
1669
            'xMun',
1670
            $xMun,
1671
            true,
1672
            $identificador . 'Nome do município'
1673
        );
1674
        $this->dom->addChild(
1675
            $this->enderEmit,
1676
            'CEP',
1677
            $CEP,
1678
            false,
1679
            $identificador . 'CEP'
1680
        );
1681
        $this->dom->addChild(
1682
            $this->enderEmit,
1683
            'UF',
1684
            $UF,
1685
            true,
1686
            $identificador . 'Sigla da UF'
1687
        );
1688
        $this->dom->addChild(
1689
            $this->enderEmit,
1690
            'fone',
1691
            $fone,
1692
            false,
1693
            $identificador . 'Telefone'
1694
        );
1695
        return $this->enderEmit;
1696
    }
1697
1698
    /**
1699
     * Gera as tags para o elemento: "rem" (Informações do Remetente das mercadorias
1700
     * transportadas pelo CT-e)
1701
     * #112
1702
     * Nível = 1
1703
     * Os parâmetros para esta função são todos os elementos da tag "rem" do
1704
     * tipo elemento (Ele = E|CE|A) e nível 2
1705
     *
1706
     * @param string $CNPJ Número do CNPJ
1707
     * @param string $CPF Número do CPF
1708
     * @param string $IE Inscrição Estadual
1709
     * @param string $xNome Razão social ou nome do remetente
1710
     * @param string $xFant Nome fantasia
1711
     * @param string $fone Telefone
1712
     * @param string $email Endereço de email
1713
     *
1714
     * @return \DOMElement
1715
     */
1716 View Code Duplication
    public function remTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $xFant = '', $fone = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1717
    {
1718
        $identificador = '#97 <rem> - ';
1719
        $this->rem = $this->dom->createElement('rem');
1720
        if ($CNPJ != '') {
1721
            $this->dom->addChild(
1722
                $this->rem,
1723
                'CNPJ',
1724
                $CNPJ,
1725
                true,
1726
                $identificador . 'CNPJ do Remente'
1727
            );
1728
        } elseif ($CPF != '') {
1729
            $this->dom->addChild(
1730
                $this->rem,
1731
                'CPF',
1732
                $CPF,
1733
                true,
1734
                $identificador . 'CPF do Remente'
1735
            );
1736
        } else {
1737
            $this->dom->addChild(
1738
                $this->rem,
1739
                'CNPJ',
1740
                $CNPJ,
1741
                true,
1742
                $identificador . 'CNPJ do Remente'
1743
            );
1744
            $this->dom->addChild(
1745
                $this->rem,
1746
                'CPF',
1747
                $CPF,
1748
                true,
1749
                $identificador . 'CPF do remente'
1750
            );
1751
        }
1752
        if ($IE !== '') {
1753
            $this->dom->addChild(
1754
                $this->rem,
1755
                'IE',
1756
                $IE,
1757
                true,
1758
                $identificador . 'Inscrição Estadual do remente'
1759
            );
1760
        }
1761
        $this->dom->addChild(
1762
            $this->rem,
1763
            'xNome',
1764
            $xNome,
1765
            true,
1766
            $identificador . 'Razão social ou Nome do remente'
1767
        );
1768
        $this->dom->addChild(
1769
            $this->rem,
1770
            'xFant',
1771
            $xFant,
1772
            false,
1773
            $identificador . 'Nome fantasia'
1774
        );
1775
        $this->dom->addChild(
1776
            $this->rem,
1777
            'fone',
1778
            $fone,
1779
            false,
1780
            $identificador . 'Telefone'
1781
        );
1782
        $this->dom->addChild(
1783
            $this->rem,
1784
            'email',
1785
            $email,
1786
            false,
1787
            $identificador . 'Endereço de email'
1788
        );
1789
        return $this->rem;
1790
    }
1791
1792
    /**
1793
     * Gera as tags para o elemento: "enderReme" (Dados do endereço)
1794
     * #119
1795
     * Nível: 2
1796
     * Os parâmetros para esta função são todos os elementos da tag "enderReme" do
1797
     * tipo elemento (Ele = E|CE|A) e nível 3
1798
     *
1799
     * @param string $xLgr Logradouro
1800
     * @param string $nro Número
1801
     * @param string $xCpl Complemento
1802
     * @param string $xBairro Bairro
1803
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
1804
     * @param string $xMun Nome do município
1805
     * @param string $CEP CEP
1806
     * @param string $UF Sigla da UF
1807
     * @param string $cPais Código do país
1808
     * @param string $xPais Nome do país
1809
     *
1810
     * @return \DOMElement
1811
     */
1812 View Code Duplication
    public function enderRemeTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1813
        $xLgr = '',
1814
        $nro = '',
1815
        $xCpl = '',
1816
        $xBairro = '',
1817
        $cMun = '',
1818
        $xMun = '',
1819
        $CEP = '',
1820
        $UF = '',
1821
        $cPais = '',
1822
        $xPais = ''
1823
    ) {
1824
        $identificador = '#119 <enderReme> - ';
1825
        $this->enderReme = $this->dom->createElement('enderReme');
1826
        $this->dom->addChild(
1827
            $this->enderReme,
1828
            'xLgr',
1829
            $xLgr,
1830
            true,
1831
            $identificador . 'Logradouro'
1832
        );
1833
        $this->dom->addChild(
1834
            $this->enderReme,
1835
            'nro',
1836
            $nro,
1837
            true,
1838
            $identificador . 'Número'
1839
        );
1840
        $this->dom->addChild(
1841
            $this->enderReme,
1842
            'xCpl',
1843
            $xCpl,
1844
            false,
1845
            $identificador . 'Complemento'
1846
        );
1847
        $this->dom->addChild(
1848
            $this->enderReme,
1849
            'xBairro',
1850
            $xBairro,
1851
            true,
1852
            $identificador . 'Bairro'
1853
        );
1854
        $this->dom->addChild(
1855
            $this->enderReme,
1856
            'cMun',
1857
            $cMun,
1858
            true,
1859
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
1860
        );
1861
        $this->dom->addChild(
1862
            $this->enderReme,
1863
            'xMun',
1864
            $xMun,
1865
            true,
1866
            $identificador . 'Nome do município'
1867
        );
1868
        $this->dom->addChild(
1869
            $this->enderReme,
1870
            'CEP',
1871
            $CEP,
1872
            false,
1873
            $identificador . 'CEP'
1874
        );
1875
        $this->dom->addChild(
1876
            $this->enderReme,
1877
            'UF',
1878
            $UF,
1879
            true,
1880
            $identificador . 'Sigla da UF'
1881
        );
1882
        $this->dom->addChild(
1883
            $this->enderReme,
1884
            'cPais',
1885
            $cPais,
1886
            false,
1887
            $identificador . 'Código do país'
1888
        );
1889
        $this->dom->addChild(
1890
            $this->enderReme,
1891
            'xPais',
1892
            $xPais,
1893
            false,
1894
            $identificador . 'Nome do país'
1895
        );
1896
        $node = $this->rem->getElementsByTagName("email")->item(0);
1897
        $this->rem->insertBefore($this->enderReme, $node);
1898
        return $this->enderReme;
1899
    }
1900
1901
    /**
1902
     * Gera as tags para o elemento: "exped" (Informações do Expedidor da Carga)
1903
     * #142
1904
     * Nível: 1
1905
     * Os parâmetros para esta função são todos os elementos da tag "exped" do
1906
     * tipo elemento (Ele = E|CE|A) e nível 2
1907
     *
1908
     * @param string $CNPJ Número do CNPJ
1909
     * @param string $CPF Número do CPF
1910
     * @param string $IE Inscrição Estadual
1911
     * @param string $xNome Razão Social ou Nome
1912
     * @param string $fone Telefone
1913
     * @param string $email Endereço de email
1914
     *
1915
     * @return \DOMElement
1916
     */
1917 View Code Duplication
    public function expedTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1918
    {
1919
        $identificador = '#142 <exped> - ';
1920
        $this->exped = $this->dom->createElement('exped');
1921
        if ($CNPJ != '') {
1922
            $this->dom->addChild(
1923
                $this->exped,
1924
                'CNPJ',
1925
                $CNPJ,
1926
                true,
1927
                $identificador . 'Número do CNPJ'
1928
            );
1929
        } elseif ($CPF != '') {
1930
            $this->dom->addChild(
1931
                $this->exped,
1932
                'CPF',
1933
                $CPF,
1934
                true,
1935
                $identificador . 'Número do CPF'
1936
            );
1937
        } else {
1938
            $this->dom->addChild(
1939
                $this->exped,
1940
                'CNPJ',
1941
                $CNPJ,
1942
                true,
1943
                $identificador . 'Número do CNPJ'
1944
            );
1945
            $this->dom->addChild(
1946
                $this->exped,
1947
                'CPF',
1948
                $CPF,
1949
                true,
1950
                $identificador . 'Número do CPF'
1951
            );
1952
        }
1953
        if ($IE !== '') {
1954
            $this->dom->addChild(
1955
                $this->exped,
1956
                'IE',
1957
                $IE,
1958
                true,
1959
                $identificador . 'Inscrição Estadual'
1960
            );
1961
        }
1962
        $this->dom->addChild(
1963
            $this->exped,
1964
            'xNome',
1965
            $xNome,
1966
            true,
1967
            $identificador . 'Razão social ou Nome'
1968
        );
1969
        $this->dom->addChild(
1970
            $this->exped,
1971
            'fone',
1972
            $fone,
1973
            false,
1974
            $identificador . 'Telefone'
1975
        );
1976
        $this->dom->addChild(
1977
            $this->exped,
1978
            'email',
1979
            $email,
1980
            false,
1981
            $identificador . 'Endereço de email'
1982
        );
1983
        return $this->exped;
1984
    }
1985
1986
    /**
1987
     * Gera as tags para o elemento: "enderExped" (Dados do endereço)
1988
     * #148
1989
     * Nível: 2
1990
     * Os parâmetros para esta função são todos os elementos da tag "enderExped" do
1991
     * tipo elemento (Ele = E|CE|A) e nível 3
1992
     *
1993
     * @param string $xLgr Logradouro
1994
     * @param string $nro Número
1995
     * @param string $xCpl Complemento
1996
     * @param string $xBairro Bairro
1997
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
1998
     * @param string $xMun Nome do município
1999
     * @param string $CEP CEP
2000
     * @param string $UF Sigla da UF
2001
     * @param string $cPais Código do país
2002
     * @param string $xPais Nome do país
2003
     *
2004
     * @return \DOMElement
2005
     */
2006 View Code Duplication
    public function enderExpedTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2007
        $xLgr = '',
2008
        $nro = '',
2009
        $xCpl = '',
2010
        $xBairro = '',
2011
        $cMun = '',
2012
        $xMun = '',
2013
        $CEP = '',
2014
        $UF = '',
2015
        $cPais = '',
2016
        $xPais = ''
2017
    ) {
2018
        $identificador = '#148 <enderExped> - ';
2019
        $this->enderExped = $this->dom->createElement('enderExped');
2020
        $this->dom->addChild(
2021
            $this->enderExped,
2022
            'xLgr',
2023
            $xLgr,
2024
            true,
2025
            $identificador . 'Logradouro'
2026
        );
2027
        $this->dom->addChild(
2028
            $this->enderExped,
2029
            'nro',
2030
            $nro,
2031
            true,
2032
            $identificador . 'Número'
2033
        );
2034
        $this->dom->addChild(
2035
            $this->enderExped,
2036
            'xCpl',
2037
            $xCpl,
2038
            false,
2039
            $identificador . 'Complemento'
2040
        );
2041
        $this->dom->addChild(
2042
            $this->enderExped,
2043
            'xBairro',
2044
            $xBairro,
2045
            true,
2046
            $identificador . 'Bairro'
2047
        );
2048
        $this->dom->addChild(
2049
            $this->enderExped,
2050
            'cMun',
2051
            $cMun,
2052
            true,
2053
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
2054
        );
2055
        $this->dom->addChild(
2056
            $this->enderExped,
2057
            'xMun',
2058
            $xMun,
2059
            true,
2060
            $identificador . 'Nome do município'
2061
        );
2062
        $this->dom->addChild(
2063
            $this->enderExped,
2064
            'CEP',
2065
            $CEP,
2066
            false,
2067
            $identificador . 'CEP'
2068
        );
2069
        $this->dom->addChild(
2070
            $this->enderExped,
2071
            'UF',
2072
            $UF,
2073
            true,
2074
            $identificador . 'Sigla da UF'
2075
        );
2076
        $this->dom->addChild(
2077
            $this->enderExped,
2078
            'cPais',
2079
            $cPais,
2080
            false,
2081
            $identificador . 'Código do país'
2082
        );
2083
        $this->dom->addChild(
2084
            $this->enderExped,
2085
            'xPais',
2086
            $xPais,
2087
            false,
2088
            $identificador . 'Nome do país'
2089
        );
2090
        $node = $this->exped->getElementsByTagName("email")->item(0);
2091
        $this->exped->insertBefore($this->enderExped, $node);
2092
        return $this->enderExped;
2093
    }
2094
2095
    /**
2096
     * Gera as tags para o elemento: "receb" (Informações do Recebedor da Carga)
2097
     * #160
2098
     * Nível: 1
2099
     * Os parâmetros para esta função são todos os elementos da tag "receb" do
2100
     * tipo elemento (Ele = E|CE|A) e nível 2
2101
     *
2102
     * @param string $CNPJ Número do CNPJ
2103
     * @param string $CPF Número do CPF
2104
     * @param string $IE Inscrição Estadual
2105
     * @param string $xNome Razão Social ou Nome
2106
     * @param string $fone Telefone
2107
     * @param string $email Endereço de email
2108
     *
2109
     * @return \DOMElement
2110
     */
2111 View Code Duplication
    public function recebTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2112
    {
2113
        $identificador = '#160 <receb> - ';
2114
        $this->receb = $this->dom->createElement('receb');
2115
        if ($CNPJ != '') {
2116
            $this->dom->addChild(
2117
                $this->receb,
2118
                'CNPJ',
2119
                $CNPJ,
2120
                true,
2121
                $identificador . 'Número do CNPJ'
2122
            );
2123
        } elseif ($CPF != '') {
2124
            $this->dom->addChild(
2125
                $this->receb,
2126
                'CPF',
2127
                $CPF,
2128
                true,
2129
                $identificador . 'Número do CPF'
2130
            );
2131
        } else {
2132
            $this->dom->addChild(
2133
                $this->receb,
2134
                'CNPJ',
2135
                $CNPJ,
2136
                true,
2137
                $identificador . 'Número do CNPJ'
2138
            );
2139
            $this->dom->addChild(
2140
                $this->receb,
2141
                'CPF',
2142
                $CPF,
2143
                true,
2144
                $identificador . 'Número do CPF'
2145
            );
2146
        }
2147
        if ($IE !== '') {
2148
            $this->dom->addChild(
2149
                $this->receb,
2150
                'IE',
2151
                $IE,
2152
                true,
2153
                $identificador . 'Inscrição Estadual'
2154
            );
2155
        }
2156
        $this->dom->addChild(
2157
            $this->receb,
2158
            'xNome',
2159
            $xNome,
2160
            true,
2161
            $identificador . 'Razão social ou Nome'
2162
        );
2163
        $this->dom->addChild(
2164
            $this->receb,
2165
            'fone',
2166
            $fone,
2167
            false,
2168
            $identificador . 'Telefone'
2169
        );
2170
        $this->dom->addChild(
2171
            $this->receb,
2172
            'email',
2173
            $email,
2174
            false,
2175
            $identificador . 'Endereço de email'
2176
        );
2177
        return $this->receb;
2178
    }
2179
2180
    /**
2181
     * Gera as tags para o elemento: "enderReceb" (Informações do Recebedor da Carga)
2182
     * #166
2183
     * Nível: 2
2184
     * Os parâmetros para esta função são todos os elementos da tag "enderReceb" do
2185
     * tipo elemento (Ele = E|CE|A) e nível 3
2186
     *
2187
     * @param string $xLgr Logradouro
2188
     * @param string $nro Número
2189
     * @param string $xCpl Complemento
2190
     * @param string $xBairro Bairro
2191
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
2192
     * @param string $xMun Nome do município
2193
     * @param string $CEP CEP
2194
     * @param string $UF Sigla da UF
2195
     * @param string $cPais Código do país
2196
     * @param string $xPais Nome do país
2197
     *
2198
     * @return \DOMElement
2199
     */
2200 View Code Duplication
    public function enderRecebTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2201
        $xLgr = '',
2202
        $nro = '',
2203
        $xCpl = '',
2204
        $xBairro = '',
2205
        $cMun = '',
2206
        $xMun = '',
2207
        $CEP = '',
2208
        $UF = '',
2209
        $cPais = '',
2210
        $xPais = ''
2211
    ) {
2212
        $identificador = '#160 <enderReceb> - ';
2213
        $this->enderReceb = $this->dom->createElement('enderReceb');
2214
        $this->dom->addChild(
2215
            $this->enderReceb,
2216
            'xLgr',
2217
            $xLgr,
2218
            true,
2219
            $identificador . 'Logradouro'
2220
        );
2221
        $this->dom->addChild(
2222
            $this->enderReceb,
2223
            'nro',
2224
            $nro,
2225
            true,
2226
            $identificador . 'Número'
2227
        );
2228
        $this->dom->addChild(
2229
            $this->enderReceb,
2230
            'xCpl',
2231
            $xCpl,
2232
            false,
2233
            $identificador . 'Complemento'
2234
        );
2235
        $this->dom->addChild(
2236
            $this->enderReceb,
2237
            'xBairro',
2238
            $xBairro,
2239
            true,
2240
            $identificador . 'Bairro'
2241
        );
2242
        $this->dom->addChild(
2243
            $this->enderReceb,
2244
            'cMun',
2245
            $cMun,
2246
            true,
2247
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
2248
        );
2249
        $this->dom->addChild(
2250
            $this->enderReceb,
2251
            'xMun',
2252
            $xMun,
2253
            true,
2254
            $identificador . 'Nome do município'
2255
        );
2256
        $this->dom->addChild(
2257
            $this->enderReceb,
2258
            'CEP',
2259
            $CEP,
2260
            false,
2261
            $identificador . 'CEP'
2262
        );
2263
        $this->dom->addChild(
2264
            $this->enderReceb,
2265
            'UF',
2266
            $UF,
2267
            true,
2268
            $identificador . 'Sigla da UF'
2269
        );
2270
        $this->dom->addChild(
2271
            $this->enderReceb,
2272
            'cPais',
2273
            $cPais,
2274
            false,
2275
            $identificador . 'Código do país'
2276
        );
2277
        $this->dom->addChild(
2278
            $this->enderReceb,
2279
            'xPais',
2280
            $xPais,
2281
            false,
2282
            $identificador . 'Nome do país'
2283
        );
2284
        $node = $this->receb->getElementsByTagName("email")->item(0);
2285
        $this->receb->insertBefore($this->enderReceb, $node);
2286
        return $this->enderReceb;
2287
    }
2288
2289
    /**
2290
     * Gera as tags para o elemento: "dest" (Informações do Destinatário do CT-e)
2291
     * #178
2292
     * Nível: 1
2293
     * Os parâmetros para esta função são todos os elementos da tag "dest" do
2294
     * tipo elemento (Ele = E|CE|A) e nível 2
2295
     *
2296
     * @param string $CNPJ Número do CNPJ
2297
     * @param string $CPF Número do CPF
2298
     * @param string $IE Inscrição Estadual
2299
     * @param string $xNome Razão Social ou Nome
2300
     * @param string $fone Telefone
2301
     * @param string $ISUF Inscrição na SUFRAMA
2302
     * @param string $email Endereço de email
2303
     *
2304
     * @return \DOMElement
2305
     */
2306 View Code Duplication
    public function destTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $ISUF = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2307
    {
2308
        $identificador = '#178 <dest> - ';
2309
        $this->dest = $this->dom->createElement('dest');
2310
        if ($CNPJ != '') {
2311
            $this->dom->addChild(
2312
                $this->dest,
2313
                'CNPJ',
2314
                $CNPJ,
2315
                true,
2316
                $identificador . 'Número do CNPJ'
2317
            );
2318
        } elseif ($CPF != '') {
2319
            $this->dom->addChild(
2320
                $this->dest,
2321
                'CPF',
2322
                $CPF,
2323
                true,
2324
                $identificador . 'Número do CPF'
2325
            );
2326
        } else {
2327
            $this->dom->addChild(
2328
                $this->dest,
2329
                'CNPJ',
2330
                $CNPJ,
2331
                true,
2332
                $identificador . 'Número do CNPJ'
2333
            );
2334
            $this->dom->addChild(
2335
                $this->dest,
2336
                'CPF',
2337
                $CPF,
2338
                true,
2339
                $identificador . 'Número do CPF'
2340
            );
2341
        }
2342
        if ($IE !== '') {
2343
            $this->dom->addChild(
2344
                $this->dest,
2345
                'IE',
2346
                $IE,
2347
                true,
2348
                $identificador . 'Inscrição Estadual'
2349
            );
2350
        }
2351
        $this->dom->addChild(
2352
            $this->dest,
2353
            'xNome',
2354
            $xNome,
2355
            true,
2356
            $identificador . 'Razão social ou Nome'
2357
        );
2358
        $this->dom->addChild(
2359
            $this->dest,
2360
            'fone',
2361
            $fone,
2362
            false,
2363
            $identificador . 'Telefone'
2364
        );
2365
        $this->dom->addChild(
2366
            $this->dest,
2367
            'ISUF',
2368
            $ISUF,
2369
            false,
2370
            $identificador . 'Inscrição na SUFRAMA'
2371
        );
2372
        $this->dom->addChild(
2373
            $this->dest,
2374
            'email',
2375
            $email,
2376
            false,
2377
            $identificador . 'Endereço de email'
2378
        );
2379
        return $this->dest;
2380
    }
2381
2382
    /**
2383
     * Gera as tags para o elemento: "enderDest" (Informações do Recebedor da Carga)
2384
     * # = 185
2385
     * Nível = 2
2386
     * Os parâmetros para esta função são todos os elementos da tag "enderDest" do
2387
     * tipo elemento (Ele = E|CE|A) e nível 3
2388
     *
2389
     * @param string $xLgr Logradouro
2390
     * @param string $nro Número
2391
     * @param string $xCpl Complemento
2392
     * @param string $xBairro Bairro
2393
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
2394
     * @param string $xMun Nome do município
2395
     * @param string $CEP CEP
2396
     * @param string $UF Sigla da UF
2397
     * @param string $cPais Código do país
2398
     * @param string $xPais Nome do país
2399
     *
2400
     * @return \DOMElement
2401
     */
2402 View Code Duplication
    public function enderDestTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2403
        $xLgr = '',
2404
        $nro = '',
2405
        $xCpl = '',
2406
        $xBairro = '',
2407
        $cMun = '',
2408
        $xMun = '',
2409
        $CEP = '',
2410
        $UF = '',
2411
        $cPais = '',
2412
        $xPais = ''
2413
    ) {
2414
        $identificador = '#185 <enderDest> - ';
2415
        $this->enderDest = $this->dom->createElement('enderDest');
2416
        $this->dom->addChild(
2417
            $this->enderDest,
2418
            'xLgr',
2419
            $xLgr,
2420
            true,
2421
            $identificador . 'Logradouro'
2422
        );
2423
        $this->dom->addChild(
2424
            $this->enderDest,
2425
            'nro',
2426
            $nro,
2427
            true,
2428
            $identificador . 'Número'
2429
        );
2430
        $this->dom->addChild(
2431
            $this->enderDest,
2432
            'xCpl',
2433
            $xCpl,
2434
            false,
2435
            $identificador . 'Complemento'
2436
        );
2437
        $this->dom->addChild(
2438
            $this->enderDest,
2439
            'xBairro',
2440
            $xBairro,
2441
            true,
2442
            $identificador . 'Bairro'
2443
        );
2444
        $this->dom->addChild(
2445
            $this->enderDest,
2446
            'cMun',
2447
            $cMun,
2448
            true,
2449
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
2450
        );
2451
        $this->dom->addChild(
2452
            $this->enderDest,
2453
            'xMun',
2454
            $xMun,
2455
            true,
2456
            $identificador . 'Nome do município'
2457
        );
2458
        $this->dom->addChild(
2459
            $this->enderDest,
2460
            'CEP',
2461
            $CEP,
2462
            false,
2463
            $identificador . 'CEP'
2464
        );
2465
        $this->dom->addChild(
2466
            $this->enderDest,
2467
            'UF',
2468
            $UF,
2469
            true,
2470
            $identificador . 'Sigla da UF'
2471
        );
2472
        $this->dom->addChild(
2473
            $this->enderDest,
2474
            'cPais',
2475
            $cPais,
2476
            false,
2477
            $identificador . 'Código do país'
2478
        );
2479
        $this->dom->addChild(
2480
            $this->enderDest,
2481
            'xPais',
2482
            $xPais,
2483
            false,
2484
            $identificador . 'Nome do país'
2485
        );
2486
        $node = $this->dest->getElementsByTagName("email")->item(0);
2487
        $this->dest->insertBefore($this->enderDest, $node);
2488
        return $this->enderDest;
2489
    }
2490
2491
    /**
2492
     * Gera as tags para o elemento: "vPrest" (Valores da Prestação de Serviço)
2493
     * #208
2494
     * Nível: 1
2495
     * @param string $vTPrest Valor Total da Prestação do Serviço
2496
     * @param string $vRec Valor a Receber
2497
     *
2498
     * @return \DOMElement
2499
     */
2500
    public function vPrestTag($vTPrest = '', $vRec = '')
2501
    {
2502
        $identificador = '#208 <vPrest> - ';
2503
        $this->vPrest = $this->dom->createElement('vPrest');
2504
        $this->dom->addChild(
2505
            $this->vPrest,
2506
            'vTPrest',
2507
            $vTPrest,
2508
            true,
2509
            $identificador . 'Valor Total da Prestação do Serviço'
2510
        );
2511
        $this->dom->addChild(
2512
            $this->vPrest,
2513
            'vRec',
2514
            $vRec,
2515
            true,
2516
            $identificador . 'Valor a Receber'
2517
        );
2518
        return $this->vPrest;
2519
    }
2520
2521
    /**
2522
     * tagICMS
2523
     * Informações do ICMS da Operação própria e ST N01 pai M01
2524
     * tag NFe/infNFe/det[]/imposto/ICMS
2525
     * @param string $cst
2526
     * @param string $pRedBC
2527
     * @param string $vBC
2528
     * @param string $pICMS
2529
     * @param string $vICMS
2530
     * @param string $vBCSTRet
2531
     * @param string $vICMSSTRet
2532
     * @param string $pICMSSTRet
2533
     * @param string $vCred
2534
     * @param string $vTotTrib
2535
     * @param bool $outraUF
2536
     * @return DOMElement
2537
     */
2538
    public function icmsTag(
2539
        $cst = '',
2540
        $pRedBC = '',
2541
        $vBC = '',
2542
        $pICMS = '',
2543
        $vICMS = '',
2544
        $vBCSTRet = '',
2545
        $vICMSSTRet = '',
2546
        $pICMSSTRet = '',
2547
        $vCred = '',
2548
        $vTotTrib = '',
2549
        $outraUF = false
2550
    ) {
2551
        $identificador = 'N01 <ICMSxx> - ';
2552
        switch ($cst) {
2553
            case '00':
2554
                $icms = $this->dom->createElement("ICMS00");
2555
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 00");
2556
                $this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador  Valor da BC do ICMS");
2557
                $this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador  Alíquota do imposto");
2558
                $this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador  Valor do ICMS");
2559
                break;
2560
            case '20':
2561
                $icms = $this->dom->createElement("ICMS20");
2562
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 20");
2563
                $this->dom->addChild($icms, 'pRedBC', $pRedBC, true, "$identificador  Percentual da Redução de BC");
2564
                $this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador  Valor da BC do ICMS");
2565
                $this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador  Alíquota do imposto");
2566
                $this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador  Valor do ICMS");
2567
                break;
2568
            case '40':
2569
                $icms = $this->dom->createElement("ICMS45");
2570
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 40");
2571
                break;
2572
            case '41':
2573
                $icms = $this->dom->createElement("ICMS45");
2574
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 41");
2575
                break;
2576
            case '51':
2577
                $icms = $this->dom->createElement("ICMS45");
2578
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 51");
2579
                break;
2580
            case '60':
2581
                $icms = $this->dom->createElement("ICMS60");
2582
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 60");
2583
                $this->dom->addChild($icms, 'vBCSTRet', $vBCSTRet, true, "$identificador  Valor BC do ICMS ST retido");
2584
                $this->dom->addChild($icms, 'vICMSSTRet', $vICMSSTRet, true, "$identificador  Valor do ICMS ST retido");
2585
                $this->dom->addChild($icms, 'pICMSSTRet', $pICMSSTRet, true, "$identificador  Valor do ICMS ST retido");
2586
                if ($vCred > 0) {
2587
                    $this->dom->addChild($icms, 'vCred', $vCred, false, "$identificador  Valor do Crédito");
2588
                }
2589
                break;
2590
            case '90':
2591
                if ($outraUF == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
2592
                    $icms = $this->dom->createElement("ICMSOutraUF");
2593
                    $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 90");
2594
                    if ($pRedBC > 0) {
2595
                        $this->dom->addChild($icms, 'pRedBCOutraUF', $pRedBC, false, "$identificador Percentual Red "
2596
                            . "BC Outra UF");
2597
                    }
2598
                    $this->dom->addChild($icms, 'vBCOutraUF', $vBC, true, "$identificador Valor BC ICMS Outra UF");
2599
                    $this->dom->addChild($icms, 'pICMSOutraUF', $pICMS, true, "$identificador Alíquota do "
2600
                        . "imposto Outra UF");
2601
                    $this->dom->addChild($icms, 'vICMSOutraUF', $vICMS, true, "$identificador Valor ICMS Outra UF");
2602
                } else {
2603
                    $icms = $this->dom->createElement("ICMS90");
2604
                    $this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 90");
2605
                    if ($pRedBC > 0) {
2606
                        $this->dom->addChild($icms, 'pRedBC', $pRedBC, false, "$identificador Percentual Redução BC");
2607
                    }
2608
                    $this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador  Valor da BC do ICMS");
2609
                    $this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador  Alíquota do imposto");
2610
                    $this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador  Valor do ICMS");
2611
                    if ($vCred > 0) {
2612
                        $this->dom->addChild($icms, 'vCred', $vCred, false, "$identificador  Valor do Crédido");
2613
                    }
2614
                }
2615
                break;
2616
            case 'SN':
2617
                $icms = $this->dom->createElement("ICMSSN");
2618
                $this->dom->addChild($icms, 'indSN', '1', true, "$identificador  Indica se contribuinte é SN");
2619
                break;
2620
        }
2621
        $this->imp = $this->dom->createElement('imp');
2622
        $tagIcms = $this->dom->createElement('ICMS');
2623
        if (isset($icms)) {
2624
            $this->imp->appendChild($tagIcms);
2625
        }
2626
        if (isset($icms)) {
2627
            $tagIcms->appendChild($icms);
2628
        }
2629
        if ($vTotTrib > 0) {
2630
            $this->dom->addChild($this->imp, 'vTotTrib', $vTotTrib, false, "$identificador Valor Total dos Tributos");
2631
        }
2632
        return $tagIcms;
2633
    }
2634
2635
    /**
2636
     * Gera as tags para o elemento: "Comp" (Componentes do Valor da Prestação)
2637
     * #211
2638
     * Nível: 2
2639
     * Os parâmetros para esta função são todos os elementos da tag "Comp"
2640
     * @param string $xNome Nome do componente
2641
     * @param string $vComp Valor do componente
2642
     *
2643
     * @return \DOMElement
2644
     */
2645 View Code Duplication
    public function compTag($xNome = '', $vComp = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2646
    {
2647
        $identificador = '#65 <pass> - ';
2648
        $this->comp[] = $this->dom->createElement('Comp');
2649
        $posicao = (integer)count($this->comp) - 1;
2650
        $this->dom->addChild(
2651
            $this->comp[$posicao],
2652
            'xNome',
2653
            $xNome,
2654
            false,
2655
            $identificador . 'Nome do componente'
2656
        );
2657
        $this->dom->addChild(
2658
            $this->comp[$posicao],
2659
            'vComp',
2660
            $vComp,
2661
            false,
2662
            $identificador . 'Valor do componente'
2663
        );
2664
        return $this->comp[$posicao];
2665
    }
2666
2667
    /**
2668
     * Tag raiz do documento xml
2669
     * Função chamada pelo método [ monta ]
2670
     * @return \DOMElement
2671
     */
2672
    private function zCTeTag()
2673
    {
2674
        if (empty($this->CTe)) {
2675
            $this->CTe = $this->dom->createElement('CTe');
2676
            $this->CTe->setAttribute('xmlns', 'http://www.portalfiscal.inf.br/cte');
2677
        }
2678
        return $this->CTe;
2679
    }
2680
2681
    /**
2682
     * Gera as tags para o elemento: "Entrega" (Informações ref. a previsão de entrega)
2683
     * #69
2684
     * Nível: 2
2685
     * Os parâmetros para esta função são todos os elementos da tag "Entrega" do
2686
     * tipo elemento (Ele = E|CE|A) e nível 3
2687
     *
2688
     * @return \DOMElement
2689
     */
2690
    private function zEntregaTag()
2691
    {
2692
        $this->entrega = $this->dom->createElement('Entrega');
2693
        return $this->entrega;
2694
    }
2695
2696
    public function infCTeNormTag()
2697
    {
2698
        $this->infCTeNorm = $this->dom->createElement('infCTeNorm');
2699
        return $this->infCTeNorm;
2700
    }
2701
2702
    /**
2703
     * Gera as tags para o elemento: "Comp" (Informações da Carga do CT-e)
2704
     * #253
2705
     * Nível: 2
2706
     * Os parâmetros para esta função são todos os elementos da tag "infCarga"
2707
     * @param string vCarga Valor total da carga
2708
     * @param string proPred Produto predominante
2709
     * @param string xOutCat Outras características da carga
2710
     *
2711
     * @return \DOMElement
2712
     */
2713
    public function infCargaTag($vCarga = '', $proPred = '', $xOutCat = '')
2714
    {
2715
        $identificador = '#253 <infCarga> - ';
2716
        $this->infCarga = $this->dom->createElement('infCarga');
2717
        $this->dom->addChild($this->infCarga, 'vCarga', $vCarga, false, $identificador . 'Valor Total da Carga');
2718
        $this->dom->addChild($this->infCarga, 'proPred', $proPred, true, $identificador . 'Produto Predominante');
2719
        $this->dom->addChild($this->infCarga, 'xOutCat', $xOutCat, false, $identificador . 'Outras Caract. da Carga');
2720
        return $this->infCarga;
2721
    }
2722
2723
    /**
2724
     * Gera as tags para o elemento: "infQ" (Informações de quantidades da Carga do CT-e)
2725
     * #257
2726
     * Nível: 3
2727
     * Os parâmetros para esta função são todos os elementos da tag "infQ"
2728
     * @param string $cUnid Código da Unidade de Medida
2729
     * @param string $tpMed Tipo da Medida
2730
     * @param string $qCarga Quantidade
2731
     * @return mixed
2732
     */
2733
    public function infQTag($cUnid = '', $tpMed = '', $qCarga = '')
2734
    {
2735
        $identificador = '#257 <infQ> - ';
2736
        $this->infQ[] = $this->dom->createElement('infQ');
2737
        $posicao = (integer)count($this->infQ) - 1;
2738
        $this->dom->addChild($this->infQ[$posicao], 'cUnid', $cUnid, true, $identificador . 'Código da 
2739
            Unidade de Medida');
2740
        $this->dom->addChild($this->infQ[$posicao], 'tpMed', $tpMed, true, $identificador . 'Tipo da Medida');
2741
        $this->dom->addChild($this->infQ[$posicao], 'qCarga', $qCarga, true, $identificador . 'Quantidade');
2742
2743
        return $this->infQ[$posicao];
2744
    }
2745
2746
    public function infDocTag()
2747
    {
2748
        $this->infDoc = $this->dom->createElement('infDoc');
2749
        return $this->infDoc;
2750
    }
2751
2752
    /**
2753
     * Documentos de Transporte Anterior
2754
     * @return DOMElement|\DOMNode
2755
     */
2756
    public function docAntTag()
2757
    {
2758
        $this->docAnt = $this->dom->createElement('docAnt');
2759
        return $this->docAnt;
2760
    }
2761
2762
    /**
2763
     * Informações de identificação dos documentos de Transporte Anterior
2764
     * @return array|DOMElement
2765
     */
2766
    public function idDocAntTag()
2767
    {
2768
        $this->idDocAnt = $this->dom->createElement('idDocAnt');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->dom->createElement('idDocAnt') of type object<DOMElement> is incompatible with the declared type array of property $idDocAnt.

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...
2769
        return $this->idDocAnt;
2770
    }
2771
2772
    /**
2773
     * Gera as tags para o elemento: "infNF" (Informações das NF)
2774
     * #262
2775
     * Nível: 3
2776
     * @param string $nRoma
2777
     * @param string $nPed
2778
     * @param string $mod
2779
     * @param string $serie
2780
     * @param string $nDoc
2781
     * @param string $dEmi
2782
     * @param string $vBC
2783
     * @param string $vICMS
2784
     * @param string $vBCST
2785
     * @param string $vST
2786
     * @param string $vProd
2787
     * @param string $vNF
2788
     * @param string $nCFOP
2789
     * @param string $nPeso
2790
     * @param string $PIN
2791
     * @param string $dPrev
2792
     * @return mixed
2793
     */
2794
    public function infNFTag(
2795
        $nRoma = '',
2796
        $nPed = '',
2797
        $mod = '',
2798
        $serie = '',
2799
        $nDoc = '',
2800
        $dEmi = '',
2801
        $vBC = '',
2802
        $vICMS = '',
2803
        $vBCST = '',
2804
        $vST = '',
2805
        $vProd = '',
2806
        $vNF = '',
2807
        $nCFOP = '',
2808
        $nPeso = '',
2809
        $PIN = '',
2810
        $dPrev = ''
2811
    ) {
2812
        $identificador = '#262 <infNF> - ';
2813
        $this->infNF[] = $this->dom->createElement('infNF');
2814
        $posicao = (integer)count($this->infNF) - 1;
2815
2816
        $this->dom->addChild($this->infNF[$posicao], 'nRoma', $nRoma, false, $identificador . 'Número do 
2817
            Romaneio da NF');
2818
        $this->dom->addChild($this->infNF[$posicao], 'nPed', $nPed, false, $identificador . 'Número do 
2819
            Pedido da NF');
2820
        $this->dom->addChild($this->infNF[$posicao], 'mod', $mod, true, $identificador . 'Modelo da 
2821
            Nota Fiscal');
2822
        $this->dom->addChild($this->infNF[$posicao], 'serie', $serie, true, $identificador . 'Série');
2823
        $this->dom->addChild($this->infNF[$posicao], 'nDoc', $nDoc, true, $identificador . 'Número');
2824
        $this->dom->addChild($this->infNF[$posicao], 'dEmi', $dEmi, true, $identificador . 'Data de Emissão');
2825
        $this->dom->addChild($this->infNF[$posicao], 'vBC', $vBC, true, $identificador . 'Valor da Base 
2826
            de Cálculo do ICMS');
2827
        $this->dom->addChild($this->infNF[$posicao], 'vICMS', $vICMS, true, $identificador . 'Valor Total 
2828
            do ICMS');
2829
        $this->dom->addChild($this->infNF[$posicao], 'vBCST', $vBCST, true, $identificador . 'Valor da 
2830
            Base de Cálculo do ICMS ST');
2831
        $this->dom->addChild($this->infNF[$posicao], 'vST', $vST, true, $identificador . 'Valor Total 
2832
            do ICMS ST');
2833
        $this->dom->addChild($this->infNF[$posicao], 'vProd', $vProd, true, $identificador . 'Valor Total
2834
            dos Produtos');
2835
        $this->dom->addChild($this->infNF[$posicao], 'vNF', $vNF, true, $identificador . 'Valor Total da NF');
2836
        $this->dom->addChild($this->infNF[$posicao], 'nCFOP', $nCFOP, true, $identificador . 'CFOP Predominante');
2837
        $this->dom->addChild($this->infNF[$posicao], 'nPeso', $nPeso, false, $identificador . 'Peso total em Kg');
2838
        $this->dom->addChild($this->infNF[$posicao], 'PIN', $PIN, false, $identificador . 'PIN SUFRAMA');
2839
        $this->dom->addChild($this->infNF[$posicao], 'dPrev', $dPrev, false, $identificador . 'Data prevista
2840
            de entrega');
2841
2842
        return $this->infNF[$posicao];
2843
    }
2844
2845
    /**
2846
     * Gera as tags para o elemento: "infNFe" (Informações das NF-e)
2847
     * #297
2848
     * Nível: 3
2849
     * @param string $chave
2850
     * @param string $PIN
2851
     * @param string $dPrev
2852
     * @return mixed
2853
     */
2854
    public function infNFeTag($chave = '', $PIN = '', $dPrev = '')
2855
    {
2856
        $identificador = '#297 <infNFe> - ';
2857
        $this->infNFe[] = $this->dom->createElement('infNFe');
2858
        $posicao = (integer)count($this->infNFe) - 1;
2859
        $this->dom->addChild(
2860
            $this->infNFe[$posicao],
2861
            'chave',
2862
            $chave,
2863
            true,
2864
            $identificador . 'Chave de acesso da NF-e'
2865
        );
2866
        $this->dom->addChild(
2867
            $this->infNFe[$posicao],
2868
            'PIN',
2869
            $PIN,
2870
            false,
2871
            $identificador . 'PIN SUFRAMA'
2872
        );
2873
        $this->dom->addChild(
2874
            $this->infNFe[$posicao],
2875
            'dPrev',
2876
            $dPrev,
2877
            false,
2878
            $identificador . 'Data prevista de entrega'
2879
        );
2880
        return $this->infNFe[$posicao];
2881
    }
2882
2883
    /**
2884
     * Gera as tags para o elemento: "infOutros" (Informações dos demais documentos)
2885
     * #319
2886
     * Nível: 3
2887
     * @param string $tpDoc
2888
     * @param string $descOutros
2889
     * @param string $nDoc
2890
     * @param string $dEmi
2891
     * @param string $vDocFisc
2892
     * @param string $dPrev
2893
     * @return mixed
2894
     */
2895
    public function infOutrosTag($tpDoc = '', $descOutros = '', $nDoc = '', $dEmi = '', $vDocFisc = '', $dPrev = '')
2896
    {
2897
        $ident = '#319 <infOutros> - ';
2898
        $this->infOutros[] = $this->dom->createElement('infOutros');
2899
        $posicao = (integer)count($this->infOutros) - 1;
2900
        $this->dom->addChild($this->infOutros[$posicao], 'tpDoc', $tpDoc, true, $ident . 'Tipo '
2901
            . 'de documento originário');
2902
        $this->dom->addChild($this->infOutros[$posicao], 'descOutros', $descOutros, false, $ident . 'Descrição '
2903
            . 'do documento');
2904
        $this->dom->addChild($this->infOutros[$posicao], 'nDoc', $nDoc, false, $ident . 'Número '
2905
            . 'do documento');
2906
        $this->dom->addChild($this->infOutros[$posicao], 'dEmi', $dEmi, false, $ident . 'Data de Emissão');
2907
        $this->dom->addChild($this->infOutros[$posicao], 'vDocFisc', $vDocFisc, false, $ident . 'Valor '
2908
            . 'do documento');
2909
        $this->dom->addChild($this->infOutros[$posicao], 'dPrev', $dPrev, false, $ident . 'Data '
2910
            . 'prevista de entrega');
2911
        return $this->infOutros[$posicao];
2912
    }
2913
2914
    /**
2915
     * Gera as tags para o elemento: "emiDocAnt" (Informações dos CT-es Anteriores)
2916
     * #345
2917
     * Nível: 3
2918
     * @param string $CNPJ
2919
     * @param string $CPF
2920
     * @param string $IE
2921
     * @param string $UF
2922
     * @param string $xNome
2923
     * @return mixed
2924
     */
2925
    public function emiDocAntTag($CNPJ = '', $CPF = '', $IE = '', $UF = '', $xNome = '')
2926
    {
2927
        $identificador = '#345 <emiDocAnt> - ';
2928
        $this->emiDocAnt[] = $this->dom->createElement('emiDocAnt');
2929
        $posicao = (integer)count($this->emiDocAnt) - 1;
2930 View Code Duplication
        if ($CNPJ != '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2931
            $this->dom->addChild($this->emiDocAnt[$posicao], 'CNPJ', $CNPJ, true, $identificador . 'Número do CNPJ');
2932
        } else {
2933
            $this->dom->addChild($this->emiDocAnt[$posicao], 'CPF', $CPF, true, $identificador . 'Número do CPF');
2934
        }
2935
        $this->dom->addChild($this->emiDocAnt[$posicao], 'IE', $IE, true, $identificador . 'Inscrição Estadual');
2936
        $this->dom->addChild($this->emiDocAnt[$posicao], 'UF', $UF, true, $identificador . 'Sigla da UF');
2937
        $this->dom->addChild($this->emiDocAnt[$posicao], 'xNome', $xNome, true, $identificador . 'Razão Social ou '
2938
            . ' Nome do Expedidor');
2939
2940
        return $this->emiDocAnt[$posicao];
2941
    }
2942
2943
    /**
2944
     * Gera as tags para o elemento: "idDocAntEle" (Informações dos CT-es Anteriores)
2945
     * #358
2946
     * Nível: 4
2947
     * @param string $chave
2948
     * @return mixed
2949
     */
2950 View Code Duplication
    public function idDocAntEleTag($chave = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2951
    {
2952
        $identificador = '#358 <idDocAntEle> - ';
2953
        $this->idDocAntEle[] = $this->dom->createElement('idDocAntEle');
2954
        $posicao = (integer)count($this->idDocAntEle) - 1;
2955
        $this->dom->addChild($this->idDocAntEle[$posicao], 'chave', $chave, true, $identificador . 'Chave de '
2956
            . 'Acesso do CT-e');
2957
2958
        return $this->idDocAntEle[$posicao];
2959
    }
2960
2961
2962
    /**
2963
     * Gera as tags para o elemento: "seg" (Informações de Seguro da Carga)
2964
     * #360
2965
     * Nível: 2
2966
     * @param int $respSeg
2967
     * @param string $xSeg
2968
     * @param string $nApol
2969
     * @param string $nAver
2970
     * @param string $vCarga
2971
     * @return mixed
2972
     */
2973
    public function segTag($respSeg = 4, $xSeg = '', $nApol = '', $nAver = '', $vCarga = '')
2974
    {
2975
        $identificador = '#360 <seg> - ';
2976
        $this->seg[] = $this->dom->createElement('seg');
2977
        $posicao = (integer)count($this->seg) - 1;
2978
2979
        $this->dom->addChild($this->seg[$posicao], 'respSeg', $respSeg, true, $identificador . 'Responsável 
2980
        pelo Seguro');
2981
        $this->dom->addChild($this->seg[$posicao], 'xSeg', $xSeg, false, $identificador . 'Nome da 
2982
        Seguradora');
2983
        $this->dom->addChild($this->seg[$posicao], 'nApol', $nApol, false, $identificador . 'Número da Apólice');
2984
        $this->dom->addChild($this->seg[$posicao], 'nAver', $nAver, false, $identificador . 'Número da 
2985
        Averbação');
2986
        $this->dom->addChild($this->seg[$posicao], 'vCarga', $vCarga, false, $identificador . 'Valor da Carga 
2987
        para efeito de averbação');
2988
        return $this->seg[$posicao];
2989
    }
2990
2991
    /**
2992
     * Gera as tags para o elemento: "infModal" (Informações do modal)
2993
     * #366
2994
     * Nível: 2
2995
     * @param string $versaoModal
2996
     * @return DOMElement|\DOMNode
2997
     */
2998
    public function infModalTag($versaoModal = '')
2999
    {
3000
        $identificador = '#366 <infModal> - ';
0 ignored issues
show
Unused Code introduced by
$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 $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3001
        $this->infModal = $this->dom->createElement('infModal');
3002
        $this->infModal->setAttribute('versaoModal', $versaoModal);
3003
        return $this->infModal;
3004
    }
3005
3006
    /**
3007
     * Leiaute - Rodoviário
3008
     * Gera as tags para o elemento: "rodo" (Informações do modal Rodoviário)
3009
     * #1
3010
     * Nível: 0
3011
     * @param string $RNTRC
3012
     * @param string $dPrev
3013
     * @param string $lota
3014
     * @param string $CIOT
3015
     * @return DOMElement|\DOMNode
3016
     */
3017
    public function rodoTag($RNTRC = '', $dPrev = '', $lota = '', $CIOT = '')
3018
    {
3019
        $identificador = '#1 <rodo> - ';
3020
        $this->rodo = $this->dom->createElement('rodo');
3021
        $this->dom->addChild($this->rodo, 'RNTRC', $RNTRC, true, $identificador . 'Registro nacional de 
3022
        transportadoresrodoviários de carga');
3023
        $this->dom->addChild($this->rodo, 'dPrev', $dPrev, true, $identificador . 'Data prevista para entrega da carga 
3024
            no recebedor');
3025
        $this->dom->addChild($this->rodo, 'lota', $lota, true, $identificador . 'Indicador de lotação');
3026
        $this->dom->addChild($this->rodo, 'CIOT', $CIOT, false, $identificador . 'Codigo identificador da operacao de '
3027
            . 'transporte');
3028
        return $this->rodo;
3029
    }
3030
3031
    /**
3032
     * Leiaute - Rodoviário
3033
     * Gera as tags para o elemento: "veic" (Dados dos Veículos)
3034
     * #21
3035
     * Nível: 1
3036
     * @param string $RENAVAM
3037
     * @param string $placa
3038
     * @param string $tara
3039
     * @param string $capKG
3040
     * @param string $capM3
3041
     * @param string $tpProp
3042
     * @param string $tpVeic
3043
     * @param string $tpRod
3044
     * @param string $tpCar
3045
     * @param string $UF
3046
     * @param string $CPF
3047
     * @param string $CNPJ
3048
     * @param string $RNTRC
3049
     * @param string $xNome
3050
     * @param string $IE
3051
     * @param string $propUF
3052
     * @param string $tpPropProp
3053
     * @return mixed
3054
     */
3055
    public function veicTag(
3056
        $RENAVAM = '',
3057
        $placa = '',
3058
        $tara = '',
3059
        $capKG = '',
3060
        $capM3 = '',
3061
        $tpProp = '',
3062
        $tpVeic = '',
3063
        $tpRod = '',
3064
        $tpCar = '',
3065
        $UF = '',
3066
        $CPF = '',
3067
        // Informar os zeros não significativos.
3068
        $CNPJ = '',
3069
        // Informar os zeros não significativos.
3070
        $RNTRC = '',
3071
        // Registro obrigatório do proprietário
3072
        $xNome = '',
3073
        // Nome do proprietário
3074
        $IE = '',
3075
        // Inscrição estadual caso seja Pessoa Jurídica
3076
        $propUF = '',
3077
        // Sigla da UF,
3078
        $tpPropProp = ''
3079
    ) {
3080
        $identificador = '#21 <veic> - ';
3081
        $this->veic[] = $this->dom->createElement('veic');
3082
        $posicao = (integer)count($this->veic) - 1;
3083
        $this->dom->addChild(
3084
            $this->veic[$posicao],
3085
            'RENAVAM',
3086
            $RENAVAM,
3087
            false,
3088
            $identificador . 'RENAVAM do veículo'
3089
        );
3090
        $this->dom->addChild(
3091
            $this->veic[$posicao],
3092
            'placa',
3093
            $placa,
3094
            false,
3095
            $identificador . 'Placa do veículo'
3096
        );
3097
        $this->dom->addChild(
3098
            $this->veic[$posicao],
3099
            'tara',
3100
            $tara,
3101
            false,
3102
            $identificador . 'Tara em KG'
3103
        );
3104
        $this->dom->addChild(
3105
            $this->veic[$posicao],
3106
            'capKG',
3107
            $capKG,
3108
            false,
3109
            $identificador . 'Capacidade em KG'
3110
        );
3111
        $this->dom->addChild(
3112
            $this->veic[$posicao],
3113
            'capM3',
3114
            $capM3,
3115
            false,
3116
            $identificador . 'Capacidade em M3'
3117
        );
3118
        $this->dom->addChild(
3119
            $this->veic[$posicao],
3120
            'tpProp',
3121
            $tpProp,
3122
            false,
3123
            $identificador . 'Tipo de Propriedade de veículo'
3124
        );
3125
        $this->dom->addChild(
3126
            $this->veic[$posicao],
3127
            'tpVeic',
3128
            $tpVeic,
3129
            false,
3130
            $identificador . 'Tipo do veículo'
3131
        );
3132
        $this->dom->addChild(
3133
            $this->veic[$posicao],
3134
            'tpRod',
3135
            $tpRod,
3136
            false,
3137
            $identificador . 'Tipo do Rodado'
3138
        );
3139
        $this->dom->addChild(
3140
            $this->veic[$posicao],
3141
            'tpCar',
3142
            $tpCar,
3143
            false,
3144
            $identificador . 'Tipo de Carroceria'
3145
        );
3146
        $this->dom->addChild(
3147
            $this->veic[$posicao],
3148
            'UF',
3149
            $UF,
3150
            false,
3151
            $identificador . 'UF em que veículo está licenciado'
3152
        );
3153
        if ($tpProp == 'T') { // CASO FOR VEICULO DE TERCEIRO
3154
            $this->prop[] = $this->dom->createElement('prop');
3155
            $p = (integer)count($this->prop) - 1;
3156 View Code Duplication
            if ($CNPJ != '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3157
                $this->dom->addChild(
3158
                    $this->prop[$p],
3159
                    'CNPJ',
3160
                    $CNPJ,
3161
                    true,
3162
                    $identificador . 'CNPJ do proprietario'
3163
                );
3164
            } elseif ($CPF != '') {
3165
                $this->dom->addChild(
3166
                    $this->prop[$p],
3167
                    'CPF',
3168
                    $CPF,
3169
                    true,
3170
                    $identificador . 'CPF do proprietario'
3171
                );
3172
            }
3173
            $this->dom->addChild(
3174
                $this->prop[$p],
3175
                'RNTRC',
3176
                $RNTRC,
3177
                true,
3178
                $identificador . 'RNTRC do proprietario'
3179
            );
3180
            $this->dom->addChild(
3181
                $this->prop[$p],
3182
                'xNome',
3183
                $xNome,
3184
                true,
3185
                $identificador . 'Nome do proprietario'
3186
            );
3187
            if ($IE !== '') {
3188
                $this->dom->addChild(
3189
                    $this->prop[$p],
3190
                    'IE',
3191
                    $IE,
3192
                    true,
3193
                    $identificador . 'IE do proprietario'
3194
                );
3195
            }
3196
            $this->dom->addChild(
3197
                $this->prop[$p],
3198
                'UF',
3199
                $propUF,
3200
                true,
3201
                $identificador . 'UF do proprietario'
3202
            );
3203
            $this->dom->addChild(
3204
                $this->prop[$p],
3205
                'tpProp',
3206
                $tpPropProp,
3207
                true,
3208
                $identificador . 'Tipo Proprietário'
3209
            );
3210
            $this->dom->appChild($this->veic[$posicao], $this->prop[$p], 'Falta tag "prop"');
3211
        }
3212
        return $this->veic[$posicao];
3213
    }
3214
3215
    /**
3216
     * Leiaute - Rodoviário
3217
     * Gera as tags para o elemento: "moto" (Informações do(s) Motorista(s))
3218
     * #43
3219
     * Nível: 1
3220
     * @param string $xNome
3221
     * @param string $CPF
3222
     * @return mixed
3223
     */
3224 View Code Duplication
    public function motoTag($xNome = '', $CPF = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3225
    {
3226
        $identificador = '#43 <moto> - ';
3227
        $this->moto[] = $this->dom->createElement('moto');
3228
        $posicao = (integer)count($this->moto) - 1;
3229
        $this->dom->addChild(
3230
            $this->moto[$posicao],
3231
            'xNome',
3232
            $xNome,
3233
            false,
3234
            $identificador . 'Nome do motorista'
3235
        );
3236
        $this->dom->addChild(
3237
            $this->moto[$posicao],
3238
            'CPF',
3239
            $CPF,
3240
            false,
3241
            $identificador . 'CPF do motorista'
3242
        );
3243
        return $this->moto[$posicao];
3244
    }
3245
3246
    /**
3247
     * Gera as tags para o elemento: "infCteComp" (Detalhamento do CT-e complementado)
3248
     * #410
3249
     * Nível: 1
3250
     * @param string $chave
3251
     * @return DOMElement|\DOMNode
3252
     */
3253
    public function infCTeComp($chave = '')
3254
    {
3255
        $identificador = '#410 <infCteComp> - ';
3256
        $this->infCteComp = $this->dom->createElement('infCteComp');
3257
        $this->dom->addChild(
3258
            $this->infCteComp,
3259
            'chave',
3260
            $chave,
3261
            true,
3262
            $identificador . ' Chave do CT-e complementado'
3263
        );
3264
        return $this->infCteComp;
3265
    }
3266
}
3267