Question: Category Report Not Working

Category Report Not Working

Hello support, I have a problem and I don't understand why it is not working. Please see my screenshot. Thanks

PV

Prom Vongchann

Asked
Hello support,

I have a problem and I don't understand why it is not working.
Please see my screenshot.

Thanks
  • VN

    Vinh Nguyen

    Answered
    i 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
  • PV

    Prom Vongchann

    Answered
    **[Mian Saleem](/u/saleem)** I got this data
  • MS

    Mian Saleem

    Answered
    Hello,

    Yes. I will update the file this week.

    Thank you
  • PV

    Prom Vongchann

    Answered
    OK so we can use the update version to enable this feature? correct?
  • MS

    Mian Saleem

    Answered
    Yes, update will fix the issue. Thanks
  • PV

    Prom Vongchann

    Answered
    **[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.
  • MS

    Mian Saleem

    Answered
    Hello,

    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
  • PV

    Prom Vongchann

    Answered
    **[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
  • MS

    Mian Saleem

    Answered
    Hello,

    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
    ```
  • PV

    Prom Vongchann

    Answered
    **[Mian Saleem](/u/saleem)** I run your query and I got the result,

    I attached.
  • Login to Reply