ria/app/Views/viewinwardgateregister.php
2024-06-12 03:14:50 +00:00

332 lines
11 KiB
PHP

<style>
.modal
{
padding-right:25% ! important;
}
.num{
text-align:right;
}
.modal-content
{
width: 800px ! 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 ?>" > <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->CourierNo ?></td>
<td>
<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">&times;</button>
<center><h4>Inward Gate Register Details</h4></center> <!-- IGR number should display here-->
</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">
<label>Purchase Order Number </label>
<?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>Delivery Challan/Invoice NO </label>
<?php
$data = array('name' => 'DeliveryChallan/InvoiceNO','value' => set_value('DeliveryChallan/InvoiceNO'),'id'=>'Invoice_No', 'class' => 'form-control', 'required=>"true"' , 'readonly'=>'true' );
echo form_input($data);
?>
</div>
<div class="col-md-4">
<label>Delivery Challan / Invoice Date </label>
<?php
$data = array('name' => 'DeliveryChallan/InvoiceDate','value' => set_value('DeliveryChallan/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>
<!-- 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>Remarks</th>
</tr>
</thead>
<tbody id="tbleAppend1"></tbody>
</table>
<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>
</div>
</div>
</form>
</div><!-- modal-dialog -->
</div> <!-- modal -->
</section><!-- content-->
</div><!-- content-wrapper -->
<script>
<!-- script for table , It works under the datatable plugin-->
$(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');
$('#content').loader('show');
$.ajax({
data:{id:igr},
type:"POST",
//dataType: 'json',
url:"<?php echo base_url() ?>inwardgateregister/ViewIGR",
success:function(data) {
// success:function(data) {
$('#content').loader('hide');
var trHTML = '';
$.each(JSON.parse(data), function (i, item) {
if(igr == item.IGRNO)
{
$("#IGRNO1").val(item.IGRNO);
//alert(item.IGRNO);
$("#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);
console.log(item.MaterialRcvdDate) ;
//alert(item.MaterialRcvdDate);
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
var dcd2 = (dcd.getDate()+ '-' + (dcd.getMonth() + 1)+ '-' + dcd.getFullYear());
//var MR_dt = item.MaterialRcvdDate === null ? ' - ' : new Date(item.MaterialRcvdDate).toDateString("d-m-Y");
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);
$("#Invoice_Date").val(dcd2);
$("#ser").val(item.ServiceDescription);
i=i+1;
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);
}
});
});
$('#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>