1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NFePHP\CTe; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* |
7
|
|
|
* @category Library |
8
|
|
|
* @package nfephp-org/sped-cte |
9
|
|
|
* @copyright 2009-2016 NFePHP |
10
|
|
|
* @name Make.php |
11
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL v.3 |
12
|
|
|
* @link http://github.com/nfephp-org/sped-cte for the canonical source repository |
13
|
|
|
* @author Roberto L. Machado <linux.rlm at gmail dot com> |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
use NFePHP\Common\Base\BaseMake; |
17
|
|
|
use \DOMElement; |
18
|
|
|
|
19
|
|
|
class Make extends BaseMake |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* versao |
23
|
|
|
* numero da versão do xml da CTe |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
public $versao = '2.00'; |
27
|
|
|
/** |
28
|
|
|
* mod |
29
|
|
|
* modelo da CTe 57 |
30
|
|
|
* @var integer |
31
|
|
|
*/ |
32
|
|
|
public $mod = 57; |
33
|
|
|
/** |
34
|
|
|
* chave da MDFe |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
public $chCTe = ''; |
38
|
|
|
/** |
39
|
|
|
* xml |
40
|
|
|
* String com o xml do documento fiscal montado |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
public $xml = ''; |
44
|
|
|
/** |
45
|
|
|
* dom |
46
|
|
|
* Variável onde será montado o xml do documento fiscal |
47
|
|
|
* @var \NFePHP\Common\Dom\Dom |
48
|
|
|
*/ |
49
|
|
|
public $dom; |
50
|
|
|
/** |
51
|
|
|
* tpAmb |
52
|
|
|
* tipo de ambiente |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
public $tpAmb = '2'; |
56
|
|
|
/** |
57
|
|
|
* Modal do Cte |
58
|
|
|
* @var integer |
59
|
|
|
*/ |
60
|
|
|
private $modal = 0; |
61
|
|
|
/** |
62
|
|
|
* Tag CTe |
63
|
|
|
* @var \DOMNode |
64
|
|
|
*/ |
65
|
|
|
private $CTe = ''; |
66
|
|
|
/** |
67
|
|
|
* Informações do CT-e |
68
|
|
|
* @var \DOMNode |
69
|
|
|
*/ |
70
|
|
|
private $infCte = ''; |
71
|
|
|
/** |
72
|
|
|
* Identificação do CT-e |
73
|
|
|
* @var \DOMNode |
74
|
|
|
*/ |
75
|
|
|
private $ide = ''; |
76
|
|
|
/** |
77
|
|
|
* Tipo do Serviço |
78
|
|
|
* @var integer |
79
|
|
|
*/ |
80
|
|
|
private $tpServ = 0; |
81
|
|
|
/** |
82
|
|
|
* Indicador do "papel" do tomador do serviço no CT-e |
83
|
|
|
* @var \DOMNode |
84
|
|
|
*/ |
85
|
|
|
private $toma3 = ''; |
86
|
|
|
/** |
87
|
|
|
* Indicador do "papel" do tomador do serviço no CT-e |
88
|
|
|
* @var \DOMNode |
89
|
|
|
*/ |
90
|
|
|
private $toma4 = ''; |
91
|
|
|
/** |
92
|
|
|
* Dados do endereço |
93
|
|
|
* @var \DOMNode |
94
|
|
|
*/ |
95
|
|
|
private $enderToma = ''; |
96
|
|
|
/** |
97
|
|
|
* Dados complementares do CT-e para fins operacionais ou comerciais |
98
|
|
|
* @var \DOMNode |
99
|
|
|
*/ |
100
|
|
|
private $compl = ''; |
101
|
|
|
/** |
102
|
|
|
* Previsão do fluxo da carga |
103
|
|
|
* @var \DOMNode |
104
|
|
|
*/ |
105
|
|
|
private $fluxo = ''; |
106
|
|
|
/** |
107
|
|
|
* Passagem |
108
|
|
|
* @var array |
109
|
|
|
*/ |
110
|
|
|
private $pass = array(); |
111
|
|
|
/** |
112
|
|
|
* Informações ref. a previsão de entrega |
113
|
|
|
* @var \DOMNode |
114
|
|
|
*/ |
115
|
|
|
private $entrega = ''; |
116
|
|
|
/** |
117
|
|
|
* Entrega sem data definida |
118
|
|
|
* @var \DOMNode |
119
|
|
|
*/ |
120
|
|
|
private $semData = ''; |
121
|
|
|
/** |
122
|
|
|
* Entrega com data definida |
123
|
|
|
* @var \DOMNode |
124
|
|
|
*/ |
125
|
|
|
private $comData = ''; |
126
|
|
|
/** |
127
|
|
|
* Entrega no período definido |
128
|
|
|
* @var \DOMNode |
129
|
|
|
*/ |
130
|
|
|
private $noPeriodo = ''; |
131
|
|
|
/** |
132
|
|
|
* Entrega sem hora definida |
133
|
|
|
* @var \DOMNode |
134
|
|
|
*/ |
135
|
|
|
private $semHora = ''; |
136
|
|
|
/** |
137
|
|
|
* Entrega com hora definida |
138
|
|
|
* @var \DOMNode |
139
|
|
|
*/ |
140
|
|
|
private $comHora = ''; |
141
|
|
|
/** |
142
|
|
|
* Entrega no intervalo de horário definido |
143
|
|
|
* @var \DOMNode |
144
|
|
|
*/ |
145
|
|
|
private $noInter = ''; |
146
|
|
|
/** |
147
|
|
|
* Campo de uso livre do contribuinte |
148
|
|
|
* @var array |
149
|
|
|
*/ |
150
|
|
|
private $obsCont = array(); |
151
|
|
|
/** |
152
|
|
|
* Campo de uso livre do contribuinte |
153
|
|
|
* @var array |
154
|
|
|
*/ |
155
|
|
|
private $obsFisco = array(); |
156
|
|
|
/** |
157
|
|
|
* Identificação do Emitente do CT-e |
158
|
|
|
* @var \DOMNode |
159
|
|
|
*/ |
160
|
|
|
private $emit = ''; |
161
|
|
|
/** |
162
|
|
|
* Endereço do emitente |
163
|
|
|
* @var \DOMNode |
164
|
|
|
*/ |
165
|
|
|
private $enderEmit = ''; |
166
|
|
|
/** |
167
|
|
|
* Informações do Remetente das mercadorias transportadas pelo CT-e |
168
|
|
|
* @var \DOMNode |
169
|
|
|
*/ |
170
|
|
|
private $rem = ''; |
171
|
|
|
/** |
172
|
|
|
* Dados do endereço |
173
|
|
|
* @var \DOMNode |
174
|
|
|
*/ |
175
|
|
|
private $enderReme = ''; |
176
|
|
|
/** |
177
|
|
|
* Informações do Expedidor da Carga |
178
|
|
|
* @var \DOMNode |
179
|
|
|
*/ |
180
|
|
|
private $exped = ''; |
181
|
|
|
/** |
182
|
|
|
* Dados do endereço |
183
|
|
|
* @var \DOMNode |
184
|
|
|
*/ |
185
|
|
|
private $enderExped = ''; |
186
|
|
|
/** |
187
|
|
|
* Informações do Recebedor da Carga |
188
|
|
|
* @var \DOMNode |
189
|
|
|
*/ |
190
|
|
|
private $receb = ''; |
191
|
|
|
/** |
192
|
|
|
* Dados do endereço |
193
|
|
|
* @var \DOMNode |
194
|
|
|
*/ |
195
|
|
|
private $enderReceb = ''; |
196
|
|
|
/** |
197
|
|
|
* Informações do Destinatário do CT-e |
198
|
|
|
* @var \DOMNode |
199
|
|
|
*/ |
200
|
|
|
private $dest = ''; |
201
|
|
|
/** |
202
|
|
|
* Dados do endereço |
203
|
|
|
* @var \DOMNode |
204
|
|
|
*/ |
205
|
|
|
private $enderDest = ''; |
206
|
|
|
/** |
207
|
|
|
* Valores da Prestação de Serviço |
208
|
|
|
* @var \DOMNode |
209
|
|
|
*/ |
210
|
|
|
private $vPrest = ''; |
211
|
|
|
/** |
212
|
|
|
* Componentes do Valor da Prestação |
213
|
|
|
* @var array |
214
|
|
|
*/ |
215
|
|
|
private $comp = array(); |
216
|
|
|
/** |
217
|
|
|
* Informações relativas aos Impostos |
218
|
|
|
* @var \DOMNode |
219
|
|
|
*/ |
220
|
|
|
private $imp = ''; |
221
|
|
|
/** |
222
|
|
|
* Informações relativas ao ICMS |
223
|
|
|
* @var \DOMNode |
224
|
|
|
*/ |
225
|
|
|
private $ICMS = ''; |
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Prestação sujeito à tributação normal do ICMS |
228
|
|
|
* @var \DOMNode |
229
|
|
|
*/ |
230
|
|
|
private $ICMS00 = ''; |
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Prestação sujeito à tributação com redução de BC do ICMS |
233
|
|
|
* @var \DOMNode |
234
|
|
|
*/ |
235
|
|
|
private $ICMS20 = ''; |
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* ICMS Isento, não Tributado ou diferido |
238
|
|
|
* @var \DOMNode |
239
|
|
|
*/ |
240
|
|
|
private $ICMS45 = ''; |
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* Tributação pelo ICMS60 - ICMS cobrado por substituição tributária. |
243
|
|
|
* Responsabilidade do recolhimento do ICMS atribuído ao tomador ou 3º por ST |
244
|
|
|
* @var \DOMNode |
245
|
|
|
*/ |
246
|
|
|
private $ICMS60 = ''; |
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* ICMS Outros |
249
|
|
|
* @var \DOMNode |
250
|
|
|
*/ |
251
|
|
|
private $ICMS90 = ''; |
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* ICMS devido à UF de origem da prestação, quando diferente da UF do emitente |
254
|
|
|
* @var \DOMNode |
255
|
|
|
*/ |
256
|
|
|
private $ICMSOutraUF = ''; |
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Simples Nacional |
259
|
|
|
* @var \DOMNode |
260
|
|
|
*/ |
261
|
|
|
private $ICMSSN = ''; |
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* Observações adicionais da CT-e |
264
|
|
|
* @var string |
265
|
|
|
*/ |
266
|
|
|
private $xObs = ''; |
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* Grupo de informações do CT-e Normal e Substituto |
269
|
|
|
* @var \DOMNode |
270
|
|
|
*/ |
271
|
|
|
private $infCTeNorm = ''; |
272
|
|
|
/** |
273
|
|
|
* Informações da Carga do CT-e |
274
|
|
|
* @var \DOMNode |
275
|
|
|
*/ |
276
|
|
|
private $infCarga = ''; |
277
|
|
|
/** |
278
|
|
|
* Informações de quantidades da Carga do CT-e |
279
|
|
|
* @var \DOMNode |
280
|
|
|
*/ |
281
|
|
|
private $infQ = array(); |
282
|
|
|
/** |
283
|
|
|
* Informações dos documentos transportados pelo CT-e Opcional para Redespacho Intermediario |
284
|
|
|
* e Serviço vinculado a multimodal. |
285
|
|
|
* @var \DOMNode |
286
|
|
|
*/ |
287
|
|
|
private $infDoc = array(); |
288
|
|
|
/** |
289
|
|
|
* Informações das NF |
290
|
|
|
* @var array |
291
|
|
|
*/ |
292
|
|
|
private $infNF = array(); |
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* Informações das NF-e |
295
|
|
|
* @var array |
296
|
|
|
*/ |
297
|
|
|
private $infNFe = array(); |
298
|
|
|
/** |
299
|
|
|
* Informações dos demais documentos |
300
|
|
|
* @var array |
301
|
|
|
*/ |
302
|
|
|
private $infOutros = array(); |
303
|
|
|
/** |
304
|
|
|
* Informações das Unidades de Transporte (Carreta/Reboque/Vagão) |
305
|
|
|
* @var array |
306
|
|
|
*/ |
307
|
|
|
private $infUnidTransp = array(); |
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Lacres das Unidades de Transporte |
310
|
|
|
* @var array |
311
|
|
|
*/ |
312
|
|
|
private $lacUnidTransp = array(); |
|
|
|
|
313
|
|
|
/** |
314
|
|
|
* Informações das Unidades de Carga (Containeres/ULD/Outros) |
315
|
|
|
* @var array |
316
|
|
|
*/ |
317
|
|
|
private $infUnidCarga = array(); |
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Lacres das Unidades de Carga |
320
|
|
|
* @var array |
321
|
|
|
*/ |
322
|
|
|
private $lacUnidCarga = array(); |
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Documentos de Transporte Anterior |
325
|
|
|
* @var \DOMNode |
326
|
|
|
*/ |
327
|
|
|
private $docAnt = ''; |
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* Emissor do documento anterior |
330
|
|
|
* @var array |
331
|
|
|
*/ |
332
|
|
|
private $emiDocAnt = array(); |
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* Informações de identificação dos documentos de Transporte Anterior |
335
|
|
|
* @var array |
336
|
|
|
*/ |
337
|
|
|
private $idDocAnt = array(); |
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* Documentos de transporte anterior em papel |
340
|
|
|
* @var array |
341
|
|
|
*/ |
342
|
|
|
private $idDocAntPap = array(); |
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* Documentos de transporte anterior eletrônicos |
345
|
|
|
* @var array |
346
|
|
|
*/ |
347
|
|
|
private $idDocAntEle = array(); |
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* Informações de Seguro da Carga |
350
|
|
|
* @var array |
351
|
|
|
*/ |
352
|
|
|
private $seg = array(); |
353
|
|
|
/** |
354
|
|
|
* Informações do modal |
355
|
|
|
* @var \DOMNode |
356
|
|
|
*/ |
357
|
|
|
private $infModal = ''; |
358
|
|
|
/** |
359
|
|
|
* Preenchido quando for transporte de produtos classificados pela ONU como perigosos. |
360
|
|
|
* @var array |
361
|
|
|
*/ |
362
|
|
|
private $peri = array(); |
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* informações dos veículos transportados |
365
|
|
|
* @var array |
366
|
|
|
*/ |
367
|
|
|
private $veicNovos = array(); |
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* Dados da cobrança do CT-e |
370
|
|
|
* @var \DOMNode |
371
|
|
|
*/ |
372
|
|
|
private $cobr = ''; |
|
|
|
|
373
|
|
|
/** |
374
|
|
|
* Dados da fatura |
375
|
|
|
* @var \DOMNode |
376
|
|
|
*/ |
377
|
|
|
private $fat = ''; |
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Dados das duplicatas |
380
|
|
|
* @var array |
381
|
|
|
*/ |
382
|
|
|
private $dup = array(); |
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* Informações do CT-e de substituição |
385
|
|
|
* @var \DOMNode |
386
|
|
|
*/ |
387
|
|
|
private $infCteSub = ''; |
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* Tomador é contribuinte do ICMS |
390
|
|
|
* @var \DOMNode |
391
|
|
|
*/ |
392
|
|
|
private $tomaICMS = ''; |
|
|
|
|
393
|
|
|
/** |
394
|
|
|
* Tomador não é contribuinte do ICMS |
395
|
|
|
* @var \DOMNode |
396
|
|
|
*/ |
397
|
|
|
private $tomaNaoICMS = ''; |
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* Informação da NF ou CT emitido pelo Tomador |
400
|
|
|
* @var \DOMNode |
401
|
|
|
*/ |
402
|
|
|
private $refNF = ''; |
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* Informação do CTe emitido pelo Tomador |
405
|
|
|
* @var \DOMNode |
406
|
|
|
*/ |
407
|
|
|
private $refCte = ''; |
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Informação da NF ou CT emitido pelo Tomador |
410
|
|
|
* @var \DOMNode |
411
|
|
|
*/ |
412
|
|
|
private $infCteComp = ''; |
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Detalhamento do CT-e do tipo Anulação |
415
|
|
|
* @var \DOMNode |
416
|
|
|
*/ |
417
|
|
|
private $infCteAnu = ''; |
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* Informações do modal Rodoviário |
420
|
|
|
* @var \DOMNode |
421
|
|
|
*/ |
422
|
|
|
private $rodo = ''; |
423
|
|
|
/** |
424
|
|
|
* Ordens de Coleta associados |
425
|
|
|
* @var array |
426
|
|
|
*/ |
427
|
|
|
private $occ = array(); |
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* @var \DOMNode |
430
|
|
|
*/ |
431
|
|
|
private $emiOcc = array(); |
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* Informações de Vale Pedágio |
434
|
|
|
* @var array |
435
|
|
|
*/ |
436
|
|
|
private $valePed = array(); |
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Dados dos Veículos |
439
|
|
|
* @var array |
440
|
|
|
*/ |
441
|
|
|
private $veic = array(); |
|
|
|
|
442
|
|
|
/** |
443
|
|
|
* Proprietários do Veículo. Só preenchido quando o veículo não pertencer à empresa emitente do CT-e |
444
|
|
|
* @var array |
445
|
|
|
*/ |
446
|
|
|
private $prop = array(); |
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* Dados dos Veículos |
449
|
|
|
* @var array |
450
|
|
|
*/ |
451
|
|
|
private $lacRodo = array(); |
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Informações do(s) Motorista(s) |
454
|
|
|
* @var array |
455
|
|
|
*/ |
456
|
|
|
private $moto = array(); |
|
|
|
|
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* Monta o arquivo XML usando as tag's já preenchidas |
460
|
|
|
* |
461
|
|
|
* @return bool |
462
|
|
|
*/ |
463
|
|
|
public function montaCTe() |
464
|
|
|
{ |
465
|
|
|
if (count($this->erros) > 0) { |
466
|
|
|
return false; |
467
|
|
|
} |
468
|
|
|
$this->zCTeTag(); |
469
|
|
|
if ($this->toma3 != '') { |
470
|
|
|
$this->dom->appChild($this->ide, $this->toma3, 'Falta tag "ide"'); |
471
|
|
|
} else { |
472
|
|
|
$this->dom->appChild($this->toma4, $this->enderToma, 'Falta tag "toma4"'); |
473
|
|
|
$this->dom->appChild($this->ide, $this->toma4, 'Falta tag "ide"'); |
474
|
|
|
} |
475
|
|
|
$this->dom->appChild($this->infCte, $this->ide, 'Falta tag "infCte"'); |
476
|
|
|
if ($this->compl != '') { |
477
|
|
|
if ($this->fluxo != '') { |
478
|
|
|
foreach ($this->pass as $pass) { |
479
|
|
|
$this->dom->appChild($this->fluxo, $pass, 'Falta tag "fluxo"'); |
480
|
|
|
} |
481
|
|
|
$this->dom->appChild($this->compl, $this->fluxo, 'Falta tag "infCte"'); |
482
|
|
|
} |
483
|
|
|
if ($this->semData != '') { |
484
|
|
|
$this->zEntregaTag(); |
485
|
|
|
$this->dom->appChild($this->entrega, $this->semData, 'Falta tag "Entrega"'); |
486
|
|
|
} elseif ($this->comData != '') { |
487
|
|
|
$this->zEntregaTag(); |
488
|
|
|
$this->dom->appChild($this->entrega, $this->comData, 'Falta tag "Entrega"'); |
489
|
|
|
} elseif ($this->noPeriodo != '') { |
490
|
|
|
$this->zEntregaTag(); |
491
|
|
|
$this->dom->appChild($this->entrega, $this->noPeriodo, 'Falta tag "Entrega"'); |
492
|
|
|
} elseif ($this->semHora != '') { |
493
|
|
|
$this->zEntregaTag(); |
494
|
|
|
$this->dom->appChild($this->entrega, $this->semHora, 'Falta tag "Entrega"'); |
495
|
|
|
} elseif ($this->comHora != '') { |
496
|
|
|
$this->zEntregaTag(); |
497
|
|
|
$this->dom->appChild($this->entrega, $this->comHora, 'Falta tag "Entrega"'); |
498
|
|
|
} elseif ($this->noInter != '') { |
499
|
|
|
$this->zEntregaTag(); |
500
|
|
|
$this->dom->appChild($this->entrega, $this->noInter, 'Falta tag "Entrega"'); |
501
|
|
|
} |
502
|
|
|
foreach ($this->obsCont as $obsCont) { |
503
|
|
|
$this->dom->appChild($this->compl, $obsCont, 'Falta tag "compl"'); |
504
|
|
|
} |
505
|
|
|
foreach ($this->obsFisco as $obsFisco) { |
506
|
|
|
$this->dom->appChild($this->compl, $obsFisco, 'Falta tag "compl"'); |
507
|
|
|
} |
508
|
|
|
$this->dom->appChild($this->infCte, $this->compl, 'Falta tag "infCte"'); |
509
|
|
|
} |
510
|
|
|
$this->dom->appChild($this->emit, $this->enderEmit, 'Falta tag "emit"'); |
511
|
|
|
$this->dom->appChild($this->infCte, $this->emit, 'Falta tag "infCte"'); |
512
|
|
|
if ($this->rem != '') { |
513
|
|
|
// $this->dom->appChild($this->rem, $this->enderReme, 'Falta tag "rem"'); |
|
|
|
|
514
|
|
|
$this->dom->appChild($this->infCte, $this->rem, 'Falta tag "infCte"'); |
515
|
|
|
} |
516
|
|
|
if ($this->exped != '') { |
517
|
|
|
// $this->dom->appChild($this->exped, $this->enderExped, 'Falta tag "exped"'); |
|
|
|
|
518
|
|
|
$this->dom->appChild($this->infCte, $this->exped, 'Falta tag "infCte"'); |
519
|
|
|
} |
520
|
|
|
if ($this->receb != '') { |
521
|
|
|
// $this->dom->appChild($this->receb, $this->enderReceb, 'Falta tag "receb"'); |
|
|
|
|
522
|
|
|
$this->dom->appChild($this->infCte, $this->receb, 'Falta tag "infCte"'); |
523
|
|
|
} |
524
|
|
|
if ($this->dest != '') { |
525
|
|
|
// $this->dom->appChild($this->dest, $this->enderDest, 'Falta tag "dest"'); |
|
|
|
|
526
|
|
|
$this->dom->appChild($this->infCte, $this->dest, 'Falta tag "infCte"'); |
527
|
|
|
} |
528
|
|
|
foreach ($this->comp as $comp) { |
529
|
|
|
$this->dom->appChild($this->vPrest, $comp, 'Falta tag "vPrest"'); |
530
|
|
|
} |
531
|
|
|
$this->dom->appChild($this->infCte, $this->vPrest, 'Falta tag "infCte"'); |
532
|
|
|
$this->dom->appChild($this->infCte, $this->imp, 'Falta tag "imp"'); |
533
|
|
|
$this->dom->appChild($this->infCte, $this->infCTeNorm, 'Falta tag "infCTeNorm"'); |
534
|
|
|
$this->dom->appChild($this->infCTeNorm, $this->infCarga, 'Falta tag "infCarga"'); |
535
|
|
|
$this->dom->appChild($this->infCarga, $this->infQ, 'Falta tag "infQ"'); |
536
|
|
|
$this->dom->appChild($this->infCTeNorm, $this->infDoc, 'Falta tag "infDoc"'); |
537
|
|
|
|
538
|
|
|
foreach ($this->infNFe as $infNFe) { |
539
|
|
|
$this->dom->appChild($this->infDoc, $infNFe, 'Falta tag "infNFe"'); |
540
|
|
|
} |
541
|
|
|
foreach ($this->infOutros as $infOutros) { |
542
|
|
|
$this->dom->appChild($this->infDoc, $infOutros, 'Falta tag "infOutros"'); |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
$this->dom->appChild($this->infCTeNorm, $this->seg, 'Falta tag "seg"'); |
|
|
|
|
546
|
|
|
$this->dom->appChild($this->infCTeNorm, $this->infModal, 'Falta tag "infModal"'); |
547
|
|
|
|
548
|
|
|
$this->dom->appChild($this->infModal, $this->rodo, 'Falta tag "rodo"'); |
549
|
|
|
|
550
|
|
|
$this->dom->appChild($this->CTe, $this->infCte, 'Falta tag "CTe"'); |
551
|
|
|
$this->dom->appChild($this->dom, $this->CTe, 'Falta tag "DOMDocument"'); |
552
|
|
|
$this->xml = $this->dom->saveXML(); |
553
|
|
|
return true; |
554
|
|
|
} |
555
|
|
|
|
556
|
|
|
/** |
557
|
|
|
* Gera o grupo básico: Informações do CT-e |
558
|
|
|
* #1 |
559
|
|
|
* Nível: 0 |
560
|
|
|
* |
561
|
|
|
* @param string $chave Chave do CTe |
562
|
|
|
* @param string $versao Versão do CTe |
563
|
|
|
* |
564
|
|
|
* @return \DOMElement |
565
|
|
|
*/ |
566
|
3 |
|
public function infCteTag($chave = '', $versao = '') |
567
|
|
|
{ |
568
|
3 |
|
$this->infCte = $this->dom->createElement('infCte'); |
569
|
3 |
|
$this->infCte->setAttribute('Id', 'CTe' . $chave); |
570
|
3 |
|
$this->infCte->setAttribute('versao', $versao); |
571
|
3 |
|
return $this->infCte; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
/** |
575
|
|
|
* Gera as tags para o elemento: Identificação do CT-e |
576
|
|
|
* #4 |
577
|
|
|
* Nível: 1 |
578
|
|
|
* 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 |
579
|
|
|
* |
580
|
|
|
* @param string $cUF Código da UF do emitente do CT-e |
581
|
|
|
* @param string $cCT Código numérico que compõe a Chave de Acesso |
582
|
|
|
* @param string $CFOP Código Fiscal de Operações e Prestações |
583
|
|
|
* @param string $natOp Natureza da Operação |
584
|
|
|
* @param string $mod Modelo do documento fiscal |
585
|
|
|
* @param string $serie Série do CT-e |
586
|
|
|
* @param string $nCT Número do CT-e |
587
|
|
|
* @param string $dhEmi Data e hora de emissão do CT-e |
588
|
|
|
* @param string $tpImp Formato de impressão do DACTE |
589
|
|
|
* @param string $tpEmis Forma de emissão do CT-e |
590
|
|
|
* @param string $cDV Digito Verificador da chave de acesso do CT-e |
591
|
|
|
* @param string $tpAmb Tipo do Ambiente |
592
|
|
|
* @param string $tpCTe Tipo do CT-e |
593
|
|
|
* @param string $procEmi Identificador do processo de emissão do CT-e |
594
|
|
|
* @param string $verProc Versão do processo de emissão |
595
|
|
|
* @param string $refCTE Chave de acesso do CT-e referenciado |
|
|
|
|
596
|
|
|
* @param string $cMunEnv Código do Município de envio do CT-e (de onde o documento foi transmitido) |
597
|
|
|
* @param string $xMunEnv Nome do Município de envio do CT-e (de onde o documento foi transmitido) |
598
|
|
|
* @param string $UFEnv Sigla da UF de envio do CT-e (de onde o documento foi transmitido) |
599
|
|
|
* @param string $modal Modal |
600
|
|
|
* @param string $tpServ Tipo do Serviço |
601
|
|
|
* @param string $cMunIni Código do Município de início da prestação |
602
|
|
|
* @param string $xMunIni Nome do Município do início da prestação |
603
|
|
|
* @param string $UFIni UF do início da prestação |
604
|
|
|
* @param string $cMunFim Código do Município de término da prestação |
605
|
|
|
* @param string $xMunFim Nome do Município do término da prestação |
606
|
|
|
* @param string $UFFim UF do término da prestação |
607
|
|
|
* @param string $retira Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino? |
608
|
|
|
* @param string $xDetRetira Detalhes do retira |
609
|
|
|
* @param string $dhCont Data e Hora da entrada em contingência |
610
|
|
|
* @param string $xJust Justificativa da entrada em contingência |
611
|
|
|
* |
612
|
|
|
* @return \DOMElement |
613
|
|
|
*/ |
614
|
3 |
|
public function ideTag( |
615
|
|
|
$cUF = '', |
616
|
|
|
$cCT = '', |
617
|
|
|
$CFOP = '', |
618
|
|
|
$natOp = '', |
619
|
|
|
$mod = '', |
620
|
|
|
$serie = '', |
621
|
|
|
$nCT = '', |
622
|
|
|
$dhEmi = '', |
623
|
|
|
$tpImp = '', |
624
|
|
|
$tpEmis = '', |
625
|
|
|
$cDV = '', |
626
|
|
|
$tpAmb = '', |
627
|
|
|
$tpCTe = '', |
628
|
|
|
$procEmi = '', |
629
|
|
|
$verProc = '', |
630
|
|
|
$indGlobalizado = '', |
631
|
|
|
$cMunEnv = '', |
632
|
|
|
$xMunEnv = '', |
633
|
|
|
$UFEnv = '', |
634
|
|
|
$modal = '', |
635
|
|
|
$tpServ = '', |
636
|
|
|
$cMunIni = '', |
637
|
|
|
$xMunIni = '', |
638
|
|
|
$UFIni = '', |
639
|
|
|
$cMunFim = '', |
640
|
|
|
$xMunFim = '', |
641
|
|
|
$UFFim = '', |
642
|
|
|
$retira = '', |
643
|
|
|
$xDetRetira = '', |
644
|
|
|
$indIEToma = '', |
645
|
|
|
$dhCont = '', |
646
|
|
|
$xJust = '' |
647
|
|
|
) { |
648
|
3 |
|
$this->tpAmb = $tpAmb; |
649
|
3 |
|
$identificador = '#4 <ide> - '; |
650
|
3 |
|
$this->ide = $this->dom->createElement('ide'); |
651
|
3 |
|
$this->dom->addChild( |
652
|
3 |
|
$this->ide, |
653
|
3 |
|
'cUF', |
654
|
2 |
|
$cUF, |
655
|
3 |
|
true, |
656
|
1 |
|
$identificador . 'Código da UF do emitente do CT-e' |
657
|
2 |
|
); |
658
|
3 |
|
$this->dom->addChild( |
659
|
3 |
|
$this->ide, |
660
|
3 |
|
'cCT', |
661
|
2 |
|
$cCT, |
662
|
3 |
|
true, |
663
|
1 |
|
$identificador . 'Código numérico que compõe a Chave de Acesso' |
664
|
2 |
|
); |
665
|
3 |
|
$this->dom->addChild( |
666
|
3 |
|
$this->ide, |
667
|
3 |
|
'CFOP', |
668
|
2 |
|
$CFOP, |
669
|
3 |
|
true, |
670
|
1 |
|
$identificador . 'Código Fiscal de Operações e Prestações' |
671
|
2 |
|
); |
672
|
3 |
|
$this->dom->addChild( |
673
|
3 |
|
$this->ide, |
674
|
3 |
|
'natOp', |
675
|
2 |
|
$natOp, |
676
|
3 |
|
true, |
677
|
1 |
|
$identificador . 'Natureza da Operação' |
678
|
2 |
|
); |
679
|
3 |
|
$this->dom->addChild( |
680
|
3 |
|
$this->ide, |
681
|
3 |
|
'mod', |
682
|
2 |
|
$mod, |
683
|
3 |
|
true, |
684
|
1 |
|
$identificador . 'Modelo do documento fiscal' |
685
|
2 |
|
); |
686
|
3 |
|
$this->mod = $mod; |
|
|
|
|
687
|
3 |
|
$this->dom->addChild( |
688
|
3 |
|
$this->ide, |
689
|
3 |
|
'serie', |
690
|
2 |
|
$serie, |
691
|
3 |
|
true, |
692
|
1 |
|
$identificador . 'Série do CT-e' |
693
|
2 |
|
); |
694
|
3 |
|
$this->dom->addChild( |
695
|
3 |
|
$this->ide, |
696
|
3 |
|
'nCT', |
697
|
2 |
|
$nCT, |
698
|
3 |
|
true, |
699
|
1 |
|
$identificador . 'Número do CT-e' |
700
|
2 |
|
); |
701
|
3 |
|
$this->dom->addChild( |
702
|
3 |
|
$this->ide, |
703
|
3 |
|
'dhEmi', |
704
|
2 |
|
$dhEmi, |
705
|
3 |
|
true, |
706
|
1 |
|
$identificador . 'Data e hora de emissão do CT-e' |
707
|
2 |
|
); |
708
|
3 |
|
$this->dom->addChild( |
709
|
3 |
|
$this->ide, |
710
|
3 |
|
'tpImp', |
711
|
2 |
|
$tpImp, |
712
|
3 |
|
true, |
713
|
1 |
|
$identificador . 'Formato de impressão do DACTE' |
714
|
2 |
|
); |
715
|
3 |
|
$this->dom->addChild( |
716
|
3 |
|
$this->ide, |
717
|
3 |
|
'tpEmis', |
718
|
2 |
|
$tpEmis, |
719
|
3 |
|
true, |
720
|
1 |
|
$identificador . 'Forma de emissão do CT-e' |
721
|
2 |
|
); |
722
|
3 |
|
$this->dom->addChild( |
723
|
3 |
|
$this->ide, |
724
|
3 |
|
'cDV', |
725
|
2 |
|
$cDV, |
726
|
3 |
|
true, |
727
|
1 |
|
$identificador . 'Digito Verificador da chave de acesso do CT-e' |
728
|
2 |
|
); |
729
|
3 |
|
$this->dom->addChild( |
730
|
3 |
|
$this->ide, |
731
|
3 |
|
'tpAmb', |
732
|
2 |
|
$tpAmb, |
733
|
3 |
|
true, |
734
|
1 |
|
$identificador . 'Tipo do Ambiente' |
735
|
2 |
|
); |
736
|
3 |
|
$this->dom->addChild( |
737
|
3 |
|
$this->ide, |
738
|
3 |
|
'tpCTe', |
739
|
2 |
|
$tpCTe, |
740
|
3 |
|
true, |
741
|
1 |
|
$identificador . 'Tipo do CT-e' |
742
|
2 |
|
); |
743
|
3 |
|
$this->dom->addChild( |
744
|
3 |
|
$this->ide, |
745
|
3 |
|
'procEmi', |
746
|
2 |
|
$procEmi, |
747
|
3 |
|
true, |
748
|
1 |
|
$identificador . 'Identificador do processo de emissão do CT-e' |
749
|
2 |
|
); |
750
|
3 |
|
$this->dom->addChild( |
751
|
3 |
|
$this->ide, |
752
|
3 |
|
'verProc', |
753
|
2 |
|
$verProc, |
754
|
3 |
|
true, |
755
|
1 |
|
$identificador . 'Versão do processo de emissão' |
756
|
2 |
|
); |
757
|
3 |
|
$this->dom->addChild( |
758
|
3 |
|
$this->ide, |
759
|
3 |
|
'indGlobalizado', |
760
|
2 |
|
$indGlobalizado, |
761
|
3 |
|
false, |
762
|
1 |
|
$identificador . 'Indicador de CT-e Globalizado' |
763
|
2 |
|
); |
764
|
3 |
|
$this->dom->addChild( |
765
|
3 |
|
$this->ide, |
766
|
3 |
|
'cMunEnv', |
767
|
2 |
|
$cMunEnv, |
768
|
3 |
|
true, |
769
|
1 |
|
$identificador . 'Código do Município de envio do CT-e (de onde o documento foi transmitido)' |
770
|
2 |
|
); |
771
|
3 |
|
$this->dom->addChild( |
772
|
3 |
|
$this->ide, |
773
|
3 |
|
'xMunEnv', |
774
|
2 |
|
$xMunEnv, |
775
|
3 |
|
true, |
776
|
1 |
|
$identificador . 'Nome do Município de envio do CT-e (de onde o documento foi transmitido)' |
777
|
2 |
|
); |
778
|
3 |
|
$this->dom->addChild( |
779
|
3 |
|
$this->ide, |
780
|
3 |
|
'UFEnv', |
781
|
2 |
|
$UFEnv, |
782
|
3 |
|
true, |
783
|
1 |
|
$identificador . 'Sigla da UF de envio do CT-e (de onde o documento foi transmitido)' |
784
|
2 |
|
); |
785
|
3 |
|
$this->dom->addChild( |
786
|
3 |
|
$this->ide, |
787
|
3 |
|
'modal', |
788
|
2 |
|
$modal, |
789
|
3 |
|
true, |
790
|
1 |
|
$identificador . 'Modal' |
791
|
2 |
|
); |
792
|
3 |
|
$this->modal = $modal; |
|
|
|
|
793
|
3 |
|
$this->dom->addChild( |
794
|
3 |
|
$this->ide, |
795
|
3 |
|
'tpServ', |
796
|
2 |
|
$tpServ, |
797
|
3 |
|
true, |
798
|
1 |
|
$identificador . 'Tipo do Serviço' |
799
|
2 |
|
); |
800
|
3 |
|
$this->dom->addChild( |
801
|
3 |
|
$this->ide, |
802
|
3 |
|
'cMunIni', |
803
|
2 |
|
$cMunIni, |
804
|
3 |
|
true, |
805
|
1 |
|
$identificador . 'Nome do Município do início da prestação' |
806
|
2 |
|
); |
807
|
3 |
|
$this->dom->addChild( |
808
|
3 |
|
$this->ide, |
809
|
3 |
|
'xMunIni', |
810
|
2 |
|
$xMunIni, |
811
|
3 |
|
true, |
812
|
1 |
|
$identificador . 'Nome do Município do início da prestação' |
813
|
2 |
|
); |
814
|
3 |
|
$this->dom->addChild( |
815
|
3 |
|
$this->ide, |
816
|
3 |
|
'UFIni', |
817
|
2 |
|
$UFIni, |
818
|
3 |
|
true, |
819
|
1 |
|
$identificador . 'UF do início da prestação' |
820
|
2 |
|
); |
821
|
3 |
|
$this->dom->addChild( |
822
|
3 |
|
$this->ide, |
823
|
3 |
|
'cMunFim', |
824
|
2 |
|
$cMunFim, |
825
|
3 |
|
true, |
826
|
1 |
|
$identificador . 'Código do Município de término da prestação' |
827
|
2 |
|
); |
828
|
3 |
|
$this->dom->addChild( |
829
|
3 |
|
$this->ide, |
830
|
3 |
|
'xMunFim', |
831
|
2 |
|
$xMunFim, |
832
|
3 |
|
true, |
833
|
1 |
|
$identificador . 'Nome do Município do término da prestação' |
834
|
2 |
|
); |
835
|
3 |
|
$this->dom->addChild( |
836
|
3 |
|
$this->ide, |
837
|
3 |
|
'UFFim', |
838
|
2 |
|
$UFFim, |
839
|
3 |
|
true, |
840
|
1 |
|
$identificador . 'UF do término da prestação' |
841
|
2 |
|
); |
842
|
3 |
|
$this->dom->addChild( |
843
|
3 |
|
$this->ide, |
844
|
3 |
|
'retira', |
845
|
2 |
|
$retira, |
846
|
3 |
|
true, |
847
|
1 |
|
$identificador . 'Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino' |
848
|
2 |
|
); |
849
|
3 |
|
$this->dom->addChild( |
850
|
3 |
|
$this->ide, |
851
|
3 |
|
'xDetRetira', |
852
|
2 |
|
$xDetRetira, |
853
|
3 |
|
false, |
854
|
1 |
|
$identificador . 'Detalhes do retira' |
855
|
2 |
|
); |
856
|
3 |
|
$this->dom->addChild( |
857
|
3 |
|
$this->ide, |
858
|
3 |
|
'indIEToma', |
859
|
2 |
|
$indIEToma, |
860
|
3 |
|
true, |
861
|
1 |
|
$identificador . 'Indicador do papel do tomador na prestação do serviço' |
862
|
2 |
|
); |
863
|
3 |
|
$this->dom->addChild( |
864
|
3 |
|
$this->ide, |
865
|
3 |
|
'dhCont', |
866
|
2 |
|
$dhCont, |
867
|
3 |
|
false, |
868
|
1 |
|
$identificador . 'Data e Hora da entrada em contingência' |
869
|
2 |
|
); |
870
|
3 |
|
$this->dom->addChild( |
871
|
3 |
|
$this->ide, |
872
|
3 |
|
'xJust', |
873
|
2 |
|
$xJust, |
874
|
3 |
|
false, |
875
|
1 |
|
$identificador . 'Justificativa da entrada em contingência' |
876
|
2 |
|
); |
877
|
3 |
|
$this->tpServ = $tpServ; |
|
|
|
|
878
|
3 |
|
return $this->ide; |
879
|
|
|
} |
880
|
|
|
|
881
|
|
|
/** |
882
|
|
|
* Gera as tags para o elemento: toma3 (Indicador do "papel" do tomador do serviço no CT-e) |
883
|
|
|
* e adiciona ao grupo ide |
884
|
|
|
* #35 |
885
|
|
|
* Nível: 2 |
886
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "toma3" do |
887
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
888
|
|
|
* |
889
|
|
|
* @param string $toma Tomador do Serviço |
890
|
|
|
* |
891
|
|
|
* @return \DOMElement |
892
|
|
|
*/ |
893
|
3 |
|
public function toma3Tag($toma = '') |
894
|
|
|
{ |
895
|
3 |
|
$identificador = '#35 <toma3> - '; |
896
|
3 |
|
$this->toma3 = $this->dom->createElement('toma3'); |
897
|
3 |
|
$this->dom->addChild( |
898
|
3 |
|
$this->toma3, |
899
|
3 |
|
'toma', |
900
|
2 |
|
$toma, |
901
|
3 |
|
true, |
902
|
1 |
|
$identificador . 'Tomador do Serviço' |
903
|
2 |
|
); |
904
|
3 |
|
return $this->toma3; |
905
|
|
|
} |
906
|
|
|
|
907
|
|
|
/** |
908
|
|
|
* Gera as tags para o elemento: toma4 (Indicador do "papel" do tomador |
909
|
|
|
* do serviço no CT-e) e adiciona ao grupo ide |
910
|
|
|
* #37 |
911
|
|
|
* Nível: 2 |
912
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "toma4" do |
913
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
914
|
|
|
* |
915
|
|
|
* @param string $toma Tomador do Serviço |
916
|
|
|
* @param string $CNPJ Número do CNPJ |
917
|
|
|
* @param string $CPF Número do CPF |
918
|
|
|
* @param string $IE Inscrição Estadual |
919
|
|
|
* @param string $xNome Razão Social ou Nome |
920
|
|
|
* @param string $xFant Nome Fantasia |
921
|
|
|
* @param string $fone Telefone |
922
|
|
|
* @param string $email Endereço de email |
923
|
|
|
* |
924
|
|
|
* @return \DOMElement |
925
|
|
|
*/ |
926
|
|
|
public function toma4Tag( |
927
|
|
|
$toma = '', |
928
|
|
|
$CNPJ = '', |
929
|
|
|
$CPF = '', |
930
|
|
|
$IE = '', |
931
|
|
|
$xNome = '', |
932
|
|
|
$xFant = '', |
933
|
|
|
$fone = '', |
934
|
|
|
$email = '' |
935
|
|
|
) { |
936
|
|
|
$identificador = '#37 <toma4> - '; |
937
|
|
|
$this->toma4 = $this->dom->createElement('toma4'); |
938
|
|
|
$this->dom->addChild( |
939
|
|
|
$this->toma4, |
940
|
|
|
'toma', |
941
|
|
|
$toma, |
942
|
|
|
true, |
943
|
|
|
$identificador . 'Tomador do Serviço' |
944
|
|
|
); |
945
|
|
|
if ($CNPJ != '') { |
946
|
|
|
$this->dom->addChild( |
947
|
|
|
$this->toma4, |
948
|
|
|
'CNPJ', |
949
|
|
|
$CNPJ, |
950
|
|
|
true, |
951
|
|
|
$identificador . 'Número do CNPJ' |
952
|
|
|
); |
953
|
|
|
} elseif ($CPF != '') { |
954
|
|
|
$this->dom->addChild( |
955
|
|
|
$this->toma4, |
956
|
|
|
'CPF', |
957
|
|
|
$CPF, |
958
|
|
|
true, |
959
|
|
|
$identificador . 'Número do CPF' |
960
|
|
|
); |
961
|
|
|
} else { |
962
|
|
|
$this->dom->addChild( |
963
|
|
|
$this->toma4, |
964
|
|
|
'CNPJ', |
965
|
|
|
$CNPJ, |
966
|
|
|
true, |
967
|
|
|
$identificador . 'Número do CNPJ' |
968
|
|
|
); |
969
|
|
|
$this->dom->addChild( |
970
|
|
|
$this->toma4, |
971
|
|
|
'CPF', |
972
|
|
|
$CPF, |
973
|
|
|
true, |
974
|
|
|
$identificador . 'Número do CPF' |
975
|
|
|
); |
976
|
|
|
} |
977
|
|
|
$this->dom->addChild( |
978
|
|
|
$this->toma4, |
979
|
|
|
'IE', |
980
|
|
|
$IE, |
981
|
|
|
false, |
982
|
|
|
$identificador . 'Inscrição Estadual' |
983
|
|
|
); |
984
|
|
|
$this->dom->addChild( |
985
|
|
|
$this->toma4, |
986
|
|
|
'xNome', |
987
|
|
|
$xNome, |
988
|
|
|
true, |
989
|
|
|
$identificador . 'Razão Social ou Nome' |
990
|
|
|
); |
991
|
|
|
$this->dom->addChild( |
992
|
|
|
$this->toma4, |
993
|
|
|
'xFant', |
994
|
|
|
$xFant, |
995
|
|
|
false, |
996
|
|
|
$identificador . 'Nome Fantasia' |
997
|
|
|
); |
998
|
|
|
$this->dom->addChild( |
999
|
|
|
$this->toma4, |
1000
|
|
|
'fone', |
1001
|
|
|
$fone, |
1002
|
|
|
false, |
1003
|
|
|
$identificador . 'Telefone' |
1004
|
|
|
); |
1005
|
|
|
$this->dom->addChild( |
1006
|
|
|
$this->toma4, |
1007
|
|
|
'email', |
1008
|
|
|
$email, |
1009
|
|
|
false, |
1010
|
|
|
$identificador . 'Endereço de email' |
1011
|
|
|
); |
1012
|
|
|
return $this->toma4; |
1013
|
|
|
} |
1014
|
|
|
|
1015
|
|
|
/** |
1016
|
|
|
* Gera as tags para o elemento: "enderToma" (Dados do endereço) e adiciona ao grupo "toma4" |
1017
|
|
|
* #45 |
1018
|
|
|
* Nível: 3 |
1019
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "enderToma" |
1020
|
|
|
* do tipo elemento (Ele = E|CE|A) e nível 4 |
1021
|
|
|
* |
1022
|
|
|
* @param string $xLgr Logradouro |
1023
|
|
|
* @param string $nro Número |
1024
|
|
|
* @param string $xCpl Complemento |
1025
|
|
|
* @param string $xBairro Bairro |
1026
|
|
|
* @param string $cMun Código do município (utilizar a tabela do IBGE) |
1027
|
|
|
* @param string $xMun Nome do município |
1028
|
|
|
* @param string $CEP CEP |
1029
|
|
|
* @param string $UF Sigla da UF |
1030
|
|
|
* @param string $cPais Código do país |
1031
|
|
|
* @param string $xPais Nome do país |
1032
|
|
|
* |
1033
|
|
|
* @return \DOMElement |
1034
|
|
|
*/ |
1035
|
|
|
public function enderTomaTag( |
1036
|
|
|
$xLgr = '', |
1037
|
|
|
$nro = '', |
1038
|
|
|
$xCpl = '', |
1039
|
|
|
$xBairro = '', |
1040
|
|
|
$cMun = '', |
1041
|
|
|
$xMun = '', |
1042
|
|
|
$CEP = '', |
1043
|
|
|
$UF = '', |
1044
|
|
|
$cPais = '', |
1045
|
|
|
$xPais = '' |
1046
|
|
|
) { |
1047
|
|
|
$identificador = '#45 <enderToma> - '; |
1048
|
|
|
$this->enderToma = $this->dom->createElement('enderToma'); |
1049
|
|
|
$this->dom->addChild( |
1050
|
|
|
$this->enderToma, |
1051
|
|
|
'xLgr', |
1052
|
|
|
$xLgr, |
1053
|
|
|
true, |
1054
|
|
|
$identificador . 'Logradouro' |
1055
|
|
|
); |
1056
|
|
|
$this->dom->addChild( |
1057
|
|
|
$this->enderToma, |
1058
|
|
|
'nro', |
1059
|
|
|
$nro, |
1060
|
|
|
true, |
1061
|
|
|
$identificador . 'Número' |
1062
|
|
|
); |
1063
|
|
|
$this->dom->addChild( |
1064
|
|
|
$this->enderToma, |
1065
|
|
|
'xCpl', |
1066
|
|
|
$xCpl, |
1067
|
|
|
false, |
1068
|
|
|
$identificador . 'Complemento' |
1069
|
|
|
); |
1070
|
|
|
$this->dom->addChild( |
1071
|
|
|
$this->enderToma, |
1072
|
|
|
'xBairro', |
1073
|
|
|
$xBairro, |
1074
|
|
|
true, |
1075
|
|
|
$identificador . 'Bairro' |
1076
|
|
|
); |
1077
|
|
|
$this->dom->addChild( |
1078
|
|
|
$this->enderToma, |
1079
|
|
|
'cMun', |
1080
|
|
|
$cMun, |
1081
|
|
|
true, |
1082
|
|
|
$identificador . 'Código do município (utilizar a tabela do IBGE)' |
1083
|
|
|
); |
1084
|
|
|
$this->dom->addChild( |
1085
|
|
|
$this->enderToma, |
1086
|
|
|
'xMun', |
1087
|
|
|
$xMun, |
1088
|
|
|
true, |
1089
|
|
|
$identificador . 'Nome do município' |
1090
|
|
|
); |
1091
|
|
|
$this->dom->addChild( |
1092
|
|
|
$this->enderToma, |
1093
|
|
|
'CEP', |
1094
|
|
|
$CEP, |
1095
|
|
|
false, |
1096
|
|
|
$identificador . 'CEP' |
1097
|
|
|
); |
1098
|
|
|
$this->dom->addChild( |
1099
|
|
|
$this->enderToma, |
1100
|
|
|
'UF', |
1101
|
|
|
$UF, |
1102
|
|
|
true, |
1103
|
|
|
$identificador . 'Sigla da UF' |
1104
|
|
|
); |
1105
|
|
|
$this->dom->addChild( |
1106
|
|
|
$this->enderToma, |
1107
|
|
|
'cPais', |
1108
|
|
|
$cPais, |
1109
|
|
|
false, |
1110
|
|
|
$identificador . 'Código do país' |
1111
|
|
|
); |
1112
|
|
|
$this->dom->addChild( |
1113
|
|
|
$this->enderToma, |
1114
|
|
|
'xPais', |
1115
|
|
|
$xPais, |
1116
|
|
|
false, |
1117
|
|
|
$identificador . 'Nome do país' |
1118
|
|
|
); |
1119
|
|
|
return $this->enderToma; |
1120
|
|
|
} |
1121
|
|
|
|
1122
|
|
|
/** |
1123
|
|
|
* Gera as tags para o elemento: "compl" (Dados complementares do CT-e para fins operacionais ou comerciais) |
1124
|
|
|
* #59 |
1125
|
|
|
* Nível: 1 |
1126
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "compl" do |
1127
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
1128
|
|
|
* |
1129
|
|
|
* @param string $xCaracAd Característica adicional do transporte |
1130
|
|
|
* @param string $xCaracSer Característica adicional do serviço |
1131
|
|
|
* @param string $xEmi Funcionário emissor do CTe |
1132
|
|
|
* @param string $origCalc Município de origem para efeito de cálculo do frete |
1133
|
|
|
* @param string $destCalc Município de destino para efeito de cálculo do frete |
1134
|
|
|
* @param string $xObs Observações Gerais |
1135
|
|
|
* |
1136
|
|
|
* @return \DOMElement |
1137
|
|
|
*/ |
1138
|
|
|
public function complTag($xCaracAd = '', $xCaracSer = '', $xEmi = '', $origCalc = '', $destCalc = '', $xObs = '') |
1139
|
|
|
{ |
1140
|
|
|
$identificador = '#59 <compl> - '; |
1141
|
|
|
$this->compl = $this->dom->createElement('compl'); |
1142
|
|
|
$this->dom->addChild( |
1143
|
|
|
$this->compl, |
1144
|
|
|
'xCaracAd', |
1145
|
|
|
$xCaracAd, |
1146
|
|
|
false, |
1147
|
|
|
$identificador . 'Característica adicional do transporte' |
1148
|
|
|
); |
1149
|
|
|
$this->dom->addChild( |
1150
|
|
|
$this->compl, |
1151
|
|
|
'xCaracSer', |
1152
|
|
|
$xCaracSer, |
1153
|
|
|
false, |
1154
|
|
|
$identificador . 'Característica adicional do serviço' |
1155
|
|
|
); |
1156
|
|
|
$this->dom->addChild( |
1157
|
|
|
$this->compl, |
1158
|
|
|
'xEmi', |
1159
|
|
|
$xEmi, |
1160
|
|
|
false, |
1161
|
|
|
$identificador . 'Funcionário emissor do CTe' |
1162
|
|
|
); |
1163
|
|
|
$this->dom->addChild( |
1164
|
|
|
$this->compl, |
1165
|
|
|
'origCalc', |
1166
|
|
|
$origCalc, |
1167
|
|
|
false, |
1168
|
|
|
$identificador . 'Município de origem para efeito de cálculo do frete' |
1169
|
|
|
); |
1170
|
|
|
$this->dom->addChild( |
1171
|
|
|
$this->compl, |
1172
|
|
|
'destCalc', |
1173
|
|
|
$destCalc, |
1174
|
|
|
false, |
1175
|
|
|
$identificador . 'Município de destino para efeito de cálculo do frete' |
1176
|
|
|
); |
1177
|
|
|
$this->dom->addChild( |
1178
|
|
|
$this->compl, |
1179
|
|
|
'xObs', |
1180
|
|
|
$xObs, |
1181
|
|
|
false, |
1182
|
|
|
$identificador . 'Observações Gerais' |
1183
|
|
|
); |
1184
|
|
|
return $this->compl; |
1185
|
|
|
} |
1186
|
|
|
|
1187
|
|
|
/** |
1188
|
|
|
* Gera as tags para o elemento: "fluxo" (Previsão do fluxo da carga) |
1189
|
|
|
* #63 |
1190
|
|
|
* Nível: 2 |
1191
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "fluxo" do |
1192
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
1193
|
|
|
* |
1194
|
|
|
* @param string $xOrig Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem |
1195
|
|
|
* @param string $xDest Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino |
1196
|
|
|
* @param string $xRota Código da Rota de Entrega |
1197
|
|
|
* |
1198
|
|
|
* @return \DOMElement |
1199
|
|
|
*/ |
1200
|
|
|
public function fluxoTag($xOrig = '', $xDest = '', $xRota = '') |
1201
|
|
|
{ |
1202
|
|
|
$identificador = '#63 <fluxo> - '; |
1203
|
|
|
$this->fluxo = $this->dom->createElement('fluxo'); |
1204
|
|
|
$this->dom->addChild( |
1205
|
|
|
$this->fluxo, |
1206
|
|
|
'xOrig', |
1207
|
|
|
$xOrig, |
1208
|
|
|
false, |
1209
|
|
|
$identificador . 'Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem' |
1210
|
|
|
); |
1211
|
|
|
$this->dom->addChild( |
1212
|
|
|
$this->fluxo, |
1213
|
|
|
'xDest', |
1214
|
|
|
$xDest, |
1215
|
|
|
false, |
1216
|
|
|
$identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino' |
1217
|
|
|
); |
1218
|
|
|
$this->dom->addChild( |
1219
|
|
|
$this->fluxo, |
1220
|
|
|
'xRota', |
1221
|
|
|
$xRota, |
1222
|
|
|
false, |
1223
|
|
|
$identificador . 'Código da Rota de Entrega' |
1224
|
|
|
); |
1225
|
|
|
return $this->fluxo; |
1226
|
|
|
} |
1227
|
|
|
|
1228
|
|
|
/** |
1229
|
|
|
* Gera as tags para o elemento: "pass" |
1230
|
|
|
* #65 |
1231
|
|
|
* Nível: 3 |
1232
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "pass" do |
1233
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 4 |
1234
|
|
|
* |
1235
|
|
|
* @param string $xPass Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem |
1236
|
|
|
* |
1237
|
|
|
* @return \DOMElement |
1238
|
|
|
*/ |
1239
|
|
|
public function passTag($xPass = '') |
1240
|
|
|
{ |
1241
|
|
|
$identificador = '#65 <pass> - '; |
1242
|
|
|
$this->pass[] = $this->dom->createElement('pass'); |
1243
|
|
|
$posicao = (integer) count($this->pass) - 1; |
1244
|
|
|
$this->dom->addChild( |
1245
|
|
|
$this->pass[$posicao], |
1246
|
|
|
'xPass', |
1247
|
|
|
$xPass, |
1248
|
|
|
false, |
1249
|
|
|
$identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem' |
1250
|
|
|
); |
1251
|
|
|
return $this->pass[$posicao]; |
1252
|
|
|
} |
1253
|
|
|
|
1254
|
|
|
/** |
1255
|
|
|
* Gera as tags para o elemento: "semData" (Entrega sem data definida) |
1256
|
|
|
* #70 |
1257
|
|
|
* Nível: 3 |
1258
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "semData" do |
1259
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 4 |
1260
|
|
|
* |
1261
|
|
|
* @param string $tpPer Tipo de data/período programado para entrega |
1262
|
|
|
* |
1263
|
|
|
* @return \DOMElement |
1264
|
|
|
*/ |
1265
|
|
|
public function semDataTag($tpPer = '') |
1266
|
|
|
{ |
1267
|
|
|
$identificador = '#70 <semData> - '; |
1268
|
|
|
$this->semData = $this->dom->createElement('semData'); |
1269
|
|
|
$this->dom->addChild( |
1270
|
|
|
$this->semData, |
1271
|
|
|
'tpPer', |
1272
|
|
|
$tpPer, |
1273
|
|
|
true, |
1274
|
|
|
$identificador . 'Tipo de data/período programado para entrega' |
1275
|
|
|
); |
1276
|
|
|
return $this->semData; |
1277
|
|
|
} |
1278
|
|
|
|
1279
|
|
|
/** |
1280
|
|
|
* Gera as tags para o elemento: "comData" (Entrega com data definida) |
1281
|
|
|
* #72 |
1282
|
|
|
* Nível: 3 |
1283
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "comData" do |
1284
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 4 |
1285
|
|
|
* |
1286
|
|
|
* @param string $tpPer Tipo de data/período programado para entrega |
1287
|
|
|
* @param string $dProg Data programada |
1288
|
|
|
* |
1289
|
|
|
* @return \DOMElement |
1290
|
|
|
*/ |
1291
|
|
|
public function comDataTag($tpPer = '', $dProg = '') |
1292
|
|
|
{ |
1293
|
|
|
$identificador = '#72 <comData> - '; |
1294
|
|
|
$this->comData = $this->dom->createElement('comData'); |
1295
|
|
|
$this->dom->addChild( |
1296
|
|
|
$this->comData, |
1297
|
|
|
'tpPer', |
1298
|
|
|
$tpPer, |
1299
|
|
|
true, |
1300
|
|
|
$identificador . 'Tipo de data/período programado para entrega' |
1301
|
|
|
); |
1302
|
|
|
$this->dom->addChild( |
1303
|
|
|
$this->comData, |
1304
|
|
|
'dProg', |
1305
|
|
|
$dProg, |
1306
|
|
|
true, |
1307
|
|
|
$identificador . 'Data programada' |
1308
|
|
|
); |
1309
|
|
|
return $this->comData; |
1310
|
|
|
} |
1311
|
|
|
|
1312
|
|
|
/** |
1313
|
|
|
* Gera as tags para o elemento: "noPeriodo" (Entrega no período definido) |
1314
|
|
|
* #75 |
1315
|
|
|
* Nível: 3 |
1316
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "noPeriodo" do tipo |
1317
|
|
|
* elemento (Ele = E|CE|A) e nível 4 |
1318
|
|
|
* |
1319
|
|
|
* @param string $tpPer Tipo de data/período programado para entrega |
1320
|
|
|
* @param string $dIni Data inicial |
1321
|
|
|
* @param string $dFim Data final |
1322
|
|
|
* |
1323
|
|
|
* @return \DOMElement |
1324
|
|
|
*/ |
1325
|
|
View Code Duplication |
public function noPeriodoTag($tpPer = '', $dIni = '', $dFim = '') |
|
|
|
|
1326
|
|
|
{ |
1327
|
|
|
$identificador = '#75 <noPeriodo> - '; |
1328
|
|
|
$this->noPeriodo = $this->dom->createElement('noPeriodo'); |
1329
|
|
|
$this->dom->addChild( |
1330
|
|
|
$this->noPeriodo, |
1331
|
|
|
'tpPer', |
1332
|
|
|
$tpPer, |
1333
|
|
|
true, |
1334
|
|
|
$identificador . 'Tipo de data/período programado para entrega' |
1335
|
|
|
); |
1336
|
|
|
$this->dom->addChild( |
1337
|
|
|
$this->noPeriodo, |
1338
|
|
|
'dIni', |
1339
|
|
|
$dIni, |
1340
|
|
|
true, |
1341
|
|
|
$identificador . 'Data inicial' |
1342
|
|
|
); |
1343
|
|
|
$this->dom->addChild( |
1344
|
|
|
$this->noPeriodo, |
1345
|
|
|
'dFim', |
1346
|
|
|
$dFim, |
1347
|
|
|
true, |
1348
|
|
|
$identificador . 'Data final' |
1349
|
|
|
); |
1350
|
|
|
return $this->noPeriodo; |
1351
|
|
|
} |
1352
|
|
|
|
1353
|
|
|
/** |
1354
|
|
|
* Gera as tags para o elemento: "semHora" (Entrega sem hora definida) |
1355
|
|
|
* #79 |
1356
|
|
|
* Nível: 3 |
1357
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "semHora" do |
1358
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 4 |
1359
|
|
|
* |
1360
|
|
|
* @param string $tpHor Tipo de hora |
1361
|
|
|
* |
1362
|
|
|
* @return \DOMElement |
1363
|
|
|
*/ |
1364
|
|
|
public function semHoraTag($tpHor = '') |
1365
|
|
|
{ |
1366
|
|
|
$identificador = '#79 <semHora> - '; |
1367
|
|
|
$this->semHora = $this->dom->createElement('semHora'); |
1368
|
|
|
$this->dom->addChild( |
1369
|
|
|
$this->semHora, |
1370
|
|
|
'tpHor', |
1371
|
|
|
$tpHor, |
1372
|
|
|
true, |
1373
|
|
|
$identificador . 'Tipo de hora' |
1374
|
|
|
); |
1375
|
|
|
return $this->semHora; |
1376
|
|
|
} |
1377
|
|
|
|
1378
|
|
|
/** |
1379
|
|
|
* Gera as tags para o elemento: "comHora" (Entrega sem hora definida) |
1380
|
|
|
* # = 81 |
1381
|
|
|
* Nível = 3 |
1382
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "comHora" do |
1383
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 4 |
1384
|
|
|
* |
1385
|
|
|
* @param string $tpHor Tipo de hora |
1386
|
|
|
* @param string $hProg Hora programada |
1387
|
|
|
* |
1388
|
|
|
* @return \DOMElement |
1389
|
|
|
*/ |
1390
|
|
|
public function comHoraTag($tpHor = '', $hProg = '') |
1391
|
|
|
{ |
1392
|
|
|
$identificador = '#81 <comHora> - '; |
1393
|
|
|
$this->comHora = $this->dom->createElement('comHora'); |
1394
|
|
|
$this->dom->addChild( |
1395
|
|
|
$this->comHora, |
1396
|
|
|
'tpHor', |
1397
|
|
|
$tpHor, |
1398
|
|
|
true, |
1399
|
|
|
$identificador . 'Tipo de hora' |
1400
|
|
|
); |
1401
|
|
|
$this->dom->addChild( |
1402
|
|
|
$this->comHora, |
1403
|
|
|
'hProg', |
1404
|
|
|
$hProg, |
1405
|
|
|
true, |
1406
|
|
|
$identificador . 'Hora programada' |
1407
|
|
|
); |
1408
|
|
|
return $this->comHora; |
1409
|
|
|
} |
1410
|
|
|
|
1411
|
|
|
/** |
1412
|
|
|
* Gera as tags para o elemento: "noInter" (Entrega no intervalo de horário definido) |
1413
|
|
|
* #84 |
1414
|
|
|
* Nível: 3 |
1415
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "noInter" do |
1416
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 4 |
1417
|
|
|
* |
1418
|
|
|
* @param string $tpHor Tipo de hora |
1419
|
|
|
* @param string $hIni Hora inicial |
1420
|
|
|
* @param string $hFim Hora final |
1421
|
|
|
* |
1422
|
|
|
* @return \DOMElement |
1423
|
|
|
*/ |
1424
|
|
View Code Duplication |
public function noInterTag($tpHor = '', $hIni = '', $hFim = '') |
|
|
|
|
1425
|
|
|
{ |
1426
|
|
|
$identificador = '#84 <noInter> - '; |
1427
|
|
|
$this->noInter = $this->dom->createElement('noInter'); |
1428
|
|
|
$this->dom->addChild( |
1429
|
|
|
$this->noInter, |
1430
|
|
|
'tpHor', |
1431
|
|
|
$tpHor, |
1432
|
|
|
true, |
1433
|
|
|
$identificador . 'Tipo de hora' |
1434
|
|
|
); |
1435
|
|
|
$this->dom->addChild( |
1436
|
|
|
$this->noInter, |
1437
|
|
|
'hIni', |
1438
|
|
|
$hIni, |
1439
|
|
|
true, |
1440
|
|
|
$identificador . 'Hora inicial' |
1441
|
|
|
); |
1442
|
|
|
$this->dom->addChild( |
1443
|
|
|
$this->noInter, |
1444
|
|
|
'hFim', |
1445
|
|
|
$hFim, |
1446
|
|
|
true, |
1447
|
|
|
$identificador . 'Hora final' |
1448
|
|
|
); |
1449
|
|
|
return $this->noInter; |
1450
|
|
|
} |
1451
|
|
|
|
1452
|
|
|
/** |
1453
|
|
|
* Gera as tags para o elemento: "ObsCont" (Campo de uso livre do contribuinte) |
1454
|
|
|
* #91 |
1455
|
|
|
* Nível: 2 |
1456
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "ObsCont" do |
1457
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
1458
|
|
|
* |
1459
|
|
|
* @param string $xCampo Identificação do campo |
1460
|
|
|
* @param string $xTexto Conteúdo do campo |
1461
|
|
|
* |
1462
|
|
|
* @return boolean |
1463
|
|
|
*/ |
1464
|
|
View Code Duplication |
public function obsContTag($xCampo = '', $xTexto = '') |
|
|
|
|
1465
|
|
|
{ |
1466
|
|
|
$identificador = '#91 <ObsCont> - '; |
1467
|
|
|
$posicao = (integer) count($this->obsCont) - 1; |
1468
|
|
|
if (count($this->obsCont) <= 10) { |
1469
|
|
|
$this->obsCont[] = $this->dom->createElement('ObsCont'); |
1470
|
|
|
$this->obsCont[$posicao]->setAttribute('xCampo', $xCampo); |
1471
|
|
|
$this->dom->addChild( |
1472
|
|
|
$this->obsCont[$posicao], |
1473
|
|
|
'xTexto', |
1474
|
|
|
$xTexto, |
1475
|
|
|
true, |
1476
|
|
|
$identificador . 'Conteúdo do campo' |
1477
|
|
|
); |
1478
|
|
|
return true; |
1479
|
|
|
} |
1480
|
|
|
$this->erros[] = array( |
1481
|
|
|
'tag' => (string) '<ObsCont>', |
1482
|
|
|
'desc' => (string) 'Campo de uso livre do contribuinte', |
1483
|
|
|
'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
1484
|
|
|
); |
1485
|
|
|
return false; |
1486
|
|
|
} |
1487
|
|
|
|
1488
|
|
|
/** |
1489
|
|
|
* Gera as tags para o elemento: "ObsFisco" (Campo de uso livre do contribuinte) |
1490
|
|
|
* #94 |
1491
|
|
|
* Nível: 2 |
1492
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "ObsFisco" do tipo |
1493
|
|
|
* elemento (Ele = E|CE|A) e nível 3 |
1494
|
|
|
* |
1495
|
|
|
* @param string $xCampo Identificação do campo |
1496
|
|
|
* @param string $xTexto Conteúdo do campo |
1497
|
|
|
* |
1498
|
|
|
* @return boolean |
1499
|
|
|
*/ |
1500
|
|
View Code Duplication |
public function obsFiscoTag($xCampo = '', $xTexto = '') |
|
|
|
|
1501
|
|
|
{ |
1502
|
|
|
$identificador = '#94 <ObsFisco> - '; |
1503
|
|
|
$posicao = (integer) count($this->obsFisco) - 1; |
1504
|
|
|
if (count($this->obsFisco) <= 10) { |
1505
|
|
|
$this->obsFisco[] = $this->dom->createElement('obsFisco'); |
1506
|
|
|
$this->obsFisco[$posicao]->setAttribute('xCampo', $xCampo); |
1507
|
|
|
$this->dom->addChild( |
1508
|
|
|
$this->obsFisco[$posicao], |
1509
|
|
|
'xTexto', |
1510
|
|
|
$xTexto, |
1511
|
|
|
true, |
1512
|
|
|
$identificador . 'Conteúdo do campo' |
1513
|
|
|
); |
1514
|
|
|
return true; |
1515
|
|
|
} |
1516
|
|
|
$this->erros[] = array( |
1517
|
|
|
'tag' => (string) '<ObsFisco>', |
1518
|
|
|
'desc' => (string) 'Campo de uso livre do contribuinte', |
1519
|
|
|
'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
1520
|
|
|
); |
1521
|
|
|
return false; |
1522
|
|
|
} |
1523
|
|
|
|
1524
|
|
|
/** |
1525
|
|
|
* Gera as tags para o elemento: "emit" (Identificação do Emitente do CT-e) |
1526
|
|
|
* #97 |
1527
|
|
|
* Nível: 1 |
1528
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "emit" do |
1529
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
1530
|
|
|
* |
1531
|
|
|
* @param string $CNPJ CNPJ do emitente |
1532
|
|
|
* @param string $IE Inscrição Estadual do Emitente |
1533
|
|
|
* @param string $xNome Razão social ou Nome do emitente |
1534
|
|
|
* @param string $xFant Nome fantasia |
1535
|
|
|
* |
1536
|
|
|
* @return \DOMElement |
1537
|
|
|
*/ |
1538
|
3 |
|
public function emitTag($CNPJ = '', $IE = '', $IEST = '', $xNome = '', $xFant = '') |
1539
|
|
|
{ |
1540
|
3 |
|
$identificador = '#97 <emit> - '; |
1541
|
3 |
|
$this->emit = $this->dom->createElement('emit'); |
1542
|
3 |
|
$this->dom->addChild( |
1543
|
3 |
|
$this->emit, |
1544
|
3 |
|
'CNPJ', |
1545
|
2 |
|
$CNPJ, |
1546
|
3 |
|
true, |
1547
|
1 |
|
$identificador . 'CNPJ do emitente' |
1548
|
2 |
|
); |
1549
|
3 |
|
$this->dom->addChild( |
1550
|
3 |
|
$this->emit, |
1551
|
3 |
|
'IE', |
1552
|
2 |
|
$IE, |
1553
|
3 |
|
true, |
1554
|
1 |
|
$identificador . 'Inscrição Estadual do Emitente' |
1555
|
2 |
|
); |
1556
|
3 |
|
$this->dom->addChild( |
1557
|
3 |
|
$this->emit, |
1558
|
3 |
|
'IEST', |
1559
|
2 |
|
$IEST, |
1560
|
3 |
|
false, |
1561
|
1 |
|
$identificador . 'Inscrição Estadual do Substituto Tributário' |
1562
|
2 |
|
); |
1563
|
3 |
|
$this->dom->addChild( |
1564
|
3 |
|
$this->emit, |
1565
|
3 |
|
'xNome', |
1566
|
2 |
|
$xNome, |
1567
|
3 |
|
true, |
1568
|
1 |
|
$identificador . 'Razão social ou Nome do emitente' |
1569
|
2 |
|
); |
1570
|
3 |
|
$this->dom->addChild( |
1571
|
3 |
|
$this->emit, |
1572
|
3 |
|
'xFant', |
1573
|
2 |
|
$xFant, |
1574
|
3 |
|
false, |
1575
|
1 |
|
$identificador . 'Nome fantasia' |
1576
|
2 |
|
); |
1577
|
3 |
|
return $this->emit; |
1578
|
|
|
} |
1579
|
|
|
|
1580
|
|
|
/** |
1581
|
|
|
* Gera as tags para o elemento: "enderEmit" (Endereço do emitente) |
1582
|
|
|
* #102 |
1583
|
|
|
* Nível: 2 |
1584
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "enderEmit" do |
1585
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
1586
|
|
|
* |
1587
|
|
|
* @param string $xLgr Logradouro |
1588
|
|
|
* @param string $nro Número |
1589
|
|
|
* @param string $xCpl Complemento |
1590
|
|
|
* @param string $xBairro Bairro |
1591
|
|
|
* @param string $cMun Código do município (utilizar a tabela do IBGE) |
1592
|
|
|
* @param string $xMun Nome do município |
1593
|
|
|
* @param string $CEP CEP |
1594
|
|
|
* @param string $UF Sigla da UF |
1595
|
|
|
* @param string $fone Telefone |
1596
|
|
|
* |
1597
|
|
|
* @return \DOMElement |
1598
|
|
|
*/ |
1599
|
|
|
public function enderEmitTag( |
1600
|
|
|
$xLgr = '', |
1601
|
|
|
$nro = '', |
1602
|
|
|
$xCpl = '', |
1603
|
|
|
$xBairro = '', |
1604
|
|
|
$cMun = '', |
1605
|
|
|
$xMun = '', |
1606
|
|
|
$CEP = '', |
1607
|
|
|
$UF = '', |
1608
|
|
|
$fone = '' |
1609
|
|
|
) { |
1610
|
|
|
$identificador = '#102 <enderEmit> - '; |
1611
|
|
|
$this->enderEmit = $this->dom->createElement('enderEmit'); |
1612
|
|
|
$this->dom->addChild( |
1613
|
|
|
$this->enderEmit, |
1614
|
|
|
'xLgr', |
1615
|
|
|
$xLgr, |
1616
|
|
|
true, |
1617
|
|
|
$identificador . 'Logradouro' |
1618
|
|
|
); |
1619
|
|
|
$this->dom->addChild( |
1620
|
|
|
$this->enderEmit, |
1621
|
|
|
'nro', |
1622
|
|
|
$nro, |
1623
|
|
|
true, |
1624
|
|
|
$identificador . 'Número' |
1625
|
|
|
); |
1626
|
|
|
$this->dom->addChild( |
1627
|
|
|
$this->enderEmit, |
1628
|
|
|
'xCpl', |
1629
|
|
|
$xCpl, |
1630
|
|
|
false, |
1631
|
|
|
$identificador . 'Complemento' |
1632
|
|
|
); |
1633
|
|
|
$this->dom->addChild( |
1634
|
|
|
$this->enderEmit, |
1635
|
|
|
'xBairro', |
1636
|
|
|
$xBairro, |
1637
|
|
|
true, |
1638
|
|
|
$identificador . 'Bairro' |
1639
|
|
|
); |
1640
|
|
|
$this->dom->addChild( |
1641
|
|
|
$this->enderEmit, |
1642
|
|
|
'cMun', |
1643
|
|
|
$cMun, |
1644
|
|
|
true, |
1645
|
|
|
$identificador . 'Código do município' |
1646
|
|
|
); |
1647
|
|
|
$this->dom->addChild( |
1648
|
|
|
$this->enderEmit, |
1649
|
|
|
'xMun', |
1650
|
|
|
$xMun, |
1651
|
|
|
true, |
1652
|
|
|
$identificador . 'Nome do município' |
1653
|
|
|
); |
1654
|
|
|
$this->dom->addChild( |
1655
|
|
|
$this->enderEmit, |
1656
|
|
|
'CEP', |
1657
|
|
|
$CEP, |
1658
|
|
|
false, |
1659
|
|
|
$identificador . 'CEP' |
1660
|
|
|
); |
1661
|
|
|
$this->dom->addChild( |
1662
|
|
|
$this->enderEmit, |
1663
|
|
|
'UF', |
1664
|
|
|
$UF, |
1665
|
|
|
true, |
1666
|
|
|
$identificador . 'Sigla da UF' |
1667
|
|
|
); |
1668
|
|
|
$this->dom->addChild( |
1669
|
|
|
$this->enderEmit, |
1670
|
|
|
'fone', |
1671
|
|
|
$fone, |
1672
|
|
|
false, |
1673
|
|
|
$identificador . 'Telefone' |
1674
|
|
|
); |
1675
|
|
|
return $this->enderEmit; |
1676
|
|
|
} |
1677
|
|
|
|
1678
|
|
|
/** |
1679
|
|
|
* Gera as tags para o elemento: "rem" (Informações do Remetente das mercadorias |
1680
|
|
|
* transportadas pelo CT-e) |
1681
|
|
|
* #112 |
1682
|
|
|
* Nível = 1 |
1683
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "rem" do |
1684
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
1685
|
|
|
* |
1686
|
|
|
* @param string $CNPJ Número do CNPJ |
1687
|
|
|
* @param string $CPF Número do CPF |
1688
|
|
|
* @param string $IE Inscrição Estadual |
1689
|
|
|
* @param string $xNome Razão social ou nome do remetente |
1690
|
|
|
* @param string $xFant Nome fantasia |
1691
|
|
|
* @param string $fone Telefone |
1692
|
|
|
* @param string $email Endereço de email |
1693
|
|
|
* |
1694
|
|
|
* @return \DOMElement |
1695
|
|
|
*/ |
1696
|
|
View Code Duplication |
public function remTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $xFant = '', $fone = '', $email = '') |
|
|
|
|
1697
|
|
|
{ |
1698
|
|
|
$identificador = '#97 <rem> - '; |
1699
|
|
|
$this->rem = $this->dom->createElement('rem'); |
1700
|
|
|
if ($CNPJ != '') { |
1701
|
|
|
$this->dom->addChild( |
1702
|
|
|
$this->rem, |
1703
|
|
|
'CNPJ', |
1704
|
|
|
$CNPJ, |
1705
|
|
|
true, |
1706
|
|
|
$identificador . 'CNPJ do Remente' |
1707
|
|
|
); |
1708
|
|
|
} elseif ($CPF != '') { |
1709
|
|
|
$this->dom->addChild( |
1710
|
|
|
$this->rem, |
1711
|
|
|
'CPF', |
1712
|
|
|
$CPF, |
1713
|
|
|
true, |
1714
|
|
|
$identificador . 'CPF do Remente' |
1715
|
|
|
); |
1716
|
|
|
} else { |
1717
|
|
|
$this->dom->addChild( |
1718
|
|
|
$this->rem, |
1719
|
|
|
'CNPJ', |
1720
|
|
|
$CNPJ, |
1721
|
|
|
true, |
1722
|
|
|
$identificador . 'CNPJ do Remente' |
1723
|
|
|
); |
1724
|
|
|
$this->dom->addChild( |
1725
|
|
|
$this->rem, |
1726
|
|
|
'CPF', |
1727
|
|
|
$CPF, |
1728
|
|
|
true, |
1729
|
|
|
$identificador . 'CPF do remente' |
1730
|
|
|
); |
1731
|
|
|
} |
1732
|
|
|
$this->dom->addChild( |
1733
|
|
|
$this->rem, |
1734
|
|
|
'IE', |
1735
|
|
|
$IE, |
1736
|
|
|
true, |
1737
|
|
|
$identificador . 'Inscrição Estadual do remente' |
1738
|
|
|
); |
1739
|
|
|
$this->dom->addChild( |
1740
|
|
|
$this->rem, |
1741
|
|
|
'xNome', |
1742
|
|
|
$xNome, |
1743
|
|
|
true, |
1744
|
|
|
$identificador . 'Razão social ou Nome do remente' |
1745
|
|
|
); |
1746
|
|
|
$this->dom->addChild( |
1747
|
|
|
$this->rem, |
1748
|
|
|
'xFant', |
1749
|
|
|
$xFant, |
1750
|
|
|
false, |
1751
|
|
|
$identificador . 'Nome fantasia' |
1752
|
|
|
); |
1753
|
|
|
$this->dom->addChild( |
1754
|
|
|
$this->rem, |
1755
|
|
|
'fone', |
1756
|
|
|
$fone, |
1757
|
|
|
false, |
1758
|
|
|
$identificador . 'Telefone' |
1759
|
|
|
); |
1760
|
|
|
$this->dom->addChild( |
1761
|
|
|
$this->rem, |
1762
|
|
|
'email', |
1763
|
|
|
$email, |
1764
|
|
|
false, |
1765
|
|
|
$identificador . 'Endereço de email' |
1766
|
|
|
); |
1767
|
|
|
return $this->rem; |
1768
|
|
|
} |
1769
|
|
|
|
1770
|
|
|
/** |
1771
|
|
|
* Gera as tags para o elemento: "enderReme" (Dados do endereço) |
1772
|
|
|
* #119 |
1773
|
|
|
* Nível: 2 |
1774
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "enderReme" do |
1775
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
1776
|
|
|
* |
1777
|
|
|
* @param string $xLgr Logradouro |
1778
|
|
|
* @param string $nro Número |
1779
|
|
|
* @param string $xCpl Complemento |
1780
|
|
|
* @param string $xBairro Bairro |
1781
|
|
|
* @param string $cMun Código do município (utilizar a tabela do IBGE) |
1782
|
|
|
* @param string $xMun Nome do município |
1783
|
|
|
* @param string $CEP CEP |
1784
|
|
|
* @param string $UF Sigla da UF |
1785
|
|
|
* @param string $cPais Código do país |
1786
|
|
|
* @param string $xPais Nome do país |
1787
|
|
|
* |
1788
|
|
|
* @return \DOMElement |
1789
|
|
|
*/ |
1790
|
|
View Code Duplication |
public function enderRemeTag( |
|
|
|
|
1791
|
|
|
$xLgr = '', |
1792
|
|
|
$nro = '', |
1793
|
|
|
$xCpl = '', |
1794
|
|
|
$xBairro = '', |
1795
|
|
|
$cMun = '', |
1796
|
|
|
$xMun = '', |
1797
|
|
|
$CEP = '', |
1798
|
|
|
$UF = '', |
1799
|
|
|
$cPais = '', |
1800
|
|
|
$xPais = '' |
1801
|
|
|
) { |
1802
|
|
|
$identificador = '#119 <enderReme> - '; |
1803
|
|
|
$this->enderReme = $this->dom->createElement('enderReme'); |
1804
|
|
|
$this->dom->addChild( |
1805
|
|
|
$this->enderReme, |
1806
|
|
|
'xLgr', |
1807
|
|
|
$xLgr, |
1808
|
|
|
true, |
1809
|
|
|
$identificador . 'Logradouro' |
1810
|
|
|
); |
1811
|
|
|
$this->dom->addChild( |
1812
|
|
|
$this->enderReme, |
1813
|
|
|
'nro', |
1814
|
|
|
$nro, |
1815
|
|
|
true, |
1816
|
|
|
$identificador . 'Número' |
1817
|
|
|
); |
1818
|
|
|
$this->dom->addChild( |
1819
|
|
|
$this->enderReme, |
1820
|
|
|
'xCpl', |
1821
|
|
|
$xCpl, |
1822
|
|
|
false, |
1823
|
|
|
$identificador . 'Complemento' |
1824
|
|
|
); |
1825
|
|
|
$this->dom->addChild( |
1826
|
|
|
$this->enderReme, |
1827
|
|
|
'xBairro', |
1828
|
|
|
$xBairro, |
1829
|
|
|
true, |
1830
|
|
|
$identificador . 'Bairro' |
1831
|
|
|
); |
1832
|
|
|
$this->dom->addChild( |
1833
|
|
|
$this->enderReme, |
1834
|
|
|
'cMun', |
1835
|
|
|
$cMun, |
1836
|
|
|
true, |
1837
|
|
|
$identificador . 'Código do município (utilizar a tabela do IBGE)' |
1838
|
|
|
); |
1839
|
|
|
$this->dom->addChild( |
1840
|
|
|
$this->enderReme, |
1841
|
|
|
'xMun', |
1842
|
|
|
$xMun, |
1843
|
|
|
true, |
1844
|
|
|
$identificador . 'Nome do município' |
1845
|
|
|
); |
1846
|
|
|
$this->dom->addChild( |
1847
|
|
|
$this->enderReme, |
1848
|
|
|
'CEP', |
1849
|
|
|
$CEP, |
1850
|
|
|
false, |
1851
|
|
|
$identificador . 'CEP' |
1852
|
|
|
); |
1853
|
|
|
$this->dom->addChild( |
1854
|
|
|
$this->enderReme, |
1855
|
|
|
'UF', |
1856
|
|
|
$UF, |
1857
|
|
|
true, |
1858
|
|
|
$identificador . 'Sigla da UF' |
1859
|
|
|
); |
1860
|
|
|
$this->dom->addChild( |
1861
|
|
|
$this->enderReme, |
1862
|
|
|
'cPais', |
1863
|
|
|
$cPais, |
1864
|
|
|
false, |
1865
|
|
|
$identificador . 'Código do país' |
1866
|
|
|
); |
1867
|
|
|
$this->dom->addChild( |
1868
|
|
|
$this->enderReme, |
1869
|
|
|
'xPais', |
1870
|
|
|
$xPais, |
1871
|
|
|
false, |
1872
|
|
|
$identificador . 'Nome do país' |
1873
|
|
|
); |
1874
|
|
|
|
1875
|
|
|
$node = $this->rem->getElementsByTagName("email")->item(0); |
1876
|
|
|
$this->rem->insertBefore($this->enderReme, $node); |
1877
|
|
|
return $this->enderReme; |
1878
|
|
|
} |
1879
|
|
|
|
1880
|
|
|
/** |
1881
|
|
|
* Gera as tags para o elemento: "exped" (Informações do Expedidor da Carga) |
1882
|
|
|
* #142 |
1883
|
|
|
* Nível: 1 |
1884
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "exped" do |
1885
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
1886
|
|
|
* |
1887
|
|
|
* @param string $CNPJ Número do CNPJ |
1888
|
|
|
* @param string $CPF Número do CPF |
1889
|
|
|
* @param string $IE Inscrição Estadual |
1890
|
|
|
* @param string $xNome Razão Social ou Nome |
1891
|
|
|
* @param string $fone Telefone |
1892
|
|
|
* @param string $email Endereço de email |
1893
|
|
|
* |
1894
|
|
|
* @return \DOMElement |
1895
|
|
|
*/ |
1896
|
|
View Code Duplication |
public function expedTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $email = '') |
|
|
|
|
1897
|
|
|
{ |
1898
|
|
|
$identificador = '#142 <exped> - '; |
1899
|
|
|
$this->exped = $this->dom->createElement('exped'); |
1900
|
|
|
if ($CNPJ != '') { |
1901
|
|
|
$this->dom->addChild( |
1902
|
|
|
$this->exped, |
1903
|
|
|
'CNPJ', |
1904
|
|
|
$CNPJ, |
1905
|
|
|
true, |
1906
|
|
|
$identificador . 'Número do CNPJ' |
1907
|
|
|
); |
1908
|
|
|
} elseif ($CPF != '') { |
1909
|
|
|
$this->dom->addChild( |
1910
|
|
|
$this->exped, |
1911
|
|
|
'CPF', |
1912
|
|
|
$CPF, |
1913
|
|
|
true, |
1914
|
|
|
$identificador . 'Número do CPF' |
1915
|
|
|
); |
1916
|
|
|
} else { |
1917
|
|
|
$this->dom->addChild( |
1918
|
|
|
$this->exped, |
1919
|
|
|
'CNPJ', |
1920
|
|
|
$CNPJ, |
1921
|
|
|
true, |
1922
|
|
|
$identificador . 'Número do CNPJ' |
1923
|
|
|
); |
1924
|
|
|
$this->dom->addChild( |
1925
|
|
|
$this->exped, |
1926
|
|
|
'CPF', |
1927
|
|
|
$CPF, |
1928
|
|
|
true, |
1929
|
|
|
$identificador . 'Número do CPF' |
1930
|
|
|
); |
1931
|
|
|
} |
1932
|
|
|
$this->dom->addChild( |
1933
|
|
|
$this->exped, |
1934
|
|
|
'IE', |
1935
|
|
|
$IE, |
1936
|
|
|
true, |
1937
|
|
|
$identificador . 'Inscrição Estadual' |
1938
|
|
|
); |
1939
|
|
|
$this->dom->addChild( |
1940
|
|
|
$this->exped, |
1941
|
|
|
'xNome', |
1942
|
|
|
$xNome, |
1943
|
|
|
true, |
1944
|
|
|
$identificador . 'Razão social ou Nome' |
1945
|
|
|
); |
1946
|
|
|
$this->dom->addChild( |
1947
|
|
|
$this->exped, |
1948
|
|
|
'fone', |
1949
|
|
|
$fone, |
1950
|
|
|
false, |
1951
|
|
|
$identificador . 'Telefone' |
1952
|
|
|
); |
1953
|
|
|
$this->dom->addChild( |
1954
|
|
|
$this->exped, |
1955
|
|
|
'email', |
1956
|
|
|
$email, |
1957
|
|
|
false, |
1958
|
|
|
$identificador . 'Endereço de email' |
1959
|
|
|
); |
1960
|
|
|
return $this->exped; |
1961
|
|
|
} |
1962
|
|
|
|
1963
|
|
|
/** |
1964
|
|
|
* Gera as tags para o elemento: "enderExped" (Dados do endereço) |
1965
|
|
|
* #148 |
1966
|
|
|
* Nível: 2 |
1967
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "enderExped" do |
1968
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
1969
|
|
|
* |
1970
|
|
|
* @param string $xLgr Logradouro |
1971
|
|
|
* @param string $nro Número |
1972
|
|
|
* @param string $xCpl Complemento |
1973
|
|
|
* @param string $xBairro Bairro |
1974
|
|
|
* @param string $cMun Código do município (utilizar a tabela do IBGE) |
1975
|
|
|
* @param string $xMun Nome do município |
1976
|
|
|
* @param string $CEP CEP |
1977
|
|
|
* @param string $UF Sigla da UF |
1978
|
|
|
* @param string $cPais Código do país |
1979
|
|
|
* @param string $xPais Nome do país |
1980
|
|
|
* |
1981
|
|
|
* @return \DOMElement |
1982
|
|
|
*/ |
1983
|
|
|
public function enderExpedTag( |
1984
|
|
|
$xLgr = '', |
1985
|
|
|
$nro = '', |
1986
|
|
|
$xCpl = '', |
1987
|
|
|
$xBairro = '', |
1988
|
|
|
$cMun = '', |
1989
|
|
|
$xMun = '', |
1990
|
|
|
$CEP = '', |
1991
|
|
|
$UF = '', |
1992
|
|
|
$cPais = '', |
1993
|
|
|
$xPais = '' |
1994
|
|
|
) { |
1995
|
|
|
$identificador = '#148 <enderExped> - '; |
1996
|
|
|
$this->enderExped = $this->dom->createElement('enderExped'); |
1997
|
|
|
$this->dom->addChild( |
1998
|
|
|
$this->enderExped, |
1999
|
|
|
'xLgr', |
2000
|
|
|
$xLgr, |
2001
|
|
|
true, |
2002
|
|
|
$identificador . 'Logradouro' |
2003
|
|
|
); |
2004
|
|
|
$this->dom->addChild( |
2005
|
|
|
$this->enderExped, |
2006
|
|
|
'nro', |
2007
|
|
|
$nro, |
2008
|
|
|
true, |
2009
|
|
|
$identificador . 'Número' |
2010
|
|
|
); |
2011
|
|
|
$this->dom->addChild( |
2012
|
|
|
$this->enderExped, |
2013
|
|
|
'xCpl', |
2014
|
|
|
$xCpl, |
2015
|
|
|
false, |
2016
|
|
|
$identificador . 'Complemento' |
2017
|
|
|
); |
2018
|
|
|
$this->dom->addChild( |
2019
|
|
|
$this->enderExped, |
2020
|
|
|
'xBairro', |
2021
|
|
|
$xBairro, |
2022
|
|
|
true, |
2023
|
|
|
$identificador . 'Bairro' |
2024
|
|
|
); |
2025
|
|
|
$this->dom->addChild( |
2026
|
|
|
$this->enderExped, |
2027
|
|
|
'cMun', |
2028
|
|
|
$cMun, |
2029
|
|
|
true, |
2030
|
|
|
$identificador . 'Código do município (utilizar a tabela do IBGE)' |
2031
|
|
|
); |
2032
|
|
|
$this->dom->addChild( |
2033
|
|
|
$this->enderExped, |
2034
|
|
|
'xMun', |
2035
|
|
|
$xMun, |
2036
|
|
|
true, |
2037
|
|
|
$identificador . 'Nome do município' |
2038
|
|
|
); |
2039
|
|
|
$this->dom->addChild( |
2040
|
|
|
$this->enderExped, |
2041
|
|
|
'CEP', |
2042
|
|
|
$CEP, |
2043
|
|
|
false, |
2044
|
|
|
$identificador . 'CEP' |
2045
|
|
|
); |
2046
|
|
|
$this->dom->addChild( |
2047
|
|
|
$this->enderExped, |
2048
|
|
|
'UF', |
2049
|
|
|
$UF, |
2050
|
|
|
true, |
2051
|
|
|
$identificador . 'Sigla da UF' |
2052
|
|
|
); |
2053
|
|
|
$this->dom->addChild( |
2054
|
|
|
$this->enderExped, |
2055
|
|
|
'cPais', |
2056
|
|
|
$cPais, |
2057
|
|
|
false, |
2058
|
|
|
$identificador . 'Código do país' |
2059
|
|
|
); |
2060
|
|
|
$this->dom->addChild( |
2061
|
|
|
$this->enderExped, |
2062
|
|
|
'xPais', |
2063
|
|
|
$xPais, |
2064
|
|
|
false, |
2065
|
|
|
$identificador . 'Nome do país' |
2066
|
|
|
); |
2067
|
|
|
|
2068
|
|
|
$node = $this->exped->getElementsByTagName("email")->item(0); |
2069
|
|
|
$this->exped->insertBefore($this->enderExped, $node); |
2070
|
|
|
return $this->enderExped; |
2071
|
|
|
} |
2072
|
|
|
|
2073
|
|
|
/** |
2074
|
|
|
* Gera as tags para o elemento: "receb" (Informações do Recebedor da Carga) |
2075
|
|
|
* #160 |
2076
|
|
|
* Nível: 1 |
2077
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "receb" do |
2078
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
2079
|
|
|
* |
2080
|
|
|
* @param string $CNPJ Número do CNPJ |
2081
|
|
|
* @param string $CPF Número do CPF |
2082
|
|
|
* @param string $IE Inscrição Estadual |
2083
|
|
|
* @param string $xNome Razão Social ou Nome |
2084
|
|
|
* @param string $fone Telefone |
2085
|
|
|
* @param string $email Endereço de email |
2086
|
|
|
* |
2087
|
|
|
* @return \DOMElement |
2088
|
|
|
*/ |
2089
|
|
View Code Duplication |
public function recebTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $email = '') |
|
|
|
|
2090
|
|
|
{ |
2091
|
|
|
$identificador = '#160 <receb> - '; |
2092
|
|
|
$this->receb = $this->dom->createElement('receb'); |
2093
|
|
|
if ($CNPJ != '') { |
2094
|
|
|
$this->dom->addChild( |
2095
|
|
|
$this->receb, |
2096
|
|
|
'CNPJ', |
2097
|
|
|
$CNPJ, |
2098
|
|
|
true, |
2099
|
|
|
$identificador . 'Número do CNPJ' |
2100
|
|
|
); |
2101
|
|
|
} elseif ($CPF != '') { |
2102
|
|
|
$this->dom->addChild( |
2103
|
|
|
$this->receb, |
2104
|
|
|
'CPF', |
2105
|
|
|
$CPF, |
2106
|
|
|
true, |
2107
|
|
|
$identificador . 'Número do CPF' |
2108
|
|
|
); |
2109
|
|
|
} else { |
2110
|
|
|
$this->dom->addChild( |
2111
|
|
|
$this->receb, |
2112
|
|
|
'CNPJ', |
2113
|
|
|
$CNPJ, |
2114
|
|
|
true, |
2115
|
|
|
$identificador . 'Número do CNPJ' |
2116
|
|
|
); |
2117
|
|
|
$this->dom->addChild( |
2118
|
|
|
$this->receb, |
2119
|
|
|
'CPF', |
2120
|
|
|
$CPF, |
2121
|
|
|
true, |
2122
|
|
|
$identificador . 'Número do CPF' |
2123
|
|
|
); |
2124
|
|
|
} |
2125
|
|
|
$this->dom->addChild( |
2126
|
|
|
$this->receb, |
2127
|
|
|
'IE', |
2128
|
|
|
$IE, |
2129
|
|
|
true, |
2130
|
|
|
$identificador . 'Inscrição Estadual' |
2131
|
|
|
); |
2132
|
|
|
$this->dom->addChild( |
2133
|
|
|
$this->receb, |
2134
|
|
|
'xNome', |
2135
|
|
|
$xNome, |
2136
|
|
|
true, |
2137
|
|
|
$identificador . 'Razão social ou Nome' |
2138
|
|
|
); |
2139
|
|
|
$this->dom->addChild( |
2140
|
|
|
$this->receb, |
2141
|
|
|
'fone', |
2142
|
|
|
$fone, |
2143
|
|
|
false, |
2144
|
|
|
$identificador . 'Telefone' |
2145
|
|
|
); |
2146
|
|
|
$this->dom->addChild( |
2147
|
|
|
$this->receb, |
2148
|
|
|
'email', |
2149
|
|
|
$email, |
2150
|
|
|
false, |
2151
|
|
|
$identificador . 'Endereço de email' |
2152
|
|
|
); |
2153
|
|
|
return $this->receb; |
2154
|
|
|
} |
2155
|
|
|
|
2156
|
|
|
/** |
2157
|
|
|
* Gera as tags para o elemento: "enderReceb" (Informações do Recebedor da Carga) |
2158
|
|
|
* #166 |
2159
|
|
|
* Nível: 2 |
2160
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "enderReceb" do |
2161
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
2162
|
|
|
* |
2163
|
|
|
* @param string $xLgr Logradouro |
2164
|
|
|
* @param string $nro Número |
2165
|
|
|
* @param string $xCpl Complemento |
2166
|
|
|
* @param string $xBairro Bairro |
2167
|
|
|
* @param string $cMun Código do município (utilizar a tabela do IBGE) |
2168
|
|
|
* @param string $xMun Nome do município |
2169
|
|
|
* @param string $CEP CEP |
2170
|
|
|
* @param string $UF Sigla da UF |
2171
|
|
|
* @param string $cPais Código do país |
2172
|
|
|
* @param string $xPais Nome do país |
2173
|
|
|
* |
2174
|
|
|
* @return \DOMElement |
2175
|
|
|
*/ |
2176
|
|
|
public function enderRecebTag( |
2177
|
|
|
$xLgr = '', |
2178
|
|
|
$nro = '', |
2179
|
|
|
$xCpl = '', |
2180
|
|
|
$xBairro = '', |
2181
|
|
|
$cMun = '', |
2182
|
|
|
$xMun = '', |
2183
|
|
|
$CEP = '', |
2184
|
|
|
$UF = '', |
2185
|
|
|
$cPais = '', |
2186
|
|
|
$xPais = '' |
2187
|
|
|
) { |
2188
|
|
|
$identificador = '#160 <enderReceb> - '; |
2189
|
|
|
$this->enderReceb = $this->dom->createElement('enderReceb'); |
2190
|
|
|
$this->dom->addChild( |
2191
|
|
|
$this->enderReceb, |
2192
|
|
|
'xLgr', |
2193
|
|
|
$xLgr, |
2194
|
|
|
true, |
2195
|
|
|
$identificador . 'Logradouro' |
2196
|
|
|
); |
2197
|
|
|
$this->dom->addChild( |
2198
|
|
|
$this->enderReceb, |
2199
|
|
|
'nro', |
2200
|
|
|
$nro, |
2201
|
|
|
true, |
2202
|
|
|
$identificador . 'Número' |
2203
|
|
|
); |
2204
|
|
|
$this->dom->addChild( |
2205
|
|
|
$this->enderReceb, |
2206
|
|
|
'xCpl', |
2207
|
|
|
$xCpl, |
2208
|
|
|
false, |
2209
|
|
|
$identificador . 'Complemento' |
2210
|
|
|
); |
2211
|
|
|
$this->dom->addChild( |
2212
|
|
|
$this->enderReceb, |
2213
|
|
|
'xBairro', |
2214
|
|
|
$xBairro, |
2215
|
|
|
true, |
2216
|
|
|
$identificador . 'Bairro' |
2217
|
|
|
); |
2218
|
|
|
$this->dom->addChild( |
2219
|
|
|
$this->enderReceb, |
2220
|
|
|
'cMun', |
2221
|
|
|
$cMun, |
2222
|
|
|
true, |
2223
|
|
|
$identificador . 'Código do município (utilizar a tabela do IBGE)' |
2224
|
|
|
); |
2225
|
|
|
$this->dom->addChild( |
2226
|
|
|
$this->enderReceb, |
2227
|
|
|
'xMun', |
2228
|
|
|
$xMun, |
2229
|
|
|
true, |
2230
|
|
|
$identificador . 'Nome do município' |
2231
|
|
|
); |
2232
|
|
|
$this->dom->addChild( |
2233
|
|
|
$this->enderReceb, |
2234
|
|
|
'CEP', |
2235
|
|
|
$CEP, |
2236
|
|
|
false, |
2237
|
|
|
$identificador . 'CEP' |
2238
|
|
|
); |
2239
|
|
|
$this->dom->addChild( |
2240
|
|
|
$this->enderReceb, |
2241
|
|
|
'UF', |
2242
|
|
|
$UF, |
2243
|
|
|
true, |
2244
|
|
|
$identificador . 'Sigla da UF' |
2245
|
|
|
); |
2246
|
|
|
$this->dom->addChild( |
2247
|
|
|
$this->enderReceb, |
2248
|
|
|
'cPais', |
2249
|
|
|
$cPais, |
2250
|
|
|
false, |
2251
|
|
|
$identificador . 'Código do país' |
2252
|
|
|
); |
2253
|
|
|
$this->dom->addChild( |
2254
|
|
|
$this->enderReceb, |
2255
|
|
|
'xPais', |
2256
|
|
|
$xPais, |
2257
|
|
|
false, |
2258
|
|
|
$identificador . 'Nome do país' |
2259
|
|
|
); |
2260
|
|
|
|
2261
|
|
|
$node = $this->receb->getElementsByTagName("email")->item(0); |
2262
|
|
|
$this->receb->insertBefore($this->enderReceb, $node); |
2263
|
|
|
return $this->enderReceb; |
2264
|
|
|
} |
2265
|
|
|
|
2266
|
|
|
/** |
2267
|
|
|
* Gera as tags para o elemento: "dest" (Informações do Destinatário do CT-e) |
2268
|
|
|
* #178 |
2269
|
|
|
* Nível: 1 |
2270
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "dest" do |
2271
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
2272
|
|
|
* |
2273
|
|
|
* @param string $CNPJ Número do CNPJ |
2274
|
|
|
* @param string $CPF Número do CPF |
2275
|
|
|
* @param string $IE Inscrição Estadual |
2276
|
|
|
* @param string $xNome Razão Social ou Nome |
2277
|
|
|
* @param string $fone Telefone |
2278
|
|
|
* @param string $ISUF Inscrição na SUFRAMA |
2279
|
|
|
* @param string $email Endereço de email |
2280
|
|
|
* |
2281
|
|
|
* @return \DOMElement |
2282
|
|
|
*/ |
2283
|
|
View Code Duplication |
public function destTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $ISUF = '', $email = '') |
|
|
|
|
2284
|
|
|
{ |
2285
|
|
|
$identificador = '#178 <dest> - '; |
2286
|
|
|
$this->dest = $this->dom->createElement('dest'); |
2287
|
|
|
if ($CNPJ != '') { |
2288
|
|
|
$this->dom->addChild( |
2289
|
|
|
$this->dest, |
2290
|
|
|
'CNPJ', |
2291
|
|
|
$CNPJ, |
2292
|
|
|
true, |
2293
|
|
|
$identificador . 'Número do CNPJ' |
2294
|
|
|
); |
2295
|
|
|
} elseif ($CPF != '') { |
2296
|
|
|
$this->dom->addChild( |
2297
|
|
|
$this->dest, |
2298
|
|
|
'CPF', |
2299
|
|
|
$CPF, |
2300
|
|
|
true, |
2301
|
|
|
$identificador . 'Número do CPF' |
2302
|
|
|
); |
2303
|
|
|
} else { |
2304
|
|
|
$this->dom->addChild( |
2305
|
|
|
$this->dest, |
2306
|
|
|
'CNPJ', |
2307
|
|
|
$CNPJ, |
2308
|
|
|
true, |
2309
|
|
|
$identificador . 'Número do CNPJ' |
2310
|
|
|
); |
2311
|
|
|
$this->dom->addChild( |
2312
|
|
|
$this->dest, |
2313
|
|
|
'CPF', |
2314
|
|
|
$CPF, |
2315
|
|
|
true, |
2316
|
|
|
$identificador . 'Número do CPF' |
2317
|
|
|
); |
2318
|
|
|
} |
2319
|
|
|
$this->dom->addChild( |
2320
|
|
|
$this->dest, |
2321
|
|
|
'IE', |
2322
|
|
|
$IE, |
2323
|
|
|
true, |
2324
|
|
|
$identificador . 'Inscrição Estadual' |
2325
|
|
|
); |
2326
|
|
|
$this->dom->addChild( |
2327
|
|
|
$this->dest, |
2328
|
|
|
'xNome', |
2329
|
|
|
$xNome, |
2330
|
|
|
true, |
2331
|
|
|
$identificador . 'Razão social ou Nome' |
2332
|
|
|
); |
2333
|
|
|
$this->dom->addChild( |
2334
|
|
|
$this->dest, |
2335
|
|
|
'fone', |
2336
|
|
|
$fone, |
2337
|
|
|
false, |
2338
|
|
|
$identificador . 'Telefone' |
2339
|
|
|
); |
2340
|
|
|
$this->dom->addChild( |
2341
|
|
|
$this->dest, |
2342
|
|
|
'ISUF', |
2343
|
|
|
$ISUF, |
2344
|
|
|
false, |
2345
|
|
|
$identificador . 'Inscrição na SUFRAMA' |
2346
|
|
|
); |
2347
|
|
|
$this->dom->addChild( |
2348
|
|
|
$this->dest, |
2349
|
|
|
'email', |
2350
|
|
|
$email, |
2351
|
|
|
false, |
2352
|
|
|
$identificador . 'Endereço de email' |
2353
|
|
|
); |
2354
|
|
|
return $this->dest; |
2355
|
|
|
} |
2356
|
|
|
|
2357
|
|
|
/** |
2358
|
|
|
* Gera as tags para o elemento: "enderDest" (Informações do Recebedor da Carga) |
2359
|
|
|
* # = 185 |
2360
|
|
|
* Nível = 2 |
2361
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "enderDest" do |
2362
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
2363
|
|
|
* |
2364
|
|
|
* @param string $xLgr Logradouro |
2365
|
|
|
* @param string $nro Número |
2366
|
|
|
* @param string $xCpl Complemento |
2367
|
|
|
* @param string $xBairro Bairro |
2368
|
|
|
* @param string $cMun Código do município (utilizar a tabela do IBGE) |
2369
|
|
|
* @param string $xMun Nome do município |
2370
|
|
|
* @param string $CEP CEP |
2371
|
|
|
* @param string $UF Sigla da UF |
2372
|
|
|
* @param string $cPais Código do país |
2373
|
|
|
* @param string $xPais Nome do país |
2374
|
|
|
* |
2375
|
|
|
* @return \DOMElement |
2376
|
|
|
*/ |
2377
|
|
View Code Duplication |
public function enderDestTag( |
|
|
|
|
2378
|
|
|
$xLgr = '', |
2379
|
|
|
$nro = '', |
2380
|
|
|
$xCpl = '', |
2381
|
|
|
$xBairro = '', |
2382
|
|
|
$cMun = '', |
2383
|
|
|
$xMun = '', |
2384
|
|
|
$CEP = '', |
2385
|
|
|
$UF = '', |
2386
|
|
|
$cPais = '', |
2387
|
|
|
$xPais = '' |
2388
|
|
|
) { |
2389
|
|
|
$identificador = '#185 <enderDest> - '; |
2390
|
|
|
$this->enderDest = $this->dom->createElement('enderDest'); |
2391
|
|
|
$this->dom->addChild( |
2392
|
|
|
$this->enderDest, |
2393
|
|
|
'xLgr', |
2394
|
|
|
$xLgr, |
2395
|
|
|
true, |
2396
|
|
|
$identificador . 'Logradouro' |
2397
|
|
|
); |
2398
|
|
|
$this->dom->addChild( |
2399
|
|
|
$this->enderDest, |
2400
|
|
|
'nro', |
2401
|
|
|
$nro, |
2402
|
|
|
true, |
2403
|
|
|
$identificador . 'Número' |
2404
|
|
|
); |
2405
|
|
|
$this->dom->addChild( |
2406
|
|
|
$this->enderDest, |
2407
|
|
|
'xCpl', |
2408
|
|
|
$xCpl, |
2409
|
|
|
false, |
2410
|
|
|
$identificador . 'Complemento' |
2411
|
|
|
); |
2412
|
|
|
$this->dom->addChild( |
2413
|
|
|
$this->enderDest, |
2414
|
|
|
'xBairro', |
2415
|
|
|
$xBairro, |
2416
|
|
|
true, |
2417
|
|
|
$identificador . 'Bairro' |
2418
|
|
|
); |
2419
|
|
|
$this->dom->addChild( |
2420
|
|
|
$this->enderDest, |
2421
|
|
|
'cMun', |
2422
|
|
|
$cMun, |
2423
|
|
|
true, |
2424
|
|
|
$identificador . 'Código do município (utilizar a tabela do IBGE)' |
2425
|
|
|
); |
2426
|
|
|
$this->dom->addChild( |
2427
|
|
|
$this->enderDest, |
2428
|
|
|
'xMun', |
2429
|
|
|
$xMun, |
2430
|
|
|
true, |
2431
|
|
|
$identificador . 'Nome do município' |
2432
|
|
|
); |
2433
|
|
|
$this->dom->addChild( |
2434
|
|
|
$this->enderDest, |
2435
|
|
|
'CEP', |
2436
|
|
|
$CEP, |
2437
|
|
|
false, |
2438
|
|
|
$identificador . 'CEP' |
2439
|
|
|
); |
2440
|
|
|
$this->dom->addChild( |
2441
|
|
|
$this->enderDest, |
2442
|
|
|
'UF', |
2443
|
|
|
$UF, |
2444
|
|
|
true, |
2445
|
|
|
$identificador . 'Sigla da UF' |
2446
|
|
|
); |
2447
|
|
|
$this->dom->addChild( |
2448
|
|
|
$this->enderDest, |
2449
|
|
|
'cPais', |
2450
|
|
|
$cPais, |
2451
|
|
|
false, |
2452
|
|
|
$identificador . 'Código do país' |
2453
|
|
|
); |
2454
|
|
|
$this->dom->addChild( |
2455
|
|
|
$this->enderDest, |
2456
|
|
|
'xPais', |
2457
|
|
|
$xPais, |
2458
|
|
|
false, |
2459
|
|
|
$identificador . 'Nome do país' |
2460
|
|
|
); |
2461
|
|
|
$node = $this->dest->getElementsByTagName("email")->item(0); |
2462
|
|
|
$this->dest->insertBefore($this->enderDest, $node); |
2463
|
|
|
return $this->enderDest; |
2464
|
|
|
} |
2465
|
|
|
|
2466
|
|
|
/** |
2467
|
|
|
* Gera as tags para o elemento: "vPrest" (Local de Entrega constante na Nota Fiscal) |
2468
|
|
|
* #208 |
2469
|
|
|
* Nível: 1 |
2470
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "vPrest" do |
2471
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 2 |
2472
|
|
|
* |
2473
|
|
|
* @param string $vTPrest Valor Total da Prestação do Serviço |
2474
|
|
|
* @param string $vRec Valor a Receber |
2475
|
|
|
* |
2476
|
|
|
* @return \DOMElement |
2477
|
|
|
*/ |
2478
|
|
|
public function vPrestTag($vTPrest = '', $vRec = '') |
2479
|
|
|
{ |
2480
|
|
|
$identificador = '#208 <vPrest> - '; |
2481
|
|
|
$this->vPrest = $this->dom->createElement('vPrest'); |
2482
|
|
|
$this->dom->addChild( |
2483
|
|
|
$this->vPrest, |
2484
|
|
|
'vTPrest', |
2485
|
|
|
$vTPrest, |
2486
|
|
|
true, |
2487
|
|
|
$identificador . 'Valor Total da Prestação do Serviço' |
2488
|
|
|
); |
2489
|
|
|
$this->dom->addChild( |
2490
|
|
|
$this->vPrest, |
2491
|
|
|
'vRec', |
2492
|
|
|
$vRec, |
2493
|
|
|
true, |
2494
|
|
|
$identificador . 'Valor a Receber' |
2495
|
|
|
); |
2496
|
|
|
return $this->vPrest; |
2497
|
|
|
} |
2498
|
|
|
|
2499
|
|
|
|
2500
|
|
|
/** |
2501
|
|
|
* tagICMS |
2502
|
|
|
* Informações do ICMS da Operação própria e ST N01 pai M01 |
2503
|
|
|
* tag NFe/infNFe/det[]/imposto/ICMS |
2504
|
|
|
* @param string $nItem |
|
|
|
|
2505
|
|
|
* @param string $orig |
|
|
|
|
2506
|
|
|
* @param string $CST |
|
|
|
|
2507
|
|
|
* @param string $modBC |
|
|
|
|
2508
|
|
|
* @param string $vBC |
2509
|
|
|
* @param string $pICMS |
2510
|
|
|
* @param string $vICMS |
2511
|
|
|
* @param string $vICMSDeson |
|
|
|
|
2512
|
|
|
* @param string $motDesICMS |
|
|
|
|
2513
|
|
|
* @param string $modBCST |
|
|
|
|
2514
|
|
|
* @param string $pMVAST |
|
|
|
|
2515
|
|
|
* @param string $pRedBCST |
|
|
|
|
2516
|
|
|
* @param string $vBCST |
|
|
|
|
2517
|
|
|
* @param string $pICMSST |
|
|
|
|
2518
|
|
|
* @param string $vICMSST |
|
|
|
|
2519
|
|
|
* @param string $pDif |
|
|
|
|
2520
|
|
|
* @param string $vICMSDif |
|
|
|
|
2521
|
|
|
* @param string $vICMSOp |
|
|
|
|
2522
|
|
|
* @param string $vBCSTRet |
2523
|
|
|
* @param string $vICMSSTRet |
2524
|
|
|
* @return DOMElement |
2525
|
|
|
*/ |
2526
|
|
|
public function icmsTag( |
2527
|
|
|
$cst = '', |
2528
|
|
|
$pRedBC = '', |
2529
|
|
|
$vBC = '', |
2530
|
|
|
$pICMS = '', |
2531
|
|
|
$vICMS = '', |
2532
|
|
|
$vBCSTRet = '', |
2533
|
|
|
$vICMSSTRet = '', |
2534
|
|
|
$pICMSSTRet = '', |
2535
|
|
|
$vCred = '', |
2536
|
|
|
$vTotTrib = '', |
2537
|
|
|
$outraUF = false |
2538
|
|
|
) { |
2539
|
|
|
$identificador = 'N01 <ICMSxx> - '; |
2540
|
|
|
switch ($cst) { |
2541
|
|
|
case '00': |
2542
|
|
|
$icms = $this->dom->createElement("ICMS00"); |
2543
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 00"); |
2544
|
|
|
$this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador Valor da BC do ICMS"); |
2545
|
|
|
$this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador Alíquota do imposto"); |
2546
|
|
|
$this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador Valor do ICMS"); |
2547
|
|
|
break; |
2548
|
|
|
case '20': |
2549
|
|
|
$icms = $this->dom->createElement("ICMS20"); |
2550
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 20"); |
2551
|
|
|
$this->dom->addChild($icms, 'pRedBC', $pRedBC, true, "$identificador Percentual da Redução de BC"); |
2552
|
|
|
$this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador Valor da BC do ICMS"); |
2553
|
|
|
$this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador Alíquota do imposto"); |
2554
|
|
|
$this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador Valor do ICMS"); |
2555
|
|
|
break; |
2556
|
|
|
case '40': |
2557
|
|
|
$icms = $this->dom->createElement("ICMS45"); |
2558
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 40"); |
2559
|
|
|
break; |
2560
|
|
|
case '41': |
2561
|
|
|
$icms = $this->dom->createElement("ICMS45"); |
2562
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 41"); |
2563
|
|
|
break; |
2564
|
|
|
case '51': |
2565
|
|
|
$icms = $this->dom->createElement("ICMS45"); |
2566
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 51"); |
2567
|
|
|
break; |
2568
|
|
|
case '60': |
2569
|
|
|
$icms = $this->dom->createElement("ICMS60"); |
2570
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 60"); |
2571
|
|
|
$this->dom->addChild($icms, 'vBCSTRet', $vBCSTRet, true, "$identificador Valor BC do ICMS ST retido"); |
2572
|
|
|
$this->dom->addChild($icms, 'vICMSSTRet', $vICMSSTRet, true, "$identificador Valor do ICMS ST retido"); |
2573
|
|
|
$this->dom->addChild($icms, 'pICMSSTRet', $pICMSSTRet, true, "$identificador Valor do ICMS ST retido"); |
2574
|
|
|
if ($vCred > 0) { |
2575
|
|
|
$this->dom->addChild($icms, 'vCred', $vCred, false, "$identificador Valor do Crédito"); |
2576
|
|
|
} |
2577
|
|
|
break; |
2578
|
|
|
case '90': |
2579
|
|
|
if ($outraUF == true) { |
|
|
|
|
2580
|
|
|
$icms = $this->dom->createElement("ICMSOutraUF"); |
2581
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 90"); |
2582
|
|
|
if ($pRedBC > 0) { |
2583
|
|
|
$this->dom->addChild($icms, 'pRedBCOutraUF', $pRedBC, false, "$identificador Percentual Red " |
2584
|
|
|
. "BC Outra UF"); |
2585
|
|
|
} |
2586
|
|
|
$this->dom->addChild($icms, 'vBCOutraUF', $vBC, true, "$identificador Valor BC ICMS Outra UF"); |
2587
|
|
|
$this->dom->addChild($icms, 'pICMSOutraUF', $pICMS, true, "$identificador Alíquota do " |
2588
|
|
|
. "imposto Outra UF"); |
2589
|
|
|
$this->dom->addChild($icms, 'vICMSOutraUF', $vICMS, true, "$identificador Valor ICMS Outra UF"); |
2590
|
|
|
} else { |
2591
|
|
|
$icms = $this->dom->createElement("ICMS90"); |
2592
|
|
|
$this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 90"); |
2593
|
|
|
if ($pRedBC > 0) { |
2594
|
|
|
$this->dom->addChild($icms, 'pRedBC', $pRedBC, false, "$identificador Percentual Redução BC"); |
2595
|
|
|
} |
2596
|
|
|
$this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador Valor da BC do ICMS"); |
2597
|
|
|
$this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador Alíquota do imposto"); |
2598
|
|
|
$this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador Valor do ICMS"); |
2599
|
|
|
if ($vCred > 0) { |
2600
|
|
|
$this->dom->addChild($icms, 'vCred', $vCred, false, "$identificador Valor do Crédido"); |
2601
|
|
|
} |
2602
|
|
|
} |
2603
|
|
|
break; |
2604
|
|
|
case 'SN': |
2605
|
|
|
$icms = $this->dom->createElement("ICMSSN"); |
2606
|
|
|
$this->dom->addChild($icms, 'indSN', '1', true, "$identificador Indica se contribuinte é SN"); |
2607
|
|
|
break; |
2608
|
|
|
} |
2609
|
|
|
$this->imp = $this->dom->createElement('imp'); |
2610
|
|
|
$tagIcms = $this->dom->createElement('ICMS'); |
2611
|
|
|
|
2612
|
|
|
if (isset($icms)) { |
2613
|
|
|
$this->imp->appendChild($tagIcms); |
2614
|
|
|
} |
2615
|
|
|
|
2616
|
|
|
if (isset($icms)) { |
2617
|
|
|
$tagIcms->appendChild($icms); |
2618
|
|
|
} |
2619
|
|
|
|
2620
|
|
|
if ($vTotTrib > 0) { |
2621
|
|
|
$this->dom->addChild($this->imp, 'vTotTrib', $vTotTrib, false, "$identificador Valor Total dos Tributos"); |
2622
|
|
|
} |
2623
|
|
|
|
2624
|
|
|
|
2625
|
|
|
return $tagIcms; |
2626
|
|
|
} |
2627
|
|
|
|
2628
|
|
|
/** |
2629
|
|
|
* Gera as tags para o elemento: "Comp" (Local de Entrega constante na Nota Fiscal) |
2630
|
|
|
* #211 |
2631
|
|
|
* Nível: 2 |
2632
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "Comp" do |
2633
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
2634
|
|
|
* |
2635
|
|
|
* @param string $xNome Nome do componente |
2636
|
|
|
* @param string $vComp Valor do componente |
2637
|
|
|
* |
2638
|
|
|
* @return \DOMElement |
2639
|
|
|
*/ |
2640
|
|
|
public function compTag($xNome = '', $vComp = '') |
2641
|
|
|
{ |
2642
|
|
|
$identificador = '#65 <pass> - '; |
2643
|
|
|
$this->comp[] = $this->dom->createElement('Comp'); |
2644
|
|
|
$posicao = (integer) count($this->obsCont) - 1; |
2645
|
|
|
$this->dom->addChild( |
2646
|
|
|
$this->comp[$posicao], |
2647
|
|
|
'xNome', |
2648
|
|
|
$xNome, |
2649
|
|
|
false, |
2650
|
|
|
$identificador . 'Nome do componente' |
2651
|
|
|
); |
2652
|
|
|
$this->dom->addChild( |
2653
|
|
|
$this->comp[$posicao], |
2654
|
|
|
'vComp', |
2655
|
|
|
$vComp, |
2656
|
|
|
false, |
2657
|
|
|
$identificador . 'Valor do componente' |
2658
|
|
|
); |
2659
|
|
|
return $this->comp[$posicao]; |
2660
|
|
|
} |
2661
|
|
|
|
2662
|
|
|
/** |
2663
|
|
|
* Tag raiz do documento xml |
2664
|
|
|
* Função chamada pelo método [ monta ] |
2665
|
|
|
* @return \DOMElement |
2666
|
|
|
*/ |
2667
|
|
|
private function zCTeTag() |
2668
|
|
|
{ |
2669
|
|
|
if (empty($this->CTe)) { |
2670
|
|
|
$this->CTe = $this->dom->createElement('CTe'); |
2671
|
|
|
$this->CTe->setAttribute('xmlns', 'http://www.portalfiscal.inf.br/cte'); |
2672
|
|
|
} |
2673
|
|
|
return $this->CTe; |
2674
|
|
|
} |
2675
|
|
|
|
2676
|
|
|
/** |
2677
|
|
|
* Gera as tags para o elemento: "Entrega" (Informações ref. a previsão de entrega) |
2678
|
|
|
* #69 |
2679
|
|
|
* Nível: 2 |
2680
|
|
|
* Os parâmetros para esta função são todos os elementos da tag "Entrega" do |
2681
|
|
|
* tipo elemento (Ele = E|CE|A) e nível 3 |
2682
|
|
|
* |
2683
|
|
|
* @return \DOMElement |
2684
|
|
|
*/ |
2685
|
|
|
private function zEntregaTag() |
2686
|
|
|
{ |
2687
|
|
|
$this->entrega = $this->dom->createElement('Entrega'); |
2688
|
|
|
return $this->entrega; |
2689
|
|
|
} |
2690
|
|
|
|
2691
|
|
|
public function infCTeNormTag() |
2692
|
|
|
{ |
2693
|
|
|
$this->infCTeNorm = $this->dom->createElement('infCTeNorm'); |
2694
|
|
|
return $this->infCTeNorm; |
2695
|
|
|
} |
2696
|
|
|
|
2697
|
3 |
|
public function infCargaTag($vCarga = '', $proPred = '', $xOutCat = '', $vCargaAverb = '') |
2698
|
|
|
{ |
2699
|
3 |
|
$identificador = '#253 <infCarga> - '; |
2700
|
3 |
|
$this->infCarga = $this->dom->createElement('infCarga'); |
2701
|
3 |
|
$this->dom->addChild($this->infCarga, 'vCarga', $vCarga, false, $identificador . 'Valor Total da Carga'); |
2702
|
3 |
|
$this->dom->addChild($this->infCarga, 'proPred', $proPred, true, $identificador . 'Produto Predominante'); |
2703
|
3 |
|
$this->dom->addChild($this->infCarga, 'xOutCat', $xOutCat, false, $identificador . 'Outras Caract. da Carga'); |
2704
|
3 |
|
$this->dom->addChild($this->infCarga, 'vCargaAverb', $vCargaAverb, false, $identificador . 'Valor da Carga para |
2705
|
3 |
|
efeito de averbação'); |
2706
|
|
|
|
2707
|
3 |
|
return $this->infCarga; |
2708
|
|
|
} |
2709
|
|
|
|
2710
|
|
|
public function infQTag($cUnid = '', $tpMed = '', $qCarga = '') |
2711
|
|
|
{ |
2712
|
|
|
$identificador = '#257 <infQ> - '; |
2713
|
|
|
$this->infQ = $this->dom->createElement('infQ'); |
2714
|
|
|
$this->dom->addChild($this->infQ, 'cUnid', $cUnid, true, $identificador . 'Código da Unidade de Medida'); |
2715
|
|
|
$this->dom->addChild($this->infQ, 'tpMed', $tpMed, true, $identificador . 'Tipo da Medida'); |
2716
|
|
|
$this->dom->addChild($this->infQ, 'qCarga', $qCarga, true, $identificador . 'Quantidade'); |
2717
|
|
|
|
2718
|
|
|
return $this->infQ; |
2719
|
|
|
} |
2720
|
|
|
|
2721
|
|
|
public function infDocTag() |
2722
|
|
|
{ |
2723
|
|
|
$this->infDoc = $this->dom->createElement('infDoc'); |
2724
|
|
|
return $this->infDoc; |
2725
|
|
|
} |
2726
|
|
|
|
2727
|
|
|
public function infNFTag($vCarga = '', $proPred = '', $xOutCat = '') |
2728
|
|
|
{ |
2729
|
|
|
$identificador = '#262 <infNF> - '; |
2730
|
|
|
$this->infCarga = $this->dom->createElement('infNF'); |
2731
|
|
|
$this->dom->addChild($this->infCarga, 'vCarga', $vCarga, false, $identificador . 'Valor Total da Carga'); |
2732
|
|
|
$this->dom->addChild($this->infCarga, 'proPred', $proPred, true, $identificador . 'Produto Predominante'); |
2733
|
|
|
$this->dom->addChild($this->infCarga, 'xOutCat', $xOutCat, false, $identificador . 'Outras Caract. da Carga'); |
2734
|
|
|
|
2735
|
|
|
return $this->infCarga; |
2736
|
|
|
} |
2737
|
|
|
|
2738
|
|
|
public function infNFeTag($chave = '', $PIN = '', $dPrev = '') |
2739
|
|
|
{ |
2740
|
|
|
$identificador = '#262 <infNFe> - '; |
2741
|
|
|
$this->infNFe[] = $this->dom->createElement('infNFe'); |
2742
|
|
|
$posicao = (integer) count($this->infNFe) - 1; |
2743
|
|
|
$this->dom->addChild($this->infNFe[$posicao], 'chave', $chave, true, $identificador . 'Chave acesso da NF-e'); |
2744
|
|
|
$this->dom->addChild($this->infNFe[$posicao], 'PIN', $PIN, false, $identificador . 'PIN SUFRAMA'); |
2745
|
|
|
$this->dom->addChild($this->infNFe[$posicao], 'dPrev', $dPrev, false, $identificador . 'Data prevista entrega'); |
2746
|
|
|
|
2747
|
|
|
return $this->infNFe[$posicao]; |
2748
|
|
|
} |
2749
|
|
|
|
2750
|
|
|
public function infOutrosTag($tpDoc = '', $descOutros = '', $nDoc = '', $dEmi = '', $vDocFisc = '', $dPrev = '') |
2751
|
|
|
{ |
2752
|
|
|
$ident = '#262 <infOutros> - '; |
2753
|
|
|
$this->infOutros[] = $this->dom->createElement('infOutros'); |
2754
|
|
|
$posicao = (integer) count($this->infOutros) - 1; |
2755
|
|
|
$this->dom->addChild($this->infOutros[$posicao], 'tpDoc', $tpDoc, true, $ident . 'Tipo ' |
2756
|
|
|
. 'de documento originário'); |
2757
|
|
|
$this->dom->addChild($this->infOutros[$posicao], 'descOutros', $descOutros, false, $ident . 'Descrição ' |
2758
|
|
|
. 'do documento'); |
2759
|
|
|
$this->dom->addChild($this->infOutros[$posicao], 'nDoc', $nDoc, false, $ident . 'Número ' |
2760
|
|
|
. 'do documento'); |
2761
|
|
|
$this->dom->addChild($this->infOutros[$posicao], 'dEmi', $dEmi, false, $ident . 'Data de Emissão'); |
2762
|
|
|
$this->dom->addChild($this->infOutros[$posicao], 'vDocFisc', $vDocFisc, false, $ident . 'Valor ' |
2763
|
|
|
. 'do documento'); |
2764
|
|
|
$this->dom->addChild($this->infOutros[$posicao], 'dPrev', $dPrev, false, $ident . 'Data ' |
2765
|
|
|
. 'prevista de entrega'); |
2766
|
|
|
|
2767
|
|
|
return $this->infOutros[$posicao]; |
2768
|
|
|
} |
2769
|
|
|
|
2770
|
|
|
public function segTag($respSeg = 4) |
2771
|
|
|
{ |
2772
|
|
|
$identificador = '#360 <seg> - '; |
2773
|
|
|
$this->seg = $this->dom->createElement('seg'); |
|
|
|
|
2774
|
|
|
$this->dom->addChild($this->seg, 'respSeg', $respSeg, true, $identificador . 'Responsável pelo Seguro'); |
2775
|
|
|
return $this->seg; |
2776
|
|
|
} |
2777
|
|
|
|
2778
|
|
|
public function infModalTag($versaoModal = '') |
2779
|
|
|
{ |
2780
|
|
|
$identificador = '#366 <infModal> - '; |
|
|
|
|
2781
|
|
|
$this->infModal = $this->dom->createElement('infModal'); |
2782
|
|
|
$this->infModal->setAttribute('versaoModal', $versaoModal); |
2783
|
|
|
return $this->infModal; |
2784
|
|
|
} |
2785
|
|
|
|
2786
|
3 |
|
public function rodoTag($RNTRC = '') |
2787
|
|
|
{ |
2788
|
3 |
|
$identificador = '#1 <rodo> - '; |
2789
|
3 |
|
$this->rodo = $this->dom->createElement('rodo'); |
2790
|
3 |
|
$this->dom->addChild($this->rodo, 'RNTRC', $RNTRC, true, $identificador . 'Registro nacional de transportadores |
2791
|
3 |
|
rodoviários de carga'); |
2792
|
|
|
|
2793
|
3 |
|
return $this->rodo; |
2794
|
|
|
} |
2795
|
|
|
} |
2796
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.