nhance/app/Views/insurer_statement_list.php
2024-09-24 14:06:43 +05:30

783 lines
34 KiB
PHP
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>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
/* table.dataTable thead th {
padding: 4px 4px !important;
} */
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.highlight {
border: 2px solid red;
background-color: #ffe6e6;
}
.column-header {
margin-right: 10px; /* Adjust this value as needed */
}
.form-section {
border: 1px solid #ccc;
padding: 15px;
margin-bottom: 20px;
}
.row-box {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
}
</style>
<style>
.switch {
position: relative;
display: inline-block;
width: 54px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 19px;
width: 19px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
<div class="row" id="inception_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Insurer Statement List</h4>
</div>
<!-- <div class="col-2" id="add_div" style="text-align: right; position: relative;top: 56px; left: 314px;"> -->
<!-- <button type="button" id="change_status" class="btn btn-primary waves-effect waves-light">Invoice Status</button> -->
<!-- </div> -->
<!-- <div class="col-1" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;"> -->
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
<!-- </div> -->
</div>
<div>
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th></th>
<th><div class="column-header">Insurer</div></th>
<th><div class="column-header">Month</div></th>
<th><div class="column-header">Filename</div></th>
<th><div class="column-header">Line<br>items</div></th>
<th><div class="column-header">File<br>status</div></th>
<th><div class="column-header">Invoice<br>status</div></th>
<th><div class="column-header">User/Time</div></th>
<th><div class="column-header">Action</div></th>
</tr>
</thead>
<tbody>
<?php foreach($insurer_statement_list as $row){ ?>
<tr>
<td><input type="hidden" class="row-select" data-id="<?= $row['id']; ?>"></td>
<td><?php echo $row['short_name'].'-'.$row['branch_code']; ?></td>
<td><?php echo change_date_format($row['month'],'Y-m-d','M-Y'); ?></td>
<td><?php echo $row['file_name'] ?> </td>
<td><?php echo $row['line_items'] ?></td>
<td><?php echo $row['file_status'];
if($row['file_status'] == 'failed')
{
echo " <span class='col-xl-3 col-lg-4 col-sm-6'> <i class='fe-alert-circle' data-toggle='modal' data-target='#file-err-modal' data-err=" . $row['id'] . "></i></span>";
}
?>
</td>
<td><?php echo (isset($invoice_status_array[ $row['invoice_status'] ]) ? $invoice_status_array[ $row['invoice_status'] ] : ' - ') ?>
<span class="col-xl-3 col-lg-4 col-sm-6">
<i class="fe-alert-circle"
data-toggle="tooltip"
data-placement="right"
title="<?php echo 'Exp Invoice Amt: ' . (isset($row['exp_inv_amt']) ? $row['exp_inv_amt'] : '0.00' ) . ' Received Invoice Amt: ' . (isset($row['received_inv_amt']) ? $row['received_inv_amt'] : '0.00') ; ?>"
data-original-title="Tooltip on right">
</i>
</span>
</td>
<td><?php echo change_date_format($row['created_at'],'Y-m-d H:i:s','d M Y h:i a').' by <br>'.$row['first_name'] ?></td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-exp-amt="<?= $row['exp_inv_amt'];?>" data-received-amt="<?= $row['received_inv_amt'];?>" onclick="showInvoiceStatusModal(event)">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Invoice status
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div><!-- end col -->
</div>
<!-- end table row -->
<div class="modal fade" id="file_upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="title">Upload Insurer Statement</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<div class="">
<form role="form" class="parsley-examples" method="post" id="insurer_statement_upload_form" enctype="multipart/form-data" action="upload">
<div class="form-group">
<div class="form-group col-md-12">
<label for="insurer"> Insurer <spanclass="text-danger">*</spanclass=></label>
<select class="form-control" id="insurer" name="insurer" required>
<option value="" selected>Select Insurer</option>
<?php
if (isset($insurers) && count($insurers)) {
foreach ($insurers as $key => $value) {
echo "<option value=" . $value['insurer_id'].'-'.$value['id'] . ">" . $value['insurer_name'] .'-'. $value['branch_code'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-12">
<label for="statement_month">Statement month</label>
<input type="date" class="form-control" id="statement_month" name="statement_month" placeholder="Enter Invoice Number" required>
</div>
<div class="form-group col-md-12" >
<label for="statment">Statement </label> <span><a href="downloadSampleInsurerStatement" id="download_sample_file" style="font-size: small;">Download sample file</a></span>
<input type="file" class="form-control" name="statement" required accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
</div>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Center modal content -->
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
</div>
</div>
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Invoice status content modal-->
<div class="modal fade" id="invoice_modal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="title">Update Invoice Status</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<div class="">
<form role="form" class="parsley-examples" method="post" id="invoiceForm" enctype="multipart/form-data" action="<?php echo base_url().'policy_tranction/statement/saveInvoicePaymentDetails'?>">
<div class="form-group">
<div class="row">
<div class="form-group col-md-4">
<label for="addon_policy">Invoice Status <span class="text-danger">*</span></label>
<select class="form-control" id="invoice_status" name="invoice_status" required>
<option value="" selected>Select Invoice Status</option>
<?php
if (isset($invoice_status_array) && count($invoice_status_array)) {
foreach ($invoice_status_array as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
<input type="hidden" id="hidden_statement_id" name="hidden_statement_id">
</div>
<div class="form-group col-md-4">
<label for="addon_policy">Exp Amount</label>
<input type="text" class="form-control" id="modal_exp_amt" placeholder="Enter Invoice Number" disabled>
</div>
<div class="form-group col-md-4">
<label for="addon_policy">Received Amount</label>
<input type="text" class="form-control" id="modal_received_amt" placeholder="Enter Invoice Number" disabled>
</div>
</div>
<!-- Invoice Number and Invoice Date in same row -->
<div class="row" id="invoice_no_div_modal" style="display: none;">
<div class="form-group col-md-6">
<label for="invoice_no">Invoice Number<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="invoice_no_modal" name="invoice_no" placeholder="Enter Invoice Number" required>
</div>
<div class="form-group col-md-6">
<label for="invoice_date">Invoice Date</label>
<input type="date" class="form-control" id="invoice_date_modal" name="invoice_date" value="<?php echo date('Y-m-d'); ?>" required>
</div>
</div>
</div>
<!-- Payment Received Table -->
<div class="form-group col-md-12" style="display: none;" id="payment_table_div_modal">
<button type="button" id="add_row_btn" class="btn btn-secondary float-right"><i class="fa fa-plus"></i></button>
<table class="table table-bordered" id="payment_table_modal">
<thead>
<tr>
<th style="display: none;">pk</th>
<th>Invoice Amount</th>
<th>UTR Number</th>
<th>Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
<td><input type="date" class="form-control" name="payment_date[]" value="<?php echo date('Y-m-d'); ?>" required></td>
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
</tr>
</tbody>
</table>
<!-- <button type="button" id="add_row_btn" class="btn btn-secondary float-right mt-2"><i class="fa fa-plus"></i></button> -->
</div>
<div class="form-group text-right m-b-0">
<!-- <button type="button" id="add_row_btn" class="btn btn-primary waves-effect waves-light mr-1">Add payment</button> -->
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Save</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
document.getElementById('invoice_status').addEventListener('change', function () {
const invoiceStatus = this.value;
console.log(invoiceStatus);
const invoiceNoDiv = document.getElementById('invoice_no_div_modal');
// const invoiceDateDiv = document.getElementById('invoice_date_div_modal');
const paymentTableDiv = document.getElementById('payment_table_div_modal');
// Hide everything initially
invoiceNoDiv.style.display = 'none';
// invoiceDateDiv.style.display = 'none';
paymentTableDiv.style.display = 'none';
// Show fields based on selected status
if (invoiceStatus === 'generated' || invoiceStatus === 'sent') {
invoiceNoDiv.style.display = 'flex';
switchRequired('invoice_no_modal',true);
switchRequired('invoice_date_modal',true);
switchRequired('invoice_amount',false,'name');
switchRequired('utr_no',false,'name');
switchRequired('payment_date',false,'name');
switchRequired('pk',false,'name');
// invoiceDateDiv.style.display = 'block';
} else if (invoiceStatus === 'payment_received') {
invoiceNoDiv.style.display = 'flex';
paymentTableDiv.style.display = 'block';
switchRequired('invoice_no_modal',true);
switchRequired('invoice_date_modal',true);
switchRequired('invoice_amount',true,'name');
switchRequired('utr_no',true,'name');
switchRequired('payment_date',true,'name');
switchRequired('pk',true,'name');
}else if(invoiceStatus === 'pending')
{
invoiceNoDiv.style.display = 'none';
paymentTableDiv.style.display = 'none';
switchRequired('invoice_no_modal',false);
switchRequired('invoice_date_modal',false);
switchRequired('invoice_amount',false,'name');
switchRequired('utr_no',false,'name');
switchRequired('payment_date',false,'name');
switchRequired('pk',false,'name');
}
});
$(document).ready(function () {
$('#file-err-modal').on('show.bs.modal', function(event) {
// console.log(event.relatedTarget);
var myVal = $(event.relatedTarget).data('err');
// console.log(myVal);
var loader =
'<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
$('#file-err-modal').find(".modal-body").html(loader);
var model_data = fetchFileError(myVal);
// console.log('data received.');
// console.log(model_data);
});
$('#invoiceForm').on('submit', function (e) {
e.preventDefault(); // Prevent default form submission
var form = document.getElementById('invoiceForm');
if(!form.checkValidity())
{
return false;
}
// Serialize form data to array and then convert to JSON
var formData = new FormData(form);
var formDataJSON = {};
// Iterate over FormData entries
formData.forEach(function(value, key) {
// Check if the key ends with '[]' indicating an array-like input
if (key.endsWith('[]')) {
// Remove '[]' from the key and store it as an array in formDataJSON
var arrayKey = key.slice(0, -2);
if (!formDataJSON[arrayKey]) {
formDataJSON[arrayKey] = [];
}
formDataJSON[arrayKey].push(value); // Push the value into the array
} else {
formDataJSON[key] = value; // Standard single-value field
}
});
// Convert the JSON object to a string
var jsonData = JSON.stringify(formDataJSON);
console.log(jsonData);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// Send the JSON data to the backend using AJAX
$.ajax({
url: 'saveInvoicePaymentDetails', // Replace with your backend URL
type: 'POST',
contentType: 'application/json',
data: jsonData,
success: function (response) {
console.log(response);
// Close the modal
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
myModal.hide();
// Reset the form data
$('#invoiceForm')[0].reset();
// Optionally display success message or perform further actions
alert('Invoice updated successfully!');
},
error: function (xhr, status, error) {
// Handle any errors
console.error('Form submission failed:', error);
alert('An error occurred while updating the invoice.');
}
});
$('.loader').fadeOut();
$('.loader-mask').delay(10).fadeOut('slow');
});
});
// Add/Delete rows in the payment table
document.getElementById('add_row_btn').addEventListener('click', function () {
const tableBody = document.querySelector('#payment_table_modal tbody');
const newRow = document.createElement('tr');
newRow.innerHTML = `
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
<td><input type="date" class="form-control" value="<?php echo date('Y-m-d'); ?>" name="payment_date[]" placeholder="Enter UTR No" required></td>
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
`;
tableBody.appendChild(newRow);
});
// Remove row
document.getElementById('payment_table_modal').addEventListener('click', function (e) {
if (e.target && e.target.classList.contains('remove-row')) {
if (confirm("Do you want to delete this entry?")) {
var row = e.target.closest('tr');
var pk = row.querySelector('input[name="pk[]"]').value;
if (pk === "") {
// If pk is empty, remove the row
row.remove();
} else {
// If pk is non-empty, send AJAX request to remove it from the backend
$.ajax({
url: 'deletePaymentEntry/'+pk, // Your backend URL here
type: 'GET',
// data: { pk: pk }, // Send the pk value to delete on server-side
success: function (response) {
// On success, remove the row
console.log(response);
if (response.dataStatus) {
row.remove();
alert('Payment deleted successfully.');
} else {
alert('Failed to delete the entry.');
}
},
error: function () {
alert('Error occurred while deleting the entry.');
}
});
}
}
}
});
function switchRequired(elementId, isRequired, type = 'id') {
if(type == 'id')//id attribute
{
let element = document.getElementById(elementId);
if (isRequired) {
element.setAttribute('required', 'required');
} else {
element.removeAttribute('required');
}
}
else //name attribute
{
var name_attribute = elementId+'[]';
// Select all elements with the name 'invoice_amt[]'
var elements = document.getElementsByName(name_attribute);
// Loop through the elements and set or remove the 'required' attribute
elements.forEach(function(element) {
if (isRequired) {
element.setAttribute('required', 'required'); // Make required
} else {
element.removeAttribute('required'); // Remove required
}
});
}
}
</script>
<script>
function showFileUploadModal(input)
{
var myModal = new bootstrap.Modal(document.getElementById('file_upload'));
myModal.show();
// $(input).val('');
}
function showInvoiceStatusModal(event)
{
// console.log(event.target.data)
var dataId = event.target.getAttribute('data-id');
var dataExpAmt = event.target.getAttribute('data-exp-amt');
var dataReceivedAmt = event.target.getAttribute('data-received-amt');
// Set the value to a hidden input field in the modal
document.getElementById('hidden_statement_id').value = dataId;
document.getElementById('modal_exp_amt').value = dataExpAmt;
document.getElementById('modal_received_amt').value = dataReceivedAmt;
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// AJAX call to get the invoice details based on data-id
$.ajax({
url: 'getPaymentDetails/'+ dataId, // Replace with your backend URL
method: 'get',
// data: { id: dataId },
// dataType: 'json',
success: function(response) {
$('.loader').fadeOut();
$('.loader-mask').delay(10).fadeOut('slow');
console.log(response);
// Assuming response contains the necessary data
if (response.dataStatus === true && response.code === 200) {
// Populate modal fields
if(response.data.invoice_status !== null)
{
var inv_status_element = document.getElementById('invoice_status');
inv_status_element.value = response.data.invoice_status;
var event = new Event('change');
inv_status_element.dispatchEvent(event);
}
document.getElementById('invoice_no_modal').value = response.data.invoice_no;
document.getElementById('invoice_date_modal').value = response.data.invoice_date;
// Clear existing rows in the payment table
var paymentTableBody = document.querySelector('#payment_table_modal tbody');
// Populate payment table rows
if(response.data.payments.length)
{
paymentTableBody.innerHTML = '';
response.data.payments.forEach(function(payment) {
var row = paymentTableBody.insertRow();
row.innerHTML = `
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td>
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
<td><input type="date" class="form-control" name="payment_date[]" value="${payment.received_date}" required></td>
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
`;
});
}
// Show the modal
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
myModal.show();
} else {
// Handle error if the response is not successful
console.error('Failed to fetch data:', response);
alert("Something went wrong! Couldn't get data");
}
},
error: function(xhr, status, error) {
// Handle AJAX errors
console.error('AJAX Error:', status, error);
alert("Something went wrong! Couldn't reach app");
}
});
$('.loader').fadeOut();
$('.loader-mask').delay(10).fadeOut('slow');
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
myModal.show();
// $(input).val('');
}
$(document).ready(function(){
var rollover_date = flatpickr("#statement_month", {
dateFormat: "Y-M-d",
allowInput: true
});
});
$('#insurer_statement_upload_form').submit(function(event) {
event.preventDefault();
var isValid = $('#insurer_statement_upload_form').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
alert('choose all fileds');
return;
}
// Create FormData object
var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) {
console.log(pair[0] + ', ' + pair[1]);
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: $(this).attr("action"),
type: "POST",
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Let jQuery handle the content type
headers: {
// "Content-Type":"multipart/form-data",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
$('#insurer_statement_upload_form')[0].reset();
if (response.code === 200 && response.dataStatus === true && response
.data !== "") {
toastr.success(
'File upload successs',
'success');
$('.close').click()
window.location.reload(true);
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
// alert(response.message);
toastr.error(response.message, 'Failed');
window.location.reload(true);
} else {
console.error('Something went wrong!');
// alert('Something went wrong! Try later');
toastr.error('Something went wrong! Try later', 'Error');
window.location.reload(true);
}
},
error: function(xhr, status, error) {
// Request failed, handle error
console.error("Request failed:", status, error);
toastr.error('Something went wrong! Try later', 'Error');
$('#uploadForm')[0].reset();
window.location.reload(true);
}
});
$('.loader').fadeOut();
$('.loader-mask').delay(10).fadeOut('slow');
});
function fetchFileError(file_id) {
$('#loader').show();
var apiURL = 'getFileErr/' + file_id;
// console.log('fetchFileError');
// console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log(response);
$(this).find(".modal-body").html("");
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
// console.log((JSON.parse(response.data)));
var file_error_data = (JSON.parse(response.data));
var file_error_html = "";
if (file_error_data['error_code'] == 1) {
file_error_html += 'The following row no(s) from excel are <span style="font-weight:bold">either already mapped / not found with policy transactions / duplicates.</span>';
file_error_html += ' : ' + '<span style="font-weight:bolder">' + file_error_data['error_data'].join(',') + '</span>';
}
// console.log(file_error_html);
$('#file-err-modal').find(".modal-body").html(file_error_html);
return file_error_html;
} catch (error) {
console.error('Error parsing API response data:', error);
}
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
}
});
$('#loader').hide();
}
function checkInvAmont(event)
{
var total = 0;
document.querySelectorAll('input[name="invoice_amount[]"]').forEach(function(el) {
let val = parseFloat(el.value) || 0;
total += val;
});
var exp_amt = document.getElementById('modal_exp_amt').value;
if(exp_amt < total)
{
alert('Exceeds expected amt');
event.target.value = '';
}
}
</script>