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

📄 spzl_unit.pas

📁 delphi进销存管理系统 很不错得进销存管理系统 有很多skin得
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit spzl_unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, Grids, DBGrids, ComCtrls, Menus;

type
  Tspzl_form = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label11: TLabel;
    Label13: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    DBGrid1: TDBGrid;
    GroupBox6: TGroupBox;
    SpeedButton15: TSpeedButton;
    SpeedButton16: TSpeedButton;
    SpeedButton17: TSpeedButton;
    SpeedButton18: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    StatusBar1: TStatusBar;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    U1: TMenuItem;
    F1: TMenuItem;
    R1: TMenuItem;
    Edit13: TEdit;
    procedure SpeedButton18Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton15Click(Sender: TObject);
    procedure SpeedButton16Click(Sender: TObject);
    procedure SpeedButton17Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure DBGrid1CellClick(Column: TColumn);
    procedure N1Click(Sender: TObject);
    procedure U1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure F1Click(Sender: TObject);
    procedure R1Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit4KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit5KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit6KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit7KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit8KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit9KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit10KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit11KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit12KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit11KeyPress(Sender: TObject; var Key: Char);
    procedure Edit12KeyPress(Sender: TObject; var Key: Char);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  spzl_form: Tspzl_form;

implementation

uses data_unit, spzl_find_unit, spfl_unit, spzl_spfl_find_unit,
  spzl_dw_find_unit;

{$R *.dfm}

procedure Tspzl_form.SpeedButton18Click(Sender: TObject);
begin
  close;
end;

procedure Tspzl_form.FormCreate(Sender: TObject);
begin
  self.Top := 74;
  self.Left := 11;
  self.Height := 491;
  self.Width := 767;
  with database do
  begin
    adoq1.Connection := adoc;
    adoq1.SQL.Clear;
    adoq1.SQL.Add('select * from spzl ');
    adoq1.active := true;
    statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
    datas1.DataSet := adoq1;
    dbgrid1.DataSource := datas1;
  end;

end;

procedure Tspzl_form.SpeedButton15Click(Sender: TObject);
begin
  if (length(edit1.Text) <> 0) and (length(edit2.Text) <> 0) then
  begin
    with database do
    begin
      adoq1.Connection := adoc;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('select 商品编码 from spzl where 商品编码=:spbm');
      adoq1.Parameters.ParamByName('spbm').Value := edit1.Text;
      adoq1.Active := true;
      if adoq1.Recordset.RecordCount > 0 then
      begin
        showmessage('已有此信息,请重输!');
        adoq1.SQL.Clear;
        adoq1.SQL.Add('select * from spzl order by 商品编码');
        adoq1.Active := true;
        statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
        datas1.DataSet := adoq1;
        dbgrid1.DataSource := datas1;
        edit1.SetFocus;
      end
      else
      begin
        adoq1.SQL.Clear;
        adoq1.SQL.Add('insert into spzl(商品编码,商品名称,拼音简码,简称,类别,规格,型号,单位,产地,备注,库存上限,库存下限) values(:spbm,:spmc,:pyjm,:jc,:lb,:gg,:xh,:dw,:cd,:bz,:kcsx,:kcxx)');
        adoq1.parameters.ParamByName('spbm').value := edit1.text;
        adoq1.parameters.ParamByName('spmc').value := edit2.text;
        adoq1.parameters.ParamByName('pyjm').value := edit3.text;
        adoq1.Parameters.ParamByName('jc').Value := edit4.Text;
        adoq1.Parameters.ParamByName('lb').Value := edit5.text;
        adoq1.parameters.ParamByName('gg').value := edit6.text;
        adoq1.parameters.ParamByName('xh').value := edit7.text;
        adoq1.parameters.ParamByName('dw').value := edit8.text;
        adoq1.Parameters.ParamByName('cd').Value := edit9.Text;
        adoq1.Parameters.ParamByName('bz').Value := edit10.text;
        adoq1.parameters.ParamByName('kcsx').value := strtofloat(edit11.text);
        adoq1.parameters.ParamByName('kcxx').value := strtofloat(edit12.text);
        adoq1.ExecSQL;
        adoq1.SQL.Clear;
        adoq1.SQL.Add('select * from spzl');
        adoq1.Active := true;
        datas1.DataSet := adoq1;
        dbgrid1.DataSource := datas1;
        statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
        edit1.Clear; edit2.Clear; edit3.Clear; edit4.clear; edit5.Clear; edit6.Text;
        edit7.Clear; edit8.Clear; edit9.Clear; edit10.clear;
        edit11.text := '0';
        edit12.text := '0';
        edit1.SetFocus;
      end;
    end;
  end
  else
  begin
    showmessage('请输入商品编码和商品名称');
    edit1.SetFocus;
  end;


end;

procedure Tspzl_form.SpeedButton16Click(Sender: TObject);
begin
  speedbutton15.Enabled := false;
  speedbutton17.Enabled := false;
  with database do
  begin
    adoq1.Connection := adoc;
    adoq1.SQL.Clear;
    adoq1.SQL.Add('select * from spzl where 商品编码=:spbm');
    adoq1.Parameters.ParamByName('spbm').Value := edit13.Text;
    adoq1.Active := true;
    if adoq1.Recordset.RecordCount > 0 then
    begin
      edit1.Text := adoq1.Fields.Fields[0].AsString;
      edit2.Text := adoq1.Fields.Fields[1].AsString;
      edit3.Text := adoq1.Fields.Fields[2].AsString;
      edit4.Text := adoq1.Fields.Fields[3].AsString;
      edit5.Text := adoq1.Fields.Fields[4].AsString;
      edit6.Text := adoq1.Fields.Fields[5].AsString;
      edit7.Text := adoq1.Fields.Fields[6].AsString;
      edit8.Text := adoq1.Fields.Fields[7].AsString;
      edit9.Text := adoq1.Fields.Fields[8].AsString;
      edit10.Text := adoq1.Fields.Fields[9].AsString;
      edit11.Text := adoq1.Fields.Fields[10].AsString;
      edit12.Text := adoq1.Fields.Fields[11].AsString;
      edit1.ReadOnly := true;
      edit2.SetFocus;
    end
    else
      showmessage('请刷新选择记录!');
  end;
end;

procedure Tspzl_form.SpeedButton17Click(Sender: TObject);
begin
  with database do
  begin
    adoq1.Connection := adoc;
    if application.MessageBox('是否真的删除?', '记录删除', 4) = 6 then
    begin
      adoq1.SQL.Clear;
      adoq1.SQL.Add('delete from spzl where 商品编码=:spbm');
      adoq1.Parameters.ParamByName('spbm').Value := edit13.Text;
      adoq1.ExecSQL;
    end;
    adoq1.SQL.Clear;
    adoq1.SQL.Add('select * from spzl');
    adoq1.Active := true;
    datas1.DataSet := adoq1;
    dbgrid1.DataSource := datas1;
    statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
  end;

end;

procedure Tspzl_form.SpeedButton3Click(Sender: TObject);
begin
  with database do
  begin
    adoq2.Connection := adoc;

⌨️ 快捷键说明

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