?? unit_serverlog.pas
字號:
unit Unit_Serverlog;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, TFlatRadioButtonUnit, StdCtrls, TFlatComboBoxUnit,
TFlatCheckBoxUnit, TFlatEditUnit, Mask, TFlatMaskEditUnit,
TFlatSpinEditUnit, TFlatMemoUnit, TFlatButtonUnit, Db, DBTables,
TFlatGroupBoxUnit, Grids, DBGrids, ExtCtrls, ImgList;
type
TFrm_ServerLog = class(TForm)
PageControlServerLog: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
FlatButtonAdd1: TFlatButton;
FlatButtonSave1: TFlatButton;
FlatButtonCancel1: TFlatButton;
FlatButtonClose1: TFlatButton;
FlatComboBoxServTypeT: TFlatComboBox;
FlatComboBoxServModeT: TFlatComboBox;
QueryInitValues: TQuery;
QueryTemp: TQuery;
ImageList1: TImageList;
QueryTmp2: TQuery;
QueryServeLog2: TQuery;
DataSourceServeLog2: TDataSource;
QueryServModi: TQuery;
FlatComboBoxServQualityT: TFlatComboBox;
FlatButtonUpdate2: TFlatButton;
FlatButtonSave2: TFlatButton;
FlatButtonCancel2: TFlatButton;
FlatButtonClose2: TFlatButton;
Panel1: TPanel;
FlatRadioButtonCust1: TFlatRadioButton;
FlatRadioButtonGroup1: TFlatRadioButton;
FlatCheckBoxVIP1: TFlatCheckBox;
Label2: TLabel;
FlatComboBoxServType1: TFlatComboBox;
Label1: TLabel;
FlatComboBoxServMode1: TFlatComboBox;
FlatComboBoxServQuality1: TFlatComboBox;
Label5: TLabel;
FlatEditObjectName1: TFlatEdit;
LabelObjectName1: TLabel;
FlatEditObject1Value: TFlatEdit;
LabelObject1: TLabel;
Label6: TLabel;
FlatComboBoxServKind: TFlatComboBox;
Label7: TLabel;
FlatMaskEditBeginDate1: TFlatMaskEdit;
FlatMaskEditBeginTime1: TFlatMaskEdit;
FlatMaskEditEndDate1: TFlatMaskEdit;
Label8: TLabel;
FlatMaskEditEndTime1: TFlatMaskEdit;
FlatCheckBoxFinish1: TFlatCheckBox;
Label10: TLabel;
FlatEditServMoney1: TFlatEdit;
Label9: TLabel;
Label11: TLabel;
FlatEditUseMoney1: TFlatEdit;
Label16: TLabel;
Label12: TLabel;
FlatSpinEditFloatTotalMoney1: TFlatSpinEditFloat;
Label17: TLabel;
Label13: TLabel;
FlatMemoServCont2: TFlatMemo;
Label14: TLabel;
FlatMemoObjInfo: TFlatMemo;
Label15: TLabel;
FlatMemoObjAdvice: TFlatMemo;
Panel2: TPanel;
Label3: TLabel;
FlatComboBoxObj2Q: TFlatComboBox;
FlatCheckBoxVIP1Q: TFlatCheckBox;
Label4: TLabel;
FlatMaskEditBeginDate2Q: TFlatMaskEdit;
Label29: TLabel;
FlatMaskEditEndDate2Q: TFlatMaskEdit;
Label18: TLabel;
FlatComboBoxServKind2Q: TFlatComboBox;
FlatCheckBoxFinish2Q: TFlatCheckBox;
FlatButton9: TFlatButton;
DBGrid1: TDBGrid;
TreeView1: TTreeView;
FlatCheckBoxVIP2: TFlatCheckBox;
FlatCheckBoxFinish2: TFlatCheckBox;
Label30: TLabel;
FlatComboBoxServType2: TFlatComboBox;
Label31: TLabel;
FlatComboBoxServMode2: TFlatComboBox;
Label35: TLabel;
FlatComboBoxServKind2: TFlatComboBox;
Label23: TLabel;
FlatMaskEditBeginDate2: TFlatMaskEdit;
FlatMaskEditBeginTime2: TFlatMaskEdit;
Label24: TLabel;
FlatMaskEditEndDate2: TFlatMaskEdit;
FlatMaskEditEndTime2: TFlatMaskEdit;
Label32: TLabel;
FlatEditObject2Value: TFlatEdit;
Label33: TLabel;
FlatEditObjectName2: TFlatEdit;
Label34: TLabel;
FlatComboBoxServQuality2: TFlatComboBox;
Label19: TLabel;
FlatEditServMoney2: TFlatEdit;
Label21: TLabel;
FlatEditUseMoney2: TFlatEdit;
Label20: TLabel;
Label22: TLabel;
Label25: TLabel;
FlatSpinEditFloat1: TFlatSpinEditFloat;
Label36: TLabel;
Label26: TLabel;
LabelServiceCode2: TLabel;
FlatMemo1: TFlatMemo;
Label27: TLabel;
FlatMemoObjInfo2: TFlatMemo;
Label28: TLabel;
FlatMemoObjAdvice2: TFlatMemo;
Panel3: TPanel;
Panel4: TPanel;
Label40: TLabel;
FlatMaskEditModiBgnDate: TFlatMaskEdit;
Label41: TLabel;
FlatMaskEditModiEndDate: TFlatMaskEdit;
FlatButton2: TFlatButton;
DBGrid3: TDBGrid;
Label42: TLabel;
MemoModiContent: TMemo;
DataSourceServModi: TDataSource;
Label37: TLabel;
FlatEditServObj: TFlatEdit;
Label38: TLabel;
FlatComboBoxCity: TFlatComboBox;
Label55: TLabel;
FlatComboBoxCounty: TFlatComboBox;
Label92: TLabel;
FlatComboBox_ManagerNo: TFlatComboBox;
Label39: TLabel;
QueryGroupInfoT: TQuery;
procedure FlatButtonClose1Click(Sender: TObject);
procedure FlatRadioButtonCust1Click(Sender: TObject);
procedure FlatRadioButtonGroup1Click(Sender: TObject);
procedure FlatEditObject1ValueKeyPress(Sender: TObject; var Key: Char);
procedure FlatEditServMoney1KeyPress(Sender: TObject; var Key: Char);
procedure FlatEditUseMoney1KeyPress(Sender: TObject; var Key: Char);
procedure FlatEditServMoney1Change(Sender: TObject);
procedure FlatEditUseMoney1Change(Sender: TObject);
procedure FlatButtonAdd1Click(Sender: TObject);
procedure FlatButtonSave1Click(Sender: TObject);
procedure FlatButtonClose2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TabSheet2Show(Sender: TObject);
procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
procedure DataSourceServeLog2DataChange(Sender: TObject;
Field: TField);
procedure FlatButtonCancel1Click(Sender: TObject);
procedure FlatButton9Click(Sender: TObject);
procedure FlatButtonSave2Click(Sender: TObject);
procedure FlatEditServMoney2Change(Sender: TObject);
procedure FlatEditUseMoney2Change(Sender: TObject);
procedure TabSheet3Show(Sender: TObject);
procedure DataSourceServModiDataChange(Sender: TObject; Field: TField);
procedure FlatButton1Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FlatButtonUpdate2Click(Sender: TObject);
procedure FlatButtonCancel2Click(Sender: TObject);
procedure TabSheet1Show(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FlatCheckBoxVIP1Click(Sender: TObject);
procedure FlatCheckBoxFinish1Click(Sender: TObject);
procedure FlatCheckBoxFinish2Click(Sender: TObject);
procedure PageControlServerLogChanging(Sender: TObject;
var AllowChange: Boolean);
procedure FlatComboBoxCityChange(Sender: TObject);
private
{ Private declarations }
sEditFlag:String;
//清空登記編輯框
procedure PL_ClearText1;
//清空修改編輯框
procedure PL_ClearText2;
//控制編輯狀態(tài)
procedure PL_ControlEnabled(pfFlag:Boolean);
//執(zhí)行新增、刪除、修改SQL語句
procedure PL_ExecSQL(psSQL:String);
//增加關(guān)系室
procedure PL_AddRoom(psCityNo:String;piOff_No_Home:Integer);
//取關(guān)系室的編號
function PL_GetRoomID(psRoomName,psCityNo:String;piOff_No_Home:Integer):Integer;
//增加關(guān)系室的成員
procedure PL_AddRoomRY(TNode:TTreeNode;psCityNo:String;piCountyNo,piRoomID:Integer);
//填充編輯框
procedure PL_FillServiceLog;
public
{ Public declarations }
end;
var
Frm_ServerLog: TFrm_ServerLog;
implementation
// 主單元, 數(shù)據(jù)模板,公共單元
uses Main, dmmain, Unit_Public;
//按鈕控制
function Fun_ButtonStatus(pFormName:TForm;pStatus:Boolean=False):Boolean;stdcall;export;external'winfun.dll';
//輸框狀態(tài)控制
//function Fun_ComponentStatus(pFormName:TForm;pStatusStyle:Integer=0;pStatus:Boolean=False):Integer;stdCall;external'winfun.dll';
Function Fun_ComponentStatus(pFormName:TForm;pStatusStyle:Integer=0;pStatus:Boolean=False;pObject:TObject=Nil):Integer;stdCall;external'winfun.dll';
{$R *.DFM}
//清空登記編輯框
procedure TFrm_ServerLog.PL_ClearText1;
begin
FlatCheckBoxVIP1.Checked:=True;
FlatEditObject1Value.Clear;
FlatEditObjectName1.Clear;
// FlatCheckBoxFinish1.Checked:=True;
FlatEditServMoney1.Clear;
FlatEditUseMoney1.Clear;
FlatMemoServCont2.Clear;
FlatMemoObjInfo.Clear;
FlatMemoObjAdvice.Clear;
end;
//清空修改編輯框
procedure TFrm_ServerLog.PL_ClearText2;
begin
//FlatMaskEditBeginDate2.Text:=' - - ';
//FlatMaskEditBeginTime2.Text:='00:00';
//FlatMaskEditEndDate2.Text:=' - - ';
//FlatMaskEditEndTime2.Text:='00:00';
FlatEditObject2Value.Clear;
FlatEditObjectName2.Clear;
FlatEditServMoney2.Clear;
FlatEditUseMoney2.Clear;
FlatMemo1.Clear;
FlatMemoObjInfo2.Clear;
FlatMemoObjAdvice2.Clear;
end;
//控制編輯狀態(tài)
procedure TFrm_ServerLog.PL_ControlEnabled(pfFlag:Boolean);
begin
FlatCheckBoxVIP2.Enabled:=pfFlag;
FlatCheckBoxFinish2.Enabled:=pfFlag;
FlatComboBoxServType2.Enabled:=pfFlag;
FlatComboBoxServMode2.Enabled:=pfFlag;
FlatComboBoxServKind2.Enabled:=pfFlag;
FlatMaskEditBeginDate2.Enabled:=pfFlag;
FlatMaskEditBeginTime2.Enabled:=pfFlag;
//FlatMaskEditEndDate2.Enabled:=pfFlag;
//FlatMaskEditEndTime2.Enabled:=pfFlag;
FlatEditObject2Value.Enabled:=pfFlag;
FlatEditObjectName2.Enabled:=pfFlag;
FlatComboBoxServQuality2.Enabled:=pfFlag;
FlatEditServMoney2.Enabled:=pfFlag;
FlatEditUseMoney2.Enabled:=pfFlag;
FlatMemo1.Enabled:=pfFlag;
FlatMemoObjInfo2.Enabled:=pfFlag;
FlatMemoObjAdvice2.Enabled:=pfFlag;
end;
procedure TFrm_ServerLog.PL_ExecSQL(psSQL:String);
var
QueryTmp:TQuery;
begin
Application.CreateForm(TQuery,QueryTmp);
QueryTmp.DatabaseName:=DM_Main.Databasedh.DatabaseName;
if DM_Main.Databasedh.InTransaction=True then
DM_Main.Databasedh.Rollback;
DM_Main.Databasedh.StartTransaction;
try
with QueryTmp do
begin
if Active then Close;
SQL.Clear;
SQL.Add(psSQL);
ExecSQL;
end;
DM_Main.Databasedh.Commit;
except
DM_Main.Databasedh.Rollback;
Application.MessageBox('命令執(zhí)行失敗!請重試。', '提示', MB_OK+MB_ICONINFORMATION);
Exit;
end;
QueryTmp.Free;
end;
//增加關(guān)系室
procedure TFrm_ServerLog.PL_AddRoom(psCityNo:String;piOff_No_Home:Integer);
begin
with QueryTmp2 do
begin
if Active then Close;
SQL.Clear;
//權(quán)限控制?
SQL.Add('Select ROOM_NAME From T_D_Room Where CITYNO=:P_CityNo And OFF_NO_HOME=:P_CountyNo');
ParamByName('P_CityNo').AsString:=psCityNo;
ParamByName('P_CountyNo').AsInteger:=piOff_No_Home;
Open;
end;
Treeview1.Items.BeginUpdate;
while not QueryTmp2.Eof do
begin
Treeview1.items.AddChild(nil,Trim(QueryTmp2.fields[0].AsString));
QueryTmp2.Next;
end;
Treeview1.Items.EndUpdate;
end;
//增加關(guān)系室的成員
procedure TFrm_ServerLog.PL_AddRoomRY(TNode:TTreeNode;psCityNo:String;piCountyNo,piRoomID:Integer);
begin
if TNode.Count=0 then
begin
with QueryTmp2 do
begin
if Active then Close;
SQL.Clear;
SQL.Add('Select WK_NO,NAME From T_F_Manager Where CITYNO=:PS_CityNo And OFF_NO_HOME=:PS_County And RoomID='+IntToStr(piRoomID));
if JBDM=4 then
SQL.Add(' And WK_NO='''+GH+'''');
ParamByName('PS_CityNo').AsString:=psCityNo;
ParamByName('PS_County').AsInteger:=piCountyNo;
Open;
TreeView1.Items.BeginUpdate;
while not Eof do
begin
TreeView1.Items.AddChild(TNode,FieldByName('WK_NO').AsString+':'+FieldByName('NAME').AsString);
Next;
end;
TreeView1.Items.EndUpdate;
end;
end;
end;
//取得關(guān)系室的編號
function TFrm_ServerLog.PL_GetRoomID(psRoomName,psCityNo:String;piOff_No_Home:Integer):Integer;
begin
with QueryTmp2 do
begin
if Active then Close;
SQL.Clear;
SQL.Add('Select ROOMID From T_D_Room Where CITYNO=:PS_CityNo And OFF_NO_HOME=:PI_CountyNo And ROOM_NAME=:PS_Room_Name');
ParamByName('PS_CityNo').AsString:=psCityNo;
ParamByName('PI_CountyNo').AsInteger:=piOff_No_Home;
ParamByName('PS_Room_Name').AsString:=psRoomName;
Open;
Result:=FieldByName('ROOMID').AsInteger;
end;
end;
//填充編輯框
procedure TFrm_ServerLog.PL_FillServiceLog;
var
sWk_No:String;
begin
if QueryServeLog2.Eof then
begin
PL_ClearText2; //清空修改編輯框
Exit;
end;
with QueryServeLog2 do
begin
LabelServiceCode2.Caption:=FieldByName('SERVICECODE').AsString;
if FieldByName('ObjFlag').AsString='大戶' then
FlatCheckBoxVIP2.Checked:=True
else
FlatCheckBoxVIP2.Checked:=False;
//FlatComboBoxServType2.Text:=FieldByName('SERVTYPE').AsString;
FlatComboBoxServType2.ItemIndex:=FlatComboBoxServType2.Items.IndexOf(FieldByName('SERVTYPE').AsString);
//FlatComboBoxServMode2.Text:=FieldByName('SERVMODE').AsString;
FlatComboBoxServMode2.ItemIndex:=FlatComboBoxServMode2.Items.IndexOf(FieldByName('SERVMODE').AsString);
FlatEditObject2Value.Text:=FieldByName('SERVOBJ').AsString;
FlatEditObjectName2.Text:=FieldByName('OBJNAME').AsString;
//FlatComboBoxServQuality2.Text:=FieldByName('SERVQUALITY').AsString;
FlatComboBoxServQuality2.ItemIndex:=FlatComboBoxServQuality2.Items.IndexOf(FieldByName('SERVQUALITY').AsString);
//FlatComboBoxServKind2.Text:=FieldByName('SERVKIND').AsString;
if FieldByName('FINISH').AsString='完成' then
FlatCheckBoxFinish2.checked:=False
else
FlatCheckBoxFinish2.checked:=True;
if FieldByName('SERVKIND').AsString='主動服務(wù)' then
FlatComboBoxServKind2.ItemIndex:=0
else
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -