https://github.com/cleaniquecoders/payslip-core
Payslip Core
https://github.com/cleaniquecoders/payslip-core
employee payslip salary
Last synced: 8 months ago
JSON representation
Payslip Core
- Host: GitHub
- URL: https://github.com/cleaniquecoders/payslip-core
- Owner: cleaniquecoders
- Created: 2018-10-11T04:23:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-14T05:43:09.000Z (almost 7 years ago)
- Last Synced: 2024-12-31T22:42:06.674Z (9 months ago)
- Topics: employee, payslip, salary
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/cleaniquecoders/payslip-core) [](https://packagist.org/packages/cleaniquecoders/payslip-core) [](https://packagist.org/packages/cleaniquecoders/payslip-core) [](https://scrutinizer-ci.com/g/cleaniquecoders/payslip-core/?branch=master) [](https://packagist.org/packages/cleaniquecoders/payslip-core)
# Payslip Core
This package about provide a simple processor for payslip - calculate employee salary for the given year and month. Each employee have their own earnings and deductions.
Earnings - anything that related to employee for getting more amount of money like Travel Allowance, Meal Allowance, Director Allowance.
Deductions - anything that related to employee for getting less amount of money - Zakat, Laptop Loan, Insurance.
## Earning / Deduction Contribution
To add new earning / deduction, you can implement `CleaniqueCoders\Payslip\Contracts\Contribution` interface. Once implement, you need to add following methods in your class:
```php
public function name(): string
{
return 'Director Allowance'
}public function type(): string;
{
return \CleaniqueCoders\Payslip\Payslip::EARNING; // for earning
// return \CleaniqueCoders\Payslip\Payslip::DEDUCTION; // for deduction
}public function contribution()
{
return 1000; // do your logic to get the amount of contribution
}
```## Usage
```php
// implement CleaniqueCoders\Payslip\Contracts\Employee interface
$employee = new \App\Models\Employee();
$salary = new \CleaniqueCoders\Payslip\Salary();// Earnings
// Implement CleaniqueCoders\Payslip\Contracts\Contribution interface
$basic_salary = new \App\Processors\Payslip\Earnings\BasicSalary();
$basic_salary->setAmount(5000);
$salary->addEarnings($basic_salary);// Implement CleaniqueCoders\Payslip\Contracts\Contribution interface
$travel_allowance = new \App\Processors\Payslip\Earnings\TravelAllowance();
$travel_allowance->setAmount(500);
$salary->addEarnings($travel_allowance);// @todo Deductions
// Payslip accept CleaniqueCoders\Payslip\Contracts\Employee contracts and
// CleaniqueCoders\Payslip\Salary object in the constructor
$payslip = new \CleaniqueCoders\Payslip\Payslip($employee, $salary);
$payslip
->setYear(2018)
->setMonth(10)
->setPayday('2018-10-28')
->handle();$summary = $payslip->getSummary();
```