ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/data-tables/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/data-tables/shipment-datatable.php |
<?php include("../inc/config.php"); ob_start(); header('Content-Type: application/json'); $status="pending"; try{ /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'awb_no', 2 =>'ref_no', 3 =>'cust_code', 4 =>'client_name', 5 =>'address', 6 =>'pincode', 7 =>'phone', 8 =>'a_weight', 9 =>'c_weight', 10 =>'pics', 11 =>'created_at', 12 =>'cust_name', 13 =>'destination' ); /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_user.full_name as client_name,tbl_customer.cust_code as cust_code,material_desc.full_desc as content,tbl_customer.cust_name as cust_name FROM pickup_entry INNER JOIN tbl_user INNER JOIN tbl_customer INNER JOIN material_desc on pickup_entry.client_id=tbl_user.id AND pickup_entry.content_desc=material_desc.id AND pickup_entry.customer_id=tbl_customer.cust_id and pickup_entry.status='pending' and tbl_user.role='Modicare' order by pickup_entry.id DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT pickup_entry.*,tbl_user.full_name as client_name,tbl_customer.cust_code as cust_code,material_desc.full_desc as content,tbl_customer.cust_name as cust_name FROM pickup_entry INNER JOIN tbl_user INNER JOIN tbl_customer INNER JOIN material_desc on pickup_entry.client_id=tbl_user.id AND pickup_entry.content_desc=material_desc.id AND pickup_entry.customer_id=tbl_customer.cust_id and pickup_entry.status='pending' and tbl_user.role='Modicare' "; $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']." "; // $requestData['order'][0]['column'] contains colmun index, $requestData['order'][0]['dir'] contains order such as asc/desc */ $statement = $pdo->prepare($sql); $s_query=$sql; $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); $i=1; foreach( $query as $row ) { // preparing an array $nestedData=array(); $nestedData[] =$i; $nestedData[] = $row["ref_no"]; $nestedData[] = $row["cust_code"]; $nestedData[] = $row["client_name"]; $nestedData[] = $row["address"]; $nestedData[] = $row["destination"]; $nestedData[] = $row["pincode"]; $nestedData[] = $row["phone"]; $nestedData[] = $row["a_weight"]; $nestedData[] = $row["c_weight"]; $nestedData[] = $row["pics"]; $nestedData[] = $row["cust_name"]; $data[] = $nestedData; $i++; } $json_data = array( "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 echo "fdgd".$totalData; print_r("ffffffffff".json_encode($data));; } catch(exception $e){ echo $e; } ?>