<div data-role="controlgroup" data-type="horizontal" >
               
            <?php
		$sql=  "SELECT Customers.CompanyName, Customers.CustomerID, Customers.Phone, derivedtbl_1.Status, derivedtbl_1.OrderID, derivedtbl_1.RequiredDate, derivedtbl_1.ShipType, derivedtbl_1.SubTotal FROM Customers LEFT OUTER JOIN (SELECT CustomerID, Status, OrderID, RequiredDate, ShipType, SubTotal FROM Orders WHERE (Status <> '".save2mssql('已结账')."')) AS derivedtbl_1 ON Customers.CustomerID = derivedtbl_1.CustomerID ORDER BY derivedtbl_1.Status DESC, LEN(Customers.CustomerID), Customers.CustomerID " ;  
  
         
$values = $orders->query($sql);
if (is_iterable($values)){
  foreach ($values as $pDesk){ 
   // die( $sql);
$pDesk['CompanyName']=loadFromMssql($pDesk['CompanyName']);
$pDesk['Phone']=loadFromMssql($pDesk['Phone']);
$pDesk['Status']=loadFromMssql($pDesk['Status']);
$pDesk['ShipType']=loadFromMssql($pDesk['ShipType']);


?>
<a href="#" id="catalogo" style="width:80px;height:60px;text-align: center;<?php if (!empty($pDesk['Status'])) echo 'background-color: coral;color:rgb(240, 240, 240)';?>" data-role="button"  onclick="loaddesk('<?php echo $pDesk['CustomerID'];?>');"> <?php
        echo $pDesk['CompanyName'];
		echo empty($pDesk['Status']) ?'':'<br/>'.$pDesk['Status'];
		echo empty($pDesk['SubTotal']) ?'':'<br/>'.number_format($pDesk['SubTotal'],2);
?> </a>                                    
  <?php
    }
}?>
              
          </div>