【问】商锐95–进销存月类别汇总(上个月结存金额不等于下个月的期初金额),查询方案 | ||
【适用版本】商锐9 | 【模块】决策管理 | 【点击数】164 |
【知识编号】P2016031200012 | ||
【问题描述】商锐95–进销存月类别汇总(上个月结存金额不等于下个月的期初金额),查询方案 |
如下是查询201512月结存金额不等于201601月的期初金额
结存金额 =
(期初金额+ 采购金额+调入金额+其他入库成本金额 – 批发销售成本金额 – pos销售成本金额-退货成本金额-其他出库成本金额-调出成本金额 -差异金额 + 调整金额)
select
sum(Init_amt + pi_amt + mi_amt+ so_cost – pos_cost – ro_cost – oo_cost – mo_cost + num2 )
from t_da_jxc_month where
oper_date=’201512′ and branch_no like ‘00%’and item_no in
(select item_no from t_bd_item_info where item_clsno like ‘600202%’)提示:进销存月类别里,如查询不对,是因为可能是上个月发生的货号多,或者是下个月的发生业务多步骤1:
–查询上个月的进销存业务数据
select * into jc from t_da_jxc_month where
oper_date=’201512′ and branch_no like ‘00%’and item_no in
(select item_no from t_bd_item_info where item_clsno like ‘600202%’)–查询本月的进销存业务数据
select * into qc from t_da_jxc_month where
oper_date=’201601′ and branch_no like ‘00%’and item_no in
(select item_no from t_bd_item_info where item_clsno like ‘600202%’)
–情况①:比对此2个月同样货号的进销存业务结存和期初是否正常,如是一样,则是上个月和下个月的货号多少问题,
select SUM(a.settle_amt),SUM(b.init_amt) from jc a,qc b where a.item_no=b.item_no–如下是可以查询出来多出来的商品数据,期初
select sum(init_amt) from qc where qc.item_no not in (select item_no from jc)
select * from qc where qc.item_no not in (select item_no from jc)提示:由于上个月发生的业务货号多,因此不等于下个月的起初,