if exists (select name from sysobjects where name='采购入库_打印_PROC' and type='P')
drop PROC 采购入库_打印_PROC
go
create PROC 采购入库_打印_PROC
@po_to int,
@po_fr int
as
CREATE TABLE [#采购入库单明细表]
(
[采购单号] [int] ,
[行] [int],
[入库日期] [datetime] ,
[供应商编码] [varchar] (10) ,
[物料编码] [varchar] (30) ,
[货币编码] [varchar] (10) ,
[计量单位] [varchar] (10) ,
[借项退货] CHAR(1),
[状态] [varchar] (10) ,
[入库数量] [numeric](18, 6) DEFAULT (0.000000),
[拒收数量] [numeric](18, 6) DEFAULT (0.000000),
[仓库] [varchar] (10) ,
[货位] [varchar] (10) ,
[批号] [varchar] (15) ,
[拒收原因] [varchar] (10))
INSERT INTO #采购入库单明细表(采购单号,行,入库日期,供应商编码,物料编码,借项退货,
货币编码,计量单位,状态,入库数量,拒收数量,仓库,货位,批号,拒收原因)
select 采购单号,行,入库日期,供应商编码,物料编码,借项退货,
货币编码,计量单位,状态,入库数量,拒收数量,仓库,货位,批号,拒收原因
from 采购入库单明细表 WHERE 采购单号>=@po_to and 采购单号
SELECT *FROM #采购入库单明细表
-- EXEC 采购入库_打印_PROC 1,1