• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 福建公安高等??茖W校貧困生補助處理T-SQl代碼(含需求分析與設計)

    發表于:2007-06-07來源:作者:點擊數: 標簽:
    /* 福建公安高等??茖W校貧困生補助處理T_SQl代碼 需求分析 與設計 *貧困生補助:1、部份貧困生原已有學校給予的常規補助(稱為A型卡),但卡類別不一致(發補助時以卡類別為標準),且這些卡類中的卡中只有部分是貧困生卡。 2、現要求為A型卡的貧困生實際補助
    /* 福建公安高等??茖W校貧困生補助處理T_SQl代碼 需求分析與設計 *貧困生補助:1、部份貧困生原已有學校給予的常規補助(稱為A型卡),但卡類別不一致(發補助時以卡類別為標準),且這些卡類中的卡中只有部分是貧困生卡。 2、現要求為A型卡的貧困生實際補助額為在原有常規補助額上增加貧困補助額。 3、增加沒有常規補助的貧困生(稱為B型卡)的補助記錄(要非0類卡,否則天王老子都沒辦法,0類卡不能領補助),其實際補助額就為貧困補助額。 4、補助月報要有所體現(主要在當月計劃補助金額上)。 *前提條件:1、一張卡補助一個月只能領一次(補助以月為發放單位)。2、公安專只能提供含有姓名、部門、貧困補助額等列值的名單,可能含有同名同姓的但沒有貧困補助的學生! *方案:1、采取相關的信息在當月補助形成后發放前修正,以保證在不動卡內信息的基礎上實現常規補助和貧困補助的正常發放。 2、 新建兩個基本表:CREATE TABLE [customerid] ( [customerid] [int] NOT NULL ,--客戶號 [pk_subsidyfare] [money] NOT NULL ),--貧困補助額 CREATE TABLE [name] ( [name] [varchar] (12) COLLATE Chinese_PRC_CI_AS NOT NULL ,--姓名 [pk_subsidyfare] [money] NOT NULL ) --貧困補助額 3、提取公安專提供的貧困補助名單中的姓名、貧困補助額列值信息(Excel形式)導入到name表中去。在name表基礎上新建一個含有customerid、name、部門、pk_subsidyfare列值信息的視圖。 4、把含有customerid、name、部門、pk_subsidyfare列值的信息的視圖導出到Excel中去,作為同名同姓學生篩選排除之用。 5、把以上篩選排除的結果中的customerid、pk_subsidyfare列值的信息導入到customerid表中去! 6、執行以下的代碼(注意只能執行一次,否則實際補助額將會多出、補助月報當月計劃補助金額會超支,確記?。。? */ declare @pk_count/*作貧困生補助記錄數統計之用*/ int,@pk_sum_subsidyfare/*作補助額統計之用*/ money,@customerid/*客戶號*/ int,@pk_subsidyfare/*貧困補助額*/ money,@subsidyfare/*補助額*/ money,@k/*卡類*/ int,@month/*月份*/ datetime, @subsidyfare1/*補助額*/ money select @month= month from t_subsidymonthplan/*獲取補助當月份值*/ declare pk_cursor cursor for select customerid,pk_subsidyfare from customerid/*定義貧困生游標,從customerid表查詢獲取*/ open pk_cursor fetch next from pk_cursor into @customerid,@pk_subsidyfare while (@@fetch_status=0)/*更改、處理t_customers、t_subsidymonthplan、t_subsidypre表相關明細記錄的循環*/ begin select @k=cardtype from t_customers where customerid=@customerid select @subsidyfare=cursubsidyfare from t_customers where customerid=@customerid/*獲取貧困生當月常規補助額*/ select @subsidyfare1=subsidy from t_subsidymonthplan where customerid=@customerid set @subsidyfare=@subsidyfare+@pk_subsidyfare/*貧困生實際補助額=常規補助額+貧困補助額*/ set @subsidyfare1=@subsidyfare1+@pk_subsidyfare if not exists(select * from t_subsidymonthplan where customerid=@customerid) begin/*B型卡處理代碼段*/ update t_customers set cursubsidyfare=@subsidyfare,subsidydt=@month,subsidyout='F' where customerid=@customerid insert into t_subsidymonthplan values(@month,@customerid,@k,@subsidyfare1) insert into t_subsidypre values(@month,@customerid,@k,@subsidyfare1) end else begin/*A型卡處理代碼段*/ update t_customers set cursubsidyfare=@subsidyfare where customerid=@customerid/*更改T_customers表中貧困生記錄的cursubsidyfare字段指*/ update t_subsidymonthplan set subsidy=@subsidyfare1 where customerid=@customerid/*更改T_subsidymonthplan表中貧困生記錄的subsidy字段指*/ update t_subsidypre set subsidy=@subsidyfare1 where customerid=@customerid and month=@month/*更改T_subsidypre表中貧困生當月記錄的subsidy字段指*/ end fetch next from pk_cursor into @customerid,@pk_subsidyfare end close pk_cursor deallocate pk_cursor set @k=1/*卡類初設*/ while (@k<=15)/*處理t_subsidymonth表的相關匯總信息的循環*/ begin if exists(select * from t_subsidymonth where cardtype=@k and month=@month)/*判斷某一類卡在t_subsidymonthplan表是否有記錄*/ begin/*處理A型卡或有補助要補發的某一類卡的代碼段*/ select @pk_count=count(*),@pk_sum_subsidyfare=isnull(sum(subsidy),0) from t_subsidymonthplan where cardtype=@k update t_subsidymonth set plancount=@pk_count,plansubsidy=@pk_sum_subsidyfare where month=@month and cardtype=@k end else begin/*處理B型卡的代碼段*/ if exists(select * from t_subsidymonthplan where cardtype=@k) begin select @pk_count=count(*),@pk_sum_subsidyfare=isnull(sum(subsidy),0) from t_subsidymonthplan where cardtype=@k insert into t_subsidymonth values(@month,@k,@pk_count,@pk_sum_subsidyfare,0,0,0,0,0,0,0,0,0,0,0,getdate(),getdate(),0) end end set @k=@k+1 end

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>