Passed
Pull Request — master (#921)
by
unknown
08:01
created

Parser::array2xml()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 4.0961

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 14
ccs 9
cts 11
cp 0.8182
rs 9.9332
c 0
b 0
f 0
cc 4
nc 4
nop 1
crap 4.0961
1
<?php
2
3
/**
4
 * Classe de conversão do TXT para XML
5
 * NOTA: ajustado para Nota Técnica 2018.005 Versão 1.00 – Dezembro de 2018
6
 * @category  API
7
 * @package   NFePHP\NFe
8
 * @copyright NFePHP Copyright (c) 2008-2019
9
 * @license   http://www.gnu.org/licenses/lgpl.txt LGPLv3+
10
 * @license   https://opensource.org/licenses/MIT MIT
11
 * @license   http://www.gnu.org/licenses/gpl.txt GPLv3+
12
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
13
 * @link      http://github.com/nfephp-org/sped-nfe for the canonical source repository
14
 */
15
16
namespace NFePHP\NFe\Factories;
17
18
use NFePHP\NFe\Make;
19
use NFePHP\NFe\Exception\DocumentsException;
20
use stdClass;
21
22
class Parser
23
{
24
    const LOCAL = "LOCAL";
25
    const LOCAL_V12 = "LOCAL_V12";
26
    const SEBRAE = "SEBRAE";
27
28
    /**
29
     * @var array
30
     */
31
    protected $structure;
32
    /**
33
     * @var Make
34
     */
35
    protected $make;
36
    /**
37
     * @var int
38
     */
39
    protected $item = 0;
40
    /**
41
     * @var int
42
     */
43
    protected $nDI = 0;
44
    /**
45
     * @var int
46
     */
47
    protected $volId = -1;
48
    /**
49
     * @var stdClass|null
50
     */
51
    protected $stdNFP;
52
    /**
53
     * @var stdClass|null
54
     */
55
    protected $stdEmit;
56
    /**
57
     * @var stdClass|null
58
     */
59
    protected $stdDest;
60
    /**
61
     * @var stdClass|null
62
     */
63
    protected $stdRetirada;
64
    /**
65
     * @var stdClass|null
66
     */
67
    protected $stdEntrega;
68
    /**
69
     * @var stdClass|null
70
     */
71
    protected $stdAutXML;
72
    /**
73
     * @var ?stdClass
74
     */
75
    protected $stdComb;
76
    /**
77
     * @var stdClass
78
     */
79
    protected $stdIPI;
80
    /**
81
     * @var stdClass
82
     */
83
    protected $stdPIS;
84
    /**
85
     * @var stdClass
86
     */
87
    protected $stdPISST;
88
    /**
89
     * @var stdClass
90
     */
91
    protected $stdII;
92
    /**
93
     * @var stdClass
94
     */
95
    protected $stdCOFINS;
96
    /**
97
     * @var stdClass
98
     */
99
    protected $stdCOFINSST;
100
    /**
101
     * @var stdClass|null
102
     */
103
    protected $stdTransporta;
104
    /**
105
     * @var string
106
     */
107
    protected $baselayout;
108
109
    /**
110
     * Configure environment to correct NFe layout
111
     * @param string $version
112
     * @param string $baselayout
113
     */
114 1
    public function __construct($version = '4.00', $baselayout = self::LOCAL)
115
    {
116 1
        $ver = str_replace('.', '', $version);
117 1
        $comp = "";
118 1
        if ($baselayout === 'SEBRAE') {
119
            $comp = "_sebrae";
120 1
        } elseif ($baselayout == 'LOCAL_V12') {
121
            $comp = "_v1.2";
122
        }
123 1
        $this->baselayout = $baselayout;
124 1
        $path = realpath(__DIR__ . "/../../storage/txtstructure$ver" . $comp . ".json");
125 1
        $this->structure = json_decode(file_get_contents($path), true);
126 1
        $this->make = new Make();
127 1
    }
128
129
    /**
130
     * Convert txt to XML
131
     * @param array $nota
132
     * @return string|null
133
     */
134 1
    public function toXml($nota)
135
    {
136 1
        $this->array2xml($nota);
137 1
        if ($this->make->monta()) {
138 1
            return $this->make->getXML();
139
        }
140
        return null;
141
    }
142
143
    /**
144
     * Retorna erros na criacao do DOM
145
     * @return array
146
     */
147
    public function getErrors()
148
    {
149
        return $this->make->errors;
150
    }
151
152
    /**
153
     * Converte txt array to xml
154
     * @param array $nota
155
     * @return void
156
     */
157 1
    protected function array2xml($nota)
158
    {
159 1
        foreach ($nota as $lin) {
160 1
            $fields = explode('|', $lin);
161 1
            if (count($fields) == 0) {
162
                continue;
163
            }
164 1
            $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity';
165 1
            if (!method_exists(__CLASS__, $metodo)) {
166
                throw DocumentsException::wrongDocument(16, $lin); //campo não definido
167
            }
168 1
            $struct = $this->structure[strtoupper($fields[0])];
169 1
            $std = $this->fieldsToStd($fields, $struct);
170 1
            $this->$metodo($std);
171
        }
172 1
    }
173
174
    /**
175
     * Creates stdClass for all tag fields
176
     * @param array $dfls
177
     * @param string $struct
178
     * @return stdClass
179
     */
180 1
    protected static function fieldsToStd($dfls, $struct)
181
    {
182 1
        $sfls = explode('|', $struct);
183 1
        $len = count($sfls) - 1;
184 1
        $std = new \stdClass();
185 1
        for ($i = 1; $i < $len; $i++) {
186 1
            $name = $sfls[$i];
187 1
            $data = $dfls[$i];
188 1
            if (!empty($name) && $data !== '') {
189 1
                $std->$name = $data;
190
            }
191
        }
192 1
        return $std;
193
    }
194
195
    /**
196
     * Create tag infNFe [A]
197
     * A|versao|Id|pk_nItem|
198
     * @param stdClass $std
199
     * @return void
200
     */
201 1
    protected function aEntity($std)
202
    {
203 1
        $this->make->taginfNFe($std);
204 1
    }
205
206
    /**
207
     * Create tag ide [B]
208
     * B|cUF|cNF|natOp|mod|serie|nNF|dhEmi|dhSaiEnt|tpNF|idDest|cMunFG|tpImp
209
     *  |tpEmis|cDV|tpAmb|finNFe|indFinal|indPres|procEmi|verProc|dhCont|xJust|
210
     * @param stdClass $std
211
     * @return void
212
     */
213 1
    protected function bEntity($std)
214
    {
215 1
        $this->make->tagide($std);
216 1
    }
217
218
    /**
219
     * Create tag nfref [BA]
220
     * BA|
221
     * @param stdClass $std
222
     * @return void
223
     */
224
    protected function baEntity($std)
225
    {
226
        //fake não faz nada
227
        $field = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $field is dead and can be removed.
Loading history...
228
    }
229
230
    /**
231
     * Create tag refNFe [BA02]
232
     * BA02|refNFe|
233
     * @param stdClass $std
234
     * @return void
235
     */
236
    protected function ba02Entity($std)
237
    {
238
        $this->make->tagrefNFe($std);
239
    }
240
241
    /**
242
     * Create tag refNF [BA03]
243
     * BA03|cUF|AAMM|CNPJ|mod|serie|nNF|
244
     * @param stdClass $std
245
     * @return void
246
     */
247
    protected function ba03Entity($std)
248
    {
249
        $this->make->tagrefNF($std);
250
    }
251
252
    /**
253
     * Load fields for tag refNFP [BA10]
254
     * BA10|cUF|AAMM|IE|mod|serie|nNF|
255
     * @param stdClass $std
256
     * @return void
257
     */
258
    protected function ba10Entity($std)
259
    {
260
        $this->stdNFP = $std;
261
        $this->stdNFP->CNPJ = null;
262
        $this->stdNFP->CPF = null;
263
    }
264
265
    /**
266
     * Create tag refNFP [BA13], with CNPJ belongs to [BA10]
267
     * BA13|CNPJ|
268
     * @param stdClass $std
269
     * @return void
270
     */
271
    protected function ba13Entity($std)
272
    {
273
        $this->stdNFP->CNPJ = $std->CNPJ;
274
        $this->buildBA10Entity();
275
        $this->stdNFP = null;
276
    }
277
278
    /**
279
     * Create tag refNFP [BA14], with CPF belongs to [BA10]
280
     * BA14|CPF|
281
     * @param stdClass $std
282
     * @return void
283
     */
284
    protected function ba14Entity($std)
285
    {
286
        $this->stdNFP->CPF = $std->CPF;
287
        $this->buildBA10Entity();
288
        $this->stdNFP = null;
289
    }
290
291
    /**
292
     * Create tag refNFP [BA10]
293
     * @return void
294
     */
295
    protected function buildBA10Entity()
296
    {
297
        $this->make->tagrefNFP($this->stdNFP);
0 ignored issues
show
Bug introduced by
It seems like $this->stdNFP can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagrefNFP() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

297
        $this->make->tagrefNFP(/** @scrutinizer ignore-type */ $this->stdNFP);
Loading history...
298
    }
299
300
    /**
301
     * Create tag refCTe [BA19]
302
     * B19|refCTe|
303
     * @param stdClass $std
304
     * @return void
305
     */
306
    protected function ba19Entity($std)
307
    {
308
        $this->make->tagrefCTe($std);
309
    }
310
311
    /**
312
     * Create tag refECF [BA20]
313
     * BA20|mod|nECF|nCOO|
314
     * @param stdClass $std
315
     * @return void
316
     */
317
    protected function ba20Entity($std)
318
    {
319
        $this->make->tagrefECF($std);
320
    }
321
322
    /**
323
     * Load fields for tag emit [C]
324
     * C|XNome|XFant|IE|IEST|IM|CNAE|CRT|
325
     * @param stdClass $std
326
     * @return void
327
     */
328 1
    protected function cEntity($std)
329
    {
330 1
        $this->stdEmit = $std;
331 1
        $this->stdEmit->CNPJ = null;
332 1
        $this->stdEmit->CPF = null;
333 1
    }
334
335
    /**
336
     * Create tag emit [C02], with CNPJ belongs to [C]
337
     * C02|CNPJ|
338
     * @param stdClass $std
339
     * @return void
340
     */
341 1
    protected function c02Entity($std)
342
    {
343 1
        $this->stdEmit->CNPJ = $std->CNPJ;
344 1
        $this->buildCEntity();
345 1
        $this->stdEmit = null;
346 1
    }
347
348
    /**
349
     * Create tag emit [C02a], with CPF belongs to [C]
350
     * C02a|CPF|
351
     * @param stdClass $std
352
     * @return void
353
     */
354
    protected function c02aEntity($std)
355
    {
356
        $this->stdEmit->CPF = $std->CPF;
357
        $this->buildCEntity();
358
        $this->stdEmit = null;
359
    }
360
361
    protected function dEntity($std)
362
    {
363
        //nada
364
    }
365
366
    /**
367
     * Create tag emit [C]
368
     * @return void
369
     */
370 1
    protected function buildCEntity()
371
    {
372 1
        $this->make->tagemit($this->stdEmit);
0 ignored issues
show
Bug introduced by
It seems like $this->stdEmit can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagemit() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

372
        $this->make->tagemit(/** @scrutinizer ignore-type */ $this->stdEmit);
Loading history...
373 1
    }
374
375
    /**
376
     * Create tag enderEmit [C05]
377
     * C05|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|
378
     * @param stdClass $std
379
     * @return void
380
     */
381 1
    protected function c05Entity($std)
382
    {
383 1
        $this->make->tagenderEmit($std);
384 1
    }
385
386
    /**
387
     * Load fields for tag dest [E]
388
     * E|xNome|indIEDest|IE|ISUF|IM|email|
389
     * @param stdClass $std
390
     * @return void
391
     */
392 1
    protected function eEntity($std)
393
    {
394 1
        $this->stdDest = $std;
395 1
        $this->stdDest->CNPJ = null;
396 1
        $this->stdDest->CPF = null;
397 1
        $this->stdDest->idEstrangeiro = null;
398 1
    }
399
400
    /**
401
     * Create tag dest [E02], with CNPJ belongs to [E]
402
     * E02|CNPJ|
403
     * @param stdClass $std
404
     * @return void
405
     */
406 1
    protected function e02Entity($std)
407
    {
408 1
        $this->stdDest->CNPJ = $std->CNPJ;
409 1
        $this->buildEEntity();
410 1
        $this->stdDest = null;
411 1
    }
412
413
    /**
414
     * Create tag dest [E03], with CPF belongs to [E]
415
     * E03|CPF|
416
     * @param stdClass $std
417
     * @return void
418
     */
419
    protected function e03Entity($std)
420
    {
421
        $this->stdDest->CPF = $std->CPF;
422
        $this->buildEEntity();
423
        $this->stdDest = null;
424
    }
425
426
    /**
427
     * Create tag dest [E03a], with idEstrangeiro belongs to [E]
428
     * E03a|idEstrangeiro|
429
     * @param stdClass $std
430
     * @return void
431
     */
432
    protected function e03aEntity($std)
433
    {
434
        $this->stdDest->idEstrangeiro = !empty($std->idEstrangeiro) ? $std->idEstrangeiro : '';
435
        $this->buildEEntity();
436
        $this->stdDest = null;
437
    }
438
439
    /**
440
     * Create tag dest [E]
441
     * @return void
442
     */
443 1
    protected function buildEEntity()
444
    {
445 1
        $this->make->tagdest($this->stdDest);
0 ignored issues
show
Bug introduced by
It seems like $this->stdDest can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagdest() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

445
        $this->make->tagdest(/** @scrutinizer ignore-type */ $this->stdDest);
Loading history...
446 1
    }
447
448
    /**
449
     * Create tag enderDest [E05]
450
     * E05|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|
451
     * @param stdClass $std
452
     * @return void
453
     */
454 1
    protected function e05Entity($std)
455
    {
456 1
        $this->make->tagenderDest($std);
457 1
    }
458
459
    /**
460
     * Load fields for tag retirada [F]
461
     * F|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|email|IE|
462
     * @param stdClass $std
463
     * @return void
464
     */
465
    protected function fEntity($std)
466
    {
467
        $this->stdRetirada = null;
468
        $this->stdRetirada = $std;
469
        $this->stdRetirada->CNPJ = null;
470
        $this->stdRetirada->CPF = null;
471
        $this->stdRetirada->xNome = null;
472
    }
473
474
    /**
475
     * Create tag retirada [F02], with CNPJ belongs to [F]
476
     * F02|CNPJ|
477
     * @param stdClass $std
478
     * @return void
479
     */
480
    protected function f02Entity($std)
481
    {
482
        $this->stdRetirada->CNPJ = $std->CNPJ;
483
        $this->buildFEntity();
484
    }
485
486
    /**
487
     * Create tag retirada [F02a], with CPF belongs to [F]
488
     * F02a|CPF|
489
     * @param stdClass $std
490
     * @return void
491
     */
492
    protected function f02aEntity($std)
493
    {
494
        $this->stdRetirada->CPF = $std->CPF;
495
        $this->buildFEntity();
496
    }
497
498
    /**
499
     * Create tag retirada [F02b], with xNome belongs to [F]
500
     * F02a|xNome|
501
     * @param stdClass $std
502
     * @return void
503
     */
504
    protected function f02bEntity($std)
505
    {
506
        $this->stdRetirada->xNome = $std->xNome;
507
        $this->buildFEntity();
508
    }
509
510
    /**
511
     * Create tag retirada [F]
512
     * @return void
513
     */
514
    protected function buildFEntity()
515
    {
516
        $this->make->tagretirada($this->stdRetirada);
0 ignored issues
show
Bug introduced by
It seems like $this->stdRetirada can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagretirada() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

516
        $this->make->tagretirada(/** @scrutinizer ignore-type */ $this->stdRetirada);
Loading history...
517
    }
518
519
    /**
520
     * Load fields for tag entrega [G]
521
     * G|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|email|IE|
522
     * @param stdClass $std
523
     * @return void
524
     */
525
    protected function gEntity($std)
526
    {
527
        $this->stdEntrega = null;
528
        $this->stdEntrega = $std;
529
        $this->stdEntrega->CNPJ = null;
530
        $this->stdEntrega->CPF = null;
531
        $this->stdEntrega->xNome = null;
532
    }
533
534
    /**
535
     * Create tag entrega [G02], with CNPJ belongs to [G]
536
     * G02|CNPJ|
537
     * @param stdClass $std
538
     * @return void
539
     */
540
    protected function g02Entity($std)
541
    {
542
        $this->stdEntrega->CNPJ = $std->CNPJ;
543
        $this->buildGEntity();
544
    }
545
546
    /**
547
     * Create tag entrega [G02a], with CPF belongs to [G]
548
     * G02a|CPF|
549
     * @param stdClass $std
550
     * @return void
551
     */
552
    protected function g02aEntity($std)
553
    {
554
        $this->stdEntrega->CPF = $std->CPF;
555
        $this->buildGEntity();
556
    }
557
558
    /**
559
     * Create tag entrega [G02b], with xNome belongs to [G]
560
     * G02b|xNome|
561
     * @param stdClass $std
562
     * @return void
563
     */
564
    protected function g02bEntity($std)
565
    {
566
        $this->stdEntrega->xNome = $std->xNome;
567
        $this->buildGEntity();
568
    }
569
570
571
    /**
572
     * Create tag entrega [G]
573
     * @return void
574
     */
575
    protected function buildGEntity()
576
    {
577
        $this->make->tagentrega($this->stdEntrega);
0 ignored issues
show
Bug introduced by
It seems like $this->stdEntrega can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagentrega() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

577
        $this->make->tagentrega(/** @scrutinizer ignore-type */ $this->stdEntrega);
Loading history...
578
    }
579
580
    /**
581
     * Create tag autXML [GA]
582
     * GA|
583
     * @param stdClass $std
584
     * @return void
585
     */
586
    protected function gaEntity($std)
587
    {
588
        //fake não faz nada
589
        $std->CNPJ = null;
590
        $std->CPF = null;
591
        $this->stdAutXML = $std;
592
    }
593
594
    /**
595
     * Create tag autXML with CNPJ [GA02], belongs to [GA]
596
     * GA02|CNPJ|
597
     * @param stdClass $std
598
     * @return void
599
     */
600
    protected function ga02Entity($std)
601
    {
602
        $this->stdAutXML->CNPJ = $std->CNPJ;
603
        $this->make->tagautXML($this->stdAutXML);
0 ignored issues
show
Bug introduced by
It seems like $this->stdAutXML can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagautXML() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

603
        $this->make->tagautXML(/** @scrutinizer ignore-type */ $this->stdAutXML);
Loading history...
604
        $this->stdAutXML = null;
605
    }
606
607
    /**
608
     * Create tag autXML with CPF [GA03], belongs to GA
609
     * GA03|CPF|
610
     * @param stdClass $std
611
     * @return void
612
     */
613
    protected function ga03Entity($std)
614
    {
615
        $this->stdAutXML->CPF = $std->CPF;
616
        $this->make->tagautXML($this->stdAutXML);
0 ignored issues
show
Bug introduced by
It seems like $this->stdAutXML can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagautXML() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

616
        $this->make->tagautXML(/** @scrutinizer ignore-type */ $this->stdAutXML);
Loading history...
617
        $this->stdAutXML = null;
618
    }
619
620
    /**
621
     * Create tag det/infAdProd [H]
622
     * H|item|infAdProd|
623
     * @param stdClass $std
624
     */
625 1
    protected function hEntity($std)
626
    {
627 1
        if (!empty($std->infAdProd)) {
628
            $this->make->taginfAdProd($std);
629
        }
630 1
        $this->item = (int) $std->item;
631 1
    }
632
633
    /**
634
     * Create tag prod [I]
635
     * LOCAL
636
     * I|cProd|cEAN|xProd|NCM|cBenef|EXTIPI|CFOP|uCom|qCom|vUnCom|vProd|cEANTrib|uTrib|qTrib|vUnTrib|vFrete|vSeg|vDesc|vOutro|indTot|xPed|nItemPed|nFCI|
637
     * SEBRAE
638
     * I|cProd|cEAN|xProd|NCM|EXTIPI|CFOP|uCom|qCom|vUnCom|vProd|cEANTrib|uTrib|qTrib|vUnTrib|vFrete|vSeg|vDesc|vOutro|indTot|xPed|nItemPed|nFCI|
639
     * @param stdClass $std
640
     * @return void
641
     */
642 1
    protected function iEntity($std)
643
    {
644 1
        $std->item = $this->item;
645 1
        $this->make->tagprod($std);
646 1
    }
647
648
    /**
649
     * Create tag NVE [I05A]
650
     * I05A|NVE|
651
     * @param stdClass $std
652
     * @return void
653
     */
654
    protected function i05aEntity($std)
655
    {
656
        $std->item = $this->item;
657
        $this->make->tagNVE($std);
658
    }
659
660
    /**
661
     * Create tag CEST [I05C]
662
     * I05C|CEST|indEscala|CNPJFab|
663
     * SEBRAE
664
     * I05C|CEST|indEscala|CNPJFab|cBenef|
665
     * @param stdClass $std
666
     * @return void
667
     */
668 1
    protected function i05cEntity($std)
669
    {
670 1
        $std->item = $this->item;
671 1
        $this->make->tagCEST($std);
672 1
    }
673
674
    /**
675
     * Create tag DI [I18]
676
     * I18|nDI|dDI|xLocDesemb|UFDesemb|dDesemb|tpViaTransp|vAFRMM|tpIntermedio|CNPJ|UFTerceiro|cExportador|
677
     * @param stdClass $std
678
     * @return void
679
     */
680
    protected function i18Entity($std)
681
    {
682
        $std->item = $this->item;
683
        $this->make->tagDI($std);
684
        $this->nDI = $std->nDI;
685
    }
686
687
    /**
688
     * Create tag adi [I25], belongs to [I18]
689
     * I25|nAdicao|nSeqAdicC|cFabricante|vDescDI|nDraw|
690
     * @param stdClass $std
691
     * @return void
692
     */
693
    protected function i25Entity($std)
694
    {
695
        $std->item = $this->item;
696
        $std->nDI = $this->nDI;
697
        $this->make->tagadi($std);
698
    }
699
700
    /**
701
     * Load fields for tag detExport [I50]
702
     * I50|nDraw|
703
     * @param stdClass $std
704
     * @return void
705
     */
706
    protected function i50Entity($std)
707
    {
708
        $std->item = $this->item;
709
        $this->make->tagdetExport($std);
710
    }
711
712
    /**
713
     * Create tag detExport/exportInd [I52], belongs to [I50]
714
     * I52|nRE|chNFe|qExport|
715
     * @param stdClass $std
716
     * @return void
717
     */
718
    protected function i52Entity($std)
719
    {
720
        $std->item = $this->item;
721
        $this->make->tagdetExportInd($std);
722
    }
723
724
    /**
725
     * Create tag RASTRO [I80]
726
     * I80|nLote|qLote|dFab|dVal|cAgreg|
727
     * @param stdClass $std
728
     * @return void
729
     */
730
    protected function i80Entity($std)
731
    {
732
        $std->item = $this->item;
733
        $this->make->tagRastro($std);
734
    }
735
736
    /**
737
     * Create tag veicProd [JA]
738
     * JA|tpOp|chassi|cCor|xCor|pot|cilin|pesoL|pesoB|nSerie|tpComb|nMotor|CMT|dist|anoMod|anoFab|tpPint|tpVeic|espVeic|VIN|condVeic|cMod|cCorDENATRAN|lota|tpRest|
739
     * @param stdClass $std
740
     * @return void
741
     */
742
    protected function jaEntity($std)
743
    {
744
        $std->item = $this->item;
745
        $this->make->tagveicProd($std);
746
    }
747
748
    /**
749
     * Create tag med [K]
750
     * K|cProdANVISA|vPMC|xMotivoIsencao|
751
     * @param stdClass $std
752
     * @return void
753
     */
754
    protected function kEntity($std)
755
    {
756
        $std->item = $this->item;
757
        $std->nLote = !empty($std->nLote) ? $std->nLote : null;
758
        $std->qLote = !empty($std->qLote) ? $std->qLote : null;
759
        $std->dFab = !empty($std->dFab) ? $std->dFab : null;
760
        $std->dVal = !empty($std->dVal) ? $std->dVal : null;
761
        $std->cProdANVISA = !empty($std->cProdANVISA) ? $std->cProdANVISA : null;
762
        $std->xMotivoIsencao = !empty($std->xMotivoIsencao) ? $std->xMotivoIsencao : null;
763
        $this->make->tagmed($std);
764
    }
765
766
    /**
767
     * Create tag arma [L]
768
     * L|tpArma|nSerie|nCano|descr|
769
     * @param stdClass $std
770
     * @return void
771
     */
772
    protected function lEntity($std)
773
    {
774
        $std->item = $this->item;
775
        $this->make->tagarma($std);
776
    }
777
778
    /**
779
     * Load fields for tag comb [LA]
780
     * LA|cProdANP|descANP|pGLP|pGNn|pGNi|vPart|CODIF|qTemp|UFCons|
781
     * @param stdClass $std
782
     * @return void
783
     */
784
    protected function laEntity($std)
785
    {
786
        $std->item = $this->item;
787
        $this->stdComb = $std;
788
    }
789
790
    /**
791
     * Load fields for tag comb [LA07], belongs to [LA]
792
     * LA07|qBCProd|vAliqProd|vCIDE|
793
     * @param stdClass $std
794
     * @return void
795
     */
796
    protected function la07Entity($std)
797
    {
798
        $this->stdComb->qBCProd = $std->qBCProd;
799
        $this->stdComb->vAliqProd = $std->vAliqProd;
800
        $this->stdComb->vCIDE = $std->vCIDE;
801
    }
802
803
    /**
804
     * Load fields for tag encerrante [LA11]
805
     * LA11|nBico|nBomba|nTanque|vEncIni|vEncFin|
806
     * @param stdClass $std
807
     * @return void
808
     */
809
    protected function la11Entity($std)
810
    {
811
        $std->item = $this->item;
812
        $this->make->tagencerrante($std);
813
    }
814
815
    /**
816
     * Create tag comb [LA]
817
     * @return void
818
     */
819 1
    protected function buildLAEntity()
820
    {
821 1
        if ($this->stdComb) {
822
            $this->make->tagcomb($this->stdComb);
823
        }
824 1
    }
825
826
    /**
827
     * Create tag RECOPI [LB]
828
     * LB|nRECOPI|
829
     * @param stdClass $std
830
     * @return void
831
     */
832
    protected function lbEntity($std)
833
    {
834
        $std->item = $this->item;
835
        $this->make->tagRECOPI($std);
836
    }
837
838
    /**
839
     * Create tag imposto [M]
840
     * M|vTotTrib|
841
     * @param stdClass $std
842
     * @return void
843
     */
844 1
    protected function mEntity($std)
845
    {
846
        //create tag comb [LA]
847 1
        $this->buildLAEntity();
848
849 1
        $std->item = $this->item;
850 1
        $this->make->tagimposto($std);
851 1
    }
852
853
    /**
854
     * Carrega a tag ICMS [N]
855
     * N|
856
     * @param stdClass $std
857
     * @return void
858
     */
859 1
    protected function nEntity($std)
860
    {
861
        //fake não faz nada
862 1
        $field = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $field is dead and can be removed.
Loading history...
863 1
    }
864
865
    /**
866
     * Load fields for tag ICMS [N02]
867
     * N02|orig|CST|modBC|vBC|pICMS|vICMS|pFCP|vFCP|
868
     * @param stdClass $std
869
     * @return void
870
     */
871
    protected function n02Entity($std)
872
    {
873
        $this->buildNEntity($std);
874
    }
875
876
    /**
877
     * Load fields for tag ICMS [N03]
878
     * N03|orig|CST|modBC|vBC|pICMS|vICMS|vBCFCP|pFCP|vFCP|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|
879
     * @param stdClass $std
880
     * @return void
881
     */
882 1
    protected function n03Entity($std)
883
    {
884 1
        $this->buildNEntity($std);
885 1
    }
886
887
    /**
888
     * Load fields for tag ICMS [N04]
889
     * N04|orig|CST|modBC|pRedBC|vBC|pICMS|vICMS|BCFCP|pFCP|vFCP|vICMSDeson|motDesICMS|
890
     * @param stdClass $std
891
     * @return void
892
     */
893
    protected function n04Entity($std)
894
    {
895
        $this->buildNEntity($std);
896
    }
897
898
    /**
899
     * Load fields for tag ICMS [N05]
900
     * N05|orig|CST|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|vICMSDeson|motDesICMS|
901
     * @param stdClass $std
902
     * @return void
903
     */
904
    protected function n05Entity($std)
905
    {
906
        $this->buildNEntity($std);
907
    }
908
909
    /**
910
     * Load fields for tag ICMS [N06]
911
     * N06|orig|CST|vICMSDeson|motDesICMS|
912
     * @param stdClass $std
913
     * @return void
914
     */
915
    protected function n06Entity($std)
916
    {
917
        $this->buildNEntity($std);
918
    }
919
920
    /**
921
     * Load fields for tag ICMS [N07]
922
     * N07|orig|CST|modBC|pRedBC|vBC|pICMS|vICMSOp|pDif|vICMSDif|vICMS|vBCFCP|pFCP|vFCP|
923
     * @param stdClass $std
924
     * @return void
925
     */
926
    protected function n07Entity($std)
927
    {
928
        $this->buildNEntity($std);
929
    }
930
931
    /**
932
     * Load fields for tag ICMS [N08]
933
     * N08|orig|CST|vBCSTRet|pST|vICMSSTRet|vBCFCPSTRet|pFCPSTRet|vFCPSTRet|
934
     * @param stdClass $std
935
     * @return void
936
     */
937
    protected function n08Entity($std)
938
    {
939
        $this->buildNEntity($std);
940
    }
941
942
    /**
943
     * Load fields for tag ICMS [N09]
944
     * N09|orig|CST|modBC|pRedBC|vBC|pICMS|vICMS|vBCFCP|pFCP|vFCP|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|vICMSDeson|motDesICMS|
945
     * @param stdClass $std
946
     * @return void
947
     */
948 1
    protected function n09Entity($std)
949
    {
950 1
        $this->buildNEntity($std);
951 1
    }
952
953
    /**
954
     * Load fields for tag ICMS [N10]
955
     * N10|orig|CST|modBC|vBC|pRedBC|pICMS|vICMS|vBCFCP|pFCP|vFCP|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|vICMSDeson|motDesICMS|
956
     * @param stdClass $std
957
     * @return void
958
     */
959
    protected function n10Entity($std)
960
    {
961
        $this->buildNEntity($std);
962
    }
963
964
    /**
965
     * Create tag ICMS [N]
966
     * NOTE: adjusted for NT2016_002_v1.30
967
     * @param \stdClass $std
968
     * @return void
969
     */
970 1
    protected function buildNEntity($std)
971
    {
972 1
        $std->item = $this->item;
973 1
        $this->make->tagICMS($std);
974 1
    }
975
976
    /**
977
     * Create tag ICMSPart [N10a]
978
     * N10a|orig|CST|modBC|vBC|pRedBC|pICMS|vICMS|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|pBCOp|UFST|
979
     * @param stdClass $std
980
     * @return void
981
     */
982
    protected function n10aEntity($std)
983
    {
984
        $std->item = $this->item;
985
        $this->make->tagICMSPart($std);
986
    }
987
988
    /**
989
     * Create tag ICMSST [N10b]
990
     * N10b|orig|CST|vBCSTRet|vICMSSTRet|vBCSTDest|vICMSSTDest|vBCFCPSTRet|pFCPSTRet|vFCPSTRet|
991
     * @param stdClass $std
992
     * @return void
993
     */
994
    protected function n10bEntity($std)
995
    {
996
        $std->item = $this->item;
997
        $this->make->tagICMSST($std);
998
    }
999
1000
    /**
1001
     * Carrega e Create tag ICMSSN [N10c]
1002
     * N10c|orig|CSOSN|pCredSN|vCredICMSSN|
1003
     * @param stdClass $std
1004
     * @return void
1005
     */
1006
    protected function n10cEntity($std)
1007
    {
1008
        $this->buildNSNEntity($std);
1009
    }
1010
1011
    /**
1012
     * Carrega e Create tag ICMSSN [N10d]
1013
     * N10d|orig|CSOSN|
1014
     * @param stdClass $std
1015
     * @return void
1016
     */
1017
    protected function n10dEntity($std)
1018
    {
1019
        $this->buildNSNEntity($std);
1020
    }
1021
1022
1023
    /**
1024
     * Carrega e Create tag ICMSSN [N10e]
1025
     * N10e|orig|CSOSN|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|pCredSN|vCredICMSSN|pCredSN|vCredICMSSN|
1026
     * @param stdClass $std
1027
     * @return void
1028
     */
1029
    protected function n10eEntity($std)
1030
    {
1031
        $this->buildNSNEntity($std);
1032
    }
1033
    /**
1034
     * Carrega e Create tag ICMSSN [N10f]
1035
     * N10f|orig|CSOSN|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|
1036
     * @param stdClass $std
1037
     * @return void
1038
     */
1039
    protected function n10fEntity($std)
1040
    {
1041
        $this->buildNSNEntity($std);
1042
    }
1043
1044
    /**
1045
     * Carrega e Create tag ICMSSN [N10g]
1046
     * N10g|orig|CSOSN|vBCSTRet|pST|vICMSSTRet|vBCFCPSTRet|pFCPSTRet|vFCPSTRet|
1047
     * @param stdClass $std
1048
     * @return void
1049
     */
1050
    protected function n10gEntity($std)
1051
    {
1052
        $this->buildNSNEntity($std);
1053
    }
1054
1055
    /**
1056
     * Carrega e Create tag ICMSSN [N10h]
1057
     * N10h|orig|CSOSN|modBC|vBC|pRedBC|pICMS|vICMS|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|pCredSN|vCredICMSSN|
1058
     * @param stdClass $std
1059
     * @return void
1060
     */
1061
    protected function n10hEntity($std)
1062
    {
1063
        $this->buildNSNEntity($std);
1064
    }
1065
1066
    /**
1067
     * Create tag ICMSSN [NS]
1068
     * Nsn|orig|CSOSN|modBC|vBC|pRedBC|pICMS|vICMS|pCredSN|vCredICMSSN|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCSTRet|vICMSSTRet|vBCFCPST|pFCPST|vFCPST|
1069
     * @param stdClass $std
1070
     * @return void
1071
     */
1072
    protected function buildNSNEntity($std)
1073
    {
1074
        $std->item = $this->item;
1075
        $this->make->tagICMSSN($std);
1076
    }
1077
1078
    /**
1079
     * Load field fot tag ICMSUFDest [NA]
1080
     * NA|vBCUFDest|pFCPUFDest|pICMSUFDest|pICMSInter|pICMSInterPart|vFCPUFDest|vICMSUFDest|vICMSFRemet|
1081
     * @param stdClass $std
1082
     * @return void
1083
     */
1084
    protected function naEntity($std)
1085
    {
1086
        $this->buildNAEntity($std);
1087
    }
1088
1089
    /**
1090
     * Create tag ICMSUFDest [NA]
1091
     * @param stdClass $std
1092
     * @return void
1093
     */
1094
    protected function buildNAEntity($std)
1095
    {
1096
        $std->item = $this->item;
1097
        $this->make->tagICMSUFDest($std);
1098
    }
1099
1100
    /**
1101
     * Load fields for tag IPI [O]
1102
     * O|clEnq|CNPJProd|cSelo|qSelo|cEnq|
1103
     * @param stdClass $std
1104
     * @return void
1105
     */
1106 1
    protected function oEntity($std)
1107
    {
1108 1
        $std->item = $this->item;
1109 1
        $this->stdIPI = $std;
1110 1
        $this->stdIPI->CST = null;
1111 1
        $this->stdIPI->vIPI = null;
1112 1
        $this->stdIPI->vBC = null;
1113 1
        $this->stdIPI->pIPI = null;
1114 1
        $this->stdIPI->qUnid = null;
1115 1
        $this->stdIPI->vUnid = null;
1116 1
    }
1117
1118
    /**
1119
     * Load fields for tag IPI [O07], belongs to [O]
1120
     * O07|CST|vIPI|
1121
     * @param stdClass $std
1122
     * @return void
1123
     */
1124 1
    protected function o07Entity($std)
1125
    {
1126 1
        $this->stdIPI->CST = $std->CST;
1127 1
        $this->stdIPI->vIPI = $std->vIPI;
1128 1
    }
1129
1130
    /**
1131
     * Load fields for tag IPI [O08], belongs to [O]
1132
     * O08|CST|
1133
     * @param stdClass $std
1134
     * @return void
1135
     */
1136 1
    protected function o08Entity($std)
1137
    {
1138 1
        $this->stdIPI->CST = $std->CST;
1139 1
        $this->buildOEntity();
1140 1
    }
1141
1142
    /**
1143
     * Load fields for tag IPI [O10], belongs to [O]
1144
     * O10|vBC|pIPI|
1145
     * @param stdClass $std
1146
     * @return void
1147
     */
1148 1
    protected function o10Entity($std)
1149
    {
1150 1
        $this->stdIPI->vBC = $std->vBC;
1151 1
        $this->stdIPI->pIPI = $std->pIPI;
1152 1
        $this->buildOEntity();
1153 1
    }
1154
1155
    /**
1156
     * Load fields for tag IPI [O11], belongs to [O]
1157
     * O11|qUnid|vUnid|
1158
     * @param stdClass $std
1159
     * @return void
1160
     */
1161
    protected function o11Entity($std)
1162
    {
1163
        $this->stdIPI->qUnid = $std->qUnid;
1164
        $this->stdIPI->vUnid = $std->vUnid;
1165
        $this->buildOEntity();
1166
    }
1167
1168
    /**
1169
     * Create tag IPI [O]
1170
     * Oxx|cst|clEnq|cnpjProd|cSelo|qSelo|cEnq|vBC|pIPI|qUnid|vUnid|vIPI|
1171
     * @return void
1172
     */
1173 1
    protected function buildOEntity()
1174
    {
1175 1
        $this->make->tagIPI($this->stdIPI);
1176 1
    }
1177
1178
    /**
1179
     * Create tag II [P]
1180
     * P|vBC|vDespAdu|vII|vIOF|
1181
     * @param stdClass $std
1182
     * @return void
1183
     */
1184
    protected function pEntity($std)
1185
    {
1186
        $std->item = $this->item;
1187
        $this->make->tagII($std);
1188
    }
1189
1190
    /**
1191
     * Load fields for tag PIS [Q]
1192
     * Q|
1193
     * @param stdClass $std
1194
     * @return void
1195
     */
1196 1
    protected function qEntity($std)
1197
    {
1198
        //carrega numero do item
1199 1
        $std->item = $this->item;
1200 1
        $this->stdPIS = $std;
1201 1
        $this->stdPIS->vBC = null;
1202 1
        $this->stdPIS->pPIS = null;
1203 1
        $this->stdPIS->vPIS = null;
1204 1
        $this->stdPIS->qBCProd = null;
1205 1
        $this->stdPIS->vAliqProd = null;
1206 1
    }
1207
1208
    /**
1209
     * Load fields for tag PIS [Q02], belongs to [Q]
1210
     * Q02|CST|vBC|pPIS|vPIS|
1211
     * @param stdClass $std
1212
     * @return void
1213
     */
1214 1
    protected function q02Entity($std)
1215
    {
1216 1
        $this->stdPIS->CST = $std->CST;
1217 1
        $this->stdPIS->vBC = $std->vBC;
1218 1
        $this->stdPIS->pPIS = $std->pPIS;
1219 1
        $this->stdPIS->vPIS = $std->vPIS;
1220 1
        $this->buildQEntity();
1221 1
    }
1222
1223
    /**
1224
     * Load fields for tag PIS [Q03], belongs to [Q]
1225
     * Q03|CST|qBCProd|vAliqProd|vPIS|
1226
     * @param stdClass $std
1227
     * @return void
1228
     */
1229
    protected function q03Entity($std)
1230
    {
1231
        $this->stdPIS->CST = $std->CST;
1232
        $this->stdPIS->vPIS = $std->vPIS;
1233
        $this->stdPIS->qBCProd = $std->qBCProd;
1234
        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1235
        $this->buildQEntity();
1236
    }
1237
1238
    /**
1239
     * Load fields for tag PIS [Q04], belongs to [Q]
1240
     * Q04|CST|
1241
     * @param stdClass $std
1242
     * @return void
1243
     */
1244
    protected function q04Entity($std)
1245
    {
1246
        $this->stdPIS->CST = $std->CST;
1247
        $this->buildQEntity();
1248
    }
1249
1250
    /**
1251
     * Load fields for tag PIS [Q05], belongs to [Q]
1252
     * Q05|CST|vPIS|
1253
     * @param stdClass $std
1254
     * @return void
1255
     */
1256
    protected function q05Entity($std)
1257
    {
1258
        $this->stdPIS->CST = $std->CST;
1259
        $this->stdPIS->vPIS = $std->vPIS;
1260
        $this->buildQEntity();
1261
    }
1262
1263
    /**
1264
     * Load fields for tag PIS [Q07], belongs to [Q]
1265
     * Q07|vBC|pPIS|
1266
     * @param stdClass $std
1267
     * @return void
1268
     */
1269
    protected function q07Entity($std)
1270
    {
1271
        $this->stdPIS->vBC = $std->vBC;
1272
        $this->stdPIS->pPIS = $std->pPIS;
1273
        $this->buildQEntity();
1274
    }
1275
1276
    /**
1277
     * Load fields for tag PIS [Q10], belongs to [Q]
1278
     * Q10|qBCProd|vAliqProd|
1279
     * @param stdClass $std
1280
     * @return void
1281
     */
1282
    protected function q10Entity($std)
1283
    {
1284
        $this->stdPIS->qBCProd = $std->qBCProd;
1285
        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1286
        $this->buildQEntity();
1287
    }
1288
1289
    /**
1290
     * Create tag PIS [Q]
1291
     * Qxx|CST|vBC|pPIS|vPIS|qBCProd|vAliqProd|
1292
     * @return void
1293
     */
1294 1
    protected function buildQEntity()
1295
    {
1296 1
        $this->make->tagPIS($this->stdPIS);
1297 1
    }
1298
1299
    /**
1300
     * Load fields for tag PISST [R]
1301
     * R|vPIS|
1302
     * @param stdClass $std
1303
     * @return void
1304
     */
1305
    protected function rEntity($std)
1306
    {
1307
        //carrega numero do item
1308
        $std->item = $this->item;
1309
        $this->stdPISST = $std;
1310
        $this->stdPISST->vBC = null;
1311
        $this->stdPISST->pPIS = null;
1312
        $this->stdPISST->vPIS = null;
1313
        $this->stdPISST->qBCProd = null;
1314
        $this->stdPISST->vAliqProd = null;
1315
    }
1316
1317
    /**
1318
     * Load fields for tag PISST [R02], belongs to [R]
1319
     * R02|vBC|pPIS|
1320
     * @param stdClass $std
1321
     * @return void
1322
     */
1323
    protected function r02Entity($std)
1324
    {
1325
        $this->stdPISST->vBC = $std->vBC;
1326
        $this->stdPISST->pPIS = $std->pPIS;
1327
        $this->buildREntity();
1328
    }
1329
1330
    /**
1331
     * Load fields for tag PISST [R04], belongs to [R]
1332
     * R04|qBCProd|vAliqProd|vPIS|
1333
     * @param stdClass $std
1334
     * @return void
1335
     */
1336
    protected function r04Entity($std)
1337
    {
1338
        $this->stdPISST->qBCProd = $std->qBCProd;
1339
        $this->stdPISST->vAliqProd = $std->vAliqProd;
1340
        $this->stdPISST->vPIS = $std->vPIS;
1341
        $this->buildREntity();
1342
    }
1343
1344
    /**
1345
     * Create tag PISST
1346
     * Rxx|vBC|pPIS|qBCProd|vAliqProd|vPIS|
1347
     * @return void
1348
     */
1349
    protected function buildREntity()
1350
    {
1351
        $this->make->tagPISST($this->stdPISST);
1352
    }
1353
1354
    /**
1355
     * Load fields for tag COFINS [S]
1356
     * S|
1357
     * @param stdClass $std
1358
     * @return void
1359
     */
1360 1
    protected function sEntity($std)
1361
    {
1362
        //carrega numero do item
1363 1
        $std->item = $this->item;
1364 1
        $this->stdCOFINS = $std;
1365 1
        $this->stdCOFINS->vBC = null;
1366 1
        $this->stdCOFINS->pCOFINS = null;
1367 1
        $this->stdCOFINS->vCOFINS = null;
1368 1
        $this->stdCOFINS->qBCProd = null;
1369 1
        $this->stdCOFINS->vAliqProd = null;
1370 1
    }
1371
1372
    /**
1373
     * Load fields for tag COFINS [S02], belongs to [S]
1374
     * S02|CST|vBC|pCOFINS|vCOFINS|
1375
     * @param stdClass $std
1376
     * @return void
1377
     */
1378 1
    protected function s02Entity($std)
1379
    {
1380 1
        $this->stdCOFINS->CST = $std->CST;
1381 1
        $this->stdCOFINS->vBC = $std->vBC;
1382 1
        $this->stdCOFINS->pCOFINS = $std->pCOFINS;
1383 1
        $this->stdCOFINS->vCOFINS = $std->vCOFINS;
1384 1
        $this->buildSEntity();
1385 1
    }
1386
1387
    /**
1388
     * Load fields for tag COFINS [S03], belongs to [S]
1389
     * S03|CST|qBCProd|vAliqProd|vCOFINS|
1390
     * @param stdClass $std
1391
     * @return void
1392
     */
1393
    protected function s03Entity($std)
1394
    {
1395
        $this->stdCOFINS->CST = $std->CST;
1396
        $this->stdCOFINS->qBCProd = $std->qBCProd;
1397
        $this->stdCOFINS->vAliqProd = $std->vAliqProd;
1398
        $this->stdCOFINS->vCOFINS = $std->vCOFINS;
1399
        $this->buildSEntity();
1400
    }
1401
1402
    /**
1403
     * Load fields for tag COFINS [S04], belongs to [S]
1404
     * S04|CST|
1405
     * @param stdClass $std
1406
     * @return void
1407
     */
1408
    protected function s04Entity($std)
1409
    {
1410
        $this->stdCOFINS->CST = $std->CST;
1411
        $this->buildSEntity();
1412
    }
1413
1414
    /**
1415
     * Load fields for tag COFINS [S05], belongs to [S]
1416
     * S05|CST|vCOFINS|
1417
     * @param stdClass $std
1418
     * @return void
1419
     */
1420
    protected function s05Entity($std)
1421
    {
1422
        $this->stdCOFINS->CST = $std->CST;
1423
        $this->stdCOFINS->vCOFINS = $std->vCOFINS;
1424
    }
1425
1426
    /**
1427
     * Load fields for tag COFINS [S07], belongs to [S]
1428
     * S07|vBC|pCOFINS|
1429
     * @param stdClass $std
1430
     * @return void
1431
     */
1432
    protected function s07Entity($std)
1433
    {
1434
        $this->stdCOFINS->vBC = $std->vBC;
1435
        $this->stdCOFINS->pCOFINS = $std->pCOFINS;
1436
        $this->buildSEntity();
1437
    }
1438
1439
    /**
1440
     * Load fields for tag COFINS [S09], belongs to [S]
1441
     * S09|qBCProd|vAliqProd|
1442
     * @param stdClass $std
1443
     * @return void
1444
     */
1445
    protected function s09Entity($std)
1446
    {
1447
        $this->stdCOFINS->qBCProd = $std->qBCProd;
1448
        $this->stdCOFINS->vAliqProd = $std->vAliqProd;
1449
        $this->buildSEntity();
1450
    }
1451
1452
    /**
1453
     * Create tag COFINS [S]
1454
     * Sxx|CST|vBC|pCOFINS|vCOFINS|qBCProd|vAliqProd|
1455
     * @return void
1456
     */
1457 1
    protected function buildSEntity()
1458
    {
1459 1
        $this->make->tagCOFINS($this->stdCOFINS);
1460 1
    }
1461
1462
    /**
1463
     * Load fields for tag COFINSST [T]
1464
     * T|vCOFINS|
1465
     * @param stdClass $std
1466
     * @return void
1467
     */
1468
    protected function tEntity($std)
1469
    {
1470
        //carrega numero do item
1471
        $std->item = $this->item;
1472
        $this->stdCOFINSST = $std;
1473
        $this->stdCOFINSST->vBC = null;
1474
        $this->stdCOFINSST->pCOFINS = null;
1475
        $this->stdCOFINSST->vCOFINS = null;
1476
        $this->stdCOFINSST->qBCProd = null;
1477
        $this->stdCOFINSST->vAliqProd = null;
1478
    }
1479
1480
    /**
1481
     * Load fields for tag COFINSST [T02], belongs to [T]
1482
     * T02|vBC|pCOFINS|
1483
     * @param stdClass $std
1484
     * @return void
1485
     */
1486
    protected function t02Entity($std)
1487
    {
1488
        $this->stdCOFINSST->vBC = $std->vBC;
1489
        $this->stdCOFINSST->pCOFINS = $std->pCOFINS;
1490
        $this->buildTEntity();
1491
    }
1492
1493
    /**
1494
     * Load fields for tag COFINSST [T04], belongs to [T]
1495
     * T04|qBCProd|vAliqProd|
1496
     * @param stdClass $std
1497
     * @return void
1498
     */
1499
    protected function t04Entity($std)
1500
    {
1501
        $this->stdCOFINSST->qBCProd = $std->qBCProd;
1502
        $this->stdCOFINSST->vAliqProd = $std->vAliqProd;
1503
        $this->buildTEntity();
1504
    }
1505
1506
    /**
1507
     * Create tag COFINSST [T]
1508
     * Txx|vBC|pCOFINS|qBCProd|vAliqProd|vCOFINS|
1509
     * @return void
1510
     */
1511
    protected function buildTEntity()
1512
    {
1513
        $this->stdCOFINSST->item = $this->item;
1514
        $this->make->tagCOFINSST($this->stdCOFINSST);
1515
    }
1516
1517
    /**
1518
     * Create tag ISSQN [U]
1519
     * U|vBC|vAliq|vISSQN|cMunFG|cListServ|vDeducao|vOutro|vDescIncond
1520
     *  |vDescCond|vISSRet|indISS|cServico|cMun|cPais|nProcesso|indIncentivo|
1521
     * @param stdClass $std
1522
     * @return void
1523
     */
1524
    protected function uEntity($std)
1525
    {
1526
        $std->item = $this->item;
1527
        $this->make->tagISSQN($std);
1528
    }
1529
1530
    /**
1531
     * Create tag tagimpostoDevol [UA]
1532
     * UA|pDevol|vIPIDevol|
1533
     * @param stdClass $std
1534
     * @return void
1535
     */
1536
    protected function uaEntity($std)
1537
    {
1538
        $std->item = $this->item;
1539
        $this->make->tagimpostoDevol($std);
1540
    }
1541
1542
    /**
1543
     * Linha W [W]
1544
     * W|
1545
     * @param stdClass $std
1546
     * @return void
1547
     */
1548 1
    protected function wEntity($std)
1549
    {
1550
        //fake não faz nada
1551 1
        $field = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $field is dead and can be removed.
Loading history...
1552 1
    }
1553
1554
    /**
1555
     * Cria tag ICMSTot [W02], belongs to [W]
1556
     * W02|vBC|vICMS|vICMSDeson|vFCP|vBCST|vST|vFCPST|vFCPSTRet|vProd|vFrete|vSeg|vDesc|vII|vIPI|vIPIDevol|vPIS|vCOFINS|vOutro|vNF|vTotTrib|vFCPUFDest|vICMSUFDest|vICMSUFRemet|
1557
     * @param stdClass $std
1558
     * @return void
1559
     */
1560 1
    protected function w02Entity($std)
1561
    {
1562 1
        $this->make->tagICMSTot($std);
1563 1
    }
1564
1565
    protected function w04cEntity($std)
1566
    {
1567
    }
1568
1569
    protected function w04eEntity($std)
1570
    {
1571
    }
1572
1573
    protected function w04gEntity($std)
1574
    {
1575
    }
1576
1577
    /**
1578
     * Create tag ISSQNTot [W17], belongs to [W]
1579
     * W17|vServ|vBC|vISS|vPIS|vCOFINS|dCompet|vDeducao|vOutro|vDescIncond
1580
     *    |vDescCond|vISSRet|cRegTrib|
1581
     * @param stdClass $std
1582
     * @return void
1583
     */
1584
    protected function w17Entity($std)
1585
    {
1586
        $this->make->tagISSQNTot($std);
1587
    }
1588
1589
    /**
1590
     * Create tag retTrib [W23], belongs to [W]
1591
     * W23|vRetPIS|vRetCOFINS|vRetCSLL|vBCIRRF|vIRRF|vBCRetPrev|vRetPrev|
1592
     * @param stdClass $std
1593
     * @return void
1594
     */
1595
    protected function w23Entity($std)
1596
    {
1597
        $this->make->tagretTrib($std);
1598
    }
1599
1600
    /**
1601
     * Create tag transp [X]
1602
     * X|modFrete|
1603
     * @param stdClass $std
1604
     * @return void
1605
     */
1606 1
    protected function xEntity($std)
1607
    {
1608 1
        $this->make->tagtransp($std);
1609 1
    }
1610
1611
    /**
1612
     * Load fields for tag transporta [X03], belongs to [X]
1613
     * X03|xNome|IE|xEnder|xMun|UF|
1614
     * @param stdClass $std
1615
     * @return void
1616
     */
1617 1
    protected function x03Entity($std)
1618
    {
1619 1
        $this->stdTransporta = $std;
1620 1
    }
1621
1622
    /**
1623
     * Load fields for tag transporta [X04], with CNPJ, belonsgs to [X03]
1624
     * X04|CNPJ|
1625
     * @param stdClass $std
1626
     * @return void
1627
     */
1628 1
    protected function x04Entity($std)
1629
    {
1630 1
        $this->stdTransporta->CNPJ = $std->CNPJ;
1631 1
        $this->stdTransporta->CPF = null;
1632 1
        $this->make->tagtransporta($this->stdTransporta);
0 ignored issues
show
Bug introduced by
It seems like $this->stdTransporta can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagtransporta() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1632
        $this->make->tagtransporta(/** @scrutinizer ignore-type */ $this->stdTransporta);
Loading history...
1633 1
        $this->stdTransporta = null;
1634 1
    }
1635
1636
    /**
1637
     * Load fields for tag transporta [X05], with CPF, belonsgs to [X03]
1638
     * X05|CPF|
1639
     * @param stdClass $std
1640
     * @return void
1641
     */
1642
    protected function x05Entity($std)
1643
    {
1644
        $this->stdTransporta->CPF = $std->CPF;
1645
        $this->stdTransporta->CNPJ = null;
1646
        $this->make->tagtransporta($this->stdTransporta);
0 ignored issues
show
Bug introduced by
It seems like $this->stdTransporta can also be of type null; however, parameter $std of NFePHP\NFe\Make::tagtransporta() does only seem to accept stdClass, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

1646
        $this->make->tagtransporta(/** @scrutinizer ignore-type */ $this->stdTransporta);
Loading history...
1647
        $this->stdTransporta = null;
1648
    }
1649
1650
    /**
1651
     * Load fields for tag retTransp [X11], belongs to [X]
1652
     * X11|vServ|vBCRet|pICMSRet|vICMSRet|CFOP|cMunFG|
1653
     * @param stdClass $std
1654
     * @return void
1655
     */
1656
    protected function x11Entity($std)
1657
    {
1658
        $this->make->tagretTransp($std);
1659
    }
1660
1661
    /**
1662
     * Create tag veicTransp [X18], belongs to [X]
1663
     * X18|placa|UF|RNTC|
1664
     * @param stdClass $std
1665
     * @return void
1666
     */
1667
    protected function x18Entity($std)
1668
    {
1669
        $this->make->tagveicTransp($std);
1670
    }
1671
1672
    /**
1673
     * Create tag reboque [X22], belogns to [X]
1674
     * X22|placa|UF|RNTC|
1675
     * @param stdClass $std
1676
     * @return void
1677
     */
1678
    protected function x22Entity($std)
1679
    {
1680
        $this->make->tagreboque($std);
1681
    }
1682
1683
    /**
1684
     * Create tag vagao [X25a], belogns to [X01]
1685
     * X25a|vagao|
1686
     * @param stdClass $std
1687
     * @return void
1688
     */
1689
    protected function x25aEntity($std)
1690
    {
1691
        $this->make->tagvagao($std);
1692
    }
1693
1694
    /**
1695
     * Create tag balsa [X25b], belogns to [X01]
1696
     * X25b|balsa|
1697
     * @param stdClass $std
1698
     * @return void
1699
     */
1700
    protected function x25bEntity($std)
1701
    {
1702
        $this->make->tagbalsa($std);
1703
    }
1704
1705
    /**
1706
     * Create tag vol [X26], belongs to [X]
1707
     * X26|qVol|esp|marca|nVol|pesoL|pesoB|
1708
     * @param stdClass $std
1709
     * @return void
1710
     */
1711 1
    protected function x26Entity($std)
1712
    {
1713 1
        $this->volId += 1;
1714 1
        $std->item = $this->volId;
1715 1
        $this->make->tagvol($std);
1716 1
    }
1717
1718
    /**
1719
     * Create tag lacre [X33], belongs to [X]
1720
     * X33|nLacre|
1721
     * @param stdClass $std
1722
     * @return void
1723
     */
1724
    protected function x33Entity($std)
1725
    {
1726
        $std->item = $this->volId;
1727
        $this->make->taglacres($std);
1728
    }
1729
1730
    /**
1731
     * Create tag vol
1732
     * @param stdClass $std
1733
     * @return void
1734
     */
1735
    protected function buildVolEntity($std)
1736
    {
1737
        $this->make->tagvol($std);
1738
    }
1739
1740
    /**
1741
     * yEntity [Y]
1742
     *
1743
     * LOCAL
1744
     * Y|vTroco|
1745
     * @param stdClass $std
1746
     * @return void
1747
     */
1748 1
    protected function yEntity($std)
1749
    {
1750 1
        if ($this->baselayout !== 'SEBRAE') {
1751 1
            $this->make->tagpag($std);
1752
        }
1753 1
    }
1754
1755
    /**
1756
     * Create tag fat [Y02]
1757
     * Y02|nFat|vOrig|vDesc|vLiq|
1758
     * @param stdClass $std
1759
     * @return void
1760
     */
1761 1
    protected function y02Entity($std)
1762
    {
1763 1
        $this->make->tagfat($std);
1764 1
    }
1765
1766
    /**
1767
     * Create tag dup [Y07]
1768
     * Y07|nDup|dVenc|vDup|
1769
     * @param stdClass $std
1770
     * @return void
1771
     */
1772 1
    protected function y07Entity($std)
1773
    {
1774 1
        $this->make->tagdup($std);
1775 1
    }
1776
1777
    /**
1778
     * Creates tag detPag and card [YA]
1779
     * YA|tPag|vPag|CNPJ|tBand|cAut|tpIntegra|xPag|
1780
     * SEBRAE
1781
     * YA|troco|
1782
     *
1783
     * @param stdClass $std
1784
     *
1785
     * @return void
1786
     */
1787 1
    protected function yaEntity($std)
1788
    {
1789 1
        if ($this->baselayout === 'SEBRAE') {
1790
            $this->make->tagpag($std);
1791
        } else {
1792 1
            $this->make->tagdetPag($std);
1793
        }
1794 1
    }
1795
1796
    /**
1797
     * Creates tag detPag and card [YA]
1798
     * SEBRAE
1799
     * YA01|indPag|tPag|vPag|"
1800
     *
1801
     * @param stdClass $std
1802
     */
1803
    protected function ya01Entity($std)
1804
    {
1805
        $this->make->tagdetPag($std);
1806
    }
1807
1808
    /**
1809
     * Create tag infIntermed [YB]
1810
     * YB|CNPJ|idCadIntTran
1811
     *
1812
     * @param stdClass $std
1813
     */
1814
    protected function ybEntity($std)
1815
    {
1816
        $this->make->tagIntermed($std);
1817
    }
1818
1819
    /**
1820
     * Create a tag infAdic [Z]
1821
     * Z|infAdFisco|infCpl|
1822
     *
1823
     * @param stdClass $std
1824
     *
1825
     * @return void
1826
     */
1827 1
    protected function zEntity($std)
1828
    {
1829 1
        $this->make->taginfAdic($std);
1830 1
    }
1831
1832
    /**
1833
     * Create tag obsCont [Z04]
1834
     * Z04|xCampo|xTexto|
1835
     * @param stdClass $std
1836
     * @return void
1837
     */
1838
    protected function z04Entity($std)
1839
    {
1840
        $this->make->tagobsCont($std);
1841
    }
1842
1843
    /**
1844
     * Create tag obsFisco [Z07]
1845
     * Z07|xCampo|xTexto|
1846
     * @param stdClass $std
1847
     * @return void
1848
     */
1849
    protected function z07Entity($std)
1850
    {
1851
        $this->make->tagobsFisco($std);
1852
    }
1853
1854
    /**
1855
     * Create tag procRef [Z10]
1856
     * Z10|nProc|indProc|
1857
     * @param stdClass $std
1858
     * @return void
1859
     */
1860
    protected function z10Entity($std)
1861
    {
1862
        $this->make->tagprocRef($std);
1863
    }
1864
1865
    /**
1866
     * Create tag exporta [ZA]
1867
     * ZA|UFSaidaPais|xLocExporta|xLocDespacho|
1868
     * @param stdClass $std
1869
     * @return void
1870
     */
1871
    protected function zaEntity($std)
1872
    {
1873
        $this->make->tagexporta($std);
1874
    }
1875
1876
    /**
1877
     * Create tag compra [ZB]
1878
     * ZB|xNEmp|xPed|xCont|
1879
     * @param stdClass $std
1880
     * @return void
1881
     */
1882
    protected function zbEntity($std)
1883
    {
1884
        $this->make->tagcompra($std);
1885
    }
1886
1887
    /**
1888
     * Create tag cana [ZC]
1889
     * ZC|safra|ref|qTotMes|qTotAnt|qTotGer|vFor|vTotDed|vLiqFor|
1890
     * @param stdClass $std
1891
     * @return void
1892
     */
1893
    protected function zcEntity($std)
1894
    {
1895
        $this->make->tagcana($std);
1896
    }
1897
1898
    /**
1899
     * Create tag forDia [ZC04]
1900
     * ZC04|dia|qtde|
1901
     * @param stdClass $std
1902
     * @return void
1903
     */
1904
    protected function zc04Entity($std)
1905
    {
1906
        $this->make->tagforDia($std);
1907
    }
1908
1909
    /**
1910
     * Create tag deduc [ZC10]
1911
     * ZC10|xDed|vDed|
1912
     * @param stdClass $std
1913
     * @return void
1914
     */
1915
    protected function zc10Entity($std)
1916
    {
1917
        $this->make->tagdeduc($std);
1918
    }
1919
1920
    /**
1921
     * Create tag infRespTec [ZD01]
1922
     * ZD|CNPJ|xContato|email|fone|CSRTidCSRT|
1923
     * @param stdClass $std
1924
     * @return void
1925
     */
1926
    protected function zdEntity($std)
1927
    {
1928
        $this->make->taginfRespTec($std);
1929
    }
1930
1931
    /**
1932
     * Create tag infNFeSupl com o qrCode para impressão da DANFCE [ZX01]
1933
     * ZX01|qrcode|urlChave|
1934
     * @param stdClass $std
1935
     * @return void
1936
     */
1937
    protected function zx01Entity($std)
1938
    {
1939
        $this->make->taginfNFeSupl($std);
1940
    }
1941
}
1942