
2.

3.

4.

5.

6.

${if(AGENCY_CODE = '',
"",
"and AGENCY_CODE in ('" + REPLACE(AGENCY_CODE, ",", "','") + "')") }


剩下的那个and agency_code就是sql里你写的where条件 你这个改成mof div code就可以
select t1.收入分类科目代码,t1.账套名称,t1.乡镇类,t1.乡镇款,t1.乡镇项,t1.乡镇子项,t.income_sort_name,t.income_sort_code,t1.code1,t1.code2,t1.code3,t1.code4,t1.会计科目代码,t1.收入分类科目名称 from
(select
c.income_sort_code as 收入分类科目代码,
a.name as 账套名称,
c.income_sort_name as 收入分类科目名称,a.code,substr(c.account_cls_code, 1, 4) as 会计科目代码,w.code1 as code1,
w.code2 as code2,w.code3 as code3,w.code4 as code4,c.vou_det_id,
sum ((c.cre_money))over(partition by w.code1,a.name,substr(c.account_cls_code, 1, 4) ) as 乡镇类,
sum ((c.cre_money))over(partition by w.code2,a.name,substr(c.account_cls_code, 1, 4) ) as 乡镇款,
sum ((c.cre_money))over(partition by w.code3,a.name,substr(c.account_cls_code, 1, 4) ) as 乡镇项,
sum ((c.cre_money))over(partition by w.code4,a.name,substr(c.account_cls_code, 1, 4) ) as 乡镇子项
from CZ_GLDATA23.GLF_VOU_DETAIL c
left join CZ_GLDATA23.GLF_VOU_HEAD b
on c.vou_id=b.vou_id
left join cz_element.gap_book_set a
on a.id = b.set_id,
cz_element.bas_income_sort w
where c.set_year = '2023'
AND substr(c.account_cls_code, 1, 4) in ('6001', '6002', '6003')
and c.is_deleted <> 1
and b.is_deleted <> 1
and a.is_deleted <> 1
${if(treeComboBoxEditor1 = '',
"",
"and c.mof_div_code in ('" + REPLACE(treeComboBoxEditor1, ",", "','") + "')") }
-- treeComboBoxEditor1
and w.income_sort_code=c.income_sort_code
and b.make_date between '${start_time}' and '${end_time}'
--and b.make_date between 2023-01-01 and 2023-03-14
group by a.name,c.income_sort_code,c.income_sort_name,c.vou_det_id,c.cre_money ,a.code,substr(c.account_cls_code, 1, 4),w.code1,w.code2,w.code3,w.code4
order by c.income_sort_code) t1
right join (select distinct w.income_sort_code,w.income_sort_name
from cz_element.bas_income_sort w
where length(income_sort_code) = 9 or length(income_sort_code) = 7 or length(income_sort_code) = 5 or length(income_sort_code) = 3) t
on t.income_sort_code = t1.收入分类科目代码
order by income_sort_code




本文是一份详尽的帆软软件使用教程,涵盖了从基础操作到高级应用的各个层面,帮助用户快速掌握帆软工具的使用技巧和最佳实践。

7423

被折叠的 条评论
为什么被折叠?



