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

📄 hcxx.~pas

📁 一个基于数据的药品行业管理系统,较全面,可供学习数据的开发人员参考消息
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
   messagedlg('耗材单价不能为空',mtinformation,[mbok],1);
   txtjhdj.SetFocus;
   txtjhdj.Color:=clskyblue;
   exit;
   end;
   if txtaqkc.text='' then
   begin
   messagedlg('安全库不能为空',mtinformation,[mbok],1);
   txtaqkc.SetFocus;
   txtaqkc.Color:=clskyblue;
   exit;
   end;
   {if txtlxr.text='' then
   begin
   messagedlg('联系人不能为空',mtinformation,[mbok],1);
   txtlxr.SetFocus;
   txtlxr.Color:=clskyblue;
   exit;
   end;}
   if editflag=1 then
   begin
   mation:='你需要修改此耗材信息吗';
   mation1:='此耗材信息已经改变;';
   if messagedlg(mation,mtinformation,[mbyes,mbno],0)=mrno then
   begin
    screen.Cursor:=crDefault;
    exit;
   end;
   end
   else
   begin
   mation:='要增加新的耗材信息吗?';
   mation1:='此耗材信息已经入库;';
   if messagedlg(mation,mtinformation,[mbyes,mbno],0)=mrno then
   begin
    screen.Cursor:=crDefault;
    exit;
   end;
   end;
   with data do
   begin
   aq1.Connection:=adoc1;
   adoc1.BeginTrans;
   screen.Cursor:=crHourGlass;
   //编辑时
   if editflag=1 then
   begin
   aq1.Close;
   aq1.SQL.Clear;
   aq1.SQL.Add('delete from hcda where hcbh=:hcbh');
   aq1.Parameters.ParamByName('hcbh').Value:=trim(txthcbh.text);
   aq1.ExecSQL;
   end
   else
   hcbhcreate;
   aq1.Close;
   aq1.SQL.Clear;
   aq1.SQL.Add('insert into hcda (hcbh,hcmc,jldw,gg,pc,dqkc,aqkc,csbh,jhdj) '+
              ' values (:hcbh,:hcmc,:jldw,:gg,:pc,:dqkc,:aqkc,:csbh,:jhdj)');
   aq1.Parameters.ParamByName('hcbh').Value:=trim(txthcbh.text);
   aq1.Parameters.ParamByName('hcmc').Value:=trim(txthcmc.text);
   aq1.Parameters.ParamByName('jldw').Value:=trim(txtdw.text);
   aq1.Parameters.ParamByName('gg').Value:=trim(txtgg.text);
   aq1.Parameters.ParamByName('pc').Value:=trim(txtpc.text);
   aq1.Parameters.ParamByName('dqkc').Value:=trim(txtdqkc.text);
   aq1.Parameters.ParamByName('aqkc').Value:=trim(txtaqkc.text);
   aq1.Parameters.ParamByName('csbh').Value:=copy(trim(txtcsbh.text),1,4);
   aq1.Parameters.ParamByName('jhdj').Value:=trim(txtjhdj.text);
   aq1.ExecSQL;
   adoc1.CommitTrans;
   messagedlg(mation1,mtinformation,[mbyes],1);
   editflag:=0;
   hcreflesh;
   screen.Cursor:=crDefault;
   end;
   aenabeld(3);
end;

procedure Tfrm_hcxx.hcreflesh;
var i:integer;
begin
for i:=1 to stringgrid1.RowCount-1 do
begin
stringgrid1.Rows[i].Clear;
end;
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from hcda order by hcbh');
aq1.Open;
if aq1.Recordset.RecordCount=0 then exit;
stringgrid1.RowCount:=aq1.Recordset.RecordCount+1;
frm_hcxx.StatusBar1.Panels[1].Text:=inttostr(aq1.Recordset.RecordCount);
stringgrid1.Font.Color:=clblack;
while not aq1.Eof do
begin
for i:=1 to stringgrid1.RowCount do
begin
stringgrid1.Cells[1,i]:=aq1.Fields.fieldbyname('csbh').Value;
stringgrid1.Cells[2,i]:=aq1.Fields.fieldbyname('hcbh').Value;
stringgrid1.Cells[3,i]:=aq1.Fields.fieldbyname('hcmc').Value;
stringgrid1.Cells[4,i]:=aq1.Fields.fieldbyname('jldw').Value;
stringgrid1.Cells[5,i]:=aq1.Fields.fieldbyname('gg').Value;
stringgrid1.Cells[6,i]:=aq1.Fields.fieldbyname('dqkc').Value;
stringgrid1.Cells[7,i]:=aq1.Fields.fieldbyname('jhdj').Value;
stringgrid1.Cells[8,i]:=aq1.Fields.fieldbyname('aqkc').Value;
stringgrid1.Cells[9,i]:=aq1.Fields.fieldbyname('pc').Value;
aq1.Next;
end;
txtcsbh.Text:=stringgrid1.Cells[1,1]; // 供应商
txthcbh.Text:=stringgrid1.Cells[2,1];  //耗材编号
txthcmc.Text:=stringgrid1.Cells[3,1];  // 耗材名称
txtdw.Text:=stringgrid1.Cells[4,1]; // 单位
txtgg.Text:=stringgrid1.Cells[5,1]; //规格
txtdqkc.Text:=stringgrid1.Cells[6,1];     // 当前库存
txtjhdj.Text:=stringgrid1.Cells[7,1];     //进货价格
txtaqkc.Text:=stringgrid1.Cells[8,1];      //安全库存
txtpc.Text:=stringgrid1.Cells[9,1];        // 批次

end;
aq1.Close;
end;
end;


procedure Tfrm_hcxx.tdelClick(Sender: TObject);
begin
if (stringgrid1.Focused) and (stringgrid1.Cells[1,mycell]<>'') and (mycell<>0) then
begin
with data do
begin
adoc1.BeginTrans;
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('delete from hcda where hcbh=:hcbh');
aq1.Parameters.ParamByName('hcbh').Value:=stringgrid1.Cells[2,mycell];
try
if messagedlg('确定删除此耗材信息吗?',mtinformation,[mbyes,mbno],0)=mrno then
  begin
  adoc1.RollbackTrans;
  exit;
  end;
   aq1.ExecSQL;
   adoc1.CommitTrans;
   messagedlg('此耗材信息已删除库',mtinformation,[mbyes],1);
   hcreflesh;
except
   showmessage('数据库连接错误');
   end;
end;
end
else
begin
showmessage('请选择纪录');
exit;
end;
end;
procedure Tfrm_hcxx.teditClick(Sender: TObject);
begin
if (stringgrid1.Focused) and (stringgrid1.Cells[1,mycell]<>'') and (mycell<>0) then
begin
aenabeld(1);
editflag:=1;
txtcsbh.Text:=stringgrid1.Cells[1,mycell]; // 供应商
txthcbh.Text:=stringgrid1.Cells[2,mycell]; //耗材编号
txthcmc.Text:=stringgrid1.Cells[3,mycell]; // 耗材名称
txtdw.Text:=stringgrid1.Cells[4,mycell];   // 单位
txtgg.Text:=stringgrid1.Cells[5,mycell];   //规格
txtdqkc.Text:=stringgrid1.Cells[6,mycell]; // 当前库存
txtjhdj.Text:=stringgrid1.Cells[7,mycell]; //进货价格
txtaqkc.Text:=stringgrid1.Cells[8,mycell]; //安全库存
txtpc.Text:=stringgrid1.Cells[9,mycell];   // 批次
txthcmc.SetFocus;
end
else
begin
showmessage('请选择纪录');
exit;
end;
end;
procedure Tfrm_hcxx.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
var i:integer;
begin
mycell:=arow;
if (stringgrid1.Focused) and (arow<>0) then
begin
for i:=0 to txtcsbh.Items.Count-1 do
begin
if copy(txtcsbh.Items[i],1,4)=trim(stringgrid1.Cells[1,mycell]) then
   txtcsbh.ItemIndex:=i;
end;        // 供应商
txtcsbh.Text:=stringgrid1.Cells[1,arow]; // 供应商
txthcbh.Text:=stringgrid1.Cells[2,arow];  //耗材编号
txthcmc.Text:=stringgrid1.Cells[3,arow];  // 耗材名称
txtdw.Text:=stringgrid1.Cells[4,arow]; // 单位
txtgg.Text:=stringgrid1.Cells[5,arow]; //规格
txtdqkc.Text:=stringgrid1.Cells[6,arow];     // 当前库存
txtjhdj.Text:=stringgrid1.Cells[7,arow];     //进货价格
txtaqkc.Text:=stringgrid1.Cells[8,arow];      //安全库存
txtpc.Text:=stringgrid1.Cells[9,arow];        // 批次
end;
end;

{procedure Tfrm_hcxx.txtaqkcExit(Sender: TObject);
begin
if not txtfax.Focused then
txtfax.Color:=clwindow;
end;

procedure Tfrm_hcxx.txtemailExit(Sender: TObject);
begin
if not txtemail.Focused then
txtemail.Color:=clwindow;
end;

procedure Tfrm_hcxx.txtjhdjExit(Sender: TObject);
begin
if not txthttp.Focused then
txthttp.Color:=clwindow;
end;

procedure Tfrm_hcxx.txthcmcMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
txtkhbh.Color:=clskyblue;
end;

procedure Tfrm_hcxx.TXTsfzKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
txtsfz.Color:=clskyblue;
tsave.Click;
end;
end;

procedure Tfrm_hcxx.TXTsfzExit(Sender: TObject);
begin
if not txtsfz.Focused then
txtsfz.Color:=clwindow;
end;

procedure Tfrm_hcxx.txtcsrqKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   begin
   txtphone.SetFocus;
   txtphone.Color:=clskyblue;
   end;
end;

procedure Tfrm_hcxx.txtaqkcKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   begin
   txtemail.SetFocus;
   txtemail.Color:=clskyblue;
   end;
end;

procedure Tfrm_hcxx.txtemailKeyPress(Sender: TObject; var Key: Char);
begin
 if key=#13 then
   begin
   txthttp.SetFocus;
   txthttp.Color:=clskyblue;
   end;
end; }

procedure Tfrm_hcxx.tcancelClick(Sender: TObject);
begin
aenabeld(3);
end;

{procedure Tfrm_hcxx.txtjhdjKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   begin
   txtsfz.SetFocus;
   txtsfz.Color:=clskyblue;
   end;
end; }

procedure Tfrm_hcxx.tfindClick(Sender: TObject);
begin
hcreflesh;
end;

procedure Tfrm_hcxx.txthcmcKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   perform(wm_nextdlgctl,0,0);
end;

procedure Tfrm_hcxx.txtdwKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   perform(wm_nextdlgctl,0,0);
end;

procedure Tfrm_hcxx.txtggKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   begin
   txtjhdj.SetFocus;
   end;
end;

procedure Tfrm_hcxx.txtjhdjKeyPress(Sender: TObject; var Key: Char);
begin
if key=#8  then key:=#8
else
if key='.' then key:='.'
else
if key=#13 then
  begin
  txtaqkc.SetFocus;
  
  end
  {if txtjhsl.text='' then
  begin
  showmessage('数量不能为空');
  txtjhje.Text:=floattostr(strtofloat(txtjhdj.Text)*strtofloat(txtjhsl.text));
  end}
else
if (key>'9') or (key<'0') then
   key:=#0;
end;



procedure Tfrm_hcxx.txtaqkcKeyPress(Sender: TObject; var Key: Char);
begin
if key=#8  then key:=#8
else
if key='.' then key:='.'
else
if key=#13 then
  begin
 tsave.Click;
  end
  {if txtjhsl.text='' then
  begin
  showmessage('数量不能为空');
  txtjhje.Text:=floattostr(strtofloat(txtjhdj.Text)*strtofloat(txtjhsl.text));
  end}
else
if (key>'9') or (key<'0') then
   key:=#0;
end;
procedure Tfrm_hcxx.txtpcKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
   tsave.Click;
end;

procedure Tfrm_hcxx.FormShow(Sender: TObject);
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_hcxx.hcbhcreate;
var s,s2:string;
begin
with data do
begin
   aq2.Connection:=adoc1;
   aq2.Close;
   aq2.SQL.Clear;
   aq2.sql.Add('select *  from hcda  order by hcbh');
   aq2.open;
   if aq2.Recordset.RecordCount=0 then
         begin
          s:='1000';
          end
        else
           begin
           aq2.Last;
           s2:=aq2.Fields.Fieldbyname('hcbh').value;
           s:=inttostr(strtoint(trim(s2))+1);
           end;
        txthcbh.text:=s;
        end;
end;

end.

⌨️ 快捷键说明

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