Skip to content

Commit

Permalink
commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
conveniadev committed Sep 22, 2022
0 parents commit 706562b
Show file tree
Hide file tree
Showing 49 changed files with 4,014 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor/
build/
.idea/
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sudo: false

language: php

cache:
directories:
- $HOME/.composer/cache/files

matrix:
include:
- php: 7.0
fast_finish: true

before_script:
- travis_retry composer self-update
- travis_retry composer global require hirak/prestissimo
- travis_retry composer install --prefer-dist --no-interaction

notifications:
script:
- "phpunit --process-isolation"
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2014 Davis Peixoto

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
268 changes: 268 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
![logo](afdreader.png)

---

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).

---
[![Latest Stable Version](https://poser.pugx.org/convenia/afd-reader/v/stable)](https://packagist.org/packages/convenia/afd-reader)
[![Build Status](https://travis-ci.org/convenia/afd-reader.svg?branch=master)](https://travis-ci.org/convenia/afd-reader)
[![Total Downloads](https://poser.pugx.org/convenia/afd-reader/downloads)](https://packagist.org/packages/convenia/afd-reader)
[![License](https://poser.pugx.org/convenia/afd-reader/license)](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
)
)
)
)
)
)
```
Binary file added afdreader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "convenia/afd-reader",
"license": "MIT",
"description": "Pacote para leitura de Arquivo Fonte de Dados (AFD). Especificação do MTE referente a portaria 1.510/2009.",
"keywords": ["php", "afd", "acjef", "afdt", "mte"],
"homepage": "https://github.com/convenia/afd-reader",
"authors": [
{
"name": "Victor Ventura",
"email": "[email protected]"
},
{
"name": "Alex Assunção",
"email": "[email protected]"
},
{
"name": "Convenia",
"email": "[email protected]"
}
],
"require": {
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"codacy/coverage": "dev-master"
},
"autoload": {
"psr-4": {
"Convenia\\AfdReader\\": "src/"
}
}
}
Loading

0 comments on commit 706562b

Please sign in to comment.