金蝶K3系统定制国际销售日报表

  1. T13T181861x2257 t7 on t7.id=(select top 1 id from [IMS].[Portal].[dbo].T13T181861x2257 as qq where qq.Fs122318127T46=t.fbillno)--财务到款系统

  2. inner join [K3].[dbo].t_icitem T8 ON T8.FitemID=T1.fitemid--物料表

  3. inner join [K3].[dbo].t_SubMessage T66 ON T66.FInterID=T.FHeadSelfS0156--购货单位调用国家

  4. left join [K3].[dbo].t_ExchangeRateEntry t11 on t11.FCyTo=T.FCurrencyID and t.FExchangeRateType=1 and CONVERT(varchar(6),t11.FBegDate,112)=CONVERT(varchar(6),GETDATE(),112)

  5. left join [K3].[dbo].t_ExchangeRateEntry t12 on t12.FCyTo=1000 and t12.FExchangeRateType=1 and CONVERT(varchar(6),t12.FBegDate,112)=CONVERT(varchar(6),GETDATE(),112)

  6. where t.fcancellation=0 and t.fchangemark=0 and fheadselfs0150<>51249

  7. --以上语句为部分出库数据中未出库部分

  8.  
  9. union all

  10.  
  11. select

  12. t.forderbillno 订单号,--订单号

  13. t10.FHeadSelfS0155 客户订单号,--客户订单号

  14. --t5.fname 大区,--销售区域

  15. t66.fname 国家,--国家

  16. t2.fname 客户名称,--客户名称

  17. t4.fname 业务员,--业务员

  18. case when t10.fcurrencyid=1 then 'CNY' when t10.fcurrencyid=1000 then 'USD' when t10.fcurrencyid=1001 then 'EUR' else '' end 币种,--币别

  19. case when t7.FG13l181129246 is null then t1.fdate else t7.FG13l181129246 end 到款日期,--到款日期

  20. t.fqty*t9.ftaxprice 到款金额原币,--到款金额

  21. null 未到款金额原币,--未到款金额

  22. t10.fdate 下单日期,--下单日期

  23. T9.FDate 需求日期,--需求日期

  24. t1.fdate 发货日期,--发货日期

  25. --t8.fmodel 产品型号,--产品型号

  26. t.fqty 下单数量,--下单台数,有出库时,取出库数,没有出库时,取订单数

  27. t9.ftaxprice 销售单价,--销售单价原币

  28. t.fqty*t9.ftaxprice 行业务金额原币,--行业务金额原币

  29. case when t10.fcurrencyid=1 then t.fqty*t9.ftaxprice/1.17 else t.fqty*t9.ftaxprice end 行业务不含税原币,--行业务金额原币不含税

  30. case when t10.fcurrencyid=1 then t.fqty*t9.ftaxprice/1.17 else t.fqty*t9.ftaxprice*t11.FExchangeRate end 行业务不含税CNY,--行业务不含税CNY,

  31. case when t10.fcurrencyid=1 then t.fqty*t9.ftaxprice/1.17/t12.FExchangeRate else t.fqty*t9.ftaxprice*t11.FExchangeRate/t12.FExchangeRate end 行业务不含税USD,--行业务不含税USD,

  32. case when t10.fcurrencyid=1 then t.fqty*t9.ftaxprice/1.17 else t.fqty*t9.ftaxprice end 已做销售不含税原币,--已做销售不含税原币

  33. case when t10.fcurrencyid=1 then t.fqty*t9.ftaxprice/1.17 else t.fqty*t9.ftaxprice*t11.FExchangeRate end 已做销售CNY,--已做销售CNY,

  34. case when t10.fcurrencyid=1 then t.fqty*t9.ftaxprice/1.17/t12.FExchangeRate else t.fqty*t9.ftaxprice*t11.FExchangeRate/t12.FExchangeRate end 已做销售USD,--已做销售USD,

  35. t.fqty 发货数量,--发货台数

  36. t8.fnumber 物料编码,--物料编码

  37. t8.fname 物料名称--物料名称

  38. from [K3].[dbo].icstockbillentry t--销售出库明细

  39. inner join [K3].[dbo].icstockbill T1 ON T1.FinterID=t.finterid --销售出库

  40. inner join [K3].[dbo].t_organization T2 ON T2.FitemID=T1.fsupplyid --购货单位

  41. inner join [K3].[dbo].t_department T3 ON T3.FitemID=T1.fdeptid and T3.FitemID=140 --销售部门

  42. inner join [K3].[dbo].t_Base_Emp T4 ON T4.FitemID=T1.fempid--业务员

  43. inner join [K3].[dbo].t_SubMessage T5 ON T5.FinterID=T2.fregionid--购货单位调用销售区域

  44. inner join [K3].[dbo].t_SubMessage T6 ON T6.FInterID=T2.ftypeid--购货单位调用客户类型

  45. left join [IMS].[Portal].[dbo].T13T181861x2257 t7 on t7.id=(select top 1 id from [IMS].[Portal].[dbo].T13T181861x2257 as qq where qq.Fs122318127T46=t.forderbillno)--财务到款系统

  46. inner join [K3].[dbo].t_icitem T8 ON T8.FitemID=T.fitemid--物料表

  47. inner join [K3].[dbo].seorderentry T9 ON T.ForderinterID=T9.finterid and t.forderentryid=t9.fentryid and t9.fauxprice>0--销售出库表体

  48. inner join [K3].[dbo].seorder T10 ON T10.FinterID=T.forderinterid and t10.fdate>'2012-12-31' and t10.fcancellation=0 and t10.fchangemark=0 --销售出库表头

  49. inner join [K3].[dbo].t_SubMessage T66 ON T66.FInterID=T10.FHeadSelfS0156--购货单位调用国家

  50. left join [K3].[dbo].t_ExchangeRateEntry t11 on t11.FCyTo=T10.FCurrencyID and t11.FExchangeRateType=1 and CONVERT(varchar(6),t11.FBegDate,112)=CONVERT(varchar(6),t1.fdate,112)

  51. left join [K3].[dbo].t_ExchangeRateEntry t12 on t12.FCyTo=1000 and t12.FExchangeRateType=1 and CONVERT(varchar(6),t12.FBegDate,112)=CONVERT(varchar(6),t1.fdate,112)

  52. where t.FSEOutinterid>0 and CONVERT(varchar(6),t1.FDate,112)=CONVERT(varchar(6),GETDATE(),112) and t1.fcheckdate is not null

  53. --以上语句为全部出货订单数据,含退库数据,销售出库未审核不计入


Excel调用如上视图即可。不再赘述!可以在Excel里边对明细数据进行汇总等操作。 

  •  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值