[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> stats_customers.php (source)

   1  <?php
   2  /*

   3  $Id: stats_customers.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    require (DIR_WS_CLASSES . 'currencies.php');
  16    $currencies = new currencies();
  17  ?>
  18  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  19  <html <?php echo HTML_PARAMS; ?>>
  20  <head>
  21  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  22  <title><?php echo TITLE; ?></title>
  23  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  24  <script language="javascript" src="includes/general.js"></script>
  25  </head>
  26  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  27  <!-- header //-->
  28  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  29  <!-- header_eof //-->
  30  
  31  <!-- body //-->
  32  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  33    <tr>
  34      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  35  <!-- left_navigation //-->
  36  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  37  <!-- left_navigation_eof //-->
  38          </table></td>
  39  <!-- body_text //-->
  40      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  41        <tr>
  42          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  43            <tr>
  44              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  45              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  46            </tr>
  47          </table></td>
  48        </tr>
  49        <tr>
  50          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  51            <tr>
  52              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  53                <tr class="dataTableHeadingRow">
  54                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td>
  55                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
  56                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_PURCHASED; ?>&nbsp;</td>
  57                </tr>
  58  <?php
  59    if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
  60    $customers_query_raw = "select c.customers_firstname, c.customers_lastname, sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_firstname, c.customers_lastname order by ordersum DESC";
  61    $customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);
  62  // fix counted customers

  63    $customers_query_numrows = tep_db_query("select customers_id from " . TABLE_ORDERS . " group by customers_id");
  64    $customers_query_numrows = tep_db_num_rows($customers_query_numrows);
  65  
  66    $rows = 0;
  67    $customers_query = tep_db_query($customers_query_raw);
  68    while ($customers = tep_db_fetch_array($customers_query)) {
  69      $rows++;
  70  
  71      if (strlen($rows) < 2) {
  72        $rows = '0' . $rows;
  73      }
  74  ?>
  75                <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo tep_href_link(FILENAME_CUSTOMERS, 'search=' . $customers['customers_lastname'], 'NONSSL'); ?>'">
  76                  <td class="dataTableContent"><?php echo $rows; ?>.</td>
  77                  <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS, 'search=' . $customers['customers_lastname'], 'NONSSL') . '">' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . '</a>'; ?></td>
  78                  <td class="dataTableContent" align="right"><?php echo $currencies->format($customers['ordersum']); ?>&nbsp;</td>
  79                </tr>
  80  <?php
  81    }
  82  ?>
  83              </table></td>
  84            </tr>
  85            <tr>
  86              <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  87                <tr>
  88                  <td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
  89                  <td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?>&nbsp;</td>
  90                </tr>
  91              </table></td>
  92            </tr>
  93          </table></td>
  94        </tr>
  95      </table></td>
  96  <!-- body_text_eof //-->
  97    </tr>
  98  </table>
  99  <!-- body_eof //-->
 100  
 101  <!-- footer //-->
 102  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 103  <!-- footer_eof //-->
 104  </body>
 105  </html>
 106  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


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