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

Posted

篇首语:枕上从妨一夜睡,灯前读尽十年诗。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 经典案例 财务管理系统(15)[3]相关的知识,希望对你有一定的参考价值。

  // 对分录表进行插入和修改时所执行的操作

  procedure TDocuInput OpType(opname: string);

  var

  i:integer;

  inputval outputval oldnum:string;

  begin

  //如果是新增凭证 则直接将分录表中的数据逐条插入

  if opname= insert then

  begin

  for i:= to do

  begin

  //如果表格中为空 则跳出循环

  if stringgrid Cells[ i]= then continue;

  inputval:=stringgrid cells[ i];

  outputval:=stringgrid cells[ i];

  //插入数据 由于借方和贷方数据在sql server中为money 故需要进行转换

  adomand CommandText:= insert into 分录表([凭证编号] [科目代码]

  [借方] [贷方] [摘要]) values( +dbedit Text+

  +stringgrid Cells[ i]+ cast( +inputval+ as money)

  cast( +outputval+ as money) +stringgrid Cells[ i]+ ) ;

  adomand Execute;

  end;

  end;

  if opname= edit then

  begin

  for i:= to do

  begin

  if stringgrid Cells[ i]= then continue;

  inputval:=stringgrid cells[ i];

  outputval:=stringgrid cells[ i];

  //对凭证所属的分录表原有数据进行更新

  if i<=recordnum then

  adomand CommandText:= update 分录表 set [科目代码]

  = +stringgrid cells[ i]+ [借方]=cast( +inputval+ as money)

  [贷方]=cast( +outputval+ as money) [摘要]= +stringgrid Cells[ i]

  + where 编号= +mytable[i]+

  else

  //插入凭证所属的分录表中的新数据

  adomand CommandText:= insert into 分录表([凭证编号] [科目代码]

  [借方] [贷方] [摘要]) values( +dbedit Text+

  +stringgrid Cells[ i]+ cast( +inputval+ as money)

  cast( +outputval+ as money) +stringgrid Cells[ i]+ ) ;

  adomand Execute;

  end;

  end;

  end;

[ ]  [ ]  [ ]  

cha138/Article/program/Delphi/201311/24842

相关参考