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

📄 sprcdnew.pas

📁 一个基于数据的药品行业管理系统,较全面,可供学习数据的开发人员参考消息
💻 PAS
📖 第 1 页 / 共 2 页
字号:
begin
 //if not txtspgg.Focused then
  //  txtspgg.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtdwExit(Sender: TObject);
begin
    // if not txtdw.Focused then
     //   txtdw.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtshdjExit(Sender: TObject);
begin
 //if not txtshdj.Focused then
 //   txtshdj.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtdqkcExit(Sender: TObject);
begin
 //if not txthydj.Focused then
  //  txthydj.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtjhdjExit(Sender: TObject);
begin
    txtjhdj.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtcbdjExit(Sender: TObject);
begin
 //if not txtcbdj.Focused then
  //  txtcbdj.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtjhjeExit(Sender: TObject);
begin
 //if not txtcdbh.Focused then
 //   txtcdbh.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtqhbzExit(Sender: TObject);
begin
 //if not txtqhbz.Focused then
  //  txtqhbz.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtjxcjlExit(Sender: TObject);
begin
//if not txtjxcjl.Focused then
  //  txtjxcjl.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtmaxExit(Sender: TObject);
begin
// if not txtmax.Focused then
  //  txtmax.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtjhslExit(Sender: TObject);
begin
    txtjhsl.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtxhslExit(Sender: TObject);
begin
 if not txtxhsl.Focused then
    txtxhsl.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtlyklExit(Sender: TObject);
begin
 //if not txtlykl.Focused then
 //   txtlykl.Color:=clwindow;
end;

procedure Tfrm_sprcnew.txtspmcKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//TXTSPGG.SetFocus;
end;

procedure Tfrm_sprcnew.txtspggKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtdw.SetFocus;
end;

procedure Tfrm_sprcnew.txtdwKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtshdj.SetFocus;
end;

procedure Tfrm_sprcnew.txtshdjKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txthydj.SetFocus;
end;

procedure Tfrm_sprcnew.txtdqkcKeyPress(Sender: TObject; var Key: Char);
begin
//txtjhdj.SetFocus;
end;

procedure Tfrm_sprcnew.txtjhdjKeyPress(Sender: TObject; var Key: Char);
begin
if key=#8  then key:=#8
else
if key='.' then key:='.'
else
if key=#13 then
  begin
  txtjhsl.enabled:=true;
  txtjhsl.SetFocus;
  txtjhsl.Color:=clskyblue;
  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_sprcnew.txtcbdjKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtcdbh.SetFocus;
end;

procedure Tfrm_sprcnew.txtjhjeKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtqhbz.SetFocus;
end;

procedure Tfrm_sprcnew.txtqhbzKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtjxcjl.SetFocus;
end;

procedure Tfrm_sprcnew.txtjxcjlKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtmax.SetFocus;
end;

procedure Tfrm_sprcnew.txtmaxKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//comspxz.SetFocus;
end;

procedure Tfrm_sprcnew.txtjhslKeyPress(Sender: TObject; var Key: Char);
begin
if key=#8  then key:=#8
else
if key=#13 then
  begin
  if txtjhsl.text='' then
  begin
  showmessage('数量不能为空');
  txtjhsl.SetFocus;
  exit;
  end;
  txtjhsl.Color:=clwindow;
  button1.SetFocus;
  end
else
if (key>'9') or (key<'0') then
   key:=#0;
end;

procedure Tfrm_sprcnew.txtxhslKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtlykl.SetFocus;
end;

procedure Tfrm_sprcnew.txtlyklKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
 // button1.SetFocus;
end;

procedure Tfrm_sprcnew.comspxzChange(Sender: TObject);
begin

//comspzt.SetFocus;
end;

procedure Tfrm_sprcnew.comspztChange(Sender: TObject);
begin

//comczzt.SetFocus;
end;

procedure Tfrm_sprcnew.combzqChange(Sender: TObject);
begin

//txtjhsl.SetFocus;
end;

procedure Tfrm_sprcnew.sprcdnewadd;
var i,j:integer;
begin
//增加行数
 frm_sprcd.StringGrid1.RowCount:=frm_sprcd.StringGrid1.RowCount+1;
 for i:=1 to frm_sprcd.StringGrid1.RowCount do
   begin
    if frm_sprcd.StringGrid1.Cells[1,i]='' then
     begin
     frm_sprcd.StringGrid1.Cells[1,i]:=trim(txtspbh.text);//编号
     frm_sprcd.StringGrid1.Cells[2,i]:=trim(txtspmc.Text);//名称
     frm_sprcd.StringGrid1.Cells[3,i]:=trim(txtspgg.text);//规格
     frm_sprcd.StringGrid1.Cells[4,i]:=trim(txtdw.text); //单位
     frm_sprcd.StringGrid1.Cells[5,i]:=trim(txtjhdj.text);//进货单价
     frm_sprcd.StringGrid1.Cells[6,i]:=trim(txtjhsl.text);//进货数量
     frm_sprcd.StringGrid1.Cells[7,i]:=trim(txtjhje.text);//进货金额
     {frm_sprcd.StringGrid1.Cells[1,i]:=trim(txtspbh.text); //编号
     frm_sprcd.StringGrid1.Cells[2,i]:=trim(txtspmc.Text); //名称
     frm_sprcd.StringGrid1.Cells[3,i]:=trim(txtspgg.text); //地质
     frm_sprcd.StringGrid1.Cells[4,i]:=trim(txtdw.text); //电话
     frm_sprcd.StringGrid1.Cells[5,i]:=trim(txtshdj.text); //传真
     frm_sprcd.StringGrid1.Cells[6,i]:=trim(txthydj.text); //状态
     frm_sprcd.StringGrid1.Cells[7,i]:=trim(txtjhdj.text);    //邮政编码
     frm_sprcd.StringGrid1.Cells[8,i]:=trim(txtcbdj.text);   //电报
     frm_sprcd.StringGrid1.Cells[9,i]:=trim(txtcdbh.text);    //联系人
     frm_sprcd.StringGrid1.Cells[10,i]:=trim(txtqhbz.text);    //开户
     frm_sprcd.StringGrid1.Cells[11,i]:=trim(txtjxcjl.text);   //开户名称
     frm_sprcd.StringGrid1.Cells[12,i]:=trim(txtmax.text);  //帐号
     frm_sprcd.StringGrid1.Cells[13,i]:=trim(comspxz.text);  //帐号
     frm_sprcd.StringGrid1.Cells[14,i]:=trim(comspzt.text);  //帐号
     frm_sprcd.StringGrid1.Cells[15,i]:=trim(comczzt.text);  //帐号
     frm_sprcd.StringGrid1.Cells[16,i]:=trim(combzq.text);  //帐号
     frm_sprcd.StringGrid1.Cells[17,i]:=trim(txtjhsl.text);  //帐号
     frm_sprcd.StringGrid1.Cells[18,i]:=trim(txtxhsl.text);  //帐号
     frm_sprcd.StringGrid1.Cells[19,i]:=trim(txtlykl.text);  //帐号 }
     txtclear;
     break;
    end;
   end; 
end;

procedure Tfrm_sprcnew.txtclear;
begin
   txtspbh.Clear;
   txtspmc.Clear;
   txtspgg.Clear;
   //txthydj.Clear;
   //txtshdj.Clear;
   txtjhdj.Clear;
   txtjhsl.Clear;
   txtjhje.Clear;
   txtdw.Clear;
   {txtqhbz.Clear;
   txtjxcjl.Clear;
   txtmax.Clear;
   txtjhsl.Clear;
   txtxhsl.Clear;
   txtlykl.Clear;}
end;
procedure Tfrm_sprcnew.txtjhslKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=8 then key:=8
else
if key=13 then key:=0
else
if (key>105) or (key>57) and (key<96) or (key<48)  then key:=0
else
//[/formatfloat('0.00',(StrTo1int(stringgrid1.Cells[6,X])*StrToFloat(stringgrid1.Cells[5,X])));   //计算合计金额
  // label7.Caption:=stringgrid1.Cells[7,X];}
txtjhje.Text:=formatfloat('0.00',strtofloat(txtjhdj.Text)*strtofloat(txtjhsl.text));
end;

procedure Tfrm_sprcnew.txtspbhChange(Sender: TObject);
begin
if length(txtspbh.text)=4 then
   begin
   if checkhcbh(txtspbh.text)=true then exit;
   with data do
    begin
    aq1.Connection :=adoc1;
    with aq1 do
    begin
    //检查此耗材是否属于此供应商
    close;
    sql.Clear;
    sql.Add('select * from hcda where hcbh=:hcbh and csbh=:csbh');
    aq1.Parameters.ParamByName('hcbh').Value:=trim(txtspbh.text);
    aq1.Parameters.ParamByName('csbh').Value:=
    copy(trim(frm_sprcd.txtcsbh.items[frm_sprcd.txtcsbh.itemindex]),1,4);
    open;
   if  aq1.Recordset.RecordCount>0 then
       begin
       txtspmc.text:=trim(aq1.fieldbyname('hcmc').value);
       txtspgg.text:=trim(aq1.fieldbyname('gg').value);
       txtdw.text:=trim(aq1.fieldbyname('jldw').value);
       txtjhdj.text:=trim(aq1.fieldbyname('jhdj').value);
       txtdqkc.text:=trim(aq1.fieldbyname('dqkc').value);
       txtjhdj.SetFocus;
       txtjhdj.color:=clskyblue;
       end
    else
       begin
       showmessage('不存在');
       //txtspbh.setfoucs;
       txtspbh.color:=clskyblue;
       txtspbh.selectall;
       exit;
       end;
    end;
    end;
end;
end;

procedure Tfrm_sprcnew.Button4Click(Sender: TObject);
begin
with data do
   begin
   screen.Cursor:=crHourGlass;
   aq1.close;
   aq1.SQL.Clear;
   aq1.SQL.Add('select hcbh as 耗材编号,hcmc as 耗材名称 from hcda '+
   ' where csbh='''+copy(trim(frm_sprcd.txtcsbh.items[frm_sprcd.txtcsbh.itemindex]),1,4)+'''');
   //aq1.Parameters.ParamByName('csbh').Value:=trim(txtcsbh.Text);
   aq1.Open;
   if aq1.Recordset.RecordCount>0 then
   begin
      aq1.FieldByName('耗材编号').DisplayWidth:=10;
      aq1.FieldByName('耗材名称').DisplayWidth:=50;
      dbgrid1.Visible:=true;
      datasource1.DataSet:=aq1;
      dbgrid1.DataSource:=datasource1;

   end;
   end;
   screen.Cursor:=crDefault;
end;

procedure Tfrm_sprcnew.DBGrid1DblClick(Sender: TObject);
begin
if dbgrid1.SelectedField.FieldName='耗材编号' then
   begin
   txtspbh.Text:=dbgrid1.SelectedField.AsString;
   if  checkhcbh(txtspbh.text)=true then exit end
   else
    with data do
   begin
   aq1.Connection:=adoc1;
   screen.Cursor:=crHourGlass;
   aq1.close;
   aq1.SQL.Clear;
   aq1.SQL.Add('select * from hcda where hcbh=:hcbh');
   aq1.Parameters.ParamByName('hcbh').Value:=copy(trim(txtspbh.Text),1,4);
   aq1.Open;
   if aq1.Recordset.RecordCount>0 then
   begin
   txtspmc.Text:=aq1.Fields.Fieldbyname('hcmc').Value;
   txtdw.Text:=aq1.Fields.Fieldbyname('jldw').Value;
   txtspgg.Text:=aq1.Fields.Fieldbyname('gg').Value;
   txtjhdj.Text:=aq1.Fields.Fieldbyname('jhdj').Value;
   txtdqkc.Text:=aq1.Fields.Fieldbyname('dqkc').Value;
   end;
   screen.Cursor:=crDefault;
   txtspbh.color:=clwindow;
   txtjhdj.SetFocus;
   txtjhdj.SelectAll;
   txtjhdj.Color:=clskyblue;
   end;
    dbgrid1.Visible:=false;
   end;


end.

⌨️ 快捷键说明

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