You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/word/新协航_设计文档/数据库建表文档/20131223/在应收应付界面显示毛利.sql

37 lines
1.1 KiB
MySQL

3 years ago
/****** Object: StoredProcedure [dbo].[sSysGetBillNo] Script Date: 01/05/2014 20:45:13 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sMsGetML]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sSysGetBillNo]
GO
/****** Object: StoredProcedure [dbo].[sSysGetBillNo] Script Date: 01/05/2014 20:45:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
Create PROCEDURE [dbo].[sMsGetML]
(
@contractno varchar(50)=''
)
--WITH ENCRYPTION
AS
Begin
select max(RMBYS) RMBYS,max(RMBYF) RMBYF,max(RMBYS)-max(RMBYF) RMBML,
max(USDYS) USDYS,max(USDYF) USDYF,max(USDYS) -max(USDYF) USDML
from(select sum(amount) RMBYS,0 RMBYF,0 USDYS,0 USDYF
from ch_fee where feetype=1 and bsno=@contractno and currency='RMB'
union all
select 0,sum(amount) ,0,0 from ch_fee where feetype=2 and bsno=@contractno and currency='RMB'
union all
select 0,0,sum(amount) ,0 from ch_fee where feetype=1 and bsno=@contractno and currency='USD'
union all
select 0,0,0,sum(amount) from ch_fee where feetype=2 and bsno=@contractno and currency='USD'
)t1
End
GO