<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td></tr>
  <tr>
	<td align="left" style="padding-left:10px">
		<table border="0" cellspacing="0" cellpadding="3" class="zakladka_czol">
		  <tr>
			<td class="main"><img src="<?php DIR_WS_ADMIN; ?>images/menu/zamowienia.gif" alt="Zamówienia"></td>
			<td class="str_czolowa" valign="middle" align="left">&nbsp;Ostatnio złożone zamówienia (<a href="<?php echo tep_href_link(FILENAME_ORDERS,'','NONSSL');?>">Przeglądaj</a>)&nbsp;&nbsp;</td>
		  </tr>
		</table>
	</td>
  </tr>										
  <tr>
	<td class="main">
		<table border="0" width="100%" cellspacing="0" cellpadding="4" style="border-color: #424242; border-width: 1px; border-style: solid;">
		  <tr class="dataTableHeadingRow_Str">
		    <td class="dataTableHeadingContent"><?php echo ADMIN_INDEX_ORDERS_TITLE; ?></td>
		    <td class="dataTableHeadingContent"><?php echo ADMIN_INDEX_ORDERS_TOTAL; ?></td>
		    <td class="dataTableHeadingContent"><?php echo ADMIN_INDEX_ORDERS_DATE; ?></td>
		    <td class="dataTableHeadingContent"><?php echo ADMIN_INDEX_ORDERS_STATUS; ?></td>
		  </tr>
		<?php
		  $orders_query = tep_db_query("select o.orders_id, o.customers_name, greatest(o.date_purchased, ifnull(o.last_modified, 0)) as date_last_modified,s.orders_status_id, s.orders_status_name, ot.text as order_total, o.date_purchased from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by date_purchased desc limit 10");
		  while ($orders = tep_db_fetch_array($orders_query)) {
		    echo '  <tr class="dataTableRow" onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '&action=edit' . '\'">' .
		         '    <td class="dataTableContent" onmouseover="rowOverEffect(this);tooltip.show(\''.$orders['orders_id'].'\');" onmouseout="rowOutEffect(this);tooltip.hide();">' . tep_output_string_protected($orders['customers_name']) . '</td>' .
		         '    <td class="dataTableContent">' . strip_tags($orders['order_total']) . '</td>' .
		         '    <td class="dataTableContent">' . $orders['date_purchased'] . '</td>' .
		         '    <td class="dataTableContent">';
				 $ta = '<span>';
				 if ($orders['orders_status_id'] == '1') {
					$ta = '<span style="color:#ff0000">';
				 }
				 if ($orders['orders_status_id'] == '2') {
					$ta = '<span style="color:#14a101">';
				 }	
				 if ($orders['orders_status_id'] == '3') {
					$ta = '<span style="color:#0613b6">';
				 }	
				 if ($orders['orders_status_id'] == '4') {
					$ta = '<span style="color:#584016">';
				 }					 
				 echo $ta . $orders['orders_status_name'] . 
				 '</span></td></tr>';
		  }
		?>
		</table>
	</td>
  </tr>
</table>
