convenia / afd-reader
Pacote para leitura de Arquivo Fonte de Dados (AFD). Especificação do MTE referente a portaria 1.510/2009.
Installs: 27 944
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 6
Open Issues: 0
Requires
- php: ^7.0|^8.0
Requires (Dev)
- codacy/coverage: dev-master
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2024-12-19 19:31:07 UTC
README
Pacote para leitura de Arquivo Fonte de Dados (AFD). Especificação do MTE referente a portaria 1.510/2009.
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:
use Convenia\AfdReader\AfdReader; ... $afdReader = new AfdReader('afdt_test.txt');
Informando o tipo do arquivo:
use Convenia\AfdReader\AfdReader; ... $afdReader = new AfdReader('afdt_test.txt', 'Afdt');
Obter informações agrupadas por NIS/PIS:
$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:
$afdReader->getByUser(62915959739);
Obter as ocorrências de um NIS/PIS no período especificado:
$afdReader->getByUser(62915959739, ['from' => '2015-05-20', 'to' => '2015-05-20']);
Obter as informações de todos os registros:
$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
)
)
)
)
)
)