📄 hcckd.pas
字号:
' t1.jhdj,t1.lyje,a.czybh,a.csbh,t1.pc,c.csbh,a.flag,a.bmbh,a.ygbh from hcda b,'+
' hcckd0 a,csda c,hcckd1 t1 '+
' where t1.hcbh=b.hcbh and a.csbh=c.csbh and a.lydh=:lydh and a.lydh=t1.lydh '+
' order by a.lydh,t1.hcbh');
{//sql.Add(' select a.djbh,a.mcbh,a.bmbh,a.dlbh,a.xlbh,a.czybh,c.czymc,a.zdrq,a.flag,'+
' b.csbh,b.csmc,t1.spbh,t1.spmc,t1.spgg,t1.jldw,t1.shdj,t1.hydj,'+
' t1.jhdj,t1.cbdj,t1.cdbh,t1.aqcl,t1.jxcjl,t1.mxsl,t1.spxz,t1.state,'+
' t1.czsp,t1.bzsx,t1.jhtax,t1.xstax,t1.lykl,a.xzbh from sprcd01 a,sprcd02 t1, '+
' czyda c,csda b where a.csbh=b.csbh and a.djbh=:djbh and c.czybh=a.czybh'+
' and t1.djbh=a.djbh'); }
aq1.Parameters.ParamByName('lydh').Value:=frm_HCCKD.number[frm_HCCKD.nownumber];
//frm_HCCKD.ComboBox1.Items[frm_HCCKD.ComboBox1.Items.Count-1];
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
frm_HCCKD.txtjhdh.Text:=aq1.Fields.Fieldbyname('lydh').Value;
frm_HCCKD.txtzdrq.Text:=aq1.Fields.Fieldbyname('zdrq').Value;
frm_HCCKD.txtczybh.Text:=aq1.Fields.Fieldbyname('czybh').Value;
for i:=0 to txtcsbh.items.count-1 do
begin
if copy(txtcsbh.items[i],1,4)=aq1.Fields.Fieldbyname('csbh').Value then
txtcsbh.itemindex:=i;
end;
for i:=0 to frm_HCCKD.txtbm.items.count-1 do
begin
if copy(frm_HCCKD.txtbm.items[i],1,2)=trim(aq1.Fields.Fieldbyname('bmbh').Value) then
frm_HCCKD.txtbm.itemindex:=i;
end;
for i:=0 to frm_HCCKD.txtyg.items.count-1 do
begin
if copy(frm_HCCKD.txtyg.items[i],1,3)=trim(aq1.Fields.Fieldbyname('ygbh').Value) then
frm_HCCKD.txtyg.itemindex:=i;
end;
if trim(aq1.Fields.Fieldbyname('flag').Value)='0' then
frm_HCCKD.txtshflag.Text:='0-未审核';///aq1.Fields.Fieldbyname('csbh').Value;
if trim(aq1.Fields.Fieldbyname('flag').Value)='1' then
frm_HCCKD.txtshflag.Text:='1-已审核';
aq1.First;
frm_HCCKD.txtpc.Text:=aq1.Fields.Fieldbyname('pc').Value;
while not aq1.Eof do
begin
for i:=1 to StringGrid1.RowCount-2 do
stringgrid1.Rows[i].Clear;
frm_HCCKD.StringGrid1.RowCount:=aq1.Recordset.RecordCount+2;
for i:=1 to frm_HCCKD.StringGrid1.RowCount-2 do
begin
frm_HCCKD.StringGrid1.Cells[1,i]:=aq1.fields.fieldbyname('hcbh').value; //编号
frm_HCCKD.StringGrid1.Cells[2,i]:=aq1.fields.fieldbyname('hcmc').value; //名称
frm_HCCKD.StringGrid1.Cells[3,i]:=aq1.fields.fieldbyname('gg').value;//规格
frm_HCCKD.StringGrid1.Cells[4,i]:=aq1.fields.fieldbyname('jldw').value;//单位
frm_HCCKD.StringGrid1.Cells[5,i]:=aq1.fields.fieldbyname('jhdj').value; //进货单价
frm_HCCKD.StringGrid1.Cells[6,i]:=aq1.fields.fieldbyname('lysl').value; //进货数量
frm_HCCKD.StringGrid1.Cells[7,i]:=aq1.fields.fieldbyname('lyje').value; // 进货金额
frm_HCCKD.StringGrid1.Cells[8,i]:=aq1.fields.fieldbyname('pc').value; // 批号
aq1.Next;
end;
end;
end;
end;
end;
end;
end;
procedure Tfrm_HCCKD.Edit7Exit(Sender: TObject);
begin
//edit7.Color:=clwindow;
end;
procedure Tfrm_HCCKD.Edit9Exit(Sender: TObject);
begin
//edit9.Color:=clwindow;
end;
procedure Tfrm_HCCKD.Edit11Exit(Sender: TObject);
begin
//edit11.Color:=clwindow;
end;
procedure Tfrm_HCCKD.Edit13Exit(Sender: TObject);
begin
//if not edit13.Focused then
// edit13.Color:=clwindow;
end;
procedure Tfrm_HCCKD.Edit13Enter(Sender: TObject);
begin
//edit13.Color:=clskyblue;
end;
procedure Tfrm_HCCKD.Edit7Enter(Sender: TObject);
begin
//edit7.Color:=clskyblue;
end;
procedure Tfrm_HCCKD.Edit9Enter(Sender: TObject);
begin
//edit9.Color:=clskyblue;
end;
procedure Tfrm_HCCKD.Edit11Enter(Sender: TObject);
begin
// edit11.Color:=clskyblue;
end;
{procedure Tfrm_HCCKD.Edit7KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
with data do
begin
aq1.Connection:=adoc1;
with aq1 do
begin
close;
sql.Clear;
sql.Add('select * from csda where csbh=:csbh and state=:state');
aq1.Parameters.ParamByName('csbh').value:=trim(edit7.Text);
aq1.Parameters.ParamByName('state').value:='0';
aq1.Open;
if aq1.Recordset.RecordCount=0 then
begin
messagebox(frm_HCCKD.Handle,'此供应商不存在或此供应商状态不为正常状态','信息提示',0);
edit7.SetFocus;
edit7.SelectAll;
exit;
end;
edit8.Text:=aq1.Fields.Fieldbyname('csmc').value;
combobox1.SetFocus;
end;
end;
end;
end; }
procedure Tfrm_HCCKD.ComboBox1Change(Sender: TObject);
begin
//dit9.SetFocus;
end;
{procedure Tfrm_HCCKD.Edit9KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
with data do
begin
aq1.Connection:=adoc1;
with aq1 do
begin
close;
sql.Clear;
sql.Add('select * from bm where bmbh=:bmbh ');
aq1.Parameters.ParamByName('bmbh').value:=trim(edit9.Text);
aq1.Open;
if aq1.Recordset.RecordCount=0 then
begin
messagebox(frm_HCCKD.Handle,'此部门不存在','信息提示',0);
edit9.SetFocus;
edit9.SelectAll;
exit;
end;
edit10.Text:=aq1.Fields.Fieldbyname('bmmc').value;
edit11.SetFocus;
end;
end;
end;
end;
procedure Tfrm_HCCKD.Edit11KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
checkinput('dlbh',trim(edit11.Text));
edit12.Text:=dlmc;
with data do
begin
aq1.Connection:=adoc1;
with aq1 do
begin
close;
sql.Clear;
sql.Add('select * from dl where bmbh=:bmbh and dlbh=:dlbh ');
aq1.Parameters.ParamByName('bmbh').value:=trim(edit9.Text);
aq1.Parameters.ParamByName('dlbh').value:=trim(edit11.Text);
aq1.Open;
if aq1.Recordset.RecordCount=0 then
begin
messagebox(frm_HCCKD.Handle,'此大类不存在于此部门','信息提示',0);
edit11.SetFocus;
edit11.SelectAll;
exit;
end;
edit13.SetFocus;
end;
end;
end;
end;
procedure Tfrm_HCCKD.Edit13KeyPress(Sender: TObject; var Key: Char);
begin
checkinput('xlbh',trim(edit13.text));
edit14.Text:=xlmc;
end; }
procedure Tfrm_HCCKD.Edit7Change(Sender: TObject);
begin
{if length(edit7.Text)=4 then
begin
checkinput('csbh',trim(edit7.Text));
edit8.Text:=csmc;
end; }
end;
procedure Tfrm_HCCKD.txtczybhChange(Sender: TObject);
begin
begin
if length(txtczybh.Text)=4 then
begin
checkinput('czybh',trim(txtczybh.Text));
txtczymc.Text:=czymc;
end;
end;
end;
procedure Tfrm_HCCKD.Edit9Change(Sender: TObject);
begin
{if length(edit9.Text)=2 then
begin
checkinput('bmbh',trim(edit9.Text));
edit10.Text:=bmmc;
end; }
end;
procedure Tfrm_HCCKD.Edit11Change(Sender: TObject);
begin
{ if length(edit11.Text)=3 then
begin
checkinput('dlbh',trim(edit11.Text));
edit12.Text:=dlmc;
end; }
end;
procedure Tfrm_HCCKD.Edit13Change(Sender: TObject);
begin
{if length(edit13.Text)=3 then
begin
checkinput('xlbh',trim(edit13.Text));
edit14.Text:=xlmc;
end; }
end;
procedure Tfrm_HCCKD.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_HCCKD.bmcreate;
begin
txtbm.Clear;
txtbm.Items.Add(' ');
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from bm');
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.Fields.Fieldbyname('bmmc').Value));
aq1.Next;
end;
end;
end;
end;
procedure Tfrm_HCCKD.txtbmChange(Sender: TObject);
begin
txtyg.Clear;
txtyg.Items.Add(' ');
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from ygzl where bmbh='''+copy(txtbm.items[txtbm.itemindex],1,2)+'''');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
while not aq1.Eof do
begin
txtyg.Items.Add(aq1.Fields.Fieldbyname('ygbh').Value+'-'+aq1.Fields.Fieldbyname('ygmc').Value);
aq1.Next;
end;
end;
end;
end;
procedure Tfrm_HCCKD.ygcreate;
begin
txtyg.Clear;
txtyg.Items.Add(' ');
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from ygzl');
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.Fields.Fieldbyname('ygmc').Value));
aq1.Next;
end;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -