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

68 lines
2.7 KiB
PHP

<?php
class MAttendance extends CI_Model
{
function getAttendance()
{
//echo "select * from tbl_attendances where attendance_date='".date('Y-m-d')."' and status='1'";
$TableData=$this->db->query("select * from tbl_attendances where attendance_date='".date('Y-m-d')."' and status=1")->result();
//pre($TableData);die;
return $TableData;
}
function getAttendance1()
{
//echo "select * from tbl_attendances where attendance_date='".date('Y-m-d')."' and status='1'";
if(isset($_GET['attendance_date'])){
$adate=NepaliToEnglishDate($_GET['attendance_date']);
}else {
$adate=date('Y-m-d');
}
$TableData=$this->db->query("select * from tbl_attendances where attendance_date='".$adate."'")->result();
//pre($TableData);die;
return $TableData;
}
function insertAttendance($TableData1)
{
$this->db->insert('tbl_attendances',$TableData1);
}
function getDateRangeAttendance($from,$to,$id){
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' and employee_id=$id group by attendance_date")->result();
// foreach($TableData as $tabledata){
// $tabledata->employee=$this->db->query("select * from tbl_employees where employee_id=".$tabledata->employee_id)->row();
// }
//pre($TableData);die;
return $TableData;
}
function getPresentDateRangeAttendance($from,$to,$id){
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' and employee_id=$id and attendance=1 and status=1")->result();
// foreach($TableData as $tabledata){
// $tabledata->employee=$this->db->query("select * from tbl_employees where employee_id=".$tabledata->employee_id)->row();
// }
//pre($TableData);die;
return $TableData;
}
function getAbsentDateRangeAttendance($from,$to,$id){
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' and employee_id=$id and attendance=0 and status=1")->result();
// foreach($TableData as $tabledata){
// $tabledata->employee=$this->db->query("select * from tbl_employees where employee_id=".$tabledata->employee_id)->row();
// }
//pre($TableData);die;
return $TableData;
}
function getDaysOfRangeAttendance($from,$to){
// $t="select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' GROUP BY attendance_date ";
//echo $t;die;
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' GROUP BY attendance_date ")->result();
return $TableData;
}
}