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

📄 khxxgl.pas

📁 delphi开发的完整的客户管理系统(带数据库)
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    MaskEdit1.Text :=  datam.ADOQuery2.FieldByName('电话').Value;
    Edit11.Text :=  datam.ADOQuery2.FieldByName('传真').Value;
    Edit12.Text :=  datam.ADOQuery2.FieldByName('联系人').Value;
    Edit7.Text :=  datam.ADOQuery2.FieldByName('联系人电话').Value;
    Edit8.Text :=  datam.ADOQuery2.FieldByName('开户银行').Value;
    Edit9.Text :=  datam.ADOQuery2.FieldByName('纳税人').Value;
    Edit13.Text :=  datam.ADOQuery2.FieldByName('邮箱网址').Value;
    Edit14.Text :=  datam.ADOQuery2.FieldByName('银行账号').Value;
    ComboBox2.Text := datam.ADOQuery2.FieldByName('级别名称').Value;
  end
  else
  begin
    Edit1.Clear;
    Edit2.Clear;
    Edit3.Clear;
    Edit4.Clear;
    Edit5.Clear;
    Edit7.Clear;
    Edit8.Clear;
    Edit9.Clear;
    Edit10.Clear;
    Edit11.Clear;
    Edit12.Clear;
    Edit13.Clear;
    Edit14.Clear;
    MaskEdit1.Clear;
  end;
end;

procedure TForm9.BitBtn1Click(Sender: TObject);
begin
  DisableComboBox;
  if Not datam.ADOQuery2.Bof  then
  begin
    datam.ADOQuery2.Prior;
    EditValue;
  end
  else
    BitBtn1.Enabled := False;
    BitBtn2.Enabled := True;
    BitBtn5.Enabled := True;
    BitBtn6.Enabled := True;
end;

procedure TForm9.BitBtn2Click(Sender: TObject);
begin
  DisableComboBox;
  if Not datam.ADOQuery2.Eof then
  begin
    datam.ADOQuery2.Next;
    EditValue;
  end
  else
    BitBtn2.Enabled := False;
    BitBtn1.Enabled := True;
  BitBtn5.Enabled := True;
  BitBtn6.Enabled := True;
end;

procedure TForm9.BitBtn6Click(Sender: TObject);
begin
  DisableComboBox;
  BitBtn5.Enabled := False;
  if datam.ADOQuery2.FieldByName('客户编号').Value = null then
  begin
    BitBtn6.Enabled := False;
    Exit;
  end;
  try
  If Application.MessageBox('确实要删除该条记录吗?','提示',MB_YESNO )= ID_Yes then
  begin
    with datam.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('delete 客户基础信息表 where 客户编号= :a');
      Parameters.ParamByName('a').Value := Trim(Edit1.Text);
      ExecSQL
    end;
    Application.MessageBox('该条记录已经删除。','提示',0+64);
    ShowDate;
  end ;
  Except
  Application.MessageBox('系统出错。','提示',0+64);
  Close
  end;
end;

procedure TForm9.BitBtn5Click(Sender: TObject);
begin
  DisableComboBox;
  if datam.ADOQuery2.FieldByName('客户编号').Value = null then
  begin
    BitBtn5.Enabled := False;
    BitBtn1.Enabled := False;
    BitBtn2.Enabled := False;
    Exit;
  end;
  Try
  if Application.MessageBox('确实要修改该条记录吗?','提示',MB_YESNO )= ID_Yes then
  begin
    if Trim(Edit5.Text)='' then
    begin
      Application.MessageBox('省级名称不能为空。','提示',64);
      Exit;
    end;
    if Trim(ComboBox2.Text)='' then
    begin
      Application.MessageBox('客户级别不能为空。','提示',64);
      ComboBox2.SetFocus;
      Exit;
    end;
    with datam.ADOQuery4 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from 客户级别表 where 级别名称 = :a');
      Parameters.ParamByName('a').Value := Trim(ComboBox2.Text);
      Open;
    end;
    if datam.ADOQuery4.RecordCount<1 then
    begin
      Application.MessageBox('该级别不存在。','提示',64);
      ComboBox2.Text := '';
      ComboBox2.SetFocus;
      Exit;
    end;
    with datam.ADOQuery2 do
    begin
      Edit;
      FieldByName('客户全称').Value := Edit2.Text ;
      FieldByName('简称').Value := Edit3.Text ;
      FieldByName('地址').Value := Edit4.Text ;
      FieldByName('级别名称').Value := Trim(ComboBox2.Text);
      FieldByName('区域代码').Value := Trim(qydm);
      FieldByName('区域名称').Value := Trim(ComboBox1.Text);
      FieldByName('邮政编码').Value := Edit10.Text ;
      FieldByName('电话').Value := MaskEdit1.Text ;
      FieldByName('传真').Value := Edit11.Text ;
      FieldByName('联系人').Value := Edit12.Text ;
      FieldByName('联系人电话').Value := Edit7.Text ;
      FieldByName('开户银行').Value := Edit8.Text ;
      FieldByName('纳税人').Value := Edit9.Text ;
      FieldByName('邮箱网址').Value := Edit13.Text ;
      FieldByName('银行账号').Value := Edit14.Text ;
      Post;
    end;
    Application.MessageBox('修改成功','提示',0+64);
    ShowDate;
  end
  else
    EditValue;
  Except
  Application.MessageBox('系统出错','提示',0+64);
  Close;
  end;
end;

procedure TForm9.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit3.SetFocus
  else if Key =VK_Left then
    Edit2.SetFocus;
end;

procedure TForm9.Edit2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit1.SetFocus;
end;

procedure TForm9.Edit3KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit4.SetFocus
  else if key = VK_Left then
    Edit1.SetFocus;
end;

procedure TForm9.Edit4KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    ComboBox1.SetFocus;
  if key = VK_Left then
    Edit3.SetFocus;
end;

procedure TForm9.Edit5KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit10.SetFocus;
  if key = VK_Left then
    Edit4.SetFocus;
end;

procedure TForm9.Edit10KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    MaskEdit1.SetFocus
  else if key = VK_Left then
    ComboBox2.SetFocus;
end;

procedure TForm9.MaskEdit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if key = vk_return then
    Edit12.SetFocus
  else if key = VK_Left then
    Edit10.SetFocus;
end;

procedure TForm9.Edit11KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit8.SetFocus;
  if key = VK_Left then
    Edit7.SetFocus;
end;

procedure TForm9.Edit12KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit7.SetFocus;
  if key = VK_Left then
    MaskEdit1.SetFocus;
end;

procedure TForm9.Edit7KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit11.SetFocus;
  if key = VK_Left then
    Edit12.SetFocus;
end;

procedure TForm9.Edit8KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
    Edit14.SetFocus;
  if key = VK_Left then
    Edit11.SetFocus;
end;

procedure TForm9.Edit14KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if key = vk_return then
    Edit13.SetFocus;
  if key = VK_Left then
    Edit8.SetFocus;
end;

procedure TForm9.Edit9KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   if key = VK_Left then
    Edit13.SetFocus;
end;

procedure TForm9.Edit13KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = VK_ReTurn then
    Edit9.SetFocus
  else if Key = VK_Left then
    Edit14.SetFocus;
end;

procedure TForm9.ShowDate;
begin
  with datam.ADOQuery2 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from 客户基础信息表');
    Open;
  end;
  EditValue;
end;

procedure TForm9.DBGrid1DblClick(Sender: TObject);
begin
  Combobox1.Text := datam.ADOQuery1.FieldByName('区域名称').Value;
  Edit5.Text := datam.ADOQuery1.FieldByName('省级名称').Value;
  Edit15.Text := datam.ADOQuery1.FieldByName('地区名称').Value;
  Edit16.Text := datam.ADOQuery1.FieldByName('县级名称').Value;
  qydm := datam.ADOQuery1.FieldByName('区域代码').Value;
  ComboBox2.SetFocus;
  DBGrid1.Visible := False;
end;

procedure TForm9.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = Vk_ReTurn then
    DBGrid1.OnDblClick(Sender);
end;

procedure TForm9.ComboBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = vk_ReTurn then
  begin
    Edit5.Clear;
    Edit15.Clear;
    Edit16.Clear;
    if Trim(ComboBox1.Text)<>'' then
    begin
      with datam.ADOQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('select * from 客户区域表 where 区域名称 = :a');
        Parameters.ParamByName('a').Value := Trim(ComboBox1.Text);
        Open;
      end;
      if datam.ADOQuery1.RecordCount>1 then
      begin
        DataSource1.DataSet := datam.ADOQuery1;
        DBGrid1.Visible := True;
        DBGrid1.SetFocus;
      end
      else if datam.ADOQuery1.RecordCount>0 then
      begin
        Combobox1.Text := datam.ADOQuery1.FieldByName('区域名称').Value;
        Edit5.Text := datam.ADOQuery1.FieldByName('省级名称').Value;
        Edit15.Text := datam.ADOQuery1.FieldByName('地区名称').Value;
        Edit16.Text := datam.ADOQuery1.FieldByName('县级名称').Value;
        qydm := datam.ADOQuery1.FieldByName('区域代码').Value;
        ComboBox2.SetFocus;
      end;
    end;
  end
  else if Key= VK_Left then
    Edit4.SetFocus;
end;

procedure TForm9.ComboBox2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_ReTurn then
    Edit10.SetFocus
  else if Key = VK_Left then
    ComboBox1.SetFocus;
end;

procedure TForm9.DisableComboBox;
begin
  aa:= False;
end;

procedure TForm9.ComboBox1Change(Sender: TObject);
begin
  Edit5.Clear;
  Edit15.Clear;
  Edit16.Clear;
end;

end.

⌨️ 快捷键说明

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