[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: affiliate_summary.php 14 2006-07-28 17:42:07Z user $ 4 5 OSC-Affiliate 6 7 Contribution based on: 8 9 osCMax Power E-Commerce 10 http://oscdox.com 11 12 Copyright 2006 osCMax 13 14 Released under the GNU General Public License 15 */ 16 17 require ('includes/application_top.php'); 18 19 require (DIR_WS_CLASSES . 'currencies.php'); 20 $currencies = new currencies(); 21 22 // delete clickthroughs 23 if (AFFILIATE_DELETE_CLICKTHROUGHS != 'false' && is_numeric(AFFILIATE_DELETE_CLICKTHROUGHS)) { 24 $time = mktime (1,1,1,date("m"),date("d") - AFFILIATE_DELETE_CLICKTHROUGHS, date("Y")); 25 $time = date("Y-m-d", $time); 26 tep_db_query("delete from " . TABLE_AFFILIATE_CLICKTHROUGHS . " where affiliate_clientdate < '". $time . "'"); 27 } 28 // delete old records from affiliate_banner_history 29 if (AFFILIATE_DELETE_AFFILIATE_BANNER_HISTORY != 'false' && is_numeric(AFFILIATE_DELETE_AFFILIATE_BANNER_HISTORY)) { 30 $time = mktime (1,1,1,date("m"),date("d") - AFFILIATE_DELETE_AFFILIATE_BANNER_HISTORY, date("Y")); 31 $time = date("Y-m-d", $time); 32 tep_db_query("delete from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_history_date < '". $time . "'"); 33 } 34 35 36 $affiliate_banner_history_raw = "select sum(affiliate_banners_shown) as count from " . TABLE_AFFILIATE_BANNERS_HISTORY . ""; 37 $affiliate_banner_history_query = tep_db_query($affiliate_banner_history_raw); 38 $affiliate_banner_history = tep_db_fetch_array($affiliate_banner_history_query); 39 $affiliate_impressions = $affiliate_banner_history['count']; 40 if ($affiliate_impressions == 0) $affiliate_impressions = "n/a"; 41 42 $affiliate_clickthroughs_raw = "select count(*) as count from " . TABLE_AFFILIATE_CLICKTHROUGHS . ""; 43 $affiliate_clickthroughs_query = tep_db_query($affiliate_clickthroughs_raw); 44 $affiliate_clickthroughs = tep_db_fetch_array($affiliate_clickthroughs_query); 45 $affiliate_clickthroughs = $affiliate_clickthroughs['count']; 46 47 $affiliate_sales_raw = " 48 select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 49 left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id = o.orders_id) 50 where o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " 51 "; 52 53 $affiliate_sales_query= tep_db_query($affiliate_sales_raw); 54 $affiliate_sales= tep_db_fetch_array($affiliate_sales_query); 55 56 $affiliate_transactions = $affiliate_sales['count']; 57 if ($affiliate_clickthroughs > 0) { 58 $affiliate_conversions = tep_round(($affiliate_transactions / $affiliate_clickthroughs)*100,2) . "%"; 59 } else { 60 $affiliate_conversions = "n/a"; 61 } 62 63 $affiliate_amount = $affiliate_sales['total']; 64 if ($affiliate_transactions > 0) { 65 $affiliate_average = tep_round($affiliate_amount / $affiliate_transactions, 2); 66 } else { 67 $affiliate_average = "n/a"; 68 } 69 70 $affiliate_commission = $affiliate_sales['payment']; 71 72 $affiliates_raw = "select count(*) as count from " . TABLE_AFFILIATE . ""; 73 $affiliates_raw_query = tep_db_query($affiliates_raw); 74 $affiliates_raw = tep_db_fetch_array($affiliates_raw_query); 75 $affiliate_number = $affiliates_raw['count']; 76 ?> 77 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 78 <html <?php echo HTML_PARAMS; ?>> 79 <head> 80 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 81 <title><?php echo TITLE; ?></title> 82 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 83 <script language="javascript" src="includes/general.js"></script> 84 <script language="javascript"><!-- 85 function popupWindow(url) { 86 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=450,height=120,screenX=150,screenY=150,top=150,left=150') 87 } 88 //--></script> 89 </head> 90 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 91 <!-- header //--> 92 <?php require (DIR_WS_INCLUDES . 'header.php'); ?> 93 <!-- header_eof //--> 94 95 <!-- body //--> 96 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 97 <tr> 98 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 99 <!-- left_navigation //--> 100 <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?> 101 <!-- left_navigation_eof //--> 102 </table></td> 103 <!-- body_text //--> 104 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 105 <tr> 106 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 107 <tr> 108 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 109 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 110 </tr> 111 </table></td> 112 </tr> 113 <tr> 114 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 115 <tr> 116 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 117 <tr class="dataTableHeadingRow"> 118 <td class="dataTableHeadingContent"><?php echo TEXT_SUMMARY_TITLE; ?></td> 119 </tr> 120 </table></td> 121 </tr> 122 <tr> 123 <td><table width="100%" border="0" cellpadding="4" cellspacing="2" class="dataTableContent"> 124 <center> 125 <tr> 126 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_AFFILIATES; ?> </td> 127 <td width="15%" class="dataTableContent"><?php echo $affiliate_number; ?></td> 128 <td width="35%" align="right" class="dataTableContent"></td> 129 <td width="15%" class="dataTableContent"></td> 130 </tr> 131 <tr> 132 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_IMPRESSIONS; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_1) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 133 <td width="15%" class="dataTableContent"><?php echo $affiliate_impressions; ?></td> 134 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_VISITS; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_2) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 135 <td width="15%" class="dataTableContent"><?php echo $affiliate_clickthroughs; ?></td> 136 </tr> 137 <tr> 138 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_TRANSACTIONS; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_3) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 139 <td width="15%" class="dataTableContent"><?php echo $affiliate_transactions; ?></td> 140 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_CONVERSION; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_4) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 141 <td width="15%" class="dataTableContent"><?php echo $affiliate_conversions;?></td> 142 </tr> 143 <tr> 144 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_AMOUNT; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_5) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 145 <td width="15%" class="dataTableContent"><?php echo $currencies->display_price($affiliate_amount, ''); ?></td> 146 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_AVERAGE; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_6) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 147 <td width="15%" class="dataTableContent"><?php echo $currencies->display_price($affiliate_average, ''); ?></td> 148 </tr> 149 <tr> 150 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_COMMISSION_RATE; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_7) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 151 <td width="15%" class="dataTableContent"><?php echo tep_round(AFFILIATE_PERCENT, 2) . ' %'; ?></td> 152 <td width="35%" align="right" class="dataTableContent"><b><?php echo TEXT_COMMISSION; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_8) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></b></td> 153 <td width="15%" class="dataTableContent"><b><?php echo $currencies->display_price($affiliate_commission, ''); ?></b></td> 154 </tr> 155 <tr> 156 <td colspan="4"><?php echo tep_draw_separator(); ?></td> 157 </tr> 158 <tr> 159 <td align="center" class="dataTableContent" colspan="4"><b><?php echo TEXT_SUMMARY; ?></b></td> 160 </tr> 161 <tr> 162 <td colspan="4"><?php echo tep_draw_separator(); ?></td> 163 </tr> 164 <tr> 165 <td align="right" class="dataTableContent" colspan="4"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_BANNERS, '') . '">' . tep_image_button('button_affiliate_banners.gif', IMAGE_BANNERS) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_CLICKS, '') . '">' . tep_image_button('button_affiliate_clickthroughs.gif', IMAGE_CLICKTHROUGHS) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_SALES, '') . '">' . tep_image_button('button_affiliate_sales.gif', IMAGE_SALES) . '</a>'; ?></td> 166 </tr> 167 </center> 168 </table></td> 169 </tr> 170 </table></td> 171 </tr> 172 </table></td> 173 <!-- body_text_eof //--> 174 </tr> 175 </table> 176 <!-- body_eof //--> 177 178 <!-- footer //--> 179 <?php require (DIR_WS_INCLUDES . 'footer.php'); ?> 180 <!-- footer_eof //--> 181 <br> 182 </body> 183 </html> 184 <?php require (DIR_WS_INCLUDES . 'application_bottom.php');?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |