Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1851346
  • 博文数量: 334
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 3452
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-18 10:19
个人简介

路虽弥,不行不至;事虽少,不做不成。

文章分类

全部博文(334)

文章存档

2013年(4)

2012年(19)

2011年(27)

2010年(71)

2009年(45)

2008年(15)

2007年(84)

2006年(69)

分类: Oracle

2009-07-16 12:33:50

--==============================================
--To query Receipt Accounting entries
--==============================================
SELECT amount_dr, amount_cr, acctd_amount_dr, acctd_amount_cr,
          gcc.segment1
       || '.'
       || gcc.segment2
       || '.'
       || gcc.segment3
       || '.'
       || gcc.segment4
       || '.'
       || gcc.segment5 ACCOUNT
  FROM ar.ar_distributions_all ad, gl.gl_code_combinations gcc
 WHERE source_table = 'CRH'
   AND EXISTS (
          SELECT 'T'
            FROM ar.ar_cash_receipt_history_all a, ar.ar_cash_receipts_all b
           WHERE a.cash_receipt_id = b.cash_receipt_id
             AND source_id = cash_receipt_history_id
             AND b.org_id = '&org_id'
             AND b.org_id = a.org_id
             AND b.receipt_number LIKE '%&receipt_number%')
   AND ad.code_combination_id = gcc.code_combination_id
UNION ALL
SELECT amount_dr, amount_cr, acctd_amount_dr, acctd_amount_cr,
          gcc.segment1
       || '.'
       || gcc.segment2
       || '.'
       || gcc.segment3
       || '.'
       || gcc.segment4
       || '.'
       || gcc.segment5 ACCOUNT
  FROM ar.ar_distributions_all ad, gl.gl_code_combinations gcc
 WHERE source_table = 'RA'
   AND EXISTS (
          SELECT 'T'
            FROM ar.ar_receivable_applications_all a,
                 ar.ar_cash_receipts_all b
           WHERE a.cash_receipt_id = b.cash_receipt_id
             AND a.receivable_application_id = source_id
             AND b.org_id = '&org_id'
             AND b.org_id = a.org_id
             AND b.receipt_number LIKE '%&receipt_number%')
   AND ad.code_combination_id = gcc.code_combination_id
  
  
--==============================================
--To check COA's struture which includes segment
--==============================================
SELECT application_column_name, segment_name
  FROM apps.fnd_id_flex_segments
 WHERE application_id = 101 AND id_flex_code = 'GL#'
 
 
另附杂收的会计分录;
 
 
SELECT acr.receipt_number, ada.amount_dr, ada.amount_cr,
       ada.acctd_amount_dr,ada.acctd_amount_cr
  FROM ar.ar_distributions_all ada,
       ar.ar_misc_cash_distributions_all mcd,
       ar.ar_cash_receipts_all acr
 WHERE ada.source_table = 'MCD'
   AND ada.source_id = mcd.misc_cash_distribution_id
   AND mcd.cash_receipt_id = acr.cash_receipt_id
   AND mcd.set_of_books_id = '&sob'
阅读(1205) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~