?? update20040515.sql
字號:
Set Term ^;
/*月結(jié)帳過程修改===================================================================
上期余額及收款日期等應(yīng)重置
2004-05-16
*/
Alter PROCEDURE P_NEWMONTH AS
/*轉(zhuǎn)存上月的抄表數(shù)據(jù),并設(shè)置新月份開始*/
Declare variable v_Year Integer;
Declare variable v_Month Integer;
Declare variable v_Date Date;
Begin
/*轉(zhuǎn)存上月抄表數(shù)據(jù)*/
/*記錄未發(fā)生的用戶到指定表*/
Delete From Tb_ZeroFee;
Insert Into Tb_ZeroFee (f_House_No, f_House_Name)
Select f_House_No, f_House_Name
From tb_House;
/*取得當(dāng)前日期所對應(yīng)抄數(shù)據(jù)數(shù)據(jù)日期*/
Execute Procedure P_GetCurrent '' Returning_Values :v_Year, :v_Month;
v_Date = v_Month || '-01-' || v_Year;
/*存儲本月已抄表的行(本月抄表數(shù)不為空)*/
Insert into tb_ammeter_detail
(f_date, f_house_no, f_ammeter_Order, f_ammeter_count, f_adjust_count, f_note)
select :v_Date, h.f_house_no, a.f_ammeter_Order, a.f_this_count, h.f_adjust_count, h.f_note
from tb_ammeter a, tb_house h
where a.f_house_no = h.f_house_no and a.f_this_count is not null;
/*更新最大用電量及最小用電量*/
Update tb_Ammeter Set f_MaxCount = f_Count Where f_MaxCount < f_Count;
Update tb_Ammeter Set f_MinCount = f_Count Where f_MinCount > f_Count;
/*生成上次抄表數(shù)據(jù)*/
Update tb_ammeter
set f_Ammeter_Last_Count = f_This_Count
Where f_This_Count is Not NULL;
/*清除本次抄表數(shù)據(jù),所有本次抄表置為未抄-NULL, 減分表數(shù)為0, 調(diào)整數(shù)為0*/
Update tb_ammeter
set f_This_Count = NULL, f_Count = 0
Where f_This_Count is Not NULL;
Update Tb_House
Set f_Sum_Count = 0,
f_Son_Count = 0,
F_Adjust_Count = 0,
f_Note = Null,
F_Count = 0, F_Amount = 0,
F_Count1 = 0, F_Amount1 = 0,
F_Count2 = 0, F_Amount2 = 0,
F_Count3 = 0, F_Amount3 = 0,
F_Arrearage = 0,F_LateFee = 0,f_2Year = '',
F_Receiver = "" , /*收費(fèi)員*/
F_Charge_Date = NULL, /*收費(fèi)日期*/
F_Last_Balance = F_Balance, /*上期余額*/
F_Gathering = 0,/*收款*/
F_Give_Change = 0,/*找零*/
F_Actual_Receive = 0, /*實(shí)收*/
F_Balance = 0;/*本期余額*/
Delete From Tb_Fee;
/*刪除10KV收費(fèi)記錄*/
Delete From Tb_10KV_Gathering;
End
^
Set Term ;^
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -