|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\eSocial\Factories\Traits; |
|
4
|
|
|
|
|
5
|
|
|
trait TraitS1000 |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* builder for version 2.5.0 |
|
9
|
|
|
*/ |
|
10
|
|
|
protected function toNode250() |
|
11
|
|
|
{ |
|
12
|
|
|
$ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
|
|
|
|
|
|
13
|
|
|
//o idEvento pode variar de evento para evento |
|
14
|
|
|
//então cada factory individualmente terá de construir o seu |
|
15
|
|
|
$ideEvento = $this->dom->createElement("ideEvento"); |
|
|
|
|
|
|
16
|
|
|
$this->dom->addChild( |
|
17
|
|
|
$ideEvento, |
|
18
|
|
|
"tpAmb", |
|
19
|
|
|
$this->tpAmb, |
|
|
|
|
|
|
20
|
|
|
true |
|
21
|
|
|
); |
|
22
|
|
|
$this->dom->addChild( |
|
23
|
|
|
$ideEvento, |
|
24
|
|
|
"procEmi", |
|
25
|
|
|
$this->procEmi, |
|
|
|
|
|
|
26
|
|
|
true |
|
27
|
|
|
); |
|
28
|
|
|
$this->dom->addChild( |
|
29
|
|
|
$ideEvento, |
|
30
|
|
|
"verProc", |
|
31
|
|
|
$this->verProc, |
|
|
|
|
|
|
32
|
|
|
true |
|
33
|
|
|
); |
|
34
|
|
|
$this->node->insertBefore($ideEvento, $ideEmpregador); |
|
35
|
|
|
$infoEmpregador = $this->dom->createElement("infoEmpregador"); |
|
36
|
|
|
//periodo |
|
37
|
|
|
$idePeriodo = $this->dom->createElement("idePeriodo"); |
|
38
|
|
|
$this->dom->addChild( |
|
39
|
|
|
$idePeriodo, |
|
40
|
|
|
"iniValid", |
|
41
|
|
|
$this->std->ideperiodo->inivalid, |
|
|
|
|
|
|
42
|
|
|
true |
|
43
|
|
|
); |
|
44
|
|
|
$this->dom->addChild( |
|
45
|
|
|
$idePeriodo, |
|
46
|
|
|
"fimValid", |
|
47
|
|
|
!empty($this->std->ideperiodo->fimvalid) ? $this->std->ideperiodo->fimvalid : '', |
|
48
|
|
|
false |
|
49
|
|
|
); |
|
50
|
|
|
//infoCadastro |
|
51
|
|
|
if (isset($this->std->infocadastro)) { |
|
52
|
|
|
$cad = $this->std->infocadastro; |
|
53
|
|
|
$infoCadastro = $this->dom->createElement("infoCadastro"); |
|
54
|
|
|
$this->dom->addChild( |
|
55
|
|
|
$infoCadastro, |
|
56
|
|
|
"nmRazao", |
|
57
|
|
|
$cad->nmrazao, |
|
58
|
|
|
true |
|
59
|
|
|
); |
|
60
|
|
|
$this->dom->addChild( |
|
61
|
|
|
$infoCadastro, |
|
62
|
|
|
"classTrib", |
|
63
|
|
|
$cad->classtrib, |
|
64
|
|
|
true |
|
65
|
|
|
); |
|
66
|
|
|
$this->dom->addChild( |
|
67
|
|
|
$infoCadastro, |
|
68
|
|
|
"natJurid", |
|
69
|
|
|
!empty($cad->natjurid) ? $cad->natjurid : null, |
|
70
|
|
|
($this->tpInsc == 1) ? true : false //obrigatorio para pessoa juridica |
|
|
|
|
|
|
71
|
|
|
); |
|
72
|
|
|
$this->dom->addChild( |
|
73
|
|
|
$infoCadastro, |
|
74
|
|
|
"indCoop", |
|
75
|
|
|
isset($cad->indcoop) ? $cad->indcoop : null, |
|
76
|
|
|
($this->tpInsc == 1) ? true : false //obrigatorio para pessoa juridica |
|
77
|
|
|
); |
|
78
|
|
|
$this->dom->addChild( |
|
79
|
|
|
$infoCadastro, |
|
80
|
|
|
"indConstr", |
|
81
|
|
|
isset($cad->indconstr) ? $cad->indconstr : null, |
|
82
|
|
|
($this->tpInsc == 1) ? true : false //obrigatorio para pessoa juridica |
|
83
|
|
|
); |
|
84
|
|
|
$this->dom->addChild( |
|
85
|
|
|
$infoCadastro, |
|
86
|
|
|
"indDesFolha", |
|
87
|
|
|
$cad->inddesfolha, |
|
88
|
|
|
true |
|
89
|
|
|
); |
|
90
|
|
|
$this->dom->addChild( |
|
91
|
|
|
$infoCadastro, |
|
92
|
|
|
"indOpcCP", |
|
93
|
|
|
!empty($cad->indopccp) ? $cad->indopccp : null, |
|
94
|
|
|
false |
|
95
|
|
|
); |
|
96
|
|
|
$this->dom->addChild( |
|
97
|
|
|
$infoCadastro, |
|
98
|
|
|
"indPorte", |
|
99
|
|
|
!empty($cad->indporte) ? $cad->indporte : null, |
|
100
|
|
|
false |
|
101
|
|
|
); |
|
102
|
|
|
$this->dom->addChild( |
|
103
|
|
|
$infoCadastro, |
|
104
|
|
|
"indOptRegEletron", |
|
105
|
|
|
$cad->indoptregeletron, |
|
106
|
|
|
true |
|
107
|
|
|
); |
|
108
|
|
|
$this->dom->addChild( |
|
109
|
|
|
$infoCadastro, |
|
110
|
|
|
"indEntEd", |
|
111
|
|
|
!empty($cad->indented) ? $cad->indented : null, |
|
112
|
|
|
false |
|
113
|
|
|
); |
|
114
|
|
|
$this->dom->addChild( |
|
115
|
|
|
$infoCadastro, |
|
116
|
|
|
"indEtt", |
|
117
|
|
|
!empty($cad->indett) ? $cad->indett : null, |
|
118
|
|
|
false |
|
119
|
|
|
); |
|
120
|
|
|
$this->dom->addChild( |
|
121
|
|
|
$infoCadastro, |
|
122
|
|
|
"nrRegEtt", |
|
123
|
|
|
!empty($cad->nrregett) ? $cad->nrregett : null, |
|
124
|
|
|
false |
|
125
|
|
|
); |
|
126
|
|
|
} |
|
127
|
|
|
if (isset($this->std->dadosisencao) && !empty($infoCadastro)) { |
|
128
|
|
|
$cad = $this->std->dadosisencao; |
|
129
|
|
|
$info = $this->dom->createElement("dadosIsencao"); |
|
130
|
|
|
$this->dom->addChild( |
|
131
|
|
|
$info, |
|
132
|
|
|
"ideMinLei", |
|
133
|
|
|
$cad->ideminlei, |
|
134
|
|
|
true |
|
135
|
|
|
); |
|
136
|
|
|
$this->dom->addChild( |
|
137
|
|
|
$info, |
|
138
|
|
|
"nrCertif", |
|
139
|
|
|
$cad->nrcertif, |
|
140
|
|
|
true |
|
141
|
|
|
); |
|
142
|
|
|
$this->dom->addChild( |
|
143
|
|
|
$info, |
|
144
|
|
|
"dtEmisCertif", |
|
145
|
|
|
$cad->dtemiscertif, |
|
146
|
|
|
true |
|
147
|
|
|
); |
|
148
|
|
|
$this->dom->addChild( |
|
149
|
|
|
$info, |
|
150
|
|
|
"dtVencCertif", |
|
151
|
|
|
$cad->dtvenccertif, |
|
152
|
|
|
true |
|
153
|
|
|
); |
|
154
|
|
|
$this->dom->addChild( |
|
155
|
|
|
$info, |
|
156
|
|
|
"nrProtRenov", |
|
157
|
|
|
!empty($cad->nrprotrenov) ? $cad->nrprotrenov : null, |
|
158
|
|
|
false |
|
159
|
|
|
); |
|
160
|
|
|
$this->dom->addChild( |
|
161
|
|
|
$info, |
|
162
|
|
|
"dtProtRenov", |
|
163
|
|
|
!empty($cad->dtprotrenov) ? $cad->dtprotrenov : null, |
|
164
|
|
|
false |
|
165
|
|
|
); |
|
166
|
|
|
$this->dom->addChild( |
|
167
|
|
|
$info, |
|
168
|
|
|
"dtDou", |
|
169
|
|
|
!empty($cad->dtdou) ? $cad->dtdou : null, |
|
170
|
|
|
false |
|
171
|
|
|
); |
|
172
|
|
|
$this->dom->addChild( |
|
173
|
|
|
$info, |
|
174
|
|
|
"pagDou", |
|
175
|
|
|
!empty($cad->pagdou) ? $cad->pagdou : null, |
|
176
|
|
|
false |
|
177
|
|
|
); |
|
178
|
|
|
$infoCadastro->appendChild($info); |
|
179
|
|
|
} |
|
180
|
|
|
if (isset($this->std->contato) && !empty($infoCadastro)) { |
|
181
|
|
|
$cad = $this->std->contato; |
|
182
|
|
|
$info = $this->dom->createElement("contato"); |
|
183
|
|
|
$this->dom->addChild( |
|
184
|
|
|
$info, |
|
185
|
|
|
"nmCtt", |
|
186
|
|
|
$cad->nmctt, |
|
187
|
|
|
true |
|
188
|
|
|
); |
|
189
|
|
|
$this->dom->addChild( |
|
190
|
|
|
$info, |
|
191
|
|
|
"cpfCtt", |
|
192
|
|
|
$cad->cpfctt, |
|
193
|
|
|
true |
|
194
|
|
|
); |
|
195
|
|
|
$this->dom->addChild( |
|
196
|
|
|
$info, |
|
197
|
|
|
"foneFixo", |
|
198
|
|
|
!empty($cad->fonefixo) ? $cad->fonefixo : '', |
|
199
|
|
|
false |
|
200
|
|
|
); |
|
201
|
|
|
$this->dom->addChild( |
|
202
|
|
|
$info, |
|
203
|
|
|
"foneCel", |
|
204
|
|
|
!empty($cad->fonecel) ? $cad->fonecel : null, |
|
205
|
|
|
false |
|
206
|
|
|
); |
|
207
|
|
|
$this->dom->addChild( |
|
208
|
|
|
$info, |
|
209
|
|
|
"email", |
|
210
|
|
|
!empty($cad->email) ? $cad->email : null, |
|
211
|
|
|
false |
|
212
|
|
|
); |
|
213
|
|
|
$infoCadastro->appendChild($info); |
|
214
|
|
|
if (isset($this->std->infoop) && !empty($infoCadastro)) { |
|
215
|
|
|
$cad = $this->std->infoop; |
|
216
|
|
|
$infoOP = $this->dom->createElement("infoOP"); |
|
217
|
|
|
$this->dom->addChild( |
|
218
|
|
|
$infoOP, |
|
219
|
|
|
"nrSiafi", |
|
220
|
|
|
$cad->nrsiafi, |
|
221
|
|
|
true |
|
222
|
|
|
); |
|
223
|
|
|
if (isset($this->std->infoefr)) { |
|
224
|
|
|
$cad = $this->std->infoefr; |
|
225
|
|
|
$infoEFR = $this->dom->createElement("infoEFR"); |
|
226
|
|
|
$this->dom->addChild( |
|
227
|
|
|
$infoEFR, |
|
228
|
|
|
"ideEFR", |
|
229
|
|
|
$cad->ideefr, |
|
230
|
|
|
true |
|
231
|
|
|
); |
|
232
|
|
|
$this->dom->addChild( |
|
233
|
|
|
$infoEFR, |
|
234
|
|
|
"cnpjEFR", |
|
235
|
|
|
!empty($cad->cnpjefr) ? $cad->cnpjefr : null, |
|
236
|
|
|
false |
|
237
|
|
|
); |
|
238
|
|
|
$infoOP->appendChild($infoEFR); |
|
239
|
|
|
} |
|
240
|
|
|
if (isset($this->std->infoente)) { |
|
241
|
|
|
$cad = $this->std->infoente; |
|
242
|
|
|
$infoEnte = $this->dom->createElement("infoEnte"); |
|
243
|
|
|
$this->dom->addChild( |
|
244
|
|
|
$infoEnte, |
|
245
|
|
|
"nmEnte", |
|
246
|
|
|
$cad->nmente, |
|
247
|
|
|
true |
|
248
|
|
|
); |
|
249
|
|
|
$this->dom->addChild( |
|
250
|
|
|
$infoEnte, |
|
251
|
|
|
"uf", |
|
252
|
|
|
$cad->uf, |
|
253
|
|
|
true |
|
254
|
|
|
); |
|
255
|
|
|
$this->dom->addChild( |
|
256
|
|
|
$infoEnte, |
|
257
|
|
|
"codMunic", |
|
258
|
|
|
!empty($cad->codmunic) ? $cad->codmunic : null, |
|
259
|
|
|
false |
|
260
|
|
|
); |
|
261
|
|
|
$this->dom->addChild( |
|
262
|
|
|
$infoEnte, |
|
263
|
|
|
"indRPPS", |
|
264
|
|
|
$cad->indrpps, |
|
265
|
|
|
true |
|
266
|
|
|
); |
|
267
|
|
|
$this->dom->addChild( |
|
268
|
|
|
$infoEnte, |
|
269
|
|
|
"subteto", |
|
270
|
|
|
$cad->subteto, |
|
271
|
|
|
true |
|
272
|
|
|
); |
|
273
|
|
|
$this->dom->addChild( |
|
274
|
|
|
$infoEnte, |
|
275
|
|
|
"vrSubteto", |
|
276
|
|
|
number_format($cad->vrsubteto, 2, ".", ""), |
|
277
|
|
|
true |
|
278
|
|
|
); |
|
279
|
|
|
$infoOP->appendChild($infoEnte); |
|
280
|
|
|
} |
|
281
|
|
|
$infoCadastro->appendChild($infoOP); |
|
282
|
|
|
} |
|
283
|
|
|
} |
|
284
|
|
|
if (isset($this->std->infoorginternacional) && !empty($infoCadastro)) { |
|
285
|
|
|
$cad = $this->std->infoorginternacional; |
|
286
|
|
|
$info = $this->dom->createElement("infoOrgInternacional"); |
|
287
|
|
|
$this->dom->addChild( |
|
288
|
|
|
$info, |
|
289
|
|
|
"indAcordoIsenMulta", |
|
290
|
|
|
$cad->indacordoisenmulta, |
|
291
|
|
|
true |
|
292
|
|
|
); |
|
293
|
|
|
$infoCadastro->appendChild($info); |
|
294
|
|
|
} |
|
295
|
|
|
if (isset($this->std->softwarehouse) && !empty($infoCadastro)) { |
|
296
|
|
|
foreach ($this->std->softwarehouse as $sh) { |
|
297
|
|
|
$info = $this->dom->createElement("softwareHouse"); |
|
298
|
|
|
$this->dom->addChild( |
|
299
|
|
|
$info, |
|
300
|
|
|
"cnpjSoftHouse", |
|
301
|
|
|
$sh->cnpjsofthouse, |
|
302
|
|
|
true |
|
303
|
|
|
); |
|
304
|
|
|
$this->dom->addChild( |
|
305
|
|
|
$info, |
|
306
|
|
|
"nmRazao", |
|
307
|
|
|
$sh->nmrazao, |
|
308
|
|
|
true |
|
309
|
|
|
); |
|
310
|
|
|
$this->dom->addChild( |
|
311
|
|
|
$info, |
|
312
|
|
|
"nmCont", |
|
313
|
|
|
$sh->nmcont, |
|
314
|
|
|
true |
|
315
|
|
|
); |
|
316
|
|
|
$this->dom->addChild( |
|
317
|
|
|
$info, |
|
318
|
|
|
"telefone", |
|
319
|
|
|
$sh->telefone, |
|
320
|
|
|
true |
|
321
|
|
|
); |
|
322
|
|
|
$this->dom->addChild( |
|
323
|
|
|
$info, |
|
324
|
|
|
"email", |
|
325
|
|
|
!empty($sh->email) ? $sh->email : null, |
|
326
|
|
|
false |
|
327
|
|
|
); |
|
328
|
|
|
$infoCadastro->appendChild($info); |
|
329
|
|
|
} |
|
330
|
|
|
if (isset($this->std->situacaopj)) { |
|
331
|
|
|
$infoComplementares = $this->dom->createElement("infoComplementares"); |
|
332
|
|
|
$sh = $this->std->situacaopj; |
|
333
|
|
|
$info = $this->dom->createElement("situacaoPJ"); |
|
334
|
|
|
$this->dom->addChild( |
|
335
|
|
|
$info, |
|
336
|
|
|
"indSitPJ", |
|
337
|
|
|
$sh->indsitpj, |
|
338
|
|
|
true |
|
339
|
|
|
); |
|
340
|
|
|
$infoComplementares->appendChild($info); |
|
341
|
|
|
} elseif (isset($this->std->situacaopf)) { |
|
342
|
|
|
$infoComplementares = $this->dom->createElement("infoComplementares"); |
|
343
|
|
|
$sh = $this->std->situacaopf; |
|
344
|
|
|
$info = $this->dom->createElement("situacaoPF"); |
|
345
|
|
|
$this->dom->addChild( |
|
346
|
|
|
$info, |
|
347
|
|
|
"indSitPF", |
|
348
|
|
|
$sh->indsitpf, |
|
349
|
|
|
true |
|
350
|
|
|
); |
|
351
|
|
|
$infoComplementares->appendChild($info); |
|
352
|
|
|
} |
|
353
|
|
|
} |
|
354
|
|
|
if (isset($this->std->novavalidade)) { |
|
355
|
|
|
$sh = $this->std->novavalidade; |
|
356
|
|
|
$novavalidade = $this->dom->createElement("novaValidade"); |
|
357
|
|
|
$this->dom->addChild( |
|
358
|
|
|
$novavalidade, |
|
359
|
|
|
"iniValid", |
|
360
|
|
|
$sh->inivalid, |
|
361
|
|
|
true |
|
362
|
|
|
); |
|
363
|
|
|
$this->dom->addChild( |
|
364
|
|
|
$novavalidade, |
|
365
|
|
|
"fimValid", |
|
366
|
|
|
!empty($sh->fimValid) ? $sh->fimValid : null, |
|
367
|
|
|
false |
|
368
|
|
|
); |
|
369
|
|
|
} |
|
370
|
|
|
switch ($this->std->modo) { |
|
371
|
|
|
case "ALT": |
|
372
|
|
|
$node = $this->dom->createElement("alteracao"); |
|
373
|
|
|
$node->appendChild($idePeriodo); |
|
374
|
|
|
if (isset($infoComplementares) && isset($infoCadastro)) { |
|
375
|
|
|
$infoCadastro->appendChild($infoComplementares); |
|
376
|
|
|
} |
|
377
|
|
|
isset($infoCadastro) ? $node->appendChild($infoCadastro) : null; |
|
378
|
|
|
isset($novavalidade) ? $node->appendChild($novavalidade) : null; |
|
379
|
|
|
break; |
|
380
|
|
|
case "EXC": |
|
381
|
|
|
$node = $this->dom->createElement("exclusao"); |
|
382
|
|
|
$node->appendChild($idePeriodo); |
|
383
|
|
|
break; |
|
384
|
|
|
case "INC": |
|
385
|
|
|
default: |
|
386
|
|
|
$node = $this->dom->createElement("inclusao"); |
|
387
|
|
|
$node->appendChild($idePeriodo); |
|
388
|
|
|
if (isset($infoComplementares) && isset($infoCadastro)) { |
|
389
|
|
|
$infoCadastro->appendChild($infoComplementares); |
|
390
|
|
|
} |
|
391
|
|
|
isset($infoCadastro) ? $node->appendChild($infoCadastro) : null; |
|
392
|
|
|
} |
|
393
|
|
|
$infoEmpregador->appendChild($node); |
|
394
|
|
|
$this->node->appendChild($infoEmpregador); |
|
395
|
|
|
//finalização do xml |
|
396
|
|
|
$this->eSocial->appendChild($this->node); |
|
|
|
|
|
|
397
|
|
|
//$this->xml = $this->dom->saveXML($this->eSocial); |
|
398
|
|
|
$this->sign(); |
|
|
|
|
|
|
399
|
|
|
} |
|
400
|
|
|
|
|
401
|
|
|
/** |
|
402
|
|
|
* builder for version S.1.0.0 |
|
403
|
|
|
*/ |
|
404
|
|
|
protected function toNodeS100() |
|
405
|
|
|
{ |
|
406
|
|
|
$ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
|
407
|
|
|
//o idEvento pode variar de evento para evento |
|
408
|
|
|
//então cada factory individualmente terá de construir o seu |
|
409
|
|
|
$ideEvento = $this->dom->createElement("ideEvento"); |
|
410
|
|
|
$this->dom->addChild( |
|
411
|
|
|
$ideEvento, |
|
412
|
|
|
"tpAmb", |
|
413
|
|
|
$this->tpAmb, |
|
414
|
|
|
true |
|
415
|
|
|
); |
|
416
|
|
|
$this->dom->addChild( |
|
417
|
|
|
$ideEvento, |
|
418
|
|
|
"procEmi", |
|
419
|
|
|
$this->procEmi, |
|
420
|
|
|
true |
|
421
|
|
|
); |
|
422
|
|
|
$this->dom->addChild( |
|
423
|
|
|
$ideEvento, |
|
424
|
|
|
"verProc", |
|
425
|
|
|
$this->verProc, |
|
426
|
|
|
true |
|
427
|
|
|
); |
|
428
|
|
|
$this->node->insertBefore($ideEvento, $ideEmpregador); |
|
429
|
|
|
$infoEmpregador = $this->dom->createElement("infoEmpregador"); |
|
430
|
|
|
//periodo |
|
431
|
|
|
$idePeriodo = $this->dom->createElement("idePeriodo"); |
|
432
|
|
|
$this->dom->addChild( |
|
433
|
|
|
$idePeriodo, |
|
434
|
|
|
"iniValid", |
|
435
|
|
|
$this->std->ideperiodo->inivalid, |
|
436
|
|
|
true |
|
437
|
|
|
); |
|
438
|
|
|
$this->dom->addChild( |
|
439
|
|
|
$idePeriodo, |
|
440
|
|
|
"fimValid", |
|
441
|
|
|
!empty($this->std->ideperiodo->fimvalid) ? $this->std->ideperiodo->fimvalid : '', |
|
442
|
|
|
false |
|
443
|
|
|
); |
|
444
|
|
|
//infoCadastro |
|
445
|
|
|
if (isset($this->std->infocadastro)) { |
|
446
|
|
|
$cad = $this->std->infocadastro; |
|
447
|
|
|
$infoCadastro = $this->dom->createElement("infoCadastro"); |
|
448
|
|
|
$this->dom->addChild( |
|
449
|
|
|
$infoCadastro, |
|
450
|
|
|
"classTrib", |
|
451
|
|
|
$cad->classtrib, |
|
452
|
|
|
true |
|
453
|
|
|
); |
|
454
|
|
|
$this->dom->addChild( |
|
455
|
|
|
$infoCadastro, |
|
456
|
|
|
"indCoop", |
|
457
|
|
|
isset($cad->indcoop) ? $cad->indcoop : null, |
|
458
|
|
|
($this->tpInsc == 1) ? true : false //obrigatorio para pessoa juridica |
|
459
|
|
|
); |
|
460
|
|
|
$this->dom->addChild( |
|
461
|
|
|
$infoCadastro, |
|
462
|
|
|
"indConstr", |
|
463
|
|
|
isset($cad->indconstr) ? $cad->indconstr : null, |
|
464
|
|
|
($this->tpInsc == 1) ? true : false //obrigatorio para pessoa juridica |
|
465
|
|
|
); |
|
466
|
|
|
$this->dom->addChild( |
|
467
|
|
|
$infoCadastro, |
|
468
|
|
|
"indDesFolha", |
|
469
|
|
|
$cad->inddesfolha, |
|
470
|
|
|
true |
|
471
|
|
|
); |
|
472
|
|
|
$this->dom->addChild( |
|
473
|
|
|
$infoCadastro, |
|
474
|
|
|
"indOpcCP", |
|
475
|
|
|
!empty($cad->indopccp) ? $cad->indopccp : null, |
|
476
|
|
|
false |
|
477
|
|
|
); |
|
478
|
|
|
$this->dom->addChild( |
|
479
|
|
|
$infoCadastro, |
|
480
|
|
|
"indPorte", |
|
481
|
|
|
!empty($cad->indporte) ? $cad->indporte : null, |
|
482
|
|
|
false |
|
483
|
|
|
); |
|
484
|
|
|
$this->dom->addChild( |
|
485
|
|
|
$infoCadastro, |
|
486
|
|
|
"indOptRegEletron", |
|
487
|
|
|
$cad->indoptregeletron, |
|
488
|
|
|
true |
|
489
|
|
|
); |
|
490
|
|
|
$this->dom->addChild( |
|
491
|
|
|
$infoCadastro, |
|
492
|
|
|
"cnpjEFR", |
|
493
|
|
|
!empty($cad->cnpjefr) ? $cad->cnpjefr : null, |
|
494
|
|
|
false |
|
495
|
|
|
); |
|
496
|
|
|
} |
|
497
|
|
|
if (isset($this->std->dadosisencao) && !empty($infoCadastro)) { |
|
498
|
|
|
$cad = $this->std->dadosisencao; |
|
499
|
|
|
$info = $this->dom->createElement("dadosIsencao"); |
|
500
|
|
|
$this->dom->addChild( |
|
501
|
|
|
$info, |
|
502
|
|
|
"ideMinLei", |
|
503
|
|
|
$cad->ideminlei, |
|
504
|
|
|
true |
|
505
|
|
|
); |
|
506
|
|
|
$this->dom->addChild( |
|
507
|
|
|
$info, |
|
508
|
|
|
"nrCertif", |
|
509
|
|
|
$cad->nrcertif, |
|
510
|
|
|
true |
|
511
|
|
|
); |
|
512
|
|
|
$this->dom->addChild( |
|
513
|
|
|
$info, |
|
514
|
|
|
"dtEmisCertif", |
|
515
|
|
|
$cad->dtemiscertif, |
|
516
|
|
|
true |
|
517
|
|
|
); |
|
518
|
|
|
$this->dom->addChild( |
|
519
|
|
|
$info, |
|
520
|
|
|
"dtVencCertif", |
|
521
|
|
|
$cad->dtvenccertif, |
|
522
|
|
|
true |
|
523
|
|
|
); |
|
524
|
|
|
$this->dom->addChild( |
|
525
|
|
|
$info, |
|
526
|
|
|
"nrProtRenov", |
|
527
|
|
|
!empty($cad->nrprotrenov) ? $cad->nrprotrenov : null, |
|
528
|
|
|
false |
|
529
|
|
|
); |
|
530
|
|
|
$this->dom->addChild( |
|
531
|
|
|
$info, |
|
532
|
|
|
"dtProtRenov", |
|
533
|
|
|
!empty($cad->dtprotrenov) ? $cad->dtprotrenov : null, |
|
534
|
|
|
false |
|
535
|
|
|
); |
|
536
|
|
|
$this->dom->addChild( |
|
537
|
|
|
$info, |
|
538
|
|
|
"dtDou", |
|
539
|
|
|
!empty($cad->dtdou) ? $cad->dtdou : null, |
|
540
|
|
|
false |
|
541
|
|
|
); |
|
542
|
|
|
$this->dom->addChild( |
|
543
|
|
|
$info, |
|
544
|
|
|
"pagDou", |
|
545
|
|
|
!empty($cad->pagdou) ? $cad->pagdou : null, |
|
546
|
|
|
false |
|
547
|
|
|
); |
|
548
|
|
|
$infoCadastro->appendChild($info); |
|
549
|
|
|
} |
|
550
|
|
|
if (isset($this->std->infoorginternacional) && !empty($infoCadastro)) { |
|
551
|
|
|
$cad = $this->std->infoorginternacional; |
|
552
|
|
|
$info = $this->dom->createElement("infoOrgInternacional"); |
|
553
|
|
|
$this->dom->addChild( |
|
554
|
|
|
$info, |
|
555
|
|
|
"indAcordoIsenMulta", |
|
556
|
|
|
$cad->indacordoisenmulta, |
|
557
|
|
|
true |
|
558
|
|
|
); |
|
559
|
|
|
$infoCadastro->appendChild($info); |
|
560
|
|
|
} |
|
561
|
|
|
if (isset($this->std->novavalidade)) { |
|
562
|
|
|
$sh = $this->std->novavalidade; |
|
563
|
|
|
$novavalidade = $this->dom->createElement("novaValidade"); |
|
564
|
|
|
$this->dom->addChild( |
|
565
|
|
|
$novavalidade, |
|
566
|
|
|
"iniValid", |
|
567
|
|
|
$sh->inivalid, |
|
568
|
|
|
true |
|
569
|
|
|
); |
|
570
|
|
|
$this->dom->addChild( |
|
571
|
|
|
$novavalidade, |
|
572
|
|
|
"fimValid", |
|
573
|
|
|
!empty($sh->fimValid) ? $sh->fimValid : null, |
|
574
|
|
|
false |
|
575
|
|
|
); |
|
576
|
|
|
} |
|
577
|
|
|
switch ($this->std->modo) { |
|
578
|
|
|
case "ALT": |
|
579
|
|
|
$node = $this->dom->createElement("alteracao"); |
|
580
|
|
|
$node->appendChild($idePeriodo); |
|
581
|
|
|
if (isset($infoComplementares) && isset($infoCadastro)) { |
|
|
|
|
|
|
582
|
|
|
$infoCadastro->appendChild($infoComplementares); |
|
583
|
|
|
} |
|
584
|
|
|
isset($infoCadastro) ? $node->appendChild($infoCadastro) : null; |
|
585
|
|
|
isset($novavalidade) ? $node->appendChild($novavalidade) : null; |
|
586
|
|
|
break; |
|
587
|
|
|
case "EXC": |
|
588
|
|
|
$node = $this->dom->createElement("exclusao"); |
|
589
|
|
|
$node->appendChild($idePeriodo); |
|
590
|
|
|
break; |
|
591
|
|
|
case "INC": |
|
592
|
|
|
default: |
|
593
|
|
|
$node = $this->dom->createElement("inclusao"); |
|
594
|
|
|
$node->appendChild($idePeriodo); |
|
595
|
|
|
if (isset($infoComplementares) && isset($infoCadastro)) { |
|
596
|
|
|
$infoCadastro->appendChild($infoComplementares); |
|
597
|
|
|
} |
|
598
|
|
|
isset($infoCadastro) ? $node->appendChild($infoCadastro) : null; |
|
599
|
|
|
} |
|
600
|
|
|
$infoEmpregador->appendChild($node); |
|
601
|
|
|
$this->node->appendChild($infoEmpregador); |
|
602
|
|
|
//finalização do xml |
|
603
|
|
|
$this->eSocial->appendChild($this->node); |
|
604
|
|
|
//$this->xml = $this->dom->saveXML($this->eSocial); |
|
605
|
|
|
$this->sign(); |
|
|
|
|
|
|
606
|
|
|
} |
|
607
|
|
|
} |
|
608
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: