merge : GWM

This commit is contained in:
bitbucket 2024-09-02 15:57:17 +05:30
commit 55d49266e5
13 changed files with 1906 additions and 2020 deletions

View File

@ -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 "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
}
}
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 "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
}
}
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 {

View File

@ -1,11 +1,12 @@
<?php
<?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
@ -16,104 +17,98 @@ class Emppaydate_model extends Model
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();
->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;
}
}
?>

View File

@ -1,303 +1,290 @@
<script>
$(document).ready(function() {
$(document).ready(function() {
$("#loan_issued_date").datepicker({
minDate: 'now',
// maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
$("#loan_issued_date").datepicker({
minDate: 'now',
// maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
$("#due_started").datepicker({
minDate: 'now',
//maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+1'
});
});
$("#due_started").datepicker({
minDate: 'now',
//maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+1'
});
});
</script>
<style type="text/css">
.num {
text-align: right;
}
.num {
text-align: right;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<center><b>
<h3 class="box-title">Add Employee Pay</h3>
</b></center>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>emppayListings" class="btn btn-success" value="Back" />Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-success">
<!-- form start -->
<form role="form" id="addemppaydate" action="<?php echo base_url() ?>emppaydate/addNewemppay"
method="post" name="addform">
<div class="box-body">
<div class="col-md-12">
<legend>Loan Details</legend>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<span for="EmpID">Employee ID</span>
<font color="Red">*</font>
<div class="form-group">
<?php
$Employee = array("-1"=>'Select Employee');
if(!empty($empdetails)){
foreach($empdetails as $emp){
$EmpID=$emp->EmpID;
$Employee+= array($EmpID => $emp->EmpID . "-" . $emp->FirstName);
}
}
$js = array('id'=> 'emp');
echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control"',$js);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Pay_Data_ID">Loan Amount</span>
<input type="text" class="form-control num" id="Loan_Amount"
name="Loan_Amount" value="0.00" pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Loan Issue(d) Date</span>
<input type="text" class="form-control num" id="loan_issued_date"
name="loan_issued_date" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Monthly Due</span>
<input type="text" value="0.00" class="form-control num" id="monthly_due"
name="monthly_due" value="" pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 1 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Due Started</span>
<input type="text" class="form-control requried num" id="due_started"
name="due_started" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">No Of Due(s)</span>
<input type="text" value="0" class="form-control requried num"
id="no_of_due" name="no_of_due" value="" pattern="[0-9]{1,2}"
title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Paid Amount</span>
<input type="text" value="0.00" class="form-control requried num"
id="Paid_Amount" name="Paid_Amount" value="0"
pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<input type="hidden" id="remaining_due" name="remaining_due" value="0">
<input type="hidden" id="paid_due" name="paid_due" value="0">
</div>
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-success" value="Submit"
onmouseover="finalCheck();" />
<input type="reset" class="btn btn-success" value="Reset" />
</div>
</div><!-- /.box-body -->
</form><!-- form closed -->
</div><!-- -->
</div><!-- -->
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row" style="margin-bottom: 10px;">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Add Employee Pay</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-dark waves-effect waves-light" href="<?php echo base_url(); ?>emppayListings"><span class="bold">Back</span></a>
</div>
</div>
</div> <!-- first row closed-->
</section>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Loan Details</h4>
<div class="row">
<div class="col-12">
<div class="p-2">
<form role="form" id="addemppaydate" action="<?php echo base_url() ?>emppaydate/addNewemppay" method="post" name="addform">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<span for="EmpID">Employee ID</span>
<font color="Red">*</font>
<div class="form-group">
<?php
$Employee = array("-1" => 'Select Employee');
if (!empty($empdetails)) {
foreach ($empdetails as $emp) {
$EmpID = $emp->EmpID;
$Employee += array($EmpID => $emp->EmpID . "-" . $emp->FirstName);
}
}
$js = array('id' => 'emp');
echo form_dropdown('EmpID', $Employee, set_value('EmpID'), 'class="form-control"', $js);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Pay_Data_ID">Loan Amount</span>
<input type="text" class="form-control num" id="Loan_Amount"
name="Loan_Amount" value="0.00" pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Loan Issue(d) Date</span>
<input type="text" class="form-control num" id="loan_issued_date"
name="loan_issued_date" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Monthly Due</span>
<input type="text" value="0.00" class="form-control num" id="monthly_due"
name="monthly_due" value="" pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 1 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Due Started</span>
<input type="text" class="form-control requried num" id="due_started"
name="due_started" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">No Of Due(s)</span>
<input type="text" value="0" class="form-control requried num"
id="no_of_due" name="no_of_due" value="" pattern="[0-9]{1,2}"
title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Paid Amount</span>
<input type="text" value="0.00" class="form-control requried num"
id="Paid_Amount" name="Paid_Amount" value="0"
pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
</div>
<input type="hidden" id="remaining_due" name="remaining_due" value="0">
<input type="hidden" id="paid_due" name="paid_due" value="0">
</div>
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onmouseover="finalCheck();" value="Submit" class="btn btn-success">
</div>
</div>
</form>
</div>
</div>
<?php
$listErrors = session()->getFlashdata('listErrors');
if ($listErrors) {
?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
</div>
<!--content-wrapper closed-->
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<script>
function calculalteHRA() {
//var empid=document.getElementById('emp').value;
//alert(empid);
var Totalsalary = document.getElementById('Total_salary').value;
var HRA = document.getElementById('HRA_Rate').value;
//if(EmpID == -1){alert("Select Employee ID..!");}
if (HRA == '') {
alert("Please Enter HRA RATE..");
document.getElementById('HRA_Rate').focus();
} else if (Totalsalary == '') {
alert("Please Enter Total Salary..");
document.getElementById('total_salary').focus();
} else {
var temp = (Totalsalary * (HRA / 100));
var basic = Totalsalary - temp;
document.getElementById('Basic_Pay').value = basic;
document.getElementById('HRA_Amount').value = temp;
}
}
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var due = document.getElementById('monthly_due').value;
if (loan != 0) {
if (due == 0) {
alert("Enter Monthly Due Amount....!");
$('#monthly_due').focus();
function calculalteHRA() {
//var empid=document.getElementById('emp').value;
//alert(empid);
var Totalsalary = document.getElementById('Total_salary').value;
var HRA = document.getElementById('HRA_Rate').value;
//if(EmpID == -1){alert("Select Employee ID..!");}
if (HRA == '') {
alert("Please Enter HRA RATE..");
document.getElementById('HRA_Rate').focus();
} else if (Totalsalary == '') {
alert("Please Enter Total Salary..");
document.getElementById('total_salary').focus();
} else {
var temp = (Totalsalary * (HRA / 100));
var basic = Totalsalary - temp;
document.getElementById('Basic_Pay').value = basic;
document.getElementById('HRA_Amount').value = temp;
}
}
totaldue = loan / due;
if (totaldue < 1) {
alert("Please Enter Correct Due Amount..!");
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var due = document.getElementById('monthly_due').value;
if (loan != 0) {
if (due == 0) {
alert("Enter Monthly Due Amount....!");
$('#monthly_due').focus();
} else {
document.getElementById('no_of_due').value = Math.ceil(totaldue);
var noofdues = document.getElementById('no_of_due').value;
$('#remaining_due').val(noofdues);
totaldue = loan / due;
if (totaldue < 1) {
alert("Please Enter Correct Due Amount..!");
$('#monthly_due').focus();
} else {
document.getElementById('no_of_due').value = Math.ceil(totaldue);
var noofdues = document.getElementById('no_of_due').value;
$('#remaining_due').val(noofdues);
}
}
} //else if(loan == "" || loan == 0)
//alert(totaldue);
}
} //else if(loan == "" || loan == 0)
//alert(totaldue);
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");
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() {
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...!");
}
}
function finalCheck() {
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...!");
}
}
}
}
</script>

View File

@ -1,133 +1,151 @@
<script>
$(document).ready(function(){
$(document).ready(function() {
$("#loan_issued_date").datepicker({
minDate : 'now',
// maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
$("#due_started").datepicker({
minDate :'now',
//maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+1'
});
});
$("#loan_issued_date").datepicker({
minDate: 'now',
// maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
$("#due_started").datepicker({
minDate: 'now',
//maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+1'
});
});
// window.onload = function(){
// window.onload = function(){
// loanReset();
// function loanReset(){
// //alert("hi");
// var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value;
// var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value;
// if(loan !=0){
// if (loan == paid)
// {
// //alert("loan reset");
// $("#Loan_Amount").val(0.00);
// $("#Paid_Amount").val(0.00);
// $("#monthly_due").val(0.00);
// $("#no_of_due").val(0);
// $("#remaining_due").val(0);
// $("#paid_due").val(0);
// $("#loan_issued_date").val("");
// $("#due_started").val("");
// }else
// {
// //alert("loan pending");
// }
// }
// }
// };
// function loanReset(){
// //alert("hi");
// var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value;
// var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value;
// if(loan !=0){
// if (loan == paid)
// {
// //alert("loan reset");
// $("#Loan_Amount").val(0.00);
// $("#Paid_Amount").val(0.00);
// $("#monthly_due").val(0.00);
// $("#no_of_due").val(0);
// $("#remaining_due").val(0);
// $("#paid_due").val(0);
// $("#loan_issued_date").val("");
// $("#due_started").val("");
// }else
// {
// //alert("loan pending");
// }
// }
// }
// };
</script>
<?php
$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='';
<?php
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;
$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))
?>
<style type="text/css">
.num {
text-align:right;
}
.num {
text-align: right;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<!--title-->
<center>Edit Loan Details</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>emppayListings" class="btn btn-success" value="Back">Back</a>
</div>
<br/>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-success">
<!-- form start-->
<form role="form" id="edit" action="<?php echo base_url() ?>emppaydate/editemppay" method="post">
<div class="box-body">
<div class="col-md-12">
<legend>Loan Details</legend>
</div>
<div class="row">
<input type="hidden" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Employee ID</span>
<input type="text" class="form-control" readonly id="EmployeeID" name="EmpID" value="<?php echo $EmpID; ?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="hidden" name="loanid" value="<?php echo $loanid;?>">
<span for="Pay_Data_ID">Loan Amount</span>
<input type="text" class="form-control num" id="Loan_Amount" name="Loan_Amount" value="<?php echo $Loan_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Loan Issue(d) Date</span>
<input type="text" class="form-control num" id="loan_issued_date" name="loan_issued_date" value="<?php echo $Loan_issued_date;?>" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Monthly Due</span>
<input type="text" class="form-control requried num" id="monthly_due" name="monthly_due" value="<?php echo $Monthly_due; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Due Started</span>
<input type="text" class="form-control requried num" id="due_started" name="due_started" value="<?php echo $Due_start_date; ?>" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">No Of Due(s)</span>
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="[0-9]{1,2}" title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Paid Amount</span>
<input type="text" class="form-control requried num" id="Paid_Amount" name="Paid_Amount" value="<?php echo $Paid_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<input type="hidden" id="remaining_due" name="remaining_due" value="<?php echo $Remaining_Due;?>">
<input type="hidden" id="paid_due" name="paid_due" value="<?php echo $Paid_Due;?>">
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="form-group">
<!--<span for ="CreatedBy">Created By:</span>-->
<input type="hidden" class="form-control required" id="CreatedBy" name="CreatedBy" value="<?php echo $Created_By; ?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<div class="form-group">
<!--<span for ="Created_Time">Created Time:</span>-->
<input type="hidden" class="form-control required" id="Created_Time" name="Created_Time" value="<?php echo $Created_Time; ?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="form-group">
<!--<span for ="Last_Mod_By">Last Modified By:</span>-->
<input type="hidden" class="form-control required" id="LastModifiedBy" name="LastModifiedBy" value="<?php echo $name; ?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<div class="form-group">
<!--<span for ="Last_Mod_Time">Last Modified Time:</span>-->
<input type="hidden" class="form-control required" id="Last_Modified_Time" name="Last_Modified_Time" value="<?php echo $Last_Mod_Time; ?>">
</div>
</div>
</div>
</div>
</div><!--row completed div-->
<div id="content">
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-success" value="Submit" onmouseover="finalCheck();"/>
<input type="button" class="btn btn-success" value="Delete" id="deleteemp"/>
<input type="reset" class="btn btn-success" value="Reset" />
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row" style="margin-bottom: 10px;">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Loan Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-dark waves-effect waves-light" href="<?php echo base_url(); ?>emppayListings"><span class="bold">Back</span></a>
</div>
</div>
</section>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Loan Details</h4>
<div class="row">
<div class="col-12">
<div class="p-2">
<form role="form" id="edit" action="<?php echo base_url() ?>emppaydate/editemppay" method="post">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
<input type="hidden" class="form-control required" id="Last_Modified_Time" name="Last_Modified_Time" value="<?php echo $Last_Mod_Time; ?>">
<input type="hidden" class="form-control required" id="LastModifiedBy" name="LastModifiedBy" value="<?php echo $name; ?>">
<input type="hidden" class="form-control required" id="Created_Time" name="Created_Time" value="<?php echo $Created_Time; ?>">
<input type="hidden" class="form-control required" id="CreatedBy" name="CreatedBy" value="<?php echo $Created_By; ?>">
<input type="hidden" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Employee ID</span>
<input type="text" class="form-control" readonly id="EmployeeID" name="EmpID" value="<?php echo $EmpID; ?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<input type="hidden" name="loanid" value="<?php echo $loanid; ?>">
<span for="Pay_Data_ID">Loan Amount</span>
<input type="text" class="form-control num" id="Loan_Amount" name="Loan_Amount" value="<?php echo $Loan_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Loan Issue(d) Date</span>
<input type="text" class="form-control num" id="loan_issued_date" name="loan_issued_date" value="<?php echo $Loan_issued_date; ?>" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Monthly Due</span>
<input type="text" class="form-control requried num" id="monthly_due" name="monthly_due" value="<?php echo $Monthly_due; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Due Started</span>
<input type="text" class="form-control requried num" id="due_started" name="due_started" value="<?php echo $Due_start_date; ?>" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">No Of Due(s)</span>
<input type="text" class="form-control requried num" id="no_of_due" name="no_of_due" value="<?php echo $No_of_dues; ?>" pattern="[0-9]{1,2}" title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Paid Amount</span>
<input type="text" class="form-control requried num" id="Paid_Amount" name="Paid_Amount" value="<?php echo $Paid_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
</div>
<input type="hidden" id="remaining_due" name="remaining_due" value="<?php echo $Remaining_Due; ?>">
<input type="hidden" id="paid_due" name="paid_due" value="<?php echo $Paid_Due; ?>">
</div>
</div>
<div class="col-md-12 text-right">
<input type="button" class="btn btn-success" value="Delete" id="deleteemp" style="background-color:red ;color: white; margin-right: 15px;width: 80px;" />
<input type="submit" onmouseover="finalCheck();" value="Submit" class="btn btn-success">
</div>
</div>
</form>
</div>
</div>
<?php
$listErrors = session()->getFlashdata('listErrors');
if ($listErrors) {
?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
<script>
function calculateBasic()
{
var Totalsalary = document.getElementById('Total_Salary').value;;
var HRA = document.getElementById('HRA_Rate').value;
if (HRA == '') {
alert("Please Enter HRA RATE..");
document.getElementById('HRA_Rate').focus();
} else if (Totalsalary == '') {
alert("Please Enter Total Salary..");
document.getElementById('Total_Salary').focus();
} else {
var temp = (Totalsalary * (HRA / 100));
var basic = Totalsalary - temp;
document.getElementById('Basic_Pay').value = basic;
document.getElementById('HRA_Amount').value = temp;
}
//alert(basic);
<script>
function calculateBasic()
{
var Totalsalary = document.getElementById('Total_Salary').value;;
var HRA=document.getElementById('HRA_Rate').value;
if(HRA==''){
alert("Please Enter HRA RATE..");
document.getElementById('HRA_Rate').focus();
}else if(Totalsalary==''){
alert("Please Enter Total Salary..");
document.getElementById('Total_Salary').focus();
}
else{
var temp=(Totalsalary*(HRA/100));
var basic=Totalsalary-temp;
document.getElementById('Basic_Pay').value=basic;
document.getElementById('HRA_Amount').value=temp;
}
//alert(basic);
}
}
function duecalculation()
{
var totaldue=0;
var loan=document.getElementById('Loan_Amount').value;
var due=document.getElementById('monthly_due').value;
if(loan != 0)
{
if(due == 0)
{
alert("Enter Monthly Due Amount....!");
$('#monthly_due').focus();
}
else
{
totaldue=loan/due;
if(totaldue < 1)
{
alert("Please Enter Correct Due Amount..!");
$('#monthly_due').focus();
}
else{
document.getElementById('no_of_due').value=Math.ceil(totaldue);
var noofdues=document.getElementById('no_of_due').value;
$('#remaining_due').val(noofdues);
$('#Paid_Amount').val("0.00");
$('#paid_due').val(0);
}
}
}//else if(loan == "" || loan == 0)
//alert(totaldue);
dateCalulation();
}
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var due = document.getElementById('monthly_due').value;
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");
}
if (loan != 0) {
if (due == 0) {
alert("Enter Monthly Due Amount....!");
$('#monthly_due').focus();
} else {
}
totaldue = loan / due;
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;
}
}
if (totaldue < 1) {
alert("Please Enter Correct Due Amount..!");
$('#monthly_due').focus();
} else {
document.getElementById('no_of_due').value = Math.ceil(totaldue);
var noofdues = document.getElementById('no_of_due').value;
$('#remaining_due').val(noofdues);
$('#Paid_Amount').val("0.00");
$('#paid_due').val(0);
}
$("#deleteemp").click(function(){
var empid = "<?php echo $EmpID;?>";
var i = confirm("Do You want to delete "+empid+" from Pay Master?");
//alert(i);s
if(i)
{
$('#content').loader('show');
}
} //else if(loan == "" || loan == 0)
//alert(totaldue);
$.ajax({
data:{id:empid},
type:"POST",
url:"<?php echo base_url();?>emppaydate/deleteEmpPay",
success:function(result) {
if(result)
{
alert(result);
$('#content').loader('hide');
window.location.href = "<?php echo base_url();?>emppayListings";
}
}
});
}
});
</script>
<script>
</script>
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 = "<?php if(isset($Loan_ID)){ echo $Loan_ID; }else{
echo $emppay[0]->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: "<?php echo base_url(); ?>emppaydate/deleteEmpPay",
success: function(result) {
if (result) {
alert(result);
// $('#content').loader('hide');
window.location.href = "<?php echo base_url(); ?>emppayListings";
}
}
});
}
});
</script>
<script>
</script>

View File

@ -1,88 +1,66 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Employee Loan Details</center>
</h1>
</section>
<section class="content">
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>emppaydate/addemppaydate">Create New Loan</a>
</div>
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Employee Loan Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>emppaydate/addemppaydate">Create New Loan</a>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
</div><!-- /.box-header -->
<div class="box-body">
<table id="datatable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align: right;" >
<thead style="background-color: #ddd;">
<tr >
<th width="15%">Employee</th>
<th width="7%"> Total Sal in </th>
<th width="7%"> Loan Amt in </th>
<th width="7%"> Loan Issued Date</th>
<th width="7%"> Monthly Due Amt in </th>
<th width="7%"> No Of Dues</th>
<th width="7%"> Paid Dues</th>
<th width="7%"> Remaining Dues</th>
<th width="7%"> Paid Amt in </th>
<th width="7%">Action</th>
<div class="col-12">
<div class="card">
<div class="card-body">
<table id="datatable" class="table dt-responsive nowrap w-100 ria_data_table">
<thead>
<tr>
<th width="15%">Employee</th>
<th width="7%"> Total Sal in </th>
<th width="7%"> Loan Amt in </th>
<th width="7%"> Loan Issued Date</th>
<th width="7%"> Monthly Due Amt in </th>
<th width="7%"> No Of Dues</th>
<th width="7%"> Paid Dues</th>
<th width="7%"> Remaining Dues</th>
<th width="7%"> Paid Amt in </th>
<th width="7%">Action</th>
</tr>
</thead>
</thead>
<tbody>
<?php
if(!empty($userRecords)) { foreach($userRecords as $record) { ?>
<tr>
<td style="text-align: left;"><?php echo $record->EmpID ?>-<?php echo $record->FirstName;?></td>
<td><?php echo $record->TotalSalary; ?></td>
<td><?php echo $record->Loan_Amount; ?></td>
<td><?php echo $record->Loan_Issued_Date; ?></td>
<td><?php echo $record->Monthly_Due; ?></td>
<td><?php echo $record->No_of_Dues; ?></td>
<td><?php echo $record->Paid_Due; ?></td>
<td><?php echo $record->Remaining_Due; ?></td>
<td><?php echo $record->Paid_Amount; ?></td>
<td>
<a href="<?php echo base_url().'emppaydate/editOldemppay/'.$record->Pay_Data_ID; ?>"><i class="btn btn-success">EDIT</i></a>
</td>
</tr>
<?php } }?>
</table>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div><!-- /.box -->
</div>
if (!empty($userRecords)) {
foreach ($userRecords as $record) { ?>
<tr>
<td style="text-align: left;"><?php echo $record->EmpID ?>-<?php echo $record->FirstName; ?></td>
<td><?php echo $record->TotalSalary; ?></td>
<td><?php echo $record->Loan_Amount; ?></td>
<td><?php echo $record->Loan_Issued_Date; ?></td>
<td><?php echo $record->Monthly_Due; ?></td>
<td><?php echo $record->No_of_Dues; ?></td>
<td><?php echo $record->Paid_Due; ?></td>
<td><?php echo $record->Remaining_Due; ?></td>
<td><?php echo $record->Paid_Amount; ?></td>
<td>
<a href="<?php echo base_url() . 'emppaydate/editOldemppay/' . $record->Pay_Data_ID; ?>"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</section>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true
});
});
</script>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>

View File

@ -1,29 +1,17 @@
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
<!-- Footer Start -->
<footer class="footer">
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
<!-- Footer Start -->
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-md-5">
<b><a href="<?php echo base_url(); ?>">RESICO </a></b> Version 2.0 | <?php echo generateCopyrightNotice(); ?>.
</div>
<div class="col-md-7">
<div class="text-md-right footer-links d-none d-sm-block">
</div>
</div>
</div>
</div>
</footer>
<!-- end Footer -->
<div class="container-fluid">
<div class="row">
<div class="col-md-5">
<b><a href="<?php echo base_url(); ?>">RESICO </a></b> Version 2.0 | <?php echo generateCopyrightNotice(); ?>.
</div>
<!-- END wrapper -->
<div class="col-md-7">
<div class="text-md-right footer-links d-none d-sm-block">
@ -66,12 +54,90 @@
<!-- <script src="<?php echo base_url(); ?>public/new_assets/js/validation.js" type="text/javascript"></script> -->
</div>
</div>
</div>
</div>
</footer>
<!-- end Footer -->
</div>
<!-- END wrapper -->
<script src="<?php echo base_url(); ?>public/new_assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script>
</script>
</body>
<script>
$(document).ready(function() {
var table = $('.ria_data_table').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
$('#hdate').addClass('form-control');
$('#hname').addClass('form-control');
});
</script>
<!-- Vendor js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/vendor.min.js"></script>
<!-- third party js -->
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-buttons-bs4/js/buttons.bootstrap4.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/datatables.net-select/js/dataTables.select.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/pdfmake/build/pdfmake.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/pdfmake/build/vfs_fonts.js"></script>
<!-- third party js ends -->
<!-- Datatables init -->
<script src="<?php echo base_url(); ?>public/new_assets/js/pages/datatables.init.js"></script>
<!-- App js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/app.min.js"></script>
<!--Morris Chart-->
<script src="<?php echo base_url(); ?>public/new_assets/libs/morris.js06/morris.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/raphael/raphael.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/js/pages/morris.init.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/c3/c3.min.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/js/pages/c3.init.js"></script>
<script src="<?php echo base_url(); ?>public/new_assets/libs/select2/js/select2.min.js"></script>
<!-- <script src="<?php echo base_url(); ?>public/new_assets/js/validation.js" type="text/javascript"></script> -->
<script src="<?php echo base_url(); ?>public/new_assets/libs/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script>
</script>
</body>
</html>

View File

@ -1,142 +1,158 @@
<script src="<?php echo base_url()?>public/assets/tabletoexport/jquery.tableexport.v2.js"></script>
<script src="<?php echo base_url() ?>public/assets/tabletoexport/jquery.tableexport.v2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<style type="text/css">
.num {
text-align:right;
}
.num {
text-align: right;
}
</style>
<style>
.dataTables_empty {
text-align: center !important;
}
.dataTables_empty {
text-align: center !important;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Leave Report <?php if(!empty($selectedfiscalyears)) {echo " ( ". $selectedfiscalyears." )";} ?></center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="row">
<form action="<?php echo base_url() ?>leavereports" method="POST" id="searchList">
<div class="col-md-3">
<?php if(!empty($fiscalyears))
{
foreach ($fiscalyears as $fy):
$options[$fy] = $fy;
endforeach;
}
echo form_dropdown('fyr',$options,set_value('fyr',$selectedfiscalyears),'id="fyr"' ,'class="form-control select2"');?>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">
<center>Leave Report <?php if (!empty($selectedfiscalyears)) {
echo " ( " . $selectedfiscalyears . " )";
} ?></center>
</h4>
</div>
<div class="col-md-3">
<input type="button" value="View Report" class="btn btn-success" id="report">
</div>
</form>
<br>
</div>
</div>
<div class="box-body">
<table id="leavelistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>S.No</th>
<th>Employee Name</th>
<!-- <th>Total Work in Days</th> -->
<th>Leave Taken</th>
<th>Paid Leave Taken</th>
</tr>
</thead>
<tbody>
<?php
$base = base_url();
if (!empty($leaverecords)) {
$index = 0;
foreach ($leaverecords as $rec) {
$index++;
?>
<tr>
<td><?php echo $index; ?></td>
<?php if((int)$rec->NoofAbsentDays != 0){ ?>
<td><?php echo '<a title="View Monthwise Details" href="'.$base.'leavemonthlyreports/'.$rec->EmpID.'/'.$selectedfiscalyears.'">'.$rec->EmpID.'-'.$rec->FullName.'</a>'; ?></td>
<?php } else { ?>
<td><?php echo $rec->EmpID.'-'.$rec->FullName ; ?></td>
<?php } ?>
<div class="row">
<div class="col-12">
<div class="card">
<form action="<?php echo base_url() ?>leavereports" method="POST" id="searchList">
<div class="row">
<div class="col-md-3" style="margin: 10px;">
<?php if (!empty($fiscalyears)) {
foreach ($fiscalyears as $fy):
$options[$fy] = $fy;
endforeach;
}
echo form_dropdown('fyr', $options, set_value('fyr', $selectedfiscalyears), 'id="fyr"', 'class="form-control select2"'); ?>
</div>
<!-- <td style="text-align:right;"><?php // if (!empty($rec->NoofWorkedDays)) { echo number_format((int)$rec->NoofWorkedDays, 0, '.', ''); } else { echo "0"; } ?></td> -->
<td style="text-align:right;"><?php if (!empty($rec->NoofAbsentDays)) { echo number_format((int)$rec->NoofAbsentDays, 0, '.', ''); } else { echo "0"; } ?></td>
<td style="text-align:right;"><?php if (!empty($rec->NoofPaidLeaveDays)) { echo number_format((int)$rec->NoofPaidLeaveDays, 0, '.', ''); } else { echo "0"; } ?></td>
</tr>
<?php
}
}// else {
?>
<!-- <tr>
<div class="col-md-3">
<input type="button" value="View Report" class="btn btn-success" id="report">
</div>
</div>
</form>
<div class="card-body">
<table id="leavelistings" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>S.No</th>
<th>Employee Name</th>
<!-- <th>Total Work in Days</th> -->
<th>Leave Taken</th>
<th>Paid Leave Taken</th>
</tr>
</thead>
<tbody>
<?php
$base = base_url();
if (!empty($leaverecords)) {
$index = 0;
foreach ($leaverecords as $rec) {
$index++;
?>
<tr>
<td><?php echo $index; ?></td>
<?php if ((int)$rec->NoofAbsentDays != 0) { ?>
<td><?php echo '<a title="View Monthwise Details" href="' . $base . 'leavemonthlyreports/' . $rec->EmpID . '/' . $selectedfiscalyears . '">' . $rec->EmpID . '-' . $rec->FullName . '</a>'; ?></td>
<?php } else { ?>
<td><?php echo $rec->EmpID . '-' . $rec->FullName; ?></td>
<?php } ?>
<!-- <td style="text-align:right;"><?php // if (!empty($rec->NoofWorkedDays)) { echo number_format((int)$rec->NoofWorkedDays, 0, '.', ''); } else { echo "0"; }
?></td> -->
<td style="text-align:left;"><?php if (!empty($rec->NoofAbsentDays)) {
echo number_format((int)$rec->NoofAbsentDays, 0, '.', '');
} else {
echo "0";
} ?></td>
<td style="text-align:left;"><?php if (!empty($rec->NoofPaidLeaveDays)) {
echo number_format((int)$rec->NoofPaidLeaveDays, 0, '.', '');
} else {
echo "0";
} ?></td>
</tr>
<?php
}
} // else {
?>
<!-- <tr>
<td colspan="4" style="text-align:center;">No data found</td>
</tr> -->
<?php
// }
?>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div>
</section>
<?php
// }
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$('#leavelistings').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[0, "asc"]],
"info": true,
"autoWidth": true,
"language": {
"emptyTable": "No data found"
}
});
});
$('#report').click(function(){
$("#searchList").submit();
});
$(function() {
$('#leavelistings').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [
[0, "asc"]
],
"info": true,
"autoWidth": true,
"language": {
"emptyTable": "No data found"
}
});
});
$('#report').click(function() {
$("#searchList").submit();
});
$(document).ready(function() {
$('#fyr').addClass('form-control');
})
</script>
<script type="text/javascript">
// var name = "<?php // echo 'Leave Report for ' . $selectedfiscalyears;?>";
// $("#leavelistings").tableExport({
// bootstrap: true,
// separator: ",",
// headings: true,
// buttonContent: "Export",
// addClass: "",
// defaultClass: "btn",
// defaultTheme: "btn-default",
// type: "csv",
// fileName: name,
// position: "bottom",
// stripQuotes: true
// });
</script>
// var name = "<?php // echo 'Leave Report for ' . $selectedfiscalyears;
?>";
// $("#leavelistings").tableExport({
// bootstrap: true,
// separator: ",",
// headings: true,
// buttonContent: "Export",
// addClass: "",
// defaultClass: "btn",
// defaultTheme: "btn-default",
// type: "csv",
// fileName: name,
// position: "bottom",
// stripQuotes: true
// });
</script>

View File

@ -1,11 +1,10 @@
<script src="<?php echo base_url()?>public/assets/tabletoexport/jquery.tableexport.v2.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<script src="<?php echo base_url() ?>public/assets/tabletoexport/jquery.tableexport.v2.js"></script>
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<style type="text/css">
.num {
text-align:right;
}
.num {
text-align: right;
}
</style>
<style>
.dataTables_empty {
@ -15,120 +14,175 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center><strong>" <?php echo $MonthwiseReport[0]->EmpID ?> - <?php echo $MonthwiseReport[0]->FullName ?> "</strong> - Monthwise Leave Reports <?= ' ( '.$finyear.' )' ?></center>
</h1>
<h1>
<center></center>
</h1>
</section>
<section class="content" id="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-body">
<table id="leavelistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>S.No</th>
<th>Employee Id</th>
<th>Employee Name</th>
<th>Month Year</th>
<!-- <th>Total Work in Days</th> -->
<th>Leave Taken</th>
<th>Paid Leave Taken</th>
<table id="" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
</tr>
</thead>
<tbody>
<?php
$index=0;
if(!empty($MonthwiseReport))
{ foreach($MonthwiseReport as $record)
{ $index++;
?>
<tr>
<td style="text-align:right;"><?php echo $index; ?></td>
<td style="text-align:right;"><?php echo $record->EmpID ?></td>
<td><?php echo $record->FullName ?></td>
<td><?php
$split_val = explode('-',$record->Month_Year);
$year_val = $split_val[0];
$month_val = $split_val[1];
$monthName = date("M", mktime(0, 0, 0, $month_val, 10));
echo $monthName . " , ".$year_val
?></td>
<!-- <td style="text-align:right;"><?php // if (!empty($record->NoofWorkedDays)) { echo number_format((int)$record->NoofWorkedDays, 0, '.', ''); } else { echo "0"; } ?></td> -->
<td style="text-align:right;"><?php if (!empty($record->NoofAbsentDays)) { echo number_format((int)$record->NoofAbsentDays, 0, '.', ''); } else { echo "0"; } ?></td>
<td style="text-align:right;"><?php if (!empty($record->NoofPaidLeaveDays)) { echo number_format((int)$record->NoofPaidLeaveDays, 0, '.', ''); } else { echo "0"; } ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /. col-xs-12 -->
</div><!-- /.inital row -->
</section><!-- /.content section closed -->
</div><!-- /.content wrapper -->
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">
<center><strong>" <?php echo $MonthwiseReport[0]->EmpID ?> - <?php echo $MonthwiseReport[0]->FullName ?> "</strong> - Monthwise Leave Reports <?= ' ( ' . $finyear . ' )' ?></center>
</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<form action="<?php echo base_url() ?>leavereports" method="POST" id="searchList">
<div class="row">
</div>
</form>
<div class="card-body">
<table id="leavelistingss" class="table dt-responsive nowrap w-100 ria_data_table">
<thead>
<tr>
<th>S.No</th>
<th>Employee Id</th>
<th>Employee Name</th>
<th>Month Year</th>
<!-- <th>Total Work in Days</th> -->
<th>Leave Taken</th>
<th>Paid Leave Taken</th>
</tr>
</thead>
<tbody>
<?php
$index = 0;
if (!empty($MonthwiseReport)) {
foreach ($MonthwiseReport as $record) {
$index++;
?>
<tr>
<td style="text-align:left;"><?php echo $index; ?></td>
<td style="text-align:left;"><?php echo $record->EmpID ?></td>
<td><?php echo $record->FullName ?></td>
<td><?php
$split_val = explode('-', $record->Month_Year);
$year_val = $split_val[0];
$month_val = $split_val[1];
$monthName = date("M", mktime(0, 0, 0, $month_val, 10));
echo $monthName . " , " . $year_val
?></td>
<!-- <td style="text-align:right;"><?php // if (!empty($record->NoofWorkedDays)) { echo number_format((int)$record->NoofWorkedDays, 0, '.', ''); } else { echo "0"; }
?></td> -->
<td style="text-align:left;"><?php if (!empty($record->NoofAbsentDays)) {
echo number_format((int)$record->NoofAbsentDays, 0, '.', '');
} else {
echo "0";
} ?></td>
<td style="text-align:left;"><?php if (!empty($record->NoofPaidLeaveDays)) {
echo number_format((int)$record->NoofPaidLeaveDays, 0, '.', '');
} else {
echo "0";
} ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
/*-----------------on ready function ------------------------------- */
$(function () {
/*-----------------for data table ------------------------------ */
var t = $('#leavelistings').DataTable( {
"columnDefs": [ {
"searchable": false,
"orderable": false,
"targets": 0
} ],
"searching": true,
"lengthChange": true,
"info": true,
"paging": true,
"autoWidth": true,
"language": {
<script type="text/javascript">
/*-----------------on ready function ------------------------------- */
$(function() {
/*-----------------for data table ------------------------------ */
var t = $('#leavelistings').DataTable({
"columnDefs": [{
"searchable": false,
"orderable": false,
"targets": 0
}],
"searching": true,
"lengthChange": true,
"info": true,
"paging": true,
"autoWidth": true,
"language": {
"emptyTable": "No data found"
},
"order": [[ 0, 'asc' ]]
} );
/**---------------for table index value using datatable -------- */
t.on( 'order.dt search.dt', function () {
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
cell.innerHTML = i+1;
} );
} ).draw();
});
},
"order": [
[0, 'asc']
]
});
/**---------------for table index value using datatable -------- */
t.on('order.dt search.dt', function() {
t.column(0, {
search: 'applied',
order: 'applied'
}).nodes().each(function(cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
});
$("#report").click(function(){
$("#report").click(function() {
$("#formid").attr("method", "post");
$("#formid").attr("method", "post");
$("#formid").attr("action", "<?php echo base_url() ?>payslip/Bonusreport");
$("#formid").attr("action", "<?php echo base_url() ?>payslip/Bonusreport");
$('#formid').submit();
$('#formid').submit();
});
});
/*-----------------for export execl button------------------------------- */
var employee = "<?php echo $MonthwiseReport[0]->EmpID ?> - <?php echo $MonthwiseReport[0]->FullName ?>";
var fin_year = "<?php echo $finyear ?>";
var name = "<?php echo 'Leave Month Report for '.$MonthwiseReport[0]->EmpID.''.$MonthwiseReport[0]->FullName .' ( '.$finyear.' )' ?>";
$("#leavelistings").tableExport({
bootstrap: true,
separator: ",",
headings: true,
buttonContent: "Export",
addClass: "",
defaultClass: "btn",
defaultTheme: "btn-default",
type: "csv",
fileName: name,
position: "bottom",
stripQuotes: true
});
</script>
/*-----------------for export execl button------------------------------- */
var employee = "<?php echo $MonthwiseReport[0]->EmpID ?> - <?php echo $MonthwiseReport[0]->FullName ?>";
var fin_year = "<?php echo $finyear ?>";
var name = "<?php echo 'Leave Month Report for ' . $MonthwiseReport[0]->EmpID . '' . $MonthwiseReport[0]->FullName . ' ( ' . $finyear . ' )' ?>";
$("#leavelistings").tableExport({
bootstrap: true,
separator: ",",
headings: true,
buttonContent: "Export",
addClass: "",
defaultClass: "btn",
defaultTheme: "btn-default",
type: "csv",
fileName: name,
position: "bottom",
stripQuotes: true
});
</script>

View File

@ -1,281 +1,212 @@
<?php
$monthsoptions = array("01" => "Jan", "02" => "Feb","03" => "Mar","04" => "Apr","05" => "May","06" => "June","07"=> "July","08"=> "Aug","09" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
<?php
$monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr", "05" => "May", "06" => "June", "07" => "July", "08" => "Aug", "09" => "Sep", "10" => "Oct", "11" => "Nov", "12" => "Dec");
?>
<script>
$(function() {
$(".select2").select2();
$('#All').click(function() {
<script>
$(function() {
$(".select2").select2();
$('#All').click(function(){
if ($('#All').prop('checked'))
{
$('#Employee').attr('disabled', 'true');
}
else
{
$('#Employee').removeAttr('disabled');
}
});
$('#PayOn').change(function(){
var id = $('#PayOn').val();
if(id != '-1')
{
$('#content').loader('show');
$.ajax({
data:{id1:id},
type:"POST",
url:"<?php echo base_url();?>payslip/getEmployee",
success:function(result) {
if(result)
{
$("#Employee").empty();
$('#content').loader('hide');
$("#Employee").append(result);
}
}
});
}
else
{
alert('Please select the PayOn');
return false;
}
});
$("#Calculate").click(function(){
var payon = $('#PayOn').val();
var employee = $('#Employee').val();
// alert(payon+employee);
if(payon != '-1' && employee !='-1')
{
var check = $('#All').is(":checked");
if(check){
var c=0;
var time=0;
$('#Employee').find('option').each(function() {
c++;
var employee=$(this).val();
$('#content').loader('show');
$.ajax({
data:{payon:payon,employee:employee},
type:"POST",
url:"<?php echo base_url();?>payslip/checkExistPay",
success:function(result)
{
if(result != 1)
{
$.ajax({
data:{payon:payon,employee:employee},
type:"POST",
url:"<?php echo base_url();?>payslip/callsp",
success:function(result){
$('#content').loader('hide');
}
});
}
}
});
if ($('#All').prop('checked')) {
$('#Employee').attr('disabled', 'true');
} else {
$('#Employee').removeAttr('disabled');
}
});
$('#PayOn').change(function() {
var id = $('#PayOn').val();
if (id != '-1') {
// $('#content').loader('show');
$.ajax({
data: {
id1: id
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/getEmployee",
success: function(result) {
if (result) {
$("#Employee").empty();
// $('#content').loader('hide');
$("#Employee").append(result);
}
}
});
time = (c * 300);
// alert(time);
setTimeout(function(){alert(c + '-Employees Salary Added Successfully!');
$('form#PayslipGenerator').submit();
alert("Please wait while Payslip Downloading...!");
$('#content').loader('hide');
},time);
} // else for select all not selected
else{
$('#content').loader('show');
} else {
alert('Please select the PayOn');
return false;
}
});
$.ajax({
data:{payon:payon,employee:employee},
type:"POST",
url:"<?php echo base_url();?>payslip/checkExistPay",
success:function(result) {
if(result == 1)
{
$('form#PayslipGenerator').submit();
$('#content').loader('hide');
alert("Payslip Downloaded Successfully..!");
}
else{
$.ajax({
data:{payon:payon,employee:employee},
type:"POST",
url:"<?php echo base_url();?>payslip/callsp",
success:function(result){
$('form#PayslipGenerator').submit();
$('#content').loader('hide');
alert("Salary Calculated Successfully..!");
}
});
}
}
});
}// else for select all not selected
}// check payon select/not selected
else
{
alert('Please select the PayOn');
return false;
}
$("#Calculate").click(function() {
var payon = $('#PayOn').val();
var employee = $('#Employee').val();
// alert(payon+employee);
if (payon != '-1' && employee != '-1') {
var check = $('#All').is(":checked");
if (check) {
var c = 0;
var time = 0;
$('#Employee').find('option').each(function() {
c++;
var employee = $(this).val();
// $('#content').loader('show');
$.ajax({
data: {
payon: payon,
employee: employee
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/checkExistPay",
success: function(result) {
if (result != 1) {
$.ajax({
data: {
payon: payon,
employee: employee
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/callsp",
success: function(result) {
// $('#content').loader('hide');
}
});
}
}
});
});
time = (c * 300);
// alert(time);
setTimeout(function() {
alert(c + '-Employees Salary Added Successfully!');
$('form#PayslipGenerator').submit();
alert("Please wait while Payslip Downloading...!");
// $('#content').loader('hide');
}, time);
} // else for select all not selected
else {
// $('#content').loader('show');
$.ajax({
data: {
payon: payon,
employee: employee
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/checkExistPay",
success: function(result) {
if (result == 1) {
$('form#PayslipGenerator').submit();
// $('#content').loader('hide');
alert("Payslip Downloaded Successfully..!");
} else {
$.ajax({
data: {
payon: payon,
employee: employee
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/callsp",
success: function(result) {
$('form#PayslipGenerator').submit();
// $('#content').loader('hide');
alert("Salary Calculated Successfully..!");
}
});
}
}
});
} // else for select all not selected
});
});
} // check payon select/not selected
else {
alert('Please select the PayOn');
return false;
}
});
});
</script>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center> PaySlip Generator</center>
</h1>
</section>
<section class="content">
<div class="row" style="border:2px dotted; padding:5%">
<form id="PayslipGenerator" action="<?php echo base_url() ?>PrintPdf" method="post" role="form" >
<div class="row" >
<div class="col-md-4">
<span for="selectmonth">Select Month</span>
<select id="PayOn" name="PayOn" class="form-control select2" style="width: 100%;">
<option value="-1">Select Payon Month</option>
<?php
if(!empty($Payon))
{
foreach ($Payon as $rl)
{
$m = substr($rl->Month_Year,0,2);
$y = substr($rl->Month_Year,3);
$tot = $monthsoptions[$m]."-".$y;
echo "<option value=\"".$rl->Month_Year."\">".$tot."</option>";
}
}
?>
</select>
</div>
<div id="content"></div>
<div class="col-md-4 col-md-offset-2">
<span>Employee</span>
<select id="Employee" name="Employee" class="form-control select2" type="text" class="form-control">
<option value="-1">Select Employee</option>
</select>
<br/>
<input type="checkbox" name="All" id="All" > Select All<br>
<div class="content-page">
<!-- Content Header (Page header) -->
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Add Config Details</h4>
</div>
<section class="content">
<div class="card">
<div class="card-body" style="padding: 1rem 2rem !important;">
<form id="PayslipGenerator" action="<?php echo base_url() ?>PrintPdf" method="post" role="form" style="border:2px dotted; padding:5%">
<div class="row">
<div class="col-md-4">
<span for="selectmonth">Select Month</span>
<select id="PayOn" name="PayOn" class="form-control select2" style="width: 100%;">
<option value="-1">Select Payon Month</option>
<?php
if (!empty($Payon)) {
foreach ($Payon as $rl) {
$m = substr($rl->Month_Year, 0, 2);
$y = substr($rl->Month_Year, 3);
$tot = $monthsoptions[$m] . "-" . $y;
echo "<option value=\"" . $rl->Month_Year . "\">" . $tot . "</option>";
}
}
?>
</select>
</div>
<div id="content"></div>
<div class="col-md-2">
</div>
<div class="col-md-4 col-md-offset-2">
<span>Employee</span>
<select id="Employee" name="Employee" class="form-control select2" type="text" class="form-control">
<option value="-1">Select Employee</option>
</select>
<br />
<input type="checkbox" name="All" id="All"> Select All<br>
</div>
<div class="col-md-6" align="right">
</div>
<div class="col-md-4 col-md-offset-6" align="right">
<input type="button" class="btn btn-info" id="Calculate" value="Calculate Pay" />
</div>
<div class="row">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-4">
<?php // echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>');
?>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4 col-md-offset-6" align = "right">
<input type="button" class="btn btn-info" id="Calculate" value="Calculate Pay"/>
</div>
<div class="row" >
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-4">
<?php // echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?>
</div>
</div>
</div>
</div>
</section>
</section>
</div>

View File

@ -1,142 +1,129 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<?php ?>
<style type="text/css">
.num {
text-align:right;
}
text-align: right;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Employee Monthly Payslip </center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-2">
<?php
$attributes = array('id' => 'paylist');
echo form_open('paysliplist', $attributes);
$today = date('m-Y');
$data = array('type' => 'text','name' => 'month','id' => 'month','value' => $today,'class' => 'form-control select2');
echo form_input($data);
?>
</div>
<div class="col-md-2">
<input id="changemonth" value="Change Month" class="btn btn-success" title='click here to view payslip Data'>
</div>
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="box-tools">
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<table id="monthlylistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead >
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Employee Monthly Payslip </h4>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="row">
<div class="col-md-2" style="padding: 10px;margin-left: 24px;">
<?php
$attributes = array('id' => 'paylist');
echo form_open('paysliplist', $attributes);
$today = date('m-Y');
$data = array('type' => 'text', 'name' => 'month', 'id' => 'month', 'value' => $today, 'class' => 'form-control select2', ' data-provide' => 'datepicker', 'data-date-format' => 'M-yyyy', 'data-date-min-view-mode' => '1');
echo form_input($data);
?>
</div>
<div class="col-md-2">
<input id="changemonth" value="Change Month" class="btn btn-success" title='click here to view payslip Data'>
</div>
</div>
<div class="card-body">
<table id="monthlylistingss" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Month Year</th>
<th>Employee Id</th>
<th>Employee Name</th>
<th>Employee Name</th>
<th>Paid Days</th>
<th>Salary in </th>
<th>Company Contribution in </th>
<th>Company Contribution in </th>
<th>Loan Recoverd in </th>
<th>Loan Balance in </th>
<th>Action</th>
<th>Loan Balance in </th>
<th>Action</th>
</tr>
</thead>
<tbody id="tbody">
</thead>
<tbody id="tbody">
<?php
if(!empty($PayInfo))
{
foreach($PayInfo as $record)
{
if (!empty($PayInfo)) {
foreach ($PayInfo as $record) {
?>
<tr>
<td style="text-align:right;"><?php echo $record->PayOn ?></td>
<td><?php echo $record->EmpID ?></td>
<td><?php echo $record->FName ." ". $record->Lname ?></td>
<td style="text-align:right;"><?php echo ($record->NoofDaysWorked + $record->Paid_Leave) ?></td>
<td style="text-align:right;"><?php echo $record->LessAdvance ?></td>
<td style="text-align:right;"><?php echo $record->TotalCompCon ?></td>
<td style="text-align:right;"><?php if(is_numeric($record->Advance)){echo number_format($record->Advance,2,'.','');}else {echo $record->Advance;} ?></td>
<td style="text-align:right;"><?php echo $record->BalanceAdvance ?></td>
<td>
<a href="<?php echo base_url().'payslip/editPayslip/'.$record->EmpID.'/'.$record->PayOn;?>"><i class="btn btn-success">EDIT</i></a>
</td>
</tr>
<tr>
<td style="text-align:right;"><?php echo $record->PayOn ?></td>
<td><?php echo $record->EmpID ?></td>
<td><?php echo $record->FName . " " . $record->Lname ?></td>
<td style="text-align:right;"><?php echo ($record->NoofDaysWorked + $record->Paid_Leave) ?></td>
<td style="text-align:right;"><?php echo $record->LessAdvance ?></td>
<td style="text-align:right;"><?php echo $record->TotalCompCon ?></td>
<td style="text-align:right;"><?php if (is_numeric($record->Advance)) {
echo number_format($record->Advance, 2, '.', '');
} else {
echo $record->Advance;
} ?></td>
<td style="text-align:right;"><?php echo $record->BalanceAdvance ?></td>
<td>
<a href="<?php echo base_url() . 'payslip/editPayslip/' . $record->EmpID . '/' . $record->PayOn; ?>"><i class="btn btn-success">EDIT</i></a>
</td>
</tr>
<?php
}
}
}
?>
</tbody>
</table>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
<?php //echo $this->pagination->create_links(); ?>
</div> -->
</div><!-- /.box -->
</div>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</section>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$("#month").datepicker({
minViewMode: 1,
format: 'mm-yyyy'
});
$(function() {
// $("#month").datepicker({
// minViewMode: 1,
// format: 'mm-yyyy'
// });
var dropdown = "<?php echo $dropdownvalue; ?>";
$('#month').val(dropdown);
$('#month').val(dropdown);
$('#monthlylistings').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "desc" ]],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true
});
});
});
$('#changemonth').on("click", function(){
$('#changemonth').on("click", function() {
$("#paylist").attr("method", "post");
$("#paylist").attr("action", "<?php echo base_url() ?>payslip/reload_paysliplist");
$("#paylist").submit();
$("#paylist").attr("action", "<?php echo base_url() ?>payslip/reload_paysliplist");
$("#paylist").submit();
});
</script>

View File

@ -1,244 +1,186 @@
<?php
// print_r($month);
// echo "-------------";
// print_r($days);
//$sample = array_merge($month,$fresh);
?>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
</script>
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.6/underscore-min.js"></script>
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
<script>
$(function() {
$("#hdate").datepicker({
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
});
$('html').bind('keypress', function(e)
{
//alert('Key Pressed');
if(e.keyCode == 13)
{
return false;
}
});
$(function() {
$("#hdate").datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
});
$('html').bind('keypress', function(e) {
//alert('Key Pressed');
if (e.keyCode == 13) {
return false;
}
});
</script>
<style type="text/css">
.num {
text-align:right;
}
text-align: right;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Public Holiday Information - <?php echo date('Y');?></center>
</h1>
</section>
<section class="content">
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<!--<center><h3 class="box-title">-->
<div class="box-tools">
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="col-md-12">
<div class="col-md-4">
<span>Holiday Name : </span>
<input type="text" name="hname" id="hname">
</div>
<div class="col-md-4">
<span>Date : </span>
<input type="text" name="hdate" id="hdate">
</div>
<div class="col-md-3">
<input type="button" id="Add" value = "Add" class="btn btn-success" >
</div>
</div>
<p>&nbsp;</p>
<div class="box-body">
<table id="phdays" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead >
<tr>
<!-- <th>S.No</th> -->
<th>Holiday_Name</th>
<th>Date</th>
<th style="width:10%";>Action</th>
</tr>
</thead>
<tbody id="db">
<?php
$index=0;
$testarray=array();
if(!empty($days))
{
foreach($days as $day)
{
$index++;
$date = date_create($day->H_Date);
$date = date_format($date,'d-m-Y');
?>
<tr id="<?php echo $index;?>">
<!-- <td style="text-align:right;"><?php echo $index ?></td> -->
<td contenteditable='true' style="text-align:left;"><?php if(!empty($day->H_Name)){echo $day->H_Name;}else{echo "NO DATA";}?></td>
<td contenteditable='false' style="text-align:right;"><?php echo $date;?></td>
<td style="text-align:right;"><a href='#' onclick = "DeleteRow(<?php echo $index ; ?>)" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-4" id="savebutton">
<input type="button" id="submit" value = "Save" class="btn btn-success">
</div>
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div><!-- /.box -->
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Public Holiday Information - <?php echo date('Y'); ?></h4>
</div>
</div>
</div>
</section>
<div class="row">
<div class="col-12">
<div class="card">
<div class="row" style="padding-left: 26px;">
<div class="col-md-3">
<span>Holiday Name : </span>
<input type="text" name="hname" id="hname" class="form-control">
</div>
<div class="col-md-3">
<span>Date : </span>
<input type="text" name="hdate" id="hdate" class="form-control">
</div>
<div class="col-md-3">
<input type="button" id="Add" value="Add" class="btn btn-success" class="form-control" style="margin-top: 20px;margin-bottom: 0px;">
</div>
</div>
<div class="card-body">
<table id="phdays" class="table dt-responsive nowrap w-100 ria_data_table">
<thead>
<tr>
<!-- <th>S.No</th> -->
<th>Holiday_Name</th>
<th>Date</th>
<th style="width:10%" ;>Action</th>
</tr>
</thead>
<tbody id="db">
<?php
$index = 0;
$testarray = array();
if (!empty($days)) {
foreach ($days as $day) {
$index++;
$date = date_create($day->H_Date);
$date = date_format($date, 'd-m-Y');
?>
<tr id="<?php echo $index; ?>">
<!-- <td style="text-align:right;"><?php echo $index ?></td> -->
<td contenteditable='true' style="text-align:left;"><?php if (!empty($day->H_Name)) {
echo $day->H_Name;
} else {
echo "NO DATA";
} ?></td>
<td contenteditable='false' style="text-align:left;"><?php echo $date; ?></td>
<td style="text-align:center;"><a href='#' onclick="DeleteRow(<?php echo $index; ?>)" id="Del"><span class="fas fa-trash"></span></a></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-4" id="savebutton">
<input type="button" id="submit" value="Save" class="btn btn-success">
</div>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$('#phdays').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": false,
// "aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true
});
});
</script>
<script type="text/html" id="addList">
<tr id="<%=index%>">
<td style="text-align:left;" contenteditable="true"><%=Holiday_Name%></td>
<td style="text-align:right;" contenteditable="false"><%=Date%></td>
<td style="text-align:right;">
<a href='#' onclick = "DeleteRow(<?php echo $index ; ?>)" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</script>
<script>
function DeleteRow(rowid)
{
var d='';
//alert(rowid);
var tr = document.getElementById(rowid);
var Row = $('#phdays').find('tr').eq(rowid).find('td');
$.each(Row,function(index,value){
if(index == 1 ){
d = value.textContent
}
});
// alert(d);
$('#content').loader('show');
$.ajax({
data:{param1:d},
type:"POST",
url:"<?php echo base_url() ?>monthlypay/deletePublicHoliday",
success:function(data){
$('#content').loader('hide');
alert(data);
}
});
tr.parentNode.removeChild(tr);
}
$('#Add').click(function(){
var index = $('#phdays tr').length;
//alert(index);
var temp = index;
var H_name = $('#hname').val();
var H_date = $('#hdate').val();
if(H_name != '' && H_date != '')
{
var template = jQuery("#addList").html();
index = parseInt(index);
$('#db').append(_.template(template,{index:temp,Holiday_Name:H_name,Date:H_date}));
var tablevalue = $('#phdays').tableToJSON(); // Convert the table into a javascript object
var value = JSON.stringify(tablevalue);
$('#hname').val('');
$('#hdate').val('');
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/html" id="addList">
<tr>
<td style="text-align:left;" contenteditable="true"><%=Holiday_Name%></td>
<td style="text-align:left;" contenteditable="false"><%=Date%></td>
<td style="text-align:center;">
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" id="Del"><span class="fas fa-trash"></span></a>
</td>
</tr>
</script>
<script>
function DeleteRow(rowid) {
var d = '';
//alert(rowid);
var tr = document.getElementById(rowid);
var Row = $('#phdays').find('tr').eq(rowid).find('td');
$.each(Row, function(index, value) {
if (index == 1) {
d = value.textContent
}
});
// alert(d);
// $('#content').loader('show');
$.ajax({
data: {
param1: d
},
type: "POST",
url: "<?php echo base_url() ?>monthlypay/deletePublicHoliday",
success: function(data) {
// $('#content').loader('hide');
alert(data);
}
});
tr.parentNode.removeChild(tr);
}
$('#Add').click(function() {
var index = $('#phdays tr').length;
var H_name = $('#hname').val();
var H_date = $('#hdate').val();
if (H_name != '' && H_date != '') {
var template = jQuery("#addList").html();
$('#db').append(_.template(template)({
index: index,
Holiday_Name: H_name,
Date: H_date
}));
$('#hname').val('');
$('#hdate').val('');
}
});
$('#submit').click(function() {
var jsondata = $('#phdays').tableToJSON();
var jsondata = JSON.stringify(jsondata);
$('#content').loader('show');
$.ajax({
data: {
param1: jsondata
},
type: "POST",
url: "<?php echo base_url() ?>monthlypay/savePublicHolidays",
success: function(data) {
$('#content').loader('hide');
alert(data);
}
});
$('#submit').click(function(){
var jsondata = $('#phdays').tableToJSON();
var jsondata = JSON.stringify(jsondata);
$('#content').loader('show');
$.ajax({
data:{param1:jsondata},
type:"POST",
url:"<?php echo base_url() ?>monthlypay/savePublicHolidays",
success:function(data){
$('#content').loader('hide');
alert(data);
}
});
});
</script>
});
</script>

View File

@ -39,104 +39,104 @@
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Material Master Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<!-- <a class="btn btn-success" href="<?php echo base_url(); ?>exportmaterial">Export Material Master <i class="fa fa-download" aira-hidden="true"></i></a> -->
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if ($success) {
$type = "success";
echo show_alert($type, $success);
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Material Master Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<!-- <a class="btn btn-success" href="<?php echo base_url(); ?>exportmaterial">Export Material Master <i class="fa fa-download" aira-hidden="true"></i></a> -->
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if ($success) {
$type = "success";
echo show_alert($type, $success);
}
?>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="raw_material_list_table" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Created Date</th>
<th>Material Code</th>
<th>Material Description</th>
<th>Type of Material</th>
<th>UOM</th>
<th>Opening Stock</th>
<th>Material Category</th>
<th>HSN Code</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
$date = date("Y-m-d");
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td style="width:8%;" align="right"><?php echo $cdate; ?></td>
<td style="width:9%;"><u><a class="a_tag_link" href="<?php echo base_url() . 'viewRawmaterial?RID=' . $record->MaterialCode . '&MType=' . $record->MaterialType . '&UOM=' . $record->UOM . '&date1=' . $date ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
<td style="width:12%;"><?php echo $record->MaterialName ?></td>
<td style="width:10%;"><?php echo $record->MaterialType ?></td>
<td style="width:7%;"><?php echo $record->UOM ?></td>
<?php if ($record->stock != null || '') { ?>
<td style="width:7%;"><?php echo $record->stock ?></td>
<?php } else { ?>
<td style="width:7%;">0</td>
<?php } ?>
<td style="width:11%;"><?php echo $record->Category ?></td>
<td style="width:8%;"><?php echo $record->HSNCODE ?></td>
</tr>
<?php
}
}
?>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="raw_material_list_table" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Created Date</th>
<th>Material Code</th>
<th>Material Description</th>
<th>Type of Material</th>
<th>UOM</th>
<th>Opening Stock</th>
<th>Material Category</th>
<th>HSN Code</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
$date = date("Y-m-d");
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td style="width:8%;" align="right"><?php echo $cdate; ?></td>
<td style="width:9%;"><u><a class="a_tag_link" href="<?php echo base_url() . 'viewRawmaterial?RID=' . $record->MaterialCode . '&MType=' . $record->MaterialType . '&UOM=' . $record->UOM . '&date1=' . $date ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
<td style="width:12%;"><?php echo $record->MaterialName ?></td>
<td style="width:10%;"><?php echo $record->MaterialType ?></td>
<td style="width:7%;"><?php echo $record->UOM ?></td>
<?php if ($record->stock != null || '') { ?>
<td style="width:7%;"><?php echo $record->stock ?></td>
<?php } else { ?>
<td style="width:7%;">0</td>
<?php } ?>
<td style="width:11%;"><?php echo $record->Category ?></td>
<td style="width:8%;"><?php echo $record->HSNCODE ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
@ -165,75 +165,78 @@
$(document).ready(function() {
// Initialize the DataTable
var table = $('#raw_material_list_table').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: true, // Responsive table
order: [], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
// Return true if the date is within the range
return date >= startDate && date <= endDate;
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
});
</script>

View File

@ -50,9 +50,9 @@
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addNew">Add New User</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>addNew">Add New User</a>
</div>
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
@ -69,62 +69,63 @@
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="user_list_table" class="table dt-responsive nowrap w-100">
<thead>
<tr> <th>Created Date</th>
<!-- <th>User Id</th> -->
<th>User Name</th>
<th>Email</th>
<th>Contact Number</th>
<th>Designation</th>
<th>Department</th>
<th>Role Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->createdDtm)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->createdDtm));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<!-- <td><?php echo $record->userId ?></td> -->
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->EmailId ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->role ?></td>
<td>
<a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>"><i class="fas fa-pencil-alt"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="deleteUser(<?php echo $record->userId; ?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
<th>Created Date</th>
<!-- <th>User Id</th> -->
<th>User Name</th>
<th>Email</th>
<th>Contact Number</th>
<th>Designation</th>
<th>Department</th>
<th>Role Name</th>
<th>Actions</th>
</tr>
<?php
}
}
?>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->createdDtm)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->createdDtm));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<!-- <td><?php echo $record->userId ?></td> -->
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->EmailId ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->role ?></td>
<td>
<a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>"><i class="fas fa-pencil-alt"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="deleteUser(<?php echo $record->userId; ?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
@ -184,78 +185,81 @@
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
$(document).ready(function() {
// Initialize the DataTable
var table = $('#user_list_table').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: true, // Responsive table
order: [], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$(document).ready(function() {
// Initialize the DataTable
var table = $('#user_list_table').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
}
});
});
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
});
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
</script>