Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

jello1

Order Tracker New Contrib....

Recommended Posts

Guest

ready to release? just about. if you look at the code, you can see my "worklist."

 

I had wondered about the daily average , but for some strange reason it was working for me, so I left it alone for the moment. Thanks for the fix!

 

As for the year, that is pretty much the most important thing missing, IMO. If you want a quick fix, just change the hardcoded "2004" to "2003". Not graceful, I know, but it'll work as a kluge.

 

-jared

Share this post


Link to post
Share on other sites

When I compare this report to the Monthly Sales/Tax Summary, they do not match.

 

I haven't had a chance to try to figure out what the difference is, but they are not the same.

 

Anyone else have the same issue as I do?

 

Thanks

Share this post


Link to post
Share on other sites

I do remember that when i first wrote this that i had made a mistake and it was x 2 the total sales. i did fix it but i don't think i uploaded the fix......let me look at the code again....


<span style='font-family:Courier'>If you can't fix it Perl it!!!...</span>

******************************

Share this post


Link to post
Share on other sites

I found the problem.

In function get_order_total

 

find this line

$query = "SELECT sum(value) FROM orders_total WHERE orders_id > \"$first\" and orders_id < \"$last\" and class = \"ot_total\"";

 

change it to

$query = "SELECT sum(value) FROM orders_total WHERE orders_id >= \"$first\" and orders_id <= \"$last\" and class = \"ot_total\"";

 

I hope this helps

 

Chris

Share this post


Link to post
Share on other sites

Yup... that's it.. good job..

how do you like the crontrib so far?...

still need to make a link in the admin.. but i think jared might be doing that... i think..


<span style='font-family:Courier'>If you can't fix it Perl it!!!...</span>

******************************

Share this post


Link to post
Share on other sites

I really like it.

I would like to have the drop down for the year and have it default to current year when you first run the report. I am doing some experimenting with the code to see if I can do this myself.

 

Chris

Share this post


Link to post
Share on other sites

cool....let us know how it goes


<span style='font-family:Courier'>If you can't fix it Perl it!!!...</span>

******************************

Share this post


Link to post
Share on other sites
Guest

link in admin already done, just follow the installation instructions in the beginning comments of the code.

 

-jared

Share this post


Link to post
Share on other sites

While working on a "enter year" feature, I notice the November sales do not match what is in my Monthly Sales/Tax Summary.

 

It is very strange, every other month is now a perfect match except November of 2003. I guess I'll have to dig deeper.

Share this post


Link to post
Share on other sites
Guest

I noticed that too. I listed it in the worklist as:

// check math for Today's average (and dollar amount) vs. Daily Average (and dollar amount) .

 

I'm nearly done with a new staging area for my website. I'll just clear out all of the customers and orders, then enter in some test orders for even dollar amounts for testing purposes. Hopefully that will help us figure out what the deal is.

 

-jared

Share this post


Link to post
Share on other sites

Hmmm...strange i have the same problem.... i thinks it's a double call...


<span style='font-family:Courier'>If you can't fix it Perl it!!!...</span>

******************************

Share this post


Link to post
Share on other sites
Guest

found another problem, where the daily total was always missing one order.

 

Right under the line that says:

# Grab the sum of all orders greater than t and less than k

 

change the line:

$query = "SELECT sum(value) FROM orders_total WHERE orders_id > \"$t\" and orders_id < \"$k\" and class = \"ot_total\"";

 

to read:

$query = "SELECT sum(value) FROM orders_total WHERE orders_id > \"$t\" and orders_id <= \"$k\" and class = \"ot_total\"";

 

I've also fixed (I hope) the "yesterday" function, after I noticed it said on March 1 that yesterday was Feb 31. Hopefully that's taken care of now.

 

The year is also no longer hardcoded to 2004 anywhere, but rather the current year. I figured out how to make the year variable based on what gets sent via the URL (i.e. append ?year=2003 and you'll get 2003 numbers) but I haven't yet figured out how to resubmit the request for the page to include that year figure. Hopefully today.

 

-jared

Share this post


Link to post
Share on other sites
Guest

ok - - here goes the latest attempt, including posted fixes, AND A BRAND NEW CAR! Ok, maybe just a selectable year. <grin>

 

Note slight changes to the worklist as well as to the install instructions.

 

Methinks this may be ready to post as a contrib. Thoughts?

 

-jared

 

<?php

require('includes/application_top.php');

 

// WORKLIST

// finish loop code for month data?

// orders shipped this month/year -- way to do this without adding date field to orders_total?

// orders shipped this year -- way to do this without adding date field to orders_total?

// clean up variable names. $i==total_customers? $j==orders_today? $w==customers_online? $day=$yesterday?

// add calculation for gift vouchers? This would sort of merge this report with the monthly sales/tax contrib's functionality

 

// FIXED? TEST at beginning of month. yesterday should never be the 0th (zero-th) day

 

 

/* Installation instructions

1) Copy /admin/orders_tracking.php (this file)

2) Edit /admin/fileames.php. Add the following to the end of the file, just prior to the ?> line:

define('FILENAME_STATS_ORDERS_TRACKING', 'orders_tracking.php'); to /admin/filenames.php

3) Save the followig as /admin/includes/language/english/orders_tracking.php:

<?php

define('HEADING_TITLE', 'Daily Sales Summary');

define('HEADING_SELECT_YEAR', 'Enter Year');

?>

4) Edit /admin/includes/boxes/reports.php. It's a small file. Find the section with lines that look like the following one, and add the following line (this reads easier with word wrap off):

'<a href="' . tep_href_link(FILENAME_STATS_ORDERS_TRACKING, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TRACKING . '</a><br>'

You can add the line in any order you want, but make sure to follow the correct syntax. The finished section could look like this:

if ($selected_box == 'reports') {

$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_VIEWED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_VIEWED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_PRODUCTS_PURCHASED . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_STATS_ORDERS_TRACKING, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TRACKING . '</a>');

}

*/

 

 

 

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td><?php

echo tep_draw_form('search', FILENAME_STATS_ORDERS_TRACKING, '', 'get');

echo HEADING_SELECT_YEAR . ' ' . tep_draw_input_field('year');

echo '</form>';

?>

 

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

 

<?php

setlocale(LC_MONETARY, 'en_US');

 

function get_month($mo, $yr) {

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$yr-$mo%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$k=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$k++;

}

mysql_free_result($result);

$month=$k;

return $month;

}

 

function get_order_total($mo, $yr) {

$query = "SELECT orders_id FROM orders WHERE date_purchased LIKE \"$yr-$mo%\" ORDER by orders_id";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$k=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

if ( $k == 0 ) {

$first=$col_value;

$k++;

} else {

$last=$col_value;

}

}

}

mysql_free_result($result);

 

$query = "SELECT sum(value) FROM orders_total WHERE orders_id >= \"$first\" and orders_id <= \"$last\" and class = \"ot_total\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$total=$col_value;

}

}

mysql_free_result($result);

return $total;

}

 

function get_status($type) {

$query = "SELECT orders_status FROM orders WHERE orders_status = \"$type\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$k=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$k++;

}

}

mysql_free_result($result);

return $k;

}

 

# Get total dollars in orders

 

$query = "SELECT sum(value) FROM orders_total WHERE class = \"ot_total\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$grand_total=$col_value;

}

}

mysql_free_result($result);

 

# Get total shipping charges

 

$query = "SELECT sum(value) FROM orders_total WHERE class like \"ot_shipping\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$shipping=$col_value;

}

}

mysql_free_result($result);

 

 

# Get total number of customers

 

$query = "SELECT * FROM customers";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$i=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$i++;

}

mysql_free_result($result);

 

# Get total number new customers

$like = date('Y-m-d');

$query = "SELECT customers_info_date_account_created FROM customers_info WHERE customers_info_date_account_created like \"$like%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$newcust=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$newcust++;

}

mysql_free_result($result);

 

# Whos online

$query = "SELECT * FROM whos_online";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$w=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$w++;

}

mysql_free_result($result);

$who = $w;

 

# Whos online again

$query = "SELECT * FROM whos_online WHERE customer_id != \"0\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$who_again=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$who_again++;

}

mysql_free_result($result);

 

# How many orders today total

 

$date = date('Y-m-d'); #2003-09-07%

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$date%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$j=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$j++;

}

mysql_free_result($result);

 

# How many orders yesterday

 

$mo = date('m');

$today = date('d');

$year = date('Y');

 

 

/*

if ( $day <= 10 ) {

$day = $day - 1;

// next line to normalize $day format to 2 digits

$day = "0$day";

} elseif ( $day == "01" ) {

$day = "31";

} else {

$day = $day - 1;

}

*/

 

$last_month = $mo-1;

if ( $last_month == 0) $last_month = 12; //if jan, then last month is dec (12th mo, not 0th month)

$day = date('d') - 1;

if ($day == "0") //today is the first day of the month, now "Thirty days hath November . . ." for the prev month

{ if ( ($last_month == 1) OR ($last_month == 3) OR ($last_month == 5) OR ($last_month == 7) OR ($last_month == 8) OR ($last_month == 10) OR ($last_month == 12) )

$day = "31";

elseif ( ($last_month == 4) OR ($last_month == 6) OR ($last_month == 9) OR ($last_month == 11) )

$day = "30";

//calculate Feb end day, including leap year calculation from http://www.mitre.org/tech/cots/LEAPCALC.html

else {

if ( ($year % 4) != 0) $day = "28";

elseif ( ($year % 400) == 0) $day = "29";

elseif ( ($year % 100) == 0) $day = "28";

else $day = "29";

}

}

 

// next line to normalize $day format to 2 digits

if ($day <10) {$day = "0$day";}

$date = date('Y-m');

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$date-$day%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$l=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$l++;

}

mysql_free_result($result);

$yesterday=$l;

// $yesterday = $day;

 

# Get the total number of order_id's

 

$query = "SELECT orders_id FROM orders_total WHERE class = \"ot_total\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$k=$col_value;

}

}

mysql_free_result($result);

 

# Calculate the order_id number less the number of orders today

$k = $k - $j;

$t = $k - $l;

 

# Grab the sum of all orders greater than k

 

$query = "SELECT sum(value) FROM orders_total WHERE orders_id > \"$k\" and class = \"ot_total\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$orders_today=$col_value;

}

}

mysql_free_result($result);

 

# Grab the sum of all orders greater than t and less than k

 

// $query = "SELECT sum(value) FROM orders_total WHERE orders_id > \"$t\" and orders_id < \"$k\" and class = \"ot_total\"";

$query = "SELECT sum(value) FROM orders_total WHERE orders_id > \"$t\" and orders_id <= \"$k\" and class = \"ot_total\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$orders_yesterday=$col_value;

}

}

mysql_free_result($result);

 

# How many repeat orders today total

 

$date = date('Y-m-d');

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$date%\" AND customers_id < \"$k\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$repeat_orders=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$repeat_orders++;

}

mysql_free_result($result);

 

# Find all repeat orders

 

$date = date('Y-m-d');

$query = "SELECT customers_id FROM orders ORDER by customers_id";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$repeats=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

foreach ($line as $col_value) {

$cust_id=$col_value;

if ( $cust_id == $cust_id_last ) {

$repeats++;

}

$cust_id_last=$cust_id;

}

}

mysql_free_result($result);

 

 

# How many per month

 

// if a year has been entered as part of the URL, use that year instead

if (isset($HTTP_GET_VARS['year'])) $year=$HTTP_GET_VARS['year'];

else $year = date('Y'); #current year

 

 

$month = date('M'); #current month

 

$dec = get_month("12", $year);

$nov = get_month("11", $year);

$oct = get_month("10", $year);

$sep = get_month("09", $year);

$aug = get_month("08", $year);

$jul = get_month("07", $year);

$jun = get_month("06", $year);

$may = get_month("05", $year);

$apr = get_month("04", $year);

$mar = get_month("03", $year);

$feb = get_month("02", $year);

$jan = get_month("01", $year);

$current_month = get_month($mo, $year);

 

 

# Only Process Month Info if Month has info to process

# Always tally totals, even if zero

 

# while ($i < 13)

# (

# $month_avg = $month_total / $current_month;

# $current_month_total = get_order_total($i, $year);

# $order = $order + $current_month_total;

# )

# $i++;

 

$jan_total = get_order_total("01", $year);

if ($jan != 0) $jan_avg = $jan_total / $jan;

$order = $order + $jan_total;

 

$feb_total = get_order_total("02", $year);

if ($feb != 0) $feb_avg = $feb_total / $feb;

$order = $order + $feb_total;

 

$mar_total = get_order_total("03", $year);

if ($mar != 0) $mar_avg = $mar_total / $mar;

$order = $order + $mar_total;

 

$apr_total = get_order_total("04", $year);

if ($apr != 0) $apr_avg = $apr_total / $apr;

$order = $order + $apr_total;

 

$may_total = get_order_total("05", $year);

if ($may != 0) $may_avg = $may_total / $may;

$order = $order + $may_total;

 

$jun_total = get_order_total("06", $year);

if ($jun != 0) $jun_avg = $jun_total / $jun;

$order = $order + $jun_total;

 

$jul_total = get_order_total("07", $year);

if ($jul != 0) $jul_avg = $jul_total / $jul;

$order = $order + $jul_total;

 

$aug_total = get_order_total("08", $year);

if ($aug != 0) $aug_avg = $aug_total / $aug;

$order = $order + $aug_total;

 

$sep_total = get_order_total("09", $year);

if ($sep != 0) $sep_avg = $sep_total / $sep;

$order = $order + $sep_total;

 

$oct_total = get_order_total("10", $year);

if ($oct != 0) $oct_avg = $oct_total / $oct;

$order = $order + $oct_total;

 

$nov_total = get_order_total("11", $year);

if ($nov != 0) $nov_avg = $nov_total / $nov;

$order = $order + $nov_total;

 

$dec_total = get_order_total("12", $year);

if ($dec != 0) $dec_avg = $dec_total / $dec;

$order = $order + $dec_total;

 

$current_month_total = get_order_total($mo, $year);

if ($current_month != 0) $current_month_avg = $current_month_total / $current_month;

 

 

 

# Order Status

$pending = get_status("1");

$processing = get_status("2");

$delivered = get_status("3");

$shipped = get_status("4");

 

# Daily Averages

if ($j !=0 ) $today_avg = $orders_today / $j;

else $today_avg = 0;

if ($yesterday != 0) $yesterday_avg = $orders_yesterday / $yesterday;

else ($yesterday_avg = 0);

 

$daily = $current_month / $today;

$daily_total = $current_month_total / $today;

 

if ($daily) $daily_avg = $daily_total / $daily;

else ($daily_avg = 0);

 

# Calculate days in this month for accurate sales projection

 

if ( ($mo == 1) OR ($mo == 3) OR ($mo == 5) OR ($mo == 7) OR ($mo == 8) OR ($mo == 10) OR ($mo == 12) )

$days_this_month = "31";

elseif ( ($mo == 4) OR ($mo == 6) OR ($mo == 9) OR ($mo == 11) )

$days_this_month = "30";

//calculate Feb end day, including leap year calculation from http://www.mitre.org/tech/cots/LEAPCALC.html

else {

if ( ($year % 4) != 0) $days_this_month = "28";

elseif ( ($year % 400) == 0) $days_this_month = "29";

elseif ( ($year % 100) == 0) $days_this_month = "28";

else $days_this_month = "29";

}

 

# Projected Profits this month

$projected = $daily * $days_this_month;

$projected_total = $daily_total * $days_this_month;

 

$gross_profit = $grand_total * .3;

 

$year_profit = $order * .3;

 

If ($newcust != 0) $close_ratio = $j / $newcust;

else $close_ratio = 0;

 

# format test into current

$total_orders = $jan + $feb + $mar + $apr + $may + $jun + $jul + $aug + $sep + $oct + $nov + $dec;

if ($total_orders != 0) $total = $order / $total_orders;

$total = number_format($total,2,'.',',');

 

$order = number_format($order,2,'.',',');

$grand_total = number_format($grand_total,2,'.',',');

 

$gross_profit = number_format($gross_profit,2,'.',',');

$year_profit = number_format($year_profit,2,'.',',');

 

$projected = number_format($projected,0,'.',',');

$projected_total = number_format($projected_total,2,'.',',');

 

$close_ratio = number_format($close_ratio,2,'.',',');

 

$yesterday_avg = number_format($yesterday_avg,2,'.',',');

 

$dec_total = number_format($dec_total,2,'.',',');

$nov_total = number_format($nov_total,2,'.',',');

$oct_total = number_format($oct_total,2,'.',',');

$sep_total = number_format($sep_total,2,'.',',');

$aug_total = number_format($aug_total,2,'.',',');

$jul_total = number_format($jul_total,2,'.',',');

$jun_total = number_format($jun_total,2,'.',',');

$may_total = number_format($may_total,2,'.',',');

$apr_total = number_format($apr_total,2,'.',',');

$mar_total = number_format($mar_total,2,'.',',');

$feb_total = number_format($feb_total,2,'.',',');

$jan_total = number_format($jan_total,2,'.',',');

 

 

$orders_today = number_format($orders_today,2,'.',',');

$orders_yesterday = number_format($orders_yesterday,2,'.',',');

 

$dec_avg = number_format($dec_avg,2,'.',',');

$nov_avg = number_format($nov_avg,2,'.',',');

$oct_avg = number_format($oct_avg,2,'.',',');

$sep_avg = number_format($sep_avg,2,'.',',');

$aug_avg = number_format($aug_avg,2,'.',',');

$jul_avg = number_format($jul_avg,2,'.',',');

$jun_avg = number_format($jun_avg,2,'.',',');

$may_avg = number_format($may_avg,2,'.',',');

$apr_avg = number_format($apr_avg,2,'.',',');

$mar_avg = number_format($mar_avg,2,'.',',');

$feb_avg = number_format($feb_avg,2,'.',',');

$jan_avg = number_format($jan_avg,2,'.',',');

 

$today_avg = number_format($today_avg,2,'.',',');

 

if ($total_orders !=0) $shipping_avg = $shipping / $total_orders;

else $shipping_avg = 0;

 

$shipping_avg = number_format($shipping_avg,2,'.',',');

$shipping = number_format($shipping,2,'.',',');

 

$daily = number_format($daily,2,'.',',');

$daily_total = number_format($daily_total,2,'.',',');

$daily_avg = number_format($daily_avg,2,'.',',');

?>

 

<CENTER>

<TABLE BORDER=1 CELLPADDING=5 CELLSPACING=1>

<TR class="dataTableHeadingRow" bgcolor=silver><th class="dataTableHeadingContent">Description<th class="dataTableHeadingContent">Order Count<th class="dataTableHeadingContent">Dollar<th class="dataTableHeadingContent">Average</TR>

<!-- <TR bgcolor=silver><TH>Description<TH>Order Count<TH>Dollar<TH>Average</TR> -->

 

<TR class="dataTableRow">

<td class="dataTableContent" align="left"><A href="orders.php?selected_box=customers&status=1">Today <?php echo "$mo-$today"; ?></a></TD><td class="dataTableContent" align="left"><A href="orders.php?selected_box=customers&status=1"><?php echo "$j ($repeat_orders)"; ?> *</a></TD>

<td class="dataTableContent" align=right>$<?php echo $orders_today ?></TD>

<td class="dataTableContent" align=right>$<?php echo $today_avg ?></TD>

</TR>

<TR class="dataTableRow">

<td class="dataTableContent">Yesterday <?php echo "$mo-$day"; ?></TD>

<td class="dataTableContent"><?php echo $yesterday ?></TD>

<td class="dataTableContent" align=right>$<?php echo $orders_yesterday ?></TD>

<td class="dataTableContent" align=right>$<?php echo $yesterday_avg ?></TD>

</TR>

<TR class="dataTableRow">

<td class="dataTableContent">Daily Average for <?php echo $month ?></TD>

<td class="dataTableContent"><?php echo $daily ?></TD><td class="dataTableContent" align=right>$<?php echo $daily_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $daily_avg ?></TD>

</TR>

<TR class="dataTableRow">

<td class="dataTableContent">Projected #'s for <?php echo $month ?></TD>

<td class="dataTableContent"><?php echo $projected ?></TD>

<td class="dataTableContent" align=right>$<?php echo $projected_total ?></TD>

<td class="dataTableContent" align=right> </TD>

</TR>

 

<TR valign="bottom"><TD bgcolor=silver colspan=4></TD></TR>

 

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Jan <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $jan ?></TD>

<td class="dataTableContent" align=right>$<?php echo $jan_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $jan_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Feb <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $feb ?></TD>

<td class="dataTableContent" align=right>$<?php echo $feb_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $feb_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Mar <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $mar ?></TD>

<td class="dataTableContent" align=right>$<?php echo $mar_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $mar_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Apr <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $apr ?></TD>

<td class="dataTableContent" align=right>$<?php echo $apr_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $apr_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >May <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $may ?></TD>

<td class="dataTableContent" align=right>$<?php echo $may_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $may_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Jun <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $jun ?></TD>

<td class="dataTableContent" align=right>$<?php echo $jun_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $jun_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Jul <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $jul ?></TD>

<td class="dataTableContent" align=right>$<?php echo $jul_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $jul_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Aug <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $aug ?></TD>

<td class="dataTableContent" align=right>$<?php echo $aug_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $aug_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Sep <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $sep ?></TD>

<td class="dataTableContent" align=right>$<?php echo $sep_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $sep_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Oct <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $oct ?></TD>

<td class="dataTableContent" align=right>$<?php echo $oct_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $oct_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Nov <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $nov ?></TD>

<td class="dataTableContent" align=right>$<?php echo $nov_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $nov_avg ?></TD></TR>

 

<TR>

<TR class="dataTableRow"><td class="dataTableContent" >Dec <?php echo $year ?> Orders</TD><td class="dataTableContent" > <?php echo $dec ?></TD>

<td class="dataTableContent" align=right>$<?php echo $dec_total ?></TD>

<td class="dataTableContent" align=right>$<?php echo $dec_avg ?></TD></TR>

 

<TR class="dataTableRow" >

<td class="dataTableContent" NOWRAP><B>Total <?php echo $year ?> Orders</TD><td class="dataTableContent"><B><?php echo "$total_orders / $repeats"; ?> *</TD><td class="dataTableContent" align=right><B>$<?php echo $order ?></TD><td class="dataTableContent" align=right><B>$<?php echo $total ?></TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent"><B><?php echo $year ?> Profit @ 30%</TD><td class="dataTableContent" colspan=2 align=right><B>$<?php echo $year_profit ?></TD><td class="dataTableContent" align=right> </TD></TR>

 

<TR valign="bottom"><TD bgcolor=silver colspan=4></TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">Total Customers</TD><td class="dataTableContent"><?php echo $i ?></TD><td class="dataTableContent"><A href="whos_online.php">Online Now</a></TD><td class="dataTableContent"><?php echo "$who / $who_again"; ?> *</TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">New Customers Today</TD><td class="dataTableContent"><?php echo $newcust ?></TD><td class="dataTableContent">Close ratio</TD><td class="dataTableContent"><?php echo $close_ratio ?>%</TR>

 

<TR class="dataTableHeadingRow" bgcolor=silver><td class="dataTableContent" class="dataTableHeadingContent" COLSPAN=4><b><center><br>**Grand Totals</b></center></TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent"><B>Grand Total**</TD><td class="dataTableContent" colspan=2 align=right><B>$<?php echo $grand_total ?></TD><td class="dataTableContent" align=right> </TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent"><B>Gross Profit @ 30%</TD><td class="dataTableContent" colspan=2 align=right><B>$<?php echo $gross_profit ?></TD><td class="dataTableContent" align=right> </TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">Orders Pending</TD><td class="dataTableContent"><?php echo $pending ?></TD><td class="dataTableContent" colspan=2 align=right> </TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">Orders Processing</TD><td class="dataTableContent"><?php echo $processing ?></TD><td class="dataTableContent" colspan=2 align=right> </TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">Orders Shipped</TD><td class="dataTableContent"><?php echo $shipped ?></TD><td class="dataTableContent" colspan=2 align=right> </TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">Orders Delivered</TD><td class="dataTableContent"><?php echo $delivered ?></TD><td class="dataTableContent" colspan=2 align=right> </TD></TR>

<TR class="dataTableRow" ><td class="dataTableContent">Shipping Charges</TD><td class="dataTableContent" colspan=2 align=right>$<?php echo $shipping ?></TD><td class="dataTableContent" align=right>$<?php echo $shipping_avg ?></TD></TR>

 

 

 

</TABLE>

 

<FONT SIZE=-1>

<br>

* - total / repeat customer

<BR>

** - Grand Totals since database inception. Raw numbers pulled from database on select * from orders_total</FONT>

 

<!-- <br>//<?php echo $current_month_total ?> -->

 

 

</td>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

 

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

SWEET!!!!... works great! wow.. i'm really impressed jared...

let's package it and release it!...

 

you have done an outstanding job on this..


<span style='font-family:Courier'>If you can't fix it Perl it!!!...</span>

******************************

Share this post


Link to post
Share on other sites
Guest

I'm not sure - - I just went live in December, I don't have any November stats. Let me see if I can force some November stats on my staging area.

 

-jared

Share this post


Link to post
Share on other sites
Guest

I've made some bogus 2003 orders, and am seeing the same problem - - March 2003 order totals look fine, Nov 2003 orders do not.

 

My Nov 2003 order total *should* be $252.90, but is displayed as $488.00

 

Strange.

 

I'll see what I can find out, fix it, and release.

 

-jared

Share this post


Link to post
Share on other sites
Guest

Jello --

 

I haven't figured out the November stats thing yet, but I have a question for you and then a fix for y'all.

 

Question for Jello: You created a stat called "Close Ratio". I'm confused as to what it's supposed to represent. The code is as follows:

 

If ($newcust != 0) $close_ratio = $j / $newcust;

 

In other words, if there are new customers today (i.e. someone signed up for an account), then $close_ratio is $j (total orders for today) divided by the number of new customers.

 

???

 

I also have the PWA contribution installed, so not all purchasing customers create accounts. BUT, even if they did, this stat still doesn't quite make sense to me.

 

What are we trying to count?

 

Fix for y'all: If you noticed, there are some garbage characters (at least if you use Mozilla, I never checked with IE) at the bottom of the page. This is because application_top is being called AFTER the </html>. All you need to do is change this:

 

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

to this:

 

<!-- footer_eof //-->

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

</body>

</html>

 

and it'll display fine and dandy.

 

I've also added a missing step 5) to the install instructions as follows:

 

5) Edit /admin/includes/languages/english.php and add the following just before the closing ?>

 

// Orders_Tracking Contrib

define('BOX_REPORTS_ORDERS_TRACKING', 'Orders_Tracking');

 

My wife (it's really her store, I'm just the programmer <grin>) also wants me to make a few more of the stats into links, so I'll do that quickly before releasing.

 

So . . . Here are the few remaining things that'll be addressed before releasing, IMO:

1) November stats need to work

2) Clarify "Close Ratio"

3) Make a couple of more stats into links (like Orders Shipped to go to the orders.php?status=4 or whatever that link is . . .)

 

-jared

Share this post


Link to post
Share on other sites
Guest

Ok, my wife has just told me that some of the shipping statuses that we have in there (like Shipped) are not stock osC.

 

So . . . Unless someone can tell me quickly (I'm lazy, tired, and going to bed, so I'll look it up tomorrow maybe) which shipping statuses are in there by default, I'll take a bit more time to take the extraneous ones out and then add them back in for myself.

 

I don't want to cause confusion with extra items that don't show up in other stores.

 

-jared

Share this post


Link to post
Share on other sites

Pending, Processing, Delivered


No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Share this post


Link to post
Share on other sites

I don't use Delivered either. I use Shipped. Because you don't know that it was delivered. You only know it was shipped.

 

I'm not sure on the close ratio. Yes, I think it's important to know this type of information. But wouldn't it be better to know the total number of vistors per day vs the number of orders?

 

This would be conversion ration? Not necessarily new customers but all customers.

Share this post


Link to post
Share on other sites
Guest

Talon: We're on the verge of releasing this.

 

Chris: Do you have *real* data from last November? With the fake data that I made up, all I found was that when I manually modify dates in the orders table, that if the relative position of those orders in the orders_total table has to match up or I get very goofy results.

 

Has *anyone* else gotten bad November totals on *real* data?

 

-jared

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×