1
|
|
|
<?php |
2
|
|
|
namespace NFePHP\eSocial\Factories; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Class eSocial EvtBaixa Event S-8299 constructor |
6
|
|
|
* Read for S_1.0 |
7
|
|
|
* |
8
|
|
|
* @category library |
9
|
|
|
* @package NFePHP\eSocial |
10
|
|
|
* @copyright NFePHP Copyright (c) 2017 |
11
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPLv3+ |
12
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
13
|
|
|
* @license http://www.gnu.org/licenses/gpl.txt GPLv3+ |
14
|
|
|
* @author Roberto L. Machado <linux.rlm at gmail dot com> |
15
|
|
|
* @link http://github.com/nfephp-org/sped-esocial for the canonical source repository |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use NFePHP\Common\Certificate; |
19
|
|
|
use NFePHP\eSocial\Common\Factory; |
20
|
|
|
use NFePHP\eSocial\Common\FactoryId; |
21
|
|
|
use NFePHP\eSocial\Common\FactoryInterface; |
22
|
|
|
use stdClass; |
23
|
|
|
|
24
|
|
|
class EvtBaixa extends Factory implements FactoryInterface |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var int |
28
|
|
|
*/ |
29
|
|
|
public $sequencial; |
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
protected $evtName = 'evtBaixa'; |
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $evtAlias = 'S-8299'; |
38
|
|
|
/** |
39
|
|
|
* Parameters patterns |
40
|
|
|
* |
41
|
|
|
* @var array |
42
|
|
|
*/ |
43
|
|
|
protected $parameters = []; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Constructor |
47
|
|
|
* |
48
|
|
|
* @param string $config |
49
|
|
|
* @param stdClass $std |
50
|
|
|
* @param Certificate $certificate | null |
51
|
|
|
* @param string $date |
52
|
|
|
*/ |
53
|
|
|
public function __construct( |
54
|
|
|
$config, |
55
|
|
|
stdClass $std, |
56
|
|
|
Certificate $certificate = null, |
57
|
|
|
$date = '' |
58
|
|
|
) { |
59
|
|
|
parent::__construct($config, $std, $certificate, $date); |
60
|
|
|
throw new \Exception("Este evento somente pode ser criado por " |
61
|
|
|
."aplicativo governamental para envio de eventos pelo Judiciário"); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Node constructor |
66
|
|
|
*/ |
67
|
|
|
protected function toNode() |
68
|
|
|
{ |
69
|
|
|
$ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
70
|
|
|
//o idEvento pode variar de evento para evento |
71
|
|
|
//então cada factory individualmente terá de construir o seu |
72
|
|
|
$ideEvento = $this->dom->createElement("ideEvento"); |
73
|
|
|
$this->dom->addChild( |
74
|
|
|
$ideEvento, |
75
|
|
|
"indRetif", |
76
|
|
|
$this->std->indretif, |
77
|
|
|
true |
78
|
|
|
); |
79
|
|
|
$this->dom->addChild( |
80
|
|
|
$ideEvento, |
81
|
|
|
"nrRecibo", |
82
|
|
|
($this->std->indretif == 2) ? $this->std->nrrecibo : null, |
83
|
|
|
false |
84
|
|
|
); |
85
|
|
|
$this->dom->addChild( |
86
|
|
|
$ideEvento, |
87
|
|
|
"tpAmb", |
88
|
|
|
$this->tpAmb, |
89
|
|
|
true |
90
|
|
|
); |
91
|
|
|
$this->dom->addChild( |
92
|
|
|
$ideEvento, |
93
|
|
|
"procEmi", |
94
|
|
|
$this->procEmi, |
95
|
|
|
true |
96
|
|
|
); |
97
|
|
|
$this->dom->addChild( |
98
|
|
|
$ideEvento, |
99
|
|
|
"verProc", |
100
|
|
|
$this->verProc, |
101
|
|
|
true |
102
|
|
|
); |
103
|
|
|
$this->node->insertBefore($ideEvento, $ideEmpregador); |
104
|
|
|
$ideVinculo = $this->dom->createElement("ideVinculo"); |
105
|
|
|
$this->dom->addChild( |
106
|
|
|
$ideVinculo, |
107
|
|
|
"cpfTrab", |
108
|
|
|
$this->std->cpftrab, |
109
|
|
|
true |
110
|
|
|
); |
111
|
|
|
$this->dom->addChild( |
112
|
|
|
$ideVinculo, |
113
|
|
|
"matricula", |
114
|
|
|
$this->std->matricula, |
115
|
|
|
true |
116
|
|
|
); |
117
|
|
|
$this->node->appendChild($ideVinculo); |
118
|
|
|
$infoBaixa = $this->dom->createElement("infoBaixa"); |
119
|
|
|
$this->dom->addChild( |
120
|
|
|
$infoBaixa, |
121
|
|
|
"mtvDeslig", |
122
|
|
|
$this->std->mtvdeslig, |
123
|
|
|
true |
124
|
|
|
); |
125
|
|
|
$this->dom->addChild( |
126
|
|
|
$infoBaixa, |
127
|
|
|
"dtDeslig", |
128
|
|
|
$this->std->dtdeslig, |
129
|
|
|
true |
130
|
|
|
); |
131
|
|
|
$this->dom->addChild( |
132
|
|
|
$infoBaixa, |
133
|
|
|
"dtProjFimAPI", |
134
|
|
|
$this->std->dtprojfimapi, |
135
|
|
|
false |
136
|
|
|
); |
137
|
|
|
$this->dom->addChild( |
138
|
|
|
$infoBaixa, |
139
|
|
|
"nrProcTrab", |
140
|
|
|
$this->std->nrproctrab, |
141
|
|
|
true |
142
|
|
|
); |
143
|
|
|
$this->dom->addChild( |
144
|
|
|
$infoBaixa, |
145
|
|
|
"observacao", |
146
|
|
|
$this->std->observacao, |
147
|
|
|
false |
148
|
|
|
); |
149
|
|
|
$this->node->appendChild($infoBaixa); |
150
|
|
|
|
151
|
|
|
$this->eSocial->appendChild($this->node); |
152
|
|
|
//$this->xml = $this->dom->saveXML($this->eSocial); |
153
|
|
|
$this->sign(); |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
|