千家信息网

制作销售订单按期交货率统计报表

发表于:2025-01-23 作者:千家信息网编辑
千家信息网最后更新 2025年01月23日,1、问题描述按照教科书的解释, 按期交货率就是用供应商按时交货的数量(或者金额, 或者订单行数), 除以该时间内应该交货的数量(或者金额,或者订单行数),在实际工作中,我们的统计方法是按订单的笔数来计
千家信息网最后更新 2025年01月23日制作销售订单按期交货率统计报表

1、问题描述

按照教科书的解释, 按期交货率就是用供应商按时交货的数量(或者金额, 或者订单行数), 除以该时间内应该交货的数量(或者金额,或者订单行数),在实际工作中,我们的统计方法是按订单的笔数来计算的,即同一个客户同一个交货日期为一笔订单,可能各家的计算方法稍有不同,但基本上大同小异。

2、实现方法

2.1 用分组实现订单笔数的统计,用序号来代表,一个序号代表一笔订单:

2.2 用SQL把与销售订单对应的生产任务单、产品入库单数据提取出来,前提是必须进行了MRP运算,并且不允许手工合并相关需求单据且不得手工下达生产任务单,否则会因为各单据之间没有关联而无法获取数据,语句如下:

  1. SELECT * FROM (SELECT t1.FBillNo,u1.FName AS FCustID,case when u1.FName='零售户' then '预测订单' else '销售订单' end as FCustID1,t1.FDate,
  2. u2.FName AS FEmpID,
  3. case when t1.FMultiCheckLevel1=16403 or t1.FMultiCheckLevel1=16507 then '昆嵛路工厂'
  4. else '四产路工厂' end
  5. AS fparentid,t2.FEntryID,t100.FNumber,t100.FName,t100.FModel,
  6. CASE WHEN t2.FUnitID=0 THEN '' ELSE u4.FName END AS FUnitID,
  7. t2.FAuxQty As FQty,t2.FDate AS FOutStockDate,t2.FAdviceConsignDate,u5.FBOMNumber,t1.FInterID
  8. ,t2.FAuxStockQty as FStockQty,t51.FName as FCUUnitID,t2.FQty/t51.FCoefficient as FCUQty,
  9. t2.FStockQty/t51.FCoefficient as FCUStockQty
  10. ,cast(t2.finterid as varchar)+cast(t2.fentryid as varchar) finteridfentryid,t800.fqty fstockqty1,t800.fcheckdate,t2.FHaveMrp,t1.FExchangeRate,t2.fauxpricediscount,t900.fqty fqty900
  11. FROM SEOrder t1 INNER JOIN SEOrderEntry t2 ON t1.FInterID = t2.FInterID and t1.fstatus in (1,2,3)
  12. and t1.FChangeMark=0 AND Isnull(t1.FClassTypeID,0)<>1007100 and t2.FMrpAutoClosed in ${是否手工行关闭} left outer join icmo t900 on t900.FOrderInterID =t2.FInterID and t900.FSourceEntryID=t2.FEntryID and t900.fitemid=t2.fitemid
  13. left outer join (select b.FICMOInterID,b.fitemid,b.fqty,a.fdate as fcheckdate from icstockbill a join icstockbillentry b
  14. on a.finterid=b.finterid where a.ftrantype=2 and a.fstatus=1) t800 on t800.FICMOInterID=t900.finterid
  15. LEFT OUTER JOIN t_Organization u1 ON t1.FCustID=u1.FItemID
  16. LEFT OUTER JOIN t_Emp u2 ON t1.FEmpID=u2.FItemID
  17. LEFT OUTER JOIN t_ICItem t100 ON t2.FItemID = t100.FItemID
  18. LEFT OUTER JOIN t_MeasureUnit u4 ON t2.FUnitID = u4.FItemID
  19. LEFT OUTER JOIN t_MeasureUnit t51 ON t100.FProductUnitID=t51.FItemID
  20. LEFT OUTER JOIN ICBOM u5 ON t2.FBomInterID = u5.FInterID ) tt
  21. WHERE 1=1 and tt.FOutStockDate>='${开始日期}' and tt.FOutStockDate<='${结束日期}'
  22. and tt.FCustID1='销售订单' and tt.FNumber>'3.01'
  23. ${if(len(fparentid)==0,"","and fparentid = '"+fparentid+"'")}
  24. order by ${cname} ${orderby}

3、效果展示

0