403 lines
12 KiB
PHP
Executable File
403 lines
12 KiB
PHP
Executable File
<?php
|
|
$IGRNO="";
|
|
$PONO="";
|
|
$VehicleNo="";
|
|
$CourierNo="";
|
|
$DeliveryChellanOrInvoiceNo="";
|
|
$SupplierName="";
|
|
$DeliveryChellanDate="";
|
|
$dcdate="";
|
|
$Address="";
|
|
$PORasiedbyName="";
|
|
$PODate="";
|
|
$podate="";
|
|
$IGRDate="";
|
|
$igrdate="";
|
|
$ServiceDescription="";
|
|
$RowCount = 0;
|
|
|
|
if(!empty($IGRDetails))
|
|
{
|
|
|
|
foreach ($IGRDetails as $IGR)
|
|
{
|
|
$IGRNO = $IGR->IGRNO;
|
|
$PONO = $IGR->PONO;
|
|
$VehicleNo = $IGR->VehicleNo;
|
|
$CourierNo= $IGR->CourierNo;
|
|
$DeliveryChellanOrInvoiceNo=$IGR->DeliveryChellanOrInvoiceNo;
|
|
$SupplierName=$IGR->SupplierName;
|
|
//$DeliveryChellanDate=$IGR->DeliveryChellanDate;
|
|
|
|
$dc_date = new DateTime( $IGR->DeliveryChellanDate );
|
|
$dcdate = $dc_date->format('d/m/Y');;
|
|
$Address=$IGR->Address;
|
|
$PORasiedbyName=$IGR->FirstName;
|
|
$PODate=$IGR->PODate;
|
|
$po_date = strtotime( $PODate );
|
|
$podate = date( 'd/m/Y', $po_date );
|
|
$IGRDate=$IGR->CreatedDate;
|
|
$igr_date = strtotime( $IGRDate );
|
|
$igrdate = date( 'd/m/Y', $igr_date );
|
|
$ServiceDescription=$IGR->ServiceDescription;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
?>
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$("#QualityIncharge").select2();
|
|
$("#plantIncharge").select2();
|
|
|
|
});//ready closed.
|
|
</script>
|
|
|
|
<style>
|
|
.modal
|
|
{
|
|
padding-right:25% ! important;
|
|
}
|
|
.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">
|
|
<div id="content"></div>
|
|
<section class="content-header">
|
|
|
|
<h1>
|
|
<center> Material Receipt And Inspection Report (MRIR)</center>
|
|
</h1>
|
|
|
|
<?php
|
|
$attributes = array('class' => 'form-label-left MRIR ','name' => 'MRIR','id' => 'MRIR');
|
|
echo form_open(base_url().'/MRIRcontroller/generateMRIR/',$attributes); ?>
|
|
</section>
|
|
<div style="border:2px solid #333">
|
|
<!-- Content Header (Page header) -->
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 col-sm-12">
|
|
<div class="col-md-3 col-sm-3">
|
|
<label for="IGRNO">Inward Gate Register No</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'IGRNO','value' => set_value('IGRNO',$IGRNO),'id'=>'IGRNO', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2 col-sm-2">
|
|
<label for="IGRNO">Inward Gate Register Date</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'IGRDate','value' => set_value('IGRDate',$igrdate),'id'=>'IGRDate', 'class' => 'form-control num' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-2 col-sm-2">
|
|
|
|
<label for="PONO">Purchase Order No</label>
|
|
<div class="form-group"><?php
|
|
$data = array('name' => 'PONO','value' => set_value('PONO',$PONO),'id'=>'PONO', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2 col-sm-2">
|
|
<label for="PODate">Purchase Order Date</label>
|
|
<div class="from-group">
|
|
<?php
|
|
$data = array('name' => 'PODate','value' => set_value('PODate',$podate),'id'=>'PODate', 'class' => 'form-control num' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3 col-sm-3">
|
|
<label for="PORasiedbyName">Purchase Order Created By</label>
|
|
<div class="from-group"><?php
|
|
$data = array('name' => 'PORasiedbyName','value' => set_value('PORasiedbyName',$PORasiedbyName),'id'=>'PORasiedbyName', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-12 col-sm-12">
|
|
<div class="col-md-3 col-sm-3">
|
|
<label for="SupplierName">Supplier Name </label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'SupplierName','value' => set_value('SupplierName',$SupplierName),'id'=>'SupplierName', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2 col-sm-2">
|
|
<label for="DeliveryChellanOrInvoiceNo">DC / Inv No</label>
|
|
<div class="form-group">
|
|
<?php
|
|
|
|
$data = array('name' => 'DeliveryChellanOrInvoiceNo','value' => set_value('DeliveryChellanOrInvoiceNo',$DeliveryChellanOrInvoiceNo),'id'=>'DeliveryChellanOrInvoiceNo', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2 col-sm-2">
|
|
<label for="DeliveryChellanDate">DC / Inv Date </label>
|
|
<div class="form-group"><?php
|
|
$data = array('name' => 'DeliveryChellanDate','value' => set_value('DeliveryChellanDate',$dcdate),'id'=>'DeliveryChellanDate', 'class' => 'form-control num','readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2 col-sm-2">
|
|
<label for="VehicleNo">Vehicle No</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'VehicleNo','value' => set_value('VehicleNo',$VehicleNo),'id'=>'VehicleNo', 'class' => 'form-control' ,'readonly' => 'true','align' => 'left');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3 col-sm-3">
|
|
<label for="CourierNo">Courier No</label>
|
|
<div class="form-group"><?php
|
|
$data = array('name' => 'CourierNo','value' => set_value('CourierNo',$CourierNo),'id'=>'CourierNo', 'class' => 'form-control','readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row" style="padding:1%;">
|
|
<div class="col-md-12 col-sm-12">
|
|
<table id="mytable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<thead >
|
|
<tr>
|
|
<th>S.NO</th>
|
|
<th>Item Code</th>
|
|
<th>Material</th>
|
|
<th>UOM</th>
|
|
<th>Ordered Quantity</th>
|
|
<th>Adviced Quantity as per the Challan</th>
|
|
<th>Actual Quantity Received</th>
|
|
<!--<th>Accepted_Quantity</th>-->
|
|
<!--<th>Rejected_Quantity</th>-->
|
|
<th>Remarks</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="tbleAppend">
|
|
<?php $SNo =0;
|
|
|
|
if(!empty($IGRDetails))
|
|
|
|
{
|
|
|
|
foreach($IGRDetails as $record)
|
|
{
|
|
$SNo =$SNo + 1;
|
|
|
|
|
|
?>
|
|
<tr id="<?php echo $SNo?>">
|
|
|
|
|
|
<td><?php echo $SNo?></td>
|
|
<td><?php echo $record->MaterialCode?></td>
|
|
<input type="hidden" name="<?php echo 'MaterialCode'.$SNo ?>" id="<?php echo 'MaterialCode'.$SNo ?>" value=" <?php echo $record->MaterialCode ?> "/>
|
|
<td><?php echo $record->MaterialName?></td>
|
|
<td><?php echo $record->UOM?></td>
|
|
<td class="num"><?php echo $record->Quantity?></td>
|
|
<td class="num"><?php echo $record->QuantityAsPerInvoice?></td>
|
|
<input type="hidden" name="<?php echo 'QuantityAsPerInvoice'.$SNo ?>" id="<?php echo 'QuantityAsPerInvoice'.$SNo ?>" />
|
|
<td><input type="text" id="<?php echo 'ActualQuantity'.$SNo;?>" name="<?php echo 'ActualQuantity'.$SNo;?>" onchange="setactual('<?php echo $SNo;?>');"></td>
|
|
<input type="hidden" name="<?php echo 'ActualQuantityReceived'.$SNo ?>" id="<?php echo 'ActualQuantityReceived'.$SNo ?>" value=""/>
|
|
<td><input type="text" id="<?php echo 'Remark'.$SNo ?>" name="<?php echo 'Remark'.$SNo ?>" onchange="setremark('<?php echo $SNo;?>');"></td>
|
|
<input type="hidden" name="<?php echo 'Remarks'.$SNo ?>" id="<?php echo 'Remarks'.$SNo ?>" />
|
|
</tr>
|
|
<?php
|
|
|
|
|
|
} //echo $SNo;
|
|
}
|
|
|
|
$RowCount = $SNo;
|
|
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="col-md-2 col-md-offset-10" align="right" style="padding: 0px;">
|
|
<a class="btn btn-success" type="submit" onclick="savemrir()">Generate MRIR</a>
|
|
<input type="hidden" name="RowCount" id="RowCount" value="<?php echo $RowCount ?>" />
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script>
|
|
|
|
<!-- script for table , It works under the datatable plugin-->
|
|
$(function () {
|
|
$('#Inwardgateregistertable').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
function validate()
|
|
{
|
|
var rowcount = $("#RowCount").val();
|
|
//alert(rowcount);
|
|
var Noval = 0;
|
|
var isExceed = 0;
|
|
for(k=1;k<=rowcount; k++)
|
|
{
|
|
var ActualQty = parseFloat( $('#ActualQuantity'+k).val() == '' ? '0.00' : $('#ActualQuantity'+k).val());
|
|
//var RecQty = parseFloat( $('#txtReceivedQuantity'+k).val() == '' ? '0.00' : $('#txtReceivedQuantity'+k).val());
|
|
//var OrderedQty =parseFloat($('#Quantity_1'+k).text());
|
|
var tr= document.getElementById(k);
|
|
var InvoiceQty = 0.0;
|
|
|
|
|
|
var cellval = tr.cells;
|
|
|
|
InvoiceQty = parseFloat(cellval[5].innerHTML);
|
|
|
|
|
|
// alert('act'+ActualQty);
|
|
if(ActualQty != '0.00')
|
|
{
|
|
// alert('inside loop');
|
|
if(ActualQty > InvoiceQty)
|
|
{
|
|
isExceed = 1;
|
|
return false;
|
|
}
|
|
Noval = 1;
|
|
}
|
|
}
|
|
//alert(Noval);
|
|
if (Noval == 0 )
|
|
{
|
|
|
|
alert('Actual Quantity is Empty.Please Enter the value');
|
|
return false;
|
|
|
|
}
|
|
else if(isExceed == 1 ){
|
|
|
|
alert("Actual Quantity is exceeding the Invoice Quantity.Please adjust for further Process ")
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
function setactual(rowId)
|
|
{
|
|
var tr= document.getElementById(rowId);
|
|
var InvoiceQty = 0.0;
|
|
|
|
|
|
var cellval = tr.cells;
|
|
|
|
InvoiceQty = parseFloat(cellval[5].innerHTML);
|
|
|
|
var actual = parseFloat($('#ActualQuantity'+rowId).val());
|
|
|
|
|
|
if(InvoiceQty < actual)
|
|
{
|
|
alert("Actual Quantity is exceeding the Invoice Quantity.Please change the Actual Quantity ")
|
|
$("#ActualQuantity"+rowId).focus();
|
|
$("#ActualQuantity"+rowId).val('');
|
|
|
|
return false;
|
|
}
|
|
}
|
|
function setremark(rowId)
|
|
{
|
|
var remark = ($('#Remark'+rowId).val());
|
|
//alert(remark);
|
|
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
function savemrir()
|
|
{
|
|
if(validate())
|
|
{
|
|
//alert("save function worked ");
|
|
$("#content").loader('show');
|
|
|
|
$.ajax({
|
|
data:$('.MRIR').serialize(),
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>MRIRcontroller/stored_db",
|
|
|
|
success:function(data) {
|
|
|
|
|
|
if(data){
|
|
$("#content").load('hide');
|
|
alert(data);
|
|
|
|
window.location ="viewmaterialinspectionreport";
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
|
|
}//success function closed
|
|
});//ajax closed
|
|
}
|
|
}//save function closed
|
|
</script>
|