Skip to content

Commit

Permalink
Versão 1.0.2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederico Gendorf committed May 11, 2018
1 parent 821fb3f commit d2e894a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
31 changes: 26 additions & 5 deletions code/REPDigitais.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
<?php
/**
* Classe que trata as digitais do relogio
*/
class REPDigitais extends REPEmpregado {

class REPDigitais extends REPUsuario {

public function __construct() {
parent::__construct();
}

public function getTemplateDigital(){
return $this->queryREP("00+RD+00+D]{$this->matriculaUsuario}");
/**
*
* @return type
*/
public function getTemplateDigital() {
return $this->queryREP("00+RD+00+D]{$this->matriculaEmpregado}");
}
/**
*
* @return array
*/
public function listMatriculasDigitalRelogio() {

$ret = $this->queryREP("00+RD+00+L]1000}0");
$chkcalc = ord($this->checkSum(substr($ret, 3, -2)));
$chkrcv = ord(substr($ret, -2, 1));
if ($chkcalc == $chkrcv) {
$proc = preg_split('/]/', substr(str_replace(chr(3), '', str_replace(chr(2), '', $ret)),0,-1));
array_shift($proc);

}
return $proc;
}

}
15 changes: 5 additions & 10 deletions code/REPRegistros.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function coletaRegistrosPonto() {
* @return array
*/
public function getInclusaoAlteracaoEmpresa($registros) {
$y = 0;
for ($x = 0; sizeof($registros) > $x; ++$x) {
if (substr($registros[$x], 9, 1) == 2) {
++$y;
$regarray[$y]["NSR"] = substr($registros[$x], 0, 9);
$regarray[$y]["tipo"] = substr($registros[$x], 9, 1);
$regarray[$y]["data"] = substr($registros[$x], 10, 8);
Expand All @@ -58,7 +58,6 @@ public function getInclusaoAlteracaoEmpresa($registros) {
$regarray[$y]["cei"] = substr($registros[$x], 37, 12);
$regarray[$y]["razaosocial"] = substr($registros[$x], 49, 150);
$regarray[$y]["local"] = substr($registros[$x], 199, 100);
++$y;
}
}
return $regarray;
Expand All @@ -71,15 +70,14 @@ public function getInclusaoAlteracaoEmpresa($registros) {
* @return array
*/
public function getMarcacaoPonto($registros) {
$y = 0;
for ($x = 0; sizeof($registros) > $x; ++$x) {
if (substr($registros[$x], 9, 1) == 3) {
++$y;
$regarray[$y]["NSR"] = substr($registros[$x], 0, 9);
$regarray[$y]["tipo"] = substr($registros[$x], 9, 1);
$date = DateTime::createFromFormat("dmYHi", substr($registros[$x], 10, 8) . substr($registros[$x], 18, 4));
$regarray[$y]["datahorario"] = $date->format("Y-m-d H:i:s");
$regarray[$y]["pis"] = substr($registros[$x], 22, 12);
++$y;
}
}
return $regarray;
Expand All @@ -92,15 +90,14 @@ public function getMarcacaoPonto($registros) {
* @return array
*/
public function getMarcacaoPontoMatricula($registros) {
$y = 0;
for ($x = 0; sizeof($registros) > $x; ++$x) {
if (substr($registros[$x], 9, 1) == 7) {
++$y;
$regarray[$y]["NSR"] = substr($registros[$x], 0, 9);
$regarray[$y]["tipo"] = substr($registros[$x], 9, 1);
$date = DateTime::createFromFormat("dmYHi", substr($registros[$x], 10, 8) . substr($registros[$x], 18, 4));
$regarray[$y]["datahorario"] = $date->format("Y-m-d H:i:s");
$regarray[$y]["matricula"] = substr($registros[$x], -6);
++$y;
}
}
return $regarray;
Expand All @@ -113,16 +110,15 @@ public function getMarcacaoPontoMatricula($registros) {
* @return array
*/
public function getAjusteRelogio($registros) {
$y = 0;
for ($x = 0; sizeof($registros) > $x; ++$x) {
if (substr($registros[$x], 9, 1) == 4) {
++$y;
$regarray[$y]["NSR"] = substr($registros[$x], 0, 9);
$regarray[$y]["tipo"] = substr($registros[$x], 9, 1);
$regarray[$y]["dataantes"] = substr($registros[$x], 10, 8);
$regarray[$y]["horarioantes"] = substr($registros[$x], 18, 4);
$regarray[$y]["dataajustada"] = substr($registros[$x], 22, 8);
$regarray[$y]["horaajustada"] = substr($registros[$x], 30, 4);
++$y;
}
}
return $regarray;
Expand All @@ -136,16 +132,15 @@ public function getAjusteRelogio($registros) {
* @return array
*/
public function getInclusaoAlteracaoEmpregado($registros) {
$y = 0;
for ($x = 0; sizeof($registros) > $x; ++$x) {
if (substr($registros[$x], 9, 1) == 5) {
++$y;
$regarray[$y]["NSR"] = substr($registros[$x], 0, 9);
$regarray[$y]["tipo"] = substr($registros[$x], 9, 1);
$regarray[$y]["data"] = substr($registros[$x], 10, 12);
$regarray[$y]["acao"] = substr($registros[$x], 22, 1);
$regarray[$y]["pis"] = substr($registros[$x], 23, 12);
$regarray[$y]["colaborador"] = substr($registros[$x], 35, 52);
++$y;
}
}
return $regarray;
Expand Down

0 comments on commit d2e894a

Please sign in to comment.