ok
Direktori : /proc/self/root/home2/selectio/www/vijay-gases/data-tables/ |
Current File : //proc/self/root/home2/selectio/www/vijay-gases/data-tables/customer-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'id', 2 =>'customer_name', 3 =>'address', 4 =>'status', 5 =>'location_id', 6 =>'cust_type' ); $conditions=""; /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT e.*,tbl_location.name FROM tbl_customer e LEFT JOIN tbl_location ON e.location_id=tbl_location.id where 1=1 and e.cust_type=1 ".$conditions." ORDER BY e.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 e.*,tbl_location.name FROM tbl_customer e LEFT JOIN tbl_location ON e.location_id=tbl_location.id where 1=1 and e.cust_type=1 ".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( e.customer_name LIKE '%".$_REQUEST['search']."%') "; } /*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=1; foreach( $query as $row ) { // preparing an array $nestedData=array(); $action= "<div class='text-center'><div class='btn-group'>"; $action.="<a style='padding: 6px;margin-right: 3px;' href='modal/customer-edit.php?id=".$row["id"]."' data-toggle='ajax-modal' title='Edit Customer' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a> "; $action.="<a style='padding: 6px;margin-right: 3px;' href='modal/customer-view.php?id=".$row["id"]."' data-toggle='ajax-modal' title='View Customer' class='tip btn btn-success btn-xs'> <i class='fa fa-eye'></i> </a> "; $action.=" <button style='padding: 6px;margin-right: 3px;' title='Delete Users' onClick='delete_customer(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='fa fa-trash-o'></i> </button>"; $action.="</div></div>"; $nestedData[] = $action; $nestedData[] = $i; $nestedData[] = $row["customer_name"]; $nestedData[] = $row["cus_company_name"]; $nestedData[] = "<a href='tel:".$row["mobile_number"]."'>".$row["mobile_number"]."</a>"; $nestedData[] = $row["address"]; $nestedData[] = $row["name"]; if($row["gst_no"]!=''){$nestedData[] = "<span>".$row['gst_no']."</span>";}else{$nestedData[] = "<span>Null</span>";} if($row["cus_date"]!=''){$nestedData[] = "<span>".date('d-m-Y', strtotime($row['cus_date']))."</span>";}else{$nestedData[] = "<span>Null</span>";} if($row["status"]==1){ $nestedData[] ="<span class='btn btn-success btn-xs'><i class='fa fa-eye'></i> Active</span>";}else{$nestedData[] ="<span onClick='dynamic_active(".$row["id"].")' class='btn btn-danger btn-xs'><i class='fa fa-eye-slash'> In-active</span>";} $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>