|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
declare @date1 datetime
declare @date2 datetime
set @date1=:date_b!起始日期
set @date2=:date_e!截止日期
select prd_no as 品号
((select isnull(sum(qty),0) from mf_mm_nbcb where mrp_no=p.prd_no and mm_dd <@date1)+
(select isnull(sum(qty),0) from tf_pss_pc_nbcb where prd_no=p.prd_no and ps_dd<@date1)-
(select isnull(sum(qty),0) from tf_pss_sa_nbcb where prd_no=p.prd_no and ps_dd<@date1))as 上期结余,
(select isnull(sum(qty),0) from mf_mm_nbcb where mrp_no=p.prd_no and mm_dd between @date1 and @date2 )+
(select isnull(sum(qty),0) from tf_pss_pc_nbcb where prd_no=p.prd_no and ps_dd between @date1 and @date2)as 本期进货,
(select isnull(sum(qty),0) from tf_pss_sa_nbcb where prd_no=p.prd_no and ps_dd between @date1 and @date2)as 本期销货,
((select isnull(sum(qty*nbcb),0) from mf_mm_nbcb where mrp_no=p.prd_no and mm_dd <@date1)+
(select isnull(sum(qty*nbcb),0) from tf_pss_pc_nbcb where prd_no=p.prd_no and ps_dd<@date1)-
(select isnull(sum(qty*nbcb),0) from tf_pss_sa_nbcb where prd_no=p.prd_no and ps_dd<@date1))as '上期结余(内部成本)',
(select isnull(sum(qty*nbcb),0) from mf_mm_nbcb where mrp_no=p.prd_no and mm_dd between @date1 and @date2 )+
(select isnull(sum(qty*nbcb),0) from tf_pss_pc_nbcb where prd_no=p.prd_no and ps_dd between @date1 and @date2)as '本期进货(内部成本)',
(select isnull(sum(qty*nbcb),0) from tf_pss_sa_nbcb where prd_no=p.prd_no and ps_dd between @date1 and @date2)as '本期销货(内部成本)'
from prdt as p where prd_no between :prdt_b!起始品号 and :prdt_e!截止品号
如何把PRDT 中的中类IDX1和WH显示出来!!谢谢!!在线等!!能否把仓库做为过滤!!
|
|