Unit7.pas
资源名称:HIS.rar [点击查看]
上传用户:fjdqny
上传日期:2016-10-26
资源大小:6299k
文件大小:3k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit7;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, DB, ADODB;
- type
- TForm7 = class(TForm)
- Label1: TLabel;
- Edit1: TEdit;
- Label2: TLabel;
- Edit2: TEdit;
- Label3: TLabel;
- Edit3: TEdit;
- Label4: TLabel;
- Edit4: TEdit;
- Label5: TLabel;
- Edit5: TEdit;
- Label6: TLabel;
- Edit6: TEdit;
- Button1: TButton;
- Button2: TButton;
- DBGrid1: TDBGrid;
- Button3: TButton;
- Button4: TButton;
- ADOConnection1: TADOConnection;
- ADOQuery1: TADOQuery;
- DataSource1: TDataSource;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form7: TForm7;
- Outno,Druno,Stono,Medno,Med,Su:Char;
- implementation
- {$R *.dfm}
- procedure TForm7.Button1Click(Sender: TObject);
- begin
- if (Edit1.Text<>'') and (Edit2.text<>'') and (Edit3.text<>'') and (Edit4.text<>'') then
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('insert into yaofangchukudan(Outno,Druno,Stono,Medno,Med,Su) values(:Outno,:Druno,:Stono,:Medno,:Med,:Su)');
- adoquery1.Parameters.ParamByName('Outno').Value:=Edit1.Text;
- adoquery1.Parameters.ParamByName('Druno').Value:=Edit2.Text;
- adoquery1.Parameters.ParamByName('Stono').Value:=Edit3.Text;
- adoquery1.Parameters.ParamByName('Medno').Value:=Edit4.Text;
- adoquery1.Parameters.ParamByName('Med').Value:=Edit5.Text;
- adoquery1.Parameters.ParamByName('Su').Value:=strtoint(Edit6.Text);
- adoquery1.ExecSQL;
- adoquery1.Close;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('select Medno,Med,Su from yaofangchukudan where Outno='''+edit1.Text+'''');
- adoquery1.Open;
- Edit4.Clear; Edit5.Clear;Edit6.Clear;
- showmessage('数据已经添加成功!');
- end
- else
- if (Edit1.Text='') then
- showmessage('请输入出库单号!')
- else
- if (Edit2.Text='') then
- showmessage('请输入药房编号!')
- else
- if (Edit3.Text='') then
- showmessage('请输入药库编号!')
- else
- if (Edit4.Text='') then
- showmessage('请输入药品编号!');
- end;
- procedure TForm7.Button2Click(Sender: TObject);
- begin
- Edit1.Clear; Edit2.Clear;Edit3.Clear;Edit4.Clear; Edit5.Clear;Edit6.Clear;
- end;
- procedure TForm7.Button3Click(Sender: TObject);
- begin
- if (Edit1.Text='') then
- showmessage('没有出库单号,出库失败!')
- else
- showmessage('出库成功!')
- end;
- procedure TForm7.Button4Click(Sender: TObject);
- begin
- form7.Close;
- end;
- end.