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

📄 fygysdz.~pas

📁 功能强大,画面精致.是一款不可多得的进销存管理系统 acess数据库,用户名:yuansheng 密码:yuansheng 建议在xp系统下运行。
💻 ~PAS
字号:
unit Fygysdz;

interface

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

type
  TF_ygysdz = class(TF_base)
    DBGrid1: TDBGrid;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    Panel1: TPanel;
    Label3: TLabel;
    ComboBox1: TComboBox;
    Label4: TLabel;
    Edit1: TEdit;
    SpeedButton1: TSpeedButton;
    procedure FormShow(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_ygysdz: TF_ygysdz;

implementation
  uses Fdm,Fgywldz;
{$R *.dfm}

procedure TF_ygysdz.FormShow(Sender: TObject);
begin
  inherited;
  with Adoquery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select tradecode,fullnamed,upperlimit,lowerlimit,qty from tb_stock');
    SQL.Add('where (qty<=lowerlimit and lowerlimit<>0) or (qty>=upperlimit and upperlimit<>0) order by tradecode');
    OPen;
  end;
end;

procedure TF_ygysdz.SpeedButton1Click(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 order by tradecode');
      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 tradecode,fullnamed,upperlimit,lowerlimit,qty from tb_stock');
        SQL.Add('where (qty<=lowerlimit and lowerlimit<>0) or (qty>=upperlimit and upperlimit<>0) order by tradecode');
        OPen;
      end;
  except
    Application.MessageBox('请正确输入条件','提示',mb_ok);
  end;
end;

procedure TF_ygysdz.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
var
  qty,lo,up:real;
begin
  inherited;
  try
    if ADOQuery1.RecordCount=0 then
      Exit;
    with Adoquery1 do
    begin
      qty:=FieldByName('qty').Value;
      lo:=FieldByName('lowerlimit').Value;
      up:=FieldByName('upperlimit').Value;
      if ((qty<=lo) and (lo<>0)) or ((qty>=up) and (up<>0)) then
        Dbgrid1.Canvas.Font.Color:=clblue;
    end;
    DBGrid1.DefaultDrawDataCell(rect,column.Field,state);
  except
  end;
end;

end.

⌨️ 快捷键说明

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