Skip to content

Commit

Permalink
Merge pull request #351 from robmachado/master
Browse files Browse the repository at this point in the history
Inclusão S-2190 S 1.0
  • Loading branch information
robmachado committed Dec 6, 2021
2 parents 31104ff + 1635698 commit b13f97f
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 8 deletions.
18 changes: 15 additions & 3 deletions examples/Fake/v_S_01_00_00/Fake_s2190_EvtAdmPerlim.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@
//carrega os dados do envento
$std = new \stdClass();
$std->sequencial = 1;
$std->cpfTrab = '00232133417';
$std->dtNascto = '1931-02-12';
$std->dtAdm = '2017-02-12';
$std->indretif = 1;
$std->nrrecibo = "1.7.1234567890123456789";
$std->cpftrab = '00232133417';
$std->dtnascto = '1931-02-12';
$std->dtadm = '2017-02-12';
$std->matricula = "abs1234";
$std->codcateg = "101";
$std->natatividade = 1;

$std->inforegctps = new \stdClass();
$std->inforegctps->cbocargo = "263105";
$std->inforegctps->vrsalfx = "2500";
$std->inforegctps->undsalfixo = 3;
$std->inforegctps->tpcontr = 1;
$std->inforegctps->dtterm = null;

try {
//carrega a classe responsavel por lidar com os certificados
Expand Down
2 changes: 1 addition & 1 deletion examples/Fake/v_S_01_00_00/Fake_s2240_EvtExpRisco.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

$std->agnoc[0]->epcepi->epi[0] = new \stdClass();
$std->agnoc[0]->epcepi->epi[0]->docaval = '111xxx';
$std->agnoc[0]->epcepi->epi[0]->dscePI = 'macacao';
$std->agnoc[0]->epcepi->epi[0]->dscepi = 'macacao';
$std->agnoc[0]->epcepi->epi[0]->medprotecao = 'S';
$std->agnoc[0]->epcepi->epi[0]->condfuncto = 'S';
$std->agnoc[0]->epcepi->epi[0]->usoinint = 'S';
Expand Down
77 changes: 74 additions & 3 deletions examples/schemes/v_S_01_00_00/s2190_JsonSchemaEvtAdmPrelim.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
use JsonSchema\SchemaStorage;
use JsonSchema\Validator;

//S-2190 sem alterações da 2.4.1 => 2.4.2
//S-2190 sem alterações da 2.4.2 => 2.5.0
//versão S_1.00

$evento = 'evtAdmPrelim';
$version = '02_05_00';
$version = 'S_01_00_00';

$jsonSchema = '{
"title": "evtAdmPrelim",
Expand All @@ -25,6 +24,17 @@
"minimum": 1,
"maximum": 99999
},
"indretif": {
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 2
},
"nrrecibo": {
"required": false,
"type": ["string","null"],
"pattern": "^[1]{1}.[0-9]{1}.[0-9]{19}$"
},
"cpftrab": {
"required": true,
"type": "string",
Expand All @@ -39,15 +49,76 @@
"required": true,
"type": "string",
"pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
},
"matricula": {
"required": true,
"type": "string",
"minLength": 1,
"maxLength": 30
},
"codcateg": {
"required": true,
"type": "string",
"pattern": "^[0-9]{3}"
},
"natatividade": {
"required": false,
"type": ["integer","null"],
"minimum": 1,
"maximum": 2
},
"inforegctps": {
"required": false,
"type": ["object","null"],
"properties": {
"cbocargo": {
"required": true,
"type": "string",
"pattern": "^[0-9]{6}$"
},
"vrsalfx": {
"required": true,
"type": "number"
},
"undsalfixo": {
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 7
},
"tpcontr": {
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 3
},
"dtterm": {
"required": false,
"type": ["string","null"],
"pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
}
}
}
}
}';

$std = new \stdClass();
$std->sequencial = 1;
$std->indretif = 1;
$std->nrrecibo = "1.7.1234567890123456789";
$std->cpftrab = '00232133417';
$std->dtnascto = '1931-02-12';
$std->dtadm = '2017-02-12';
$std->matricula = "abs1234";
$std->codcateg = "101";
$std->natatividade = 1;

$std->inforegctps = new \stdClass();
$std->inforegctps->cbocargo = "263105";
$std->inforegctps->vrsalfx = "2500";
$std->inforegctps->undsalfixo = 3;
$std->inforegctps->tpcontr = 1;
$std->inforegctps->dtterm = null;

// Schema must be decoded before it can be used for validation
$jsonSchemaObject = json_decode($jsonSchema);
Expand Down
60 changes: 60 additions & 0 deletions jsonSchemes/v_S_01_00_00/evtAdmPrelim.schema
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
"minimum": 1,
"maximum": 99999
},
"indretif": {
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 2
},
"nrrecibo": {
"required": false,
"type": ["string","null"],
"pattern": "^[1]{1}.[0-9]{1}.[0-9]{19}$"
},
"cpftrab": {
"required": true,
"type": "string",
Expand All @@ -22,6 +33,55 @@
"required": true,
"type": "string",
"pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
},
"matricula": {
"required": true,
"type": "string",
"minLength": 1,
"maxLength": 30
},
"codcateg": {
"required": true,
"type": "string",
"pattern": "^[0-9]{3}"
},
"natatividade": {
"required": false,
"type": ["integer","null"],
"minimum": 1,
"maximum": 2
},
"inforegctps": {
"required": false,
"type": ["object","null"],
"properties": {
"cbocargo": {
"required": true,
"type": "string",
"pattern": "^[0-9]{6}$"
},
"vrsalfx": {
"required": true,
"type": "number"
},
"undsalfixo": {
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 7
},
"tpcontr": {
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 3
},
"dtterm": {
"required": false,
"type": ["string","null"],
"pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
}
}
}
}
}
114 changes: 113 additions & 1 deletion src/Factories/Traits/TraitS2190.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,118 @@ protected function toNode250()
*/
protected function toNodeS100()
{
throw new \Exception("TODO !!");
$ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0);
//o idEvento pode variar de evento para evento
//então cada factory individualmente terá de construir o seu
$ideEvento = $this->dom->createElement("ideEvento");
$this->dom->addChild(
$ideEvento,
"indRetif",
$this->std->indretif,
true
);
$this->dom->addChild(
$ideEvento,
"nrRecibo",
!empty($this->std->nrrecibo) ? $this->std->nrrecibo : null,
false
);
$this->dom->addChild(
$ideEvento,
"tpAmb",
$this->tpAmb,
true
);
$this->dom->addChild(
$ideEvento,
"procEmi",
$this->procEmi,
true
);
$this->dom->addChild(
$ideEvento,
"verProc",
$this->verProc,
true
);
$this->node->insertBefore($ideEvento, $ideEmpregador);
//tag deste evento em particular
$infoRegPrelim = $this->dom->createElement("infoRegPrelim");
$this->dom->addChild(
$infoRegPrelim,
"cpfTrab",
$this->std->cpftrab,
true
);
$this->dom->addChild(
$infoRegPrelim,
"dtNascto",
$this->std->dtnascto,
true
);
$this->dom->addChild(
$infoRegPrelim,
"dtAdm",
$this->std->dtadm,
true
);
$this->dom->addChild(
$infoRegPrelim,
"matricula",
$this->std->matricula,
true
);
$this->dom->addChild(
$infoRegPrelim,
"codCateg",
$this->std->codcateg,
true
);
$this->dom->addChild(
$infoRegPrelim,
"natAtividade",
$this->std->natatividade ?? null,
false
);
if (!empty($this->std->inforegctps)) {
$info = $this->std->inforegctps;
$infoRegCTPS = $this->dom->createElement("infoRegCTPS");
$this->dom->addChild(
$infoRegCTPS,
"CBOCargo",
$info->cbocargo,
true
);
$this->dom->addChild(
$infoRegCTPS,
"vrSalFx",
$info->vrsalfx,
true
);
$this->dom->addChild(
$infoRegCTPS,
"undSalFixo",
$info->undsalfixo,
true
);
$this->dom->addChild(
$infoRegCTPS,
"tpContr",
$info->tpcontr,
true
);
$this->dom->addChild(
$infoRegCTPS,
"dtTerm",
!empty($info->dtTerm) ? $info->dtTerm : null,
false
);
$infoRegPrelim->appendChild($infoRegCTPS);
}
$this->node->appendChild($infoRegPrelim);
//finalização do xml
$this->eSocial->appendChild($this->node);
//$this->xml = $this->dom->saveXML($this->eSocial);
$this->sign();
}
}

0 comments on commit b13f97f

Please sign in to comment.