[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> tax_rates.php (source)

   1  <?php
   2  /*

   3  $Id: tax_rates.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  16  
  17    if (tep_not_null($action)) {
  18      switch ($action) {
  19        case 'insert':
  20          $tax_zone_id = tep_db_prepare_input($HTTP_POST_VARS['tax_zone_id']);
  21          $tax_class_id = tep_db_prepare_input($HTTP_POST_VARS['tax_class_id']);
  22          $tax_rate = tep_db_prepare_input($HTTP_POST_VARS['tax_rate']);
  23          $tax_description = tep_db_prepare_input($HTTP_POST_VARS['tax_description']);
  24          $tax_priority = tep_db_prepare_input($HTTP_POST_VARS['tax_priority']);
  25  
  26          tep_db_query("insert into " . TABLE_TAX_RATES . " (tax_zone_id, tax_class_id, tax_rate, tax_description, tax_priority, date_added) values ('" . (int)$tax_zone_id . "', '" . (int)$tax_class_id . "', '" . tep_db_input($tax_rate) . "', '" . tep_db_input($tax_description) . "', '" . tep_db_input($tax_priority) . "', now())");
  27  
  28          tep_redirect(tep_href_link(FILENAME_TAX_RATES));
  29          break;
  30        case 'save':
  31          $tax_rates_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);
  32          $tax_zone_id = tep_db_prepare_input($HTTP_POST_VARS['tax_zone_id']);
  33          $tax_class_id = tep_db_prepare_input($HTTP_POST_VARS['tax_class_id']);
  34          $tax_rate = tep_db_prepare_input($HTTP_POST_VARS['tax_rate']);
  35          $tax_description = tep_db_prepare_input($HTTP_POST_VARS['tax_description']);
  36          $tax_priority = tep_db_prepare_input($HTTP_POST_VARS['tax_priority']);
  37  
  38          tep_db_query("update " . TABLE_TAX_RATES . " set tax_rates_id = '" . (int)$tax_rates_id . "', tax_zone_id = '" . (int)$tax_zone_id . "', tax_class_id = '" . (int)$tax_class_id . "', tax_rate = '" . tep_db_input($tax_rate) . "', tax_description = '" . tep_db_input($tax_description) . "', tax_priority = '" . tep_db_input($tax_priority) . "', last_modified = now() where tax_rates_id = '" . (int)$tax_rates_id . "'");
  39  
  40          tep_redirect(tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $tax_rates_id));
  41          break;
  42        case 'deleteconfirm':
  43          $tax_rates_id = tep_db_prepare_input($HTTP_GET_VARS['tID']);
  44  
  45          tep_db_query("delete from " . TABLE_TAX_RATES . " where tax_rates_id = '" . (int)$tax_rates_id . "'");
  46  
  47          tep_redirect(tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page']));
  48          break;
  49      }
  50    }
  51  ?>
  52  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  53  <html <?php echo HTML_PARAMS; ?>>
  54  <head>
  55  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  56  <title><?php echo TITLE; ?></title>
  57  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  58  <script language="javascript" src="includes/general.js"></script>
  59  </head>
  60  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
  61  <!-- header //-->
  62  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  63  <!-- header_eof //-->
  64  
  65  <!-- body //-->
  66  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  67    <tr>
  68      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  69  <!-- left_navigation //-->
  70  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  71  <!-- left_navigation_eof //-->
  72      </table></td>
  73  <!-- body_text //-->
  74      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  75        <tr>
  76          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  77            <tr>
  78              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  79              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  80            </tr>
  81          </table></td>
  82        </tr>
  83        <tr>
  84          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  85            <tr>
  86              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  87                <tr class="dataTableHeadingRow">
  88                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_RATE_PRIORITY; ?></td>
  89                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASS_TITLE; ?></td>
  90                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ZONE; ?></td>
  91                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_RATE; ?></td>
  92                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  93                </tr>
  94  <?php
  95    $rates_query_raw = "select r.tax_rates_id, z.geo_zone_id, z.geo_zone_name, tc.tax_class_title, tc.tax_class_id, r.tax_priority, r.tax_rate, r.tax_description, r.date_added, r.last_modified from " . TABLE_TAX_CLASS . " tc, " . TABLE_TAX_RATES . " r left join " . TABLE_GEO_ZONES . " z on r.tax_zone_id = z.geo_zone_id where r.tax_class_id = tc.tax_class_id";
  96    $rates_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $rates_query_raw, $rates_query_numrows);
  97    $rates_query = tep_db_query($rates_query_raw);
  98    while ($rates = tep_db_fetch_array($rates_query)) {
  99      if ((!isset($HTTP_GET_VARS['tID']) || (isset($HTTP_GET_VARS['tID']) && ($HTTP_GET_VARS['tID'] == $rates['tax_rates_id']))) && !isset($trInfo) && (substr($action, 0, 3) != 'new')) {
 100        $trInfo = new objectInfo($rates);
 101      }
 102  
 103      if (isset($trInfo) && is_object($trInfo) && ($rates['tax_rates_id'] == $trInfo->tax_rates_id)) {
 104        echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id . '&action=edit') . '\'">' . "\n";
 105      } else {
 106        echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $rates['tax_rates_id']) . '\'">' . "\n";
 107      }
 108  ?>
 109                  <td class="dataTableContent"><?php echo $rates['tax_priority']; ?></td>
 110                  <td class="dataTableContent"><?php echo $rates['tax_class_title']; ?></td>
 111                  <td class="dataTableContent"><?php echo $rates['geo_zone_name']; ?></td>
 112                  <td class="dataTableContent"><?php echo tep_display_tax_value($rates['tax_rate']); ?>%</td>
 113                  <td class="dataTableContent" align="right"><?php if (isset($trInfo) && is_object($trInfo) && ($rates['tax_rates_id'] == $trInfo->tax_rates_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $rates['tax_rates_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 114                </tr>
 115  <?php
 116    }
 117  ?>
 118                <tr>
 119                  <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 120                    <tr>
 121                      <td class="smallText" valign="top"><?php echo $rates_split->display_count($rates_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_TAX_RATES); ?></td>
 122                      <td class="smallText" align="right"><?php echo $rates_split->display_links($rates_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
 123                    </tr>
 124  <?php
 125    if (empty($action)) {
 126  ?>
 127                    <tr>
 128                      <td colspan="5" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_tax_rate.gif', IMAGE_NEW_TAX_RATE) . '</a>'; ?></td>
 129                    </tr>
 130  <?php
 131    }
 132  ?>
 133                  </table></td>
 134                </tr>
 135              </table></td>
 136  <?php
 137    $heading = array();
 138    $contents = array();
 139  
 140    switch ($action) {
 141      case 'new':
 142        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TAX_RATE . '</b>');
 143  
 144        $contents = array('form' => tep_draw_form('rates', FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert'));
 145        $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
 146        $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . tep_tax_classes_pull_down('name="tax_class_id" style="font-size:10px"'));
 147        $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_NAME . '<br>' . tep_geo_zones_pull_down('name="tax_zone_id" style="font-size:10px"'));
 148        $contents[] = array('text' => '<br>' . TEXT_INFO_TAX_RATE . '<br>' . tep_draw_input_field('tax_rate'));
 149        $contents[] = array('text' => '<br>' . TEXT_INFO_RATE_DESCRIPTION . '<br>' . tep_draw_input_field('tax_description'));
 150        $contents[] = array('text' => '<br>' . TEXT_INFO_TAX_RATE_PRIORITY . '<br>' . tep_draw_input_field('tax_priority'));
 151        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 152        break;
 153      case 'edit':
 154        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TAX_RATE . '</b>');
 155  
 156        $contents = array('form' => tep_draw_form('rates', FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id  . '&action=save'));
 157        $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
 158        $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . tep_tax_classes_pull_down('name="tax_class_id" style="font-size:10px"', $trInfo->tax_class_id));
 159        $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_NAME . '<br>' . tep_geo_zones_pull_down('name="tax_zone_id" style="font-size:10px"', $trInfo->geo_zone_id));
 160        $contents[] = array('text' => '<br>' . TEXT_INFO_TAX_RATE . '<br>' . tep_draw_input_field('tax_rate', $trInfo->tax_rate));
 161        $contents[] = array('text' => '<br>' . TEXT_INFO_RATE_DESCRIPTION . '<br>' . tep_draw_input_field('tax_description', $trInfo->tax_description));
 162        $contents[] = array('text' => '<br>' . TEXT_INFO_TAX_RATE_PRIORITY . '<br>' . tep_draw_input_field('tax_priority', $trInfo->tax_priority));
 163        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 164        break;
 165      case 'delete':
 166        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TAX_RATE . '</b>');
 167  
 168        $contents = array('form' => tep_draw_form('rates', FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id  . '&action=deleteconfirm'));
 169        $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
 170        $contents[] = array('text' => '<br><b>' . $trInfo->tax_class_title . ' ' . number_format($trInfo->tax_rate, TAX_DECIMAL_PLACES) . '%</b>');
 171        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 172        break;
 173      default:
 174        if (is_object($trInfo)) {
 175          $heading[] = array('text' => '<b>' . $trInfo->tax_class_title . '</b>');
 176          $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_TAX_RATES, 'page=' . $HTTP_GET_VARS['page'] . '&tID=' . $trInfo->tax_rates_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 177          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($trInfo->date_added));
 178          $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($trInfo->last_modified));
 179          $contents[] = array('text' => '<br>' . TEXT_INFO_RATE_DESCRIPTION . '<br>' . $trInfo->tax_description);
 180        }
 181        break;
 182    }
 183  
 184    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 185      echo '            <td width="25%" valign="top">' . "\n";
 186  
 187      $box = new box;
 188      echo $box->infoBox($heading, $contents);
 189  
 190      echo '            </td>' . "\n";
 191    }
 192  ?>
 193            </tr>
 194          </table></td>
 195        </tr>
 196      </table></td>
 197  <!-- body_text_eof //-->
 198    </tr>
 199  </table>
 200  <!-- body_eof //-->
 201  
 202  <!-- footer //-->
 203  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 204  <!-- footer_eof //-->
 205  <br>
 206  </body>
 207  </html>
 208  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7