BBnepal-Accounts/account/application/models/MHelper.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

62 lines
2.6 KiB
PHP

<?php
class MHelper extends CI_Model{
function checkIfAliasExist($alias,$alias_name,$table){
$this->db->where($alias_name,$alias);
$exist=$this->db->get($table);
if ($exist->num_rows()>0)
return true;
return false;
}
function getMaxDisplayOrder($table){
$this->db->select_max('display_order');
return $this->db->get($table)->row()->display_order;
}
function getHolidayByDaterangeInFactory($from_date,$to_date){
$t="select * from tbl_factorycalendar where day_work=0 and day_ad>='$from_date' and day_ad<='$to_date' ";
//echo $t;die;
return $this->db->query($t)->result();
}
function getTotalDaysByDaterange($from_date,$to_date){
$t="select * from tbl_factorycalendar where day_ad>='$from_date' and day_ad<='$to_date' ";
//echo $t;die;
return $this->db->query($t)->result();
}
function getTotalPresentsDaysByDaterange($from_date,$to_date,$id){
$t="select * from tbl_attendances where attendance=1 and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
//echo $t;die;
//echo $t;die;
return $this->db->query($t)->result();
}
function getTotalPaidLeavesByDaterange($from_date,$to_date,$id){
$t="select * from tbl_attendances where attendance=0 and reason='PL' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
//echo $t;die;
//echo $t;die;
return $this->db->query($t)->result();
}
function getTotalUnPaidLeavesByDaterange($from_date,$to_date,$id){
$t="select * from tbl_attendances where attendance=0 and reason='Off' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
//echo $t;die;
//echo $t;die;
return $this->db->query($t)->result();
}
function getTotalAnnualLeavesByDaterange($from_date,$to_date,$id){
$t="select * from tbl_attendances where attendance=0 and reason='SV' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
//echo $t;die;
//echo $t;die;
return $this->db->query($t)->result();
}
function getTotalSickLeavesByDaterange($from_date,$to_date,$id){
$t="select * from tbl_attendances where attendance=0 and reason='SL' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
//echo $t;die;
//echo $t;die;
return $this->db->query($t)->result();
}
}