122 lines
3.8 KiB
PHP
Executable File
122 lines
3.8 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class Emppaydate_model extends Model
|
|
{
|
|
|
|
/**
|
|
* This function is used to get the user listing count
|
|
* @param string $searchText : This is optional search text
|
|
* @param number $page : This is pagination offset
|
|
* @param number $segment : This is pagination limit
|
|
* @return array $result : This is result
|
|
*/
|
|
function emppayListing()
|
|
{
|
|
$builder = $this->db->table('t_loan_master')
|
|
->select('t_loan_master.*,t_emp_pay_data.*,t_employee_details.FirstName')
|
|
->join('t_employee_details', 't_loan_master.EmpID = t_employee_details.EmpID', 'LEFT')
|
|
->join('t_emp_pay_data', 't_loan_master.EmpID = t_emp_pay_data.EmpID', 'LEFT');
|
|
$query = $builder->get();
|
|
$result = $query->getResult();
|
|
return $result;
|
|
}
|
|
|
|
function deleteEmployeePay($Loan_ID)
|
|
{
|
|
$query = $this->db->table('t_loan_master')->delete(['Loan_ID' => $Loan_ID]);
|
|
return $query;
|
|
}
|
|
|
|
|
|
|
|
|
|
function addNewemppay($emppay)
|
|
{
|
|
$this->db->transStart();
|
|
$builder = $this->db->table('t_emp_pay_data');
|
|
$builder->insert($emppay);
|
|
|
|
$paydataid = $this->db->insertId();
|
|
|
|
$this->db->transComplete();
|
|
|
|
return $emppay;
|
|
}
|
|
|
|
function addLoanInfo($dataarray, $string)
|
|
{
|
|
if ($string == 'add') {
|
|
$builder = $this->db->table('t_loan_master');
|
|
$builder->insert($dataarray);
|
|
|
|
$loanid = $this->db->affectedRows();
|
|
return $loanid;
|
|
} else if ($string == 'update') {
|
|
$loanid = $dataarray['Loan_ID'];
|
|
|
|
$this->db->table('t_loan_master')
|
|
->where('Loan_ID', $loanid)
|
|
->update($dataarray);
|
|
|
|
$loanid = $this->db->affectedRows();
|
|
return $loanid;
|
|
}
|
|
}
|
|
function getUserInfo($paydataid)
|
|
{
|
|
$sql = 'select t_emp_pay_data.Pay_Data_ID,t_emp_pay_data.EmpID as PAYEMPID,t_emp_pay_data.Basic_Pay,t_emp_pay_data.HRA_Rate,t_emp_pay_data.Allowances,t_emp_pay_data.Food_Allowances,t_emp_pay_data.Incentives,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,t_emp_pay_data.HRA_Amount,t_emp_pay_data.TotalSalary,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.*from t_emp_pay_data
|
|
join t_employee_details on t_emp_pay_data.EmpID=t_employee_details.EmpID
|
|
left join t_loan_master on t_emp_pay_data.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1
|
|
where t_emp_pay_data.Pay_Data_ID = ?;';
|
|
$query = $this->db->query($sql, array($paydataid));
|
|
|
|
return $query->getResult();
|
|
}
|
|
function getUserLoanHistoryInfo($loan_id)
|
|
{
|
|
$sql = 'select * from t_loan_history where Loan_ID = ?;';
|
|
$query = $this->db->query($sql, array($loan_id));
|
|
|
|
return $query->getResult();
|
|
}
|
|
|
|
function getEmpPayData($EmpID)
|
|
{
|
|
$sql = 'select t_emp_pay_data.Pay_Data_ID,t_emp_pay_data.EmpID,t_emp_pay_data.Basic_Pay,t_emp_pay_data.HRA_Rate,t_emp_pay_data.Allowances,t_emp_pay_data.Food_Allowances,t_emp_pay_data.Incentives,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,t_emp_pay_data.HRA_Amount,t_emp_pay_data.TotalSalary from t_emp_pay_data
|
|
|
|
where t_emp_pay_data.EmpID = ?;';
|
|
$query = $this->db->query($sql, array($EmpID));
|
|
|
|
return $query->getRow();
|
|
}
|
|
|
|
|
|
function editemppay($emppaydatas)
|
|
{
|
|
|
|
$EmpID = $emppaydatas['EmpID'];
|
|
//echo $paydateid;
|
|
//print_r($emppaydatas);die();
|
|
$this->db->table('t_emp_pay_data')
|
|
->where('EmpID', $EmpID)
|
|
->update($emppaydatas);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
function viewemppay($emppaydata, $paydateid)
|
|
{
|
|
$this->db->table('t_emp_pay_data')
|
|
->where('Pay_Data_ID', $paydateid)
|
|
->update($emppaydata);
|
|
|
|
|
|
return TRUE;
|
|
}
|
|
}
|