Skip to content

Commit

Permalink
refactor map and improve ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
euventura committed Jan 26, 2017
2 parents 35bc9ae + 07c42c2 commit b131dd9
Show file tree
Hide file tree
Showing 12 changed files with 441 additions and 104 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.phar
/vendor/
build
composer.lock
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ finder:
exclude:
- "tests"
name:
- "*.php"
- "*.php"
111 changes: 106 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# dominio-payslip-import

[![Latest Stable Version](https://poser.pugx.org/convenia/dominio-payslip-import/v/stable)](https://packagist.org/packages/convenia/dominio-payslip-import) [![Build Status](https://travis-ci.org/convenia/dominio-payslip-import.svg?branch=master)](https://travis-ci.org/convenia/dominio-payslip-import) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b9d51779126a42fea449632cff17984f)](https://www.codacy.com/app/Convenia/dominio-payslip-import) [![StyleCI](https://styleci.io/repos/67138972/shield)](https://styleci.io/repos/67138972) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/b38b2c28-b697-4843-983c-52ffac7c0221/mini.png)](https://insight.sensiolabs.com/projects/b38b2c28-b697-4843-983c-52ffac7c0221) [![License](https://poser.pugx.org/convenia/dominio-payslip-import/license)](https://packagist.org/packages/convenia/dominio-payslip-import)

## Requisitos

* PHP >= 5.6

### Instale usando o composer [Composer](http://getcomposer.org/)

```bash
composer require convenia/dominio-payslip-import
```

## Uso

```php
<?php
use Convenia\Dominio\Payslip\Payslip;

$filePath = 'PATH/TO/TXT/FILE';

$payslip = new Payslip();
$payslip = new Payslip;
$payslip->importFromFile($filePath);

$events = $payslip->getEvents();
Expand All @@ -18,13 +31,101 @@ Array
(
[0] => Array
(
[employee_code] => 13
[employee_name] => THORIN OAKENSHIELD
[company_code] => 412
[employee_code] => 50
[employee_name] => GANDALF THE GREY
[company_name] => THE LORD OF THE RINGS
[company_reg] => 22924567000158
[role] => LEADER OF THE FELLOWSHIP
[cost_center] => BR23 SALES QUALIFYING OUT
[company_department] => 1,000000
[company_branch] => 1
[admission_date] => 24/08/2015
[rubrik_name] => DESCONTO PLANO DE SAÚDE
[rubrik_code] => 8111
[reference] => 1,00
[event_value] => 1,00
[event_type] => D
[role] => DWARF
[description] => DESC VALE REFEIÇÃO
[salary] => 2616,75
[base_inss] => 2616,75
[base_irrf] => 2328,91
[base_fgts] => 2616,75
[month_fgts] => 209,340000
[level_irrf] => 7,50

)

)
```

## Retornar todos os eventos de um único funcionário

Após importar um arquivo você poderá retornar todos os eventos encontrados no arquivo com o método getEvents() ou retornar apenas os eventos de um determinado funcionário com o método find()

```php
<?php
use Convenia\Dominio\Payslip\Payslip;

$filePath = 'PATH/TO/TXT/FILE';

$payslip = new Payslip;
$payslip->importFromFile($filePath);

$events = $payslip->query()->find(13);

// Exemplo de retorno

Array
(
[0] => Array
(
[company_code] => 412
[employee_code] => 50
[employee_name] => GANDALF THE GREY
[company_name] => THE LORD OF THE RINGS
[company_reg] => 22924567000158
[role] => LEADER OF THE FELLOWSHIP
[cost_center] => BR23 SALES QUALIFYING OUT
[company_department] => 1,000000
[company_branch] => 1
[admission_date] => 24/08/2015
[rubrik_name] => DESCONTO PLANO DE SAÚDE
[rubrik_code] => 8111
[reference] => 1,00
[event_value] => 1,00
[event_type] => D
[salary] => 2616,75
[base_inss] => 2616,75
[base_irrf] => 2328,91
[base_fgts] => 2616,75
[month_fgts] => 209,340000
[level_irrf] => 7,50

)

[1] => Array
(
[company_code] => 412
[employee_code] => 50
[employee_name] => THORIN
[company_name] => THE LORD OF THE RINGS
[company_reg] => 22924567000158
[role] => DWARF
[cost_center] => BR23 SALES QUALIFYING OUT
[company_department] => 1,000000
[company_branch] => 1
[admission_date] => 24/08/2015
[rubrik_name] => DESCONTO PLANO DE SAÚDE
[rubrik_code] => 8111
[reference] => 1,00
[event_value] => 1,00
[event_type] => P
[salary] => 2616,75
[base_inss] => 2616,75
[base_irrf] => 2328,91
[base_fgts] => 2616,75
[month_fgts] => 209,340000
[level_irrf] => 7,50
)
)
```
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"keywords": [
"php",
"dominio",
"holerite"
"holerite",
"folha de pagamento",
"fechamento de folha",
"contador"
],
"authors": [
{
Expand All @@ -20,7 +23,7 @@
],
"require": {
"php": ">=5.4",
"tightenco/collect": "^5.3"
"tightenco/collect": "^5.4"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0",
Expand Down
Loading

0 comments on commit b131dd9

Please sign in to comment.