392 lines
10 KiB
PHP
Executable File
392 lines
10 KiB
PHP
Executable File
|
|
<div class="content-wrapper">
|
|
|
|
|
|
<section class="content">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header">
|
|
<center><b><h3 class="box-title">Requisition Approval List</h3></b></center>
|
|
</div>
|
|
<?php
|
|
$attributes = array('class' => 'form-label-left Approve ','name' => 'Approve','id' => 'Approve');
|
|
|
|
echo form_open(base_url().'requisitionform/SearchRequistList',$attributes); ?>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
<div class="modal fade" id="myModal" 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> Requisition Details - <span id="ReqNo"></span> </h4></center>
|
|
</div>
|
|
<div align="left">
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-4">
|
|
<label>Requistion Type</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'ReqType','value' => set_value('ReqType'),'id'=>'ReqType', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<label>Requested By</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'ReqBy','value' => set_value('ReqBy'),'id'=>'ReqBy', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Designation</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'Desigination','value' => set_value('Desigination'),'id'=>'Desigination', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="col-md-4">
|
|
<label>Requested Date</label>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'ReqDate','value' => set_value('ReqDate'),'id'=>'ReqDate', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<label>Cost Center Name</label>
|
|
<div class="form-group">
|
|
|
|
<?php
|
|
|
|
$data = array('name' => 'CostCenter','value' => set_value('CostCenter'),'id'=>'CostCenter', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
|
|
|
|
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Avl Budget Amt</label> <img id="AlertImg" src="<?php echo base_url(); ?>public/assets/dist/img/red.png" alt="your image" width="25px" style="display:none"/>
|
|
<div class="form-group">
|
|
<?php
|
|
$data = array('name' => 'AvlBudgetAmount','value' => set_value('AvlBudgetAmount'),'id'=>'AvlBudgetAmount', 'class' => 'form-control' ,'readonly' => 'true');
|
|
echo form_input($data);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<table id="Items" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
|
<div align="right" style="padding-right:10px">
|
|
|
|
<div class="modal fade" role="dialog">
|
|
|
|
<thead>
|
|
<tr>
|
|
|
|
<th>SNo</th>
|
|
<th>Item Code</th>
|
|
<th>Item Description</th>
|
|
<th>UOM</th>
|
|
<th>Requested Quantity</th>
|
|
<th>Ordered Quantity</th>
|
|
<th>Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="tbleAppend">
|
|
|
|
</tbody>
|
|
</div>
|
|
</div>
|
|
</table>
|
|
<div class="modal-footer"> <div class="col-md-12">
|
|
<a class="btn btn-info" data-dismiss="modal" value="Cancel">Ok</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<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>
|
|
<div class="modal fade" role="dialog">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>Requisition Number</th>
|
|
<th>Requested By</th>
|
|
<th>Requested Date</th>
|
|
<th>Status</th>
|
|
<th>Remarks</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="ApprovalList">
|
|
|
|
<?php
|
|
if(!empty($AppList))
|
|
{
|
|
$index = 0;
|
|
foreach($AppList 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->ReqNo ?>" ><u><?php echo $record->ReqNo ?></u></a></td>
|
|
<td><?php echo $record->FirstName ?></td>
|
|
<td align="right"><?php $Cdt = new DateTime($record->CreatedDate);
|
|
$CreatedDate = $Cdt->format('d-m-Y');
|
|
echo $CreatedDate;
|
|
?></td>
|
|
<td><?php echo $record->StatusName ?></td>
|
|
<?php if (($record->Status) == REQ_PENDING_APPROVAL || ($record->Status) == REQ_DRAFT)
|
|
{
|
|
|
|
?>
|
|
<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" 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">Approve</option>
|
|
<option value="3">Reject</option>
|
|
</select>
|
|
</td>
|
|
<?php
|
|
}
|
|
else
|
|
{
|
|
?>
|
|
<td><?php echo $record->Comments ?></td>
|
|
<td><?php echo $record->StatusName ?></td>
|
|
<?php
|
|
|
|
}
|
|
?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<br>
|
|
</div>
|
|
</div>
|
|
|
|
</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');
|
|
$('#ReqNo').html(ReqId);
|
|
$("#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]['FirstName']);
|
|
$("#ReqDate").val(json.Requist[0]['CreatedDate']);
|
|
$("#Desigination").val(json.Requist[0]['Designation']);
|
|
$("#CostCenter").val(json.Requist[0]['CostCenterName']);
|
|
$("#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: { Remarks: Remarks, Status: StatusCode, ReqNo: ReqId },
|
|
type: "POST",
|
|
url: "<?php echo base_url('requisitionform/ApproveRequest'); ?>",
|
|
success: function (data) {
|
|
if (data && data.message) {
|
|
alert(data.message);
|
|
location.reload(true);
|
|
} else {
|
|
alert("Error Occur");
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
|
|
alert("request failed: " + error);
|
|
}
|
|
});
|
|
$('#content').loader('hide');
|
|
|
|
}
|
|
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 () {
|
|
|
|
$('#Items').DataTable({
|
|
"paging": false,
|
|
"lengthChange": true,
|
|
"searching": false,
|
|
"ordering": false,
|
|
"info": false,
|
|
"autoWidth": false
|
|
|
|
});
|
|
$('#Requisition').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"columnDefs" : [{"targets":2, "type":"date-eu"}],
|
|
|
|
"aaSorting": [[ 2, "desc" ]],
|
|
"ordering": true,
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
});
|
|
</script>
|
|
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
|