固定资产变动,查询找不到相应卡片

一、在单位做资产类别变动时,选择不到需要变动的卡片

ScreenClip(2)

二、开启后台日志跟踪,提取“卡片查询”时后台执行的sql语句如下

  1. select *
  2. from ( select row_fa.*, rownum rownum_
  3. from (select distinct fa_card.card_code,
  4.                                 fa_card.asset_code,
  5.                                 fa_card.asset_name,
  6.                                 fa_card.pk_card
  7. from fa_card
  8. left outer join ( select code
  9. from fa_log
  10. where pk_corp = '公司pk'
  11. and (substr (bill_code, 1, 1) = '0')) fa_log_not_in
  12. on fa_card.pk_card = fa_log_not_in.code
  13. left outer join fa_cardhistory
  14. on fa_card.pk_card = fa_cardhistory.fk_card
  15. left outer join fa_deptscale
  16. on fa_cardhistory.fk_usedept =
  17.                        fa_deptscale.fk_history_usedept
  18. left outer join fa_category
  19. on fa_cardhistory.fk_category = fa_category.pk_category
  20. where (fa_card.dr = 0 and fa_cardhistory.dr = 0 and
  21.                        fa_card.pk_corp = '公司pk' and
  22.                        fa_cardhistory.pk_corp = '公司pk' and reduce_flag = 0 and
  23.                        laststate_flag = 1 and
  24.                        fa_cardhistory.fk_accbook = '公司固定资产账簿pk' and
  25.                        fa_cardhistory.reduce_flag = 0 and
  26.                        fa_cardhistory.laststate_flag = 1 and
  27.                        fa_cardhistory.dr = 0 and
  28.                        (fa_card.bill_code is null or
  29. substr(fa_card.bill_code, 1 , 1) = '1') and
  30.                        fa_cardhistory.pk_corp = '公司pk' and
  31.                        fk_card in
  32.                        ( select code
  33. from fa_log
  34. where pk_corp = '公司pk'
  35. and fa_log.fk_accbook = '公司固定资产账簿pk'
  36. and (bill_code is null or
  37. substr(bill_code, 1 , 1) = '1')))) row_fa
  38. where rownum <= 5000)
  39. where rownum_ > 0

三、通过对刷选条件进行对比,发现问题出在fa_log表中无对应fk_card主键记录,通过如下sql进行查询

  1. select *
  2. from fa_log
  3. where pk_corp = '1138'
  4. and fa_log.fk_accbook = '公司固定资产账簿pk'
  5. and (bill_code is null or substr(bill_code, 1 , 1) = '1')
  6. and code = '固定资产卡片pk'

四、问题解决办法

    a、确认此张卡片是否存在未审核的变动单,在“变动单管理”进行查询确认,或者在卡片中点击附属项”减少记录“查看,若有进行”审核“或者”删除“

    b、在固定资产最小结账月,重新进行”折旧与摊销“计提;进行固定资产模块结账操作,然后反结账

这次遇到的问题并没有未确认的资产变动单,通过第二种方法进行了操作后,通过对fa_log表进行查询,发现新增了一条新的记录,增加时间为当天,奇怪的现象

ScreenClip(3)

posted @ 2013-01-08 14:10  afonofa  阅读(1602)  评论(0)    收藏  举报