实施日志-成本计算单横向展示-分成本项目原创
11人赞赏了该文章
472次浏览
编辑于2023年05月15日 15:03:03
select t2.FYEAR as 年度,t2.FPERIOD as 期间,t1.FFORMID as 单据类型,t3.FNUMBER as 物料编码, sum(t4.FBEGINQTY) as 期初数量,sum(t4.FCURRINPUTQTY) as 本期投入数量,0,sum(t4.FENDQTY) as 期末在产数量, sum(t5.FBegAmount1) as 期初直接材料,sum(t5.FInAmount1) as 本期投入直接材料,0,sum(t5.FEndAmount1) as 期末在产直接材料, sum(t5.FBegAmount2) as 期初直接人工,sum(t5.FInAmount2) as 本期投入直接人工,0,sum(t5.FEndAmount2) as 期末在产直接人工, sum(t5.FBegAmount3) as 期初制造费用,sum(t5.FInAmount3) as 本期投入制造费用,0,sum(t5.FEndAmount3) as 期末在产制造费用 from T_CB_PROORDERINFO t0 inner join T_CB_PROORDERDIME t1 on t0.FProductDimeId=t1.FProductDimeId inner join T_HS_OUTACCTG t2 on t2.FID=t0.FACCTGID inner join t_bd_Material t3 on t1.FPRODUCTID=t3.FMATERIALID inner join T_CB_COSTCALEXPENSE t4 on t0.FID=t4.FID left join (select t04.FENTRYID,sum(case when t5.FNAME='直接材料' then t04.FBeginAmount else 0 end) as FBegAmount1, sum(case when t5.FNAME='直接材料' then t04.FCurrInputAmount else 0 end) as FInAmount1, sum(case when t5.FNAME='直接材料' then t04.FEndAmount else 0 end) as FEndAmount1, sum(case when t5.FNAME='直接人工' then t04.FBeginAmount else 0 end) as FBegAmount2, sum(case when t5.FNAME='直接人工' then t04.FCurrInputAmount else 0 end) as FInAmount2, sum(case when t5.FNAME='直接人工' then t04.FEndAmount else 0 end) as FEndAmount2, sum(case when t5.FNAME='制造费用' then t04.FBeginAmount else 0 end) as FBegAmount3, sum(case when t5.FNAME='制造费用' then t04.FCurrInputAmount else 0 end) as FInAmount3, sum(case when t5.FNAME='制造费用' then t04.FEndAmount else 0 end) as FEndAmount3 from T_CB_COSTCALEXPENSEDETAIL t04 inner join T_HS_COSTITEM_L t5 on t04.FCOSTITEMID=t5.FCOSTITEMID and t5.FLOCALEID=2052 group by t04.FENTRYID) t5 on t5.FENTRYID=t4.FENTRYID group by t2.FYEAR,t2.FPERIOD,t3.FNUMBER,t1.FFORMID
赞 11
11人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读