430 lines
20 KiB
PHP
Executable File
430 lines
20 KiB
PHP
Executable File
<script>
|
||
$(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'
|
||
});
|
||
});
|
||
|
||
|
||
|
||
// 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");
|
||
// }
|
||
// }
|
||
// }
|
||
// };
|
||
</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 = '';
|
||
|
||
|
||
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;
|
||
}
|
||
}
|
||
|
||
|
||
?>
|
||
|
||
<style type="text/css">
|
||
.num {
|
||
text-align: right;
|
||
}
|
||
</style>
|
||
|
||
<div class="content-page">
|
||
<div class="content">
|
||
<!-- Start Content-->
|
||
<div class="container-fluid">
|
||
<!-- start page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="page-title-box page-title-box-alt">
|
||
<h4 class="page-title">Edit Loan Details</h4>
|
||
<a class="btn btn-secondary" href="<?php echo base_url(); ?>emppayListings"><span class="bold">Back</span></a>
|
||
</div>
|
||
</div>
|
||
</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; ?>">
|
||
<input type="hidden" class="form-control num" id="Old_Loan_Amount" value="<?php echo $Loan_Amount; ?>" >
|
||
<input type="hidden" class="form-control num" id="Old_monthly_due" value="<?php echo $Monthly_due; ?>" >
|
||
<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; ?>" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<span for="">Paid Due</span>
|
||
<input type="text" class="form-control requried num" id="paid_due" name="paid_due" value="<?php echo $Paid_Due; ?>" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<span for="">Remaining Due</span>
|
||
<input type="text" class="form-control requried num" id="remaining_due" name="remaining_due" value="<?php echo $Remaining_Due; ?>" readonly>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="col-md-12 text-right">
|
||
<input type="button" class="btn btn-success" value="Delete" id="deleteemp" style="background-color:#ee4d4d;color:white;margin-right:15px;width:80px;border:none;" />
|
||
<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 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_due').val());
|
||
// $('#Paid_Amount').val("0.00");
|
||
// $('#paid_due').val(0);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
dateCalulation();
|
||
|
||
|
||
}
|
||
|
||
function dateCalulation() {
|
||
|
||
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...!");
|
||
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?");
|
||
|
||
if (i) {
|
||
|
||
$('#loader').show();
|
||
$.ajax({
|
||
data: {
|
||
id: loanid
|
||
},
|
||
type: "POST",
|
||
url: "<?php echo base_url(); ?>emppaydate/deleteEmpPay",
|
||
success: function(result) {
|
||
if (result) {
|
||
|
||
alert(result);
|
||
$('#loader').hide();
|
||
window.location.href = "<?php echo base_url(); ?>emppayListings";
|
||
|
||
}
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
});
|
||
</script>
|
||
<script>
|
||
</script>
|