include_once( 'config/global.inc.php' );
 
        $dbSql = new Bweb();
+       
        $clientid               = '';
     $client                    = '';
        $client_jobs    = array();
+       $backup_jobs    = array();
+       
+       $job_levels = array( 'D' => 'Differential', 'I' => 'Incremental', 'F' => 'Full' );
        
        $http_post = CHttpRequest::getRequestVars( $_POST ); 
        $http_get  = CHttpRequest::getRequestVars( $_GET );
        // Client informations
        $client = $dbSql->getClientInfos($clientid);
        
+       // Client's backup jobs
+       $query  = 'SELECT Job.Name, Job.Jobid, Job.Level, Job.Jobbytes, Job.Jobfiles, Status.JobStatusLong FROM Job ';
+       $query .= "LEFT JOIN Status ON Job.JobStatus = Status.JobStatus ";
+       $query .= "WHERE Job.ClientId = '$clientid' AND Job.JobStatus = 'T' ";
+    $query .= 'ORDER BY Job.EndTime DESC ';
+       $query .= 'LIMIT 1';
+       
+       try{
+               $jobs_result = $dbSql->db_link->runQuery($query);
+               
+               foreach( $jobs_result->fetchAll() as $job ) {
+                       $job['level']    = $job_levels[ $job['level'] ];
+                       $job['jobfiles'] = number_format( $job['jobfiles'], 0, '.', "'");
+                       $job['jobbytes'] = CUtils::Get_Human_Size( $job['jobbytes'] );
+                       
+                       $backup_jobs[] = $job;
+               }
+       }catch(PDOException $e) {
+               CDBError::raiseError($e);
+       }
+       $dbSql->tpl->assign( 'backup_jobs', $backup_jobs);
+       
        $dbSql->tpl->assign( 'client_name', $client['name']);
        $dbSql->tpl->assign( 'client_os', $client['os']);
        $dbSql->tpl->assign( 'client_arch', $client['arch']);
 
 {include file=header.tpl}
 
   <div id="nav">
-    <a href="index.php" title="Back to the dashboard">Dashboard</a> > Client(s) report
+    <a href="index.php" title="Back to the dashboard">Dashboard</a> > Client report
   </div>
 
   <div id="main_center">
   
   <div class="box">
-       <p class="title">Client(s) Report</p>
+       <p class="title">Client Report</p>
     <h4>Client informations</h4>       
     <table width="300px">
          <tr>
          </tr>
     </table>
        
+       <h4>Last good backup job</h4>
+       <table>
+               <tr>
+                       <td class="tbl_header">Name</td>
+                       <td class="tbl_header">Jod Id</td>
+                       <td class="tbl_header">Level</td>
+                       <td class="tbl_header">Bytes</td>
+                       <td class="tbl_header">Files</td>
+                       <td class="tbl_header">Status</td>
+               </tr>
+               {foreach from=$backup_jobs item=job}
+               <tr>
+                       <td class="{$job.Job_classe}">{$job.name}</td>
+                       <td class="{$job.Job_classe}">{$job.jobid}</td>
+                       <td class="{$job.Job_classe}">{$job.level}</td>
+                       <td class="{$job.Job_classe}">{$job.jobbytes}</td>
+                       <td class="{$job.Job_classe}">{$job.jobfiles}</td>
+                       <td class="{$job.Job_classe}">{$job.jobstatuslong}</td>
+               </tr>
+               {/foreach}
+       </table>
+       
   </div> <!-- end div class=box -->
   
   </div> <!-- end div id=main_center -->