Consultar Recibos y sus aplicaciones

Posted: noviembre 4, 2009 in AR, SQL & PLSQL
Etiquetas: , , ,

Como parte del ciclo de vida de una factura en AR es necesario cobrarla.. la consulta siguiente ayuda a conocer el estado de los cobros y sus aplicaciones, buscar por un número de cliente y la unidad operativa donde se desea hacer la busqueda

select /*+ INDEX (ara AR_RECEIVABLE_APPLICATIONS_N1), INDEX(acr AR_CHAS_RECEIPTS_N2)*/
           acr.receipt_number                               recibo
         , nvl(ARA.amount_applied_from, ara.amount_applied) importe_aplicado
         , ara.apply_date       fecha_applicacion
         , trx.trx_number       factura
         , hca.account_number   cliente
    from ar_receivable_applications_all ara
       , ar_cash_receipts_all           acr
       , ra_customer_trx_all            trx
       , ra_cust_trx_types_all          ctt
       , hz_cust_accounts               hca
    where hca.cust_account_id          = acr.pay_from_customer
      and acr.cash_receipt_id          = ara.cash_receipt_id
      and ara.applied_customer_trx_id  = trx.customer_trx_id
      and ctt.org_id                   = trx.org_id
      and ctt.type                     = 'INV'
      and trx.cust_trx_type_id         =  ctt.cust_trx_type_id
      and ara.display                  = 'Y'
      and ara.status                   = 'APP'
      and ara.application_type         = 'CASH'
      and acr.org_id                   = trx.org_id
      and acr.org_id                   = &operating_unit
      and hca.account_number           = '&customer_number';
Advertisement

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s