ok
Direktori : /proc/self/root/home2/selectio/www/y1jobportal.in/admin/data-tables/ |
Current File : //proc/self/root/home2/selectio/www/y1jobportal.in/admin/data-tables/client-dt.php |
<?php include("../api/config/config.php"); $requestData= $_REQUEST; $condition=''; $status = $_POST['status']; $category_id = $_POST['category_id']; $state_id = $_POST['state_id']; $district_id = $_POST['district_id']; $business_type = $_POST['business_type']; $payment_status = $_POST['payment_status']; $created_user = $_POST['created_user']; $followup_id = $_POST['followup_id']; $subscription_id = $_POST['subscription_id']; $condition =''; $city = $_SESSION['y1_jobs']['city'] ?? null; if($_SESSION['y1_jobs']['role_json'] == 2){ $condition.= " and client.district_id IN ($city)" ; } if($business_type!=""){ $condition.=" and client.business_type = '".$business_type."' "; } if($status!=""){ $condition.=" and client.status = ".$status; } if($category_id!=""){ $condition.=" and client.category_id = ".$category_id; } if($state_id!=""){ $condition.=" and client.state_id = ".$state_id; } if($district_id!=""){ $condition.=" and client.district_id = ".$district_id; } if($payment_status!=""){ $condition.=" and client.payment_status = ".$payment_status; } if($created_user!=""){ $condition.=" and client.emp_id = ".$created_user; } if($followup_id!=""){ $condition.=" and client.follow_up_id = ".$followup_id; } if($subscription_id!=""){ $condition.=" and client.plan_id = ".$subscription_id; } // if($districtid!="" && $districtid!=NULL ){ // $condition.=" and client.district_id = ".$districtid; // } /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'id', 2 =>'firstname', 3 =>'mobile', 4 =>'email', 5 =>'password', 6 =>'city', 7 =>'address', ); /*Fetch All Data Start*/ $statement = $pdo->prepare(" SELECT d.district_name,client.payment_status as paymnt, client.*,follow_up_status.name as follow_name,subscription.name as sub_name FROM client INNER JOIN follow_up_status ON follow_up_status.id=client.follow_up_id INNER JOIN district d on d.id = client.district_id LEFT JOIN subscription ON client.plan_id=subscription.id ORDER BY client.id DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT d.district_name, client.payment_status as paymnt,client.*,follow_up_status.name as follow_name,subscription.name as sub_name FROM client INNER JOIN district d on d.id = client.district_id INNER JOIN follow_up_status ON follow_up_status.id=client.follow_up_id LEFT JOIN subscription ON client.plan_id=subscription.id where 1=1 $condition"; if( !empty($requestData['search']['value']) ) { $sql.=" AND ( client.id LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR client.firstname LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR client.lastname LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR client.company_name LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR client.mobile LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR client.email LIKE '%".$requestData['search']['value']."%' "; $sql.=" OR client.city 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(); /*Get Plan Details Start*/ $totalDatas=''; $statement_plan = $pdo->prepare("SELECT a.*,b.* FROM tbl_subscription_details a INNER JOIN subscription b on b.id = a.plan_id where a.status=1 and a.customer_id=? "); $statement_plan->execute([$row['id']]); $query_datas = $statement_plan->fetchAll(PDO::FETCH_ASSOC); $totalDatas = $statement_plan->rowCount(); /*Get Plan Details End*/ $action = ''; $action= "<div class='text-center'><div class='btn-group'>"; $action.="<a style='padding: 0px 0px 0px 5px; height: 30px; margin-right: 3px;' href='add-client.php?id=".$row["id"]."' title='Edit Client' class='tip btn btn-warning btn-xs'> <i class='bi bi-pencil'></i> </a> "; $action.=" <button style='padding: 0px 0px 0px 5px; height: 30px; margin-right: 3px;' title='Delete Client Details' onClick='delete_client(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='bi bi-trash3'></i> </button>"; $action.="</div></div>"; $client_details='<a >'.($row['firstname'].' '.$row['lastname']).'</a>'; if(isset($row['mobile'])){ $client_details.="<br>Mobile :<b>".$row['mobile']."</b>";} if(isset($row['email'])){ $client_details.="<br>Email :<b>".$row['email']."</b>";} if(isset($row['password'])){ $client_details.="<br>Password :<b>".$row['password']."</b>";} if(isset($row['district_name'])){ $client_details.="<br> District Name :<b>".$row['district_name']."</b>";} $company_details='<a >'.($row['company_name']).'</a>'; if(isset($row['gst_no'])){ $company_details.="<br>GST :<b>".$row['gst_no']."</b>";} if(isset($row['kyc_status'])){$kyc="<span class='span-success'> Verified </span>"; } else{$kyc="<span class='span-danger'> Not Verified </span>";} // Current Status Start Here $current_status = ''; $current_status.="Active Plans :<b> ".$totalDatas." </b></br>"; if($row['plan_id']=='' || $row['plan_id']==0){ $current_status.="Subscription :<b> Not Updated </b>"; } else { $current_status .= "Subscription: <b>" . (!empty($query_datas[0]['name']) ? $query_datas[0]['name'] : 'Nil') . "</b>"; } if($row['paymnt']=='1'){ $current_status.=" <br>Payment Status :<b> Completed </b>";} else{ $current_status.="<br>Payment Status :<b> Pending </b>";} if($row['follow_name']=='' || $row['follow_up_id']==0){ $current_status.="<br> Followup Status :<b> Not Updated </b>";} else { $current_status.="<br>Followup Status :<b> ".$row['follow_name']." </b>";} // Current Status End Here $nestedData[] = $action; $nestedData[] = $i; $nestedData[] = $client_details; if($row['logo']!=""){ $nestedData[] = '<img src="'.$row['logo'].'" style="width: 65px;height: 65px;border-radius: 10px;">'; }else{ $nestedData[] = '<img src="upload/y1.png" style="width: 65px;height: 65px;border-radius: 10px;">'; } $nestedData[] = $company_details; $nestedData[] = $row['business_type']; /* $nestedData[] = $kyc;*/ $nestedData[] = $current_status; if(isset($row['status'])=="Active"){$status="<span class='span-success'> Active </span>"; } else{$status="<span class='span-danger'> In-Active </span>";} $ids = $row['id']; $nestedData[] ="<center><a href='payment_change.php?id=".$ids."'>update</a></center>"; $nestedData[] = $status; $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 ?>