<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.0.9h
  @date  29/05/10, 16:44
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
$orders_contents = '<ul>';
$orders_status_query = tep_db_query("select status_name as orders_status_name,status_id as orders_status_id from " . TABLE_STATUS . " where status_type='orders' and language_id = '" . $languages_id . "'");
?>
<div id="orderStats" class="<?php echo $widg['class'] ?>">
<h3><?php echo __('box title orders'); ?></h3>
<?php
  while ($orders_status = tep_db_fetch_array($orders_status_query)) {
    $orders_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where orders_status = '" . $orders_status['orders_status_id'] . "'");
    $orders_pending = tep_db_fetch_array($orders_pending_query);

    if (tep_admin_check_boxes(FILENAME_ORDERS, 'sub_boxes') == true) {
      $orders_contents .= '<li><a href="' . tep_href_link(FILENAME_ORDERS, 'selected_box=customers&amp;status=' . $orders_status['orders_status_id']) . '">' . $orders_status['orders_status_name'] . '</a>: ' . $orders_pending['count'] . '</li>';

    } else {
      $orders_contents .= '<li>' . $orders_status['orders_status_name'] . ': ' . $orders_pending['count'] . '</li>';
    }

  }
	$orders_contents .= '</ul>';

    echo $orders_contents ;
?>
</div>