AR_OPEN_ITEMS_V

Details

  • Schema: FUSION

  • Object owner: AR

  • Object type: VIEW

Columns

Name

TRX_NUMBER

CUSTOMER_ID

CUSTOMER_NUMBER

CUSTOMER_NAME

LOCATION

CLASS

CLASS_MEANING

TRX_TYPE

CUST_TRX_TYPE_ID

INVOICE_CURRENCY_CODE

BALANCE_DUE_CURR

BALANCE_DUE_CURR_UNFORMATTED

BALANCE_DUE_FUNCTIONAL

AMOUNT_DUE_ORIGINAL

AMOUNT_LINE_ITEMS_ORIGINAL

DISCOUNT_TAKEN_EARNED

DISCOUNT_TAKEN_UNEARNED

TRX_EXCHANGE_RATE

TRX_DATE

TRX_GL_DATE

TRX_DUE_DATE

TERM_ID

CALC_DISCOUNT_ON_LINES_FLAG

PARTIAL_DISCOUNT_FLAG

ALLOW_OVERAPPLICATION_FLAG

NATURAL_APPLICATION_ONLY_FLAG

CREATION_SIGN

PAYMENT_SCHEDULE_ID

TERMS_SEQUENCE_NUMBER

CUSTOMER_TRX_ID

STATUS

PURCHASE_ORDER

INTERFACE_HEADER_ATTRIBUTE1

INTERFACE_HEADER_ATTRIBUTE2

INTERFACE_HEADER_ATTRIBUTE3

INTERFACE_HEADER_ATTRIBUTE4

INTERFACE_HEADER_ATTRIBUTE5

INTERFACE_HEADER_ATTRIBUTE6

INTERFACE_HEADER_ATTRIBUTE7

INTERFACE_HEADER_ATTRIBUTE8

INTERFACE_HEADER_ATTRIBUTE9

INTERFACE_HEADER_ATTRIBUTE10

INTERFACE_HEADER_ATTRIBUTE11

INTERFACE_HEADER_ATTRIBUTE12

INTERFACE_HEADER_ATTRIBUTE13

INTERFACE_HEADER_ATTRIBUTE14

INTERFACE_HEADER_ATTRIBUTE15

TRX_BATCH_SOURCE_NAME

AMOUNT_ADJUSTED

AMOUNT_ADJUSTED_PENDING

AMOUNT_LINE_ITEMS_REMAINING

FREIGHT_ORIGINAL

FREIGHT_REMAINING

RECEIVABLES_CHARGES_REMAINING

TAX_ORIGINAL

TAX_REMAINING

SELECTED_FOR_RECEIPT_BATCH_ID

TRX_BILLING_NUMBER

BILL_TO_SITE_USE_ID

DEFAULT_REFERENCE

OPEN_RECEIPT_STATUS

OPEN_RECEIPT_STATUS_MEANING

CUSTOMER_REFERENCE

REASON

RECEIVABLE_APPLICATION_ID

APPLICATION_REF_NUM

ACCOUNT_DESCRIPTION

CUSTOMER_REASON

Query

SQL_Statement

SELECT

/* PURPOSE: THIS VIEW IS USED MAINLY IN APPLICATIONS LOVS TO SHOW */

/* OPEN TRANSACTIONS */ ps.trx_number trx_number,

ps.customer_id customer_id,

cst.account_number customer_number,

cst_party.party_name customer_name,

su.location location,

ps.class class,

decode(ps.customer_id, -1, NULL, -3, NULL, -4, NULL,

arpt_sql_func_util.get_lookup_meaning('INV/CM', ps.class)) class_meaning,

ctt.name trx_type,

ps.cust_trx_type_seq_id cust_trx_type_id,

ps.invoice_currency_code invoice_currency_code,

SUBSTR(decode(SIGN(ps.customer_id), -1, NULL,

to_char(decode(app.status, NULL, ps.amount_due_remaining,

SUM(app.amount_applied) * -1),

fnd_currency.get_format_mask(decode(SIGN(ps.payment_schedule_id),

-1, 'USD', ps.invoice_currency_code), 30))), 1, 30)

balance_due_curr,

decode(app.status, NULL, ps.amount_due_remaining,

SUM(app.amount_applied) * -1) balance_due_curr_unformatted,

decode(app.status, NULL, ps.acctd_amount_due_remaining,

SUM(app.acctd_amount_applied_from) * -1) balance_due_functional,

ps.amount_due_original amount_due_original,

ps.amount_line_items_original amount_line_items_original,

ps.discount_taken_earned discount_taken_earned,

ps.discount_taken_unearned discount_taken_unearned,

ps.exchange_rate trx_exchange_rate,

decode(ps.class, 'PMT', cr.receipt_date, ct.trx_date) trx_date,

ps.gl_date trx_gl_date,

TRUNC(decode(SIGN(ps.customer_id), -1,

fnd_date.canonical_to_date(NULL), decode(ps.class, 'PMT',

cr.receipt_date, ps.due_date))) trx_due_date,

ps.term_id term_id,

t.calc_discount_on_lines_flag calc_discount_on_lines_flag,

t.partial_discount_flag partial_discount_flag,

decode(ps.payment_schedule_id, -3, 'N',

ctt.allow_overapplication_flag) allow_overapplication_flag,

decode(ps.payment_schedule_id, -3, 'N',

ctt.natural_application_only_flag) natural_application_only_flag,

decode(ps.payment_schedule_id, -3, 'P', ctt.creation_sign)

creation_sign,

ps.payment_schedule_id payment_schedule_id,

to_number(decode(SIGN(ps.payment_schedule_id), -1, NULL,

ps.terms_sequence_number)) terms_sequence_number,

ct.customer_trx_id customer_trx_id,

ps.status status,

ct.purchase_order,

ct.interface_header_attribute1 interface_header_attribute1,

ct.interface_header_attribute2 interface_header_attribute2,

ct.interface_header_attribute3 interface_header_attribute3,

ct.interface_header_attribute4 interface_header_attribute4,

ct.interface_header_attribute5 interface_header_attribute5,

ct.interface_header_attribute6 interface_header_attribute6,

ct.interface_header_attribute7 interface_header_attribute7,

ct.interface_header_attribute8 interface_header_attribute8,

ct.interface_header_attribute9 interface_header_attribute9,

ct.interface_header_attribute10 interface_header_attribute10,

ct.interface_header_attribute11 interface_header_attribute11,

ct.interface_header_attribute12 interface_header_attribute12,

ct.interface_header_attribute13 interface_header_attribute13,

ct.interface_header_attribute14 interface_header_attribute14,

ct.interface_header_attribute15 interface_header_attribute15,

bs.name trx_batch_source_name,

nvl(ps.amount_adjusted, 0) amount_adjusted,

nvl(ps.amount_adjusted_pending, 0) amount_adjusted_pending,

nvl(ps.amount_line_items_remaining, 0) amount_line_items_remaining,

nvl(ps.freight_original, 0) freight_original,

nvl(ps.freight_remaining, 0) freight_remaining,

nvl(ps.receivables_charges_remaining, 0) receivables_charges_remaining,

nvl(ps.tax_original, 0) tax_original,

nvl(ps.tax_remaining, 0) tax_remaining,

ps.selected_for_receipt_batch_id selected_for_receipt_batch_id,

ci.cons_billing_number trx_billing_number,

ct.bill_to_site_use_id bill_to_site_use_id,

bs.default_reference,

decode(app.applied_payment_schedule_id, -4, 'CLAIM', app.status)

open_receipt_status,

decode(app.status, NULL, NULL, 'UNAPP',

arpt_sql_func_util.get_lookup_meaning('PAYMENT_TYPE', 'UNAPP'),

ps_dummy.trx_number) open_receipt_status_meaning,

nvl(decode(app.applied_payment_schedule_id, -4,

app.customer_reference, -1, app.customer_reference, NULL),

ct.customer_reference) customer_reference,

decode(ps.class, 'PMT',

decode(decode(app.applied_payment_schedule_id, -4,

app.application_ref_type, NULL), 'CLAIM',

NULL/*arp_deduction.get_tm_oracle_reason(decode(app.applied_payment_schedule

_id,

-4, app.secondary_application_ref_id, NULL))*/, NULL), 'CM',

arpt_sql_func_util.get_lookup_meaning('CREDIT_MEMO_REASON',

ct.reason_code),

arpt_sql_func_util.get_lookup_meaning('INVOICING_REASON',

ct.reason_code)) reason,

to_number(decode(app.applied_payment_schedule_id, NULL, NULL,

app.receivable_application_id)) receivable_application_id,

decode(app.applied_payment_schedule_id, NULL, NULL,

app.application_ref_num) application_ref_num,

cst.account_name account_description,

decode(ps.class, 'PMT', decode(app.applied_payment_schedule_id,

-4, app.customer_reason, NULL), NULL) customer_reason

FROM ra_customer_trx ct,

ra_cust_trx_types_all ctt,

hz_cust_site_uses_all su,

ra_batch_sources_all bs

/*, AR_LOOKUPS LU Not used -Get lookup meaning used instead. */,

hz_cust_accounts cst,

hz_parties cst_party,

ra_terms t,

ar_receivable_applications_all app,

ar_cash_receipts_all cr,

ar_payment_schedules_all ps,

ar_payment_schedules_all ps_dummy,

ar_cons_inv_all ci

WHERE ps.class IN('CB', 'CM', 'DEP', 'DM', 'INV', 'BR', 'PMT')

/* 20-APR-2000 J Rautiainen BR Implementation */

AND ps.selected_for_receipt_batch_id IS NULL

AND ps.reserved_type IS NULL

/* 29-APR-2000 J Rautiainen BR Implementation */

AND ps.reserved_value IS NULL

/* 29-APR-2000 J Rautiainen BR Implementation */

AND decode(ps.payment_schedule_id, -4,

arpt_sql_func_util.check_iclaim_installed, 'T') = 'T'

AND ps.payment_schedule_id NOT IN(-5, -2, -7)

/* snambiar receipt chargeback */

AND t.term_id(+) = ps.term_id

AND ct.customer_trx_id(+) = ps.customer_trx_id

AND bs.batch_source_seq_id(+) = ct.batch_source_seq_id

AND ctt.cust_trx_type_seq_id(+) = ps.cust_trx_type_seq_id

AND cst.cust_account_id(+) = ps.customer_id

AND cst.party_id = cst_party.party_id(+)

AND su.site_use_id(+) = ps.customer_site_use_id

/*AND PS.CLASS = LU.LOOKUP_CODE Not used -Get lookup meaning used

instead.*/

AND ct.previous_customer_trx_id IS NULL

/*AND LU.LOOKUP_TYPE = 'INV/CM' Not used -Get lookup meaning used

instead.*/

AND ci.cons_inv_id(+) = ps.cons_inv_id

AND ps.cash_receipt_id = cr.cash_receipt_id(+)

AND cr.cash_receipt_id = app.cash_receipt_id(+)

AND app.applied_payment_schedule_id = ps_dummy.payment_schedule_id(+)

AND nvl(app.status, 'UNAPP') IN('UNAPP', 'ACC', 'OTHER ACC')

AND decode(app.status, 'OTHER ACC',

app.applied_payment_schedule_id, -4) = -4

AND decode(app.applied_payment_schedule_id, -1, app.display,

-4, app.display, 'Y') = 'Y'

GROUP BY decode(app.applied_payment_schedule_id, NULL, NULL,

app.receivable_application_id),

decode(app.applied_payment_schedule_id, NULL, NULL,

app.application_ref_num),

ps_dummy.trx_number,

ps.trx_number,

ps.customer_id,

cst.account_number,

cst_party.party_name,

su.location,

ps.class,

decode(ps.customer_id, -1, NULL, -3, NULL, -4, NULL,

arpt_sql_func_util.get_lookup_meaning('INV/CM', ps.class)),

ctt.name,

ps.cust_trx_type_seq_id,

ps.invoice_currency_code,

app.status,

ps.amount_due_remaining,

ps.invoice_currency_code,

ps.acctd_amount_due_remaining,

ps.amount_due_original,

ps.amount_line_items_original,

ps.discount_taken_earned,

ps.discount_taken_unearned,

ps.exchange_rate,

cr.receipt_date,

ct.trx_date,

ps.gl_date,

ps.due_date,

ps.term_id,

t.calc_discount_on_lines_flag,

t.partial_discount_flag,

ctt.allow_overapplication_flag,

ctt.natural_application_only_flag,

ctt.creation_sign,

ps.payment_schedule_id,

ps.terms_sequence_number,

ct.customer_trx_id,

ps.status,

ct.purchase_order,

ct.interface_header_attribute1,

ct.interface_header_attribute2,

ct.interface_header_attribute3,

ct.interface_header_attribute4,

ct.interface_header_attribute5,

ct.interface_header_attribute6,

ct.interface_header_attribute7,

ct.interface_header_attribute8,

ct.interface_header_attribute9,

ct.interface_header_attribute10,

ct.interface_header_attribute11,

ct.interface_header_attribute12,

ct.interface_header_attribute13,

ct.interface_header_attribute14,

ct.interface_header_attribute15,

bs.name,

ps.amount_adjusted,

ps.amount_adjusted_pending,

ps.amount_line_items_remaining,

ps.freight_original,

ps.freight_remaining,

ps.receivables_charges_remaining,

ps.tax_original,

ps.tax_remaining,

ps.selected_for_receipt_batch_id,

ci.cons_billing_number,

ct.bill_to_site_use_id,

bs.default_reference,

app.applied_payment_schedule_id,

decode(app.status, NULL, NULL,

arpt_sql_func_util.get_lookup_meaning('AR_OPEN_RECEIPT_STATUSES',

decode(app.applied_payment_schedule_id, -4, 'CLAIM', app.status))),

app.display,

decode(app.applied_payment_schedule_id, -4,

app.application_ref_type, NULL),

decode(app.applied_payment_schedule_id, -4,

app.secondary_application_ref_id, NULL),

decode(app.applied_payment_schedule_id, -4,

app.customer_reference, -1, app.customer_reference, NULL),

ct.customer_reference,

ct.reason_code,

cst.account_name,

decode(app.applied_payment_schedule_id, -4, app.customer_reason,

NULL)