




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
-产品日报表-exec Get_Product_Day ,0,2010-10-01,0alter proc Get_Product_DayNodeKey nvarchar(100),ID int,FDate varchar(10),FStoreID int=0asset nocount ondeclare Count int declare FSQEDate datetime -上期结存时间declare strSql varchar(8000)if exists (select * from dbo.sysobjects where id = object_id(Ndbo.Temp_Product_Day) and OBJECTPROPERTY(id, NIsUserTable) = 1)drop table dbo.Temp_Product_DayCREATE TABLE dbo.Temp_Product_Day (FID int IDENTITY (1, 1) NOT NULL ,FProductID int NULL ,FDayInNumber float default (0) NULL ,FDayInPiece float default (0) NULL ,FDayInMoney float default (0) NULL ,FMonthInNumber float default (0) NULL ,FMonthInPiece float default (0) NULL ,FMonthInMoney float default (0) NULL ,FDayOutNumber float default (0) NULL ,FDayOutPiece float default (0) NULL ,FDayOutMoney float default (0) NULL ,FMonthOutNumber float default (0) NULL ,FMonthOutPiece float default (0) NULL ,FMonthOutMoney float default (0) NULL ,FNowNumber float default (0) NULL ,FNowPiece float default (0) NULL ,FNowMoney float default (0) NULL ) ON PRIMARY-1、得到成品IDif (NodeKey= and ID0)insert into Temp_Product_Day(FProductID) values (ID)elseinsert into Temp_Product_Day(FProductID) select i.FID from Base_CProduct i left outer join t_Item on i.FParentID=t_Item.FID where t_Item.FItemClassID=35 and t_Item.FNodeKey like NodeKey + %-2.1、组合期初数,直接计算到这天位置的库存数-set FSQEDate=(select max(FEDate) from FMonth_Product where FEDateconvert(datetime,FDate)-if (FSQEDate is null) set FSQEDate=2011-12-18if (FSQEDate 2011-12-18 And a.FDate 2011-12-18 And a.FDate+ FSQEDate + And a.FDate+ FSQEDate + And a.FDate=+ FDate + set strSql=strSql + Case when FStoreID=0 then else And A.FStorageID= +rtrim(cast(FStoreID as char(8) endset strSql=strSql + and b.FCmbProductID in (select FProductID from Temp_Product_Day)set strSql=strSql + group by b.FCmbProductID) FProdset strSql=strSql + join Temp_Product_Day Temp_Product_Day on Temp_Product_Day.FProductID=FProd.FCmbProductID exec (strSql)end-3.1、得到当天入库set strSql=update Temp_Product_Day set FDayInNumber=isnull(FProd.FNumber,0),set strSql=strSql + FDayInPiece=isnull(FProd.FPiece,0),set strSql=strSql + FDayInMoney=isnull(FProd.FMoney,0) set strSql=strSql + from (select b.FCmbProductID,sum(b.FNumber*isnull(A.FType,1) as FNumber,sum(b.FPiece*isnull(A.FType,1) as FPiece,sum(b.FMoney*isnull(A.FType,1) as FMoneyset strSql=strSql + from ST_Bill_Prod_Input_Base a join ST_Bill_Prod_Input_Detail b on a.FBillID=b.FBillIDset strSql=strSql + where a.FState not in (1,3) and a.FDate=+ FDate + set strSql=strSql + Case when FStoreID=0 then else And A.FStorageID= +rtrim(cast(FStoreID as char(8) endset strSql=strSql + and b.FCmbProductID in (select FProductID from Temp_Product_Day)set strSql=strSql + group by b.FCmbProductID) FProdset strSql=strSql + join Temp_Product_Day Temp_Product_Day on Temp_Product_Day.FProductID=FProd.FCmbProductID exec (strSql)print strsql-3.2、得到当月入库数据set strSql=update Temp_Product_Day set FMonthInNumber=isnull(FProd.FNumber,0),set strSql=strSql + FMonthInPiece=isnull(FProd.FPiece,0),set strSql=strSql + FMonthInMoney=isnull(FProd.FMoney,0) set strSql=strSql + from (select b.FCmbProductID,sum(b.FNumber*isnull(A.FType,1) as FNumber,sum(b.FPiece*isnull(A.FType,1) as FPiece,sum(b.FMoney*isnull(A.FType,1) as FMoneyset strSql=strSql + from ST_Bill_Prod_Input_Base a join ST_Bill_Prod_Input_Detail b on a.FBillID=b.FBillIDset strSql=strSql + where a.FState not in (1,3) and a.FDate=+ FDate + and year(a.FDate)= +rtrim(cast(year(FDate) as char(8) + and month(a.FDate)= + rtrim(cast(month(FDate) as char(8)set strSql=strSql + Case when FStoreID=0 then else And A.FStorageID= +rtrim(cast(FStoreID as char(8) endset strSql=strSql + and b.FCmbProductID in (select FProductID from Temp_Product_Day)set strSql=strSql + group by b.FCmbProductID) FProdset strSql=strSql + join Temp_Product_Day Temp_Product_Day on Temp_Product_Day.FProductID=FProd.FCmbProductID exec (strSql)print strsql-3.3、得到当天出库set strSql=update Temp_Product_Day set FDayOutNumber=isnull(FProd.FNumber,0),set strSql=strSql + FDayOutPiece=isnull(FProd.FPiece,0),set strSql=strSql + FDayOutMoney=isnull(FProd.FMoney,0) set strSql=strSql + from (select b.FCmbProductID,sum(b.FSendGoodsWeight*isnull(A.FType,1) as FNumber,sum(b.FSendGoodsPiece*isnull(A.FType,1) as FPiece,sum(b.FSendGoodsMny*isnull(A.FType,1) as FMoneyset strSql=strSql + from ST_Bill_Prod_Output_Base a join ST_Bill_Prod_Output_Detail b on a.FBillID=b.FBillIDset strSql=strSql + where a.FState not in (1,3) and a.FDate=+ FDate + set strSql=strSql + Case when FStoreID=0 then else And A.FStorageID= +rtrim(cast(FStoreID as char(8) endset strSql=strSql + and b.FCmbProductID in (select FProductID from Temp_Product_Day)set strSql=strSql + group by b.FCmbProductID) FProdset strSql=strSql + join Temp_Product_Day Temp_Product_Day on Temp_Product_Day.FProductID=FProd.FCmbProductID exec (strSql)-3.4、得到当月出库set strSql=update Temp_Product_Day set FMonthOutNumber=isnull(FProd.FNumber,0),set strSql=strSql + FMonthOutPiece=isnull(FProd.FPiece,0),set strSql=strSql + FMonthOutMoney=isnull(FProd.FMoney,0) set strSql=strSql + from (select b.FCmbProductID,sum(b.FSendGoodsWeight*isnull(A.FType,1) as FNumber,sum(b.FSendGoodsPiece*isnull(A.FType,1) as FPiece,sum(b.FSendGoodsMny*isnull(A.FType,1) as FMoneyset strSql=strSql + from ST_Bill_Prod_Output_Base a join ST_Bill_Prod_Output_Detail b on a.FBillID=b.FBillIDset strSql=strSql + where a.FState not in (1,3) and a.FDate=+ FDate + and year(a.FDate)= + rtrim(cast(year(FDate) as char(8) + and month(a.FDate)= + rtrim(cast(month(FDate) as char(8)set strSql=strSql + Case when FStoreID=0 then else And A.FStorageID= +rtrim(cast(FStoreID as char(8) endset strSql=strSql + and b.FCmbProductID in (select FProductID from Temp_Product_Day)set strSql=strSql + group by b.FCmbProductID) FProdset strSql=strSql + join Temp_Product_Day Temp_Product_Day on Temp_Product_Day.FProductID=FProd.FCmbProductID exec (strSql)select a.FProductID,b.FCode as FProductCode,b.FName as FProductName,c.FType as FType,d.FName as FGradeName,e.FN
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 广东工程数学自考试题及答案
- 控制测量考试题及答案
- 2025年中国平烫机数据监测研究报告
- 四川省广元市川师大万达中学2025-2026学年高二上学期第一次月考(8月)英语试题(原卷版)
- 康复考试题型及答案
- 木材保护与改性处理工综合考核试卷及答案
- 钻车司机三级安全教育(车间级)考核试卷及答案
- 钒铁熔化还原工工艺创新考核试卷及答案
- 餐厨垃圾处理工职业技能考核试卷及答案
- 课件文本框汉字输入问题
- T-CNAS 10-2020 成人有创机械通气气道内吸引技术操作
- 《危险货物港口作业重大事故隐患判定标准》知识培训
- 农村废弃物综合利用资源化利用方式与路径
- 脑卒中的识别及预防与处理
- 和田玉知识培训课件下载
- 交互式游戏设计趋势-深度研究
- 2025年中国海洋功能性食品行业全景评估及投资规划建议报告
- 2025-2030年中国铷行业市场规模分析及投资前景研究报告
- 餐饮行业培训合作协议书
- 沪价费(2006)27号-关于调整本市部分绿化行政事业性收费标准的通知
- 水稻机械化种植技术-洞察分析
评论
0/150
提交评论