267 lines
7.2 KiB
PHP
Executable File
267 lines
7.2 KiB
PHP
Executable File
|
|
<div class="content-wrapper">
|
|
<section class="content">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<CENTER><h3 class="box-title">Siddharth Industries - Material Distribution List</h3></CENTER>
|
|
</div>
|
|
<?php
|
|
$attributes = array('class' => 'form-label-left Approve ','name' => 'Approve','id' => 'Approve');
|
|
|
|
echo form_open($this->config->base_url().'requisitionform/SearchRequistList',$attributes); ?>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
</div>
|
|
</div>
|
|
<br/>
|
|
<table id="Requisition" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<div align="right" style="padding-right:10px">
|
|
<div id="content" > </div>
|
|
<thead style="background-color:#ddf">
|
|
<tr>
|
|
<th>Purchase Order No</th>
|
|
<th>Requisition No</th>
|
|
<th>Req By</th>
|
|
<th>Req Dept</th>
|
|
<th>Req Date</th>
|
|
<th>Material Code</th>
|
|
<th>Material Name</th>
|
|
<th>UOM</th>
|
|
<th>Req Qty</th>
|
|
<th>Ordered Qty</th>
|
|
|
|
<th>Accepted Qty </th>
|
|
<th>Remarks</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="ApprovalList">
|
|
|
|
<?php
|
|
if(!empty($Distribution))
|
|
{
|
|
$index = 0;
|
|
foreach($Distribution as $record)
|
|
{
|
|
$index = $index +1;
|
|
?>
|
|
<tr id="<?php echo $index ?>" >
|
|
<td><?php echo $record->PONO ?></td>
|
|
<td><?php echo $record->ReqNo ?></td>
|
|
<td><?php echo $record->FirstName ?></td>
|
|
<td><?php echo $record->DepartmentName ?></td>
|
|
<td align="right"><?php $Cdt = new DateTime($record->ReqDate);
|
|
$CreatedDate = $Cdt->format('d-m-Y');
|
|
echo $CreatedDate;
|
|
?></td>
|
|
<td><?php echo $record->MaterialCode ?></td>
|
|
<td><?php echo $record->MaterialName ?></td>
|
|
<td><?php echo $record->UOM ?></td>
|
|
<td><?php echo $record->RequestedQty ?></td>
|
|
<td><?php echo $record->OrderedQuantity ?></td>
|
|
|
|
<td><?php echo $record->AcceptedQty; ?> </td>
|
|
<?php if($record->ReqStatus != REQ_DELIVERED) { ?>
|
|
<td contenteditable="true"><input type="text" id="Remarks<?php echo $index ?>" name="Remarks<?php echo $index ?>"class="form-control" maxlength="100" value="<?php echo $record->Remarks ?>"></td>
|
|
<td data-name="sel" contenteditable="true" id="Action<?php echo $index ?>" onchange="saveToDatabase(this,'question','<?php echo $record->ReqNo ; ?>','<?php echo $index ; ?>')">
|
|
<select name="status<?php echo $index ?>" id="status<?php echo $index ?>">
|
|
<option value="<?php echo $record->ReqStatus; ?>"><?php echo $record->StatusName; ?></option>
|
|
<?php
|
|
if(!empty($status))
|
|
{
|
|
foreach ($status as $rl)
|
|
{
|
|
if($rl->StatusCode != $record->ReqStatus) { ?>
|
|
<option value="<?php echo $rl->StatusCode ?>"><?php echo $rl->StatusName ?></option>
|
|
<?php }
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
|
|
</td>
|
|
<?php } else {?>
|
|
<td><?php echo $record->Remarks; ?> </td>
|
|
<td><?php echo $record->StatusName; ?> </td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script>
|
|
var startDate = '';
|
|
var endDate = '';
|
|
|
|
function Reset()
|
|
{
|
|
$('#RequisitionStatus').val("-1");
|
|
$('#SearchDate').val('');
|
|
}
|
|
$("#myModal").on("shown.bs.modal", function(e) {
|
|
var ReqId = $(e.relatedTarget).data('userid');
|
|
$("#CostCenter").val('');
|
|
$("#tbleAppend").empty();
|
|
$("#ReqType").val('');
|
|
$("#ReqBy").val('');
|
|
$("#ReqDate").val('');
|
|
$("#Desigination").val('');
|
|
$("#AvlBudgetAmount").val('');
|
|
$('#AlertImg').attr("style","display:none;");
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{id:ReqId},
|
|
type:"POST",
|
|
dataType: 'json',
|
|
url:"<?php echo base_url() ?>requisitionform/ViewRequest",
|
|
success:function(json) {
|
|
// success:function(data) {
|
|
$('#content').loader('hide');
|
|
//alert(data);
|
|
$("#ReqType").val(json.Requist[0]['ReqType']);
|
|
$("#ReqBy").val(json.Requist[0]['Requestedby']);
|
|
$("#ReqDate").val(json.Requist[0]['CreatedDate']);
|
|
$("#Desigination").val(json.Requist[0]['Designation']);
|
|
$("#CostCenter").val(json.Requist[0]['CostCenterCode']);
|
|
$("#AvlBudgetAmount").val(json.AvilBudAmount);
|
|
|
|
$("#tbleAppend").append(json.Items);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
function saveToDatabase(editableObj,column,ReqId,Index) {
|
|
|
|
var tr= document.getElementById(Index);
|
|
var Actulqty = 0.0;
|
|
|
|
|
|
var cellval = tr.cells;
|
|
|
|
Actulqty = parseFloat(cellval[6].innerHTML);
|
|
|
|
|
|
var id = $('#Remarks'+Index).val();
|
|
var StatusCode = $('#status'+Index).val();
|
|
|
|
|
|
var Remarks = $('#Remarks'+Index).val();
|
|
var MaterialCode = cellval[5].innerHTML;
|
|
var RequestedQty = cellval[8].innerHTML;
|
|
var AcceptedQty = cellval[10].innerHTML;
|
|
var ReqNo = cellval[1].innerHTML;
|
|
if(StatusCode=='ST050' &&(RequestedQty>AcceptedQty))
|
|
{
|
|
var ReqQuantity=cellval[10].innerHTML;
|
|
}
|
|
|
|
if(StatusCode=='ST050' &&(RequestedQty<AcceptedQty))
|
|
{
|
|
var ReqQuantity=cellval[8].innerHTML;
|
|
}
|
|
|
|
if (StatusCode!='ST050')
|
|
{
|
|
var ReqQuantity=0;
|
|
}
|
|
var Sendvalues = [];
|
|
Sendvalues[0] = StatusCode;
|
|
Sendvalues[1] = MaterialCode;
|
|
Sendvalues[2] = ReqNo;
|
|
Sendvalues[3] = Remarks;
|
|
Sendvalues[4] = RequestedQty;
|
|
Sendvalues[5] = AcceptedQty;
|
|
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{id:Sendvalues},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>MRIRcontroller/UpdateReqItemStatus",
|
|
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
location.reload();
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
$(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;
|
|
$( ".datePicker" ).datepicker(
|
|
{
|
|
minDate : new Date(year-SIAStartYear,1,1),
|
|
maxDate :'now',
|
|
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
|
|
}
|
|
);
|
|
//$('#SearchDate').daterangepicker( );
|
|
//Initialize Select2 Elements
|
|
$(".select2").select2();
|
|
//$('#SearchDate').val('');
|
|
$('#SearchDate').daterangepicker(
|
|
{
|
|
locale: {
|
|
format: 'DD-MM-YYYY'
|
|
},
|
|
|
|
showDropdowns: true
|
|
},
|
|
function(start, end, label) {
|
|
|
|
startDate = start.format('DD-MM-YYYY');
|
|
endDate = end.format('DD-MM-YYYY');
|
|
$('#FromDate').val(startDate);
|
|
$('#ToDate').val(endDate);
|
|
|
|
|
|
//alert("A new date range was chosen: " + start.format('DD-MM-YYYY') + ' to ' + end.format('DD-MM-YYYY'));
|
|
});
|
|
|
|
});
|
|
$(function () {
|
|
|
|
|
|
$('#Requisition').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
});
|
|
</script>
|
|
|