290 lines
15 KiB
PHP
Executable File
290 lines
15 KiB
PHP
Executable File
<script>
|
||
$(document).ready(function() {
|
||
|
||
|
||
$("#loan_issued_date").datepicker({
|
||
minDate: 'now',
|
||
orientation: 'bottom',
|
||
// 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'
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<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">Create Loan</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="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 -->
|
||
|
||
|
||
<!--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();
|
||
} 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);
|
||
}
|
||
|
||
}
|
||
} //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");
|
||
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
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>
|