395 lines
9.3 KiB
PHP
Executable File
395 lines
9.3 KiB
PHP
Executable File
|
|
<?php
|
|
//echo "OUTIF";
|
|
if(empty($Status))
|
|
{
|
|
//echo "INIF";
|
|
//print_r($Status);
|
|
}
|
|
?>
|
|
|
|
<style>
|
|
|
|
.modal-content {
|
|
width:1000px ! important;
|
|
}
|
|
|
|
.modal
|
|
{
|
|
padding-right:25% ! important;
|
|
}
|
|
</style>
|
|
<div class="content-wrapper">
|
|
<section class="content">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<CENTER><h3 class="box-title">Siddharth Industries - Purchase Order Approval List</h3></CENTER>
|
|
</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 style="background-color:#ddf">
|
|
<tr>
|
|
<th>Purchase Order Number</th>
|
|
<th>Purchase Order Type</th>
|
|
<th>Cost Center Name</th>
|
|
|
|
<th>Total Order Value</th>
|
|
<th>Created By</th>
|
|
<th>Created Date</th>
|
|
<th>Status</th>
|
|
<th>Action</th>
|
|
<th>Remarks</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="ApprovalList">
|
|
|
|
<?php
|
|
if(!empty($AppList))
|
|
{
|
|
$index = 0;
|
|
foreach($AppList as $record)
|
|
{
|
|
$index = $index +1;
|
|
//echo $index;
|
|
?>
|
|
<tr id="<?php echo $index ?>" >
|
|
|
|
|
|
<td><a target="_blank" href="<?php echo base_url() ?>purchaseorder/CreatePOPrint?PONO=<?php echo $record->PONO ?>&ReqType=<?php echo $record->RType ?>" data-id="<%=index%>" data-userid="<?php echo $record->PONO ?>" ><u><?php echo $record->PONO ?></u>
|
|
|
|
|
|
<?php if(($record->RType=='IMPORT' || $record->RType=='CAPITAL')&&($record->StatusCode!='ST015'))
|
|
{?>
|
|
|
|
<a target="_blank" href="<?php echo base_url() ?>purchaseorder/PurchaseOrderFinanceView?PONO=<?php echo $record->PONO ?>&ReqType=<?php echo $record->ReqType ?>&POType=<?php echo $record->RType.'&CapitalRange='.$record->CapitalRange; ?>" data-id="<%=index%>" data-userid="" ><u><i class="fa fa-eye" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to View the Purchase Order details"></i>
|
|
|
|
<?php }?>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td><?php echo $record->RType ?> </td>
|
|
<td><?php echo $record->CostCenterName ?> </td>
|
|
|
|
|
|
<td align="right"><?php echo $record->TotalOrderValue ?></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>
|
|
<td><?php if($record->StatusCode == PO_APPROVER_ONHOLD or $record->StatusCode == PO_CREATED or $record->StatusCode == REQITEM_Emergency_PO_CREATED ){ ?>
|
|
|
|
<select name="selectId" id="selectId" title="Select Your Option" onchange="showvalue('<?php echo $record->PONO ?>','<?php echo $index ; ?>',this.options[this.selectedIndex].value,'<?php echo $record->Remarks ?>');">
|
|
<option value="-1" >Select Option</option>
|
|
<option value="1">Approve</option>
|
|
<option value="2">OnHold</option>
|
|
</select>
|
|
|
|
|
|
<?php }
|
|
else
|
|
{
|
|
?>
|
|
|
|
-
|
|
|
|
<?php } ?>
|
|
</td>
|
|
|
|
|
|
<td contenteditable="true" id="remarks<?php echo $index ; ?>"> <?php
|
|
|
|
|
|
if($record->Remarks == ''){
|
|
|
|
}
|
|
else{ echo $record->Remarks; }?></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
|
|
</tbody>
|
|
</div>
|
|
</div>
|
|
</table>
|
|
<script>
|
|
function showvalue(PONO,value,Status,Remark)
|
|
{
|
|
//alert(value);
|
|
var Remarks='';
|
|
var curtremarks=document.getElementById('remarks'+value+'').innerHTML;
|
|
var curtremarks = curtremarks.trim();
|
|
//var lower = str.toLowerCase();
|
|
|
|
//alert("already"+Remark);
|
|
//alert("Current"+curtremarks);
|
|
//var curtremarks="CUR"
|
|
var PO=PONO;
|
|
//var val=value;
|
|
var Status=Status;
|
|
|
|
|
|
if((curtremarks == '<br>' || curtremarks == '') && Remark == ''){
|
|
Remarks='';
|
|
//alert("To Store both empty:-" + Remarks)
|
|
}
|
|
else if((curtremarks != '' && Remark == ''))
|
|
{
|
|
Remarks=curtremarks;
|
|
//alert("To Store current empty:-" + Remarks)
|
|
}
|
|
else if((Remark != '') && (curtremarks == '' || curtremarks == '<br>'))
|
|
{
|
|
Remarks=Remark;
|
|
//alert("To Store current empty:-" + Remarks)
|
|
}
|
|
else{
|
|
Remarks=Remark+"||"+curtremarks;
|
|
//alert("To Store both:-" + Remarks)
|
|
}
|
|
//alert(Remarks);
|
|
var StatusCode='';
|
|
var srtMsg='';
|
|
//alert(PO+"-"+Status+"-"+StatusCode+"-"+Remarks);
|
|
if(Status != '-1'){
|
|
if(Status == '1'){
|
|
var strMsg='Do you want to Approve this Purchase Order?'
|
|
var StatusCode='ST025';
|
|
//alert(StatusCode);
|
|
}
|
|
else if(Status == '2')
|
|
{
|
|
var strMsg='Do you want to put Hold this Purchase Order?';
|
|
var StatusCode='ST051';
|
|
//alert(StatusCode);
|
|
}
|
|
|
|
/* MSG*/
|
|
var answer = confirm(strMsg);
|
|
if (answer)
|
|
{
|
|
$('#content').loader('show');
|
|
$.ajax({
|
|
data:{PONO:PO,SCode:StatusCode,NewRemarks:Remarks},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>purchaseorder/ApprovePO",
|
|
success:function(data) {
|
|
if(data)
|
|
{
|
|
$('#content').loader('hide');
|
|
alert(data);
|
|
location.reload();
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
/* MSG*/
|
|
|
|
}
|
|
else
|
|
{
|
|
alert('please Select Status!');
|
|
}
|
|
|
|
|
|
} //End of showvalue function for approve/hold po status
|
|
</script>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
</div>
|
|
|
|
<script>
|
|
var startDate = '';
|
|
var endDate = '';
|
|
|
|
function Reset()
|
|
{
|
|
$('#RequisitionStatus').val("-1");
|
|
$('#SearchDate').val('');
|
|
}
|
|
<!-- JQuery For POP UP and Getting all relevant Data -->
|
|
$("#myModal").on("shown.bs.modal", function(e) {
|
|
var ReqId = $(e.relatedTarget).data('userid');
|
|
$("#RequistionNo").val('');
|
|
$("#drpSupplier").val('');
|
|
$("#POType").val('');
|
|
$("#Tax Range").val(''); //not conform
|
|
$("#SupAddress").val('');
|
|
$("#DeliveryAddr").val('');
|
|
$("#PODate").val('');
|
|
$("#Deliverydt").val('');
|
|
$("#tbleAppend").empty();
|
|
$("#txtTotBasicAmount").val('');
|
|
$("#txtTotalDiscount").val('');
|
|
$("#txtTotalVat").val('');
|
|
$("#txtTotCST").val('');
|
|
$("#txtTotalPackaing").val('');
|
|
$("#txtTotExciseDuty").val('');
|
|
$("#txtTotalGST").val('');
|
|
$("#txtTotalInsurance").val('');
|
|
$("#txtTotalFreight").val('');
|
|
$("#txtTotalOtherTaxes").val('');
|
|
$("#txtTotalOrderValueSummary").val('');
|
|
$("#txtSpcialInstruction").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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
<!-- End of JQuery For POP UP and Getting all relevant Data -->
|
|
|
|
function printpdf(PONO,value,Status) {
|
|
|
|
|
|
var PONO =PONO;
|
|
var Status = Status;
|
|
var value = value;
|
|
alert(PONO+Status+value);
|
|
|
|
if(PONO != '' && Status != '' && value != ''){
|
|
alert('inside if '+PONO+Status+value);
|
|
|
|
$.ajax({
|
|
data:{PONO1:PONO,Status1:Status},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>purchaseorder/Poprintpdf",
|
|
/*success:function(data) {
|
|
if(data)
|
|
{
|
|
alert(data);
|
|
}
|
|
else
|
|
{
|
|
alert("Error");
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
});
|
|
|
|
}
|
|
else{
|
|
alert('inside else '+PONO+Status+value);
|
|
}
|
|
}
|
|
|
|
|
|
$(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,
|
|
"columnDefs" : [{"targets":5, "type":"date-eu"}],
|
|
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
});
|
|
</script>
|
|
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
|
|
|