https://github.com/convenia/afd-reader
Pacote de leitura de arquivos de ponto no padrão do brasil. AFD, AFDT e ACJEF
https://github.com/convenia/afd-reader
acjef afd afdt clt fiscal ponto
Last synced: about 1 year ago
JSON representation
Pacote de leitura de arquivos de ponto no padrão do brasil. AFD, AFDT e ACJEF
- Host: GitHub
- URL: https://github.com/convenia/afd-reader
- Owner: convenia
- License: mit
- Created: 2016-07-05T13:08:02.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-09-19T19:02:58.000Z (over 1 year ago)
- Last Synced: 2025-04-15T15:59:11.166Z (about 1 year ago)
- Topics: acjef, afd, afdt, clt, fiscal, ponto
- Language: PHP
- Homepage:
- Size: 516 KB
- Stars: 9
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

---
Pacote para leitura de Arquivo Fonte de Dados (AFD).
Especificação do MTE referente a portaria [1.510/2009](http://www.trtsp.jus.br/geral/tribunal2/ORGAOS/MTE/Portaria/P1510_09.html).
---
[](https://packagist.org/packages/convenia/afd-reader)
[](https://travis-ci.org/convenia/afd-reader)
[](https://packagist.org/packages/convenia/afd-reader)
[](https://packagist.org/packages/convenia/afd-reader)
---
## Arquivos suportados
- Arquivo-Fonte de Dados - AFD
- Arquivo-Fonte de Dados Tratado - AFDT
- Arquivo de Controle de Jornada para Efeitos Fiscais - ACJEF
## Métodos
- getByUser()
- getAll()
## Utilização
O AfdReader pode ser instanciado informando apenas o caminho do arquivo, neste caso ele tentará descobrir o tipo:
```php
use Convenia\AfdReader\AfdReader;
...
$afdReader = new AfdReader('afdt_test.txt');
```
Informando o tipo do arquivo:
```php
use Convenia\AfdReader\AfdReader;
...
$afdReader = new AfdReader('afdt_test.txt', 'Afdt');
```
Obter informações agrupadas por NIS/PIS:
```php
$afdReader->getByUser();
```
```
Array
(
[62915959739] => Array
(
[20052015] => Array
(
[01] => Array
(
[0] => Array
(
[sequency] => 000000002
[dateTime] => DateTime Object
(
[date] => 2015-05-20 09:00:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Entrada
[type] => Original
)
[1] => Array
(
[sequency] => 000000003
[dateTime] => DateTime Object
(
[date] => 2015-05-20 12:04:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Saída
[type] => Original
)
)
[02] => Array
(
[0] => Array
(
[sequency] => 000000004
[dateTime] => DateTime Object
(
[date] => 2015-05-20 13:14:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Entrada
[type] => Original
)
[1] => Array
(
[sequency] => 000000005
[dateTime] => DateTime Object
(
[date] => 2015-05-20 18:07:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Saída
[type] => Original
)
)
)
)
)
```
Obter as ocorrências de um NIS/PIS:
```php
$afdReader->getByUser(62915959739);
```
Obter as ocorrências de um NIS/PIS no período especificado:
```php
$afdReader->getByUser(62915959739, ['from' => '2015-05-20', 'to' => '2015-05-20']);
```
Obter as informações de todos os registros:
```php
$afdReader->getAll();
```
```
Array
(
[header] => Array
(
[sequency] => 000000001
[type] => 1
[entityType] => CNPJ
[entityNumber] => 32041763000177
[cei] => 000000000000
[name] => NOME DA EMPRESA - LTDA ME
[startDate] => 20052015
[endDate] => 20092015
[generationDate] => DateTime Object
(
[date] => 2015-09-21 09:57:59.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[generationTime] => Array
(
[hour] => 10
[minute] => 43
)
)
[trailer] => Array
(
[sequency] => 000011305
[type] => 9
)
[detail] => Array
(
[62915959739] => Array
(
[20052015] => Array
(
[01] => Array
(
[0] => Array
(
[sequency] => 000000002
[dateTime] => DateTime Object
(
[date] => 2015-05-20 09:00:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Entrada
[type] => Original
)
[1] => Array
(
[sequency] => 000000003
[dateTime] => DateTime Object
(
[date] => 2015-05-20 12:04:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Saída
[type] => Original
)
)
[02] => Array
(
[0] => Array
(
[sequency] => 000000004
[dateTime] => DateTime Object
(
[date] => 2015-05-20 13:14:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Entrada
[type] => Original
)
[1] => Array
(
[sequency] => 000000005
[dateTime] => DateTime Object
(
[date] => 2015-05-20 18:07:00.000000
[timezone_type] => 3
[timezone] => America/Sao_Paulo
)
[reason] =>
[direction] => Saída
[type] => Original
)
)
)
)
)
)
```