Unit4.~pas
资源名称:HIS.rar [点击查看]
上传用户:fjdqny
上传日期:2016-10-26
资源大小:6299k
文件大小:3k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit4;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, DBCtrls, Grids, DBGrids, DB, ADODB;
- type
- TForm4 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Label7: TLabel;
- Edit1: TEdit;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Edit5: TEdit;
- Edit7: TEdit;
- Label8: TLabel;
- Edit8: TEdit;
- Label9: TLabel;
- Edit9: TEdit;
- Button1: TButton;
- Button2: TButton;
- DBGrid1: TDBGrid;
- Button3: TButton;
- Button4: TButton;
- Label6: TLabel;
- Edit6: TEdit;
- 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
- Form4: TForm4;
- Senno,Chano,Patno,Pat,Docno,Doc,Med,Su,Uprice:Char;
- implementation
- {$R *.dfm}
- procedure TForm4.Button1Click(Sender: TObject);
- begin
- if (Edit1.Text<>'') and (Edit2.text<>'') and (Edit3.text<>'')and (Edit5.text<>'')and (Edit7.text<>'') then
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('insert into fayaodan(Senno,Chano,Patno,Pat,Docno,Doc,Med,Su,Uprice) values(:Senno,:Chano,:Patno,:Pat,:Docno,:Doc,:Med,:Su,:Uprice)');
- adoquery1.Parameters.ParamByName('Senno').Value:=Edit1.Text;
- adoquery1.Parameters.ParamByName('Chano').Value:=Edit2.Text;
- adoquery1.Parameters.ParamByName('Patno').Value:=Edit3.Text;
- adoquery1.Parameters.ParamByName('Pat').Value:=Edit4.Text;
- adoquery1.Parameters.ParamByName('Docno').Value:=Edit5.Text;
- adoquery1.Parameters.ParamByName('Doc').Value:=Edit6.Text;
- adoquery1.Parameters.ParamByName('Med').Value:=Edit7.Text;
- adoquery1.Parameters.ParamByName('Su').Value:=strtoint(Edit8.Text);
- adoquery1.Parameters.ParamByName('Uprice').Value:=strtoint(Edit9.Text);
- adoquery1.ExecSQL;
- adoquery1.Close;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('select Med,Su,Uprice from fayaodan where Senno='''+edit1.Text+'''');
- adoquery1.Open;
- Edit7.Clear; Edit8.Clear;Edit9.Clear;
- showmessage('数据已经添加成功!');
- end
- else
- if (Edit1.Text='') then
- showmessage('请输入发药单编号!')
- else
- if (Edit2.Text='') then
- showmessage('请输入收费单编号!')
- else
- if (Edit3.Text='') then
- showmessage('请输入病人编号!')
- else
- if (Edit5.Text='') then
- showmessage('请输入医生编号!')
- else
- if (Edit7.Text='') then
- showmessage('请输入药品名!');
- end;
- procedure TForm4.Button2Click(Sender: TObject);
- begin
- Edit1.Clear; Edit2.Clear;Edit3.Clear;Edit4.Clear; Edit5.Clear;Edit6.Clear;Edit7.Clear; Edit8.Clear;Edit9.Clear;
- end;
- procedure TForm4.Button3Click(Sender: TObject);
- begin
- if (Edit1.Text='') then
- showmessage('没有药单号,发药失败!')
- else
- showmessage('发药成功!')
- end;
- procedure TForm4.Button4Click(Sender: TObject);
- begin
- form4.Close;
- end;
- end.