View Single Post
  #18  
Old 04-27-2004, 08:39 AM
 
jeremye jeremye is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Philadelphia, PA
Posts: 158
 

Default

This can easily be accomplished by adding a few qualifying statements to the SQL query on Line 110 (or thereabouts): Delete the line where it starts with "$sql = "SELECT tblproducts..." and replace it with the following:

Code:
$sql = "SELECT tblproducts.product, tbldetails.productid, SUM(tbldetails.price*tbldetails.amount) AS total, SUM(tbldetails.amount) AS qty_purchased FROM xcart_order_details AS tbldetails, xcart_products AS tblproducts, xcart_orders AS tblorders WHERE tblproducts.productid=tbldetails.productid AND tbldetails.orderid=tblorders.orderid AND tblorders.date >= $start_date AND tblorders.date <= $end_date AND tblorders.status = 'C' OR tblorders.status = 'P' GROUP BY tbldetails.productid ORDER BY $report_type desc";

Notice that I added two statements:
Code:
AND tblorders.status = 'C' OR tblorders.status = 'P'

This makes sure it only counts orders that are Complete or Processed.

I have tested it on my side and it works fine. Let me know if this helps or not.
__________________
Jeremy
X-Cart Gold v3.4.14 [Linux/Apache]
Heavily Modded
Reply With Quote