PV
Asked
Hello support,
I have a problem and I don't understand why it is not working.
Please see my screenshot.
Thanks
I have a problem and I don't understand why it is not working.
Please see my screenshot.
Thanks
- VNAnsweredi buy this product in codecanyon few years ago but i don't use . At this time, i try to use this product for my family company, i hope it works.
Thanks you. [@Mian Saleem](/u/saleem) , this topic can close - PVAnswered**[Mian Saleem](/u/saleem)** I got this data
- MSAnsweredHello,
Yes. I will update the file this week.
Thank you - PVAnsweredOK so we can use the update version to enable this feature? correct?
- MSAnsweredYes, update will fix the issue. Thanks
- PVAnswered**[Mian Saleem](/u/saleem)** Hello support,
it's been awhile. and now I already updated to V3.4.51, but category report still see nothing.
see my screenshot. - MSAnsweredHello,
The update was released. It might not be due to `parent_id` :(
Let me know the site link with owner account and server details to check.
Thank you - PVAnswered**[Mian Saleem](/u/saleem)** Oh to do that, you need to access my hosting.
and in my hosting there are many sites.
could we work remotely? or can anyone do a skype or online?
thank you - MSAnsweredHello,
Please try to run the following query after selecting your database in phpmyadmin and let me know the result.
```sql
SELECT
sma_categories.id AS cid,
sma_categories.code,
sma_categories.name,
SUM(COALESCE(PCosts.purchasedQty, 0)) AS PurchasedQty,
SUM(COALESCE(PSales.soldQty, 0)) AS SoldQty,
SUM(COALESCE(PCosts.totalPurchase, 0)) AS TotalPurchase,
SUM(COALESCE(PSales.totalSale, 0)) AS TotalSales,
(SUM(COALESCE(PSales.totalSale, 0)) - SUM(COALESCE(PCosts.totalPurchase, 0))) AS Profit
FROM
`sma_categories`
LEFT JOIN (
SELECT
sp.category_id AS category,
SUM(si.quantity) soldQty,
SUM(si.subtotal) totalSale
FROM
sma_products sp
LEFT JOIN sma_sale_items si ON sp.id = si.product_id
LEFT JOIN sma_sales s ON s.id = si.sale_id
GROUP BY
sp.category_id) PSales ON `sma_categories`.`id` = `PSales`.`category`
LEFT JOIN (
SELECT
pp.category_id AS category,
SUM(pi.quantity) purchasedQty,
SUM(pi.subtotal) totalPurchase
FROM
sma_products pp
LEFT JOIN sma_purchase_items pi ON pp.id = pi.product_id
LEFT JOIN sma_purchases p ON p.id = pi.purchase_id
GROUP BY
pp.category_id) PCosts ON `sma_categories`.`id` = `PCosts`.`category`
WHERE (parent_id IS NULL OR `parent_id` = 0)
GROUP BY
`sma_categories`.`id`,
`sma_categories`.`code`,
`sma_categories`.`name`,
`PSales`.`SoldQty`,
`PSales`.`totalSale`,
`PCosts`.`purchasedQty`,
`PCosts`.`totalPurchase`
ORDER BY
`sma_categories`.`code` ASC
LIMIT 10
``` - PVAnswered**[Mian Saleem](/u/saleem)** I run your query and I got the result,
I attached. - Login to Reply