Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1851334
  • 博文数量: 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-06-23 16:36:14

--Purpose: To validate whether a transaction's REC is equal to its REV plus TAX or not
--Author : Richard.liu
 
SELECT c.trx_number, c.complete_flag, c.customer_trx_id,
       a.customer_trx_line_id,
       (SELECT payment_schedule_id
          FROM ar.ar_payment_schedules_all d
         WHERE a.customer_trx_id = d.customer_trx_id) payment_schedule_id,
       (SELECT receivable_application_id
          FROM ar.ar_receivable_applications_all e
         WHERE a.customer_trx_id =
                                  e.customer_trx_id)
                                                    receivable_application_id
  FROM ar.ra_customer_trx_lines_all a,
       ar.ra_customer_trx_lines_all b,
       ar.ra_customer_trx_all c
 WHERE c.set_of_books_id = '&sob'
   AND a.customer_trx_id = c.customer_trx_id
   AND a.set_of_books_id = '&sob'
   AND a.set_of_books_id = b.set_of_books_id
   AND a.customer_trx_line_id = b.link_to_cust_trx_line_id
   AND a.revenue_amount <> b.taxable_amount
   AND EXISTS (
          SELECT 'T'
            FROM ar.ra_cust_trx_types_all rctt
           WHERE rctt.post_to_gl = 'Y'
             AND rctt.set_of_books_id = c.set_of_books_id
             AND rctt.cust_trx_type_id = c.cust_trx_type_id
             AND rctt.end_date IS NULL)
   AND EXISTS (
          SELECT 'T'
            FROM ar.ra_cust_trx_line_gl_dist_all rctlg
           WHERE rctlg.set_of_books_id = c.set_of_books_id
             AND rctlg.customer_trx_id = c.customer_trx_id
             AND rctlg.gl_date >= SYSDATE - 31)
阅读(873) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~