Saturday, 21 February 2026

AR Credit Memo Applications Report

 AR Credit Memo Applications Report


SELECT AL1.Company_Code, 

       AL1.Org_Id, 

       AL1.Period_MON_YY,

       AL1.Corp_Code,

       AL1.Corp_Name,

       AL1.Customer_Code,

       AL1.Application_Type,

       AL1.Apply_Creation_Date,

       AL1.Application_Status,

       AL1.Credit_Memo,

       AL1.Invoice_Number,

       AL1.Curr_Cd,

       AL1.CM_Amount,

       AL1.Amount_Applied,

       AL1.Appl_Created_by_Id,

       AL1.Appl_Created_by_Name,

   to_char(sysdate,'mm/dd/yyyy hh:mi:ss AM') timestamp


  FROM (SELECT HDR.ORG_ID                            Org_Id,

       SUBSTR(opr.name,1,3)                          Company_Code,

       PRD.PERIOD_NAME                               Period_MON_YY,

       PRD.PERIOD_YEAR                               Period_YYYY,

       CAC.ACCOUNT_NUMBER                            Corp_Code,

       PAR.PARTY_NAME                                Corp_Name, 

       CST.LOCATION                                  Customer_Code, 

       PTS.PARTY_SITE_NAME                           Customer_Name,

       APL.APPLICATION_TYPE                          Application_Type,

       APL.APPLY_DATE                                Apply_Date,

       to_char(APL.CREATION_DATE,'mm/dd/yyyy hh:mi:ss AM')   Apply_Creation_Date,

       APL.STATUS                                    Application_Status,

       hdr.trx_number                                Credit_Memo,

       inv.trx_number                                Invoice_Number,

       hdr.invoice_currency_code                     Curr_Cd,

       pmt.amount_due_original                       CM_Amount,

       APL.AMOUNT_APPLIED                            Amount_Applied,

       USR.USER_ID                                 Appl_Created_by_Id,

       USR.USERNAME                               Appl_Created_by_Name

--

FROM ar_receivable_applications_all  apl,

     hr_operating_units              opr,

    GL_PERIODS                      PRD, 

     HZ_CUST_ACCOUNTS                CAC,

     HZ_PARTIES                      PAR,

     HZ_CUST_SITE_USES_ALL           CST,

     HZ_PARTY_SITES                  PTS,

     HZ_CUST_ACCT_SITES_ALL          SIT,

    PER_USERS                        USR,

     ra_customer_trx_all             hdr,

     ra_customer_trx_all             inv,

     ar_payment_schedules_all        pmt

--

WHERE opr.organization_id              = apl.org_id

  and APL.GL_DATE                      BETWEEN PRD.START_DATE AND PRD.END_DATE 

  AND PRD.PERIOD_SET_NAME              = '4-4-5'

  AND PRD.PERIOD_TYPE                  like 'MONTH%'

  and CAC.cust_account_id              = hdr.bill_to_customer_id

  AND PAR.PARTY_ID(+)                  = CAC.PARTY_ID

  and CST.site_use_id                  = hdr.bill_to_site_use_id

  AND PTS.PARTY_SITE_ID(+)             = SIT.PARTY_SITE_ID

  AND SIT.CUST_ACCT_SITE_ID(+)         = CST.CUST_ACCT_SITE_ID

  and apl.application_type             = 'CM'

  and apl.display                      = 'Y' 

  AND USR.USERNAME                      = APL.CREATED_BY

  and hdr.customer_trx_id              = apl.customer_trx_id 

  and inv.customer_trx_id              = apl.applied_customer_trx_id

  and pmt.customer_trx_id              = hdr.customer_trx_id) AL1

 WHERE 1=1 

    AND Al1.Org_Id = nvl(:p_org_id,Al1.Org_Id)

AND Al1.Company_Code = nvl(:p_company_code,Al1.Company_Code)

AND AL1.Period_MON_YY = nvl(:p_period_MON_YY,AL1.Period_MON_YY)

AND Al1.Credit_Memo = nvl(:p_credit_memo,Al1.Credit_Memo)

AND Al1.Invoice_Number = nvl(:p_invoice_number,Al1.Invoice_Number)

AND Al1.Corp_Code = nvl(:p_corp_code,Al1.Corp_Code)

AND Al1.Customer_Code = nvl(:p_customer_code,Al1.Customer_Code)

 ORDER BY

       AL1.Org_Id,

       AL1.Corp_Name,

       AL1.Credit_Memo,

       AL1.Invoice_Number

No comments: