[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 stats_customers_referrals.php

Zen Cart 源代码 stats_customers_referrals.php




下载文件

文件名: stats_customers_referrals.php
文件类型: PHP文件
文件大小: 8.32 KiB
MD5: 0c2be68b3369bfe3afa3b7f0da8f7701

stats_customers_referrals.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2012 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version GIT: $Id: Author: DrByte  Tue Jul 17 22:56:16 2012 -0400 Modified in v1.5.1 $
  8.  */
  9.   require('includes/application_top.php');
  10.  
  11.   require(DIR_WS_CLASSES . 'currencies.php');
  12.   $currencies = new currencies();
  13.  
  14.   $_GET['start_date'] = (!isset($_GET['start_date']) ? date("m-d-Y",(time())) : $_GET['start_date']);
  15.   $_GET['end_date'] = (!isset($_GET['end_date']) ? date("m-d-Y",(time())) : $_GET['end_date']);
  16.   $_GET['referral_code'] = (!isset($_GET['referral_code']) ? '0' : $_GET['referral_code']);
  17.  
  18.   include(DIR_WS_CLASSES . 'order.php');
  19. ?>
  20. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  21. <html <?php echo HTML_PARAMS; ?>>
  22. <head>
  23. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  24. <title><?php echo TITLE; ?></title>
  25. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  26. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  27. <script language="javascript" src="includes/menu.js"></script>
  28. <script language="javascript" src="includes/general.js"></script>
  29. <script type="text/javascript">
  30.   <!--
  31.   function init()
  32.   {
  33.     cssjsmenu('navbar');
  34.     if (document.getElementById)
  35.     {
  36.       var kill = document.getElementById('hoverJS');
  37.       kill.disabled = true;
  38.     }
  39.   }
  40.   // -->
  41. </script>
  42. </head>
  43. <body onload="init()">
  44. <!-- header //-->
  45. <?php
  46.   require(DIR_WS_INCLUDES . 'header.php');
  47. ?>
  48. <!-- header_eof //-->
  49. <!-- body //-->
  50. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  51.   <tr>
  52. <!-- body_text //-->
  53.     <td>
  54.  
  55.       <tr>
  56.         <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  57.       </tr>
  58.  
  59.       <tr>
  60.         <td><table border="0" cellspacing="0" cellpadding="0">
  61. <?php
  62. // select all customer_referrals
  63.   $customers_referral_query = "select distinct customers_referral from " . TABLE_CUSTOMERS . " where customers_referral != ''";
  64.   $customers_referral = $db->Execute($customers_referral_query);
  65.  
  66.   $customers_referrals = array();
  67.   $customers_referrals_array = array();
  68.   $customers_referrals[] = array('id' => '0',
  69.                                  'text' => TEXT_REFERRAL_UNKNOWN);
  70.  
  71.   while (!$customers_referral->EOF) {
  72.     $customers_referrals[] = array('id' => $customers_referral->fields['customers_referral'],
  73.                                    'text' => $customers_referral->fields['customers_referral']);
  74.     $customers_referral->MoveNext();
  75.   }
  76.  
  77. ?>
  78.           <tr>
  79.             <td><table border="0" cellspacing="2" cellpadding="2">
  80.               <tr>
  81.                 <td class="main"><?php echo TEXT_INFO_SELECT_REFERRAL; ?></td>
  82.                 <td class="main">
  83.                   <?php
  84.                     echo zen_draw_form('new_date', FILENAME_STATS_CUSTOMERS_REFERRALS, '', 'get') . '&nbsp;&nbsp;' . zen_draw_pull_down_menu('referral_code', $customers_referrals, $_GET['referral_code'], 'onChange="this.form.submit();"') .
  85.                      zen_hide_session_id() .
  86.                      zen_draw_hidden_field('action', 'new_date') .
  87.                      zen_draw_hidden_field('start_date', $_GET['start_date']) .
  88.                      zen_draw_hidden_field('end_date', $_GET['end_date']);
  89.                   ?>
  90.                  &nbsp;&nbsp;</form>
  91.                 </td>
  92.               </tr>
  93.             </td></table>
  94.           </tr>
  95.  
  96.           <tr>
  97.             <td><table border="0" width="100%" cellspacing="2" cellpadding="2">
  98.               <tr><?php echo zen_draw_form('search', FILENAME_STATS_CUSTOMERS_REFERRALS, '', 'get'); echo zen_draw_hidden_field('referral_code', $_GET['referral_code']); ?>
  99.                 <td class="main" align="right"><?php echo TEXT_INFO_START_DATE . ' ' . zen_draw_input_field('start_date', $_GET['start_date']); ?></td>
  100.                 <td class="main" align="right"><?php echo TEXT_INFO_END_DATE . ' ' . zen_draw_input_field('end_date', $_GET['end_date']) . zen_hide_session_id(); ?></td>
  101.                 <td class="main" align="right"><?php echo zen_image_submit('button_display.gif', IMAGE_DISPLAY); ?></td>
  102.               </tr>
  103.             </td></table></form>
  104.           </tr>
  105.  
  106. <?php
  107. // reverse date from m-d-y to y-m-d
  108.     $date1 = explode("-", $_GET['start_date']);
  109.     $m1 = $date1[0];
  110.     $d1 = $date1[1];
  111.     $y1 = $date1[2];
  112.  
  113.     $date2 = explode("-", $_GET['end_date']);
  114.     $m2 = $date2[0];
  115.     $d2 = $date2[1];
  116.     $y2 = $date2[2];
  117.  
  118.     $sd = $y1 . '-' . $m1 . '-' . $d1 . ' 00:00:00';
  119.     $ed = $y2. '-' . $m2 . '-' . $d2 .  ' 23:59:59';
  120.  
  121. //  $sd = $_GET['start_date'];
  122. //  $ed = $_GET['end_date'];
  123.   if ($_GET['referral_code'] == '0') {
  124.     $customers_orders_query = "select c.customers_id, c.customers_referral, o.orders_id, o.date_purchased, o.order_total, o.coupon_code from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and c.customers_referral= '' and (o.date_purchased >= :sd: and o.date_purchased <= :ed:) order by o.date_purchased, o.orders_id";
  125.   } else {
  126.     $customers_orders_query = "select c.customers_id, c.customers_referral, o.orders_id, o.date_purchased, o.order_total, o.coupon_code from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and c.customers_referral=:refcode: and (o.date_purchased >= :sd: and o.date_purchased <= :ed:) order by o.date_purchased, o.orders_id";
  127.   }
  128.   $customers_orders_query = $db->bindVars($customers_orders_query, ':ed:', $ed, 'date');
  129.   $customers_orders_query = $db->bindVars($customers_orders_query, ':sd:', $sd, 'date');
  130.   $customers_orders_query = $db->bindVars($customers_orders_query, ':refcode:', $_GET['referral_code'], 'string');
  131.   $customers_orders = $db->Execute($customers_orders_query);
  132. ?>
  133.           <tr>
  134.             <td><table border="0" width="100%" cellspacing="2" cellpadding="2">
  135. <?php
  136. //echo 'I see ' . $customers_orders->RecordCount() . '<br>' . $customers_orders_query . '<br><br>' . 'start ' . date($_GET['start_date']) . ' end ' . date($_GET['end_date']) . '<br>Referral: ' . $_GET['referral_code'] . ' ' . strlen($_GET['referral_code']) . '<br>';
  137.   while (!$customers_orders->EOF) {
  138. //    echo $customers_orders->fields['orders_id'] . ' ' . $customers_orders->fields['order_total'] . '<br />';
  139.     $current_orders_id = $customers_orders->fields['orders_id'];
  140.  
  141.     $orders_total_query = "select * from " . TABLE_ORDERS_TOTAL . " where orders_id='" . $current_orders_id . "'";
  142.     $orders_total = $db->Execute($orders_total_query);
  143.  
  144.     $order = new order($customers_orders->fields['orders_id']);
  145. ?>
  146.           <tr>
  147.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  148.           </tr>
  149.           <tr>
  150.             <td class="main" align="left"><?php echo zen_date_long($customers_orders->fields['date_purchased']); ?></td>
  151.             <td class="main" align="left"><?php echo TEXT_ORDER_NUMBER; ?> <?php echo $customers_orders->fields['orders_id']; ?></td>
  152.             <td class="main" align="left"><?php echo TEXT_COUPON_ID; ?> <?php echo $customers_orders->fields['coupon_code']; ?></td>
  153.             <td class="main" align="left"><?php echo '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $customers_orders->fields['orders_id'] . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>'; ?></td>
  154.           </tr>
  155.           <tr>
  156.             <td><table border="0" cellspacing="0" cellpadding="2">
  157. <?php
  158.     for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
  159.       echo '              <tr>' . "\n" .
  160.            '                <td align="left" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $order->totals[$i]['title'] . '</td>' . "\n" .
  161.            '                <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $order->totals[$i]['text'] . '</td>' . "\n" .
  162.            '              </tr>' . "\n";
  163.     }
  164. ?>
  165.             </table></td>
  166.           </tr>
  167. <?php
  168.     $customers_orders->MoveNext();
  169.   }
  170. ?>
  171.  
  172. <!--
  173.               </tr>
  174.             </td></table></form>
  175.           </tr>
  176. -->
  177.  
  178.         </table></td>
  179.       </tr>
  180.  
  181.     </td>
  182.   </tr>
  183. </table>
  184.  


cron