知识大全 经典案例 财务管理系统(15)[2]

Posted

篇首语:卧疾丰暇豫,翰墨时间作。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 经典案例 财务管理系统(15)[2]相关的知识,希望对你有一定的参考价值。

  // 为凭证录入分录表

  procedure TDocuInput BitBtn Click(Sender: TObject);

  begin

  datasource DataSet Delete;

  end;

  // 统计分录表中的各项信息以储存到数据库

  procedure TDocuInput SumAccount;

  var

  sumoutput suminput:double;

  i:integer;

  begin

  suminput:= ;

  sumoutput:= ;

  //统计借贷双方的数额

  for i:= to do

  if (stringgrid Cells[ i]<> )and(stringgrid Cells[ i]<> ) then

  begin

  suminput:=suminput+strtofloat(stringgrid Cells[ i]);

  sumoutput:=sumoutput+strtofloat(stringgrid Cells[ i]);

  end;

  dbedit Text:=floattostr(suminput);

  dbedit Text:=floattostr(sumoutput);

  end;

  procedure TDocuInput DBEdit Exit(Sender: TObject);

  begin

  SumAccount;

  end;

  // 设置分录表表头

  procedure TDocuInput FormShow(Sender: TObject);

  begin

  stringgrid Cells[ ]:= 科目编码 ;

  stringgrid Cells[ ]:= 科目名称(双击选择) ;

  stringgrid Cells[ ]:= 借方 ;

  stringgrid Cells[ ]:= 贷方 ;

  stringgrid Cells[ ]:= 摘要 ;

  end;

  // 当在分录表中输入时 不允许在上面有空行的情况下输入一行新的数据

  procedure TDocuInput StringGrid SelectCell(Sender: TObject; ACol

  ARow: Integer; var CanSelect: Boolean);

  begin

  //防止在输入数据时上面有空行

  if stringgrid Cells[ Arow ]= then

  begin

  showmessage( 请先完成上行中空的项目 );

  exit;

  end;

  //保存选取的单元行列值

  curRow:=ARow;

  curCol:=ACol;

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

  stringgrid Options:=stringgrid Options+[goEditing];

  //防止选中标题栏

  if ARow= then curRow:=ARow+ ;

  //统计借贷双方信息

  sumAccount();

  end;

  // 在输入分录表时调用DLL中的表格 选择科目名称和号码

  procedure TDocuInput StringGrid DblClick(Sender: TObject);

  var

  showForm:TShowDllForm;

  module:Thandle;

  begin

  //只有双击指定列才有效

  if curCol<> then exit;

  //读入DLL

  module:=loadlibrary( sec dll );

  //如果读入错误 则module会是一个小于的错误代码

  //由此可以判断是否读入成功

  if module< then exit;

  @showForm:=getprocaddress(module pchar( ));

  if @showForm=nil then exit;

  //通过DLL传递参数

  stringgrid Cells[ curRow]:=showForm(application Handle 选择科目名称科目表 );

  //为科目代码添加科目名称

  adoquery Close;

  adoquery SQL Clear;

  adoquery SQL Add( select 科目名称 from 科目表 where 科目代码

  = +stringgrid Cells[ curRow]+ );

  adoquery Open;

  stringgrid Cells[ curRow]:=adoquery fieldbyname( 科目名称 ) AsString;

  end;

[ ]  [ ]  [ ]  

cha138/Article/program/Delphi/201311/24841

相关参考