FIX_igr : ps

This commit is contained in:
VE10-Sanjeev 2024-07-18 12:08:40 +00:00
parent f861d6635d
commit 16bbefe30c

View File

@ -19,8 +19,12 @@
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
});
});
//jquery for vechicle masking
// $(document).ready(function(){
// Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
// });
</script>
<style>
@ -55,12 +59,8 @@
<div class="content-wrapper" style="min-height:537px;">
<section class="content-header">
<div class="pull-right hidden-xs">
<!-- <b><?php // $date = date('Y-m-d H:i:s'); echo $date; ?> </b> -->
<b><div id="clock"></div></b>
</div>
<h1>
<center> Inward Gate Register</center>
<center> Inward Gate Register </center>
</h1>
</section>
<section class="content" style="margin: 15px;"><br/>
@ -71,13 +71,13 @@
<div class="row"><br/><br/>
<div id="content" > </div>
<div class="col-md-12">
<div class="col-md-3">
<div class="col-md-3">
<div style="display: flex; justify-content: space-between; align-items: center;">
<label>Select Purchase Order No</label>
<a id="printLink" data-toggle="tooltip" href="" target="new" style="text-align: right;">
<i class="fa fa-print" data-toggle="tooltip" title="Click here to Print the Purchase Order details"></i>
</a>
</div>
</div>
<?php
$options = array("-1"=>'Purchase Order No');
@ -95,12 +95,10 @@
}
echo form_dropdown('PONO', $options,set_value('PONO'),'id="PONO"' ,'class="form-control select2"' , 'required="true"');
?>
<input type="hidden" name="hiddenIsOpenOrder" id="hiddenIsOpenOrder"/>
</div>
<input type="hidden" name="hiddenIsOpenOrder" id="hiddenIsOpenOrder"/>
<div class="col-md-3">
<label>Supplier Name </label>
<div class="form-group">
@ -115,15 +113,15 @@
<div class="col-md-3">
<label>Invoice Number</label>
<label>Invoice Number <!-- Delivery Challan/Inv No --></label>
<?php
$data = array('name' => 'InvoiceNo','value' => set_value('InvoiceNo'),'id'=>'InvoiceNo', 'class' => 'form-control', 'required=>"true"' );
$data = array('name' => 'InvoiceNo','value' => set_value('InvoiceNo'),'id'=>'InvoiceNo', 'class' => 'form-control', 'required=>"true"','onkeypress'=>'return isNumberKey(event);' );
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Invoice Date</label>
<label>Invoice Date <!-- Delivery Challan/Inv Date --></label>
<?php
$data = array('name' => 'InvoiceDate','value' => set_value('InvoiceDate'),'id'=>'InvoiceDate', 'class' => 'form-control num', 'required'=>'true' );
echo form_input($data);
@ -148,7 +146,8 @@
$data = array('name' => 'VehicleNo','value' => set_value('VehicleNo'), 'id'=>'VehicleNo', 'class' => 'form-control', 'maxlength' => '20' );
echo form_input($data);
?>
</div>
<!-- <span pattern="" required="true"></span> -->
</div>
<div class="col-md-3">
<label>Driver Name</label>
<?php
@ -162,9 +161,17 @@
$data = array('name' => 'DriverMobileNumber','value' => set_value('DriverMobileNumber'), 'id'=>'DriverMobileNumber', 'class' => 'form-control', 'maxlength' => '50' );
echo form_input($data);
?>
</div>
</div>
<!-- <div class="col-md-3">
<label>Courier No</label>
<?php
// $data = array('name' => 'CourierNo','value' => set_value('CourierNo'),'id'=>'CourierNo', 'class' => 'form-control','onkeypress'=>'return isNumberKey(event);' );
// echo form_input($data);
?>
</div> -->
</div>
<!-- <div class="col-md-12">
<div class="col-md-offset-4">
<div class="box-header">
@ -180,17 +187,15 @@
</div>
<div class="col-md-12" style="margin: 10px 0;">
<div class="col-md-12" style="margin-top: 10px;">
<!-- <input type="button" class="btn btn-success" id ="addemorebutton" value=" + ADD FILES.."> -->
<!-- <input type="button" class="btn btn-primary" id ="addemorebutton" value=" + ADD FILES.."> -->
<!-- <div id="newsdiv"></div>this div for add more section -->
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
<input type="hidden" name="hideIGRRemarks" id="hideIGRRemarks" value="" />
<!-- <div id="newsdiv"></div>this div for add more section -->
<input type="hidden" name="hidecounters" id="hidecounters" value="0" />
<input type="hidden" name="hideconstants" id="hideconstants" value="0" />
<input type="hidden" name="hideIGRStatus" id="hideIGRStatus" value="0" />
</div>
@ -199,18 +204,20 @@
<div class="col-md-12">
<table id="Inwardgateregistertable" class="table table-bordered table-hover editabletable IGR_Line" style="background-color:#fff;font-size:12px;">
<thead >
<thead style="background-color:#ddf">
<tr>
<th>S.No</th>
<th>Item Code</th>
<th>Material</th>
<th>UOM</th>
<th>Ordered Quantity</th>
<th>Received Quantity</th>
<th>Balance Quantity</th>
<th>Pending Quantity</th>
<th>Remarks</th>
<th>Item Code</th>
<th>Material</th>
<th>UOM</th>
<th>Ordered Quantity</th>
<th>Received Quantity</th>
<th>Pending Quantity</th>
<th>Advised Quantity</th>
<th>Remarks</th>
<th> </th>
</tr>
</thead>
<tbody id ="IGRappend">
@ -229,7 +236,7 @@
<!--<table id="specialtable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >-->
<!--<thead >
<!--<thead style="background-color:#ddf">
<tr>
<th>MaterialCode1</th>
<th>DeliveryChallanDate</th>
@ -246,69 +253,15 @@
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button>
<button class="btn btn-primary" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button>
</div> -->
<div class="container">
<div class="form-group row">
<label for="GrossWeight" class="col-md-2 col-form-label">Gross Weight</label>
<div class="col-md-3">
<?php
$data = array('name' => 'GrossWeight', 'value' => set_value('GrossWeight'), 'id' => 'GrossWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<?php
$data = array('name' => 'GrossWeightDate', 'value' => set_value('GrossWeightDate'), 'id' => 'GrossWeightDate', 'class' => 'form-control', 'readonly' => true);
echo form_input($data);
?>
</div>
</div>
<div class="form-group row">
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
<div class="col-md-3">
<?php
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<?php
$data = array('name' => 'TareWeightDate', 'value' => set_value('TareWeightDate'), 'id' => 'TareWeightDate', 'class' => 'form-control', 'readonly' => true);
echo form_input($data);
?>
</div>
</div>
<div class="form-group row">
<label for="NetWeight" class="col-md-2 col-form-label">Net Weight</label>
<div class="col-md-3">
<?php
$data = array('name' => 'NetWeight', 'value' => set_value('NetWeight'), 'id' => 'NetWeight', 'class' => 'form-control', 'maxlength' => '50', 'readonly' => true);
echo form_input($data);
?>
</div>
</div>
</div>
<?php if ($DEPCode == ADMIN) { $class = "col-md-5 col-md-offset-7"; }else{ $class="col-md-4 col-md-offset-8";} ?>
<div class="<?php echo $class; ?>">
<div class="col-md-4 col-md-offset-8">
<input type="file" name="browseFiles1" id="images1" onchange="Copyfilenames(this.name); "><br>
<?php if (($DEPCode == SECURITY || $DEPCode == ADMIN)) { ?>
<button class="btn btn-success" id='IGRDraftLink' type="submit" name='IGRDraftLink' onclick="filecheck(0);">Draft IGR</button>
<?php } if (($DEPCode == SECURITY || $DEPCode == ADMIN && 1)) { ?>
<button class="btn btn-success" id='IGRCreatedLink' type="submit" name='IGRCreatedLink' onclick="filecheck(1);">Generate IGR</button>
<?php } if ($DEPCode == ADMIN) { ?>
<button class="btn btn-success" id='IGRCompleteLink' type="submit" name='IGRCompleteLink' onclick="filecheck(2);">Complete IGR</button>
<?php } if ($DEPCode == ADMIN) { ?>
<button class="btn btn-success" id='IGRCancelLink' type="submit" name='IGRCancelLink' onclick="filecheck(3);">Cancel IGR</button>
<?php } ?>
</div>
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck(1);">Generate IGR</button>
</div>
</div>
</div>
@ -323,7 +276,7 @@
<div class="modal-content">
<div class="modal-header">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Inward Gate Register Number</h4></center>
</div>
@ -343,6 +296,79 @@
</div><!-- modal fade closed-->
<!-- new modal ended-->
<div class="modal fade" id="WeightCalculator" role="dialog">
<div class="modal-dialog modal_style">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Weight Calculator</h4><div id="material"></div></center>
<div class="pull-right hidden-xs">
<b><div id="clock"></div></b>
</div>
</div>
<div class="col-md-12"> <br/>
<!-- <center><label style="font-size:40px;">Default</label> </center> -->
<!-- <div class="container"> -->
<div class="form-group row">
<label for="GrossWeight" class="col-md-2 col-form-label">Gross Weight</label>
<div class="col-md-5">
<?php
$data = array('name' => 'GrossWeight', 'value' => set_value('GrossWeight'), 'id' => 'GrossWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);' , 'placeholder' => 'Gross Weight Value (A)');
echo form_input($data);
?>
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'GrossWeightDate', 'value' => set_value('GrossWeightDate'), 'id' => 'GrossWeightDate', 'class' => 'form-control', 'readonly' => true , 'placeholder' => 'Gross Weight Date/Timing');
echo form_input($data);
?>
</div>
</div>
<div class="form-group row">
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
<div class="col-md-5">
<?php
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);' ,'placeholder' => 'Enter your username','placeholder' => 'Tare Weight Value (B)');
echo form_input($data);
?>
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'TareWeightDate', 'value' => set_value('TareWeightDate'), 'id' => 'TareWeightDate', 'class' => 'form-control', 'readonly' => true , 'placeholder' => 'Tare Weight Date/Timing',);
echo form_input($data);
?>
</div>
</div>
<div class="form-group row">
<label for="NetWeight" class="col-md-2 col-form-label">Net Weight</label>
<div class="col-md-5">
<input type="hidden" id="CurrentInx" name="CurrentInx" readonly>
<?php
$data = array('name' => 'NetWeight', 'value' => set_value('NetWeight'), 'id' => 'NetWeight', 'class' => 'form-control', 'maxlength' => '50', 'readonly' => true , 'placeholder' => 'Net Weight Value (A-B)');
echo form_input($data);
?>
</div>
</div>
<!-- </div> -->
</div>
<div class="modal-footer">
<center>
<a class="btn btn-primary" onclick="modalSave()">&nbsp;&nbsp;<span class="bold">Save</span>
<a class="btn btn-primary" data-dismiss="modal" value="Close">Close</a>
</center>
</div><!-- footer div closed -->
</div><!-- modal content div closed-->
</div><!-- modal content closed-->
</div><!-- modal fade closed-->
@ -370,13 +396,13 @@ function validate()
var isExceed = 0;
for(k=1;k<=rowcount ; k++)
{
var PendingQty = parseFloat( $('#QuantityAsPerInvoice'+k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+k).val());
var AdvisedQty = parseFloat( $('#QuantityAsPerInvoice'+k).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+k).val());
var RecQty = parseFloat( $('#txtReceivedQuantity'+k).val() == '' ? '0.00' : $('#txtReceivedQuantity'+k).val());
var OrderedQty =parseFloat($('#Quantity_1'+k).text());
if(PendingQty != '0.00')
if(AdvisedQty != '0.00')
{
if(OrderedQty < (PendingQty+RecQty))
if(OrderedQty < (AdvisedQty+RecQty))
{
isExceed = 1;
return false;
@ -414,13 +440,13 @@ function validate()
else if (Noval == 0 )
{
alert('Pending Quantity is Empty.Please Enter the value');
alert('Advised Quantity is Empty.Please Enter the value');
return false;
}
else if(isExceed == 1 ){
alert("Pending Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
return false;
}
else
@ -456,6 +482,12 @@ function validate()
$("#txtReceivedQuantity"+k).remove();
$("#txtRemarks"+k).remove();
$("#txtPendingQty"+k).remove();
$("#txtGrossWeight"+k).remove();
$("#txtGrossWeightDate"+k).remove();
$("#txtTareWeight"+k).remove();
$("#txtTareWeightDate"+k).remove();
$("#txtNetWeight"+k).remove();
}
}
@ -471,11 +503,7 @@ function validate()
$('#content').loader('show');
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
console.log("427");
console.log(y);
$.each(y, function(idx, obj) {
if(id == obj.PONO)
@ -487,6 +515,7 @@ function validate()
$("#po").val(obj.PONO);
$("#Sup").val(obj.SupplierName);
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
//$("#Add").val(obj.Address);
$("#del").val(obj.DeliveryDate);
//$("#ser").val(obj.ServiceDescription);
@ -495,8 +524,7 @@ function validate()
formatted_PODate = obj.formatted_PODate;
formatted_IsOpenOrder = obj.formatted_IsOpenOrder;
}
}
});
//alert(ostatus)
@ -504,6 +532,7 @@ function validate()
data:{id:id},
type:"POST",
url:"<?php echo base_url() ?>inwardgateregister/IGRITEM",
success:function(data) {
//alert(data);
@ -511,62 +540,130 @@ function validate()
$('#content').loader('hide');
//alert(data);
var trHTML = '';
var j=0;
var showTable = false;
// var startDate = formatted_PODate ? new Date(formatted_PODate) : null;
// var currentDate = new Date();
var j=0;
var showTable = false;
$.each(JSON.parse(data), function (i, item) {
// if(item.PendingQty != 0){
// showTable = true;
// }
// if (startDate && endDate && currentDate >= startDate && currentDate <= endDate) {
// showTable = true;
// }
showTable = true;
if(showTable){
$.each(JSON.parse(data), function (i, item) {
showTable = true;
if(showTable){
i=i+1;
j=j+1;
trHTML += '<tr>' +
trHTML += '<tr>' +
'<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1'+i+'" id="Quantity_1'+i+'">' + item.Quantity + '</td>' +
'<td name="Quantity1'+i+'" id="Quantity_1'+i+'">' + item.Quantity + '</td>' +
'<td name="ReceivedQuantity'+i+'" id="ReceivedQuantity'+i+'">'+ item.ReceivedQuantity +'</td>'+
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity('+i+')"id="QuantityAsPerInvoice'+ i +'" name="QuantityAsPerInvoice'+ i +'" value="" onkeypress="return isNumberKey(event);"></td>' +
'<td name="PendingQuantity'+i+'" id="PendingQuantity'+i+'">'+ item.PendingQty +'</td>'+
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity('+i+')"id="QuantityAsPerInvoice'+ i +'" name="QuantityAsPerInvoice'+ i +'" value="" onkeypress="return isNumberKey(event);"></td>' +
'<td><input type="text" id="Remark'+ i +'" name="Remark'+ i +'" class="form" onchange="SetRemarks('+i+')"> </td>' +
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'"><i class="fa fa-solid fa-calculator" style="text-align: center;"></i></a> </td>' +
'</tr>';
$('#txtRowCount').val(i);
$('<input>').attr({type: 'hidden',id: 'MaterialCode'+i,value:item.MaterialCode,name: 'MaterialCode'+i}).appendTo('form');
$('<input>').attr({type: 'hidden',id: 'txtQuantityAsPerInvoice'+i,name: 'txtQuantityAsPerInvoice'+i}).appendTo('form');
$('<input>').attr({type: 'hidden',id: 'OrderedQuantity'+i,value:item.Quantity,name: 'OrderedQuantity'+i}).appendTo('form');
$('<input>').attr({type: 'hidden',id: 'txtReceivedQuantity'+i,name: 'txtReceivedQuantity'+i,value:item.ReceivedQuantity}).appendTo('form');
$('<input>').attr({type: 'hidden',id: 'txtRemarks'+i,name: 'txtRemarks'+i}).appendTo('form');
$('<input>').attr({type: 'hidden',id: 'txtPendingQty'+i,name: 'txtPendingQty'+i,value:item.PendingQty}).appendTo('form');
//alert(item.PendingQty);
if(item.PendingQty == 0.00)
{
//alert('inside if');
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
// $('#txtEditFreight').attr('readonly', 'true');
}
$("#IGRCreatedLink").show();
}else{
if(JSON.parse(data).length == 1 && item.PendingQty == 0){
$("#IGRCreatedLink").hide();
//alert('The Order is new completed!!');
}
$('<input>').attr({
type: 'hidden',
id: 'MaterialCode'+i,
value:item.MaterialCode,
name: 'MaterialCode'+i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtQuantityAsPerInvoice'+i,
name: 'txtQuantityAsPerInvoice'+i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'OrderedQuantity'+i,
value:item.Quantity,
name: 'OrderedQuantity'+i
}
}).appendTo('form');
});
$('<input>').attr({
type: 'hidden',
id: 'txtReceivedQuantity'+i,
name: 'txtReceivedQuantity'+i,
value:item.ReceivedQuantity
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtRemarks'+i,
name: 'txtRemarks'+i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtPendingQty'+i,
name: 'txtPendingQty'+i,
value:item.PendingQty
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtGrossWeight' + i,
value: item.GrossWeight,
name: 'txtGrossWeight' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtGrossWeightDate' + i,
value: item.GrossWeightDate,
name: 'txtGrossWeightDate' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtTareWeight' + i,
value: item.TareWeight,
name: 'txtTareWeight' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtTareWeightDate' + i,
value: item.TareWeightDate,
name: 'txtTareWeightDate' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtNetWeight' + i,
value: item.NetWeight,
name: 'txtNetWeight' + i
}).appendTo('form');
//alert(item.PendingQty);
if(item.PendingQty == 0.00)
{
//alert('inside if');
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
// $('#txtEditFreight').attr('readonly', 'true');
}
$("#IGRLink").show();
} else{
if(JSON.parse(data).length == 1 && item.PendingQty == 0){
$("#IGRLink").hide();
//alert('The Order is new completed!!');
}
}
});
@ -582,14 +679,15 @@ function validate()
});
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>') && ((hiddenIsOpenOrder === null || hiddenIsOpenOrder === "")) )
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>'))
{
alert('The Order is completed!!');
$("#IGRCreatedLink").hide();
alert('The Order is completed!!');
$("#IGRLink").hide();
}
else
{
$("#IGRCreatedLink").show();
$("#IGRLink").show();
}
}
@ -612,41 +710,43 @@ function validateReceivedQuantity(Rowid){
var InvoiceQty = parseFloat( $('#QuantityAsPerInvoice'+Rowid).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+Rowid).val());
var PendingQty = parseFloat( $('#PendingQuantity'+Rowid).text() == '' ? '0.00' : $('#PendingQuantity'+Rowid).text());
var PendingQty = parseFloat( $('#PendingQuantity'+Rowid).text() == '' ? '0.00' : $('#PendingQuantity'+Rowid).text());
var RecQty = parseFloat( $('#txtReceivedQuantity'+Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity'+Rowid).val());
var RecQty = parseFloat( $('#txtReceivedQuantity'+Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity'+Rowid).val());
var OrderedQty =parseFloat($("#Quantity_1"+Rowid).text());
var r =$("#Remark"+Rowid).val();
if (parseInt(OrderedQty) !== 0) {
if((InvoiceQty+RecQty) > OrderedQty){
alert("Pending Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
// alert(RecQty);
//alert(InvoiceQty);
if((InvoiceQty+RecQty) > OrderedQty){
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
$("#QuantityAsPerInvoice"+Rowid).focus();
$("#QuantityAsPerInvoice"+Rowid).val('');
return false;
} else if(((InvoiceQty+RecQty) - OrderedQty) > 0.00){
return false;
}
else if(((InvoiceQty+RecQty) - OrderedQty) > 0.00){
alert("Order is completed.")
$("#QuantityAsPerInvoice"+Rowid).focus();
$('#QuantityAsPerInvoice'+Rowid).val('');
return false;
} else {
// alert(RecQty);
$('#PendingQuantity'+Rowid).text((OrderedQty - (InvoiceQty+RecQty)).toFixed(2));
$('#txtPendingQty'+Rowid).val(OrderedQty - (InvoiceQty+RecQty));
$("#ReceivedQuantity"+Rowid).val(InvoiceQty+RecQty);
$("#txtQuantityAsPerInvoice"+Rowid).val(InvoiceQty);
// InvoiceQty
return false;
}
else {
// alert(RecQty);
$('#PendingQuantity'+Rowid).text((OrderedQty - (InvoiceQty+RecQty)).toFixed(2));
$('#txtPendingQty'+Rowid).val(OrderedQty - (InvoiceQty+RecQty));
$("#ReceivedQuantity"+Rowid).val(InvoiceQty+RecQty);
$("#txtQuantityAsPerInvoice"+Rowid).val(InvoiceQty);
// InvoiceQty
return true;
}
} else {
$('#PendingQuantity'+Rowid).text((OrderedQty - (InvoiceQty+RecQty)).toFixed(2));
$('#txtPendingQty'+Rowid).val(OrderedQty - (InvoiceQty+RecQty));
$("#ReceivedQuantity"+Rowid).val(InvoiceQty+RecQty);
$("#txtQuantityAsPerInvoice"+Rowid).val(InvoiceQty);
return true;
}
}
</script>
@ -664,11 +764,7 @@ function isNumberKey(evt)
function Save(status)
{
alert("save function worked "+status);
if(status == '3'){
$('#cancelIGR').modal('show');
}
// alert("save function worked "+status);
//alert("save function worked ");
// var file = $('#images'+counterConstants).val()
@ -904,21 +1000,6 @@ function Copyfilenames(id)
}
function WeightDiffer(element)
{
// console.log(element);
var v1 = $("#GrossWeight").val();
var v2 = $("#TareWeight").val();
var v3 = v1-v2;
$("#NetWeight").val(v3);
if (element.id === 'GrossWeight') {
$("#GrossWeightDate").val($("#clock").text());
}
if (element.id === 'TareWeight') {
$("#TareWeightDate").val($("#clock").text());
}
}
@ -966,4 +1047,99 @@ function removeRows(inputs) {
setInterval(updateTime, 1000); // Update every second
updateTime(); // Initial call to display time immediately
</script>
function WeightDiffer(element)
{
// console.log(element);
var v1 = $("#GrossWeight").val();
var v2 = $("#TareWeight").val();
var v3 = v1-v2;
$("#NetWeight").val(v3);
if (element.id === 'GrossWeight') {
$("#GrossWeightDate").val($("#clock").text());
}
if (element.id === 'TareWeight') {
$("#TareWeightDate").val($("#clock").text());
}
}
</script>
<script>
$("#WeightCalculator").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index');
var material = $(e.relatedTarget).data('material');
document.getElementById('material').textContent = " ( "+material+" )";
// Clear the modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
// Retrieve values from hidden inputs
var v1 = $("#txtGrossWeight" + inx).val();
var v2 = $("#txtGrossWeightDate" + inx).val();
var v3 = $("#txtTareWeight" + inx).val();
var v4 = $("#txtTareWeightDate" + inx).val();
var v5 = $("#txtNetWeight" + inx).val();
// Debugging alerts
// console.log("v1:", v1);
// console.log("v2:", v2);
// console.log("v3:", v3);
// console.log("v4:", v4);
// console.log("v5:", v5);
console.log("Selected values for index:", typeof inx,inx);
// Set modal inputs with the retrieved values
$("#GrossWeight").val(v1);
$("#GrossWeightDate").val(v2);
$("#TareWeight").val(v3);
$("#TareWeightDate").val(v4);
$("#NetWeight").val(v5);
$("#CurrentInx").val(inx);
});
function modalSave() {
var v1 = $("#GrossWeight").val();
var v2 = $("#GrossWeightDate").val();
var v3 = $("#TareWeight").val();
var v4 = $("#TareWeightDate").val();
var v5 = $("#NetWeight").val();
var v6 = $("#CurrentInx").val();
// Debugging alerts
// console.log("v1:", v1);
// console.log("v2:", v2);
// console.log("v3:", v3);
// console.log("v4:", v4);
// console.log("v5:", v5);
if (v6 !== undefined && v6 !== '') {
console.log("Saving values for index:", v6);
// Set the values back to the hidden inputs
$("#txtGrossWeight" + v6).val(v1);
$("#txtGrossWeightDate" + v6).val(v2);
$("#txtTareWeight" + v6).val(v3);
$("#txtTareWeightDate" + v6).val(v4);
$("#txtNetWeight" + v6).val(v5);
// Clear modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
// Close the modal
$("#WeightCalculator").modal('hide');
} else {
console.log("Saving values for index: undefined");
}
}
</script>