熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Delphi編程 >> 正文

經典案例 財務管理系統(7)[2]

2022-06-13   來源: Delphi編程 
    ——此文章摘自《Delphi 數據庫開發經典案例解析》定價 特價 購買>>

  para:Ttable;

  function FindForm(caption:string):bool;

  procedure setpara();

  end;

  var

  main: Tmain;

  para:Ttable;

  implementation

  {$R *dfm}

  uses SecSettingFormAccountSettingFormDocuInputFormTotalAccountForm

DetailAccountFormSumAccountFormFinalReportForm;

  //通過用戶定義的函數判斷窗體是否存在

  function TmainFindForm(caption: string): bool;

  var

  i:integer;

  begin

  for i:= to mainMDIChildCount do

  begin

  // 通過對窗體標題判斷窗體是否存在

  if mainMDIChildren[i]Caption=caption then

  begin

  //如果窗體已存在則恢復窗體並返回true

  SendMessage(mdichildren[i]Handle WM_SYSCOMMAND SC_restore );

  mdichildren[i]Enabled:=true;

  mdichildren[i]Show;

  mdichildren[i]SetFocus;

  result:=true;

  break;

  end

  else

  //如窗體不存在則返回false程序將創建窗體

  result:=false;

  end

  end;

  //該函數的作用是保存系統參數表中的參數並在調用前更新

  procedure Tmainsetpara;

  var

  i:integer;

  begin

  adoqueryActive:=false;

  adoqueryActive:=true;

  i:=;

  while not adoqueryEof do

  begin

  //保存系統參數

  para[i]:=adoqueryFieldByName(取值)AsString;

  i:=i+;

  adoqueryNext;

  end;

  end;

  //顯示會計科目設置窗體

  procedure TmainNClick(Sender: TObject);

  var

  newform:TSecSetting;

  begin

  if findForm(會計科目設置)=false then

  begin

  //若窗體不存在則創建窗體

  newform:=TsecsettingCreate(application);

  newformCaption:=會計科目設置;

  end;

  end;

  //顯示帳戶設置窗體

  procedure TmainNClick(Sender: TObject);

  var

  newform:TaccountSetting;

  begin

  if findForm(帳戶設置(期初數據錄入))=false then

  begin

  //若窗體不存在則創建窗體

  newform:=TaccountSettingCreate(application);

  newformCaption:=帳戶設置(期初數據錄入);

  end;

  end;

  //顯示憑證設置窗體

  procedure TmainNClick(Sender: TObject);

  var

  newform:TDocuInput;

  begin

  if findForm(會計憑證輸入)=false then

  begin

  //若窗體不存在則創建窗體

  newform:=TdocuinputCreate(application);

  newformCaption:=會計憑證輸入;

  end;

  end;

  //顯示總分類帳查詢窗體

  procedure TmainNClick(Sender: TObject);

  var

  newform:Ttotalaccount;

  begin

  if findForm(總分類帳查詢)=false then

  begin

  //若窗體不存在則創建窗體

  newform:=TtotalaccountCreate(application);

  newformCaption:=總分類帳查詢;

  end;

  end;

  //顯示明細帳查詢窗體

  procedure TmainNClick(Sender: TObject);

  var

  newform:Tdetailaccount;

  begin

  if findForm(明細帳查詢)=false then

  begin

  //若窗體不存在則創建窗體

  newform:=TdetailaccountCreate(application);

  newformCaption:=明細帳查詢;

  end;

  end;

[]  []  []  []  


From:http://tw.wingwit.com/Article/program/Delphi/201311/25046.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.