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

📄 hcckcx.~pas

📁 一个基于数据的药品行业管理系统,较全面,可供学习数据的开发人员参考消息
💻 ~PAS
字号:
unit hcckcx;

interface

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

type
  Tfrm_ckcx = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    txtzdrq: TEdit;
    txtdjbh: TEdit;
    txthcbh: TComboBox;
    txtcsbh: TComboBox;
    Label7: TLabel;
    txtbm: TComboBox;
    txtyg: TComboBox;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure hcbhcreate;
    procedure csbhcreate;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frm_ckcx: Tfrm_ckcx;

implementation

uses date1, HCCK;

{$R *.dfm}

procedure Tfrm_ckcx.hcbhcreate;
begin
txthcbh.Clear;
txthcbh.Items.Add(' ');
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from hcda');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
  while not aq1.Eof do
  begin
    txthcbh.Items.Add(aq1.Fields.Fieldbyname('hcbh').Value+'-'+aq1.Fields.Fieldbyname('hcmc').Value);
    aq1.Next;
  end;
end;
end;
end;

procedure Tfrm_ckcx.FormCreate(Sender: TObject);
begin
hcbhcreate;
csbhcreate;
with data do
begin
txtbm.Clear;
txtbm.Items.Add(' ');
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from bm order by bmbh');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
while not aq1.Eof do
begin
   txtbm.Items.Add(trim(aq1.Fields.Fieldbyname('bmbh').Value)+'-'+trim(aq1.FieldByName('bmmc').Value));
   aq1.Next;
end;
end;
txtyg.Clear;
txtyg.Items.Add(' ');
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from ygzl order by ygbh');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
while not aq1.Eof do
  begin
   txtyg.Items.Add(trim(aq1.Fields.Fieldbyname('ygbh').Value)+'-'+trim(aq1.FieldByName('ygmc').Value));
   aq1.Next;
  end;
end;

end;
end;

procedure Tfrm_ckcx.csbhcreate;
begin
txtcsbh.Clear;
txtcsbh.Items.Add(' ');
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from csda');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
  while not aq1.Eof do
  begin
    txtcsbh.Items.Add(aq1.Fields.Fieldbyname('csbh').Value+'-'+aq1.Fields.Fieldbyname('csmc').Value);
    aq1.Next;
  end;
end;
end;
end;

procedure Tfrm_ckcx.Button1Click(Sender: TObject);
var sqlstr,wherestr:string;
    i:integer;
begin
sqlstr:='select a.LYdh,a.hcbh,b.hcmc,b.gg,b.jldw,a.LYrq,a.zdrq,a.LYsl,'+
' a.jhdj,a.LYje,a.czybh,a.csbh,a.pc,b.dqkc,b.aqkc,a.bmbh,a.ygbh from '+
' hcda b,hcckd a where a.hcbh=b.hcbh';
wherestr:='';
if (txtcsbh.Text='') and (txtzdrq.Text='') and (txthcbh.Text='') and
   (txtbm.Text='') and (txtyg.Text='') and (txtdjbh.text='') then
   begin
   sqlstr:=sqlstr;
   wherestr:=wherestr;
   end
else
  begin
  if (txtcsbh.text<>'') then
  wherestr:=wherestr+' and a.csbh='+quotedstr(copy(trim(txtcsbh.text),1,4));
   if (txthcbh.text<>'') then
  wherestr:=wherestr+' and a.hcbh='+quotedstr(copy(trim(txthcbh.text),1,4));
   if (txtbm.ItemIndex<>0) and (txtbm.itemindex<>-1) then
  wherestr:=wherestr+' and a.bmbh='+quotedstr(copy(trim(txtbm.Items[txtbm.itemindex]),1,2));
  if (txtyg.ItemIndex<>0) and (txtyg.itemindex<>-1) then
  wherestr:=wherestr+' and a.ygbh='+quotedstr(copy(trim(txtyg.Items[txtyg.itemindex]),1,4));
   if (txtdjbh.text<>'') then
  wherestr:=wherestr+' and a.djbh='+quotedstr(trim(txtdjbh.text));
  end;
sqlstr:=sqlstr+wherestr;
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add(sqlstr);
aq1.Open;
if aq1.Recordset.RecordCount=0 then begin showmessage('没有符合条件的纪录');exit;end;
frm_hcck.stringgrid1.RowCount:=aq1.Recordset.RecordCount+1;
frm_hcck.StatusBar1.Panels[1].Text:=inttostr(aq1.Recordset.RecordCount);
frm_hcck.stringgrid1.Font.Color:=clblack;
while not aq1.Eof do
begin
for i:=1 to frm_hcck.stringgrid1.RowCount do
begin
frm_hcck.stringgrid1.Cells[1,i]:=aq1.Fields.fieldbyname('lydh').Value;// 进货单号
frm_hcck.stringgrid1.Cells[2,i]:=aq1.Fields.fieldbyname('hcbh').Value; //耗材编号
frm_hcck.stringgrid1.Cells[3,i]:=aq1.Fields.fieldbyname('hcmc').Value; //耗材名称
frm_hcck.stringgrid1.Cells[4,i]:=aq1.Fields.fieldbyname('lysl').Value; //进货数量
frm_hcck.stringgrid1.Cells[5,i]:=aq1.Fields.fieldbyname('lyrq').Value; //进货日期
frm_hcck.stringgrid1.Cells[6,i]:=aq1.Fields.fieldbyname('czybh').Value;   //操作员
frm_hcck.stringgrid1.Cells[7,i]:=aq1.Fields.fieldbyname('csbh').Value; // 供应商
frm_hcck.stringgrid1.Cells[8,i]:=aq1.Fields.fieldbyname('jhdj').Value; // 进货价格
frm_hcck.stringgrid1.Cells[9,i]:=aq1.Fields.fieldbyname('lyje').Value;//   进货金额
frm_hcck.stringgrid1.Cells[10,i]:=aq1.Fields.fieldbyname('pc').Value;  //批次
frm_hcck.stringgrid1.Cells[11,i]:=aq1.Fields.fieldbyname('zdrq').Value;//制单日期
frm_hcck.stringgrid1.Cells[12,i]:=aq1.Fields.fieldbyname('gg').Value;  //gg
frm_hcck.stringgrid1.Cells[13,i]:=aq1.Fields.fieldbyname('jldw').Value;//jldw
frm_hcck.stringgrid1.Cells[14,i]:=aq1.Fields.fieldbyname('dqkc').Value;//dqkc
frm_hcck.stringgrid1.Cells[15,i]:=aq1.Fields.fieldbyname('aqkc').Value;// aqkc
frm_hcck.stringgrid1.Cells[16,i]:=aq1.Fields.fieldbyname('bmbh').Value; //bmbh
frm_hcck.stringgrid1.Cells[17,i]:=aq1.Fields.fieldbyname('ygbh').Value; //ygbh
aq1.Next;
end;
end;
frm_hcck.txtjhdh.Text:=frm_hcck.stringgrid1.Cells[1,1]; // 进货单号
frm_hcck.txthcbh.Text:=frm_hcck.stringgrid1.Cells[2,1];  //耗材编号
frm_hcck.txthcmc.text:=frm_hcck.stringgrid1.Cells[3,1];
frm_hcck.txtjhsl.Text:=frm_hcck.stringgrid1.Cells[4,1];  // 进货数量
frm_hcck.txtjhrq.Text:=frm_hcck.stringgrid1.Cells[5,1]; // 进货日期
frm_hcck.txtczy.Text:=frm_hcck.stringgrid1.Cells[6,1]; //操作员
frm_hcck.txtcsbh.Text:=frm_hcck.stringgrid1.Cells[7,1];     // 供应商
frm_hcck.txtjhdj.Text:=frm_hcck.stringgrid1.Cells[8,1];     //进货价格
frm_hcck.txtjhje.Text:=frm_hcck.stringgrid1.Cells[9,1];     //进货金额
frm_hcck.txtpc.Text:=frm_hcck.stringgrid1.Cells[10,1];      //批次
frm_hcck.txtjhrq.Text:=frm_hcck.stringgrid1.Cells[11,1];        // 制单日期
frm_hcck.txtgg.text:=frm_hcck.stringgrid1.Cells[12,1];
frm_hcck.txtdw.text:=frm_hcck.stringgrid1.Cells[13,1];
frm_hcck.txtdqkc.text:=frm_hcck.stringgrid1.Cells[14,1];
frm_hcck.txtaqkc.text:=frm_hcck.stringgrid1.Cells[15,1];
frm_hcck.txtbm.text:=frm_hcck.stringgrid1.Cells[16,1];
frm_hcck.txtyg.text:=frm_hcck.stringgrid1.Cells[17,1];
end;
end;
end.

⌨️ 快捷键说明

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