• 应收数据脚本


    --应收INVOICE主表
    SELECT *
      FROM RA_CUSTOMER_TRX_ALL A
     WHERE A.TRX_NUMBER = '156640'
       AND A.ORG_ID = 236;
    --应收INVOICE行表
    SELECT B.EXTENDED_AMOUNT --不含税原币金额
          ,B.EXTENDED_ACCTD_AMOUNT --不含税本币金额
          ,B.GROSS_UNIT_SELLING_PRICE -- 含税单价
          ,B.GROSS_EXTENDED_AMOUNT --含税金额
          ,B.REVENUE_AMOUNT --收入金额
          ,B.UNIT_SELLING_PRICE --不含税单价
          ,B.UNIT_STANDARD_PRICE
          ,B.*
      FROM RA_CUSTOMER_TRX_LINES_ALL B
     WHERE B.CUSTOMER_TRX_ID = 1449740;
    --INVOICE分配表
    SELECT C.AMOUNT --不含税原原币金额
          ,C.ACCTD_AMOUNT --不含税本币金额
          ,C.*
      FROM RA_CUST_TRX_LINE_GL_DIST_ALL C
     WHERE C.CUSTOMER_TRX_ID = 1449519;
    --INVOICE应收科目
    SELECT RCTLGDA.*
      FROM RA_CUSTOMER_TRX_ALL          RCA
          ,RA_CUST_TRX_LINE_GL_DIST_ALL RCTLGDA
     WHERE RCA.CUSTOMER_TRX_ID = RCTLGDA.CUSTOMER_TRX_ID
       AND RCTLGDA.ACCOUNT_CLASS = 'REC'
       AND RCA.CUSTOMER_TRX_ID = 1337786;
    --INVOICE收入和税科目
    SELECT RCTLGDA.*
      FROM RA_CUSTOMER_TRX_ALL          RCA
          ,RA_CUST_TRX_LINE_GL_DIST_ALL RCTLGDA
     WHERE RCA.CUSTOMER_TRX_ID = RCTLGDA.CUSTOMER_TRX_ID
       AND RCTLGDA.ACCOUNT_CLASS <> 'REC'
       AND RCA.CUSTOMER_TRX_ID = 1337786;
    --或
    SELECT RCTLGDA.*
      FROM RA_CUSTOMER_TRX_ALL          RCA
          ,RA_CUSTOMER_TRX_LINES_ALL    RCL
          ,RA_CUST_TRX_LINE_GL_DIST_ALL RCTLGDA
     WHERE RCA.CUSTOMER_TRX_ID = RCL.CUSTOMER_TRX_ID
       AND RCL.CUSTOMER_TRX_LINE_ID = RCTLGDA.CUSTOMER_TRX_LINE_ID
       AND RCA.CUSTOMER_TRX_ID = 1337786;
    
    --27663
    /*select count(1) from ap_invoice_distributions_all;*/
    SELECT h.batch_id 批id,
           aba.batch_name 批名,
           h.org_id ou,
           ood.organization_name 业务实体,
           h.invoice_type_lookup_code INVOICE类型,
           pha.segment1 po编号,
           ass.vendor_name 贸易伙伴,
           ass.segment1 供应商编号,
           assa.vendor_site_code 供应商地点编码,
           assa.address_line1 供应商地点名称,
           h.invoice_date INVOICE日期,
           h.invoice_num INVOICE编号,
           h.invoice_currency_code INVOICE币种,
           h.invoice_amount INVOICE额,
           h.amount_paid 已付金额,
           h.total_tax_amount 税额,
           h.gl_date gl日期,
           h.attribute3 成本中心编码,
           department.description 成本中心,
           cux_flex_pkg.get_gl_flexfields(p_ccid   => h.accts_pay_code_combination_id,
                                          p_return => 'A') 负债账户,
           
           d.line_type_lookup_code 行类型代码,
           alc.description 行类型说明,
           d.amount,
           cux_flex_pkg.get_gl_flexfields(p_ccid   => d.dist_code_combination_id,
                                          p_return => 'A') 账户,
           d.created_by,
           us.user_name,
           d.creation_date
    
      FROM ap_invoices_all h,
           ap_invoice_distributions_all d,
           ap_batches_all aba,
           org_organization_definitions ood,
           po_headers_all pha,
           ap_suppliers ass,
           ap_supplier_sites_all assa,
           ap_lookup_codes alc,
           fnd_user us,
           (SELECT ffvt.description, ffv.flex_value
              FROM fnd_flex_value_sets ffvs,
                   fnd_flex_values     ffv,
                   fnd_flex_values_tl  ffvt
             WHERE ffvs.flex_value_set_id = ffv.flex_value_set_id
               AND ffv.flex_value_id = ffvt.flex_value_id
               AND ffvt.language = 'ZHS'
               AND ffv.summary_flag = 'N'
               AND ffv.enabled_flag = 'Y'
               AND ffvs.flex_value_set_name = 'BZ_DEPARTMENT') department
    
     WHERE h.invoice_id = d.invoice_id
       AND h.batch_id = aba.batch_id
       AND ood.organization_id = h.org_id
       AND h.po_header_id = pha.po_header_id(+)
       AND ass.vendor_id = assa.vendor_id
       AND ass.vendor_id = h.vendor_id
       AND assa.vendor_site_id = h.vendor_site_id
       AND h.attribute3 = department.flex_value
       AND alc.lookup_type = 'INVOICE DISTRIBUTION TYPE'
       AND alc.lookup_code = d.line_type_lookup_code
       and us.user_id = d.created_by
          
       --AND h.gl_date >= to_date('2014-01-01', 'YYYY-MM-DD')
       AND h.gl_date < to_date('2014-02-01', 'YYYY-MM-DD')
    
    
    SELECT ood.organization_name 公司,
           vendor.segment1 供应商,
           vendor.address_line1 供应商地址,
           vendor.vendor_site_code 供应商地点,
           h.invoice_type_lookup_code INVOICE类型,
           SUM(nvl(h.invoice_amount, 0)) INVOICE金额,
           SUM(nvl(h.amount_paid, 0)) 已付款金额,
           SUM(nvl(h.invoice_amount, 0)) - SUM(nvl(h.amount_paid, 0)) 应付金额
    
      FROM ap_invoices_all h,
           org_organization_definitions ood,
           (SELECT h.segment1,
                   l.address_line1,
                   l.vendor_site_id,
                   l.vendor_site_code
              FROM ap_supplier_sites_all l, ap_suppliers h
             WHERE l.vendor_id = h.vendor_id) vendor
     WHERE h.org_id = ood.organization_id
       AND h.vendor_site_id = vendor.vendor_site_id
     GROUP BY ood.organization_name,
              vendor.segment1,
              vendor.vendor_site_code,
              vendor.address_line1,
              h.invoice_type_lookup_code;
    /** AND ass.vendor_id = assa.vendor_id
    AND ass.vendor_id = h.vendor_id
    AND assa.vendor_site_id = h.vendor_site_id*
    
    *   minus
    
    select l.invoice_id
    from ap_invoices_all l*
    
    * select *from ap_invoices_all l where *l.vendor_id is null or* l.vendor_site_id is null*
    
    SELECT COUNT(1)
      FROM ap_invoices_all h
     WHERE h.vendor_site_id > 0
     GROUP BY h.org_id,
              h.vendor_id,
              h.vendor_site_id,
              h.invoice_type_lookup_code*/
    
    --INVOICE收款计划表
    SELECT ARP.AMOUNT_DUE_ORIGINAL --INVOICE原始金额(含税)
          ,ARP.TAX_ORIGINAL --INVOICE原始税额 
          ,ARP.TAX_REMAINING --INVOICE税余额
          ,ARP.AMOUNT_APPLIED --INVOICE收款金额
          ,ARP.AMOUNT_LINE_ITEMS_ORIGINAL --INVOICE行原始金额
          ,ARP.AMOUNT_LINE_ITEMS_REMAINING --INVOICE行余额
          ,ARP.AMOUNT_DUE_REMAINING --到期余额
          ,ARP.ACCTD_AMOUNT_DUE_REMAINING --本币到期余额           
          ,ARP.AMOUNT_ADJUSTED --INVOICE调整金额
          ,ARP.AMOUNT_CREDITED --INVOICE做过贷项通知单金额
          ,ARP.FREIGHT_ORIGINAL
          ,ARP.FREIGHT_REMAINING
          ,ARP.DISCOUNT_ORIGINAL
          ,ARP.DISCOUNT_REMAINING
          ,ARP.DISCOUNT_TAKEN_EARNED
          ,ARP.DISCOUNT_TAKEN_UNEARNED
          ,ARP.RECEIVABLES_CHARGES_CHARGED
          ,ARP.RECEIVABLES_CHARGES_REMAINING
          ,ARP.*
      FROM AR_PAYMENT_SCHEDULES_ALL ARP
     WHERE ARP.CUSTOMER_TRX_ID = 1485432 --Num: 80210055
    --INVOICE是否做过贷项
    SELECT *
      FROM RA_CUSTOMER_TRX_ALL RCA
     WHERE RCA.PREVIOUS_CUSTOMER_TRX_ID = 1337786; --ra_customer_trx_all.customer_trx_id
    --INVOICE现金收款金额
    SELECT *
      FROM AR_RECEIVABLE_APPLICATIONS_ALL ARA
     WHERE ARA.APPLIED_CUSTOMER_TRX_ID = 1337785
       AND ARA.APPLICATION_TYPE = 'CASH'
       AND ARA.STATUS = 'APP';
    --INVOICE被贷项通知单核销金额
    SELECT *
      FROM AR_RECEIVABLE_APPLICATIONS_ALL ARA
     WHERE ARA.APPLIED_CUSTOMER_TRX_ID = 1337786
       AND ARA.APPLICATION_TYPE = 'CM'
       AND ARA.STATUS = 'APP';
    --INVOICE调整金额
    SELECT ADJ.*
      FROM AR_ADJUSTMENTS_ALL  ADJ
          ,RA_CUSTOMER_TRX_ALL RCT
     WHERE RCT.CUSTOMER_TRX_ID = ADJ.CUSTOMER_TRX_ID
       AND ADJ.STATUS = 'A'
       AND RCT.CUSTOMER_TRX_ID = 1337785;
     
    --收款录入后产生的信息如下:
    --收款主表
    SELECT *
      FROM AR_CASH_RECEIPTS_ALL ACRA
     WHERE ACRA.RECEIPT_NUMBER = '20120106001';
    --收款历史记录表
    SELECT *
      FROM AR_CASH_RECEIPT_HISTORY_ALL ACRH
     WHERE ACRH.CASH_RECEIPT_ID = 304387;
    --收款事务处理表
    SELECT *
      FROM AR_RECEIVABLE_APPLICATIONS_ALL ARA
     WHERE ARA.CASH_RECEIPT_ID = 304387;
    --收款分配表
    --收款录入时产生两条记录,SOURCE_ID分别对应 
    --SOURCE_TABLE为 'RA' 时SOURCE_ID对应的是AR_RECEIVABLE_APPLICATIONS_ALL.RECEIVABLE_APPLICATION_ID,为CRH时SOURCE_ID对应的是AR_CASH_RECEIPT_HISTORY_ALL.CASH_RECEIPT_HISTORY_ID
    --下面SQL获取的是收款录入时产生的未核销科目及收款核销时产生的应收账款和未核销科目
    SELECT *
      FROM AR_DISTRIBUTIONS_ALL ADA
     WHERE ADA.SOURCE_ID IN
           (SELECT ARA.RECEIVABLE_APPLICATION_ID
              FROM AR_RECEIVABLE_APPLICATIONS_ALL ARA
             WHERE ARA.CASH_RECEIPT_ID = 304387)
       AND ADA.SOURCE_TABLE = 'RA';
    --收款录入时产生两条分录:现金和未核销,下面语句获取的是现金科目
    SELECT *
      FROM AR_DISTRIBUTIONS_ALL ADA
     WHERE ADA.SOURCE_ID IN
           (SELECT ACRH.CASH_RECEIPT_HISTORY_ID
              FROM AR_CASH_RECEIPT_HISTORY_ALL ACRH
             WHERE ACRH.CASH_RECEIPT_ID = 304387)
       AND ADA.SOURCE_TABLE = 'CRH';
    --应收INVOICE收货方 收单方 到期日等
    SELECT CT.CUSTOMER_TRX_ID CUSTOMER_TRX_ID
          ,CT.TRX_NUMBER TRX_NUMBER
          ,CT.OLD_TRX_NUMBER OLD_TRX_NUMBER
          ,CT_REL.TRX_NUMBER CT_RELATED_TRX_NUMBER
          ,CT.RECURRED_FROM_TRX_NUMBER CT_MODEL_TRX_NUMBER
          ,CT.TRX_DATE TRX_DATE
          ,ARPT_SQL_FUNC_UTIL.GET_FIRST_REAL_DUE_DATE(CT.CUSTOMER_TRX_ID
                                                     ,CT.TERM_ID
                                                     ,CT.TRX_DATE) TERM_DUE_DATE --到期日
          ,CT.PREVIOUS_CUSTOMER_TRX_ID PREVIOUS_CUSTOMER_TRX_ID
          ,CT.INITIAL_CUSTOMER_TRX_ID INITIAL_CUSTOMER_TRX_ID
          ,CT.RELATED_BATCH_SOURCE_ID RELATED_BATCH_SOURCE_ID
          ,CT.RELATED_CUSTOMER_TRX_ID RELATED_CUSTOMER_TRX_ID
          ,CT.CUST_TRX_TYPE_ID CUST_TRX_TYPE_ID
          ,CT.BATCH_ID BATCH_ID
          ,CT.BATCH_SOURCE_ID BATCH_SOURCE_ID
          ,CT.REASON_CODE REASON_CODE
          ,CT.TERM_ID TERM_ID
          ,CT.PRIMARY_SALESREP_ID PRIMARY_SALESREP_ID
          ,CT.AGREEMENT_ID AGREEMENT_ID
          ,CT.CREDIT_METHOD_FOR_RULES CREDIT_METHOD_FOR_RULES
          ,CT.CREDIT_METHOD_FOR_INSTALLMENTS CREDIT_METHOD_FOR_INSTALLMENTS
          ,CT.RECEIPT_METHOD_ID RECEIPT_METHOD_ID
          ,CT.INVOICING_RULE_ID INVOICING_RULE_ID
          ,CT.SHIP_VIA SHIP_VIA
          ,CT.FOB_POINT FOB_POINT
          ,CT.FINANCE_CHARGES
          ,CT.COMPLETE_FLAG COMPLETE_FLAG
          ,CT.CUSTOMER_BANK_ACCOUNT_ID CUSTOMER_BANK_ACCOUNT_ID
          ,CT.RECURRED_FROM_TRX_NUMBER RECURRED_FROM_TRX_NUMBER
          ,CT.STATUS_TRX STATUS_TRX
          ,CT.DEFAULT_TAX_EXEMPT_FLAG DEFAULT_TAX_EXEMPT_FLAG
          ,CT.SOLD_TO_CUSTOMER_ID SOLD_TO_CUSTOMER_ID
          ,CT.SOLD_TO_SITE_USE_ID SOLD_TO_SITE_USE_ID
          ,CT.SOLD_TO_CONTACT_ID SOLD_TO_CONTACT_ID
          ,CT.BILL_TO_CUSTOMER_ID BILL_TO_CUSTOMER_ID
          ,CT.BILL_TO_SITE_USE_ID BILL_TO_SITE_USE_ID
          ,RAA_BILL.CUST_ACCT_SITE_ID RAA_BILL_TO_ADDRESS_ID
          ,CT.BILL_TO_CONTACT_ID BILL_TO_CONTACT_ID
          ,RAC_BILL_PARTY.JGZZ_FISCAL_CODE BILL_TO_TAXPAYER_ID
          ,CT.SHIP_TO_CUSTOMER_ID
          ,CT.SHIP_TO_SITE_USE_ID
          ,RAA_SHIP.CUST_ACCT_SITE_ID RAA_SHIP_TO_ADDRESS_ID
          ,CT.SHIP_TO_CONTACT_ID
          ,RAC_SHIP_PARTY.JGZZ_FISCAL_CODE SHIP_TO_TAXPAYER_ID
          ,CT.REMIT_TO_ADDRESS_ID
          ,CT.INVOICE_CURRENCY_CODE
          ,CT.CREATED_FROM
          ,CT.SET_OF_BOOKS_ID
          ,CT.PRINTING_ORIGINAL_DATE
          ,CT.PRINTING_LAST_PRINTED
          ,CT.PRINTING_OPTION
          ,CT.PRINTING_COUNT
          ,CT.PRINTING_PENDING
          ,CT.LAST_PRINTED_SEQUENCE_NUM
          ,CT.PURCHASE_ORDER
          ,CT.PURCHASE_ORDER_REVISION
          ,CT.PURCHASE_ORDER_DATE
          ,CT.CUSTOMER_REFERENCE
          ,CT.CUSTOMER_REFERENCE_DATE
          ,CT.COMMENTS
          ,CT.INTERNAL_NOTES
          ,CT.EXCHANGE_RATE_TYPE
          ,CT.EXCHANGE_DATE
          ,CT.EXCHANGE_RATE
          ,CT.TERRITORY_ID
          ,CT.END_DATE_COMMITMENT
          ,CT.START_DATE_COMMITMENT
          ,CT.ORIG_SYSTEM_BATCH_NAME
          ,CT.SHIP_DATE_ACTUAL
          ,CT.WAYBILL_NUMBER
          ,CT.DOC_SEQUENCE_ID
          ,CT.DOC_SEQUENCE_VALUE
          ,CT.PAYING_CUSTOMER_ID
          ,CT.PAYING_SITE_USE_ID
          ,CT.DEFAULT_USSGL_TRANSACTION_CODE
          ,CT.LAST_UPDATE_DATE
          ,CT.LAST_UPDATED_BY
          ,CT.CREATION_DATE
          ,CT.CREATED_BY
          ,CT.LAST_UPDATE_LOGIN
          ,CT.REQUEST_ID
          ,RAC_BILL_PARTY.PARTY_NAME RAC_BILL_TO_CUSTOMER_NAME --收单方
          ,RAC_BILL.ACCOUNT_NUMBER RAC_BILL_TO_CUSTOMER_NUM
          ,SU_BILL.LOCATION SU_BILL_TO_LOCATION --收单地点
          ,RAA_BILL_LOC.ADDRESS1 RAA_BILL_TO_ADDRESS1 --收单地址
          ,RAA_BILL_LOC.ADDRESS2 RAA_BILL_TO_ADDRESS2
          ,RAA_BILL_LOC.ADDRESS3 RAA_BILL_TO_ADDRESS3_DB
          ,DECODE(RAA_BILL.CUST_ACCT_SITE_ID
                 ,NULL
                 ,NULL
                 ,ARH_ADDR_PKG.FORMAT_LAST_ADDRESS_LINE(RAA_BILL_LOC.ADDRESS_STYLE
                                                       ,RAA_BILL_LOC.ADDRESS3
                                                       ,RAA_BILL_LOC.ADDRESS4
                                                       ,RAA_BILL_LOC.CITY
                                                       ,RAA_BILL_LOC.COUNTY
                                                       ,RAA_BILL_LOC.STATE
                                                       ,RAA_BILL_LOC.PROVINCE
                                                       ,FT_BILL.TERRITORY_SHORT_NAME
                                                       ,RAA_BILL_LOC.POSTAL_CODE)) RAA_BILL_TO_ADDRESS3
          ,RAA_BILL_LOC.CITY RAA_BILL_TO_CITY
          ,RAA_BILL_LOC.COUNTY RAA_BILL_TO_COUNTY
          ,RAA_BILL_LOC.STATE RAA_BILL_TO_STATE
          ,RAA_BILL_LOC.PROVINCE RAA_BILL_TO_PROVINCE
          ,RAA_BILL_LOC.POSTAL_CODE RAA_BILL_TO_POSTAL_CODE
          ,FT_BILL.TERRITORY_SHORT_NAME FT_BILL_TO_COUNTRY
          ,DECODE(RAA_BILL.CUST_ACCT_SITE_ID
                 ,NULL
                 ,NULL
                 ,ARH_ADDR_PKG.ARXTW_FORMAT_ADDRESS(RAA_BILL_LOC.ADDRESS_STYLE
                                                   ,RAA_BILL_LOC.ADDRESS1
                                                   ,RAA_BILL_LOC.ADDRESS2
                                                   ,RAA_BILL_LOC.ADDRESS3
                                                   ,RAA_BILL_LOC.ADDRESS4
                                                   ,RAA_BILL_LOC.CITY
                                                   ,RAA_BILL_LOC.COUNTY
                                                   ,RAA_BILL_LOC.STATE
                                                   ,RAA_BILL_LOC.PROVINCE
                                                   ,RAA_BILL_LOC.POSTAL_CODE
                                                   ,FT_BILL.TERRITORY_SHORT_NAME)) RAA_BILL_TO_CONCAT_ADDRESS
           
          ,DECODE(SUBSTRB(RACO_BILL_PARTY.PERSON_LAST_NAME
                         ,1
                         ,50)
                 ,NULL
                 ,SUBSTRB(RACO_BILL_PARTY.PERSON_FIRST_NAME
                         ,1
                         ,40)
                 ,SUBSTRB(RACO_BILL_PARTY.PERSON_LAST_NAME
                         ,1
                         ,50) || ', ' || SUBSTRB(RACO_BILL_PARTY.PERSON_FIRST_NAME
                                                ,1
                                                ,40)) RACO_BILL_TO_CONTACT_NAME
          ,RAC_SHIP_PARTY.PARTY_NAME RAC_SHIP_TO_CUSTOMER_NAME --收货方
          ,RAC_SHIP.ACCOUNT_NUMBER RAC_SHIP_TO_CUSTOMER_NUM
          ,SU_SHIP.LOCATION SU_SHIP_TO_LOCATION --收货地点
          ,RAA_SHIP_LOC.ADDRESS1 RAA_SHIP_TO_ADDRESS1 --收货地址
          ,RAA_SHIP_LOC.ADDRESS2 RAA_SHIP_TO_ADDRESS2
          ,RAA_SHIP_LOC.ADDRESS3 RAA_SHIP_TO_ADDRESS3_DB
          ,DECODE(RAA_SHIP.CUST_ACCT_SITE_ID
                 ,NULL
                 ,NULL
                 ,ARH_ADDR_PKG.FORMAT_LAST_ADDRESS_LINE(RAA_SHIP_LOC.ADDRESS_STYLE
                                                       ,RAA_SHIP_LOC.ADDRESS3
                                                       ,RAA_SHIP_LOC.ADDRESS4
                                                       ,RAA_SHIP_LOC.CITY
                                                       ,RAA_SHIP_LOC.COUNTY
                                                       ,RAA_SHIP_LOC.STATE
                                                       ,RAA_SHIP_LOC.PROVINCE
                                                       ,FT_SHIP.TERRITORY_SHORT_NAME
                                                       ,RAA_SHIP_LOC.POSTAL_CODE)) RAA_SHIP_TO_ADDRESS3
           
          ,RAA_SHIP_LOC.CITY RAA_SHIP_TO_CITY
          ,RAA_SHIP_LOC.COUNTY RAA_SHIP_TO_COUNTY
          ,RAA_SHIP_LOC.STATE RAA_SHIP_TO_STATE
          ,RAA_SHIP_LOC.PROVINCE RAA_SHIP_TO_PROVINCE
          ,RAA_SHIP_LOC.POSTAL_CODE RAA_SHIP_TO_POSTAL_CODE
          ,FT_SHIP.TERRITORY_SHORT_NAME FT_SHIP_TO_COUNTRY
          ,DECODE(RAA_SHIP.CUST_ACCT_SITE_ID
                 ,NULL
                 ,NULL
                 ,ARH_ADDR_PKG.ARXTW_FORMAT_ADDRESS(RAA_SHIP_LOC.ADDRESS_STYLE
                                                   ,RAA_SHIP_LOC.ADDRESS1
                                                   ,RAA_SHIP_LOC.ADDRESS2
                                                   ,RAA_SHIP_LOC.ADDRESS3
                                                   ,RAA_SHIP_LOC.ADDRESS4
                                                   ,RAA_SHIP_LOC.CITY
                                                   ,RAA_SHIP_LOC.COUNTY
                                                   ,RAA_SHIP_LOC.STATE
                                                   ,RAA_SHIP_LOC.PROVINCE
                                                   ,RAA_SHIP_LOC.POSTAL_CODE
                                                   ,FT_SHIP.TERRITORY_SHORT_NAME)) RAA_SHIP_TO_CONCAT_ADDRESS
          ,DECODE(SUBSTRB(RACO_SHIP_PARTY.PERSON_LAST_NAME
                         ,1
                         ,50)
                 ,NULL
                 ,SUBSTRB(RACO_SHIP_PARTY.PERSON_FIRST_NAME
                         ,1
                         ,40)
                 ,SUBSTRB(RACO_SHIP_PARTY.PERSON_LAST_NAME
                         ,1
                         ,50) || ', ' || SUBSTRB(RACO_SHIP_PARTY.PERSON_FIRST_NAME
                                                ,1
                                                ,40)) RACO_SHIP_TO_CONTACT_NAME
           
          ,RAC_SOLD_PARTY.PARTY_NAME RAC_SOLD_TO_CUSTOMER_NAME --采购方
          ,RAC_SOLD.ACCOUNT_NUMBER RAC_SOLD_TO_CUSTOMER_NUM
          ,RAC_PAYING_PARTY.PARTY_NAME RAC_PAYING_CUSTOMER_NAME --付款客户
          ,RAC_PAYING.ACCOUNT_NUMBER RAC_PAYING_CUSTOMER_NUM
          ,SU_PAYING.LOCATION SU_PAYING_CUSTOMER_LOCATION
          ,RAA_REMIT_LOC.ADDRESS1 RAA_REMIT_TO_ADDRESS1
          ,RAA_REMIT_LOC.ADDRESS2 RAA_REMIT_TO_ADDRESS2
          ,RAA_REMIT_LOC.ADDRESS3 RAA_REMIT_TO_ADDRESS3_DB
          ,DECODE(RAA_REMIT.CUST_ACCT_SITE_ID
                 ,NULL
                 ,NULL
                 ,ARH_ADDR_PKG.FORMAT_LAST_ADDRESS_LINE(RAA_REMIT_LOC.ADDRESS_STYLE
                                                       ,RAA_REMIT_LOC.ADDRESS3
                                                       ,RAA_REMIT_LOC.ADDRESS4
                                                       ,RAA_REMIT_LOC.CITY
                                                       ,RAA_REMIT_LOC.COUNTY
                                                       ,RAA_REMIT_LOC.STATE
                                                       ,RAA_REMIT_LOC.PROVINCE
                                                       ,FT_REMIT.TERRITORY_SHORT_NAME
                                                       ,RAA_REMIT_LOC.POSTAL_CODE)) RAA_REMIT_TO_ADDRESS3
           
          ,RAA_REMIT_LOC.CITY RAA_REMIT_TO_CITY
          ,RAA_REMIT_LOC.COUNTY RAA_REMIT_TO_COUNTY
          ,RAA_REMIT_LOC.STATE RAA_REMIT_TO_STATE
          ,RAA_REMIT_LOC.PROVINCE RAA_REMIT_TO_PROVINCE
          ,RAA_REMIT_LOC.POSTAL_CODE RAA_REMIT_TO_POSTAL_CODE
          ,FT_REMIT.TERRITORY_SHORT_NAME FT_REMIT_TO_COUNTRY
          ,DECODE(RAA_REMIT.CUST_ACCT_SITE_ID
                 ,NULL
                 ,NULL
                 ,ARH_ADDR_PKG.ARXTW_FORMAT_ADDRESS(RAA_REMIT_LOC.ADDRESS_STYLE
                                                   ,RAA_REMIT_LOC.ADDRESS1
                                                   ,RAA_REMIT_LOC.ADDRESS2
                                                   ,RAA_REMIT_LOC.ADDRESS3
                                                   ,RAA_REMIT_LOC.ADDRESS4
                                                   ,RAA_REMIT_LOC.CITY
                                                   ,RAA_REMIT_LOC.COUNTY
                                                   ,RAA_REMIT_LOC.STATE
                                                   ,RAA_REMIT_LOC.PROVINCE
                                                   ,RAA_REMIT_LOC.POSTAL_CODE
                                                   ,FT_REMIT.TERRITORY_SHORT_NAME)) RAA_CONCAT_REMIT_TO_ADDRESS
           
          ,APBA.BANK_ACCOUNT_NAME APBA_BANK_ACCOUNT_NAME
          ,DECODE(NVL(FND_PROFILE.VALUE('AR_MASK_BANK_ACCOUNT_NUMBERS')
                     ,'F')
                 ,'N'
                 ,APBA.BANK_ACCOUNT_NUM
                 ,'F'
                 ,RPAD(SUBSTRB(APBA.BANK_ACCOUNT_NUM
                              ,1
                              ,4)
                      ,LENGTH(APBA.BANK_ACCOUNT_NUM)
                      ,'*')
                 ,'L'
                 ,LPAD(SUBSTRB(APBA.BANK_ACCOUNT_NUM
                              ,-4)
                      ,LENGTH(APBA.BANK_ACCOUNT_NUM)
                      ,'*')) APBA_BANK_ACCOUNT_NUM
          ,APBA.INACTIVE_DATE APBA_INACTIVE_DATE
          ,APB.BANK_NAME APB_CUSTOMER_BANK_NAME
          ,APB.BANK_BRANCH_NAME APB_CUSTOMER_BANK_BRANCH_NAME
          ,ARM.NAME ARM_RECEIPT_METHOD_NAME
          ,ARM.PAYMENT_TYPE_CODE ARM_PAYMENT_TYPE_CODE
          ,ARC.CREATION_METHOD_CODE ARC_CREATION_METHOD_CODE
          ,BS.NAME BS_BATCH_SOURCE_NAME
          ,BS.AUTO_TRX_NUMBERING_FLAG BS_AUTO_TRX_NUMBERING_FLAG
          ,BS.COPY_DOC_NUMBER_FLAG BS_COPY_DOC_NUMBER_FLAG
          ,RAB.NAME RAB_BATCH_NAME
           
          ,CTT.NAME CTT_TYPE_NAME
          ,CTT.TYPE CTT_CLASS
          ,ARPT_SQL_FUNC_UTIL.GET_SALESREP_NAME_NUMBER(CT.PRIMARY_SALESREP_ID
                                                      ,'NAME') RAS_PRIMARY_SALESREP_NAME
          ,ARPT_SQL_FUNC_UTIL.GET_SALESREP_NAME_NUMBER(CT.PRIMARY_SALESREP_ID
                                                      ,'NUMBER') RAS_PRIMARY_SALESREP_NUM
          ,RAT.NAME RAT_TERM_NAME
          ,RAT.IN_USE RAT_TERM_IN_USE_FLAG
          ,SOA.NAME SOA_AGREEMENT_NAME
          ,ORF.DESCRIPTION OF_SHIP_VIA_NAME
          ,ORF.ORGANIZATION_ID OF_ORGANIZATION_ID
          ,AL_FOB.MEANING AL_FOB_MEANING
          ,AL_TAX.MEANING AL_DEFAULT_TAX_EXEMPT_FLAG
          ,CT.CT_REFERENCE CT_REFERENCE
          ,GD.GL_DATE GD_GL_DATE
          ,GDCT.USER_CONVERSION_TYPE GDCT_USER_EXCHANGE_RATE_TYPE
          ,ARPT_SQL_FUNC_UTIL.GET_CB_INVOICE(CT.CUSTOMER_TRX_ID
                                            ,CTT.TYPE) CT_INVOICE_FOR_CB
          ,ARPT_SQL_FUNC_UTIL.GET_DISPUTE_AMOUNT(CT.CUSTOMER_TRX_ID
                                                ,CTT.TYPE
                                                ,CTT.ACCOUNTING_AFFECT_FLAG) PS_DISPUTE_AMOUNT
          ,ARPT_SQL_FUNC_UTIL.GET_DISPUTE_DATE(CT.CUSTOMER_TRX_ID
                                              ,CTT.TYPE
                                              ,CTT.ACCOUNTING_AFFECT_FLAG) PS_DISPUTE_DATE
          ,ARPT_SQL_FUNC_UTIL.GET_MAX_DISPUTE_DATE(CT.CUSTOMER_TRX_ID
                                                  ,CTT.TYPE
                                                  ,CTT.ACCOUNTING_AFFECT_FLAG) DH_MAX_DISPUTE_DATE
           
          ,ARPT_SQL_FUNC_UTIL.GET_REVENUE_RECOG_RUN_FLAG(CT.CUSTOMER_TRX_ID
                                                        ,CT.INVOICING_RULE_ID) REV_RECOG_RUN_FLAG
          ,ARPT_SQL_FUNC_UTIL.GET_POSTED_FLAG(CT.CUSTOMER_TRX_ID
                                             ,CTT.POST_TO_GL
                                             ,CT.COMPLETE_FLAG) POSTED_FLAG --过账标识?
          ,ARPT_SQL_FUNC_UTIL.GET_SELECTED_FOR_PAYMENT_FLAG(CT.CUSTOMER_TRX_ID
                                                           ,CTT.ACCOUNTING_AFFECT_FLAG
                                                           ,CT.COMPLETE_FLAG) SELECTED_FOR_PAYMENT_FLAG
          ,ARPT_SQL_FUNC_UTIL.GET_ACTIVITY_FLAG(CT.CUSTOMER_TRX_ID
                                               ,CTT.ACCOUNTING_AFFECT_FLAG
                                               ,CT.COMPLETE_FLAG
                                               ,CTT.TYPE
                                               ,CT.INITIAL_CUSTOMER_TRX_ID
                                               ,CT.PREVIOUS_CUSTOMER_TRX_ID) ACTIVITY_FLAG
          ,CTT.POST_TO_GL CTT_POST_TO_GL_FLAG
          ,CTT.ACCOUNTING_AFFECT_FLAG CTT_OPEN_RECEIVABLES_FLAG
          ,CTT.ALLOW_FREIGHT_FLAG CTT_ALLOW_FREIGHT_FLAG
          ,CTT.CREATION_SIGN CTT_CREATION_SIGN
          ,CTT.ALLOW_OVERAPPLICATION_FLAG CTT_ALLOW_OVERAPPLICATION_FLAG
          ,CTT.NATURAL_APPLICATION_ONLY_FLAG CTT_NATURAL_APP_ONLY_FLAG
          ,CTT.TAX_CALCULATION_FLAG CTT_TAX_CALCULATION_FLAG
          ,CTT.DEFAULT_STATUS CTT_DEFAULT_STATUS
          ,CTT.DEFAULT_TERM CTT_DEFAULT_TERM
          ,CTT.DEFAULT_PRINTING_OPTION CTT_DEFAULT_PRINTING_OPTION
          ,DECODE(CT.INVOICING_RULE_ID
                 ,NULL
                 ,'N'
                 ,'Y') RULES_FLAG
           
          ,DECODE(CT.PRINTING_LAST_PRINTED
                 ,NULL
                 ,'N'
                 ,'Y') PRINTED_FLAG
          ,DECODE(CT.PREVIOUS_CUSTOMER_TRX_ID
                 ,NULL
                 ,'N'
                 ,'Y') CM_AGAINST_TRX_FLAG
          ,SU_BILL.STATUS SITE_STATUS
          ,RAC_BILL.STATUS CUSTOMER_STATUS
          ,ARPT_SQL_FUNC_UTIL.GET_OVERRIDE_TERMS(CT.BILL_TO_CUSTOMER_ID
                                                ,CT.BILL_TO_SITE_USE_ID) OVERRIDE_TERMS
          ,DECODE(CT.INITIAL_CUSTOMER_TRX_ID
                 ,NULL
                 ,DECODE(CTT.TYPE
                        ,'DEP'
                        ,'N'
                        ,'GUAR'
                        ,'N'
                        ,'CB'
                        ,'N'
                        ,'Y')
                 ,'Y') COMMITMENTS_EXIST_FLAG
          ,DECODE(CT.AGREEMENT_ID
                 ,NULL
                 ,DECODE(CTT.TYPE
                        ,'CM'
                        ,'N'
                        ,ARPT_SQL_FUNC_UTIL.GET_AGREEMENTS_EXIST_FLAG(CT.BILL_TO_CUSTOMER_ID
                                                                     ,CT.TRX_DATE))
                 ,'Y') AGREEMENTS_EXIST_FLAG
          ,FND_ATTACHMENT_UTIL_PKG.GET_ATCHMT_EXISTS('RA_CUSTOMER_TRX'
                                                    ,CT.CUSTOMER_TRX_ID) ATCHMT_FLAG
           
          ,CT.REVERSED_CASH_RECEIPT_ID REVERSED_CASH_RECEIPT_ID
      FROM RA_CUST_TRX_LINE_GL_DIST_ALL GD
          ,RA_CUSTOMER_TRX_ALL          CT
          ,HZ_CUST_ACCOUNTS             RAC_BILL
          ,HZ_PARTIES                   RAC_BILL_PARTY
          ,HZ_CUST_ACCOUNTS             RAC_SHIP
          ,HZ_PARTIES                   RAC_SHIP_PARTY
          ,HZ_CUST_ACCOUNTS             RAC_SOLD
          ,HZ_PARTIES                   RAC_SOLD_PARTY
          ,HZ_CUST_ACCOUNTS             RAC_PAYING
          ,HZ_PARTIES                   RAC_PAYING_PARTY
          ,HZ_CUST_SITE_USES_ALL        SU_BILL
          ,HZ_CUST_SITE_USES_ALL        SU_SHIP
          ,HZ_CUST_SITE_USES_ALL        SU_PAYING
          ,FND_TERRITORIES_VL           FT_BILL
          ,FND_TERRITORIES_VL           FT_SHIP
          ,FND_TERRITORIES_VL           FT_REMIT
          ,HZ_CUST_ACCT_SITES_ALL       RAA_BILL
          ,HZ_PARTY_SITES               RAA_BILL_PS
          ,HZ_LOCATIONS                 RAA_BILL_LOC
          ,HZ_CUST_ACCT_SITES_ALL       RAA_SHIP
          ,HZ_PARTY_SITES               RAA_SHIP_PS
          ,HZ_LOCATIONS                 RAA_SHIP_LOC
          ,HZ_CUST_ACCT_SITES_ALL       RAA_REMIT
          ,HZ_PARTY_SITES               RAA_REMIT_PS
          ,HZ_LOCATIONS                 RAA_REMIT_LOC
          ,HZ_CUST_ACCOUNT_ROLES        RACO_SHIP
          ,HZ_PARTIES                   RACO_SHIP_PARTY
          ,HZ_RELATIONSHIPS             RACO_SHIP_REL
          ,HZ_CUST_ACCOUNT_ROLES        RACO_BILL
          ,HZ_PARTIES                   RACO_BILL_PARTY
          ,HZ_RELATIONSHIPS             RACO_BILL_REL
          ,AP_BANK_ACCOUNTS_ALL         APBA
          ,AP_BANK_BRANCHES             APB
          ,AR_RECEIPT_METHODS           ARM
          ,AR_RECEIPT_CLASSES           ARC
          ,RA_BATCH_SOURCES_ALL         BS
          ,RA_BATCHES_ALL               RAB
          ,RA_CUST_TRX_TYPES_ALL        CTT
          ,RA_TERMS                     RAT
          ,SO_AGREEMENTS                SOA
          ,ORG_FREIGHT                  ORF
          ,GL_DAILY_CONVERSION_TYPES    GDCT
          ,RA_CUSTOMER_TRX_ALL          CT_REL
          ,AR_LOOKUPS                   AL_FOB
          ,AR_LOOKUPS                   AL_TAX
     WHERE CT.CUSTOMER_TRX_ID = GD.CUSTOMER_TRX_ID
       AND 'REC' = GD.ACCOUNT_CLASS
       AND 'Y' = GD.LATEST_REC_FLAG
       AND CT.RELATED_CUSTOMER_TRX_ID = CT_REL.CUSTOMER_TRX_ID(+)
       AND CT.BILL_TO_CUSTOMER_ID = RAC_BILL.CUST_ACCOUNT_ID
       AND RAC_BILL.PARTY_ID = RAC_BILL_PARTY.PARTY_ID
       AND CT.SHIP_TO_CUSTOMER_ID = RAC_SHIP.CUST_ACCOUNT_ID(+)
       AND RAC_SHIP.PARTY_ID = RAC_SHIP_PARTY.PARTY_ID(+)
       AND CT.SOLD_TO_CUSTOMER_ID = RAC_SOLD.CUST_ACCOUNT_ID(+)
       AND RAC_SOLD.PARTY_ID = RAC_SOLD_PARTY.PARTY_ID(+)
       AND CT.PAYING_CUSTOMER_ID = RAC_PAYING.CUST_ACCOUNT_ID(+)
       AND RAC_PAYING.PARTY_ID = RAC_PAYING_PARTY.PARTY_ID(+)
       AND CT.BILL_TO_SITE_USE_ID = SU_BILL.SITE_USE_ID
       AND CT.SHIP_TO_SITE_USE_ID = SU_SHIP.SITE_USE_ID(+)
       AND CT.PAYING_SITE_USE_ID = SU_PAYING.SITE_USE_ID(+)
       AND SU_BILL.CUST_ACCT_SITE_ID = RAA_BILL.CUST_ACCT_SITE_ID
       AND RAA_BILL.PARTY_SITE_ID = RAA_BILL_PS.PARTY_SITE_ID
       AND RAA_BILL_LOC.LOCATION_ID = RAA_BILL_PS.LOCATION_ID
       AND SU_SHIP.CUST_ACCT_SITE_ID = RAA_SHIP.CUST_ACCT_SITE_ID(+)
       AND RAA_SHIP.PARTY_SITE_ID = RAA_SHIP_PS.PARTY_SITE_ID(+)
       AND RAA_SHIP_LOC.LOCATION_ID(+) = RAA_SHIP_PS.LOCATION_ID
       AND CT.BILL_TO_CONTACT_ID = RACO_BILL.CUST_ACCOUNT_ROLE_ID(+)
       AND RACO_BILL.PARTY_ID = RACO_BILL_REL.PARTY_ID(+)
       AND RACO_BILL_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
       AND RACO_BILL_REL.OBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
       AND RACO_BILL_REL.DIRECTIONAL_FLAG(+) = 'F'
       AND RACO_BILL.ROLE_TYPE(+) = 'CONTACT'
       AND RACO_BILL_REL.SUBJECT_ID = RACO_BILL_PARTY.PARTY_ID(+)
       AND CT.SHIP_TO_CONTACT_ID = RACO_SHIP.CUST_ACCOUNT_ROLE_ID(+)
       AND RACO_SHIP.PARTY_ID = RACO_SHIP_REL.PARTY_ID(+)
       AND RACO_SHIP_REL.SUBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
       AND RACO_SHIP_REL.OBJECT_TABLE_NAME(+) = 'HZ_PARTIES'
       AND RACO_SHIP_REL.DIRECTIONAL_FLAG(+) = 'F'
       AND RACO_SHIP.ROLE_TYPE(+) = 'CONTACT'
       AND RACO_SHIP_REL.SUBJECT_ID = RACO_SHIP_PARTY.PARTY_ID(+)
       AND CT.REMIT_TO_ADDRESS_ID = RAA_REMIT.CUST_ACCT_SITE_ID(+)
       AND RAA_REMIT.PARTY_SITE_ID = RAA_REMIT_PS.PARTY_SITE_ID(+)
       AND RAA_REMIT_LOC.LOCATION_ID(+) = RAA_REMIT_PS.LOCATION_ID
       AND RAA_BILL_LOC.COUNTRY = FT_BILL.TERRITORY_CODE(+)
       AND RAA_SHIP_LOC.COUNTRY = FT_SHIP.TERRITORY_CODE(+)
       AND RAA_REMIT_LOC.COUNTRY = FT_REMIT.TERRITORY_CODE(+)
       AND CT.CUSTOMER_BANK_ACCOUNT_ID = APBA.BANK_ACCOUNT_ID(+)
       AND APBA.BANK_BRANCH_ID = APB.BANK_BRANCH_ID(+)
       AND CT.RECEIPT_METHOD_ID = ARM.RECEIPT_METHOD_ID(+)
       AND ARM.RECEIPT_CLASS_ID = ARC.RECEIPT_CLASS_ID(+)
       AND CT.BATCH_SOURCE_ID = BS.BATCH_SOURCE_ID
       AND CT.BATCH_ID = RAB.BATCH_ID(+)
       AND CT.CUST_TRX_TYPE_ID = CTT.CUST_TRX_TYPE_ID
       AND CTT.TYPE <> 'BR'
       AND CT.TERM_ID = RAT.TERM_ID(+)
       AND CT.AGREEMENT_ID = SOA.AGREEMENT_ID(+)
       AND CT.EXCHANGE_RATE_TYPE = GDCT.CONVERSION_TYPE(+)
       AND 'FOB' = AL_FOB.LOOKUP_TYPE(+)
       AND CT.FOB_POINT = AL_FOB.LOOKUP_CODE(+)
       AND CT.SHIP_VIA = ORF.FREIGHT_CODE(+)
       AND CT.ORG_ID = ORF.ORGANIZATION_ID(+)
       AND 'TAX_CONTROL_FLAG' = AL_TAX.LOOKUP_TYPE(+)
       AND CT.DEFAULT_TAX_EXEMPT_FLAG = AL_TAX.LOOKUP_CODE(+)
       AND RACO_SHIP_REL.STATUS(+) = 'A'
       AND RACO_BILL_REL.STATUS(+) = 'A'
       AND CT.CUSTOMER_TRX_ID = 1485432;
    --INVOICE收款应用界面脚本
    SELECT APP.CASH_RECEIPT_ID CASH_RECEIPT_ID
          ,PS_INV.CUSTOMER_TRX_ID CUSTOMER_TRX_ID
          ,TO_NUMBER('') CM_CUSTOMER_TRX_ID
          ,APP.LAST_UPDATE_DATE LAST_UPDATE_DATE
          ,APP.LAST_UPDATED_BY LAST_UPDATED_BY
          ,APP.CREATION_DATE CREATION_DATE
          ,APP.CREATED_BY CREATED_BY
          ,APP.LAST_UPDATE_LOGIN LAST_UPDATE_LOGIN
          ,APP.PROGRAM_APPLICATION_ID PROGRAM_APPLICATION_ID
          ,APP.PROGRAM_ID PROGRAM_ID
          ,APP.PROGRAM_UPDATE_DATE PROGRAM_UPDATE_DATE
          ,APP.REQUEST_ID REQUEST_ID
          ,CR.RECEIPT_NUMBER RECEIPT_NUMBER
          ,'Y' APPLIED_FLAG
          ,PS_INV.CUSTOMER_ID CUSTOMER_ID
          ,SUBSTRB(PARTY.PARTY_NAME
                  ,1
                  ,50) CUSTOMER_NAME
          ,CUST.ACCOUNT_NUMBER CUSTOMER_NUMBER
          ,PS_INV.TRX_NUMBER TRX_NUMBER
          ,TO_NUMBER(DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                           ,-1
                           ,NULL
                           ,PS_INV.TERMS_SEQUENCE_NUMBER)) INSTALLMENT
          ,APP.AMOUNT_APPLIED AMOUNT_APPLIED
          ,NVL(APP.AMOUNT_APPLIED_FROM
              ,APP.AMOUNT_APPLIED) AMOUNT_APPLIED_FROM
          ,APP.TRANS_TO_RECEIPT_RATE TRANS_TO_RECEIPT_RATE
          ,TO_NUMBER(DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                           ,-1
                           ,NULL
                           ,NVL(APP.EARNED_DISCOUNT_TAKEN
                               ,0) + NVL(APP.UNEARNED_DISCOUNT_TAKEN
                                        ,0))) DISCOUNT
          ,APP.EARNED_DISCOUNT_TAKEN DISCOUNTS_EARNED
          ,APP.UNEARNED_DISCOUNT_TAKEN DISCOUNTS_UNEARNED
          ,PS_INV.DISCOUNT_TAKEN_EARNED DISCOUNT_TAKEN_EARNED
          ,PS_INV.DISCOUNT_TAKEN_UNEARNED DISCOUNT_TAKEN_UNEARNED
          ,TO_NUMBER(DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                           ,-1
                           ,NULL
                           ,PS_INV.AMOUNT_DUE_REMAINING)) AMOUNT_DUE_REMAINING
          ,DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                 ,-1
                 ,TO_DATE(NULL)
                 ,PS_INV.DUE_DATE) DUE_DATE
          ,PS_INV.STATUS STATUS
          ,PS_INV.TERM_ID TERM_ID
          ,DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                 ,-1
                 ,NULL
                 ,L_CLASS.MEANING) TRX_CLASS_NAME
          ,PS_INV.CLASS TRX_CLASS_CODE
          ,CTT.NAME TRX_TYPE_NAME
          ,CTT.CUST_TRX_TYPE_ID CUST_TRX_TYPE_ID
          ,CT.TRX_DATE TRX_DATE
          ,SU.LOCATION LOCATION_NAME
          ,CT.BILL_TO_SITE_USE_ID BILL_TO_SITE_USE_ID
          ,TO_NUMBER(DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                           ,-1
                           ,NULL
                           ,TRUNC(APP.APPLY_DATE) - TRUNC(PS_INV.DUE_DATE))) DAYS_LATE
          ,CTL.LINE_NUMBER LINE_NUMBER
          ,CTL.CUSTOMER_TRX_LINE_ID CUSTOMER_TRX_LINE_ID
          ,APP.APPLY_DATE APPLY_DATE
          ,APP.GL_DATE GL_DATE
          ,APP.GL_POSTED_DATE GL_POSTED_DATE
          ,APP.REVERSAL_GL_DATE REVERSAL_GL_DATE
          ,PS_INV.EXCHANGE_RATE EXCHANGE_RATE
          ,DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                 ,-1
                 ,CR.CURRENCY_CODE
                 ,PS_INV.INVOICE_CURRENCY_CODE) INVOICE_CURRENCY_CODE
          ,PS_INV.AMOUNT_DUE_ORIGINAL AMOUNT_DUE_ORIGINAL
          ,PS_INV.AMOUNT_IN_DISPUTE AMOUNT_IN_DISPUTE
          ,PS_INV.AMOUNT_LINE_ITEMS_ORIGINAL AMOUNT_LINE_ITEMS_ORIGINAL
          ,TO_NUMBER(DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                           ,-1
                           ,NULL
                           ,PS_INV.ACCTD_AMOUNT_DUE_REMAINING)) ACCTD_AMOUNT_DUE_REMAINING
          ,APP.ACCTD_AMOUNT_APPLIED_TO ACCTD_AMOUNT_APPLIED_TO
          ,APP.ACCTD_AMOUNT_APPLIED_FROM ACCTD_AMOUNT_APPLIED_FROM
          ,TO_NUMBER(DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                           ,-1
                           ,NULL
                           ,APP.ACCTD_AMOUNT_APPLIED_FROM -
                            NVL(APP.ACCTD_AMOUNT_APPLIED_TO
                               ,APP.ACCTD_AMOUNT_APPLIED_FROM))) EXCHANGE_GAIN_LOSS
          ,PS_INV.DISCOUNT_REMAINING DISCOUNT_REMAINING
          ,ARPT_SQL_FUNC_UTIL.GET_TERM_DETAILS(PS_INV.TERM_ID
                                              ,'CALC_DISCOUNT_ON_LINES_FLAG') CALC_DISCOUNT_ON_LINES_FLAG
          ,ARPT_SQL_FUNC_UTIL.GET_TERM_DETAILS(PS_INV.TERM_ID
                                              ,'PARTIAL_DISCOUNT_FLAG') PARTIAL_DISCOUNT_FLAG
          ,CTT.ALLOW_OVERAPPLICATION_FLAG ALLOW_OVERAPPLICATION_FLAG
          ,CTT.NATURAL_APPLICATION_ONLY_FLAG NATURAL_APPLICATION_ONLY_FLAG
          ,CTT.CREATION_SIGN CREATION_SIGN
          ,PS_INV.PAYMENT_SCHEDULE_ID APPLIED_PAYMENT_SCHEDULE_ID
          ,APP.USSGL_TRANSACTION_CODE USSGL_TRANSACTION_CODE
          ,APP.USSGL_TRANSACTION_CODE_CONTEXT USSGL_TRANSACTION_CODE_CONTEXT
          ,CT.PURCHASE_ORDER PURCHASE_ORDER
          ,CT.DOC_SEQUENCE_ID TRX_DOC_SEQUENCE_ID
          ,CT.DOC_SEQUENCE_VALUE TRX_DOC_SEQUENCE_VALUE
          ,BS.NAME TRX_BATCH_SOURCE_NAME
          ,PS_INV.AMOUNT_ADJUSTED AMOUNT_ADJUSTED
          ,PS_INV.AMOUNT_ADJUSTED_PENDING AMOUNT_ADJUSTED_PENDING
          ,PS_INV.AMOUNT_LINE_ITEMS_REMAINING AMOUNT_LINE_ITEMS_REMAINING
          ,PS_INV.FREIGHT_ORIGINAL FREIGHT_ORIGINAL
          ,PS_INV.FREIGHT_REMAINING FREIGHT_REMAINING
          ,PS_INV.RECEIVABLES_CHARGES_REMAINING RECEIVABLES_CHARGES_REMAINING
          ,PS_INV.TAX_ORIGINAL TAX_ORIGINAL
          ,PS_INV.TAX_REMAINING TAX_REMAINING
          ,PS_INV.SELECTED_FOR_RECEIPT_BATCH_ID SELECTED_FOR_RECEIPT_BATCH_ID
          ,APP.RECEIVABLE_APPLICATION_ID RECEIVABLE_APPLICATION_ID
          ,APP.SECONDARY_APPLICATION_REF_ID SECONDARY_APPLICATION_REF_ID
          ,APP.COMMENTS
          ,CTT.ATTRIBUTE10 TRANSACTION_CATEGORY
          ,APP.RECEIVABLES_TRX_ID RECEIVABLES_TRX_ID
          ,DECODE(PS_INV.CLASS
                 ,'PMT'
                 ,ART.NAME
                 ,DECODE(SIGN(APP.APPLIED_PAYMENT_SCHEDULE_ID)
                        ,-1
                        ,ART.NAME
                        ,NULL)) REC_ACTIVITY_NAME
          ,APP.APPLICATION_REF_TYPE
          ,ARPT_SQL_FUNC_UTIL.GET_LOOKUP_MEANING(DECODE(APP.APPLIED_PAYMENT_SCHEDULE_ID
                                                       ,-7
                                                       ,'AR_PREPAYMENT_TYPE'
                                                       ,'APPLICATION_REF_TYPE')
                                                ,APP.APPLICATION_REF_TYPE) APPLICATION_REF_TYPE_MEANING
          ,APP.APPLICATION_REF_ID
          ,APP.APPLICATION_REF_NUM
          ,APP.PAYMENT_SET_ID
          ,APP.APPLICATION_REF_REASON
          ,DECODE(APP.SECONDARY_APPLICATION_REF_ID
                 ,NULL
                 ,DECODE(PS_INV.CLASS
                        ,'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))
                 ,ARP_DEDUCTION.GET_TM_ORACLE_REASON(APP.SECONDARY_APPLICATION_REF_ID)) APPLICATION_REF_REASON_MEANING
          ,APP.CUSTOMER_REFERENCE
          ,APP.CUSTOMER_REASON
          ,APP.APPLIED_REC_APP_ID
          ,APP.SECONDARY_APPLICATION_REF_TYPE SECONDARY_APPLICATION_REF_TYPE
          ,APP.SECONDARY_APPLICATION_REF_NUM SECONDARY_APPLICATION_REF_NUM
      FROM AR_RECEIVABLE_APPLICATIONS_ALL APP
          ,AR_CASH_RECEIPTS_ALL           CR
          ,AR_PAYMENT_SCHEDULES_ALL       PS_INV
          ,HZ_CUST_ACCOUNTS               CUST
          ,HZ_PARTIES                     PARTY
          ,RA_CUSTOMER_TRX_ALL            CT
          ,RA_CUST_TRX_TYPES_ALL          CTT
          ,RA_CUSTOMER_TRX_LINES_ALL      CTL
          ,RA_BATCH_SOURCES_ALL           BS
          ,HZ_CUST_SITE_USES_ALL          SU
          ,AR_CONS_INV_ALL                CI
          ,AR_LOOKUPS                     L_CLASS
          ,AR_RECEIVABLES_TRX_ALL         ART
     WHERE APP.DISPLAY = 'Y'
       AND APP.CASH_RECEIPT_ID = CR.CASH_RECEIPT_ID
       AND CT.CUSTOMER_TRX_ID(+) = PS_INV.CUSTOMER_TRX_ID
       AND BS.BATCH_SOURCE_ID(+) = CT.BATCH_SOURCE_ID
       AND CTT.CUST_TRX_TYPE_ID(+) = PS_INV.CUST_TRX_TYPE_ID
       AND CUST.CUST_ACCOUNT_ID(+) = PS_INV.CUSTOMER_ID
       AND CUST.PARTY_ID = PARTY.PARTY_ID(+)
       AND SU.SITE_USE_ID(+) = PS_INV.CUSTOMER_SITE_USE_ID
       AND CTL.CUSTOMER_TRX_LINE_ID(+) = APP.APPLIED_CUSTOMER_TRX_LINE_ID
       AND PS_INV.CLASS = L_CLASS.LOOKUP_CODE
       AND L_CLASS.LOOKUP_TYPE = 'INV/CM'
       AND CI.CONS_INV_ID(+) = PS_INV.CONS_INV_ID
       AND APP.APPLIED_PAYMENT_SCHEDULE_ID = PS_INV.PAYMENT_SCHEDULE_ID
       AND ART.RECEIVABLES_TRX_ID(+) = APP.RECEIVABLES_TRX_ID
       AND CR.CASH_RECEIPT_ID = 294508;
    --应收INVOICE及收款产生的会计科目 
    --INVOICE产生的会计科目
    SELECT GP.PERIOD_NAME
                        ,A.CURRENCY_CODE
                        ,MEW_GET_TRANSACTION_PARTY_F(143
                                                    ,A.THIRD_PARTY_NUMBER
                                                    ,'C') THIRD_PARTY_NUMBER
                        ,GCC.SEGMENT4 || '.' || GCC.SEGMENT5 CONCATENATED_SEGMENTS
                        ,NVL(A.ENTERED_DR
                            ,0) ENTERED_DR
                        ,NVL(A.ENTERED_CR
                            ,0) ENTERED_CR
                        ,NVL(A.ACCOUNTED_DR
                            ,0) ACCOUNTED_DR
                        ,NVL(A.ACCOUNTED_CR
                            ,0) ACCOUNTED_CR
                    FROM XLA_AR_INV_AEL_SL_V  A
                        ,GL_CODE_COMBINATIONS GCC
                        ,GL_PERIOD_STATUSES   GP
                   WHERE A.APPLICATION_ID = 222
                     AND A.SET_OF_BOOKS_ID = 143
                     AND A.TRX_HDR_TABLE = 'CT'
                        --   AND A.TRX_HDR_ID = 1484132
                     AND A.ORG_ID BETWEEN 236 AND 242
                     AND GP.PERIOD_NAME = P_PERIOD
                     AND (GCC.SEGMENT4 = P_ACCOUNT OR P_ACCOUNT IS NULL)
                     AND A.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
                     AND A.ACCOUNTING_DATE >= GP.START_DATE
                     AND A.ACCOUNTING_DATE < GP.END_DATE + 1
                     AND GP.APPLICATION_ID = 222
                     AND GP.SET_OF_BOOKS_ID = 143
                     AND A.GL_TRANSFER_STATUS = 'Y'
                  UNION ALL
    --收款产生的会计科目
                  SELECT GP.PERIOD_NAME
                        ,A.CURRENCY_CODE
                        ,MEW_GET_TRANSACTION_PARTY_F(143
                                                    ,A.THIRD_PARTY_NUMBER
                                                    ,'C') THIRD_PARTY_NUMBER
                        ,GCC.SEGMENT4 || '.' || GCC.SEGMENT5 CONCATENATED_SEGMENTS
                        ,NVL(A.ENTERED_DR
                            ,0) ENTERED_DR
                        ,NVL(A.ENTERED_CR
                            ,0) ENTERED_CR
                        ,NVL(A.ACCOUNTED_DR
                            ,0) ACCOUNTED_DR
                        ,NVL(A.ACCOUNTED_CR
                            ,0) ACCOUNTED_CR
                    FROM XLA_AR_REC_AEL_SL_V  A
                        ,GL_CODE_COMBINATIONS GCC
                        ,GL_PERIOD_STATUSES   GP
                   WHERE A.APPLICATION_ID = 222
                     AND A.SET_OF_BOOKS_ID = 143
                     AND A.TRX_HDR_TABLE = 'CR'
                        --    AND A.TRX_HDR_ID = 294467
                     AND A.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
                     AND A.ACCOUNTING_DATE >= GP.START_DATE
                     AND A.ACCOUNTING_DATE < GP.END_DATE + 1
                     AND A.ORG_ID BETWEEN 236 AND 242
                     AND GP.PERIOD_NAME = P_PERIOD
                     AND (GCC.SEGMENT4 = P_ACCOUNT OR P_ACCOUNT IS NULL)
                     AND GP.APPLICATION_ID = 222
                     AND GP.SET_OF_BOOKS_ID = 143
                     AND A.GL_TRANSFER_STATUS = 'Y'
    --应收模块INVOICE及收款数据与总账的关联即如何由总账追溯到应收
    --从总账日记账追溯到应收INVOICE
    SELECT GJL.JE_LINE_NUM
          ,GJL.ENTERED_DR
          ,GJL.ENTERED_CR
          ,GJL.ACCOUNTED_DR
          ,GJL.ACCOUNTED_CR
          ,GJL.STAT_AMOUNT
          ,GJL.DESCRIPTION
          ,GJL.TRANSLATION_RATE
          ,GJL.TRANSLATION_AMOUNT
          ,GJL.USSGL_TRANSACTION_CODE
          ,GJL.SET_OF_BOOKS_ID
          ,GJL.CODE_COMBINATION_ID
          ,GJL.ROW_ID
          ,GJL.STATUS
          ,GJL.PERIOD_NAME
          ,GJL.IGNORE_RATE_FLAG
          ,GJL.EFFECTIVE_DATE
          ,GJL.REFERENCE_1
          ,GJL.REFERENCE_2
          ,GJL.REFERENCE_3
          ,GJL.REFERENCE_4
          ,GJL.REFERENCE_5
          ,GJL.REFERENCE_6
          ,GJL.REFERENCE_7
          ,GJL.REFERENCE_8
          ,GJL.REFERENCE_9
          ,GJL.REFERENCE_10
          ,GJL.CONTEXT
          ,GJL.ATTRIBUTE1
          ,GJL.ATTRIBUTE2
          ,GJL.ATTRIBUTE3
          ,GJL.ATTRIBUTE4
          ,GJL.ATTRIBUTE5
          ,GJL.ATTRIBUTE6
          ,GJL.ATTRIBUTE7
          ,GJL.ATTRIBUTE8
          ,GJL.ATTRIBUTE9
          ,GJL.ATTRIBUTE10
          ,GJL.CONTEXT2
          ,GJL.ATTRIBUTE11
          ,GJL.ATTRIBUTE12
          ,GJL.ATTRIBUTE13
          ,GJL.ATTRIBUTE14
          ,GJL.ATTRIBUTE15
          ,GJL.ATTRIBUTE16
          ,GJL.ATTRIBUTE17
          ,GJL.ATTRIBUTE18
          ,GJL.ATTRIBUTE19
          ,GJL.ATTRIBUTE20
          ,GJL.CONTEXT3
          ,GJL.TAX_CODE
          ,GJL.INVOICE_DATE
          ,GJL.INVOICE_IDENTIFIER
          ,GJL.INVOICE_AMOUNT
          ,GJL.NO1
          ,GJL.TAXABLE_LINE_FLAG
          ,GJL.TAX_TYPE_CODE
          ,GJL.TAX_CODE_ID
          ,GJL.TAX_ROUNDING_RULE_CODE
          ,GJL.AMOUNT_INCLUDES_TAX_FLAG
          ,GJL.TAX_DOCUMENT_IDENTIFIER
          ,GJL.TAX_DOCUMENT_DATE
          ,GJL.TAX_CUSTOMER_NAME
          ,GJL.TAX_CUSTOMER_REFERENCE
          ,GJL.TAX_REGISTRATION_NUMBER
          ,GJL.TAX_LINE_FLAG
          ,GJL.TAX_GROUP_ID
          ,GJL.CONTEXT4
          ,GJL.JGZZ_RECON_CONTEXT
          ,GJL.JGZZ_RECON_STATUS
          ,GJL.JGZZ_RECON_DATE
          ,GJL.JGZZ_RECON_ID
          ,GJL.JGZZ_RECON_REF
          ,GJL.JE_HEADER_ID
          ,GJL.GLOBAL_ATTRIBUTE1
          ,GJL.GLOBAL_ATTRIBUTE2
          ,GJL.GLOBAL_ATTRIBUTE3
          ,GJL.GLOBAL_ATTRIBUTE4
          ,GJL.GLOBAL_ATTRIBUTE5
          ,GJL.GLOBAL_ATTRIBUTE6
          ,GJL.GLOBAL_ATTRIBUTE7
          ,GJL.GLOBAL_ATTRIBUTE8
          ,GJL.GLOBAL_ATTRIBUTE9
          ,GJL.GLOBAL_ATTRIBUTE10
          ,GJL.GLOBAL_ATTRIBUTE_CATEGORY
          ,GJL.SUBLEDGER_DOC_SEQUENCE_ID
          ,GJL.SUBLEDGER_DOC_SEQUENCE_VALUE
          ,GJL.CREATION_DATE
          ,GJL.CREATED_BY
          ,GJL.LAST_UPDATE_DATE
          ,GJL.LAST_UPDATED_BY
          ,GJL.LAST_UPDATE_LOGIN
          ,GJL.WAD_ROW_ID
          ,GJL.TRANSACTION_TYPE
          ,GJL.TRANSACTION_DETAIL_TYPE
          ,GJL.EXCEPTION_FLAG
          ,GJL.AMOUNTS_FILLED_FLAG
          ,GJL.TO_CURRENCY_CODE
          ,GJL.TRANSLATED_DR
          ,GJL.TRANSLATED_CR
      FROM GL_JE_LINES_V                GJL
          ,RA_CUSTOMER_TRX_ALL          RCTA
          ,RA_CUST_TRX_LINE_GL_DIST_ALL RCLGDA
     WHERE (JE_HEADER_ID = 3332300)
       AND DESCRIPTION LIKE '%80210595%' --事务处理编号
       AND RCLGDA.CUST_TRX_LINE_GL_DIST_ID = GJL.REFERENCE_3
       AND GJL.REFERENCE_4 = RCTA.TRX_NUMBER
       AND GJL.REFERENCE_2 = RCTA.CUSTOMER_TRX_ID
       AND GJL.SUBLEDGER_DOC_SEQUENCE_ID = RCTA.DOC_SEQUENCE_ID
       AND GJL.SUBLEDGER_DOC_SEQUENCE_VALUE = RCTA.DOC_SEQUENCE_VALUE
     ORDER BY JE_LINE_NUM;
    --从总账日记账追溯到应收收款
    SELECT GJL.JE_LINE_NUM
          ,GJL.ENTERED_DR
          ,GJL.ENTERED_CR
          ,GJL.ACCOUNTED_DR
          ,GJL.ACCOUNTED_CR
          ,GJL.STAT_AMOUNT
          ,GJL.DESCRIPTION
          ,GJL.TRANSLATION_RATE
          ,GJL.TRANSLATION_AMOUNT
          ,GJL.USSGL_TRANSACTION_CODE
          ,GJL.SET_OF_BOOKS_ID
          ,GJL.CODE_COMBINATION_ID
          ,GJL.ROW_ID
          ,GJL.STATUS
          ,GJL.PERIOD_NAME
          ,GJL.IGNORE_RATE_FLAG
          ,GJL.EFFECTIVE_DATE
          ,GJL.REFERENCE_1
          ,GJL.REFERENCE_2
          ,GJL.REFERENCE_3
          ,GJL.REFERENCE_4
          ,GJL.REFERENCE_5
          ,GJL.REFERENCE_6
          ,GJL.REFERENCE_7
          ,GJL.REFERENCE_8
          ,GJL.REFERENCE_9
          ,GJL.REFERENCE_10
          ,GJL.CONTEXT
          ,GJL.ATTRIBUTE1
          ,GJL.ATTRIBUTE2
          ,GJL.ATTRIBUTE3
          ,GJL.ATTRIBUTE4
          ,GJL.ATTRIBUTE5
          ,GJL.ATTRIBUTE6
          ,GJL.ATTRIBUTE7
          ,GJL.ATTRIBUTE8
          ,GJL.ATTRIBUTE9
          ,GJL.ATTRIBUTE10
          ,GJL.CONTEXT2
          ,GJL.ATTRIBUTE11
          ,GJL.ATTRIBUTE12
          ,GJL.ATTRIBUTE13
          ,GJL.ATTRIBUTE14
          ,GJL.ATTRIBUTE15
          ,GJL.ATTRIBUTE16
          ,GJL.ATTRIBUTE17
          ,GJL.ATTRIBUTE18
          ,GJL.ATTRIBUTE19
          ,GJL.ATTRIBUTE20
          ,GJL.CONTEXT3
          ,GJL.TAX_CODE
          ,GJL.INVOICE_DATE
          ,GJL.INVOICE_IDENTIFIER
          ,GJL.INVOICE_AMOUNT
          ,GJL.NO1
          ,GJL.TAXABLE_LINE_FLAG
          ,GJL.TAX_TYPE_CODE
          ,GJL.TAX_CODE_ID
          ,GJL.TAX_ROUNDING_RULE_CODE
          ,GJL.AMOUNT_INCLUDES_TAX_FLAG
          ,GJL.TAX_DOCUMENT_IDENTIFIER
          ,GJL.TAX_DOCUMENT_DATE
          ,GJL.TAX_CUSTOMER_NAME
          ,GJL.TAX_CUSTOMER_REFERENCE
          ,GJL.TAX_REGISTRATION_NUMBER
          ,GJL.TAX_LINE_FLAG
          ,GJL.TAX_GROUP_ID
          ,GJL.CONTEXT4
          ,GJL.JGZZ_RECON_CONTEXT
          ,GJL.JGZZ_RECON_STATUS
          ,GJL.JGZZ_RECON_DATE
          ,GJL.JGZZ_RECON_ID
          ,GJL.JGZZ_RECON_REF
          ,GJL.JE_HEADER_ID
          ,GJL.GLOBAL_ATTRIBUTE1
          ,GJL.GLOBAL_ATTRIBUTE2
          ,GJL.GLOBAL_ATTRIBUTE3
          ,GJL.GLOBAL_ATTRIBUTE4
          ,GJL.GLOBAL_ATTRIBUTE5
          ,GJL.GLOBAL_ATTRIBUTE6
          ,GJL.GLOBAL_ATTRIBUTE7
          ,GJL.GLOBAL_ATTRIBUTE8
          ,GJL.GLOBAL_ATTRIBUTE9
          ,GJL.GLOBAL_ATTRIBUTE10
          ,GJL.GLOBAL_ATTRIBUTE_CATEGORY
          ,GJL.SUBLEDGER_DOC_SEQUENCE_ID
          ,GJL.SUBLEDGER_DOC_SEQUENCE_VALUE
          ,GJL.CREATION_DATE
          ,GJL.CREATED_BY
          ,GJL.LAST_UPDATE_DATE
          ,GJL.LAST_UPDATED_BY
          ,GJL.LAST_UPDATE_LOGIN
          ,GJL.WAD_ROW_ID
          ,GJL.TRANSACTION_TYPE
          ,GJL.TRANSACTION_DETAIL_TYPE
          ,GJL.EXCEPTION_FLAG
          ,GJL.AMOUNTS_FILLED_FLAG
          ,GJL.TO_CURRENCY_CODE
          ,GJL.TRANSLATED_DR
          ,GJL.TRANSLATED_CR
          ,ADA.LINE_ID
      FROM GL_JE_LINES_V        GJL
          ,AR_CASH_RECEIPTS_ALL ACRA
          ,AR_DISTRIBUTIONS_ALL ADA
     WHERE (GJL.JE_HEADER_ID = 3332299)
       AND GJL.DESCRIPTION LIKE '%20120113001%' --收款编号
       AND GJL.SUBLEDGER_DOC_SEQUENCE_ID = ACRA.DOC_SEQUENCE_ID
       AND GJL.SUBLEDGER_DOC_SEQUENCE_VALUE = ACRA.DOC_SEQUENCE_VALUE
       AND ADA.LINE_ID = GJL.REFERENCE_3 --收款分配ID
     ORDER BY JE_LINE_NUM;
    --AR与OM关联关系
    interface_line_context : 'ORDER ENTRY'
    interface_line_attribute1: order_number
    interface_line_attribute2: order_type
    interface_line_attribute3: delivery_id
    interface_line_attribute4: Waybill
    interface_line_attribute5: Count
    interface_line_attribute6: order line id
    interface_line_attribute10 warehouse id
    
    

  • 相关阅读:
    InfluxDB 安装使用
    Jenkins 覆盖率插件Cobertura 使用
    sonarqube的安装部署以及集成jenkins
    vscode md样式自定义
    maven配置JaCoCo
    jenkins 安装
    Maven 构建报依赖jar下载失败
    Telegraf 简单使用
    Python 生成当前项目依赖包 requirements
    面试内容
  • 原文地址:https://www.cnblogs.com/wanghang/p/6299328.html
Copyright © 2020-2023  润新知