Project

General

Profile

Edit Copy Actions

Feature #251

open

Supplier Productivity Report

Added by Anil KV over 1 year ago. Updated 6 months ago.

Status:
Testing Done
Priority:
Normal
Assignee:
Target version:
Start date:
07/09/2023
Due date:
% Done:

90%

Estimated time:
Owner(Agency):
Travvise
Time Taken(HH):
Module:
Supplier Productivity Report
Tested By:
unnikannan S
Code Reviewed By:

Description

Coding Supplier Productivity Report


Add

Subtasks


Add

Related issues

Actions #1

Updated by Anonymous over 1 year ago

  • Assignee changed from travvise Admin to Karthika V Anand

Updated by Junaid M over 1 year ago

OLD - NOT USE

SELECT    fk_productivity_mapping_id,
                                                 pk_account_id,
                                                 MAX(vhr_account_code) AS account_code,
                                                 MAX(vhr_account_name) AS account_name,
                                                 MAX(vhr_display_name) AS display_name,
                                                 SUM(tmp.dbl_sale) AS dbl_sale,
                                                 SUM(tmp.dbl_refund) AS dbl_refund,
                                                 SUM(tmp.dbl_profit) AS dbl_profit,
                                                 SUM(tmp.dbl_expense) AS dbl_expense

                                                 FROM (SELECT tr.fk_productivity_mapping_id,
                                                              ac.vhr_account_code,
                                                              ac.vhr_account_name,
                                                              ac.vhr_display_name,
                                                              pk_account_id,    
                                                              CASE WHEN tr.dbl_ledg_cur_credit > 0 THEN tr.dbl_ledg_cur_credit ELSE 0.00 END AS dbl_sale,
                                                              CASE WHEN tr.dbl_ledg_cur_debit > 0 THEN tr.dbl_ledg_cur_debit ELSE 0.00 END AS dbl_refund,
                                                              0.00 AS dbl_profit,
                                                              0.00 AS dbl_expense
                                                        FROM transaction.tbl_transaction AS tr
                                                        INNER JOIN accounts.tbl_account AS ac
                                                            ON fk_productivity_mapping_id = ac.pk_account_id
                                                        WHERE tr.sin_posting_status = 1 AND tr.sin_transaction_status = 1 AND tr.sin_document_status = 1
                                                        AND tr.sin_record_type = 5 
                                                        -- ?? WHERE

                                                        UNION ALL

                                                        SELECT tr.fk_productivity_mapping_id,
                                                               ac2.vhr_account_code,
                                                               ac2.vhr_account_name,
                                                               ac2.vhr_display_name,
                                                               ac2.pk_account_id,    
                                                               0.00 AS dbl_sale,
                                                               0.00 AS dbl_refund,
                                                               CASE WHEN tr.dbl_ledg_cur_credit > 0 THEN tr.dbl_ledg_cur_credit ELSE 0.00 END AS dbl_profit,
                                                               CASE WHEN tr.dbl_ledg_cur_debit > 0 THEN tr.dbl_ledg_cur_debit ELSE 0.00 END AS dbl_expense
                                                        FROM transaction.tbl_transaction AS tr
                                                        INNER JOIN accounts.tbl_account AS ac1
                                                            ON tr.fk_ledger_id = ac1.pk_account_id 
                                                        INNER JOIN accounts.tbl_account ac2
                                                            ON tr.fk_productivity_mapping_id = ac2.pk_account_id
                                                        WHERE tr.sin_posting_status = 1 AND tr.sin_transaction_status = 1 AND tr.sin_document_status = 1
                                                        AND ac1.sin_ac_category IN (3, 4)
                                                        -- ??? WHERE
                                                      ) AS tmp

                                                GROUP BY fk_productivity_mapping_id, pk_account_id

New Solutions

1) GUI Change
-Add Status - like ledger Statement
2)SQL
SELECT tr.fk_productivity_mapping_id,
      MAX(ac.vhr_account_code) AS vhr_account_code,
      MAX(ac.vhr_account_name) AS vhr_account_name,
      MAX(ac.vhr_display_name) AS vhr_display_name,
      SUM(CASE WHEN tr.dbl_ledg_cur_credit > 0 THEN tr.dbl_ledg_cur_credit ELSE 0.00 END) AS dbl_refund,--Currency replace based on Input currency
      SUM(CASE WHEN tr.dbl_ledg_cur_debit > 0 THEN tr.dbl_ledg_cur_debit ELSE 0.00 END) AS dbl_sale,--Currency replace based on Input currency
      SUM(tmp.dbl_profit) AS dbl_profit,
      SUM(tmp.dbl_expense) AS dbl_expense
FROM transaction.tbl_transaction AS tr
INNER JOIN accounts.tbl_account AS ac
    ON tr.fk_productivity_mapping_id = ac.pk_account_id
INNER JOIN (SELECT tr.fk_productivity_mapping_id,
        CASE WHEN tr.dbl_ledg_cur_credit > 0 THEN tr.dbl_ledg_cur_credit ELSE 0.00 END AS dbl_profit, --Currency replace based on Input currency
          CASE WHEN tr.dbl_ledg_cur_debit > 0 THEN tr.dbl_ledg_cur_debit ELSE 0.00 END AS dbl_expense--Currency replace based on Input currency
    FROM transaction.tbl_transaction AS tr
        INNER JOIN accounts.tbl_account AS ac
            ON fk_productivity_mapping_id = ac.pk_account_id
    WHERE tr.sin_posting_status = 1 
        AND tr.sin_transaction_status = 1 
        AND tr.sin_document_status = 1
        AND tr.dat_transaction BETWEEN '2023-08-01' AND '2023-08-30'
        AND ac.sin_ac_category IN (3,4) -- Income and Expense account only
        --...
    ) AS tmp
    ON tr.fk_productivity_mapping_id = tmp.fk_productivity_mapping_id
WHERE tr.sin_posting_status = 1 
    AND tr.sin_transaction_status = 1 
    AND tr.sin_document_status = 1
    AND tr.sin_record_type IN (5, 6)
    AND tr.vhr_sys_module_name IN ('SALE', 'REFUND')
    AND tr.dat_transaction BETWEEN '2023-08-01' AND '2023-08-30'
    AND (ac.sin_ac_category = 19 --Supplier
        OR (ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1) -- COA Act as Supplier
        OR (ac.sin_ac_category = 18 AND sin_if_supplier = 1) --Customer act as Supplier
        OR (ac.sin_ac_category = 22 AND sin_if_supplier = 1)) --Airline act as custmer
    --...
GROUP BY tr.fk_productivity_mapping_id
ORDER BY (SUM(tmp.dbl_profit) - SUM(tmp.dbl_expense)) DESC

-- Net = dbl_sale-dbl_refund
--Net Profit = dbl_profit - dbl_expense

Actions #3

Updated by Karthika V Anand over 1 year ago

  • Status changed from New to Coding Started
  • % Done changed from 0 to 40
Actions #4

Updated by Karthika V Anand over 1 year ago

  • Status changed from Coding Started to Particialy Coding Done

Updated by Junaid M over 1 year ago

New Query

SELECT mt.fk_productivity_mapping_id,
    MIN(ac.vhr_account_code) AS vhr_account_code,
    MIN(ac.vhr_account_name) AS vhr_account_name,
    MIN(ac.vhr_display_name) AS vhr_display_name,
    SUM(mt.dbl_sale) AS dbl_sale,
    SUM(mt.dbl_refund) AS dbl_refund,
    SUM(mt.dbl_profit) AS dbl_profit,
    SUM(mt.dbl_expense) AS dbl_expense
FROM ( SELECT tr.fk_productivity_mapping_id,
        CASE WHEN tr.dbl_base_cur_credit > 0 THEN tr.dbl_base_cur_credit ELSE 0.00 END AS dbl_sale,
        CASE WHEN tr.dbl_base_cur_debit > 0 THEN tr.dbl_base_cur_debit ELSE 0.00 END AS dbl_refund,
        0.00 AS dbl_profit,
        0.00 AS dbl_expense
    FROM transaction.tbl_transaction AS tr
    INNER JOIN accounts.tbl_account AS ac
        ON tr.fk_productivity_mapping_id = ac.pk_account_id
    WHERE tr.sin_posting_status = 1 
        AND tr.sin_transaction_status = 1 
        AND tr.sin_document_status = 1
        AND tr.sin_record_type IN (5, 6)
        AND tr.vhr_sys_module_name IN ('SALE', 'REFUND')
        AND tr.dat_transaction BETWEEN CAST('06-09-2023 06:30:00' AS DATE) AND CAST('06-09-2023 06:30:00' AS DATE)
        AND tr.fk_branch_id = ANY(STRING_TO_ARRAY('1', ',')::BIGINT[])  
        AND tr.sin_posting_status = ANY(STRING_TO_ARRAY('1,3', ',')::BIGINT[])  
        AND  (  ac.sin_ac_category = 19 )  AND  (  ac.sin_ac_category = 19 OR ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1 )  
        AND  (  ac.sin_ac_category = 19 OR ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1 OR ac.sin_ac_category = 18 AND sin_if_supplier = 1 )  
        AND  (  ac.sin_ac_category = 19 OR ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1 OR ac.sin_ac_category = 18 AND sin_if_supplier = 1 OR ac.sin_ac_category = 22 AND sin_if_supplier = 1 ) 

    UNION ALL

    SELECT tr.fk_productivity_mapping_id,
        0.00 AS dbl_sale,
        0.00 AS dbl_refund,
        CASE WHEN tr.dbl_base_cur_credit > 0 THEN tr.dbl_base_cur_credit ELSE 0.00 END AS dbl_profit,
        CASE WHEN tr.dbl_base_cur_debit > 0 THEN tr.dbl_base_cur_debit ELSE 0.00 END AS dbl_expense
    FROM transaction.tbl_transaction AS tr
    INNER JOIN accounts.tbl_account AS ac
    ON tr.fk_productivity_mapping_id = ac.pk_account_id
    WHERE tr.sin_posting_status = 1
        AND tr.sin_transaction_status = 1
        AND tr.sin_document_status = 1
        AND tr.dat_transaction BETWEEN CAST('06-09-2023 06:30:00' AS DATE) AND CAST('06-09-2023 06:30:00' AS DATE)
        AND ac.sin_ac_category IN(3,4)
        AND tr.vhr_sys_module_name NOT IN ('SALE', 'REFUND')
        AND   tr.fk_branch_id = ANY(STRING_TO_ARRAY('1', ',')::BIGINT[])  
        AND tr.sin_posting_status = ANY(STRING_TO_ARRAY('1,3', ',')::BIGINT[])  
        AND  (  ac.sin_ac_category = 19 )  AND  (  ac.sin_ac_category = 19 OR ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1 )  
        AND  (  ac.sin_ac_category = 19 OR ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1 OR ac.sin_ac_category = 18 AND sin_if_supplier = 1 )  
        AND  (  ac.sin_ac_category = 19 OR ac.sin_ac_category IN (1,2,3,4) AND sin_if_supplier = 1 OR ac.sin_ac_category = 18 AND sin_if_supplier = 1 OR ac.sin_ac_category = 22 AND sin_if_supplier = 1 ) 
) AS mt
INNER JOIN accounts.tbl_account AS ac
    ON mt.fk_productivity_mapping_id = ac.pk_account_id
GROUP BY mt.fk_productivity_mapping_id;
Actions #6

Updated by Karthika V Anand over 1 year ago

  • Status changed from Particialy Coding Done to Coding Done
  • % Done changed from 40 to 60

Updated by Seema Mathew over 1 year ago

  • Status changed from Coding Done to Reopen Bugs
  • % Done changed from 60 to 50
  • Tested By set to Seema Mathew

ISSUE FOUNDED****

1.ADD TOTAL AMOUNT IN PRINT
2.ERASER FILTER NOT WORKING

Actions #8

Updated by Karthika V Anand over 1 year ago

  • Status changed from Reopen Bugs to Reopen Bugs Coding Done
  • % Done changed from 50 to 60
Actions #9

Updated by Junaid M over 1 year ago

  • Assignee changed from Karthika V Anand to Vivekp V

Updated by unnikannan S over 1 year ago

  • Tested By changed from Seema Mathew to unnikannan S

TESTING DONE

Updated by unnikannan S over 1 year ago

  • Status changed from Reopen Bugs Coding Done to Reopen Bugs
  • % Done changed from 60 to 50

ISSUE FOUNDED

1.SHOW PROFIT,EXPENCE AND NET PROFIT DATA OF SUPPLIER AND ACT US SUPPLIERS A/C S

Updated by Vivekp V over 1 year ago

  • Status changed from Reopen Bugs to Reopen Bugs Coding Done
  • % Done changed from 50 to 60

ISSUE FIXED

1.SHOW PROFIT,EXPENCE AND NET PROFIT DATA OF SUPPLIER AND ACT US SUPPLIERS A/C S

Updated by unnikannan S over 1 year ago

  • Status changed from Reopen Bugs Coding Done to Reopen Bugs
  • % Done changed from 60 to 50

ISSUE FOUNDED

1.DONT SHOW CUSTOMER/FOP SIDE ADDED ACT AS A/C SUPPLIERS

Updated by Vivekp V about 1 year ago

  • Status changed from Reopen Bugs to Reopen Bugs Coding Done
  • % Done changed from 50 to 60

SSUE Fixed

1.DONT SHOW CUSTOMER/FOP SIDE ADDED ACT AS A/C SUPPLIERS

Updated by unnikannan S about 1 year ago

  • Status changed from Reopen Bugs Coding Done to Reopen Bugs
  • % Done changed from 60 to 50

ISSUE FOUNDED

1.SHOWING LEDGERS INCOME/EXPENSE ACCOUNT FROM RECEIPT THAT NOT RELATED WITH THE SUPPLIER PRODUCTIVITY

Updated by Vivekp V about 1 year ago

  • Status changed from Reopen Bugs to Reopen Bugs Coding Done
  • % Done changed from 50 to 60

ISSUE FIXED

1.SHOWING LEDGERS INCOME/EXPENSE ACCOUNT FROM RECEIPT THAT NOT RELATED WITH THE SUPPLIER PRODUCTIVITY

Updated by unnikannan S about 1 year ago

TESTING DONE

Updated by Junaid M about 1 year ago

Issue Found
------------------------
Productivity Amount is wrong when sharing

Actions #19

Updated by Junaid M about 1 year ago

  • Status changed from Reopen Bugs Coding Done to Reopen Bugs
  • % Done changed from 60 to 50

Updated by Vivekp V about 1 year ago

  • Status changed from Reopen Bugs to Reopen Bugs Coding Done
  • % Done changed from 50 to 60

Issue FIXED
------------------------
Productivity Amount is wrong when sharing

Updated by unnikannan S about 1 year ago

TESTING DONE

Actions #22

Updated by unnikannan S 6 months ago

  • Status changed from Reopen Bugs Coding Done to Testing Done
  • % Done changed from 70 to 90
Edit Copy Actions

Also available in: Atom PDF