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

📄 ffyxz.pas

📁 进销存开发系统
💻 PAS
字号:
unit Ffyxz;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Fbase, ToolWin, ComCtrls, Buttons, StdCtrls, Grids, DBGrids, DB,
  ADODB;

type
  TF_fyxz = class(TF_base)
    DBGrid1: TDBGrid;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    SpeedButton3: TSpeedButton;
    ToolBar1: TToolBar;
    SpeedButton2: TSpeedButton;
    SpeedButton1: TSpeedButton;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    procedure FormShow(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure DBGrid1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_fyxz: TF_fyxz;
  grow:integer;
implementation
  uses Fdm,Fzct,Fxjfy, Fybfy;
{$R *.dfm}

procedure TF_fyxz.FormShow(Sender: TObject);
begin
  inherited;
  with ADoquery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select subjectcode,fullname,name,shortcode from tb_feetype order by subjectcode asc');
    open;
  end;
end;

procedure TF_fyxz.SpeedButton3Click(Sender: TObject);
var
  searchwhat:string;
begin
  inherited;
  searchwhat:='';
  case combobox1.ItemIndex of
    0: searchwhat:='subjectcode';
    1: searchwhat:='fullname';
    2: searchwhat:='name';
    3: searchwhat:='shortcode';
  end;
  try
    with ADoquery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select subjectcode,fullname,name,shortcode from tb_feetype ');
      SQL.Add('where '+''+searchwhat+''+' like :a order by subjectcode asc');
      parameters.ParamByName('a').Value:='%'+Trim(Edit1.Text)+'%';
      open;
    end;
    if Application.MessageBox('是否刷新表?','提示',mb_yesno)=Id_yes then
      with ADoquery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('select subjectcode,fullname,name,shortcode from tb_feetype order by subjectcode asc');
        open;
      end;
  except
    Application.MessageBox('请正确输入条件','提示',mb_ok);
  end;
end;

procedure TF_fyxz.SpeedButton1Click(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure TF_fyxz.SpeedButton2Click(Sender: TObject);
var
  gcol,xh:integer;
begin
  inherited;
  grow:=1;
  //往现金费用窗体加数据
  if F_zct.wf=8 then
  begin
    for xh:=1 to F_xjfy.StringGrid1.RowCount do
    begin
      if Trim(F_xjfy.StringGrid1.Cells[1,xh])='' then    //查找第几行为空
      begin
        grow:=xh;
        break;
      end;
    end;
    for xh:=0 to 1 do   //将数据库的数据读出
    begin
      gcol:=xh;
      F_xjfy.StringGrid1.Cells[xh+1,grow]:=adoquery1.Fields[gcol].Value;
    end;
    F_xjfy.StringGrid1.SetFocus;
    F_xjfy.StringGrid1.Col:=3;
    F_xjfy.StringGrid1.Row:=grow;
  end;
  //往一般费用窗体中添加数据
  if F_zct.wf=9 then
  begin
    for xh:=1 to F_ybfy.StringGrid1.RowCount do
    begin
      if Trim(F_ybfy.StringGrid1.Cells[1,xh])='' then    //查找第几行为空
      begin
        grow:=xh;
        break;
      end;
    end;
    for xh:=0 to 1 do   //将数据库的数据读出
    begin
      gcol:=xh;
      F_ybfy.StringGrid1.Cells[xh+1,grow]:=adoquery1.Fields[gcol].Value;
    end;
    F_ybfy.StringGrid1.SetFocus;
    F_ybfy.StringGrid1.Col:=3;
    F_ybfy.StringGrid1.Row:=grow;
  end;
  Close;
end;

procedure TF_fyxz.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  inherited;
  if key=13 then speedbutton2.Click;
end;

end.

⌨️ 快捷键说明

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