open-payroll icon indicating copy to clipboard operation
open-payroll copied to clipboard

Features

Open nasrulhazim opened this issue 7 years ago • 1 comments

  • [x] Multiple Earning and Deductions, based on organisation or employee
  • [ ] Automated Payroll Calculation using Payroll Scheduler
  • [ ] Each payroll will require at least a reviewer and an approver
  • [ ] Customisable Payslip Design
  • [ ] E-mail / Export the payslip to the employee
  • [ ] Payroll Report for Administrator
  • [ ] Payroll Report for Employee
  • [x] Custom Earnings and Deductions
  • [ ] Customisable earnings and deductions calculation process

nasrulhazim avatar Aug 20 '18 09:08 nasrulhazim

Customisable earnings and deductions calculation process

For both earning and deduction by default will not need to use earning / deduction processor if the type of each earning / deduction did not exist - refer Line 50 and Line 60 in Payslip processor.

If we require to have separate calculation based on it's type - for example Leave Encashment (Earning), then you need to extend the \CleaniqueCoders\OpenPayroll\Processors\Earning\BaseEarningProcessor class, and implement the concrete implementation for getting the amount of Leave Encashment in calculate() method.

Below is an example of custom earning calculation.

<?php

namespace CleaniqueCoders\OpenPayroll\Processors\Earning;

class LeaveEncashmentProcessor extends BaseEarningProcessor
{
	/**
	 * @todo Apply your logic here
	 * @return float	Rate for the employee, if any.
	 */
	public function getRate()
	{
		// get the employee rate for leave encashment
	}

	/**
	 * @todo Apply your logic here
	 * @return int	Days Entitled for Leave Encashment
	 */
	public function getEntitledLeaves()
	{
		// return amount of days entitled for leave encashement
	}

	public function calculate()
	{
		return $this->getEntitledLeaves() * $this->getRate();
	}
}

To use this new processor, please ensured to add Leave Encashment as a new type of Earning.

nasrulhazim avatar Aug 24 '18 08:08 nasrulhazim