ria/app/Views/addemppaydate.php
2025-03-13 07:23:59 +00:00

321 lines
15 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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" enctype="multipart/form-data">
<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">
<label for="EmpID">Employee ID</label>
<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);
}
}
echo form_dropdown('EmpID', $Employee, set_value('EmpID'), 'class="form-control"', 'id="EmpID"', 'required="true"');
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<label for="Pay_Data_ID">Loan Amount</label>
<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">
<label for="Basic_Pay">No Of Due(s)</label>
<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" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<label for="Basic_Pay">Monthly Due</label>
<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" >
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<label for="loan_issued_date">Loan Issue(d) Date</label>
<input
type="text"
name="loan_issued_date"
id="loan_issued_date"
class="form-control"
/>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<label for="Basic_Pay">Due Started</label>
<input
type="text"
class="form-control requried"
id="due_started"
name="due_started"/>
</div>
</div>
</div>
</div>
<!-- File -->
<h4 class="header-title mt-2 mb-2">Loan Documents</h4>
<!-- Text input-->
<div class="row">
<div class="form-group" >
<div class="col-md-6">
<label class="col-form-label" for="request_letter">Request letter</label>
<input style="margin-top: 5px;" type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="request_letter" name="request_letter" />
</div>
</div>
</div>
<div class="row">
<div class="form-group" >
<div class=" col-md-6">
<label class="col-form-label" for="payment_statement">Payment Receipt</label>
<input style="margin-top: 5px;" type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="payment_statement" name="payment_statement" />
</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">
<input type="hidden" id="Paid_Amount" name="Paid_Amount" value="0">
</div>
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-secondary" style="margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return 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>
$(document).ready(function() {
// Get the current date
const currentDate = new Date();
// Format the date as "M-yyyy"
const options = { month: 'short', year: 'numeric' };
const formattedDate = currentDate.toLocaleDateString('en-US', options).replace(' ', '-');
// Set the value of the input field
document.getElementById('due_started').value = formattedDate;
document.getElementById('loan_issued_date').value = formattedDate;
$('#loan_issued_date').datepicker({
format: "M-yyyy",
minViewMode: 1, // Month selection only
orientation: "bottom auto", // Ensures it opens downward
autoclose: true
});
$('#due_started').datepicker({
format: "M-yyyy",
minViewMode: 1, // Month selection only
orientation: "bottom auto", // Ensures it opens downward
autoclose: true
});
});
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var no_of_due = document.getElementById('no_of_due').value;
$('#remaining_due').val(no_of_due);
if (loan != 0) {
if (no_of_due == 0) {
alert("Enter No Of Due");
$('#no_of_due').focus();
} else {
totalDueAmt = loan / no_of_due;
document.getElementById('monthly_due').value = Math.ceil(totalDueAmt);
}
}
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 = $('#Loan_Amount').val();
var emp = $("select[name=EmpID]").val();
if (loanamount !== "" && loanamount != 0.00) {
var idate = $('#loan_issued_date').val();
var due = $('#monthly_due').val();
var dsdate = $('#due_started').val();
if (idate === "" || due === "" || due == 0.00 || dsdate === "") {
console.log(idate);
alert("Enter All Loan Information Correctly...!");
return false;
}
}
if (emp === "0" || emp === "-1") {
alert('Please select the Employee');
return false;
}
return true;
}
</script>