PO
This commit is contained in:
parent
996d14e49d
commit
e35bd1a327
527
application/views/createPOfromRequistion.php
Normal file
527
application/views/createPOfromRequistion.php
Normal file
@ -0,0 +1,527 @@
|
||||
<?php $defaultDate =''; ?>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<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">
|
||||
<?php
|
||||
$attributes = array('class' => 'form-label-left CreatePO ','name' => 'CreatePO','id' => 'CreatePO','method' => 'post','role' => 'form' );
|
||||
|
||||
echo form_open($this->config->base_url().'PurchaseOrder',$attributes); ?>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<div>
|
||||
<center><b><h2> Siddharth Industries - Create Purchase Order from Requistion </h2></b></center><br/><br/>
|
||||
<div class="container-fluid">
|
||||
<div id="content"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<label>Select Department Name</label>
|
||||
<div>
|
||||
<?php
|
||||
$options = array("0"=>'Select Department Name');
|
||||
//print_r( $options);
|
||||
|
||||
if(!empty($DeptList))
|
||||
{
|
||||
foreach ($DeptList as $DID):
|
||||
|
||||
|
||||
$options[$DID->DEPCode] = $DID->DEPCode.' '.' - '.' '.$DID->DepartmentName;
|
||||
|
||||
endforeach;
|
||||
}
|
||||
|
||||
echo form_dropdown('drpDepartment', $options,set_value('drpDepartment'),'id="drpDepartment"' ,'class = "form-control required"','required="true"');
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Requistion Status</label>
|
||||
<div>
|
||||
<?php
|
||||
$StList = array("0"=>'Select Requistion Status');
|
||||
//print_r( $options);
|
||||
|
||||
if(!empty($stList))
|
||||
{
|
||||
foreach ($stList as $SID):
|
||||
$StList[$SID->StatusCode] = $SID->StatusCode.' '.' - '.' '.$SID->StatusName;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
echo form_dropdown('drpstatus', $StList,set_value('drpstatus'),'id="drpstatus"' ,'class = "form-control required"','required="true"');
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<!-- Date range -->
|
||||
<div class="form-group">
|
||||
<label>Requistion Date range:</label>
|
||||
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
<input type="text" class="form-control pull-right" id="ReqDate" name="ReqDate" >
|
||||
</div>
|
||||
<!-- /.input group -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div align="right">
|
||||
|
||||
<a class="btn btn-primary" onclick="Search()" >Search</a>
|
||||
<a class="btn btn-primary" onclick="Reset()" >Clear</a>
|
||||
</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" style="background-color: #3c8dbc;color:#fff;">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<center><h4> Requisition Details - <label id="SelReqNo" name="SelReqNo"></label> </h4></center>
|
||||
</div>
|
||||
<div align="left">
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4">
|
||||
<label>Request 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>Desigination</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>Requisition Date</label>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
$data = array('name' => 'RequistionDate','value' => set_value('RequistionDate'),'id'=>'RequistionDate', '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
|
||||
$options = array("0"=>'Select Cost Center');
|
||||
//print_r( $options);
|
||||
|
||||
|
||||
|
||||
echo form_dropdown('CostCenter', $options,set_value('CostCenter'),'id="CostCenter"' ,'class="form-control"');
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Available Budget Amount</label>
|
||||
<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>
|
||||
<div class="col-md-12">
|
||||
<table class="table table-bordered editableTable" style="border:1px solid #333">
|
||||
<div align="right" style="padding-right:10px">
|
||||
|
||||
<div class="modal fade" role="dialog">
|
||||
|
||||
<thead style="background-color:#fff">
|
||||
<tr>
|
||||
|
||||
<th>SNo</th>
|
||||
<th>Item Code</th>
|
||||
<th>Item Description</th>
|
||||
<th>UOM</th>
|
||||
<th>Quantity</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbleAppend">
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer"> <div class="col-md-12">
|
||||
|
||||
<a class="btn btn-info" data-dismiss="modal" value="Cancel">Ok</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table table-bordered editableTable" style="border:1px solid #333">
|
||||
<div align="right" style="padding-right:10px">
|
||||
|
||||
<div class="modal fade" role="dialog">
|
||||
|
||||
<thead style="background-color:#fff">
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Requistion Number</th>
|
||||
<th>Requistion Type </th>
|
||||
<th>Requisted By</th>
|
||||
<th>ReqDate</th>
|
||||
<th>Status</th>
|
||||
<th>Department</th>
|
||||
<th>Designation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="AppendReqList">
|
||||
<?php
|
||||
if(!empty($ReqList))
|
||||
{
|
||||
$index = 1;
|
||||
foreach($ReqList as $record)
|
||||
{
|
||||
?>
|
||||
<tr id="<?php echo $index; ?>">
|
||||
<td><input type="checkbox" name="chk<?php echo $index; ?>" id="chk<?php echo $index; ?>" onclick="selectReqNo(<?php echo $index; ?>)" /> </td>
|
||||
<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->ReqType; ?></td>
|
||||
<td><?php echo $record->FirstName; ?></td>
|
||||
<td><?php echo $record->ReqDate; ?></td>
|
||||
<td><?php echo $record->StatusName; ?></td>
|
||||
<td><?php echo $record->DepartmentName; ?></td>
|
||||
<td><?php echo $record->Designation; ?></td>
|
||||
</tr>
|
||||
<?php $index = $index + 1;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<div align="right" style="padding-right:10px">
|
||||
<!--<a href="<?php echo base_url(); ?>purchaseorderform/purchaseorder">
|
||||
<button type="button" class="btn btn-primary">Create PO</button></a> -->
|
||||
<input type="submit" class="btn btn-primary" value="Create Purchase Order">
|
||||
<input type="hidden" name="txtReqNo" id="txtReqNo" />
|
||||
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
<script>
|
||||
$('#ReqDate').val('');
|
||||
var Fromdt = '';
|
||||
var Todt = '';
|
||||
var baseurl = "<?php print base_url(); ?>";
|
||||
$(".RequisitionList").submit(function(e) {
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var id = '';
|
||||
var chk1 = $('#chk1').val();
|
||||
var chk2 = $('#chk2').val();
|
||||
var chk3 = $('#chk3').val();
|
||||
if( $('#chk1').is(":checked"))
|
||||
{
|
||||
id = '';
|
||||
}
|
||||
else if($('#chk2').is(":checked"))
|
||||
{
|
||||
id = '';
|
||||
}
|
||||
else if($('#chk3').is(":checked"))
|
||||
{
|
||||
id = '';
|
||||
}
|
||||
// alert(chk1);
|
||||
// alert(chk2);
|
||||
// alert(chk3);
|
||||
|
||||
window.location = baseurl +'purchaseorderform/purchaseorder';
|
||||
|
||||
|
||||
});
|
||||
//Date range picker
|
||||
$('#ReqDate').daterangepicker({
|
||||
locale: {
|
||||
format: 'YYYY/MM/DD'
|
||||
}
|
||||
});
|
||||
|
||||
$('#drpDepartment').change(function() {
|
||||
|
||||
var id = $('#drpDepartment').val();
|
||||
|
||||
if(id != '-1')
|
||||
{
|
||||
$('#content').loader('show');
|
||||
|
||||
$.ajax({
|
||||
data:{id:id},
|
||||
dataType: 'json',
|
||||
type:"POST",
|
||||
url:"<?php echo base_url();?>purchaseorder/getStatusByDepartment",
|
||||
success:function(json) {
|
||||
|
||||
$('#content').loader('hide');
|
||||
|
||||
$("#drpstatus").empty();
|
||||
$("#drpstatus").append(json.depStaus);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Please select the Employee details');
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function Search()
|
||||
{
|
||||
var dept = '';
|
||||
var status ='';
|
||||
//st = '';
|
||||
var val = $('#ReqDate').val();
|
||||
if($('#drpDepartment').val() != 0)
|
||||
{
|
||||
dept= $('#drpDepartment').val()
|
||||
}
|
||||
if($('#drpstatus').val() != 0)
|
||||
{
|
||||
status= $('#drpstatus').val()
|
||||
}
|
||||
var daterng = $('#ReqDate').val();
|
||||
DataColl = [];
|
||||
DataColl[0] = dept;
|
||||
DataColl[1] = status;
|
||||
DataColl[2] = daterng;
|
||||
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data:{id:DataColl},
|
||||
type:"POST",
|
||||
dataType: 'json',
|
||||
url:"<?php echo base_url() ?>purchaseorder/SearchListofRequistion",
|
||||
success:function(json) {
|
||||
// success:function(data) {
|
||||
$('#content').loader('hide');
|
||||
|
||||
$("#AppendReqList").empty();
|
||||
$("#AppendReqList").append(json.ReqList);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function Reset()
|
||||
{
|
||||
$('#drpDepartment').val("0");
|
||||
$('#drpstatus').val("0");
|
||||
$('#ReqDate').val('');
|
||||
}
|
||||
var coll = [];
|
||||
var RequistionList = {
|
||||
Req: []
|
||||
};
|
||||
|
||||
var Type ='';
|
||||
var i=0;
|
||||
|
||||
|
||||
function selectReqNo(rowId)
|
||||
{
|
||||
|
||||
ckb = $('#chk'+rowId).is(':checked');
|
||||
var tr = document.getElementById(rowId);
|
||||
var cellval = tr.cells;
|
||||
//coo/kie_value_add = {};
|
||||
if(!ckb )
|
||||
{
|
||||
|
||||
var removeItem = cellval[1].innerText;
|
||||
|
||||
|
||||
$.each(RequistionList.Req, function(i, el){
|
||||
|
||||
if (this.ReqNo == removeItem){//Type = '';
|
||||
RequistionList.Req.splice(i, 1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var tr = document.getElementById(rowId);
|
||||
var cellval = tr.cells;
|
||||
//alert(RequistionList.Req.length);
|
||||
if(RequistionList.Req.length > 0)
|
||||
{
|
||||
|
||||
if(Type == cellval[2].innerText )
|
||||
{
|
||||
|
||||
RequistionList.Req.push({
|
||||
"ReqNo" : cellval[1].innerText,
|
||||
"ReqType" : cellval[2].innerText,
|
||||
"ReqBy" : cellval[3].innerText,
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
alert('Same type of Requistion only can be together.')
|
||||
$('#chk'+rowId).attr('checked', false);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
RequistionList.Req.push({
|
||||
"ReqNo" : cellval[1].innerText,
|
||||
"ReqType" : cellval[2].innerText,
|
||||
"ReqBy" : cellval[3].innerText,
|
||||
});
|
||||
Type =cellval[2].innerText;
|
||||
|
||||
}
|
||||
|
||||
i= i +1;
|
||||
}
|
||||
|
||||
$('#txtReqNo').val(JSON.stringify(RequistionList));
|
||||
|
||||
}
|
||||
$("#myModal").on("shown.bs.modal", function(e) {
|
||||
var ReqId = $(e.relatedTarget).data('userid');
|
||||
$('#SelReqNo').html(ReqId);
|
||||
//alert(ReqId);
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data:{id:ReqId},
|
||||
type:"POST",
|
||||
dataType: 'json',
|
||||
url:"<?php echo base_url() ?>requisitionform/ViewRequest",
|
||||
success:function(json) {
|
||||
$('#content').loader('hide');
|
||||
//alert(json.Requist[0]['ReqDate']);
|
||||
$("#ReqType").val(json.Requist[0]['ReqType']);
|
||||
$("#ReqBy").val(json.Requist[0]['FirstName']);
|
||||
$("#RequistionDate").val(json.Requist[0]['ReqDate']);
|
||||
$("#Desigination").val(json.Requist[0]['Designation']);
|
||||
$("#CostCenter").empty();
|
||||
$("#CostCenter").append(json.Cost);
|
||||
|
||||
$("#tbleAppend").empty();
|
||||
$("#tbleAppend").append(json.Items);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
$('#CostCenter').change(function() {
|
||||
|
||||
var id = $('#CostCenter').val();
|
||||
$("#AvlBudgetAmount").val('');
|
||||
var ReqType = $('#ReqType').val();
|
||||
if(id != '-1')
|
||||
{
|
||||
$('#content').loader('show');
|
||||
|
||||
$.ajax({
|
||||
data:{id:id},
|
||||
dataType: 'json',
|
||||
type:"POST",
|
||||
url:"<?php echo base_url();?>requisitionform/getAvailableBudAmount?ReqType="+ReqType,
|
||||
success:function(json) {
|
||||
$('#content').loader('hide');
|
||||
$("#AvlBudgetAmount").val(json.Cost[0]['BudgetAmount']);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Please select the Employee details');
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user