⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pzlr.pas

📁 凭证管理系统的制作
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  JIsNull := True;
  For i := 2 to 14 do
  begin
    if Trim(a.Cells[i,x])<>'' then
    begin
      JIsNull := False;
      Break;
    end;
  end;
end;
function TForm2.DIsNull: Boolean;
var
  i: Integer;
begin
  DIsNull := True;
  For i := 16 to 28 do
  begin
    if Trim(a.Cells[i,x])<>'' then
    begin
      DIsNull := False;
      Break;
    end;
  end;
end;
//如果对于每个借方数据都有对应的贷方数据
//并且对于每一个贷方数据都有其对应的贷方数据则DPJD为True
function TForm2.DPJD: Boolean;
var
  m,n: Integer;
  mm,nn: Boolean;
begin
  DPJD := False;
  mm := True; //如果对于每个借方数据都有对应的贷方数据mm = True
  nn := True; //如果对于每个贷方数据都有对应的借方数据nn = True
  for m := 1 to a.RowCount-1 do
    if (JIsNull(m)= False)and(DIsCz(Trim(a.Cells[0,m]))= False) then
    begin
      mm := False;
      Break;
    end;
  For n := 1 to a.RowCount-1 do
    if (DisNull(n)= False)and(JIsCz(Trim(a.Cells[0,n]))= False)then
    begin
      nn := False;
      Break;
    end;
  if (mm = True)and(nn = True) then
    DPJD := True;
end;
function TForm2.JIsNull(Row: Integer): Boolean;
var
  i: Integer;
begin
  JIsNull := True;
  For i := 3 to 15 do
    if Trim(a.Cells[i,Row])<>'' then
    begin
      JIsNull := False;
      Break;
    end;
end;
function TForm2.DIsNull(Row: integer): Boolean;
var
  i: Integer;
begin
  DIsNull := True;
  For i := 17 to 29 do
    if Trim(a.Cells[i,Row])<>'' then
    begin
      DIsNull := False;
      Break;
    end;
end;

procedure TForm2.BitBtn2Click(Sender: TObject);
var
  mm: Integer;
begin
  if Trim(Label3.Caption)='' then
  begin
    Application.MessageBox('凭证号不能为空。','提示',64);
    BitBtn1.SetFocus;
    Exit;
  end;
  if Trim(Edit3.Text)='' then
  begin
    Application.MessageBox('制单人不能为空。','提示',64);
    Edit3.SetFocus;
    Exit;
  end;
  if Trim(Edit4.Text)='' then
  begin
    Application.MessageBox('制单人不能为空。','提示',64);
    Edit4.SetFocus;
    Exit;
  end;
  if StrToInt(Edit4.Text)<1 then
  begin
    Application.MessageBox('附单拒不能小于1。','提示',64);
    Edit4.SetFocus;
    Exit;
  end;
  if DPJD = False then
  begin
    Application.MessageBox('项目列表有误。','提示',64);
    Exit;
  end;
  if (Trim(Label8.Caption)='')or(Trim(Label10.Caption)='') then
  begin
    Application.MessageBox('请计算贷方金额或借方金额。','提示',64);
    BitBtn5.SetFocus;
    Exit;
  end;
  if JCZYKJ = False then
  begin
    Application.MessageBox('列表中摘要或会计不存在。','提示',64);
    Exit;
  end;
  if  JDisPH= False then
  begin
    Application.MessageBox('借方金额与贷方金额不平衡.','提示',64);
    Exit;
  end;
  Try
  Da.ADOConnection1.BeginTrans;
    with da.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('insert 凭证表 values(:a,:b,:c,:d,:e,default,Default,Default,:f)');
      Parameters.ParamByName('a').Value := Trim(Label3.Caption);
      Parameters.ParamByName('b').Value := StrToFloat(Label8.Caption);
      Parameters.ParamByName('c').Value := StrToFloat(Label10.Caption);
      Parameters.ParamByName('d').Value := StrToInt(Edit4.Text);
      Parameters.ParamByName('e').Value := Trim(Edit3.Text);
      Parameters.ParamByName('f').Value := DateTimePicker1.Date;
      ExecSQL;
    end;
    For mm := 1 to a.RowCount-1 do
    begin
      with Da.ADOQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('insert 凭证明细表 values (:a,:b,:c,:d,:e,:f,:g)');
        Parameters.ParamByName('a').Value := Trim(Label3.Caption);
        with Da.ADOQuery2 do
        begin
          Close;
          SQL.Clear;
          SQL.Add('select * from 摘要表 where 摘要名称 = :a');
          Parameters.ParamByName('a').Value := a.Cells[0,mm];
          Open;
        end;
        Parameters.ParamByName('b').Value := Trim(Da.ADOQuery2.FieldByName('摘要编号').Value);
        Parameters.ParamByName('c').Value := Trim(a.Cells[0,mm]);
        with Da.ADOQuery2 do
        begin
          Close;
          SQL.Clear;
          SQL.Add('select * from 会计科目表 where 科目名称 = :a');
          Parameters.ParamByName('a').Value := Trim(a.Cells[1,mm]);
          Open;
        end;
        Parameters.ParamByName('d').Value := Trim(Da.ADOQuery2.FieldByName('科目编号').Value);
        Parameters.ParamByName('e').Value := Trim(a.Cells[1,mm]);
        Parameters.ParamByName('f').Value := jsJFje(mm);
        Parameters.ParamByName('g').Value := JSDFje(mm);
        ExecSQL;
      end;
    end;
    Da.ADOConnection1.CommitTrans;
    Application.MessageBox('操作成功。','提示',64);
    BitBtn3.OnClick(Sender);
  Except
    Da.ADOConnection1.RollbackTrans;
    Application.MessageBox('操作失败。','提示',64);
  end;
end;

function TForm2.DIsCz(Zy: String): Boolean;
var
  i: Integer;
begin
  DIsCz := False;
  For i := 1 to A.RowCount-1 do
    if (Trim(Zy) = Trim(a.Cells[0,i]))and (DIsNull(i) = False) then
    begin
      DIsCz := True;
      Break;
    end;
end;
function TForm2.JIsCz(Zy: String): Boolean;
var
  i: Integer;
begin
  JIsCz := False;
  For i := 1 to A.RowCount-1 do
    if (Trim(Zy) = Trim(a.Cells[0,i]))and (JIsNull(i) = False) then
    begin
      JIsCz := True;
      Break;
    end;
end;
procedure TForm2.BitBtn5Click(Sender: TObject);
var
  i: integer;
begin
  Label8.Caption := '';
  Label10.Caption := '';
  a1 := 0.0;
  a2 := 0.0;
  For i := 1 to a.RowCount-1 do
  begin
    if a.Cells[2,i]='-' then
    begin
      if a.Cells[3,i]<>'' then a1 := a1 -StrToInt(a.Cells[3,i])*10000000000.0;
      if a.Cells[4,i]<>'' then a1 :=a1 - StrToInt(a.Cells[4,i])*1000000000.0;
      if a.Cells[5,i]<>'' then a1 := a1 - StrToInt(a.Cells[5,i])*100000000.0;
      if a.Cells[6,i]<>'' then a1 := a1 - StrToInt(a.Cells[6,i])*10000000.0;
      if a.Cells[7,i]<>'' then a1 := a1 - StrToInt(a.Cells[7,i])*1000000.0;
      if a.Cells[8,i]<>'' then a1 := a1 - StrToInt(a.Cells[8,i])*100000.0;
      if a.Cells[9,i]<>'' then a1 := a1 - StrToInt(a.Cells[9,i])*10000.0;
      if a.Cells[10,i]<>'' then a1 := a1 - StrToInt(a.Cells[10,i])*1000.0;
      if a.Cells[11,i]<>'' then a1 := a1 - StrToInt(a.Cells[11,i])*100.0;
      if a.Cells[12,i]<>'' then a1 := a1 - StrToInt(a.Cells[12,i])*10.0;
      if a.Cells[13,i]<>'' then a1 := a1 - StrToInt(a.Cells[13,i]);
      if a.Cells[14,i]<>'' then a1 := a1 - StrToInt(a.Cells[14,i])*0.1;
      if a.Cells[15,i]<>'' then a1 := a1 -StrToInt(a.Cells[15,i])*0.01;
    end
    else
    begin
      if a.Cells[3,i]<>'' then a1 := a1 +StrToInt(a.Cells[3,i])*10000000000.0  ;
      if a.Cells[4,i]<>'' then a1 :=a1 + StrToInt(a.Cells[4,i])*1000000000.0;
      if a.Cells[5,i]<>'' then a1 := a1 + StrToInt(a.Cells[5,i])*100000000.0 ;
      if a.Cells[6,i]<>'' then a1 := a1 + StrToInt(a.Cells[6,i])*10000000.0;
      if a.Cells[7,i]<>'' then a1 := a1 + StrToInt(a.Cells[7,i])*1000000.0;
      if a.Cells[8,i]<>'' then a1 := a1 + StrToInt(a.Cells[8,i])*100000.0;
      if a.Cells[9,i]<>'' then a1 := a1 + StrToInt(a.Cells[9,i])*10000.0;
      if a.Cells[10,i]<>'' then a1 := a1 + StrToInt(a.Cells[10,i])*1000.0;
      if a.Cells[11,i]<>'' then a1 := a1 + StrToInt(a.Cells[11,i])*100.0;
      if a.Cells[12,i]<>'' then a1 := a1 + StrToInt(a.Cells[12,i])*10.0;
      if a.Cells[13,i]<>'' then a1 := a1 + StrToInt(a.Cells[13,i]);
      if a.Cells[14,i]<>'' then a1 := a1 + StrToInt(a.Cells[14,i])*0.1;
      if a.Cells[15,i]<>'' then a1 := a1 +StrToInt(a.Cells[15,i])*0.01;
    end;
  end;
  Label8.Caption := FloatToStr(a1);
  For i := 1 to a.RowCount-1 do
  begin
    if a.Cells[16,i]='-' then
    begin
      if a.Cells[17,i]<>'' then a2 := a2 - StrToInt(a.Cells[17,i])*10000000000.0;
      if a.Cells[18,i]<>'' then a2 := a2 - StrToInt(a.Cells[18,i])*1000000000.0;
      if a.Cells[19,i]<>'' then a2 := a2 - StrToInt(a.Cells[19,i])*100000000.0;
      if a.Cells[20,i]<>'' then a2 := a2 - StrToInt(a.Cells[20,i])*10000000.0;
      if a.Cells[21,i]<>'' then a2 := a2 - StrToInt(a.Cells[21,i])*1000000.0;
      if a.Cells[22,i]<>'' then a2 := a2 - StrToInt(a.Cells[22,i])*100000.0;
      if a.Cells[23,i]<>'' then a2 := a2 - StrToInt(a.Cells[23,i])*10000.0;
      if a.Cells[24,i]<>'' then a2 := a2 - StrToInt(a.Cells[24,i])*1000.0;
      if a.Cells[25,i]<>'' then a2 := a2 - StrToInt(a.Cells[25,i])*100.0;
      if a.Cells[26,i]<>'' then a2 := a2 - StrToInt(a.Cells[26,i])*10.0;
      if a.Cells[27,i]<>'' then a2 := a2 - StrToInt(a.Cells[27,i]);
      if a.Cells[28,i]<>'' then a2 := a2 - StrToInt(a.Cells[28,i])*0.1;
      if a.Cells[29,i]<>'' then a2 := a2 -StrToInt(a.Cells[29,i])*0.01;
    end
    else
    begin
      if a.Cells[17,i]<>'' then a2 := a2 +StrToInt(a.Cells[17,i])*10000000000.0  ;
      if a.Cells[18,i]<>'' then a2 :=a2 + StrToInt(a.Cells[18,i])*1000000000.0;
      if a.Cells[19,i]<>'' then a2 := a2 + StrToInt(a.Cells[19,i])*100000000.0 ;
      if a.Cells[20,i]<>'' then a2 := a2 + StrToInt(a.Cells[20,i])*10000000.0;
      if a.Cells[21,i]<>'' then a2 := a2 + StrToInt(a.Cells[21,i])*1000000.0;
      if a.Cells[22,i]<>'' then a2 := a2 + StrToInt(a.Cells[22,i])*100000.0;
      if a.Cells[23,i]<>'' then a2 := a2 + StrToInt(a.Cells[23,i])*10000.0;
      if a.Cells[24,i]<>'' then a2 := a2 + StrToInt(a.Cells[24,i])*1000.0;
      if a.Cells[25,i]<>'' then a2 := a2 + StrToInt(a.Cells[25,i])*100.0;
      if a.Cells[26,i]<>'' then a2 := a2 + StrToInt(a.Cells[26,i])*10.0;
      if a.Cells[27,i]<>'' then a2 := a2 + StrToInt(a.Cells[27,i]);
      if a.Cells[28,i]<>'' then a2 := a2 + StrToInt(a.Cells[28,i])*0.1;
      if a.Cells[29,i]<>'' then a2 := a2 +StrToInt(a.Cells[29,i])*0.01;
    end;
  end;
  Label10.Caption := FloatToStr(a2);
end;

procedure TForm2.aSetEditText(Sender: TObject; ACol, ARow: Integer;
  const Value: String);
begin
  if (y >1) and (y<16) then
    Label8.Caption := '';
  if (y>15)and(y<30) then
    Label10.Caption := '';
end;

function TForm2.JCXmlb: Boolean;
var
  m: Integer;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -