Page 1 of 1
Products Purchased Report Problem
Posted: Wed May 27, 2009 8:50 pm
by simrae
Everything seems to be working fine on my test site, apart from something screwy with the "Total" column in the Products Purchased Report. It looks like the Total is taking the total for the order and then multiplying it by the quatity - but this isn't necessary as the total has already been multiplied by the quatity factor - it ends up squaring the result!
I don't believe I have modified anything in my code to introduce this effect, but could you please confirm this for me?
I'm using version 1.2.8
Kindest regards,
Simon...
Re: Products Purchased Report Problem
Posted: Thu May 28, 2009 6:42 pm
by simrae
simrae wrote:It looks like the Total is taking the total for the order and then multiplying it by the quatity - but this isn't necessary as the total has already been multiplied by the quatity factor - it ends up squaring the result!...
I think I've found an answer to the problem here!
Follow this fix at your own risk, until it is confirmed!
I found what I think is the problem in the "report.php" file found in \sitename\admin\model\report.
Find the follwoing section and delete the section highlighted in
RED:
public function getProductPurchasedReport($start = 0, $limit = 20) {
$query = $this->db->query("SELECT op.name, op.model, SUM(op.quantity) AS quantity, SUM((op.total + op.tax) * op.quantity) AS total FROM order_product op LEFT JOIN `order` o ON (op.order_id = o.order_id) WHERE o.order_status_id > '0' GROUP BY model ORDER BY total DESC LIMIT " . (int)$start . "," . (int)$limit);
return $query->rows;
I am not claiming that this IS the bug, but it corrects the output as far as I can see. I'll monitor this fix and report back if I find any unforseen repercussions...
Good luck
Simon...
Re: Products Purchased Report Problem
Posted: Mon Dec 17, 2012 2:19 pm
by yogesh84
I got the same problem that the product purchase report shows the wrong calculation for the total product purchased
Then i checked my admin/model/report/product.php and found query.......
SELECT op.name, op.model, SUM( op.quantity ) AS quantity, SUM( op.total + ( op.total * op.tax /100 ) ) AS total
FROM order_product op
LEFT JOIN `order` o ON ( op.order_id = o.order_id )
i found miss caculation logic applied in query as SUM( op.total + ( op.total * op.tax /100 ) . The mistake i seen that instead of picking the tax rate calulated tax amount has been picked in this query .
Solution that applied that is
SUM( op.total + ( op.tax *op.quantity ) )
this solution works fine for me..................