首页 > Linux操作系统 > Linux操作系统 > 采购、入库、退货的状况
/*
采购单号,项目,入库号,退货号,物料编号,单位,采购量,入库量,退货量
功能:采购、入库、退货的状况
格式:sp_pur_input_return '采购单号' --后缀含糊查询
作者:Sam
建立日期:2008-09-21
完成日期:2008-09-21
*/
if exists (select name from sysobjects where name='sp_pur_input_return' and type='p')
drop procedure sp_pur_input_return
go
create procedure sp_pur_input_return
@PurNo varchar(12) --采购单号,后缀含糊查询
with encryption
as
begin
select a.pno,a.citem,a.ysno as rkNo,t.ysno as thNO,a.matNo,a.cgunit,isnull(a.cg_qty,0) as cgQty,isnull(a.ys_qty,0) as rkQty,isnull(t.ys_qty,0) as thQty from
( select pur.*,mat_ysmx_c.ys_qty,mat_ysmx_c.ysno from
(select p.pno,p.citem,p.matNo,p.cgUnit,p.cg_qty
from mat_cg_c p
where pno like @purNo+'%' ) pur
left join mat_ysmx_c on pur.pno=mat_ysmx_c.pno_tmp and pur.citem=mat_ysmx_c.citem) a
left join mat_thmx_c as t on
a.ysno=t.pno_tmp and a.citem=t.citem
Order by a.pno,a.citem
end
sp_pur_input_return 'CC08080023'
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/729024/viewspace-564857/ ,如需转载,请注明出处,否则将追究法律责任。