634 lines
23 KiB
PHP
634 lines
23 KiB
PHP
<style>
|
|
.modal {
|
|
padding-right: 25% ! important;
|
|
}
|
|
|
|
.num {
|
|
text-align: right;
|
|
}
|
|
|
|
.modal-content {
|
|
width: 800px ! important;
|
|
}
|
|
|
|
.modal-footer {
|
|
border-top-color: #fff ! important;
|
|
}
|
|
</style>
|
|
<script>
|
|
$(function() {
|
|
var d = new Date();
|
|
|
|
var month = d.getMonth();
|
|
var day = d.getDate();
|
|
var year = d.getFullYear();
|
|
var SIAStartYear = year - 2015;
|
|
var mindt = year - 70;
|
|
var maxdt = year - 15;
|
|
|
|
$("#Invoice_Date , #MaterialRcvdDate ").datepicker({
|
|
minDate: new Date(year - SIAStartYear, 1, 1),
|
|
maxDate: 'now',
|
|
dateFormat: 'dd-mm-yy',
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
});
|
|
});
|
|
</script>
|
|
<div class="content-wrapper">
|
|
|
|
<section class="content"><br />
|
|
<div class="box">
|
|
<div class=" container-fluid">
|
|
<div class="box-header">
|
|
<center><b>
|
|
<h3 class="box-title">View Inward Gate Register</h3>
|
|
</b></center>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
|
|
<table id="Inwardgateregistertable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color: #ddd;">
|
|
<tr>
|
|
<!-- <th>S.No</th> -->
|
|
<th>IGR No</th>
|
|
<th>PO No</th>
|
|
<th>Supplier Name</th>
|
|
<th>Invoice No</th>
|
|
<th>Date of Invoice</th>
|
|
<th>Vechicle No</th>
|
|
<th>Courier No</th>
|
|
<th>Action</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
if (!empty($IGR)) {
|
|
$index = 0;
|
|
foreach ($IGR as $record) {
|
|
|
|
$index = $index + 1;
|
|
?>
|
|
<tr id="<?php echo $index ?>">
|
|
<!-- <td style="text-align: center;"><?php echo $index ?></td> -->
|
|
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<%=index%>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>" title="View Generated IGR details/edit Draft IGR details"> <u><?php echo $record->IGRNO ?></u></a></td>
|
|
<td><?php echo $record->PONO ?></a></td>
|
|
<td><?php echo $record->SupplierName ?></td>
|
|
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
|
|
<td align="right"><?php
|
|
$date = new DateTime($record->DeliveryChellanDate);
|
|
echo $date->format('d-m-Y'); ?></td>
|
|
<td><?php echo $record->VehicleNo ?></td>
|
|
<td><?php echo $record->CreatedDate ?></td>
|
|
<td>
|
|
<a target="_blank" data-toggle="modal" data-target="#Historyshow" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>"><button class="btn btn-success btn-sm">History <i class="fa fa-history"></i></button></a>
|
|
<a href="<?php echo base_url() . 'MRIRcontroller/igrdatavalues?IGRNO=' . $record->IGRNO; ?>"><button style="font-size:12px" id="generated" name="generated">Generate MRIR <i class="fa fa-file-text"></i></button></a>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
//$SNo++;
|
|
}
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</div> <!-- col-md-12 -->
|
|
</div><!-- class row -->
|
|
</div> <!-- class container-fluid -->
|
|
</div><!-- class box -->
|
|
|
|
<div class="modal fade" id="Igrshow" role="dialog">
|
|
<div class="modal-dialog">
|
|
<!-- Modal content-->
|
|
<form>
|
|
<div class="modal-content" style="width:800px;">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center>
|
|
<h4>Inward Gate Register Details</h4>
|
|
</center> <!-- IGR number should display here-->
|
|
<div class="pull-right hidden-xs">
|
|
<b>
|
|
<div id="clock"></div>
|
|
</b>
|
|
</div>
|
|
</div>
|
|
|
|
<!--<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<label>IGR Number :</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" id="IGRNO1" readonly>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label> Purchase Order Number:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" id="PONo" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<label>Delivery Challan/Invoice NO :</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" id="Invoice_No" readonly>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label>Delivery Challan / Invoice Date:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" id="Invoice_Date" readonly>
|
|
</div>
|
|
</div>
|
|
<br/>
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<label>Supplier Name :</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" id="Supplier" readonly>
|
|
|
|
|
|
</div>
|
|
|
|
</div>-->
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-4">
|
|
<label>IGR Number </label>
|
|
<?php
|
|
$data = array('name' => 'IGRNumber', 'value' => set_value('IGRNumber'), 'id' => 'IGRNO1', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
|
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<label>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>
|
|
<?php
|
|
$data = array('name' => 'PurchaseOrderNumber', 'value' => set_value('PurchaseOrderNumber'), 'id' => 'PONo', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
|
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Supplier Name </label>
|
|
<?php
|
|
$data = array('name' => 'SupplierName', 'value' => set_value('SupplierName'), 'id' => 'Supplier', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
|
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12" style="padding-bottom: 10px;">
|
|
<div class="col-md-4">
|
|
<label>Invoice Number </label>
|
|
<?php
|
|
$data = array('name' => 'InvoiceNO', 'value' => set_value('InvoiceNO'), 'id' => 'Invoice_No', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
|
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Invoice Date </label>
|
|
<?php
|
|
$data = array('name' => 'InvoiceDate', 'value' => set_value('InvoiceDate'), 'id' => 'Invoice_Date', 'class' => 'form-control', 'required=>"true"');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Material Received Date </label>
|
|
<?php
|
|
$data = array('name' => 'MaterialRcvdDate', 'value' => set_value('MaterialRcvdDate'), 'id' => 'MaterialRcvdDate', 'class' => 'form-control');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12" style="padding-bottom: 10px;">
|
|
<div class="col-md-4">
|
|
<label>Vehicle Number</label>
|
|
<?php
|
|
$data = array('name' => 'VehicleNo', 'value' => set_value('VehicleNo'), 'id' => 'Vehicle_No', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Driver Name </label>
|
|
<?php
|
|
$data = array('name' => 'DriverName', 'value' => set_value('DriverName'), 'id' => 'Driver_Name', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true');
|
|
|
|
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', 'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Table to show the line item of po -->
|
|
<div id="content"> </div>
|
|
<table id="Inwardgateregistertable1" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color: #ddd !important;">
|
|
<tr>
|
|
<th>SNo</th>
|
|
<th>Item Code</th>
|
|
<th>Item Description</th>
|
|
<th>UOM</th>
|
|
<th>Ordred Quantity</th>
|
|
<th>Received Quantity</th>
|
|
<th id="pendingQuantityHeader" style="display:none;">Balance Quantity</th>
|
|
<th>Remarks</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="tbleAppend1"></tbody>
|
|
</table>
|
|
<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>
|
|
|
|
<div class="modal-footer">
|
|
<!-- <a class="btn btn-success" id="update" value="Update">Update</a>
|
|
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a> -->
|
|
<a class="btn btn-success" id="draftIGR" onclick="setStatusAndSubmit('draft')">Draft IGR</a>
|
|
<a class="btn btn-success" id="generateIGR" onclick="setStatusAndSubmit('generate')">Generate IGR</a>
|
|
<a class="btn btn-success" data-dismiss="modal" value="Close">Close IGR</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div><!-- modal-dialog -->
|
|
</div> <!-- modal -->
|
|
</section><!-- content-->
|
|
</div><!-- content-wrapper -->
|
|
|
|
<script>
|
|
|
|
$(function(){
|
|
$.fn.dataTable.moment('DD-MM-YYYY');
|
|
$('#Inwardgateregistertable').DataTable({
|
|
"paging":true,
|
|
"lengthChange":true,
|
|
"searching":true,
|
|
"ordering":true,
|
|
//"columnDefs":[{ "targets": 5,"type": "date-eu"}],
|
|
"aaSorting":[[4,"desc"]],
|
|
"info":true,
|
|
"autoWidth":true
|
|
});
|
|
});
|
|
</script><!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
|
|
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
|
|
<script>
|
|
$("#Igrshow").on("shown.bs.modal", function(e) {
|
|
var igr = $(e.relatedTarget).data('userid');
|
|
var igrstatus = $(e.relatedTarget).data('igrstatus');
|
|
// alert(igrstatus);
|
|
var buttonContainer = $("#buttonContainer");
|
|
var modal = $(this); // Reference to the modal itself
|
|
var invoiceDateInput = modal.find('#Invoice_Date');
|
|
var MaterialRcvdDateInput = modal.find('#MaterialRcvdDate');
|
|
var VehicleNoInput = modal.find('#Vehicle_No');
|
|
var DriverInput = modal.find('#Driver_Name');
|
|
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
|
var GrossWeightInput = modal.find('#GrossWeight');
|
|
var TareWeightInput = modal.find('#TareWeight');
|
|
|
|
|
|
if (igrstatus == "ST074") {
|
|
// Show buttons in the container
|
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
|
// Changed into Readonly = false
|
|
invoiceDateInput.prop('readonly', false);
|
|
MaterialRcvdDateInput.prop('readonly', false);
|
|
VehicleNoInput.prop('readonly', false);
|
|
DriverInput.prop('readonly', false);
|
|
DriverMobileNumberInput.prop('readonly', false);
|
|
GrossWeightInput.prop('readonly', false);
|
|
TareWeightInput.prop('readonly', false);
|
|
} else {
|
|
// Hide buttons in the container
|
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
|
|
// Changed into Readonly = true
|
|
invoiceDateInput.prop('readonly', true);
|
|
MaterialRcvdDateInput.prop('readonly', true);
|
|
VehicleNoInput.prop('readonly', true);
|
|
DriverInput.prop('readonly', true);
|
|
DriverMobileNumberInput.prop('readonly', true);
|
|
GrossWeightInput.prop('readonly', true);
|
|
TareWeightInput.prop('readonly', true);
|
|
}
|
|
|
|
$("#tbleAppend1").empty();
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data: {
|
|
id: igr
|
|
},
|
|
type: "POST",
|
|
//dataType: 'json',
|
|
url: "<?php echo base_url() ?>inwardgateregister/ViewIGR",
|
|
success: function(data) {
|
|
console.log(data);
|
|
console.log('d');
|
|
$('#content').loader('hide');
|
|
var trHTML = '';
|
|
$.each(JSON.parse(data), function(i, item) {
|
|
if (igr == item.IGRNO) {
|
|
|
|
$("#IGRNO1").val(item.IGRNO);
|
|
$("#IGRItemNo").val(item.IGRItemNo);
|
|
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
|
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
|
$('#printLink').attr('href', newUrl);
|
|
$("#Vehicle_No").val(item.VehicleNo);
|
|
$("#Driver_Name").val(item.DriverName);
|
|
$("#DriverMobileNumber").val(item.DriverMobileNumber);
|
|
$("#IGRStatus").val(item.IGRStatus);
|
|
$("#PONo").val(item.PONO);
|
|
$("#Supplier").val(item.SupplierName);
|
|
$("#Add1").val(item.Address);
|
|
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
|
//alert(item.DeliveryChellanDate);
|
|
var dcd = new Date(item.DeliveryChellanDate);
|
|
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
|
var dcd2 = (dcd.getDate() + '/' + (dcd.getMonth() + 1) + '/' + dcd.getFullYear());
|
|
$("#Invoice_Date").val(dcd2);
|
|
if (item.MaterialRcvdDate === null) {
|
|
var Mat_rcv_date = ' ';
|
|
} else {
|
|
var MR_dt = new Date(item.MaterialRcvdDate);
|
|
var Mat_rcv_date = (MR_dt.getDate() + '/' + (MR_dt.getMonth() + 1) + '/' + MR_dt.getFullYear());
|
|
}
|
|
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
|
if (item.GrossWeightDate === null) {
|
|
var gross_rcv_date = ' ';
|
|
} else {
|
|
var G_dt = new Date(item.GrossWeightDate);
|
|
var gross_rcv_date = formatDateTime(G_dt);
|
|
}
|
|
$("#GrossWeight").val(parseFloat(item.GrossWeight));
|
|
$("#GrossWeightDate").val(gross_rcv_date);
|
|
if (item.TareWeightDate === null) {
|
|
var tare_rcv_date = ' ';
|
|
} else {
|
|
var T_dt = new Date(item.TareWeightDate);
|
|
var tare_rcv_date = formatDateTime(T_dt);
|
|
}
|
|
$("#TareWeight").val(parseFloat(item.TareWeight));
|
|
$("#TareWeightDate").val(tare_rcv_date);
|
|
$("#NetWeight").val(parseFloat(item.NetWeight));
|
|
$("#ser").val(item.ServiceDescription);
|
|
i = i + 1;
|
|
if (igrstatus == "ST074") {
|
|
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
|
$("#pendingQuantityHeader").css("display", "table-cell");
|
|
|
|
trHTML += '<tr>' +
|
|
'<td align="right">' + i + '</td>' +
|
|
'<td name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
|
'<td>' + item.MaterialName + '</td>' +
|
|
'<td name="UOM">' + item.UOM + '</td>' +
|
|
'<td align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
|
|
'<td align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);"></td>' +
|
|
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
|
|
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')"> </td>' +
|
|
|
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
|
'<input type="hidden" id="IGRItemNo' + i + '" name="IGRItemNo' + i + '" value="' + item.IGRItemNo + '">' +
|
|
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
|
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
|
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
|
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '">'; // Example with no initial value
|
|
'</tr>';
|
|
|
|
//alert(item.PendingQty);
|
|
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
|
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
|
}
|
|
} else {
|
|
$("#pendingQuantityHeader").css("display", "none");
|
|
|
|
trHTML += '<tr>' +
|
|
'<td align="right">' + i + '</td>' +
|
|
'<td name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
|
'<td>' + item.MaterialName + '</td>' +
|
|
'<td name="UOM">' + item.UOM + '</td>' +
|
|
'<td align="right" name="Quantity">' + item.Quantity + '</td>' +
|
|
'<td align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
|
|
'<td>' + item.Remarks + '</td>' +
|
|
'</tr>';
|
|
}
|
|
|
|
//alert(item.QuantityAsPerInvoice);
|
|
}
|
|
|
|
|
|
});
|
|
$("#tbleAppend1").empty();
|
|
$('#Inwardgateregistertable1 > tbody').append(trHTML);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
|
|
$('#update').click(function() {
|
|
alert('updated function entered');
|
|
$('#content').loader('show');
|
|
var igrno = $("#IGRNO1").val();
|
|
var materialrcv_date = $("#MaterialRcvdDate").val();
|
|
var inv_date = $("#Invoice_Date").val();
|
|
|
|
$.ajax({
|
|
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>inwardgateregister/UpdateIGR",
|
|
success:function(data) {
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
function setStatusAndSubmit(status) {
|
|
var statuscode = (status == "draft") ? 'ST074' : 'ST027';
|
|
alert('updated function entered');
|
|
$('#content').loader('show');
|
|
var igrno = $("#IGRNO1").val();
|
|
var VehicleNo = $("#Vehicle_No").val();
|
|
var DriverName = $("#Driver_Name").val();
|
|
var DriverMobileNumber = $("#DriverMobileNumber").val();
|
|
var GrossWeight = $("#GrossWeight").val()
|
|
var TareWeight = $("#TareWeight").val()
|
|
var NetWeight = $("#NetWeight").val()
|
|
var GrossWeightDate = $("#GrossWeightDate").val()
|
|
var TareWeightDate = $("#TareWeightDate").val()
|
|
|
|
var dataToSend = [];
|
|
|
|
$('#tbleAppend1 tr').each(function(index, row) {
|
|
var rowData = {};
|
|
|
|
$(row).find('input[type="hidden"]').each(function() {
|
|
var fieldName = $(this).attr('name');
|
|
var fieldValue = $(this).val();
|
|
rowData[fieldName] = fieldValue;
|
|
});
|
|
|
|
dataToSend.push(rowData);
|
|
});
|
|
console.log(dataToSend);
|
|
$.ajax({
|
|
url: "<?php echo base_url() ?>inwardgateregister/updateIGRLineItem",
|
|
type: "POST",
|
|
dataType: 'json',
|
|
data: {
|
|
IGRNO: igrno,
|
|
IGRStatus: statuscode,
|
|
VehicleNo: VehicleNo,
|
|
DriverName: DriverName,
|
|
DriverMobileNumber: DriverMobileNumber,
|
|
GrossWeight: GrossWeight,
|
|
TareWeight: TareWeight,
|
|
NetWeight: NetWeight,
|
|
GrossWeightDate: GrossWeightDate,
|
|
TareWeightDate: TareWeightDate,
|
|
data: JSON.stringify(dataToSend)
|
|
},
|
|
success: function(response) {
|
|
$('#content').loader('hide');
|
|
console.log('Data saved successfully:', response);
|
|
alert(response.message);
|
|
// Close the modal
|
|
$('#Igrshow').modal('hide');
|
|
// location.reload();
|
|
setTimeout(function() {
|
|
location.reload();
|
|
}, 500);
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
$('#content').loader('hide');
|
|
console.error('Error saving data:', textStatus, errorThrown);
|
|
alert(response.message);
|
|
$('#Igrshow').modal('hide');
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<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());
|
|
}
|
|
}
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
setInterval(updateTime, 1000); // Update every second
|
|
updateTime(); // Initial call to display time immediately
|
|
</script>
|
|
<script>
|
|
function formatDateTime(dateString) {
|
|
// Check if the date string is null
|
|
if (dateString === null) {
|
|
return ' ';
|
|
} else {
|
|
// Create a new Date object from the date string
|
|
var date = new Date(dateString);
|
|
|
|
// Extract date components
|
|
var day = date.getDate().toString().padStart(2, '0');
|
|
var month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based
|
|
var year = date.getFullYear();
|
|
|
|
// Extract time components
|
|
var hours = date.getHours().toString().padStart(2, '0');
|
|
var minutes = date.getMinutes().toString().padStart(2, '0');
|
|
var seconds = date.getSeconds().toString().padStart(2, '0');
|
|
|
|
// Format the date and time in DD-MM-YYYY HH:MM:SS format
|
|
var formattedDate = `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
|
|
|
|
return formattedDate;
|
|
}
|
|
}
|
|
</script>
|