<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  18/12/10, 11:21
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
?>
<h3><?php echo HEADING_TITLE; ?></h3>
<!-- body //-->

<!-- body_text //-->

<?php if ($action == 'list') {  /** LISTE ENFANT  ZONE */ ?>
<h4><?php echo HEADING_TITLE_T; ?></h4>
<div class="button_nav">
  <?php echo '<a class="button"  href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('saction')) . 'saction=new') . '">' .  IMAGE_NEW_TAX_RATE . '</a>'; ?>
  <?php echo '<a class="button"  href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('action','saction')) ) . '">' .  IMAGE_BACK . '</a>'; ?>
</div>
<div class="box_left">
  <table  width="100%" class="dataTable">
    <thead>
      <tr>
	<th><?php echo TABLE_HEADING_TAX_RATE_PRIORITY.tep_link_sort_by(FILENAME_TAX_CLASSES,'r.tax_priority'); ?></th>
	<th><?php echo TABLE_HEADING_TAX_CLASS_TITLE.tep_link_sort_by(FILENAME_TAX_CLASSES,'tc.tax_class_title'); ?></th>
	<th><?php echo TABLE_HEADING_ZONE.tep_link_sort_by(FILENAME_TAX_CLASSES,'z.geo_zone_name'); ?></th>
	<th><?php echo TABLE_HEADING_TAX_RATE.tep_link_sort_by(FILENAME_TAX_CLASSES,'z.countries_name'); ?></th>
	<th><?php echo TABLE_HEADING_ACTION; ?></th>
      </tr>
    </thead>
    <tfoot>
      <tr>
	<td colspan="2"><?php echo $rates_split->display_count($rates_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_TAX_RATES); ?></td>
	<td><?php  ?></td>
	<td colspan="2" class="tright"><?php echo $rates_split->display_links($rates_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
      </tr>
    </tfoot>
    <?php foreach($list_c as $rates) { ?>
      <tr class="view parent dataTableRow <?php if($rates['tax_rates_id'] ==$trID) echo "Selected"; ?>">
	<td><?php echo $rates['tax_priority']; ?></td>
	<td><?php echo $rates['tax_class_title']; ?></td>
	<td><?php echo $rates['geo_zone_name']; ?></td>
	<td><?php echo tep_display_tax_value($rates['tax_rate']); ?>%</td>
	<td>
	  <span class="view fils fleft">
	  <?php
	    echo '<a class="buttonimg" href="' .  tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('saction','trID')). 'trID=' . $rates['tax_rates_id'] . '&amp;saction=edit').'">' . tep_image(DIR_WS_ICONS . 'icon_edit.png',IMAGE_EDIT). '</a>'
		.'<a  class="buttonimg" href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('saction','trID')). 'trID=' . $rates['tax_rates_id'] . '&amp;saction=delete') . '">' . tep_image(DIR_WS_ICONS . 'icon_delete.png',IMAGE_DELETE).'</a>';
	  ?></span>
	  <span class="fright"><?php
	  if (isset($trInfo) && is_object($trInfo) && ($rates['tax_rates_id'] == $trInfo->tax_rates_id)) { echo tep_image(DIR_WS_ICONS . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('saction','trID')). 'trID=' . $rates['tax_rates_id']) . '">' . tep_image(DIR_WS_ICONS . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
	  </span>
	  </td>
      </tr>
    <?php } ?>
  </table>
</div>


<?php } else { /** LISTE ZONE */?>
<h4><?php echo HEADING_TITLE_C; ?></h4>
  <div class="button_nav"><?php echo '<a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;action=new') . '">' . IMAGE_NEW_TAX_CLASS . '</a>'; ?></div>
  <div class="box_left">
  <table width="100%" class="dataTable">
    <thead>
      <tr>
	<th><?php echo TABLE_HEADING_TAX_CLASSES; ?></th>
	<th><?php echo TABLE_HEADING_ACTION; ?></th>
      </tr>
    </thead>
    <tfoot>
      <tr>
	<td><?php echo $classes_split->display_count($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $page, TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES); ?></td>
	<td><?php echo $classes_split->display_links($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $page); ?></td>
      </tr>
    </tfoot>
    <tbody>
      <?php foreach($list_c as $classes) { ?>
	  <tr class=" view parent dataTableRow <?php if($tID == $classes['tax_class_id']) echo "Selected"; ?>" >
	    <td><?php echo $classes['tax_class_title']; ?></td>
	    <td style="width:100px">
	      <span class="view fils fleft">
	      <?php
		echo  '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('action','tID')). 'tID=' . $classes['tax_class_id'] . '&amp;action=list') . '">' . tep_image(DIR_WS_ICONS . 'icon_plus.gif', ICON_FOLDER) . '</a> ';
		echo '<a class="buttonimg" href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('action','tID')). 'tID=' . $classes['tax_class_id'] . '&amp;action=edit') . '">' . tep_image(DIR_WS_ICONS . 'icon_edit.png',IMAGE_EDIT ). '</a>'
		  .'<a  class="buttonimg" href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('action','tID')). 'tID=' . $classes['tax_class_id']. '&amp;action=delete') . '">' . tep_image(DIR_WS_ICONS . 'icon_delete.png',IMAGE_DELETE).'</a>'; ?>
	      </span>
	      <span class="fright">
	      <?php
	      if (isset($tcInfo) && is_object($tcInfo) && ($classes['tax_class_id'] == $tcInfo->tax_class_id)) { echo tep_image(DIR_WS_ICONS . 'icon_arrow_right.gif', ''); }
	      else { echo '<a href="' . tep_href_link(FILENAME_TAX_CLASSES, tep_get_all_get_params(array('action','tID')). 'tID=' . $classes['tax_class_id']) . '">' . tep_image(DIR_WS_ICONS . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
	      </span>
	    </td>
	  </tr>
	<?php } ?>
    </tbody>
  </table>
</div>

<?php } ?>

<?php
  $heading = array();
  $contents = array();
if($action=='list') {
  switch ($saction) {
    case 'new':
      $heading[] = array('text' => TEXT_INFO_HEADING_NEW_TAX_RATE );

      $contents = array('form' => tep_draw_form('rates', FILENAME_TAX_CLASSES, tep_get_all_get_params(array('saction')). '&amp;saction=insert'));
      $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_CLASS_TITLE . tep_tax_classes_pull_down('name="tax_class_id" style="font-size:10px"'));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_ZONE_NAME . tep_geo_zones_pull_down('name="tax_zone_id" style="font-size:10px"',1));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_TAX_RATE . tep_draw_input_field('tax_rate'));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_RATE_DESCRIPTION . tep_draw_input_field('tax_description'));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_TAX_RATE_PRIORITY . tep_draw_input_field('tax_priority'));
      $contents[] = array('class' => 'button_nav', 'text' => tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a class="button"  href="' . tep_href_link(FILENAME_TAX_CLASSES,  tep_get_all_get_params(array('saction'))) . '">' .  IMAGE_CANCEL . '</a>');
      break;
    case 'edit':
      $heading[] = array('text' => TEXT_INFO_HEADING_EDIT_TAX_RATE );

      $contents = array('form' => tep_draw_form('rates', FILENAME_TAX_CLASSES, tep_get_all_get_params(array('saction','trID')). 'trID=' . $trInfo->tax_rates_id  . '&amp;saction=save'));
      $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_CLASS_TITLE . tep_tax_classes_pull_down('name="tax_class_id" style="font-size:10px"', $trInfo->tax_class_id));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_ZONE_NAME . tep_geo_zones_pull_down('name="tax_zone_id" style="font-size:10px"', $trInfo->geo_zone_id,1));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_TAX_RATE . tep_draw_input_field('tax_rate','', $trInfo->tax_rate));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_RATE_DESCRIPTION . tep_draw_input_field('tax_description','', $trInfo->tax_description));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_TAX_RATE_PRIORITY . tep_draw_input_field('tax_priority','', $trInfo->tax_priority).tep_draw_hidden_field('tax_rates_id','', $trInfo->tax_rates_id));
      $contents[] = array('class' => 'button_nav', 'text' => tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a class="button"  href="' . tep_href_link(FILENAME_TAX_CLASSES,  tep_get_all_get_params(array('saction','trID')).'trID=' . $trInfo->tax_rates_id) . '">' .  IMAGE_CANCEL . '</a>');
      break;
    case 'delete':
      $heading[] = array('text' => TEXT_INFO_HEADING_DELETE_TAX_RATE );

      $contents = array('form' => tep_draw_form('rates', FILENAME_TAX_CLASSES,  tep_get_all_get_params(array('saction','tID')). 'tID=' . $trInfo->tax_rates_id  . '&amp;saction=deleteconfirm'));
      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
      $contents[] = array('text' => '<strong>' . $trInfo->tax_class_title . number_format($trInfo->tax_rate, TAX_DECIMAL_PLACES) . '%</strong>');
      $contents[] = array('class' => 'button_nav', 'text' => tep_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a class="button"  href="' . tep_href_link(FILENAME_TAX_CLASSES,  tep_get_all_get_params(array('saction','trID=')). 'trID=' . $trInfo->tax_rates_id) . '">' . IMAGE_CANCEL . '</a>');
      break;
    default:
      if (isset($trInfo) && is_object($trInfo)) {
        $heading[] = array('text' => $trInfo->tax_class_title );
        $contents[] = array('class' => 'button_nav', 'text' => '<a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES,  tep_get_all_get_params(array('saction','trID')). 'trID=' . $trInfo->tax_rates_id . '&amp;saction=edit') . '">' .  IMAGE_EDIT . '</a> <a class="button"  href="' . tep_href_link(FILENAME_TAX_CLASSES,  tep_get_all_get_params(array('saction','trID')). 'trID=' . $trInfo->tax_rates_id . '&amp;saction=delete') . '">' .  IMAGE_DELETE . '</a>');
        $contents[] = array('text' => TEXT_INFO_DATE_ADDED . tep_date_short($trInfo->date_added));
        $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . tep_date_short($trInfo->last_modified));
        $contents[] = array('text' => TEXT_INFO_RATE_DESCRIPTION . $trInfo->tax_description);
      }
      break;
  }
} else {
  switch ($action) {
    case 'new':
      $heading[] = array('text' => TEXT_INFO_HEADING_NEW_TAX_CLASS );

      $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;action=insert'));
      $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_CLASS_TITLE . tep_draw_input_field('tax_class_title'));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_CLASS_DESCRIPTION . tep_draw_input_field('tax_class_description'));
      $contents[] = array('class' => 'button_nav', 'text' => tep_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $page) . '">' . IMAGE_CANCEL . '</a>');
      break;
    case 'edit':
      $heading[] = array('text' => TEXT_INFO_HEADING_EDIT_TAX_CLASS );

      $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;tID=' . $tcInfo->tax_class_id . '&amp;action=save'));
      $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_CLASS_TITLE . tep_draw_input_field('tax_class_title', '', $tcInfo->tax_class_title));
      $contents[] = array('class' => 'block_input','text' => TEXT_INFO_CLASS_DESCRIPTION . tep_draw_input_field('tax_class_description', '', $tcInfo->tax_class_description));
      $contents[] = array('class' => 'button_nav', 'text' => tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;tID=' . $tcInfo->tax_class_id) . '">' .  IMAGE_CANCEL . '</a>');
      break;
    case 'delete':
      $heading[] = array('text' => TEXT_INFO_HEADING_DELETE_TAX_CLASS );

      $contents = array('form' => tep_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;tID=' . $tcInfo->tax_class_id . '&amp;action=deleteconfirm'));
      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
      $contents[] = array('text' => '<strong>' . $tcInfo->tax_class_title . '</strong>');
      $contents[] = array('class' => 'button_nav', 'text' => tep_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;tID=' . $tcInfo->tax_class_id) . '">' .  IMAGE_CANCEL . '</a>');
      break;
    default:
      if (isset($tcInfo) && is_object($tcInfo)) {
        $heading[] = array('text' => $tcInfo->tax_class_title );

        $contents[] = array('class' => 'button_nav', 'text' => '<a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;tID=' . $tcInfo->tax_class_id . '&amp;action=edit') . '">' .  IMAGE_EDIT . '</a> <a class="button" href="' . tep_href_link(FILENAME_TAX_CLASSES, 'page=' . $page . '&amp;tID=' . $tcInfo->tax_class_id . '&amp;action=delete') . '">' .  IMAGE_DELETE . '</a>');
        $contents[] = array('text' => TEXT_INFO_DATE_ADDED . tep_date_short($tcInfo->date_added));
        $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . tep_date_short($tcInfo->last_modified));
        $contents[] = array('text' => TEXT_INFO_CLASS_DESCRIPTION . $tcInfo->tax_class_description);
      }
      break;
  }
}
?>
<div class="box_right">
<?php
  if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
    $box = new box;
    echo $box->infoBox($heading, $contents);
  }
?>
</div>

<!-- body_text_eof //-->
<!-- body_eof //-->