📄 hcckdnew.pas
字号:
begin
//if not txtshdj.Focused then
// txtshdj.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtdqkcExit(Sender: TObject);
begin
//if not txthydj.Focused then
// txthydj.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtjhdjExit(Sender: TObject);
begin
txtjhdj.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtcbdjExit(Sender: TObject);
begin
//if not txtcbdj.Focused then
// txtcbdj.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtjhjeExit(Sender: TObject);
begin
//if not txtcdbh.Focused then
// txtcdbh.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtqhbzExit(Sender: TObject);
begin
//if not txtqhbz.Focused then
// txtqhbz.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtjxcjlExit(Sender: TObject);
begin
//if not txtjxcjl.Focused then
// txtjxcjl.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtmaxExit(Sender: TObject);
begin
// if not txtmax.Focused then
// txtmax.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtjhslExit(Sender: TObject);
begin
txtjhsl.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtxhslExit(Sender: TObject);
begin
if not txtxhsl.Focused then
txtxhsl.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtlyklExit(Sender: TObject);
begin
//if not txtlykl.Focused then
// txtlykl.Color:=clwindow;
end;
procedure Tfrm_hcckdnew.txtspmcKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//TXTSPGG.SetFocus;
end;
procedure Tfrm_hcckdnew.txtspggKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtdw.SetFocus;
end;
procedure Tfrm_hcckdnew.txtdwKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtshdj.SetFocus;
end;
procedure Tfrm_hcckdnew.txtpckcKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txthydj.SetFocus;
end;
procedure Tfrm_hcckdnew.txtdqkcKeyPress(Sender: TObject; var Key: Char);
begin
//txtjhdj.SetFocus;
end;
procedure Tfrm_hcckdnew.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_hcckdnew.txtcbdjKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtcdbh.SetFocus;
end;
procedure Tfrm_hcckdnew.txtjhjeKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtqhbz.SetFocus;
end;
procedure Tfrm_hcckdnew.txtqhbzKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtjxcjl.SetFocus;
end;
procedure Tfrm_hcckdnew.txtjxcjlKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtmax.SetFocus;
end;
procedure Tfrm_hcckdnew.txtmaxKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//comspxz.SetFocus;
end;
procedure Tfrm_hcckdnew.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_hcckdnew.txtxhslKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
//txtlykl.SetFocus;
end;
procedure Tfrm_hcckdnew.txtlyklKeyPress(Sender: TObject; var Key: Char);
begin
//if key=#13 then
// button1.SetFocus;
end;
procedure Tfrm_hcckdnew.comspxzChange(Sender: TObject);
begin
//comspzt.SetFocus;
end;
procedure Tfrm_hcckdnew.comspztChange(Sender: TObject);
begin
//comczzt.SetFocus;
end;
procedure Tfrm_hcckdnew.combzqChange(Sender: TObject);
begin
//txtjhsl.SetFocus;
end;
procedure Tfrm_hcckdnew.sprcdnewadd;
var i,j:integer;
begin
//增加行数
frm_HCCKD.StringGrid1.RowCount:=frm_HCCKD.StringGrid1.RowCount+1;
for i:=1 to frm_HCCKD.StringGrid1.RowCount do
begin
if frm_HCCKD.StringGrid1.Cells[1,i]='' then
begin
frm_HCCKD.StringGrid1.Cells[1,i]:=trim(txtspbh.text);//编号
frm_HCCKD.StringGrid1.Cells[2,i]:=trim(txtspmc.Text);//名称
frm_HCCKD.StringGrid1.Cells[3,i]:=trim(txtspgg.text);//规格
frm_HCCKD.StringGrid1.Cells[4,i]:=trim(txtdw.text); //单位
frm_HCCKD.StringGrid1.Cells[5,i]:=trim(txtjhdj.text);//进货单价
frm_HCCKD.StringGrid1.Cells[6,i]:=trim(txtjhsl.text);//进货数量
frm_HCCKD.StringGrid1.Cells[7,i]:=trim(txtjhje.text);//进货金额
frm_HCCKD.StringGrid1.Cells[8,i]:=trim(txtpc.text);//进货金额
{frm_HCCKD.StringGrid1.Cells[1,i]:=trim(txtspbh.text); //编号
frm_HCCKD.StringGrid1.Cells[2,i]:=trim(txtspmc.Text); //名称
frm_HCCKD.StringGrid1.Cells[3,i]:=trim(txtspgg.text); //地质
frm_HCCKD.StringGrid1.Cells[4,i]:=trim(txtdw.text); //电话
frm_HCCKD.StringGrid1.Cells[5,i]:=trim(txtshdj.text); //传真
frm_HCCKD.StringGrid1.Cells[6,i]:=trim(txthydj.text); //状态
frm_HCCKD.StringGrid1.Cells[7,i]:=trim(txtjhdj.text); //邮政编码
frm_HCCKD.StringGrid1.Cells[8,i]:=trim(txtcbdj.text); //电报
frm_HCCKD.StringGrid1.Cells[9,i]:=trim(txtcdbh.text); //联系人
frm_HCCKD.StringGrid1.Cells[10,i]:=trim(txtqhbz.text); //开户
frm_HCCKD.StringGrid1.Cells[11,i]:=trim(txtjxcjl.text); //开户名称
frm_HCCKD.StringGrid1.Cells[12,i]:=trim(txtmax.text); //帐号
frm_HCCKD.StringGrid1.Cells[13,i]:=trim(comspxz.text); //帐号
frm_HCCKD.StringGrid1.Cells[14,i]:=trim(comspzt.text); //帐号
frm_HCCKD.StringGrid1.Cells[15,i]:=trim(comczzt.text); //帐号
frm_HCCKD.StringGrid1.Cells[16,i]:=trim(combzq.text); //帐号
frm_HCCKD.StringGrid1.Cells[17,i]:=trim(txtjhsl.text); //帐号
frm_HCCKD.StringGrid1.Cells[18,i]:=trim(txtxhsl.text); //帐号
frm_HCCKD.StringGrid1.Cells[19,i]:=trim(txtlykl.text); //帐号 }
txtclear;
break;
end;
end;
end;
procedure Tfrm_hcckdnew.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_hcckdnew.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_hcckdnew.txtspbhChange(Sender: TObject);
var sqlstr:string;
begin
if length(txtspbh.text)=4 then
begin
if checkhcbh(txtspbh.text)=true then exit;
sqlstr:='select a.dqkc as dqkc,a.hcbh,a.hcmc,b.pc,a.jldw,a.gg, '+
'b.pckc as pckc,b.jhdj '+
'from hcda a,pcb b where a.hcbh=b.hcbh and a.hcbh='''+trim(txtspbh.text)+''' and '+
'b.csbh='''+copy(trim(frm_HCCKD.txtcsbh.items[frm_HCCKD.txtcsbh.itemindex]),1,4)+''' and '+
'b.pckc>0 order by b.pc,a.hcbh';
with data do
begin
aq1.Connection :=adoc1;
with aq1 do
begin
//检查此耗材是否属于此供应商
close;
sql.Clear;
sql.Add(sqlstr);
//aq1.Parameters.ParamByName('hcbh').Value:=trim(txtspbh.text);
//aq1.Parameters.ParamByName('csbh').Value:=
//copy(trim(frm_HCCKD.txtcsbh.items[frm_HCCKD.txtcsbh.itemindex]),1,4);
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;
txtpckc.text:=aq1.Fields.Fieldbyname('pckc').Value;
txtpc.text:=aq1.Fields.Fieldbyname('pc').Value;
dbgrid1.visible:=false;
txtjhdj.SetFocus;
txtjhdj.color:=clskyblue;
end
else
begin
dbgrid1.visible:=false;
showmessage('不存在');
//txtspbh.setfoucs;
txtspbh.color:=clskyblue;
txtspbh.selectall;
exit;
end;
end;
end;
end;
end;
procedure Tfrm_hcckdnew.Button4Click(Sender: TObject);
begin
with data do
begin
screen.Cursor:=crHourGlass;
aq1.close;
aq1.SQL.Clear;
aq1.SQL.Add('select a.hcbh as 耗材编号,a.hcmc as 耗材名称,b.pc as 批次 '+
'from hcda a,pcb b where a.hcbh=b.hcbh and '+
'b.csbh='''+copy(trim(frm_HCCKD.txtcsbh.items[frm_HCCKD.txtcsbh.itemindex]),1,4)+''' and '+
'b.pckc>0 order by b.pc,a.hcbh');
//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;
aq1.FieldByName('批次').DisplayWidth:=2;
dbgrid1.Visible:=true;
datasource1.DataSet:=aq1;
dbgrid1.DataSource:=datasource1;
end;
end;
screen.Cursor:=crDefault;
end;
procedure Tfrm_hcckdnew.DBGrid1DblClick(Sender: TObject);
var sqlstr:string;
begin
sqlstr:='select a.dqkc,a.hcbh as 耗材编号,a.hcmc as 耗材名称,a.jldw,a.gg'+
' b.pc,b.pckc,b.jhdj from hcda a,pcb b '+
' where a.hcbh=b.hcbh and a.hcbh='''+trim(txtspbh.text)+''' and '+
' b.csbh='''+copy(trim(frm_HCCKD.txtcsbh.items[frm_HCCKD.txtcsbh.itemindex]),1,4)+''' and '+
' b.pckc>0 order by b.pc,a.hcbh';
if dbgrid1.SelectedField.FieldName='耗材编号' then
begin
txtspbh.Text:=dbgrid1.SelectedField.AsString;
//检查是否重复
if checkhcbh(txtspbh.text)=true then exit end
else
begin
with data do
begin
aq1.Connection:=adoc1;
screen.Cursor:=crHourGlass;
aq1.close;
aq1.SQL.Clear;
aq1.SQL.Add(sqlstr);
//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('耗材名称').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;
txtpckc.text:=aq1.Fields.Fieldbyname('pckc').Value;
txtpc.text:=aq1.Fields.Fieldbyname('pc').Value;
end;
screen.Cursor:=crDefault;
txtspbh.color:=clwindow;
txtjhdj.SetFocus;
txtjhdj.SelectAll;
txtjhdj.Color:=clskyblue;
end;
dbgrid1.Visible:=false;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -