AR_DB_BAL_VW

(SQL View)
Index Back

Bal/Count by Setid

Customer balance and count by setid for use in AR dashboard

SELECT B.SETID , I.BUSINESS_UNIT , I.CUST_ID , i.item , i.item_line , i.item_seq_num , C.NAME1 , I.SUBCUST_QUAL1 , I.SUBCUST_QUAL2 , I.ITEM_STATUS , i.pymnt_terms_cd , i.entry_type , i.entry_reason , i.due_dt , COUNT(*) , I.BAL_AMT , I.BAL_CURRENCY , I.LAST_ACTIVITY_DT , CASE WHEN I.ITEM_STATUS = 'O' THEN %DateDiff(I.DUE_DT, %CurrentDateIn) ELSE %DateDiff(I.DUE_DT, I.LAST_ACTIVITY_DT) END FROM PS_ITEM I , PS_CUST_DATA A , PS_SET_CNTRL_REC B , PS_CUSTOMER C WHERE B.SETCNTRLVALUE = I.BUSINESS_UNIT AND RECNAME = 'CUSTOMER' AND I.BUSINESS_UNIT = A.BUSINESS_UNIT AND I.CUST_ID = A.CUST_ID AND B.SETID = C.SETID AND A.CUST_ID = C.CUST_ID GROUP BY B.SETID, I.BUSINESS_UNIT, I.CUST_ID, i.item , i.item_line, i.item_seq_num, C.NAME1, I.SUBCUST_QUAL1, I.SUBCUST_QUAL2, I.ITEM_STATUS , i.pymnt_terms_cd, i.entry_type , i.entry_reason, I.DUE_DT, I.BAL_AMT, I.BAL_CURRENCY, I.LAST_ACTIVITY_DT

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 SETID Character(5) VARCHAR2(5) NOT NULL SetID

Prompt Table: SP_SETID_NONVW

2 BUSINESS_UNIT Character(5) VARCHAR2(5) NOT NULL Business Unit

Default Value: OPR_DEF_TBL_FS.BUSINESS_UNIT

Prompt Table: SP_BUARDS_NONVW

3 CUST_ID Character(15) VARCHAR2(15) NOT NULL Uniquely identifies an organizational entity that purchases goods or services from the enterprise. Represents the sold-to customer which is the customer organization that places orders. The CUST_ID may or may not be the same as the identifiers for the bill-to and ship-to locations.

Prompt Table: CUSTOMER

4 ITEM Character(30) VARCHAR2(30) NOT NULL Uniquely identifies an invoice credit memo or debit memo. The item ID is also called the invoice number.
5 ITEM_LINE Number(6,0) INTEGER NOT NULL Item Line
6 ITEM_SEQ_NUM Number(3,0) SMALLINT NOT NULL Item Sequence Number
7 NAME1 Character(40) VARCHAR2(40) NOT NULL Name 1
8 SUBCUST_QUAL1 Character(15) VARCHAR2(15) NOT NULL Specifies a user-defined grouping of customer receivables activity. A subcustomer qualifier provides the ability to record and report receivables activity across multiple business units and/or multiple customers. For example a subcustomer qualifier could represent a sales region or a geographic area. There are two possible subcustomer qualifiers: SUBCUST_QUAL1 and SUBCUST_QUAL2.
9 SUBCUST_QUAL2 Character(15) VARCHAR2(15) NOT NULL Specifies a user-defined grouping of customer receivables activity. A subcustomer qualifier provides the ability to record and report receivables activity across multiple business units and/or multiple customers. For example a subcustomer qualifier could represent a sales region or a geographic area. There are two possible subcustomer qualifiers: SUBCUST_QUAL1 and SUBCUST_QUAL2.
10 ITEM_STATUS Character(1) VARCHAR2(1) NOT NULL Item Status
C=Closed
O=Open
11 PYMNT_TERMS_CD Character(5) VARCHAR2(5) NOT NULL Specifies how the payment due date and discount due date are calculated. A payment terms code is associated with various business units bill-to customers vendors as well as sales orders purchase orders and vouchers.
12 ENTRY_TYPE Character(5) VARCHAR2(5) NOT NULL Specifies the type of transaction associated with a pending item. The entry type remains with the item after it is posted and affects many areas of Receivables processing. Some examples of entry types are Invoices Credit Memo Prepayment and Deduction.
13 ENTRY_REASON Character(5) VARCHAR2(5) NOT NULL "Specifies an entry reason that further qualifies the entry type associated with a pending item. For example an entry reason for a credit memo might be ""Pricing Error"" or ""Shipping Error""."
14 DUE_DT Date(10) DATE Specifies the date that a transaction is due. It is a generic field used in multiple PeopleSoft applications including Receivables Payables and Purchasing. For example it represents the date that payment is due for a voucher or the date that a scheduled shipment is due to be received.
15 ITEM_COUNT Number(5,0) INTEGER NOT NULL Item Count
16 BAL_AMT Signed Number(28,3) DECIMAL(26,3) NOT NULL Item Balance
17 CURRENCY_CD Character(3) VARCHAR2(3) NOT NULL Currency Code
18 LAST_ACTIVITY_DT Date(10) DATE Last Activity Date
19 DAYS_LATE Signed Number(7,0) DECIMAL(6) NOT NULL Days Late