db->insert('T_Payroll_File', $FileDetails); $Payon = $this->db->affected_rows(); return $Payon; } /** * This function is used to update the File details in which is already exists in the database * @FileDetails array : This will have the set of value which we need to insert into database * @return number boolean: success of the updation */ function UpdateFileName($FileDetails, $PayOn) { //echo $EmpID; $this->db->where('PayOn', $PayOn); $this->db->update('T_Payroll_File', $FileDetails); //print_r($this->db->last_query()); return TRUE; } /** * This function is used to check the File details is already exists in the database or not * @FileDetails array : This will have the set of value which we need to insert into database * @return number boolean: success of the updation */ function checkFileDetailsExists($PayOn) { $this->db->select('PayOn'); $this->db->from('T_Payroll_File'); $this->db->where('PayOn',$PayOn); $query = $this->db->get(); // print_r($this->db->last_query()); if ($query->num_rows > 0) { return $query->result(); } } /** * This function is used to insert the File data in database * @FileDetails array : This will have the set of value which we need to insert into database * @return number $Payon : Insert row count will be the return value */ function UploadFileData($FileData) { $this->db->insert('T_Payroll', $FileData); $Payon = $this->db->affected_rows(); //print_r($this->db->last_query()); return $Payon; } /** * This function is used to update the File details in which is already exists in the database * @FileDetails array : This will have the set of value which we need to insert into database * @return number boolean: success of the updation */ function UpdateFiledata($FileData, $PayOn,$EmpId) { //echo $EmpID; $this->db->where('PayOn', $PayOn); $this->db->where('EmpID', $EmpId); $this->db->update('T_Payroll', $FileData); //print_r($this->db->last_query()); //print_r($this->db->last_query()); return TRUE; } /** * This function is used to get the data details in which is already exists in the database * @FileDetails array : This will have the set of value which we need to insert into database * @return number boolean: success of the updation */ function GetPayslipdata($PayOn='',$EmpId='') { $this->db->select('Pay.*,payfile.TotalNoofDays as TotalNoofDays ,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.Designation as Designation,Dep.DepartmentName as DeptName'); $this->db->from('T_Payroll Pay'); $this->db->join('T_Payroll_File payfile', 'Pay.PayOn = payfile.PayOn'); $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode'); $this->db->where('Pay.PayOn', $PayOn); if($EmpId != '') { $this->db->where('Pay.EmpID', $EmpId); } $this->db->order_by("Pay.EmpID", "asc"); $query = $this->db->get(); return $query->result(); } /* *//** * This function is used to get the PayOn details from T_Payroll_File * @return array $result : This is result of the query */ function getPayOn() { $this->db->select('PayOn'); $this->db->from('T_Payroll_File'); $query = $this->db->get(); return $query->result(); } /* *//** * This function is used to get the PayOn details from T_Payroll_File * @return array $result : This is result of the query */ function getEmployeelist($Payon ='') { $this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname'); $this->db->from('T_Payroll Pay'); $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); if($Payon != '') { $this->db->where('Pay.PayOn', $Payon); } $this->db->order_by("Pay.EmpID", "asc"); $query = $this->db->get(); return $query; } /* *//** * This function is used to get the PayOn details from T_Payroll_File * @return array $result : This is result of the query */ function getEmpAll($Payon ='') { $this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname'); $this->db->from('T_Payroll Pay'); $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); if($Payon != '') { $this->db->where('Pay.PayOn', $Payon); } $this->db->order_by("Pay.EmpID", "asc"); $query = $this->db->get(); return $query->result_array(); } /* *//** * This function is used to delete the PayOn details from T_Payroll * @return array $result : This is result of the query */ function deleteFileData($PayOn='') { $this->db->where("PayOn", $PayOn); $this->db->delete('T_Payroll'); } } ?>