1507 lines
56 KiB
PHP
1507 lines
56 KiB
PHP
<style>
|
|
.modal
|
|
{
|
|
padding-right:25% ! important;
|
|
}
|
|
.num{
|
|
text-align:right;
|
|
}
|
|
.modal-content
|
|
{
|
|
width: 800px ! important;
|
|
}
|
|
th {
|
|
white-space: nowrap;
|
|
}
|
|
</style>
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
|
|
<!-- Latest DataTables Buttons CSS -->
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.3.4/css/buttons.dataTables.min.css">
|
|
<style>
|
|
.dataTables_wrapper .dataTables_length select {
|
|
background-color:white !important;
|
|
}
|
|
.dataTables_wrapper .dataTables_filter input {
|
|
background-color: white !important;
|
|
}
|
|
button.dt-button, div.dt-button, a.dt-button, input.dt-button {
|
|
background-color: white !important;
|
|
}
|
|
.dataTables_length, label{
|
|
display: flex !important;
|
|
}
|
|
.dataTables_wrapper .dataTables_filter {
|
|
text-align: center;
|
|
}
|
|
.dataTables_wrapper .dataTables_length {
|
|
float: left;
|
|
}
|
|
.dataTables_wrapper .dt-buttons {
|
|
float: right;
|
|
}
|
|
.dataTables_wrapper .clear {
|
|
clear: both;
|
|
}
|
|
th, td {
|
|
white-space: nowrap;
|
|
}
|
|
.dataTables_wrapper {
|
|
width: 100%;
|
|
overflow-x: auto;
|
|
}
|
|
</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,yearRange: '-100:+0'
|
|
});
|
|
});
|
|
</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 style="display:none;"></th>
|
|
<th>Created Date</th>
|
|
<th>IGR No</th>
|
|
<th>PO No</th>
|
|
<th>Supplier Name</th>
|
|
<th>Invoice No</th>
|
|
<th>Invoice Date </th>
|
|
<th>Vechicle No</th>
|
|
<th>IGR Status</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if(!empty($IGR))
|
|
{ $index = 0;
|
|
foreach($IGR as $record)
|
|
{ $index = $index +1;
|
|
?>
|
|
<tr id="<?php echo $index ?>" >
|
|
<th style="display:none;"><?php echo $record->CreatedDate ?></th>
|
|
<td align="right"><?php
|
|
$createddate = new DateTime($record->CreatedDate);
|
|
echo $createddate->format('d-m-Y h:i A'); ?></td>
|
|
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <u><?php echo $record->IGRNO ?></u></a></td>
|
|
<td><a target="_blank" data-toggle="modal" data-target="#CostCentershow" data-id="<%=index%>" title="Cost Center" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><u><?php echo $record->PONO ?></u></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->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
|
|
<td><?php if (!empty($record->FilePath)) { ?>
|
|
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Files" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-clone" style="text-align: center;"></i></a>
|
|
<?php } else if (!empty($record->file)) { ?>
|
|
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Files" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-clone" style="text-align: center;"></i></a>
|
|
<?php } else { ?>
|
|
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Files" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-clone" style="text-align: center;"></i></a>
|
|
<?php } ?>
|
|
|
|
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
|
|
<i class="fa fa-history" style="text-align: center;"></i>
|
|
</a>
|
|
|
|
|
|
|
|
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- box closed here -->
|
|
<!-- Igr modal fade -->
|
|
<div class="modal fade" id="Igrshow" role="dialog">
|
|
<div class="modal-dialog">
|
|
<!-- Modal content-->
|
|
<form>
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center><h4>Inward Gate Register Details <span id="IgrshowTitle"></span></h4></center> <!-- IGR number should display here-->
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-6">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<label>Purchase Order Number </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);
|
|
?>
|
|
<span class="help-block"></span>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<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>
|
|
<input type="hidden" id="IGRNO1" name="IGRNumber" readonly>
|
|
</div>
|
|
<div class="col-md-12" style="margin: 10px 0;">
|
|
<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 <span class="requiredsymbol" style="color:red; font-size: 15px;">*</span></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 <span class="requiredsymbol" style="color:red; font-size: 15px;">*</span> </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="margin: 10px 0;">
|
|
<div class="col-md-4">
|
|
<label>Vehicle Number </label>
|
|
<?php $data = array('name' => 'VehicleNo','value' => set_value('VehicleNo'),'id'=>'Vehicle_No', 'class' => 'form-control');
|
|
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');
|
|
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');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Table to show the line item of po -->
|
|
<div id="content" > </div>
|
|
<table class="table table-bordered" id="Inwardgateregistertable1 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 Qty</th>
|
|
<th>Received Qty</th>
|
|
<th id="pendingQuantityHeader" style="display:none;">Pending Qty</th>
|
|
<th>Remarks</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="tbleIGRAppend">
|
|
<!-- <tr>
|
|
<td>1</td>
|
|
<td>RM002</td>
|
|
<td>Raw sand</td>
|
|
<td>Kgs</td>
|
|
<td>10000</td>
|
|
<td>10000</td>
|
|
<td>Received</td>
|
|
</tr> -->
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="modal-footer">
|
|
<!-- <a class="btn btn-primary" id="update" value="Update">Update</a> -->
|
|
<div class="col-md-4 col-md-offset-8">
|
|
<input type="file" name="MasterFile" id="MasterFile" onchange="Copyfilenames(this.name); ">
|
|
<label id="MasterFileLabel" style="display:none;">
|
|
<a><span></span><small></small></a>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="buttonContainer">
|
|
<a class="btn btn-cancel" data-dismiss="modal" value="Close">Close</a>
|
|
<a class="btn btn-primary" id="draftIGR" value="draftIGR">Draft IGR</a>
|
|
<a class="btn btn-primary" id="generateIGR" value="generateIGR">Generate IGR</a>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- Igr modal fade closed-->
|
|
<!-- WeightCalculator modal fade -->
|
|
<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 <span id="WeightTitle"></span></h4>
|
|
</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' => '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 class="col-md-5">
|
|
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); ">
|
|
|
|
<label id="WeightFileLabel" style="display:none;">
|
|
<a><span></span><small></small></a>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- </div> -->
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<center>
|
|
<a class="btn btn-primary" onclick="modalSave()" id="modalsave"> <span class="bold">Save</span>
|
|
<a class="btn btn-cancel" data-dismiss="modal" value="Close">Close</a>
|
|
</center>
|
|
</div><!-- footer div closed -->
|
|
</div><!-- modal content div closed-->
|
|
</div><!-- modal content closed-->
|
|
</div>
|
|
<!-- WeightCalculator modal fade closed-->
|
|
<!-- History modal fade -->
|
|
<div class="modal fade" id="Historyshow" role="dialog">
|
|
<div class="modal-dialog">
|
|
<!-- Modal content -->
|
|
<div class="modal-content" style="width:800px;">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center>
|
|
<h4>IGR History Details <span id="HisTitle"></span></h4>
|
|
</center>
|
|
</div>
|
|
<div style="margin:20px;" id="HisStatement"></div>
|
|
<div style="text-align: right; margin:5px;">
|
|
<a class="btn btn-cancel" data-dismiss="modal" value="Close">Close</a>
|
|
</div>
|
|
<br />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- History modal fade closed-->
|
|
<!-- CostCenter modal fade -->
|
|
<div class="modal fade" id="CostCentershow" role="dialog">
|
|
<div class="modal-dialog">
|
|
<!-- Modal content-->
|
|
<div class="modal-content" style="width:800px;">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center>
|
|
<h4>Cost Center List <span id="CCTitle"></span></h4>
|
|
</center> <!-- IGR number should display here-->
|
|
</div>
|
|
|
|
<div style="margin:20px;" id="CCStatement"></div>
|
|
<div style="text-align: right; margin:5px;">
|
|
<a class="btn btn-cancel" data-dismiss="modal" value="Close">Close</a>
|
|
</div>
|
|
<br />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- CostCenter modal fade closed-->
|
|
<!-- File modal -->
|
|
<div class="modal fade" id="Fileshow" role="dialog">
|
|
<div class="modal-dialog">
|
|
<!-- Modal content-->
|
|
<form id="igrfileform">
|
|
<div class="modal-content" style="width:800px;">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
<center>
|
|
<h4>Inward Gate File Details</h4>
|
|
</center> <!-- IGR number should display here-->
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div style="text-align: right; margin:10px;">
|
|
<input type="button" class="btn btn-primary" id="addmorebutton" value=" ADD FILES..">
|
|
</div>
|
|
<div id="newdiv"></div>
|
|
<input type="hidden" name="hidecounter" id="hidecounter" value="0" />
|
|
<input type="hidden" name="hidegrandcounter" id="hidegrandcounter" value="0" />
|
|
<input type="hidden" name="hiddenIGRNO" id="hiddenIGRNO" />
|
|
<input type="hidden" name="hiddenPONO" id="hiddenPONO" />
|
|
</div>
|
|
<div id="contents"> </div>
|
|
<table class="table table-bordered" id="Inwardgateregisterfile" style="background-color:#fff;font-size:12px;">
|
|
<thead style="background-color:#ddd;">
|
|
<tr>
|
|
<th>SNo</th>
|
|
<th>BillNO</th>
|
|
<th>PONO</th>
|
|
<th>FileName</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="tblefile">
|
|
</tbody>
|
|
</table>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-cancel" data-dismiss="modal" value="close">Close</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- File modal fade closed -->
|
|
<!-- Bill modal fade -->
|
|
<div class="modal fade" id="billModel" role="dialog" data-backdrop-limit="1" aria-labelledby="myModalLabel">
|
|
<div class="modal-dialog">
|
|
|
|
|
|
<div class="modal-content" style="width:950px;">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">Update Bill Details</h4>
|
|
</div>
|
|
<form class="tagForm" id="tag-form" method="post" enctype="multipart/form-data">
|
|
<div class="modal-body" style="padding:0px;">
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-5">
|
|
|
|
<!-- onChange="filecheck();" -->
|
|
<input type="file" size="20" input accept=".docx,.pdf,.doc.JPG,.PNG,.jpg" id="billimag" name="images" />
|
|
<label for="images">Select file <br /><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" name="hideoldfile" id="hideoldfile" class="form-control" readonly>
|
|
<input type="hidden" name="hidebillno" id="hidebillno" class="form-control" readonly>
|
|
|
|
</div><!-- /.modal body -->
|
|
|
|
<div class="modal-footer">
|
|
<div class="col-md-12 text-right">
|
|
<div class="col-md-4 col-md-offset-8">
|
|
<a class="btn btn-success" onclick="fileupdate()"> <span class="bold">Update</span>
|
|
<a class="btn btn-success" data-dismiss="modal" value="Close">Close</a>
|
|
</div>
|
|
</div>
|
|
</div><!-- /.modal footer -->
|
|
</form>
|
|
</div><!-- /.modal content -->
|
|
</div><!-- /.modal dialog -->
|
|
</div>
|
|
<!-- Bill modal fade closed-->
|
|
|
|
</section>
|
|
</div>
|
|
<script>
|
|
$("#Igrshow").on("shown.bs.modal", function(e) {
|
|
var inx = $(e.relatedTarget).data('id');
|
|
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 MasterFileInput = modal.find('#MasterFile');
|
|
modal.find('#MasterFileLabel').hide();
|
|
|
|
var depCode = "<?php echo $DEPCode; ?>";
|
|
|
|
// depCode != "DEP27"
|
|
if(depCode == "DEP27"){
|
|
if (igrstatus == "ST074") {
|
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
|
$(".a_tag_for_mrir").css("display", "block");
|
|
VehicleNoInput.prop('readonly', false);
|
|
DriverInput.prop('readonly', false);
|
|
DriverMobileNumberInput.prop('readonly', false);
|
|
MaterialRcvdDateInput.prop('readonly', false);
|
|
invoiceDateInput.prop('readonly', false);
|
|
} else {
|
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
|
|
$(".a_tag_for_mrir").css("display", "none");
|
|
VehicleNoInput.prop('readonly', true);
|
|
DriverInput.prop('readonly', true);
|
|
DriverMobileNumberInput.prop('readonly', true);
|
|
MaterialRcvdDateInput.prop('readonly', true);
|
|
invoiceDateInput.prop('readonly', true);
|
|
}
|
|
}else{
|
|
$(".a_tag_for_mrir").css("display", "none");
|
|
if (igrstatus == "ST074") {
|
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
|
} else {
|
|
buttonContainer.find("#draftIGR").css("display", "none");
|
|
}
|
|
}
|
|
|
|
$("#tbleIGRAppend").empty();
|
|
$('#content').loader('show');
|
|
|
|
$.ajax({
|
|
data: { id: igr },
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>ViewIGRDetails",
|
|
success: function(data) {
|
|
// success:function(data) {
|
|
$('#content').loader('hide');
|
|
var parsedData = JSON.parse(data);
|
|
if (parsedData.length === 0) {
|
|
console.log("No data available");
|
|
// Reset all relevant fields and table
|
|
$('#IgrshowTitle').text('');
|
|
$("#IGRNO1").val('');
|
|
$("#txtIGRLineItem").val('');
|
|
$('#printLink').attr('href', '#');
|
|
$('.help-block').text('');
|
|
$("#Vehicle_No").val('');
|
|
$("#Driver_Name").val('');
|
|
$("#DriverMobileNumber").val('');
|
|
$("#IGRStatus").val('');
|
|
$("#PONo").val('');
|
|
$("#Supplier").val('');
|
|
$("#Add1").val('');
|
|
$("#Invoice_No").val('');
|
|
$("#Invoice_Date").val('');
|
|
$("#MaterialRcvdDate").val('');
|
|
$("#ser").val('');
|
|
$("#tbleIGRAppend").empty(); // Clear the table
|
|
// Hide the MasterFileLabel if no data
|
|
modal.find('#MasterFileLabel').hide();
|
|
|
|
return; // Exit the function early
|
|
}
|
|
|
|
var trIGRHTML = '';
|
|
|
|
$.each(parsedData, function(i, item) {
|
|
if (igr == item.IGRNO) {
|
|
console.log(item);
|
|
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
|
|
$("#IGRNO1").val(item.IGRNO);
|
|
$("#txtIGRLineItem").val(item.IGRItemNo);
|
|
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
|
|
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
|
|
$('#printLink').attr('href', newUrl);
|
|
var isOpenOrder = parseInt(item.IsOpenOrder, 2);
|
|
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
|
|
$('.help-block').text(formatted_IsOpenOrder);
|
|
|
|
$("#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);
|
|
console.log(typeof item.MasterFile);
|
|
modal.find('#MasterFileLabel').hide();
|
|
if (typeof item.MasterFile == 'string') {
|
|
if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") {
|
|
modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile);
|
|
modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File');
|
|
modal.find('#MasterFileLabel a span').text('previously uploaded - ');
|
|
modal.find('#MasterFileLabel a small').text(item.MasterFile);
|
|
modal.find('#MasterFileLabel').show();
|
|
}
|
|
} else {
|
|
modal.find('#MasterFileLabel').hide();
|
|
}
|
|
|
|
// Format dates
|
|
var dcd = new Date(item.DeliveryChellanDate);
|
|
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
|
|
$("#Invoice_Date").val(dcd2);
|
|
console.log(item.MaterialRcvdDate)
|
|
var Mat_rcv_date = (item.MaterialRcvdDate === null) ? ' ' : formatDateTime(item.MaterialRcvdDate,1);
|
|
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
|
console.log(item.MaterialRcvdDate)
|
|
var gross_rcv_date = (item.GrossWeightDate === null) ? ' ' : formatDateTime(item.GrossWeightDate,2);
|
|
$("#ser").val(item.ServiceDescription);
|
|
|
|
i = i + 1;
|
|
if (igrstatus === "ST074") {
|
|
$("#pendingQuantityHeader").css("display", "table-cell");
|
|
|
|
trIGRHTML += '<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);" style="width: 75px;"></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 + ')" style="width: 75px;"> </td>' +
|
|
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
|
'<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="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
|
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
|
|
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
|
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
|
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
|
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
|
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
|
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
|
|
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
|
|
'</tr>';
|
|
|
|
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
|
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
|
|
}
|
|
|
|
} else {
|
|
$("#pendingQuantityHeader").css("display", "none");
|
|
trIGRHTML += '<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>' +
|
|
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
|
'<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="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
|
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
|
|
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
|
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
|
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
|
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
|
|
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
|
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '">' +
|
|
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
|
|
'</tr>';
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#tbleIGRAppend").empty();
|
|
$("#tbleIGRAppend").append(trIGRHTML);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
$('#update').click(function(){
|
|
$('#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() ?>UpdateIGR",
|
|
success:function(data) {
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
}
|
|
});
|
|
});
|
|
$('#draftIGR').click(function(){
|
|
$('#content').loader('show');
|
|
var igrno = $("#IGRNO1").val();
|
|
var status = 0;
|
|
var tableData = [];
|
|
$('#tbleIGRAppend tr').each(function(index) {
|
|
var row = $(this);
|
|
++index;
|
|
var rowData = {
|
|
Quantity: row.find('#txtOrderedQuantity' + index).val(),
|
|
QuantityAsPerInvoice: row.find('#txtQuantityAsPerInvoice' + index).val(),
|
|
Remarks: row.find('#txtRemarks' + index).val(),
|
|
GrossWeight: row.find('#txtGrossWeight' + index).val(),
|
|
GrossWeightDate: row.find('#txtGrossWeightDate' + index).val(),
|
|
TareWeight: row.find('#txtTareWeight' + index).val(),
|
|
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
|
NetWeight: row.find('#txtNetWeight' + index).val(),
|
|
IGRItemNo: row.find('#txtIGRLineItem' + index).val(),
|
|
WeightFile: row.find('#txtWeightFile' + index).val()
|
|
};
|
|
tableData.push(rowData);
|
|
});
|
|
var formData = new FormData();
|
|
formData.append('igr', igrno);
|
|
formData.append('mrc', $("#MaterialRcvdDate").val());
|
|
formData.append('invdate', $("#Invoice_Date").val());
|
|
formData.append('vehicle_no', $('#Vehicle_No').val());
|
|
formData.append('driver', $('#Driver_Name').val());
|
|
formData.append('driver_mobile', $('#DriverMobileNumber').val());
|
|
formData.append('status', status);
|
|
formData.append('tableData', JSON.stringify(tableData));
|
|
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
|
$.ajax({
|
|
data: formData,
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>UpdateIGR",
|
|
processData: false,
|
|
contentType: false,
|
|
success:function(data) {
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
$('#generateIGR').click(function(){
|
|
$('#content').loader('show');
|
|
var igrno = $("#IGRNO1").val();
|
|
var status = 1;
|
|
var tableData = [];
|
|
$('#tbleIGRAppend tr').each(function(index) {
|
|
var row = $(this);
|
|
++index;
|
|
var rowData = {
|
|
Quantity: row.find('#txtOrderedQuantity' + index).val(),
|
|
QuantityAsPerInvoice: row.find('#txtQuantityAsPerInvoice' + index).val(),
|
|
Remarks: row.find('#txtRemarks' + index).val(),
|
|
GrossWeight: row.find('#txtGrossWeight' + index).val(),
|
|
GrossWeightDate: row.find('#txtGrossWeightDate' + index).val(),
|
|
TareWeight: row.find('#txtTareWeight' + index).val(),
|
|
TareWeightDate: row.find('#txtTareWeightDate' + index).val(),
|
|
NetWeight: row.find('#txtNetWeight' + index).val(),
|
|
IGRItemNo: row.find('#txtIGRLineItem' + index).val(),
|
|
WeightFile: row.find('#txtWeightFile' + index).val()
|
|
};
|
|
tableData.push(rowData);
|
|
});
|
|
var formData = new FormData();
|
|
formData.append('igr', igrno);
|
|
formData.append('mrc', $("#MaterialRcvdDate").val());
|
|
formData.append('invdate', $("#Invoice_Date").val());
|
|
formData.append('vehicle_no', $('#Vehicle_No').val());
|
|
formData.append('driver', $('#Driver_Name').val());
|
|
formData.append('driver_mobile', $('#DriverMobileNumber').val());
|
|
formData.append('status', status);
|
|
formData.append('tableData', JSON.stringify(tableData));
|
|
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
|
|
|
|
$.ajax({
|
|
data: formData,
|
|
type:"POST",
|
|
url: "<?php echo base_url() ?>UpdateIGR",
|
|
processData: false,
|
|
contentType: false,
|
|
success:function(data) {
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#Historyshow").on("shown.bs.modal", function(e) {
|
|
var igr = $(e.relatedTarget).data('igrno');
|
|
$('#HisTitle').text(" (" + igr + ") ");
|
|
$("#HisStatement").empty();
|
|
|
|
if (igr !== "") {
|
|
$.ajax({
|
|
data: { igr: igr },
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>ViewIGRHistory",
|
|
success: function(data) {
|
|
var output = '';
|
|
if (data && data.length > 0) {
|
|
data.forEach(function(record) {
|
|
var sentence = constructSentence(record);
|
|
console.log(sentence);
|
|
output += '<p>' + sentence + '</p>';
|
|
});
|
|
} else {
|
|
output = '<p style="text-align: center;">No History Data Available</p>';
|
|
}
|
|
$("#HisStatement").html(output);
|
|
},
|
|
error: function(xhr, status, error) {
|
|
var output = '<p style="text-align: center;">No History Data Available</p>';
|
|
$("#HisStatement").html(output);
|
|
console.error('AJAX Error: ' + status + error);
|
|
}
|
|
});
|
|
} else {
|
|
var output = '<p style="text-align: center;">No History Data Available</p>';
|
|
$("#HisStatement").html(output);
|
|
}
|
|
});
|
|
$("#CostCentershow").on("shown.bs.modal", function(e) {
|
|
|
|
var pono = $(e.relatedTarget).data('pono');
|
|
|
|
$('#CCTitle').text(" (" + pono + ") ");
|
|
$("#CCStatement").empty();
|
|
|
|
if (pono !== "") {
|
|
$.ajax({
|
|
data: { pono: pono },
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>getCostCenterData",
|
|
success: function(data) {
|
|
var output = '';
|
|
if (data && data.length > 0) {
|
|
|
|
data.forEach(function(record) {
|
|
|
|
output += '<p style="font-size:16px;"> <strong>' + record.ReqNo + '</strong> : ' + record.CostCenterName + '-' + record.CostCenterCode +' </p>';
|
|
});
|
|
} else {
|
|
output = '<p style="text-align: center;">No Cost Center Data Available</p>';
|
|
}
|
|
$("#CCStatement").html(output);
|
|
},
|
|
error: function(xhr, status, error) {
|
|
var output = '<p style="text-align: center;">No Data Available</p>';
|
|
$("#CCStatement").html(output);
|
|
console.error('AJAX Error: ' + status + error);
|
|
}
|
|
});
|
|
} else {
|
|
var output = '<p style="text-align: center;">No Data Available</p>';
|
|
$("#CCStatement").html(output);
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
function constructSentence(record) {
|
|
let str = record.field;
|
|
let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
let sentence = record.FullName + ' on ' + formatDateTime(record.history_dated,2) + " " + fieldName + " ";
|
|
if (parseInt(record.is_add) === 1) {
|
|
sentence += record.new_data + " was added.";
|
|
} else if (parseInt(record.is_edit) === 1) {
|
|
sentence += record.old_data + " was updated into " + record.new_data + ".";
|
|
} else if (parseInt(record.is_delete) === 1) {
|
|
sentence += record.new_data + " was deleted.";
|
|
}
|
|
return sentence;
|
|
}
|
|
</script>
|
|
<script>
|
|
function filecheck() {
|
|
var sizef = document.getElementById('billimag').files[0].size;
|
|
var file = $('#billimag').val();
|
|
|
|
if (file != '' && sizef < 2100000) { // alert('Your file added successfully');
|
|
} else {
|
|
alert('Sorry Your File is Large To 2MB');
|
|
|
|
$('#billimag').val('');
|
|
}
|
|
}
|
|
|
|
|
|
function fileupdate() {
|
|
var formData = new FormData();
|
|
|
|
|
|
//var file = document.getElementById('billimag').files[0];
|
|
|
|
var file = $("#billimag").prop('files')[0];
|
|
|
|
var param1 = $('#hidebillno').val();
|
|
// alert(param1);
|
|
|
|
var param2 = $('#hideoldfile').val();
|
|
// alert(param2);
|
|
|
|
// var filename = $("#billimag").val();
|
|
// filename = filename.split('\\');
|
|
formData.append('file', file);
|
|
formData.append('param1', param1);
|
|
formData.append('param2', param2);
|
|
|
|
|
|
$('.content').loader('show');
|
|
$.ajax({
|
|
data: formData,
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>inwardgateregister/edituploadfile",
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function(data) {
|
|
if (data) {
|
|
alert(data);
|
|
$('.content').loader('hide');
|
|
$('#billModel').modal('hide');
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#Fileshow").on("shown.bs.modal", function(e) {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
var igr = $(e.relatedTarget).data('igrno');
|
|
var po = $(e.relatedTarget).data('pono');
|
|
|
|
$("#hiddenIGRNO").val(igr);
|
|
$("#hiddenPONO").val(po);
|
|
|
|
|
|
if (igr != "" && po != "") {
|
|
|
|
$.ajax({
|
|
data: {
|
|
id: igr,
|
|
id1: po
|
|
},
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>ViewIGRfile",
|
|
success: function(file) {
|
|
|
|
$("#hidegrandcounter").val(JSON.parse(file).length);
|
|
|
|
var trFileHTML = '';
|
|
var FilePath = '';
|
|
var Filename = '';
|
|
var PONO = '';
|
|
var BillNO = '';
|
|
$.each(JSON.parse(file), function(i, item) {
|
|
if (item.file == null) {
|
|
if (item.Remarks == null) {
|
|
PONO = item.PONO;
|
|
BillNO = item.BillNo;
|
|
Filename = item.FilePath;
|
|
FilePath = "<?php echo base_url() ?>public/uploads/Igrfiles/" + item.FilePath;
|
|
} else {
|
|
Filename = "BillDetails";
|
|
PONO = item.PONO;
|
|
BillNO = item.BillNo;
|
|
FilePath = item.FilePath;
|
|
}
|
|
|
|
} else {
|
|
Filename = item.file;
|
|
PONO = item.pono;
|
|
BillNO = '-';
|
|
|
|
FilePath = item.file;
|
|
}
|
|
if (Filename != null) {
|
|
i = i + 1;
|
|
trFileHTML += '<tr id="row' + i + '">' +
|
|
'<td align="right">' + i + '</td>' +
|
|
'<td id="billno' + i + '">' + BillNO + '</td>' +
|
|
'<td>' + PONO + '</td>' +
|
|
'<td id="file' + i + '"><a target="_blank" href="' + FilePath + '" title="download">' + Filename + '</a></td>' +
|
|
'<td>' +
|
|
|
|
'<a href="#" onclick="openbillmodel(' + i + ')">' +
|
|
'<i class="fa fa-edit" style="margin-right: 10px;"></i>' +
|
|
'</a>' +
|
|
'<a href="#" onclick="deleteBill(' + BillNO + ',' + i + ')">' +
|
|
'<i class="fa fa-trash"></i>' +
|
|
'</a>' +
|
|
'</td>' +
|
|
'</tr>';
|
|
}
|
|
|
|
});
|
|
$("#tblefile").empty();
|
|
if (trFileHTML == '') {
|
|
trFileHTML = '<tr><td colspan="5" style="text-align: center;">NO FILE</td></tr>';
|
|
}
|
|
$("#tblefile").append(trFileHTML);
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function openbillmodel(i) {
|
|
|
|
// alert(i);
|
|
// return false;
|
|
var igr = $("#tblefile").find('tr').find('td').eq(2).text();
|
|
|
|
// alert(igr);
|
|
var Billno = $("#billno" + i).text();
|
|
// alert(Billno);
|
|
var file = $("#file" + i).text();
|
|
//alert(file);
|
|
|
|
|
|
$("#billModel").modal("show");
|
|
$("#bill").text(Billno);
|
|
$("#hideoldfile").val(file);
|
|
$("#hidebillno").val(Billno);
|
|
}
|
|
function deleteBill(Billno,i){
|
|
$.ajax({
|
|
data: {
|
|
Billno: Billno,
|
|
},
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>deleteBillFile",
|
|
success: function(data) {
|
|
if (data) {
|
|
alert(data);
|
|
$('#row' + counter).remove();
|
|
$('.content').loader('hide');
|
|
$('#billModel').modal('hide');
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
</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;
|
|
}
|
|
|
|
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());
|
|
}
|
|
}
|
|
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
|
var inx = $(e.relatedTarget).data('index');
|
|
var material = $(e.relatedTarget).data('material');
|
|
var modal = $(this);
|
|
|
|
|
|
$('#WeightTitle').text(" ( " + material + " )");
|
|
|
|
// Clear the modal inputs
|
|
$("#GrossWeight").val('');
|
|
$("#GrossWeightDate").val('');
|
|
$("#TareWeight").val('');
|
|
$("#TareWeightDate").val('');
|
|
$("#NetWeight").val('');
|
|
$("#WeightFile").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();
|
|
var fileInput = $("#txtWeightFile" + inx)[0];
|
|
var fileName = $("#txtWeightFileName" + inx).val();
|
|
modal.find('#WeightFileLabel').hide();
|
|
console.log(typeof fileName);
|
|
if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") {
|
|
modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File');
|
|
modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>'+'public/uploads/Igrfiles/'+fileName);
|
|
modal.find('#WeightFileLabel a span').text('previously uploaded - ');
|
|
modal.find('#WeightFileLabel a small').text(fileName);
|
|
modal.find('#WeightFileLabel').show();
|
|
}
|
|
console.log(fileInput);
|
|
console.log("Selected values for index:", typeof inx,inx);
|
|
|
|
// Set modal inputs with the retrieved values
|
|
$("#GrossWeight").val(v1);
|
|
$("#GrossWeightDate").val(formatDateTime(v2,2));
|
|
$("#TareWeight").val(v3);
|
|
$("#TareWeightDate").val(formatDateTime(v4,2) );
|
|
$("#NetWeight").val(v5);
|
|
$("#CurrentInx").val(inx);
|
|
|
|
fileName
|
|
if (fileInput && fileInput.files.length > 0) {
|
|
var targetInput = $("#WeightFile")[0];
|
|
var file = fileInput.files[0];
|
|
|
|
// Create a new DataTransfer object
|
|
var dataTransfer = new DataTransfer();
|
|
dataTransfer.items.add(file);
|
|
|
|
// Set the file to the target input
|
|
targetInput.files = dataTransfer.files;
|
|
|
|
} else {
|
|
console.log("No file selected or file input not found.");
|
|
}
|
|
});
|
|
|
|
|
|
function modalSave() {
|
|
var v1 = $("#GrossWeight").val();
|
|
var v2 = $("#GrossWeightDate").val();
|
|
var v3 = $("#TareWeight").val();
|
|
var v4 = $("#TareWeightDate").val();
|
|
var v5 = $("#NetWeight").val();
|
|
var inx = $("#CurrentInx").val();
|
|
var IGRNO1 = $("#IGRNO1").val();
|
|
var fileInput = $("#WeightFile")[0]; // Get the file input element
|
|
|
|
if (inx !== undefined && inx !== '') {
|
|
console.log("Saving values for index:", inx);
|
|
|
|
// Set the values back to the hidden inputs
|
|
$("#txtGrossWeight" + inx).val(v1);
|
|
$("#txtGrossWeightDate" + inx).val(v2);
|
|
$("#txtTareWeight" + inx).val(v3);
|
|
$("#txtTareWeightDate" + inx).val(v4);
|
|
$("#txtNetWeight" + inx).val(v5);
|
|
var txtIGRLineItem = $("#txtIGRLineItem" + inx).val();
|
|
|
|
// Prepare FormData
|
|
var formData = new FormData();
|
|
formData.append('GrossWeight', v1);
|
|
formData.append('GrossWeightDate', v2);
|
|
formData.append('TareWeight', v3);
|
|
formData.append('TareWeightDate', v4);
|
|
formData.append('NetWeight', v5);
|
|
formData.append('IGR', IGRNO1);
|
|
formData.append('IGRlineitem', txtIGRLineItem);
|
|
if (fileInput && fileInput.files.length > 0) {
|
|
var file = fileInput.files[0];
|
|
formData.append('WeightFile', file);
|
|
} else {
|
|
console.log("No file selected or file input not found.");
|
|
}
|
|
// if (fileInput && fileInput.files.length > 0) {
|
|
// var targetInput = $("#txtWeightFile" + inx)[0];
|
|
// var file = fileInput.files[0];
|
|
|
|
// // Create a new DataTransfer object
|
|
// var dataTransfer = new DataTransfer();
|
|
// dataTransfer.items.add(file);
|
|
|
|
// // Set the file to the target input
|
|
// targetInput.files = dataTransfer.files;
|
|
// formData.append('WeightFile', file);
|
|
|
|
// } else {
|
|
// console.log("No file selected or file input not found.");
|
|
// }
|
|
$.ajax({
|
|
url: "<?php echo base_url() ?>updateIGRWeight",
|
|
type: "POST",
|
|
data: formData,
|
|
contentType: false, // Don't set content type header
|
|
processData: false,
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
alert(data);
|
|
}
|
|
|
|
}
|
|
});
|
|
// Clear modal inputs
|
|
$("#GrossWeight").val('');
|
|
$("#GrossWeightDate").val('');
|
|
$("#TareWeight").val('');
|
|
$("#TareWeightDate").val('');
|
|
$("#NetWeight").val('');
|
|
$("#WeightFile").val('');
|
|
|
|
// Close the modal
|
|
$("#WeightCalculator").modal('hide');
|
|
} else {
|
|
console.log("Saving values for index: "+inx+" undefined");
|
|
}
|
|
}
|
|
|
|
|
|
</script>
|
|
<script>
|
|
function formatDateTime(dateString,flag) {
|
|
// Note 1 means DATE only
|
|
// 2 means DATE and Time
|
|
// Check if the date string is null or empty
|
|
if (!dateString || dateString === null || dateString === '0000-00-00 00:00:00') {
|
|
return '';
|
|
} else {
|
|
|
|
console.log("Received date string:", dateString);
|
|
|
|
// Split the date string into date and time components
|
|
var dateTimeParts = dateString.split(' ');
|
|
var dateParts = dateTimeParts[0].split('-');
|
|
var timeParts = dateTimeParts[1].split(':');
|
|
|
|
// Extract individual components
|
|
var year = parseInt(dateParts[0], 10);
|
|
var month = parseInt(dateParts[1], 10) - 1; // Months are zero-based in JavaScript
|
|
var day = parseInt(dateParts[2], 10);
|
|
|
|
var hours = parseInt(timeParts[0], 10);
|
|
var minutes = parseInt(timeParts[1], 10);
|
|
var seconds = parseInt(timeParts[2], 10);
|
|
|
|
// Create a new Date object
|
|
var date = new Date(year, month, day, hours, minutes, seconds);
|
|
|
|
// 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');
|
|
var formattedDate = '';
|
|
// Format the date and time in DD-MM-YYYY HH:MM:SS format
|
|
if(flag == 1){
|
|
formattedDate = `${day}-${month}-${year}`;
|
|
}else if (flag == 2){
|
|
formattedDate = `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
|
|
}
|
|
return formattedDate;
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
function SetRemarks(RowId) {
|
|
var remks = $("#Remark" + RowId).val();
|
|
if (remks != '') {
|
|
$("#txtRemarks" + RowId).val(remks);
|
|
}
|
|
}
|
|
|
|
function validateReceivedQuantity(Rowid) {
|
|
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() || '0.00'); // working fine
|
|
var OrderedQty = parseFloat($("#Quantity" + Rowid).text());
|
|
|
|
if (parseInt(OrderedQty) !== 0) {
|
|
if ((InvoiceQty) > OrderedQty) {
|
|
alert("Pending Quantity is exceeding the Ordered Quantity. Please contact the Purchase Team for further process.");
|
|
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
|
|
return false;
|
|
} else if ((InvoiceQty) - OrderedQty > 0.00) {
|
|
alert("Order is completed.");
|
|
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
|
|
return false;
|
|
} else {
|
|
var PendingQty = OrderedQty - (InvoiceQty);
|
|
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
|
|
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
|
|
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
|
|
return true;
|
|
}
|
|
} else {
|
|
var PendingQty = OrderedQty - (InvoiceQty);
|
|
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
|
|
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
|
|
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
|
|
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;
|
|
}
|
|
</script>
|
|
<script>
|
|
var counter = 0;
|
|
|
|
$("#addmorebutton").click(function() {
|
|
$('#newdiv').empty();
|
|
var file_count = $("#hidegrandcounter").val();
|
|
counter++;
|
|
var bil_count = +counter + +file_count;
|
|
if (bil_count >= 6) {
|
|
alert("You have to upload five files only"); //this allows only 5 files;
|
|
$('#addmorebutton').hide();
|
|
return false;
|
|
}
|
|
var div = document.createElement('div');
|
|
div.id = "divid";
|
|
div.className = "row";
|
|
div.innerHTML = '<div class="col-md-12">' +
|
|
'<div class="col-md-3">' +
|
|
'<label><br></label>' +
|
|
'<input type="file" name="browseFiles" id="images' + counter + '" ><br>' +
|
|
'</div>' +
|
|
'<div class="col-md-2">' +
|
|
'<label><br><br></label>' +
|
|
'<button class="btn btn-success" type ="button" id="addbtn" onclick="addRow(' + counter + ')">ADD</button></div>' +
|
|
'</div>' +
|
|
'</div>';
|
|
|
|
$('#newdiv').append(div);
|
|
$('#hidecounter').val(counter);
|
|
|
|
if (counter > 1) {
|
|
alert("Add button click here");
|
|
return false;
|
|
} else {
|
|
$('#addmorebutton').hide();
|
|
}
|
|
});
|
|
|
|
function addRow(counter) {
|
|
var file = $('#images' + counter).val();
|
|
|
|
if (file == '') {
|
|
alert('File not found');
|
|
} else {
|
|
fileupload(counter);
|
|
}
|
|
}
|
|
|
|
function fileupload(counter) {
|
|
var formData = new FormData();
|
|
var file = document.getElementById('images' + counter).files[0];
|
|
var PONO = $('#hiddenPONO').val();
|
|
var igr = $('#hiddenIGRNO').val();
|
|
|
|
formData.append('file', file);
|
|
formData.append('PONO', PONO);
|
|
formData.append('count', counter);
|
|
formData.append('igr', igr);
|
|
|
|
$('.content').loader('show');
|
|
$.ajax({
|
|
data: formData,
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>inwardgateregister/addloadfile",
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function(data) {
|
|
if (data) {
|
|
const chars = data.split("-");
|
|
billNo = chars[1] != undefined ? chars[1] : "";
|
|
alert('File uploaded successfully.');
|
|
addToTable(counter,billNo, file.name);
|
|
$('.content').loader('hide');
|
|
$('#billModel').modal('hide');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function addToTable(counter,billNo, fileName) {
|
|
var hidecounter = $("#hidecounter").val();
|
|
var file_count = $("#hidegrandcounter").val();
|
|
|
|
var newRow = '<tr id="row' + counter + '">' +
|
|
'<td>' + counter + '</td>' +
|
|
'<td>' + billNo + '</td>' +
|
|
'<td>' + $('#hiddenPONO').val() + '</td>' +
|
|
'<td>' + fileName + '</td>' +
|
|
'<td>' + '<a href="#" onclick="openbillmodel(' + counter + ')">' +
|
|
'<i class="fa fa-edit" style="margin-right: 10px;"></i>' +
|
|
'</a>' +
|
|
'<a href="#" onclick="deleteBill(' + billNo + ',' + counter + ')">' +
|
|
'<i class="fa fa-trash"></i>' +
|
|
'</a>' +
|
|
'</td>' +
|
|
'</tr>';
|
|
$('#tblefile').append(newRow);
|
|
}
|
|
function Copyfilenames(id) {
|
|
var size = $('input[name=' + id + ']')[0].files[0].size;
|
|
if (size > 2100000) {
|
|
alert('Sorry Your File is Large To 2MB');
|
|
} else {
|
|
var name = $('input[name=' + id + ']')[0].files[0].name;
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<!-- Latest DataTables JS -->
|
|
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
|
<!-- Latest DataTables Buttons JS -->
|
|
<script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script>
|
|
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script>
|
|
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.print.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
|
|
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script>
|
|
|
|
<script>
|
|
$(function () {
|
|
$.fn.dataTable.moment('DD-MM-YYYY');
|
|
$('#Inwardgateregistertable').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"info": true,
|
|
"autoWidth": true,
|
|
"scrollCollapse": true,
|
|
"scrollX": true,
|
|
"pageLength": 25,
|
|
"order": [[0, "desc"]], // Assuming the "Created Date" is the first column and you want to order by it in descending order
|
|
"dom": '<"top"lBf>rt<"bottom"ip><"clear">', // Custom layout
|
|
"buttons": [
|
|
{
|
|
extend: 'excelHtml5',
|
|
text: 'Export to Excel',
|
|
title: 'Inward Gate Register',
|
|
exportOptions: {
|
|
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
|
|
}
|
|
},
|
|
{
|
|
extend: 'pdfHtml5',
|
|
text: 'Export to PDF',
|
|
title: 'Inward Gate Register',
|
|
exportOptions: {
|
|
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
|
|
}
|
|
}
|
|
]
|
|
});
|
|
});
|
|
</script>
|