diff --git a/app/Controllers/Emppaydate.php b/app/Controllers/Emppaydate.php
index 98423449..d71c129b 100644
--- a/app/Controllers/Emppaydate.php
+++ b/app/Controllers/Emppaydate.php
@@ -78,12 +78,6 @@ class Emppaydate extends BaseController
function addNewemppay()
{
-
-
-
-
-
-
$EmpID = $this->request->getPost('EmpID');
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
@@ -96,13 +90,9 @@ class Emppaydate extends BaseController
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
$CreateBy = $this->session->get('userId');
-
-
$loandetails = array('EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Created_By' => $CreateBy);
-
-
if ($Loan_Amount != 0) {
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'add');
if ($result2 > 0) {
@@ -111,8 +101,8 @@ class Emppaydate extends BaseController
echo "";
}
}
-
+ return redirect()->to('/emppayListings');
}
/**
@@ -123,6 +113,7 @@ class Emppaydate extends BaseController
$data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid);
+ // print_r($data);die;
$this->global['pageTitle'] = 'Edit Employee Pay Monthly Details ';
@@ -151,16 +142,9 @@ class Emppaydate extends BaseController
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
$Last_Mod_By = $this->session->get('userId');
-
-
-
-
-
-
$loandetails = array('Loan_ID' => $loan_ID, 'EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Last_Mod_By' => $Last_Mod_By);
-
if ($Loan_Amount != 0 and $loan_ID != '') {
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'update');
if ($result2 > 0) {
@@ -177,19 +161,16 @@ class Emppaydate extends BaseController
echo "";
}
}
-
-
-
-
+ return redirect()->to('/emppayListings');
}
function deleteEmpPay()
{
- $EmpID = $this->request->getPost('id');
+ $LoanID = $this->request->getPost('id');
//echo $EmpID;
- $result = $this->emppaydate_model->deleteEmployeePay($EmpID);
+ $result = $this->emppaydate_model->deleteEmployeePay($LoanID);
if ($result == 1) {
echo "Deleted Sucessfully..!";
} else {
diff --git a/app/Models/Emppaydate_model.php b/app/Models/Emppaydate_model.php
index 17bdf4ba..5d65ce5b 100644
--- a/app/Models/Emppaydate_model.php
+++ b/app/Models/Emppaydate_model.php
@@ -1,11 +1,12 @@
-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();
+ ->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($EmpID)
+
+ function deleteEmployeePay($Loan_ID)
{
- $query = $this->db->table('t_emp_pay_data')->delete(['EmpID' => $EmpID]);
+ $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);
-
+ $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)
+ function addLoanInfo($dataarray, $string)
{
- $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
+ 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));
-
+ $query = $this->db->query($sql, array($paydataid));
+
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
+ $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));
-
+ $query = $this->db->query($sql, array($EmpID));
+
return $query->getRow();
}
-
-
- function editemppay($emppaydatas)
+
+
+ function editemppay($emppaydatas)
{
- $EmpID=$emppaydatas['EmpID'];
- //echo $paydateid;
- //print_r($emppaydatas);die();
+ $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)
+
+
+ function viewemppay($emppaydata, $paydateid)
{
$this->db->table('t_emp_pay_data')
->where('Pay_Data_ID', $paydateid)
->update($emppaydata);
-
-
+
+
return TRUE;
}
-
-
}
-?>
diff --git a/app/Views/addemppaydate.php b/app/Views/addemppaydate.php
index 835df076..a7b11127 100644
--- a/app/Views/addemppaydate.php
+++ b/app/Views/addemppaydate.php
@@ -1,303 +1,290 @@
-
-
-
-
-
-
-
-
-
-
-
-
- getFlashdata('error');
- if($error)
- {
- ?>
-
- ×
- getFlashdata('error'); ?>
-
-
- getFlashdata('success');
- if($success)
- {
- ?>
-
- ×
- getFlashdata('success'); ?>
-
-
-
-
-
- listErrors('
', ' ×
'); ?>
+
+
+
+
-
+
+
+
+
+
+
+
+ getFlashdata('listErrors');
+ if ($listErrors) {
+ ?>
+
+
+
+ ×
+ getFlashdata('listErrors'); ?>
+
+
+
+
+
+
+ getFlashdata('error');
+ if ($error) {
+ ?>
+
+ ×
+ getFlashdata('error'); ?>
+
+
+
+ getFlashdata('success');
+ if ($success) {
+ ?>
+
+ ×
+ getFlashdata('success'); ?>
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/app/Views/editOldemppay.php b/app/Views/editOldemppay.php
index c6f39ee9..07906209 100644
--- a/app/Views/editOldemppay.php
+++ b/app/Views/editOldemppay.php
@@ -1,133 +1,151 @@
-
- Pay_Data_ID;
- $EmpID=$ep->PAYEMPID;
- $Empname=$ep->FirstName ." ". $ep->LastName ;
- $TotalSalary=$ep->TotalSalary;
- $Basic_Pay=$ep->Basic_Pay;
- $HRA_Rate=$ep->HRA_Rate;
- $HRA_Amount=$ep->HRA_Amount;
-
- $Allowances=$ep->Allowances;
- $PF_Rate=$ep->PF_Rate;
- $ESI_Rate=$ep->ESI_Rate;
- $is_Active=$ep->is_Active;
- $Food_Allowances=$ep->Food_Allowances;
- $Incentives=$ep->Incentives;
- $Loan_Amount=$ep->Loan_Amount;
- if(empty($Loan_Amount)){$Loan_Amount = 0.00;}
- if( !empty($ep->Loan_Issued_Date) ){
- $Loan_issued_date=new DateTime( $ep->Loan_Issued_Date, new DateTimeZone('Asia/Kolkata'));
- $Loan_issued_date=$Loan_issued_date->format('d-m-Y');}
- else{$Loan_issued_date=null;}
-
- $Monthly_due=$ep->Monthly_Due;
- if(empty($Monthly_due)){$Monthly_due = 0.00;}
- if(!empty($ep->Due_Start_Date)){
- $Due_start_date=new DateTime( $ep->Due_Start_Date, new DateTimeZone('Asia/Kolkata'));
- $Due_start_date=$Due_start_date->format('d-m-Y');}
- else{$Due_start_date=null;}
- $No_of_dues=$ep->No_of_Dues;
- if(empty($No_of_dues)){$No_of_dues = 0.00;}
- $Paid_Due=$ep->Paid_Due;
- if(empty($Paid_Due)){$Paid_Due = 0.00;}
- $Remaining_Due=$ep->Remaining_Due;
- if(empty($Remaining_Due)){$Remaining_Due = 0.00;}
- $Paid_Amount=$ep->Paid_Amount;
- if(empty($Paid_Amount)){$Paid_Amount = 0.00;}
- $Created_By=$ep->Created_By;
- $Created_Time=$ep->Created_Time;
- $Last_Mod_By=$ep->Last_Mod_By;
- $Last_Mod_Time=$ep->Last_Mod_Time;
- $loanid = $ep->Loan_ID;
+$Pay_Data_ID = '';
+$EmpID = '';
+$Empname = "";
+$Basic_Pay = '';
+$HRA_Rate = '';
-
+$Allowances = '';
+$PF_Rate = '';
+$ESI_Rate = '';
+$is_Active = '';
+$Food_Allowances = '';
+$Incentives = '';
+$Created_By = '';
+$Created_Time = '';
+$Last_Mod_By = '';
+$Last_Mod_Time = '';
+$HRA_Amount = 0.0;
+$TotalSalary = 0.0;
+$Loan_Amount = '';
+$Loan_issued_date = '';
+$Monthly_due = '';
+$Due_start_date = '';
+$No_of_dues = '';
+$Remaining_Due = '';
+$Paid_Due = '';
+$Paid_Amount = 0;
+$loanid = '';
+
+
+if (!empty($emppay)) {
+ // print_r($emppay);
+ // die();
+ foreach ($emppay as $ep) {
+
+
+
+ $Pay_Data_ID = $ep->Pay_Data_ID;
+ $EmpID = $ep->PAYEMPID;
+ $Empname = $ep->FirstName . " " . $ep->LastName;
+ $TotalSalary = $ep->TotalSalary;
+ $Basic_Pay = $ep->Basic_Pay;
+ $HRA_Rate = $ep->HRA_Rate;
+ $HRA_Amount = $ep->HRA_Amount;
+
+ $Allowances = $ep->Allowances;
+ $PF_Rate = $ep->PF_Rate;
+ $ESI_Rate = $ep->ESI_Rate;
+ $is_Active = $ep->is_Active;
+ $Food_Allowances = $ep->Food_Allowances;
+ $Incentives = $ep->Incentives;
+ $Loan_Amount = $ep->Loan_Amount;
+ if (empty($Loan_Amount)) {
+ $Loan_Amount = 0.00;
+ }
+ if (!empty($ep->Loan_Issued_Date)) {
+ $Loan_issued_date = new DateTime($ep->Loan_Issued_Date, new DateTimeZone('Asia/Kolkata'));
+ $Loan_issued_date = $Loan_issued_date->format('d-m-Y');
+ } else {
+ $Loan_issued_date = null;
+ }
+
+ $Monthly_due = $ep->Monthly_Due;
+ if (empty($Monthly_due)) {
+ $Monthly_due = 0.00;
+ }
+ if (!empty($ep->Due_Start_Date)) {
+ $Due_start_date = new DateTime($ep->Due_Start_Date, new DateTimeZone('Asia/Kolkata'));
+ $Due_start_date = $Due_start_date->format('d-m-Y');
+ } else {
+ $Due_start_date = null;
+ }
+ $No_of_dues = $ep->No_of_Dues;
+ if (empty($No_of_dues)) {
+ $No_of_dues = 0.00;
+ }
+ $Paid_Due = $ep->Paid_Due;
+ if (empty($Paid_Due)) {
+ $Paid_Due = 0.00;
+ }
+ $Remaining_Due = $ep->Remaining_Due;
+ if (empty($Remaining_Due)) {
+ $Remaining_Due = 0.00;
+ }
+ $Paid_Amount = $ep->Paid_Amount;
+ if (empty($Paid_Amount)) {
+ $Paid_Amount = 0.00;
+ }
+ $Created_By = $ep->Created_By;
+ $Created_Time = $ep->Created_Time;
+ $Last_Mod_By = $ep->Last_Mod_By;
+ $Last_Mod_Time = $ep->Last_Mod_Time;
+ $loanid = $ep->Loan_ID;
}
}
@@ -135,365 +153,289 @@ if(!empty($emppay))
?>
-
-
-
-
-
- getFlashdata('error');
- if($error)
- {
- ?>
-
- �
- getFlashdata('error'); ?>
-
-
- getFlashdata('success');
- if($success)
- {
- ?>
-
- �
- getFlashdata('success'); ?>
-
-
-
-
-
- ', ' �
'); ?>
+
+
+
+
+
+
+
+
+
+
+
+ getFlashdata('listErrors');
+ if ($listErrors) {
+ ?>
+
+
+
+ ×
+ getFlashdata('listErrors'); ?>
+
+
+
+
+
+
+ getFlashdata('error');
+ if ($error) {
+ ?>
+
+ ×
+ getFlashdata('error'); ?>
+
+
+
+ getFlashdata('success');
+ if ($success) {
+ ?>
+
+ ×
+ getFlashdata('success'); ?>
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+ dateCalulation();
+
+
+ }
+
+ function dateCalulation() {
+ //alert('j');
+ var loanamount = document.getElementById('Loan_Amount').value;
+ if (loanamount == 0.00 || loanamount == "") {
+ $('#loan_issued_date').val("");
+ $('#due_started').val("");
+ $('#monthly_due').val("0.00");
+ $('#remaining_due').val(0);
+ $('#no_of_due').val(0);
+ $('#Loan_Amount').val("0.00");
+ $('#paid_due').val(0);
+ $('#Paid_Amount').val("0.00");
+
+
+ }
+
+ }
+
+ function finalCheck() {
+ //alert("final check");
+
+
+
+ var loanamount = document.getElementById('Loan_Amount').value;
+ if (loanamount != "" && loanamount != 0.00) {
+ var idate = document.getElementById('loan_issued_date').value;
+ var due = document.getElementById('monthly_due').value;
+ var dsdate = document.getElementById('due_started').value;
+ if (idate == "" || due == "" || due == 0.00 || dsdate == "") {
+ alert("Enter All Loan Information Correctly...!");
+ return false;
+ }
+ }
+
+ if ($('#Total_Salary').val() == '' || $('#HRA_Rate').val() == '' || $('#Allowances').val() == '' || $('#PF_Rate').val() == '' || $('#ESI_Rate').val() == '' || $('#Food_Allowances').val() == '' || $('#Incentives').val() == '') {
+
+ alert("Please Enter All Information Correctly..!");
+ return false;
+ }
+ }
+
+ $("#deleteemp").click(function() {
+ var loanid = "Loan_ID;
+ } ?>";
+ var i = confirm("Do You want to delete " + loanid + " from Loan Master?");
+ // alert(i);s
+ if (i) {
+ // $('#content').loader('show');
+ $.ajax({
+ data: {
+ id: loanid
+ },
+ type: "POST",
+ url: "emppaydate/deleteEmpPay",
+ success: function(result) {
+ if (result) {
+
+ alert(result);
+ // $('#content').loader('hide');
+ window.location.href = "emppayListings";
+
+ }
+
+ }
+ });
+ }
+
+ });
+
+
\ No newline at end of file
diff --git a/app/Views/emppayListing.php b/app/Views/emppayListing.php
index c0c3e68e..4f236708 100644
--- a/app/Views/emppayListing.php
+++ b/app/Views/emppayListing.php
@@ -1,88 +1,66 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
Employee Loan Details
+
+
-
-
-
-
-
-
-
- Employee
- Total Sal in ₹
- Loan Amt in ₹
- Loan Issued Date
- Monthly Due Amt in ₹
- No Of Dues
- Paid Dues
- Remaining Dues
- Paid Amt in ₹
- Action
+
+
+
+
+
+
+ Employee
+ Total Sal in ₹
+ Loan Amt in ₹
+ Loan Issued Date
+ Monthly Due Amt in ₹
+ No Of Dues
+ Paid Dues
+ Remaining Dues
+ Paid Amt in ₹
+ Action
-
-
-
+
+
-
- EmpID ?>-FirstName;?>
- TotalSalary; ?>
- Loan_Amount; ?>
- Loan_Issued_Date; ?>
- Monthly_Due; ?>
- No_of_Dues; ?>
- Paid_Due; ?>
- Remaining_Due; ?>
- Paid_Amount; ?>
-
-
- EDIT
-
-
-
-
-
-
-
-
-
-
+ if (!empty($userRecords)) {
+ foreach ($userRecords as $record) { ?>
+
+ EmpID ?>-FirstName; ?>
+ TotalSalary; ?>
+ Loan_Amount; ?>
+ Loan_Issued_Date; ?>
+ Monthly_Due; ?>
+ No_of_Dues; ?>
+ Paid_Due; ?>
+ Remaining_Due; ?>
+ Paid_Amount; ?>
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/Views/includes/new_footer.php b/app/Views/includes/new_footer.php
index 6a24dc58..31ec9b10 100644
--- a/app/Views/includes/new_footer.php
+++ b/app/Views/includes/new_footer.php
@@ -1,29 +1,17 @@
+
+
+
+
+
+
+
+
-
-
-
-