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

📄 formzhuancang.~pas

📁 这是一个关于药品进销存的管理软件
💻 ~PAS
字号:
unit FormZhuancang;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ADODB, DB;

type
  Tzhuancang = class(TForm)
    GroupBox1: TGroupBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Edit15: TEdit;
    Label15: TLabel;
    GroupBox2: TGroupBox;
    Edit16: TEdit;
    Label16: TLabel;
    Button1: TButton;
    Button2: TButton;
    ADOQuery1: TADOQuery;
    ADOCommand1: TADOCommand;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  zhuancang: Tzhuancang;

implementation

uses FormCangkuxinxi;

{$R *.dfm}

procedure Tzhuancang.Button1Click(Sender: TObject);
begin
cangkuxinxi.Show;
end;

procedure Tzhuancang.Button2Click(Sender: TObject);
var
pihao,b4,b3,b2,a0,a7,a1,a2,a3,a4,a5,a6,b1:string;
temp:integer;
kucunshuliang,jine:double;
begin
temp:=strtoint(edit15.Text);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select 入库编号,药品编号,剂型编号,类别编号,业务员编号,供应商编号,加成率,备注 from 库存信息 where 批号='''+edit3.Text+'''';
adoquery1.Open;
//showmessage('hello');
a7:=adoquery1.fieldbyname('入库编号').AsString;

a1:=adoquery1.fieldbyname('药品编号').AsString;
//showmessage(floattostr(a1));
a2:=adoquery1.fieldbyname('剂型编号').AsString;
a3:=adoquery1.fieldbyname('类别编号').AsString;

a5:=adoquery1.fieldbyname('业务员编号').AsString;
a6:=adoquery1.fieldbyname('供应商编号').AsString;
b2:=adoquery1.fieldbyname('加成率').AsString;
b4:=adoquery1.fieldbyname('备注').AsString;
//showmessage('hello');
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select max(库存编号) as 最大库存编号 from 库存信息';
adoquery1.Open;
a0:=adoquery1.fieldbyname('最大库存编号').AsString;

a0:=inttostr(strtoint(a0)+1);
//showmessage('hello');
b3:=floattostr(strtofloat(b2)*strtofloat(edit13.Text));
adoquery1.close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:='select 批号,库存数量 from 库存信息查询 where 仓库名称='''+edit16.Text+''' and 供应商名称='''+edit5.text+''' and 规格='''+edit6.Text+''' and 批准文号='''+edit12.Text+'''';
adoquery1.Open;
pihao:=adoquery1.fieldbyname('批号').AsString;
kucunshuliang:=adoquery1.fieldbyname('库存数量').AsInteger;
//showmessage('hello');
if pihao=edit3.Text then
  begin
  showmessage('hello');
    kucunshuliang:=kucunshuliang-temp;
    jine:=kucunshuliang*strtofloat(edit13.Text);
    adocommand1.CommandText:='update 库存信息 set 库存数量=d1,库存金额=d2 where 批号='''+edit3.text+''' and 仓库编号=d3';
    adocommand1.Parameters.ParamByName('d1').Value:=kucunshuliang;
    adocommand1.Parameters.ParamByName('d2').Value:=jine ;
    adocommand1.Execute;
  end;
if pihao<>edit3.Text then
  begin
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Text:='select 仓库编号 from 仓库信息 where  仓库名称='''+edit16.Text+'''';
  adoquery1.Open;

  a4:=adoquery1.fieldbyname('仓库编号').AsString;
  b1:=floattostr(strtofloat(edit15.Text)*strtofloat(edit13.Text));
   showmessage(a1);

  adocommand1.CommandText:='insert into 库存信息 ([库存编号],[入库编号],[药品编号],[剂型编号],[类别编号],[仓库编号],[业务员编号],[供应商编号],[单位],[批号]) values('''+a0+''','''+a7+''','''+a1+''','''+a2+''','''+a3+''','''+a4+''','''+a5+''','''+a6+''','''+edit7.Text+''','''+edit3.Text+''')';
//  adocommand1.Parameters.ParamByName('f0').Value:=a0;
 // adocommand1.Parameters.ParamByName('f16').Value:=a7;
//  adocommand1.Parameters.ParamByName('f1').Value:=a1;
//  adocommand1.Parameters.ParamByName('f2').Value:=a2;
//  adocommand1.Parameters.ParamByName('f3').Value:=a3;
//  adocommand1.Parameters.ParamByName('f4').Value:=a4;
//  adocommand1.Parameters.ParamByName('f5').Value:=a5;
//  adocommand1.Parameters.ParamByName('f6').Value:=a6;
//  adocommand1.Parameters.ParamByName('f7').Value:=edit7.Text;
//  adocommand1.Parameters.ParamByName('f8').Value:=edit3.Text;

  adocommand1.CommandText:='insert into 库存信息 ([进价],[库存数量],[库存金额],[加成率],[预售价],[有效期至],[备注]) values('''+edit13.Text+''','''+edit4.Text+''','''+b1+''','''+b2+''','''+b3+''','''+edit8.Text+''','''+b4+''')';
//  adocommand1.Parameters.ParamByName('f9').Value:=edit13.Text;
//  adocommand1.Parameters.ParamByName('f10').Value:=edit4.Text;
//  adocommand1.Parameters.ParamByName('f11').Value:=b1;
//  adocommand1.Parameters.ParamByName('f12').Value:=b2;
//  adocommand1.Parameters.ParamByName('f13').Value:=b3;
 // adocommand1.Parameters.ParamByName('f14').Value:=edit8.Text;
//  adocommand1.Parameters.ParamByName('f15').Value:=b4;
  adocommand1.Execute;


  end;

end;
end.

⌨️ 快捷键说明

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