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