275 lines
6.7 KiB
PHP
275 lines
6.7 KiB
PHP
|
|
<?php
|
|
//print_r($AppList);
|
|
?>
|
|
|
|
<style>
|
|
.table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td {border: 1px solid #333;}
|
|
|
|
</style>
|
|
<div class="content-wrapper">
|
|
|
|
|
|
<section class="content">
|
|
|
|
<div>
|
|
<center><b><h2> SIA - Material Distribution List </h2></b></center>
|
|
<?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 Number</th>
|
|
<th>Requisition Number</th>
|
|
<th>Requested By</th>
|
|
<th>Requested Department</th>
|
|
<th>Requested Date</th>
|
|
<th>Material Code</th>
|
|
<th>Material Name</th>
|
|
<th>UOM</th>
|
|
<th>Requested Qty</th>
|
|
<th>Ordered Quantity</th>
|
|
|
|
<th>Accepted Quantity </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><a data-toggle="modal" data-target="#myModal" data-id="<%=index%>" data-userid="<?php echo $record->PONO ?>" ><u><?php echo $record->PONO ?></u></a></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>
|
|
|
|
<td contenteditable="true"><input type="text" id="Remarks<?php echo $index ?>" name="Remarks<?php echo $index ?>"class="form-control" maxlength="100"></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="1">Select Action</option>
|
|
<option value="2">Ready For Dispatch</option>
|
|
<option value="3">Dispatched</option>
|
|
</select>
|
|
</td>
|
|
|
|
</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 id = $('#Remarks'+Index).val();
|
|
var Status = $('#status'+Index).val();
|
|
var StatusCode = '<?php echo REQ_APPROVED; ?>';
|
|
var strMsg = 'Do you want to Approve the Requisition?';
|
|
if(Status == '3')
|
|
{
|
|
StatusCode = '<?php echo REQ_REJECTED; ?>';
|
|
strMsg = 'Do you want to Reject the Requisition?'
|
|
}
|
|
var Remarks = $('#Remarks'+Index).val();
|
|
if(Status == '3' && Remarks == '')
|
|
{
|
|
alert('Please enter remarks');
|
|
$('#status'+Index).val('1');
|
|
return false;
|
|
|
|
}
|
|
|
|
var answer = confirm(strMsg);
|
|
if (answer)
|
|
{
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{id:id},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>requisitionform/ApproveRequest?Status="+StatusCode+"&ReqNo="+ReqId,
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
location.reload();
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
$(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>
|