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,

17th Jan 2019, 2:25 AM
Sophia Daud
Sophia Daud - avatar
4 Answers
0
Front or back end?
17th Jan 2019, 3:33 AM
Calviղ
Calviղ - avatar
0
Both front & back end, thanks.
17th Jan 2019, 3:51 AM
Sophia Daud
Sophia Daud - avatar
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.
17th Jan 2019, 4:44 AM
Calviղ
Calviղ - avatar
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); ?>
23rd Jan 2019, 12:14 AM
Sophia Daud
Sophia Daud - avatar