1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NFePHP\eSocial\Factories\Traits; |
4
|
|
|
|
5
|
|
|
trait TraitS2260 |
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
|
|
|
"indRetif", |
19
|
|
|
$this->std->indretif, |
|
|
|
|
20
|
|
|
true |
21
|
|
|
); |
22
|
|
|
$this->dom->addChild( |
23
|
|
|
$ideEvento, |
24
|
|
|
"nrRecibo", |
25
|
|
|
! empty($this->std->nrrecibo) ? $this->std->nrrecibo : null, |
26
|
|
|
false |
27
|
|
|
); |
28
|
|
|
$this->dom->addChild( |
29
|
|
|
$ideEvento, |
30
|
|
|
"tpAmb", |
31
|
|
|
$this->tpAmb, |
|
|
|
|
32
|
|
|
true |
33
|
|
|
); |
34
|
|
|
$this->dom->addChild( |
35
|
|
|
$ideEvento, |
36
|
|
|
"procEmi", |
37
|
|
|
$this->procEmi, |
|
|
|
|
38
|
|
|
true |
39
|
|
|
); |
40
|
|
|
$this->dom->addChild( |
41
|
|
|
$ideEvento, |
42
|
|
|
"verProc", |
43
|
|
|
$this->verProc, |
|
|
|
|
44
|
|
|
true |
45
|
|
|
); |
46
|
|
|
$this->node->insertBefore($ideEvento, $ideEmpregador); |
47
|
|
|
$ideVinculo = $this->dom->createElement("ideVinculo"); |
48
|
|
|
$this->dom->addChild( |
49
|
|
|
$ideVinculo, |
50
|
|
|
"cpfTrab", |
51
|
|
|
$this->std->idevinculo->cpftrab, |
52
|
|
|
true |
53
|
|
|
); |
54
|
|
|
$this->dom->addChild( |
55
|
|
|
$ideVinculo, |
56
|
|
|
"nisTrab", |
57
|
|
|
$this->std->idevinculo->nistrab, |
58
|
|
|
true |
59
|
|
|
); |
60
|
|
|
$this->dom->addChild( |
61
|
|
|
$ideVinculo, |
62
|
|
|
"matricula", |
63
|
|
|
$this->std->idevinculo->matricula, |
64
|
|
|
true |
65
|
|
|
); |
66
|
|
|
$this->node->appendChild($ideVinculo); |
67
|
|
|
|
68
|
|
|
$i = $this->std->infoconvinterm; |
69
|
|
|
$info = $this->dom->createElement("infoConvInterm"); |
70
|
|
|
$this->dom->addChild( |
71
|
|
|
$info, |
72
|
|
|
"codConv", |
73
|
|
|
$i->codconv, |
74
|
|
|
true |
75
|
|
|
); |
76
|
|
|
$this->dom->addChild( |
77
|
|
|
$info, |
78
|
|
|
"dtInicio", |
79
|
|
|
$i->dtinicio, |
80
|
|
|
true |
81
|
|
|
); |
82
|
|
|
$this->dom->addChild( |
83
|
|
|
$info, |
84
|
|
|
"dtFim", |
85
|
|
|
$i->dtfim, |
86
|
|
|
true |
87
|
|
|
); |
88
|
|
|
$this->dom->addChild( |
89
|
|
|
$info, |
90
|
|
|
"dtPrevPgto", |
91
|
|
|
$i->dtprevpgto, |
92
|
|
|
true |
93
|
|
|
); |
94
|
|
|
$jornada = $this->dom->createElement("jornada"); |
95
|
|
|
$this->dom->addChild( |
96
|
|
|
$jornada, |
97
|
|
|
"codHorContrat", |
98
|
|
|
!empty($i->jornada->codhorcontrat) ? $i->jornada->codhorcontrat : null, |
99
|
|
|
false |
100
|
|
|
); |
101
|
|
|
$this->dom->addChild( |
102
|
|
|
$jornada, |
103
|
|
|
"dscJornada", |
104
|
|
|
!empty($i->jornada->dscjornada) ? $i->jornada->dscjornada : null, |
105
|
|
|
false |
106
|
|
|
); |
107
|
|
|
$info->appendChild($jornada); |
108
|
|
|
|
109
|
|
|
$localTrab = $this->dom->createElement("localTrab"); |
110
|
|
|
$this->dom->addChild( |
111
|
|
|
$localTrab, |
112
|
|
|
"indLocal", |
113
|
|
|
$i->localtrab->indlocal, |
114
|
|
|
true |
115
|
|
|
); |
116
|
|
|
if (!empty($i->localtrab->localtrabinterm)) { |
117
|
|
|
$l = $i->localtrab->localtrabinterm; |
118
|
|
|
$local = $this->dom->createElement("localTrabInterm"); |
119
|
|
|
$this->dom->addChild( |
120
|
|
|
$local, |
121
|
|
|
"tpLograd", |
122
|
|
|
$l->tplograd, |
123
|
|
|
true |
124
|
|
|
); |
125
|
|
|
$this->dom->addChild( |
126
|
|
|
$local, |
127
|
|
|
"dscLograd", |
128
|
|
|
$l->dsclograd, |
129
|
|
|
true |
130
|
|
|
); |
131
|
|
|
$this->dom->addChild( |
132
|
|
|
$local, |
133
|
|
|
"nrLograd", |
134
|
|
|
$l->nrlograd, |
135
|
|
|
true |
136
|
|
|
); |
137
|
|
|
$this->dom->addChild( |
138
|
|
|
$local, |
139
|
|
|
"complem", |
140
|
|
|
!empty($l->complem) ? $l->complem : null, |
141
|
|
|
false |
142
|
|
|
); |
143
|
|
|
$this->dom->addChild( |
144
|
|
|
$local, |
145
|
|
|
"bairro", |
146
|
|
|
!empty($l->bairro) ? $l->bairro : null, |
147
|
|
|
false |
148
|
|
|
); |
149
|
|
|
$this->dom->addChild( |
150
|
|
|
$local, |
151
|
|
|
"cep", |
152
|
|
|
$l->cep, |
153
|
|
|
true |
154
|
|
|
); |
155
|
|
|
$this->dom->addChild( |
156
|
|
|
$local, |
157
|
|
|
"codMunic", |
158
|
|
|
$l->codmunic, |
159
|
|
|
true |
160
|
|
|
); |
161
|
|
|
$this->dom->addChild( |
162
|
|
|
$local, |
163
|
|
|
"uf", |
164
|
|
|
$l->uf, |
165
|
|
|
true |
166
|
|
|
); |
167
|
|
|
$localTrab->appendChild($local); |
168
|
|
|
} |
169
|
|
|
$info->appendChild($localTrab); |
170
|
|
|
$this->node->appendChild($info); |
171
|
|
|
$this->eSocial->appendChild($this->node); |
|
|
|
|
172
|
|
|
//$this->xml = $this->dom->saveXML($this->eSocial); |
173
|
|
|
$this->sign(); |
|
|
|
|
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* builder for version S.1.0.0 |
178
|
|
|
*/ |
179
|
|
|
protected function toNodeS100() |
180
|
|
|
{ |
181
|
|
|
throw new \Exception("NÃO EXISTE EVENTO {$this->evtAlias} na versão S_1.0 !!"); |
|
|
|
|
182
|
|
|
} |
183
|
|
|
} |
184
|
|
|
|
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: