0
Leave management using php
Hi coders, would like to ask if you have any samples or reference on leave management system. The system will autodeduct the leave balance once the staff apply for leave. Thanks,
4 Réponses
0
Front or back end?
0
Both front & back end, thanks.
0
You need to have a database eg mysql with table to keep all the employees and their salary record.
First page you could make is showing all employee salary record, with SQL query SELECT * FROM employee.
0
Thanks. Tried this function but with error. Appreciate if anyone can fix the error or have a better method for the annual leave balance calculation? Thanks.
<?php
// Create a function to count leave balance for the year.
class Leave {
public $leave_entitlement;
public $start_date;
public $end_date;
public $leave_balance;
public function days_between($startDate='TODAY', $endDate='TODAY')
{
$start_date = new DateTime($startDate);
$end_date = new DateTime($endDate);
$diff = $end_date->diff($start_date);
return $diff->days;
}
public function calculateLeaveBal($leave_entitlement, $diff) {
$leave_balance=$this->$leave_entitlement-$diff;
echo $this->leave_balance;
}
}
$leave1 = new Leave();
echo $leave1->days_between('Today','Tomorrow');
echo $leave1->calculateLeaveBal(20, 1);
?>