ok
Direktori : /home2/selectio/www/y1jobportal.in/admin/ui-pages/orders/data-tables/ |
Current File : //home2/selectio/www/y1jobportal.in/admin/ui-pages/orders/data-tables/order-dt.php |
<?php ob_start(); session_start(); $session_id = $_SESSION['speed_connect']; $session_user_type = $_SESSION['sc_user_type']; include("../../../api/config/config.php"); $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'order_id', 2 =>'cust_firstname', 3 =>'cust_mobile', 4 =>'shipping_address_pincode', 5 =>'shipping_address1', 6 =>'shipping_address_city', 7 =>'shipping_address_state', ); $where=''; if(isset($_POST['status']) && $_POST['status']!='all'){ if($_POST['status']==5){ $where.=" and (shipment_updated_status='5' or shipment_updated_status='6' or shipment_updated_status='7' ) "; }else{ $where.=" and shipment_updated_status='".$_POST['status']."'"; } } if($_SESSION['speed_connect']['id'] && $_SESSION['sc_user_type']==2){ $where.=" and client_id='".$_SESSION['speed_connect']['id']."'"; } /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT * FROM shipment where 1=1 $where ORDER BY id DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT * FROM shipment where 1=1 $where"; if( !empty($requestData['search']['value']) ) { $sql.=" AND ( id LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR order_id LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR cust_firstname LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR cust_mobile LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR shipping_address_pincode LIKE '%".$requestData['search']['value']."%' ) "; } $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalFiltered = $statement->rowCount(); /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); $i=$requestData['start']+1; foreach($query as $row){ // preparing an array $nestedData=array(); $action='<button class="small-btn btn-purple-bg"> Clone Order</button><br> <div class="dropdown"> <button class="small-btn btn-gray-bg dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Action</button> <ul class="dropdown-menu" style=""> <li><a class="dropdown-item" href="#">View Order Info</a> </li> <li><a class="dropdown-item" href="#">Print Invoice</a> </li> <li><a class="dropdown-item" href="#">Print Lable</a> </li> </ul> </div>'; $pickup_address_rto_address=""; $statement = $pdo->prepare("SELECT * FROM `pickup_address` where id='".$row['pickup_id']."'"); $statement->execute(); $pickup_id = $statement->fetchAll(PDO::FETCH_ASSOC); $statement = $pdo->prepare("SELECT * FROM `pickup_address` where id='".$row['rto_pickup_id']."'"); $statement->execute(); $rto_pickup_id = $statement->fetchAll(PDO::FETCH_ASSOC); if($pickup_id){ $pickup_address_rto_address.="<b>".$pickup_id[0]['name']."</b>,".$pickup_id[0]['mobile']; // $pickup_address_rto_address.="<br>Address:".$pickup_id[0]['address_line1']." ".$pickup_id[0]['address_line1']; $pickup_address_rto_address.="<br>".$pickup_id[0]['city']."-".$pickup_id[0]['pincode'].",".$pickup_id[0]['state'].",".$pickup_id[0]['country']; } if($rto_pickup_id){ $pickup_address_rto_address.="<br><center>----------------</center>"; $pickup_address_rto_address.="<b>".$rto_pickup_id[0]['name']."</b>,".$rto_pickup_id[0]['mobile']; // $pickup_address_rto_address.="<br>Address:".$pickup_id[0]['address_line1']." ".$pickup_id[0]['address_line1']; $pickup_address_rto_address.="<br>".$rto_pickup_id[0]['city']."-".$rto_pickup_id[0]['pincode'].",".$rto_pickup_id[0]['state'].",".$rto_pickup_id[0]['country']; } $order_details='<a >'.($row['order_id']).'</a><br> '.date("d M Y", strtotime($row['order_date'])).' | '.date("h:m A", strtotime($row['order_date'])).'<br> <b>Package Details</b>'; $pickup_rto_details='<a >'.($row['order_id']).'</a><br> '.$row['order_date'].' | 00:00 PM<br> <b>Package Details</b>'; $nestedData[] = $action; $nestedData[] = $order_details; $nestedData[] = ' '.$row['cust_firstname'].' <br> '.$row['cust_mobile'].''; $nestedData[] = '<span class=" span-success">'.$row['payment_method'].'</span>'; $nestedData[] = $pickup_address_rto_address; if($row['carrier_awb']!=''){ $nestedData[] = ' AWB :<b style="color: #f99631;font-weight: 900;">'.$row['carrier_awb'].'</b>'; }else{ $nestedData[] = ' AWB # <br>Not Assigned'; } $nestedData[] = '<span class=" span-danger">'.$row['shipment_updated_status_name'].'</span><br> On '.date("d M Y", strtotime($row['shipment_updated_date'])).''; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. "recordsTotal" => intval( $totalData ), // total number of records "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData "data" => $data // total data array ); echo json_encode($json_data); // send data as json format ?>