Location: PHPKode > projects > MembersGear > membersgear/admin/admin_user_grid_get_payment_info.php
<?php 
require_once("../config/config.php");
require_once(INCLUDE_DIR."/users_class.php");
  
if(isset($_POST))
 {
    
   if(isset($_POST['userId'])) 
   {
        $uId=$_POST['userId'];  
        $sql="select userid,cast(GROUP_CONCAT( concat(ProductStatusCount,'-',products) separator '<br />') as char(500)) ProductMembershipStatus,payment
        from (
        select
              userid,count(tpu.productmembershipstatusid) ProductStatusCount,
                                  case when pmvp.value = 'Expire' then
               concat('<span style=\"color:red;font-weight:bold\">',pmvp.value,'</span>')
              when pmvp.value = 'Active' then
                  concat('<span style=\"font-weight:bold\">',pmvp.value,'</span>')
              when pmvp.value = 'Pending' or pmvp.value ='Inactive'
              then pmvp.value end as
              products,
             (SELECT replace(FORMAT(sum(amount),2),',','') as payment
              from ".TABLE_PREFIX."product_users   where   userid=tpu.userid  and productmembershipstatusid  in (SELECT mv.id  FROM
                     ".TABLE_PREFIX."master_values mv join ".TABLE_PREFIX."master m on m.id = mv.masterID where
                   m.Name = 'productmembershipstatus' and  mv.value!='Pending'
              )) as payment

             from ".TABLE_PREFIX."users u
             left join ".TABLE_PREFIX."product_users tpu on u.id=tpu.userid
             left join ".TABLE_PREFIX."master_values pmvp on pmvp.id = tpu.productmembershipstatusid
              where u.id in $uId group by u.id,tpu.userid,productmembershipstatusid

          ) a  group by userid" ;
         
          $userss = new users_class();
          $result=$userss->BaseView($sql);    
          $returnString='';
       
          foreach($result as $key=>$val){
            if($val['userid']=="")
              unset($result[$key]);
            else
              $returnString.=$val['userid'] . '||'.'<center>'.$val['payment'].'</center>'.'||'. $val['productmembershipstatus'].'|||';
              
          
          }
            if($result!=false and result!=null){
              
             echo $returnString;
            
          }
         else
           echo '';
           
        exit;   

    }
   else
     echo ''.'|||'.'';    
 }
exit;
?>
Return current item: MembersGear