NC65 查询科目余额表,按月计算期末余额sql
sum(case when adjustperiod > '00' and #{month}>=adjustperiodthen gl_detail.localdebitamount else 0 end) borrower,--借方累计,sum(case when adjustperiod > '00' and #{month}>=adjustperiodthen gl_detail.local
·
select
sum(CASE WHEN adjustperiod = '00' THEN gl_detail.localdebitamount ELSE 0 END ) begin1,--期初余额
sum(case when adjustperiod > '00' and #{month}>=adjustperiod then gl_detail.localdebitamount else 0 end) borrower,--借方累计,
sum(case when adjustperiod > '00' and #{month}>=adjustperiod then gl_detail.localcreditamount else 0 end) lender --贷方累计
from gl_detail gl_detail,org_accountingbook,bd_accasoa,bd_account
where gl_detail.pk_accountingbook=org_accountingbook.pk_accountingbook
and gl_detail.pk_accasoa=bd_accasoa.pk_accasoa
and bd_accasoa.pk_account=bd_account.pk_account
and gl_detail.yearv = #{year}
and gl_detail.adjustperiod >= '00'
and #{month} >=gl_detail.adjustperiod
and org_accountingbook.code=#{bookCode} --账簿编号
and gl_detail.discardflagv !='Y'
and gl_detail.dr = 0
and gl_detail.voucherkindv!= 255
and gl_detail.tempsaveflag!='Y'
and gl_detail.voucherkindv!= 5
and bd_account.code like #{accountCode} --科目编码
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐

所有评论(0)