Skip to content

Pay Ops - run report from Pay to see how many PAD and OB credits are still sitting there #25868

Closed

Description

@JohnamLane

As the end of fiscal approaches, Finance is wondering how many people have not spent the credit from their refunds.

These credits will need to be accounted for by SBC Fin if they cross over into the next fiscal.

This would be for any positive credit amount for both PAD and OB no matter when it was created.

Activity

  1. added
    Pay
    on Feb 6, 2025
  2. seeker25 commented on Feb 7, 2025

    @seeker25
    Contributor

    Move up estimate if needed

  3. seeker25 commented on Feb 7, 2025

    @seeker25
    Contributor

    To be done by Next Thursday

  4. self-assigned this
    on Feb 11, 2025
  5. Jxio commented on Feb 11, 2025

    @Jxio
    Collaborator

    select sum(remaining_amount), sum(amount) from pay.credits where is_credit_memo = 't';
    -> 4351.7, 78912.2

    select sum(txn_remaining_amount), sum(txn_amount)
    	from cas.ar_transactions art
    	join pay.credits c on c.cfs_identifier = art.txn_number
    	WHERE txn_class = 'CREDIT MEMO'
    	and c.remaining_amount > 0
    	and art.txn_type in ('BC_REG_CREDIT_MEMO')
    	and is_credit_memo = 't';
    

    -> 4516.7, -4663.7

    SELECT sum(txn_remaining_amount)
    FROM cas.ar_transactions art  
    WHERE txn_class = 'CREDIT MEMO'
    and not EXISTS (  
        SELECT 1  
        FROM cas.ar_applied_receivables aar  
        WHERE aar.applied_from_id = art.txn_id  
        AND aar.applied_from_type = 'CREDIT MEMO'  
        AND aar.applied_to_type = 'INVOICE'  
    )
    and art.txn_type in ('BC_REG_CREDIT_MEMO');
    

    -3683.7

    select count(distinct c.cfs_identifier)
    	from cas.ar_transactions art
    	join pay.credits c on c.cfs_identifier = art.txn_number
    	WHERE txn_class = 'CREDIT MEMO'
    	and c.remaining_amount > 0
    	and art.txn_type in ('BC_REG_CREDIT_MEMO')
    	and is_credit_memo = 't'; 
    

    -> 75

  6. Jxio commented on Feb 12, 2025

    @Jxio
    Collaborator
    SELECT 
        aggregated.account_id, 
        aggregated.total_txn_remaining_amount, 
        aggregated.total_remaining_amount, 
        pa.credit
    FROM (
        SELECT 
            c.account_id,
            SUM(art.txn_remaining_amount) AS total_txn_remaining_amount, 
            SUM(c.remaining_amount) AS total_remaining_amount
        FROM cas.ar_transactions art
        JOIN pay.credits c ON c.cfs_identifier = art.txn_number
        WHERE art.txn_class = 'CREDIT MEMO'
        AND c.remaining_amount > 0
        AND art.txn_type IN ('BC_REG_CREDIT_MEMO')
        AND c.is_credit_memo = 't'  
        GROUP BY c.account_id
    ) AS aggregated
    JOIN pay.payment_accounts pa ON pa.id = aggregated.account_id;
    

    48 accounts have credits. Compared with CAS, 7 accounts show a difference in amount, account ids: 4610, 5593, 8402, 9177, 14368, 20024, 23014, 102522

  7. seeker25 commented on Feb 13, 2025

    @seeker25
    Contributor

    Provided this to Patty, reopen if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PayPay Ops

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions