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

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

2022-06-13   來源: Delphi編程 

  //查詢數據並顯示

  procedure TDocuInputBitBtnClick(Sender: TObject);

  begin

  adoqueryClose;

  adoquerySQLClear;

  adoquerySQLAdd(select * from 憑證表 where (憑證編號 like %+editText+%)and);

  adoquerySQLAdd((會計期間 like %+editText+%)and(日期 like %+editText+%));

  adoqueryOpen;

  end;

  //為憑證錄入分錄表

  procedure TDocuInputBitBtnClick(Sender: TObject);

  begin

  datasourceDataSetDelete;

  end;

  //統計分錄表中的各項信息以儲存到數據庫

  procedure TDocuInputSumAccount;

  var

  sumoutputsuminput:double;

  i:integer;

  begin

  suminput:=;

  sumoutput:=;

  //統計借貸雙方的數額

  for i:= to do

  if (stringgridCells[i]<>)and(stringgridCells[i]<>) then

  begin

  suminput:=suminput+strtofloat(stringgridCells[i]);

  sumoutput:=sumoutput+strtofloat(stringgridCells[i]);

  end;

  dbeditText:=floattostr(suminput);

  dbeditText:=floattostr(sumoutput);

  end;

  procedure TDocuInputDBEditExit(Sender: TObject);

  begin

  SumAccount;

  end;

  //設置分錄表表頭

  procedure TDocuInputFormShow(Sender: TObject);

  begin

  stringgridCells[]:=科目編碼;

  stringgridCells[]:=科目名稱(雙擊選擇);

  stringgridCells[]:=借方;

  stringgridCells[]:=貸方;

  stringgridCells[]:=摘要;

  end;

  //當在分錄表中輸入時不允許在上面有空行的情況下輸入一行新的數據

  procedure TDocuInputStringGridSelectCell(Sender: TObject; ACol

  ARow: Integer; var CanSelect: Boolean);

  begin

  //防止在輸入數據時上面有空行

  if stringgridCells[Arow]= then

  begin

  showmessage(請先完成上行中空的項目);

  exit;

  end;

  //保存選取的單元行列值

  curRow:=ARow;

  curCol:=ACol;

  if (curCol<=)and(curCol>=) then

  stringgridOptions:=stringgridOptions+[goEditing];

  //防止選中標題欄

  if ARow= then curRow:=ARow+;

  //統計借貸雙方信息

  sumAccount();

  end;

[]  []  []  


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