|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00009 require('includes/application_top.php'); 00010 00011 require(DIR_WS_CLASSES . 'currencies.php'); 00012 $currencies = new currencies(); 00013 00014 $_GET['start_date'] = (!isset($_GET['start_date']) ? date("m-d-Y",(time())) : $_GET['start_date']); 00015 $_GET['end_date'] = (!isset($_GET['end_date']) ? date("m-d-Y",(time())) : $_GET['end_date']); 00016 $_GET['referral_code'] = (!isset($_GET['referral_code']) ? '0' : $_GET['referral_code']); 00017 00018 include(DIR_WS_CLASSES . 'order.php'); 00019 ?> 00020 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00021 <html <?php echo HTML_PARAMS; ?>> 00022 <head> 00023 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00024 <title><?php echo TITLE; ?></title> 00025 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00026 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00027 <script language="javascript" src="includes/menu.js"></script> 00028 <script language="javascript" src="includes/general.js"></script> 00029 <script type="text/javascript"> 00030 <!-- 00031 function init() 00032 { 00033 cssjsmenu('navbar'); 00034 if (document.getElementById) 00035 { 00036 var kill = document.getElementById('hoverJS'); 00037 kill.disabled = true; 00038 } 00039 } 00040 // --> 00041 </script> 00042 </head> 00043 <body onload="init()"> 00044 <!-- header //--> 00045 <?php 00046 require(DIR_WS_INCLUDES . 'header.php'); 00047 ?> 00048 <!-- header_eof //--> 00049 <!-- body //--> 00050 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00051 <tr> 00052 <!-- body_text //--> 00053 <td> 00054 00055 <tr> 00056 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00057 </tr> 00058 00059 <tr> 00060 <td><table border="0" cellspacing="0" cellpadding="0"> 00061 <?php 00062 // select all customer_referrals 00063 $customers_referral_query = "select distinct customers_referral from " . TABLE_CUSTOMERS . " where customers_referral != ''"; 00064 $customers_referral = $db->Execute($customers_referral_query); 00065 00066 $customers_referrals = array(); 00067 $customers_referrals_array = array(); 00068 $customers_referrals[] = array('id' => '0', 00069 'text' => TEXT_REFERRAL_UNKNOWN); 00070 00071 while (!$customers_referral->EOF) { 00072 $customers_referrals[] = array('id' => $customers_referral->fields['customers_referral'], 00073 'text' => $customers_referral->fields['customers_referral']); 00074 $customers_referral->MoveNext(); 00075 } 00076 00077 ?> 00078 <tr> 00079 <td><table border="0" cellspacing="2" cellpadding="2"> 00080 <tr> 00081 <td class="main"><?php echo TEXT_INFO_SELECT_REFERRAL; ?></td> 00082 <td class="main"> 00083 <?php 00084 echo zen_draw_form('new_date', FILENAME_STATS_CUSTOMERS_REFERRALS, '', 'get') . ' ' . zen_draw_pull_down_menu('referral_code', $customers_referrals, $_GET['referral_code'], 'onChange="this.form.submit();"') . 00085 zen_hide_session_id() . 00086 zen_draw_hidden_field('action', 'new_date') . 00087 zen_draw_hidden_field('start_date', $_GET['start_date']) . 00088 zen_draw_hidden_field('end_date', $_GET['end_date']); 00089 ?> 00090 </form> 00091 </td> 00092 </tr> 00093 </td></table> 00094 </tr> 00095 00096 <tr> 00097 <td><table border="0" width="100%" cellspacing="2" cellpadding="2"> 00098 <tr><?php echo zen_draw_form('search', FILENAME_STATS_CUSTOMERS_REFERRALS, '', 'get'); echo zen_draw_hidden_field('referral_code', $_GET['referral_code']); ?> 00099 <td class="main" align="right"><?php echo TEXT_INFO_START_DATE . ' ' . zen_draw_input_field('start_date', $_GET['start_date']); ?></td> 00100 <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> 00101 <td class="main" align="right"><?php echo zen_image_submit('button_display.gif', IMAGE_DISPLAY); ?></td> 00102 </tr> 00103 </td></table></form> 00104 </tr> 00105 00106 <?php 00107 // reverse date from m-d-y to y-m-d 00108 $date1 = explode("-", $_GET['start_date']); 00109 $m1 = $date1[0]; 00110 $d1 = $date1[1]; 00111 $y1 = $date1[2]; 00112 00113 $date2 = explode("-", $_GET['end_date']); 00114 $m2 = $date2[0]; 00115 $d2 = $date2[1]; 00116 $y2 = $date2[2]; 00117 00118 $sd = $y1 . '-' . $m1 . '-' . $d1 . ' 00:00:00'; 00119 $ed = $y2. '-' . $m2 . '-' . $d2 . ' 23:59:59'; 00120 00121 // $sd = $_GET['start_date']; 00122 // $ed = $_GET['end_date']; 00123 if ($_GET['referral_code'] == '0') { 00124 $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"; 00125 } else { 00126 $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"; 00127 } 00128 $customers_orders_query = $db->bindVars($customers_orders_query, ':ed:', $ed, 'date'); 00129 $customers_orders_query = $db->bindVars($customers_orders_query, ':sd:', $sd, 'date'); 00130 $customers_orders_query = $db->bindVars($customers_orders_query, ':refcode:', $_GET['referral_code'], 'string'); 00131 $customers_orders = $db->Execute($customers_orders_query); 00132 ?> 00133 <tr> 00134 <td><table border="0" width="100%" cellspacing="2" cellpadding="2"> 00135 <?php 00136 //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>'; 00137 while (!$customers_orders->EOF) { 00138 // echo $customers_orders->fields['orders_id'] . ' ' . $customers_orders->fields['order_total'] . '<br />'; 00139 $current_orders_id = $customers_orders->fields['orders_id']; 00140 00141 $orders_total_query = "select * from " . TABLE_ORDERS_TOTAL . " where orders_id='" . $current_orders_id . "'"; 00142 $orders_total = $db->Execute($orders_total_query); 00143 00144 $order = new order($customers_orders->fields['orders_id']); 00145 ?> 00146 <tr> 00147 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00148 </tr> 00149 <tr> 00150 <td class="main" align="left"><?php echo zen_date_long($customers_orders->fields['date_purchased']); ?></td> 00151 <td class="main" align="left">Order #<?php echo $customers_orders->fields['orders_id']; ?></td> 00152 <td class="main" align="left">Discount Coupon ID# <?php echo $customers_orders->fields['coupon_code']; ?></td> 00153 <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> 00154 </tr> 00155 <tr> 00156 <td><table border="0" cellspacing="0" cellpadding="2"> 00157 <?php 00158 for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { 00159 echo ' <tr>' . "\n" . 00160 ' <td align="left" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $order->totals[$i]['title'] . '</td>' . "\n" . 00161 ' <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $order->totals[$i]['text'] . '</td>' . "\n" . 00162 ' </tr>' . "\n"; 00163 } 00164 ?> 00165 </table></td> 00166 </tr> 00167 <?php 00168 $customers_orders->MoveNext(); 00169 } 00170 ?> 00171 00172 <!-- 00173 </tr> 00174 </td></table></form> 00175 </tr> 00176 --> 00177 00178 </table></td> 00179 </tr> 00180 00181 </td> 00182 </tr> 00183 </table>