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

📄 fkcspxz.pas

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

interface

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

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

var
  F_kcspxz: TF_kcspxz;
  grow:integer;
implementation
  uses Fdm,Fjhd,Fzct, Fjhthd,fxsd, Fxsthd;
{$R *.dfm}

procedure TF_kcspxz.SpeedButton3Click(Sender: TObject);
var
  searchwhat:string;
begin
  inherited;
  searchwhat:='';
  case combobox1.ItemIndex of
    0: searchwhat:='tradecode';
    1: searchwhat:='fullnamed';
    2: searchwhat:='name';
    3: searchwhat:='shortcode';
  end;
  try
    with ADoquery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from tb_stock ');
      SQL.Add('where '+''+searchwhat+''+' like :a');
      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 * from tb_stock order by tradecode asc');
        open;
      end;
  except
    Application.MessageBox('请正确输入条件','提示',mb_ok);
  end;
end;
procedure TF_kcspxz.FormShow(Sender: TObject);
begin
  inherited;
  with ADoquery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from tb_stock order by tradecode asc');
    open;
  end;
end;

procedure TF_kcspxz.SpeedButton2Click(Sender: TObject);
var
  gcol,xh:integer;
begin
  inherited;
  grow:=1;
  if F_zct.wf=1 then  //往进货单录入窗体加数据
  begin
    for xh:=1 to F_jhd.StringGrid1.RowCount do
    begin
      if Trim(F_jhd.StringGrid1.Cells[1,xh])='' then    //查找第几行为空
      begin
        grow:=xh;
        break;
      end;
    end;
    for xh:=0 to adoquery1.FieldCount-12 do   //将数据库的数据读出
    begin
      gcol:=xh;
      if xh>=2 then gcol:=gcol+1;
      F_jhd.StringGrid1.Cells[xh+1,grow]:=adoquery1.Fields[gcol].Value;
    end;
    F_jhd.StringGrid1.Cells[8,grow]:=adoquery1.Fields[8].Value;
    F_jhd.StringGrid1.SetFocus;
    F_jhd.StringGrid1.Col:=7;
    F_jhd.StringGrid1.Row:=grow;
  end;
  if F_zct.wf=2 then    //往进货退货单录入窗体加数据
  begin
    for xh:=1 to F_jhthd.StringGrid1.RowCount do
    begin
      if Trim(F_jhthd.StringGrid1.Cells[1,xh])='' then    //查找第几行为空
      begin
        grow:=xh;
        break;
      end;
    end;
    for xh:=0 to adoquery1.FieldCount-12 do   //将数据库的数据读出
    begin
      gcol:=xh;
      if xh>=2 then gcol:=gcol+1;
      F_jhthd.StringGrid1.Cells[xh+1,grow]:=adoquery1.Fields[gcol].Value;
    end;
    F_jhthd.StringGrid1.Cells[8,grow]:=adoquery1.Fields[8].Value;
    F_jhthd.StringGrid1.SetFocus;
    F_jhthd.StringGrid1.Col:=7;
    F_jhthd.StringGrid1.Row:=grow;
  end;
  if F_zct.wf=3 then    //往销售单录入窗体加数据
  begin
    for xh:=1 to F_xsd.StringGrid1.RowCount do
    begin
      if Trim(F_xsd.StringGrid1.Cells[1,xh])='' then    //查找第几行为空
      begin
        grow:=xh;
        break;
      end;
    end;
    for xh:=0 to adoquery1.FieldCount-12 do   //将数据库的数据读出
    begin
      gcol:=xh;
      if xh>=2 then gcol:=gcol+1;
      F_xsd.StringGrid1.Cells[xh+1,grow]:=adoquery1.Fields[gcol].Value;
    end;
    F_xsd.StringGrid1.Cells[8,grow]:=adoquery1.Fields[10].Value;
    F_xsd.StringGrid1.SetFocus;
    F_xsd.StringGrid1.Col:=7;
    F_xsd.StringGrid1.Row:=grow;
  end;
  if F_zct.wf=4 then    //往销售退货单录入窗体加数据
  begin
    for xh:=1 to F_xsthd.StringGrid1.RowCount do
    begin
      if Trim(F_xsthd.StringGrid1.Cells[1,xh])='' then    //查找第几行为空
      begin
        grow:=xh;
        break;
      end;
    end;
    for xh:=0 to adoquery1.FieldCount-12 do   //将数据库的数据读出
    begin
      gcol:=xh;
      if xh>=2 then gcol:=gcol+1;
      F_xsthd.StringGrid1.Cells[xh+1,grow]:=adoquery1.Fields[gcol].Value;
    end;
    F_xsthd.StringGrid1.Cells[8,grow]:=adoquery1.Fields[10].Value;
    F_xsthd.StringGrid1.SetFocus;
    F_xsthd.StringGrid1.Col:=7;
    F_xsthd.StringGrid1.Row:=grow;
  end;
  Close;
end;

procedure TF_kcspxz.SpeedButton1Click(Sender: TObject);
begin
  inherited;
  close;
end;

procedure TF_kcspxz.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 + -