1152 lines
33 KiB
PHP
Executable File
1152 lines
33 KiB
PHP
Executable File
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
|
|
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
|
<script src="<?php echo base_url()?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
|
<style>
|
|
#MaterialRcvdDate {
|
|
text-align: left;
|
|
}
|
|
#InvoiceDate {
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$("#PONO").select2();
|
|
|
|
|
|
$("#InvoiceDate").datepicker({
|
|
maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
|
});
|
|
$("#MaterialRcvdDate").datepicker({
|
|
maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
|
}).datepicker("setDate", new Date());
|
|
|
|
});
|
|
//jquery for vechicle masking
|
|
// $(document).ready(function(){
|
|
// Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
|
|
// });
|
|
</script>
|
|
|
|
<style>
|
|
.modal {
|
|
text-align: center;
|
|
padding: 0!important;
|
|
}
|
|
|
|
.modal:before {
|
|
content: '';
|
|
display: inline-block;
|
|
height: 100%;
|
|
vertical-align: middle;
|
|
margin-right: -4px;
|
|
}
|
|
|
|
.modal-dialog {
|
|
display: inline-block;
|
|
text-align: left;
|
|
vertical-align: middle;
|
|
}
|
|
.select2 {
|
|
width: 100% ! important;
|
|
}
|
|
.num {
|
|
text-align:right;
|
|
}
|
|
.dataTables_wrapper {
|
|
padding-bottom: 0px;
|
|
}
|
|
</style>
|
|
|
|
<div class="content-wrapper" style="min-height:537px;">
|
|
|
|
<section class="content-header">
|
|
<h5><div class="pull-right hidden-xs">
|
|
<b><div id="wizard_clock"></div></b>
|
|
</div></h5>
|
|
<h1>
|
|
<center> Inward Gate Register </center>
|
|
</h1>
|
|
|
|
</section>
|
|
<section class="content" style="margin: 15px;"><br/>
|
|
<div style="border:2px solid #333;">
|
|
|
|
<form action ="<?php echo base_url()?>SaveIGR"
|
|
method="post" enctype="multipart/form-data">
|
|
<div class="row"><br/><br/>
|
|
<div id="content" > </div>
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<label>Select Purchase Order No <span style="color:red; font-size: 15px;">*</span></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>
|
|
<?php
|
|
$options = array("-1"=>'Purchase Order No');
|
|
if(!empty($PO_NO)){
|
|
//print_r($PO_NO);
|
|
foreach ($PO_NO as $SI):
|
|
$options[$SI->PONO] = $SI->PONO .'-'. $SI->SupplierName ;
|
|
$PONO = $SI->PONO;
|
|
endforeach;
|
|
}
|
|
echo form_dropdown('PONO', $options,set_value('PONO'),'id="PONO"' ,'class="form-control select2"' , 'required="true"');
|
|
?>
|
|
<span class="help-block"></span>
|
|
</div>
|
|
<input type="hidden" name="hiddenIsOpenOrder" id="hiddenIsOpenOrder"/>
|
|
<div class="col-md-6">
|
|
<label>Supplier Name </label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'SupplierName','value' => set_value('SupplierName'),'id'=>'Sup', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12" style="margin: 10px 0;">
|
|
<div class="col-md-4">
|
|
<label>Invoice Number <span style="color:red; font-size: 15px;">*</span><!-- Delivery Challan/Inv No --></label>
|
|
<?php
|
|
$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-4">
|
|
<label>Invoice Date <span style="color:red; font-size: 15px;">*</span><!-- 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);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Material Received Date <span style="color:red; font-size: 15px;">*</span></label>
|
|
<?php
|
|
$data = array('name' => 'MaterialRcvdDate','value' => set_value('MaterialRcvdDate'),'id'=>'MaterialRcvdDate', 'class' => 'form-control num', 'required'=>'true' );
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12" style="margin: 10px 0;">
|
|
<div class="col-md-4">
|
|
<label>Vechicle Number</label>
|
|
<?php
|
|
$data = array('name' => 'VehicleNo','value' => set_value('VehicleNo'), 'id'=>'VehicleNo', 'class' => 'form-control', 'maxlength' => '20' );
|
|
echo form_input($data);
|
|
?>
|
|
<!-- <span pattern="" required="true"></span> -->
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Driver Name</label>
|
|
<?php
|
|
$data = array('name' => 'DriverName','value' => set_value('DriverName'), 'id'=>'DriverName', 'class' => 'form-control', 'maxlength' => '50' );
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Driver Mobile Number</label>
|
|
<?php
|
|
$data = array('name' => 'DriverMobileNumber','value' => set_value('DriverMobileNumber'), 'id'=>'DriverMobileNumber', 'class' => 'form-control', 'maxlength' => '50' );
|
|
echo form_input($data);
|
|
?>
|
|
</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">
|
|
<input type="file" accept=".png,.jpg,.pdf" id="myfile" name="myfile" />
|
|
<label for="photo">Select File to upload<br/></label>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12" style="margin-top: 10px;">
|
|
|
|
<!-- <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" />
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
<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 style="background-color:#ddf">
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Item Code</th>
|
|
<th>Material</th>
|
|
<th>UOM</th>
|
|
<th>Ordered Quantity</th>
|
|
<th>Received Quantity</th>
|
|
<th>Balance Quantity</th>
|
|
<th>Invoice Quantity</th>
|
|
<th>Remarks</th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id ="IGRappend">
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
|
|
</table>
|
|
<input type="hidden" name="txtRowCount" id="txtRowCount" />
|
|
|
|
<!--<input type="text" id="tablevalues" value="sample" name="tablevalues"/>
|
|
<div class="col-md-12">-->
|
|
|
|
<!--<table id="specialtable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >-->
|
|
|
|
|
|
<!--<thead style="background-color:#ddf">
|
|
<tr>
|
|
<th>MaterialCode1</th>
|
|
<th>DeliveryChallanDate</th>
|
|
<th>DeliveryChallanNo</th>
|
|
<th>VehicleNo</th>
|
|
<th>CourierNo</th>
|
|
<th>Quantity12</th>
|
|
<th>File</th>
|
|
</tr>
|
|
</thead>-->
|
|
|
|
|
|
<!-- <div class="col-md-1 col-md-offset-10">
|
|
|
|
|
|
|
|
<button class="btn btn-primary" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button>
|
|
|
|
|
|
</div> -->
|
|
<div class="col-md-4 col-md-offset-8">
|
|
<input type="file" name="browseFiles1" id="images1" onchange="Copyfilenames(this.name); "><br>
|
|
<button class="btn btn-success" id='IGRDraftLink' type="submit" name='IGRDraftLink' onclick="filecheck(0);">Draft IGR</button>
|
|
<button class="btn btn-success" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck(1);">Generate IGR</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal fade" id="generateIGR" role="dialog">
|
|
<div class="modal-dialog modal_style">
|
|
<!-- Modal content-->
|
|
<form>
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Inward Gate Register Number</h4></center>
|
|
</div>
|
|
<div class="col-md-12"> <br/>
|
|
|
|
<center><label style="font-size:40px;" id="finaligr" >Default</label> </center>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<center>
|
|
<button type="reset" value="Reset" onClick="window.location.reload()"> OK</button>
|
|
</center>
|
|
</div><!-- footer div closed -->
|
|
</div><!-- modal content div closed-->
|
|
</form><!-- form closed-->
|
|
</div><!-- modal content closed-->
|
|
</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">×</button>
|
|
<center><h4>Weight Calculator</h4><div id="WeightTitle"></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' => 'validateTareWeight(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()"> <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-->
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function validate()
|
|
{
|
|
var rowcount = $("#txtRowCount").val();
|
|
|
|
var Noval = 0;
|
|
var isExceed = 0;
|
|
for(k=1;k<=rowcount ; k++)
|
|
{
|
|
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(AdvisedQty != '0.00')
|
|
{
|
|
|
|
if(OrderedQty < (AdvisedQty+RecQty))
|
|
{
|
|
isExceed = 1;
|
|
return false;
|
|
}
|
|
Noval = 1;
|
|
}
|
|
}
|
|
|
|
|
|
if($('#PONO').val()=='-1')
|
|
{
|
|
|
|
alert("Please select PurchaseOrder");
|
|
$('#PONO').focus();
|
|
return false;
|
|
}
|
|
else if($('#InvoiceNo').val() == '' )
|
|
{
|
|
alert('Please Enter Invoice Number' );
|
|
$('#InvoiceNo').focus();
|
|
return false;
|
|
}
|
|
else if($('#InvoiceDate').val() == '' )
|
|
{
|
|
alert('Please Enter Invoice Date' );
|
|
$('#InvoiceDate').focus();
|
|
return false;
|
|
}
|
|
else if($('#MaterialRcvdDate').val() == '' )
|
|
{
|
|
alert('Please Enter Material Received Date' );
|
|
$('#MaterialRcvdDate').focus();
|
|
return false;
|
|
}
|
|
else if (Noval == 0 )
|
|
{
|
|
|
|
alert('Advised Quantity is Empty.Please Enter the value');
|
|
return false;
|
|
|
|
}
|
|
else if(isExceed == 1 ){
|
|
|
|
alert("Advised Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
$(function () {
|
|
$('#Inwardgateregistertable').DataTable({
|
|
"paging": false,
|
|
"lengthChange": false,
|
|
"searching": false,
|
|
"ordering": false,
|
|
"info": false,
|
|
"autoWidth": false
|
|
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
// $(function() {
|
|
function removeHidden()
|
|
{
|
|
var rowcount = $("#txtRowCount").val();
|
|
for(k=1;k<=rowcount ; k++)
|
|
{
|
|
$("#MaterialCode"+k).remove();
|
|
$("#txtQuantityAsPerInvoice"+k).remove();
|
|
$("#OrderedQuantity"+k).remove();
|
|
$("#txtReceivedQuantity"+k).remove();
|
|
$("#txtRemarks"+k).remove();
|
|
$("#txtPendingQty"+k).remove();
|
|
|
|
$("#txtGrossWeight"+k).remove();
|
|
$("#txtGrossWeightDate"+k).remove();
|
|
$("#txtTareWeight"+k).remove();
|
|
$("#txtTareWeightDate"+k).remove();
|
|
$("#txtNetWeight"+k).remove();
|
|
}
|
|
}
|
|
|
|
$('#PONO').change(function() {
|
|
removeHidden();
|
|
$("#IGRappend").empty();
|
|
$('#txtRowCount').val('');
|
|
|
|
var id = $('#PONO').val();
|
|
var status= '';
|
|
if(id != '-1')
|
|
{
|
|
|
|
$('#content').loader('show');
|
|
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
|
|
|
|
$.each(y, function(idx, obj) {
|
|
|
|
if(id == obj.PONO)
|
|
{
|
|
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
|
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
|
|
$('#printLink').attr('href', newUrl);
|
|
|
|
$("#po").val(obj.PONO);
|
|
$("#Sup").val(obj.SupplierName);
|
|
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
|
|
var isOpenOrder = parseInt(obj.IsOpenOrder, 2);
|
|
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
|
$('.help-block').text(formatted_IsOpenOrder);
|
|
|
|
//$("#Add").val(obj.Address);
|
|
$("#del").val(obj.DeliveryDate);
|
|
//$("#ser").val(obj.ServiceDescription);
|
|
status = obj.status;
|
|
ostatus= obj.OGR_Status;
|
|
formatted_PODate = obj.formatted_PODate;
|
|
formatted_IsOpenOrder = obj.formatted_IsOpenOrder;
|
|
|
|
}
|
|
});
|
|
|
|
//alert(ostatus)
|
|
$.ajax({
|
|
data:{id:id},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>GetIGRLineItemDetails",
|
|
|
|
success:function(data) {
|
|
|
|
//alert(data);
|
|
|
|
$('#content').loader('hide');
|
|
//alert(data);
|
|
var trHTML = '';
|
|
|
|
var j=0;
|
|
var showTable = false;
|
|
|
|
|
|
$.each(JSON.parse(data), function (i, item) {
|
|
showTable = true;
|
|
|
|
if(showTable){
|
|
i=i+1;
|
|
j=j+1;
|
|
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="ReceivedQuantity'+i+'" id="ReceivedQuantity'+i+'">'+ item.ReceivedQuantity +'</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-truck" 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');
|
|
$('<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!!');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#IGRappend").empty();
|
|
|
|
|
|
$('#IGRappend').append(trHTML);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>'))
|
|
{
|
|
alert('The Order is completed!!');
|
|
|
|
$("#IGRLink").hide();
|
|
}
|
|
else
|
|
{
|
|
$("#IGRLink").show();
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
alert('Please Select the Purchase Order Number to Create IGR');
|
|
}
|
|
});
|
|
|
|
function SetRemarks(RowId)
|
|
{
|
|
var remks = $("#Remark"+RowId).val();
|
|
if( remks != '')
|
|
{
|
|
$("#txtRemarks"+RowId).val(remks);
|
|
}
|
|
}
|
|
function validateReceivedQuantity(Rowid){
|
|
//alert(Rowid);
|
|
|
|
var InvoiceQty = parseFloat( $('#QuantityAsPerInvoice'+Rowid).val() == '' ? '0.00' : $('#QuantityAsPerInvoice'+Rowid).val());
|
|
|
|
var PendingQty = parseFloat( $('#PendingQuantity'+Rowid).text() == '' ? '0.00' : $('#PendingQuantity'+Rowid).text());
|
|
|
|
var RecQty = parseFloat( $('#txtReceivedQuantity'+Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity'+Rowid).val());
|
|
|
|
var OrderedQty =parseFloat($("#Quantity_1"+Rowid).text());
|
|
|
|
var r =$("#Remark"+Rowid).val();
|
|
// 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){
|
|
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 true;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function isNumberKey(evt)
|
|
{
|
|
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
|
if (charCode != 46 && charCode > 31
|
|
&& (charCode < 48 || charCode > 57))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
function Save(status)
|
|
{
|
|
// alert("save function worked "+status);
|
|
//alert("save function worked ");
|
|
// var file = $('#images'+counterConstants).val()
|
|
|
|
if (validate())
|
|
{
|
|
var file = $('#images'+counterConstants).val()
|
|
// alert($('#Inwardgateregistertable').rows.count);
|
|
//alert(" if condition validation part ");
|
|
// $('#content').loader('show');
|
|
// $.ajax({
|
|
// data:$('.IGR').serialize(),
|
|
// type:"POST",
|
|
// url:"<?php echo base_url() ?>SaveIGR",
|
|
|
|
// success:function(data) {
|
|
|
|
// if(data){
|
|
|
|
// $('#content').loader('hide');
|
|
|
|
// document.getElementById('finaligr').innerHTML=data;
|
|
// $('#generateIGR').modal('show');
|
|
// }
|
|
// else
|
|
// {
|
|
// alert("Error");
|
|
// }
|
|
|
|
//var file = $('#images'+counterConstants).val();
|
|
// }//success function closed
|
|
// });//ajax closed
|
|
//var tablevalue = $('#specialtable').tableToJSON(); // Convert the table into a javascript object
|
|
//var jsondata = JSON.stringify(tablevalue);
|
|
//$('#tablevalues').val(jsondata);
|
|
// $("#IGR").attr("method", "post");
|
|
// $("#IGR").attr("enctype", "multipart/form-data");
|
|
// $("#IGR").attr("action", "SaveIGR");
|
|
// $('#IGR').submit();
|
|
}//validate if closed
|
|
}//save function closed
|
|
|
|
|
|
|
|
</script>
|
|
<script>
|
|
|
|
|
|
|
|
|
|
var counters = 0;
|
|
var counterConstants = 0;
|
|
|
|
$("#addemorebutton").click(function(){
|
|
|
|
//alert('sda');
|
|
|
|
if(counters>4){
|
|
alert("No more files to add");//this allows only 5 files;
|
|
return false;
|
|
}
|
|
else{
|
|
|
|
counters++;
|
|
counterConstants++;
|
|
|
|
var div = document.createElement('div');
|
|
div.id = "divid"+counters;
|
|
div.className="row";
|
|
div.innerHTML='<div class="col-md-12">'+
|
|
|
|
'<div class="col-md-3">'+
|
|
'<label><br></label>'+
|
|
'<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
|
|
'</div>'+
|
|
|
|
'<div class="col-md-1">'+
|
|
'<label><br><br></label>'+
|
|
'<button class="btn btn-success" type ="button" onclick="addRow('+counters+')"id="addbtn1" ><i class="fa fa-plus-square"></i></button></div>'+
|
|
|
|
'<div class="col-md-1">'+
|
|
'<label><br><br></label>'+
|
|
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i> </button></div>'+
|
|
|
|
|
|
'</div>';
|
|
$('#newsdiv').append(div);
|
|
|
|
|
|
|
|
$('#hidecounters').val(counters);
|
|
$('#hideconstants').val(counterConstants);
|
|
|
|
if(counters > 1){
|
|
alert("Add button click here");//this allows only 5 files;
|
|
return false;
|
|
}
|
|
else {
|
|
|
|
$('#addemorebutton').hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
// document.write("browseFiles"+length);
|
|
}
|
|
});
|
|
|
|
function addRow(inputs)
|
|
{ if(inputs <5){
|
|
if(inputs ==0){
|
|
inputs = inputs+1;
|
|
$("#addbtn"+inputs).hide();
|
|
$("#removebtn"+inputs).hide();
|
|
}else{
|
|
$("#addbtn"+inputs).hide();
|
|
$("#removebtn"+inputs).hide();
|
|
}
|
|
}else{
|
|
$("#addbtn"+inputs).show();
|
|
$("#removebtn"+inputs).show();
|
|
}
|
|
// alert(s);
|
|
if(counters>4){
|
|
alert("No more files to add");//this allows only 5 files;
|
|
return false;
|
|
}
|
|
else{
|
|
counters++;
|
|
counterConstants++;
|
|
//alert("count"+counterConstants);
|
|
var div = document.createElement('div');
|
|
div.id = "divid"+counters;
|
|
div.className="row";
|
|
div.innerHTML='<div class="col-md-12">'+
|
|
|
|
'<div class="col-md-3">'+
|
|
'<label><br></label>'+
|
|
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilenames(this.name); "><br>'+
|
|
'</div>'+
|
|
'<div class="col-md-1">'+
|
|
'<label><br><br></label>'+
|
|
'<button class="btn btn-success" type ="button" id="addbtn'+counters+'" onclick="addRow('+counters+')"><i class="fa fa-plus-square"></i></button></div>'+
|
|
|
|
'<div class="col-md-1">'+
|
|
'<label><br><br></label>'+
|
|
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
|
|
'</div>'+
|
|
|
|
|
|
|
|
'</div>';
|
|
$('#newsdiv').append(div);
|
|
|
|
|
|
$('#hidecounters').val(counters);
|
|
$('#hideconstants').val(counterConstants);
|
|
|
|
|
|
if(counters > 1){
|
|
//alert("Next File choose + button click here");//this allows only 5 files;
|
|
//return false;
|
|
$('#addbtn').hide();
|
|
$("#removebtn").hide();
|
|
}
|
|
else {
|
|
|
|
$('#addemorebutton').hide();
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function filecheck(status)
|
|
{
|
|
$('#hideIGRStatus').val(status);
|
|
$('#hidecounters').val(1);
|
|
$('#hideconstants').val(1);
|
|
|
|
//alert(counterConstants);
|
|
var file1 = $('#images').val();
|
|
|
|
//alert(myfile);
|
|
|
|
if(file1=='')
|
|
{
|
|
alert('File not Found');
|
|
//Save();
|
|
}
|
|
else
|
|
{
|
|
Save(status);
|
|
}
|
|
// var sizef = document.getElementById('myfile').files[0].size;
|
|
// var myfile = $('#myfile').val();
|
|
// if(myfile!='' && sizef < 2100000)
|
|
// {
|
|
// alert('Your file added successfully');
|
|
// Save();
|
|
// }
|
|
// else
|
|
// {
|
|
// alert('Sorry Your File is Large To 2MB');
|
|
// $('#myfile').val('');
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
function Copyfilenames(id)
|
|
{
|
|
|
|
var size = $('input[name='+id+']')[0].files[0].size;
|
|
|
|
var number = id.replace(/[^0-9]+/ig,"");
|
|
|
|
if(size > 2100000){
|
|
//alert(id);
|
|
alert('Sorry Your File is Large To 2MB');
|
|
removeRows(id);
|
|
//$('input[name = browseFiles'+number+']').val(' ');
|
|
}else {
|
|
var name = $('input[name='+id+']')[0].files[0].name;
|
|
//alert(name);
|
|
//$("#maint_filename"+number).val(name);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function removeRows(inputs) {
|
|
// alert(input);
|
|
var number = inputs.replace(/[^0-9]+/ig,"");
|
|
//alert(number);
|
|
if(counters >= 1){
|
|
counters --;
|
|
|
|
$("#divid"+number).remove();
|
|
$('#hidecounters').val(counters);
|
|
}
|
|
|
|
var rm_count = $("#hideconstants").val();
|
|
if(counters !=0){
|
|
if(number != rm_count){
|
|
// alert("if");
|
|
$("#addbtn"+counters).show();
|
|
$("#removebtn"+counters).show();
|
|
}else{
|
|
//alert('else');
|
|
$("#addbtn"+counters).show();
|
|
$("#removebtn"+counters).show();
|
|
|
|
}
|
|
}else{
|
|
$("#addemorebutton").show();
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
function validateTareWeight(element) {
|
|
var grossWeight = parseFloat(document.getElementById('GrossWeight').value);
|
|
var tareWeight = parseFloat(document.getElementById('TareWeight').value);
|
|
|
|
if (tareWeight > grossWeight) {
|
|
alert("Tare Weight must be less than or equal to Gross Weight.");
|
|
document.getElementById('TareWeight').value = '';
|
|
document.getElementById('TareWeightDate').value = '';
|
|
return false;
|
|
}
|
|
WeightDiffer(element)
|
|
return true;
|
|
}
|
|
function updateTime() {
|
|
const now = new Date();
|
|
const year = now.getFullYear();
|
|
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
|
const todaydate = now.getDate().toString().padStart(2, '0');
|
|
const hours = now.getHours().toString().padStart(2, '0');
|
|
const minutes = now.getMinutes().toString().padStart(2, '0');
|
|
const seconds = now.getSeconds().toString().padStart(2, '0');
|
|
const dateString = todaydate+'-'+month+'-'+year;
|
|
const timeString = hours+":"+minutes+":"+seconds;
|
|
document.getElementById('clock').textContent = dateString+" "+timeString;
|
|
document.getElementById('wizard_clock').textContent = dateString+" "+timeString;
|
|
}
|
|
setInterval(updateTime, 1000); // Update every second
|
|
updateTime(); // Initial call to display time immediately
|
|
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('WeightTitle').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: "+v6+" undefined");
|
|
}
|
|
}
|
|
|
|
</script>
|