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

📄 finadd.pas

📁 delphi2007开发的汽车配件进销存系统.实用级的源码.
💻 PAS
字号:
{*******************************************************}
{                                                       }
{       单证打印                                        }
{       Finadd.pas 简单进货
{       2007-07-01 19:08:09
{       独孤九剑 rhcgrys@sina.com                       }
{       版权所有 (C) 2007 未来科技                      }
{                                                       }
{*******************************************************}

unit Finadd;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, cxLookAndFeelPainters, StdCtrls, cxButtons, cxPC, cxControls,
  cxLabel, cxContainer, cxEdit, cxTextEdit, cxDBEdit,
  ADODB;

type
  TFrminadd = class(TForm)
    cxPageControl1: TcxPageControl;
    cxTabSheet1: TcxTabSheet;
    cxButton1: TcxButton;
    cxDBTextEdit1: TcxDBTextEdit;
    cxDBTextEdit2: TcxDBTextEdit;
    cxDBTextEdit3: TcxDBTextEdit;
    cxDBTextEdit4: TcxDBTextEdit;
    cxDBTextEdit5: TcxDBTextEdit;
    cxDBTextEdit6: TcxDBTextEdit;
    cxDBTextEdit7: TcxDBTextEdit;
    cxDBTextEdit8: TcxDBTextEdit;
    cxLabel1: TcxLabel;
    cxLabel2: TcxLabel;
    cxLabel3: TcxLabel;
    cxLabel4: TcxLabel;
    cxLabel5: TcxLabel;
    cxLabel6: TcxLabel;
    cxLabel7: TcxLabel;
    cxLabel8: TcxLabel;
    cxLabel9: TcxLabel;
    cxTextEdit1: TcxTextEdit;
    cxButton2: TcxButton;
    cxButton3: TcxButton;
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure cxTextEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  function checkrecord(field:string;qry:TADOQuery): Boolean;

var
  Frminadd: TFrminadd;

implementation

uses UDM;

{$R *.dfm}

procedure TFrminadd.cxButton1Click(Sender: TObject);
begin
  close;
end;

procedure TFrminadd.cxButton2Click(Sender: TObject);
begin
  try
    cxTextEdit1.Text:=(FormatFloat('0.00',StrToFloat(cxTextEdit1.text)));
    with dm.connqry do begin
      active:=false;
      with sql do begin
        if checkrecord(cxDBTextEdit2.Text,dm.connqry) then begin
          dm.connqry.SQL.Clear;
          add('update kcxx set sl=sl+:psl where bm=:pbm')
        end
        else begin
          dm.connqry.SQL.Clear;
          add('insert into kcxx(bm,sl) values(:pbm,:psl)');
        end;
      end;
      Parameters.ParamByName('pbm').value:=cxDBTextEdit2.Text;
      Parameters.ParamByName('psl').value:=cxTextEdit1.Text;
      ExecSQL;
      showmessage(#10#13+'编码:'+cxDBTextEdit2.Text+#10#13#10#13+
                  '数量:'+cxTextEdit1.Text+#10#13#10#13+'入库成功!');
    end;
    close;
  except
    Application.MessageBox('输入的进货数量必须为数字,请重新输入!!', '提示', MB_OK
      + MB_ICONSTOP);
    cxTextEdit1.text:='0';
  end;
end;

{------------------------------------
   检测库存中是否有此编码的信息
------------------------------------}
function checkrecord(field:string;qry:TADOQuery): Boolean;
begin
  with qry do begin
    Close;
    with sql do begin
      clear;
      add('select * from kcxx where bm=:pbm');
    end;
    Parameters.ParamByName('pbm').value:=field;
    active:=true;
    if qry.RecordCount>0 then
      Result:=true
    else
      Result:=false;
  end;
end;

procedure TFrminadd.cxTextEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then  begin
     cxButton2.Click;
     cxbutton2.SetFocus;
  end;
end;

procedure TFrminadd.FormShow(Sender: TObject);
begin
  cxTextEdit1.Clear;
end;

end.

⌨️ 快捷键说明

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