siddharth_application/application/views/porelease_view.php
2018-05-22 14:58:28 +05:30

397 lines
9.0 KiB
PHP
Executable File

<?php
//echo "OUTIF";
if(empty($Status))
{
//echo "INIF";
//print_r($Status);
}
?>
<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;}
.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">Purchase Order Release List </h3></CENTER>
</div>
<div class="container-fluid">
<table id="Requisition" class="table table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Purchase Order Number</th>
<th>Purchase Order Type</th>
<th>Cost Center Name</th>
<th>Cost Center Code</th>
<th>Created By</th>
<th>Department</th>
<th>Created Date</th>
<th>Total Order Value</th>
<th>Approved By</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 ?> </td>
<td><?php echo $record->RType ?> </td>
<td><?php echo $record->CostCenterName ?> </td>
<td><?php echo $record->CostCenterCode?></td>
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->DepartmentName?></td>
<td align="right"><?php $Cdt = new DateTime($record->CreatedDate);
$CreatedDate = $Cdt->format('d-m-Y');
echo $CreatedDate;
?></td>
<td align="right"><?php echo $record->TotalOrderValue ?></td>
<td><?php echo $record->Approver?></td>
<td><?php echo $record->StatusName ?></td>
<?php
if($record->StatusName == 'RELEASER ONHOLD' or $record->StatusName == 'AWAITING RELEASE' or $record->StatusName == 'AMENDMENT PO'){
?>
<td>
<select name="selectId" id="selectId" onchange="showvalue('<?php echo $record->PONO ?>','<?php echo $index ; ?>',this.options[this.selectedIndex].value,'<?php echo $record->Remarks ?>');">
<option value="-1" >Select Action</option>
<option value="1">Release</option>
<option value="2">OnHold</option>
</select>
</td>
<?php }else{
echo "<td><center>-</center></td>";
}?>
<td contenteditable="true" id="remarks<?php echo $index ; ?>"><?php
if($record->Remarks == ''){
}
else{ echo $record->Remarks; }?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<br>
</div>
</div>
</section>
</div>
<script>
function showvalue(PONO,value,Status,Remark)
{
var Remarks='';
var curtremarks=document.getElementById('remarks'+value+'').innerHTML;
//var curtremarks = curtremarks.trim();
var PO=PONO;
var Status=Status;
var StatusCode='';
var srtMsg='';
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(PO+"-"+Status+"-"+StatusCode);
if(Status != '-1'){
if(Status == '1'){
var strMsg='Do you want to Release this Purchase Order?'
var StatusCode='ST026';
//alert(StatusCode);
}
else if(Status == '2')
{
var strMsg='Do you want to put Hold this Purchase Order?';
var StatusCode='ST052';
//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/ReleasePO",
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>
<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 () {
$('#Items').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
"info": false,
"autoWidth": false
});
$('#Requisition').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs" : [{"targets":6, "type":"date-eu"}],
"info": true,
"autoWidth": true
//"data-sort-name":Status
});
});
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>