Location: PHPKode > projects > MembersGear > membersgear/includes/report_class.php
<?php
    require_once "peardb_class.php";
    require_once INCLUDE_DIR."/PaygearWebserviceClient.php";
    
 class report_class extends peardb_class
 {  
 
     function View($pQuery, $pValues=false, $types=true, $pStart=0, $pEnd=0)
    {
        /*
        global $mdb2;    
        $result;  
 
        $query      = 'SELECT * FROM tbluser1 t limit 10;';
        $resultset  = $mdb2->query($query);
        
        if(PEAR::isError($resultset)) 
        {
            die("Failed to issue query, error message : " . $resultset->getMessage());
        }
        
        while($row = $resultset->fetchRow(MDB2_FETCHMODE_ASSOC))
        {
            $result[] = $row;
        }
                                                                                                                 
        return  $result;   
        */
        //print_r($pParameters);
        
        return $this->BaseView($pQuery,$pValues,$types,$pStart,$pEnd);
        
    }
    
    function Update($pQuery, $pValues=false, $types=true)
    { 
       
        return $this->BaseUpdate($pQuery, $pValues, $types);
    
    }

    
    function Insert($pQuery, $pValues=false, $types=true)
    { 
    
        return $this->BaseInsert($pQuery, $pValues, $types);
    
    }
    
     function delete($pQuery, $pValues=false, $types=true)
    {
        
      return $this->BaseDelete($pQuery, $pValues,null);
        
    } 
    function fillreportcombo()
    {
         $lafillreport=array();
         $lafillreport[0]="All Sales I Made";
         $lafillreport[1]="My Product Sales";
         $lafillreport[2]="My Product Sales I Made";
         $lafillreport[3]="My Product Sales Affiliates Made";
         $lafillreport[4]="Affiliates Sales I Made";
         return  $lafillreport;    
        
    }  
    function fillpresetcombo()
    {
    
       /* $lafillpreset=array();
        $PaygearWebserviceClient1=new PaygearWebserviceClient();
        $lapreset=$PaygearWebserviceClient1->GetPaygearPresetTimeDurations();  
        $sp="!@#$%^&*()";
        foreach($lapreset as $key=>$value)
        {
          
            $value1=str_replace($sp,'|',$value);
             $value2=substr($value1,0,strpos($value1,'|'));
           
             $arrayvaue=substr($value1,strpos($value1,'|')+1);  
                
              $lafillpreset[$value2]= $arrayvaue;
     
        }
        
        if(is_array($lafillpreset))
        {    
               if(count($lafillpreset))
               {
                   $_SESSION[SESSION_PREFIX.'fillpresetcombo']=$lafillpreset; 
                  // return $lafillpreset; 
               } 
               
        }  */
        $larrpreset = array();
        $m= date("m"); // Month value
        $de= date("d"); //today's date
        $y= date("Y"); // Year value
       $larrpreset['Today']= date('m/d/Y') .','. date('m/d/Y');
       $larrpreset['Yesterday']= date('m/d/Y', mktime(0,0,0,$m,($de-1),$y)) .','. date('m/d/Y', mktime(0,0,0,$m,($de-1),$y)) ;
       $larrpreset['Last 7 Days']=  date('m/d/Y', mktime(0,0,0,$m,($de-7),$y)) .','. date('m/d/Y');
       $larrpreset['Last 14 Days']= date('m/d/Y', mktime(0,0,0,$m,($de-14),$y)) .','. date('m/d/Y');
  
      for($i=0;$i<=12;$i++)
      {
          if($i == 0)
          {
              $larrpreset['Current Month']= date('m/d/Y', mktime(0,0,0,($m-$i),1,$y)) .','. date('m/d/Y'); 
          }
          else
          {
              $larrpreset[date('F', mktime(0,0,0,($m-$i),1,$y))]= date('m/d/Y', mktime(0,0,0,($m-$i),1,$y)) .','. date('m/d/Y', mktime(0,0,0,($m-$i),date('t', mktime(0,0,0,($m-$i),1,$y)),$y)); 
          }
      }
       return $larrpreset;  
      
     }  
     
     function GetPaygearVendorLessProfitData($plagetprofitreport)
     { 
        $lapaygearupdateinfo=array();
        $sp="!@#$%^*()";
        foreach($plagetprofitreport['string'] as $key=>$value)
        {
              $value1=str_replace($sp,'|',$value);
              $value2=substr($value1,0,strpos($value1,'|'));
              $arrayvaue=substr($value1,strpos($value1,'|')+1);  
              $lapaygearupdateinfo[]=$arrayvaue;
        
        }
     
        return  $lapaygearupdateinfo;
     }
      function GetPaygearVendorMoreProfitData($plagetprofitreport)
     { 
        $lapaygearupdateinfo=array();
        
        
        $sp="!@#$%^*()";
       //print_r($plagetprofitreport);
       //print_r($testarray);
       
        foreach($plagetprofitreport  as  $key=>$value)
        {
         
          $lapaygearupdateinfo[$key]=explode($sp,$value);
           //$lapaygearupdateinfo[]=str_replace($sp,'|',$plagetprofitreport['string'] ); 
        }
      // print_r($lapaygearupdateinfo);
        return  $lapaygearupdateinfo;
        }
     
     function spliteValuesofReport($pstring)
     {
       $arr=explode("!@#$%^*()",$pstring);
       return $arr;
         
     }
     
     function getsubReportData($arry,$orderId)
     {
         $tblid="tbl".$orderId;
         $tblid1="'".$tblid."'";
         $linkId="tbllnk".$orderId;
         $linkId1="'".$linkId."'";
         $subtable="tblsub".$orderId;
         $subtable.="'".$subtable."'";
         $reportDisplay="";
         $flag=false;
         $reportDisplay.='
                           <tr>
                            <td align="left" style="width: 50px;"/><td align="left" colspan="12"><a style="font-weight: bold;" href="javascript: return false;" onclick="SwitchBox('.$tblid1.','.$linkId1.');return false;" id="'.$linkId.'"><b>More Detail</b></a>
                            <table border="0" style=" width: 700px;%;display:none;" id="'.$tblid.'">
                                <tbody><tr>
                                    <td><div>
                                        <table cellspacing="0" cellpadding="3" border="0" style="border-collapse: collapse; width: 90%;" class="PGridStyle";id="'.$subtable.'">
                                            <tbody>
                                            <tr>
                                                <th scope="col" style="height:21px;">OrderDate</th><th scope="col">TransactionType</th><th scope="col">PaymentStatus</th><th scope="col">VendorPaymentStatus</th><th scope="col">Amount</th>
                                            </tr>
                                            ';
         $len=sizeof($arry);
         for($i=1;$i<$len;$i++)
          {
                 $string=$arry[$i];
                 $splitedArr=explode("!@#$%^*()",$string);
                 
                 if($splitedArr[sizeof($splitedArr)-1]==$orderId)
                   {
                         
                         $arr1len=strlen($splitedArr[0]);
                                if($arr1len>17)
                                {
                                   $firstString=substr($splitedArr[0],0,12);
                                   $secondString=substr($splitedArr[0],12);
                                   $splitedArr[0]=$firstString."\n".$secondString;
                                
                                }
                                
                          $arr1len=strlen($splitedArr[1]);
                                if($arr1len>17)
                                {
                                   $firstString=substr($splitedArr[1],0,12);
                                   $secondString=substr($splitedArr[1],12);
                                   $len2=strlen($secondString);
                                   if($len2>17)
                                    {
                                      $secstringSub1=substr($secondString,0,17);   
                                      $secstringSub2=substr($secondString,17);  
                                      $secondString=$secstringSub1."<br>".$secstringSub2;
                                    }
                                   $splitedArr[1]=$firstString."<br>".$secondString;
                                
                                }   
                            $arr1len=strlen($splitedArr[3]);
                                if($arr1len>17)
                                {
                                   $firstString=substr($splitedArr[3],0,12);
                                   $secondString=substr($splitedArr[3],12);
                                   $splitedArr[3]=$firstString."<br>".$secondString;
                                
                                }
                           $arr1len=strlen($splitedArr[4]);
                                if($arr1len>17)
                                {
                                   $firstString=substr($splitedArr[4],0,12);
                                   $secondString=substr($splitedArr[4],12);
                                   $splitedArr[4]=$firstString."<br>".$secondString;
                                
                                }             
                          $reportDisplay.='<tr>
                                                <td align="left">'.trim($splitedArr[0]).'</td><td align="left">'.trim($splitedArr[1]).'</td><td align="left">'.trim($splitedArr[2]).'</td><td align="left">'.trim($splitedArr[3]).'</td><td align="right">'.trim($splitedArr[4]).'</td>
                                            </tr>';
                           $flag=true;                 
                   }    
                       
                       
                          
          }
         
         $reportDisplay.='</tbody></table>
                                    </div></td>
                                </tr>
                            </tbody></table></td>
                        </tr><tr><td><br></td></tr>'; 
          if($flag==true)
            return $reportDisplay; 
     
     
     }
     
     
 }
?>
Return current item: MembersGear