-- ==============================
-- 长登科技 www.ppfor.com
-- 唐镇波   2010-04-20
-- ------------------------------
-- 支付方式类型表
-- ==============================

--创建支付方式类型表
if not exists (select * from sysobjects where name='PPFOR_TZB_PaymentType')
begin
	CREATE TABLE [PPFOR_TZB_PaymentType] (
		[ID] int IDENTITY (1, 1) NOT NULL PRIMARY KEY,
		[Name] varchar (50) COLLATE Chinese_PRC_CI_AS NOT NULL unique,
		[Type] varchar (20) COLLATE Chinese_PRC_CI_AS NOT NULL unique,
		[Order] int not null default(0),	
		[MoneyCodes] text not null,
		[BankCodes] text null,
		[Description] text null	
	)	
end 
PPFOR_GO;

---查询所有支付方式类型
if exists(select name from sysobjects where name='PPFOR_TZB_PaymentType_GetModelList' and type='P')
	drop procedure PPFOR_TZB_PaymentType_GetModelList
PPFOR_GO;

CREATE  PROCEDURE PPFOR_TZB_PaymentType_GetModelList
 AS 
	SELECT [ID],[Name],[Type] FROM [PPFOR_TZB_PaymentType] order by [Order] asc,[ID] asc
PPFOR_GO;

---获取支付方式类型
if exists(select name from sysobjects where name='PPFOR_TZB_PaymentType_GetModel' and type='P')
	drop procedure PPFOR_TZB_PaymentType_GetModel
PPFOR_GO;

CREATE  PROCEDURE PPFOR_TZB_PaymentType_GetModel(@ID int)
 AS 
	SELECT * FROM [PPFOR_TZB_PaymentType] WHERE [ID]=@ID 
PPFOR_GO;

---获取支付方式类型
if exists(select name from sysobjects where name='PPFOR_TZB_PaymentType_GetModelByType' and type='P')
	drop procedure PPFOR_TZB_PaymentType_GetModelByType
PPFOR_GO;

CREATE  PROCEDURE PPFOR_TZB_PaymentType_GetModelByType(@Type varchar (20))
 AS 
	SELECT * FROM [PPFOR_TZB_PaymentType] WHERE [Type]=@Type 
PPFOR_GO;
