Here is something to get you started on this modification. Insert the code below into a file named TotalRevenue.php in the admin folder of your site. Then there is a code to insert into the CWIncNav.php file that will help you run the simple report from the admin nav area.
<?php
require_once("application.php");
/*
================================================================
Application Info:
Cartweaver© 2002 - 2007, All Rights Reserved.
Developer Info:
Application Dynamics Inc.
1560 NE 10th
East Wenatchee, WA 98802
Support Info:
http://www.cartweaver.com/go/phphelp
Cartweaver Version: 3.0.0 - Date: 4/21/2007
================================================================
Name: Orders.php
Description: Displays a list of orders filtered by the selected "Order Status"
================================================================
*/
/* Set location for highlighting in Nav Menu */
$strSelectNav = "Reports";
/* Set default values for order status and search dates */
if(!isset($_GET["searchBy"])) {$_GET["searchBy"] = 0;}
if(!isset($_POST["StartDate"])) {
$_POST["StartDate"] = cwDateFormat(date("Y/m/d",mktime(0,0,0,date("m"),date("d") - 7, date("y"))),true);
}else{
$theDate = cwGetDateFormat($_POST["StartDate"]);
$month = strftime("%m",$theDate);
$year = strftime("%Y",$theDate);
$day = strftime("%d",$theDate);
$_POST["StartDate"] = cwDateFormat("$year/$month/$day", true);
}
//default is last week
if(!isset($_POST["EndDate"])) {
$_POST["EndDate"] = cwDateFormat(date('Y/m/d'),true);
} else{
//$_POST["EndDate"] = cwDateFormat(cwGetDateFormat($_POST["EndDate"]), true);
$theDate = cwGetDateFormat($_POST["EndDate"]);
$month = strftime("%m",$theDate);
$year = strftime("%Y",$theDate);
$day = strftime("%d",$theDate);
$_POST["EndDate"] = cwDateFormat("$year/$month/$day", true);
}
if(!isset($_POST["Status"])) {$_POST["Status"] = '0';}
if($_GET["searchBy"] != 0) {
$_POST["Status"] = $_GET["searchBy"];
}
$query_rsCWRevenue = sprintf("SELECT O.order_ID,
O.order_Date,
O.order_Status,
O.order_Tax,
O.order_Shipping,
O.order_Total,
O.order_State,
OS.orderSKU_OrderID,
OS.orderSKU_SKUTotal,
OS.orderSKU_TaxRate,
OS.orderSKU_DiscountAmount
FROM tbl_orders O
INNER JOIN tbl_orderskus OS
ON O.order_ID = OS.orderSKU_OrderID
WHERE (O.order_Status = 2 || O.order_Status = 3 || O.order_Status = 9) AND (O.order_Date >= '%s'
AND O.order_Date <= '%s')
%s
ORDER BY order_Date DESC"
,mySQLDate($_POST["StartDate"])
,mySQLDate($_POST["EndDate"])
,($_POST["Status"] != 0) ? " AND order_Status = " .$_POST["Status"] : '');
$rsCWRevenue = $cartweaver->db->executeQuery($query_rsCWRevenue, "rsCWRevenue");
$rsCWRevenue_recordCount = $cartweaver->db->recordCount;
$row_rsCWRevenue = $cartweaver->db->db_fetch_assoc($rsCWRevenue);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Admin: Report Revenue</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="assets/admin.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="JavaScript">
<!--
/* Date Pop Up */
// function to load the calendar window.
function ShowCalendar(FormName, FieldName) {
var curValue = eval("document."+FormName+"."+FieldName+".value");
window.open("DatePopup.php?getDate="+ curValue + "&FormName=" + FormName + "&FieldName=" + FieldName, "CalendarWindow", "width=250,height=200");
}
//Function to clear default text. Function name must stay all lowercase!
function cw_cleardefault(theField){
if(theField.value == theField.defaultValue){theField.value = '';}
}
//-->
</script>
</head>
<body>
<?php include("CWIncNav.php");?>
<div id="divMainContent">
<form name="DateForm" method="post" action="<?php echo($cartweaver->thisPage);?>">
From
<input name="StartDate" type="text" required="yes" message="Must be a date - mm/dd/yyyy format" validate="date" value="<?php echo($_POST["StartDate"]);?>" size="10" passthrough="onFocus=""cw_cleardefault(this);""">
<a href="javascript:ShowCalendar('DateForm', 'StartDate')"><img src="assets/images/calendar.gif" alt="Click to Select Date" width="16" height="16"></a> To
<input name="EndDate" type="text" required="yes" validate="date" message="Must be a date - mm/dd/yyyy format" value="<?php echo($_POST["EndDate"]);?>" size="10" passthrough="onFocus=""cw_cleardefault(this);""">
<a href="javascript:ShowCalendar('DateForm', 'EndDate')"><img src="assets/images/calendar.gif" width="16" height="16" style="margin-bottom:0px;" alt="Click to Select Date"></a>
<input name="Submit" type="submit" class="formButton" value="Get Report">
</form>
<br />
<h1>Report: Revenue
</h1>
<?php /* Results Output table */
if($rsCWRevenue_recordCount !=0) { ?>
<table>
<tr>
<th width="165">Order ID</th>
<th width="170">Order Date</th>
<th width="95">Sku Revenue</th>
<th width="95">Sku Tax Revenue</th>
<th width="95">Shipping Revenue</th>
<th width="95">Shipping Tax Revenue</th>
<th width="95">Discount Credit</th>
<th width="150">Total Revenue</th>
</tr>
<?php /* loop through to show all records found */
if($rsCWRevenue_recordCount == 0) {
echo("<p>No results found.</p>");
}
$recCounter = 0;
do {
?>
<tr style="text-align:center" class="<?php cwAltRow($recCounter++);?>">
<td><?php echo($row_rsCWRevenue["order_ID"]);?></td>
<td><?php echo(cwDateFormat($row_rsCWRevenue["order_Date"],false));?></td>
<td><?php echo($row_rsCWRevenue["orderSKU_SKUTotal"]);?></td>
<td><?php echo($row_rsCWRevenue["orderSKU_TaxRate"]);?></td>
<td><?php echo($row_rsCWRevenue["order_Shipping"]);?></td>
<td><?php echo($row_rsCWRevenue["order_Tax"]);?></td>
<td><?php echo($row_rsCWRevenue["orderSKU_DiscountAmount"]);?></td>
<td><?php echo($row_rsCWRevenue["order_Total"]);?></td>
</tr>
<?php } while ($row_rsCWRevenue = $cartweaver->db->db_fetch_assoc($rsCWRevenue)); ?>
</table>
<?php
} else {
echo("<p><strong>Sorry, no matching records found.");
/* If the user has tried a form search, and there are no results, prompt them to choose different dates */
if (isset ($_POST["StartDate"])) {
echo("Try different dates.");
}
echo("</strong></p>");
}?>
</div>
</body>
</html>
<?php
cwDebugger($cartweaver);
?>
PLACE THIS CODE IN CWIncNav.php I placed it above the Categories tab around line 53
<a href="javascript:;" class="leftNav" id="lnReports" onclick="dwfaq_ToggleOMaticClass(this,'lnReports','leftNavOpen');dwfaq_ToggleOMaticDisplay(this,'lnSubReports');return document.MM_returnValue">Reports</a>
<div id="lnSubReports" class="lnSubMenu" style="display: none;">
<a href="TotalRevenue.php">–Revenue</a>
</div>
Hope this gives you a starting point to complete what you are looking for.