JezK
Edit File: shipmentStatus-ajax-list.php
<?php include_once("adminObj.php"); include('checkSession.php'); $data =array(); $limit = ""; $tableColumns = array('uar.quotation_id::TEXT','uar.warehouse_id::TEXT','umw.warehouse_name','uar.created_date::TEXT','uws.request_status','uar.price::TEXT','uar.date::TEXT','uu.first_name','uu.last_name','uar.asn_status::TEXT'); if (isset($_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' ) { $limit = "OFFSET ".$customerObj->db->escape($_GET['iDisplayStart'] )." LIMIT ". $customerObj->db->escape($_GET['iDisplayLength'] ); } $order="order by uar.date desc"; $whereCondition = ""; if(isset($_SESSION['customer_user_id']) && $_SESSION['customer_user_id'] != ""){ $whereCondition = "where uar.user_id=".$_SESSION['customer_user_id'].""; } if ( $_GET['sSearch'] != "" ) { $whereCondition.= "and ("; for ( $i=0 ; $i<count($tableColumns) ; $i++ ) { $whereCondition .= $tableColumns[$i]." ILIKE '%".$customerObj->db->escape($_GET['sSearch'] )."%' OR "; } $whereCondition = substr_replace( $whereCondition, "", -3 ); $whereCondition .= ') '; } $sql="select urq.currency_type,uc.currency,uar.asn_status,umw.warehouse_name,uu.first_name,uu.last_name,uar.date, uar.warehouse_id,uar.price, urq.warehouse_request_type,urq.from_date ,uar.quotation_id ,uws.request_status from uflexit_asn_request as uar join uflexit_request_quote as urq on uar.quotation_id=urq.quotation_id join uflexit_master_warehouse as umw on umw.warehouse_id=uar.warehouse_id join uflexit_users as uu on uu.user_id=uar.user_id join uflexit_warehouse_status as uws on urq.warehouse_request_type=uws.status_type join uflexit_countries as uc on uc.country_id=urq.currency_type $whereCondition $order $limit "; // echo $sql; $rows = $customerObj->db->get_results($sql); $sql2="select umw.warehouse_name,uu.first_name,uu.last_name, uar.warehouse_id,uar.price, urq.warehouse_request_type,urq.from_date ,uar.quotation_id,uws.request_status from uflexit_asn_request as uar join uflexit_request_quote as urq on uar.quotation_id=urq.quotation_id join uflexit_master_warehouse as umw on umw.warehouse_id=uar.warehouse_id join uflexit_users as uu on uu.user_id=uar.user_id join uflexit_warehouse_status as uws on urq.warehouse_request_type=uws.status_type $whereCondition "; $rows = $rows ? $rows : array(); $totalRecord = count($rows); $rows2 = $customerObj->db->get_results($sql2); $totalRecords =$rows2 ? count($rows2):0; if($totalRecord>0) { $j=1; foreach($rows as $fetch) { $currency='SAR'; $fetch['name']=$fetch['first_name'].' '.$fetch['last_name']; $fetch['price']="<span class='priceValue' title='".$fetch['price']."'>".$fetch['price']."</span>"; $fetch['currency']="<span class='currencyType'>".$fetch['currency']."</span>"; $fetch['action']='<small class="d-inline-flex tableData smallFont"> <a href="view_shipment_status.php?id='.$fetch['quotation_id'].'" class="pl-md-2" title="view details"> <img src="./images/view.png"></a> </small>'; $date=date_create($fetch['date']); $fetch['date']=date_format($date,"d-m-Y"); $data[]=$fetch; } } $data = ["sEcho" => intval($_GET['sEcho']), "iTotalRecords" => $totalRecord, "iTotalDisplayRecords" => $totalRecords, "aaData" => $data ]; echo json_encode($data); exit; ?>