根据事务处理ID取会计分录的金额

function get_price(p_in_transaction_id in number) return number is
    l_price  number;
    l_exists varchar2(1);
    l_msg    varchar2(200);
  begin
    begin
      select 'Y'
        into l_exists
        from xla.xla_transaction_entities xte
       where nvl(xte.source_id_int_1, -99) = p_in_transaction_id
         and rownum = 1;
    exception
      when others then
        l_exists := 'N';
        l_msg    := '存在未创建会计分录的事务处理 ID:' || p_in_transaction_id;
        fnd_file.put_line(fnd_file.log, l_msg);
    end;
    if l_exists = 'Y' then
   
      select sum(nvl(xal.entered_dr, 0) - nvl(xal.entered_cr, 0))
        into l_price
        from xla.xla_ae_lines             xal,
             xla.xla_ae_headers           xah,
             xla.xla_events               xe,
             xla.xla_transaction_entities xte
       where xah.ae_header_id = xal.ae_header_id
         and xah.application_id = xal.application_id
         and xah.application_id = 555
         and xe.event_id = xah.event_id
         and xe.application_id = xah.application_id
         and xe.entity_id = xte.entity_id
         and xe.application_id = xte.application_id
         and xte.application_id = xah.application_id
         and xte.entity_id = xah.entity_id
         and xal.accounting_class_code = 'DEFERRED_COGS'--'COST_OF_GOODS_SOLD'
         and nvl(xte.source_id_int_1, -99) = p_in_transaction_id;
    end if;
    return nvl(l_price, 0);
  end get_price;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值