<?php 
//*********************START HERE*********************AMIT SINGH****************30-10-2012******************************
//$ClientSQL=DB_query("Select * from clientmaster where CompanyId='".$_SESSION['ACGCompanyId']."' and  Site in('".$_SESSION['AssignedBranch']."') 
		//and Zone in(".$_SESSION['AssignedSites'].")",$db);

?>
<table width="100%" border="1" cellspacing="0" cellpadding="3">
  <tr>
    <td class="tabledata" style="font-size:10px;">Client</td>
    <td class="tabledata" style="font-size:10px;">Order No </td>
    <td class="tabledata" style="font-size:10px;">Date</td>
     <td class="tabledata" style="font-size:10px;">Delivery Date</td>
    <td class="tabledata" style="font-size:10px;">Created By</td>
  </tr>
<?php //$i=0; while($DistinctClient=DB_fetch_array($ClientSQL)) {
$SQlpendOrder=DB_query("SELECT orderNo,orderDate,client,createdBy,DeliveryDate FROM salesorder 
INNER JOIN salesorder_details 
ON (salesorder.id=salesorder_details.masterId) 
WHERE salesorder_details.ApprovalStatus='1' GROUP BY  salesorder.id
ORDER BY DeliveryDate DESC LIMIT 0,6",$db);
 while($PendOrder=DB_fetch_array($SQlpendOrder)) {
//$Test=DB_num_rows($SQlClint);

//$dataarray[]=array('client' => $DistinctClient['c_name'], 'basic' => $Test);	
//}
//foreach ($dataarray as $key => $row)
 // {   
  // $volume[$key]  = $row['basic'];
 //  $edition[$key] = $row['client'];
 // }  
//array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $dataarray);
 //$k=0;
// foreach ($dataarray as $key => $row2)
  // {
/// if($row2['basic']!='0'){
// $i++;
// if($i<4){
?>  
  <tr>
    <td class="tabledata_fist" style="font-size:10px;"><?php echo $s->GetFieldValue('clientmaster',"id='".$PendOrder['client']."'",'c_name');?></td>
    <td class="tabledata1" style="font-size:10px;"><?php echo $PendOrder['orderNo']; ?></td>
     <td class="tabledata1" style="font-size:10px;"><?php echo ConvertSQLDate($PendOrder['orderDate']); ?></td>
     <td class="tabledata1" style="font-size:10px;"><?php echo ConvertSQLDate($PendOrder['DeliveryDate']); ?></td>
      <td class="tabledata1" style="font-size:10px;"><?php echo $s->GetFieldValue('www_users',"id='".$PendOrder['createdBy']."'",'realname'); ?></td>
  </tr>
<?php //}}  }
 }?>  
</table> 
<?php  //if($i>=4) {?>
<!--<div  align="right" class="seemore" ><a href="#" onclick="showpendingordapproval()" >Show More</a></div> -->
<?php //} ?>