Saturday 8 September 2012

SQL Query to check if AP invoices is Accounted or not.

Validated  but not posted.

SELECT INVOICE_NUM
FROM    AP_INVOICES_ALL
WHERE  AP_INVOICES_PKG.GET_APPROVAL_STATUS
                       (INVOICE_ID,
                        INVOICE_AMOUNT,
                        PAYMENT_STATUS_FLAG,
                        INVOICE_TYPE_LOOKUP_CODE
                        ) ='APPROVED' 
 AND AP_INVOICES_PKG.GET_POSTING_STATUS(INVOICE_ID)='N' 
                

Validated  and  posted.

SELECT INVOICE_NUM
FROM    AP_INVOICES_ALL
WHERE  AP_INVOICES_PKG.GET_APPROVAL_STATUS
                       (INVOICE_ID,
                        INVOICE_AMOUNT,
                        PAYMENT_STATUS_FLAG,
                        INVOICE_TYPE_LOOKUP_CODE
                        ) ='APPROVED' 
 AND AP_INVOICES_PKG.GET_POSTING_STATUS(INVOICE_ID)='P' 

7 comments:

  1. SELECT INVOICE_NUM
    FROM AP_INVOICES_ALL
    WHERE AP_INVOICES_PKG.GET_APPROVAL_STATUS
    (INVOICE_ID,
    INVOICE_AMOUNT,
    PAYMENT_STATUS_FLAG,
    INVOICE_TYPE_LOOKUP_CODE
    ) ='APPROVED'
    AND AP_INVOICES_PKG.GET_POSTING_STATUS(INVOICE_ID)='Y' ...
    Can u please tell me What does this Sql query mean ?

    ReplyDelete
  2. Hi Madhu,

    There are 4 different types as below

    'S' - Selected
    'P' - Partial
    'N' - Unposted
    'Y' - Posted

    Regards,
    Anil

    ReplyDelete
  3. Good Job anil...

    ReplyDelete
  4. Hi Anil,

    I have a question about encumbrance amount calculation. In procurement module encumbrance amount is quantity_ordered - quantity_cancelled - Quantity_billed. We enable the budgetary controls after PO is created and and in payable record is showing with insufficient funds,since the budgetary control is enabled. Hence the budget fund analysis report and open purchase order by costcenter reports are showing different amount in payable vrs procurement encumbrance amount. Please advice i need to consider only the amount with account post status flag to 'Y'.

    Thanks
    Manu

    ReplyDelete
  5. with out function how i can check

    ReplyDelete
  6. You have any query which show me all those transaction of payable which is accounted in particular gl period , but which is not transferred to gl period.

    ReplyDelete