📄 jh_unit.pas
字号:
procedure Tjh_form.Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton10click(nil);
end;
procedure Tjh_form.SpeedButton11Click(Sender: TObject);
begin
jh_yg_find_form := Tjh_yg_find_form.create(application);
jh_yg_find_form.show;
jh_yg_find_form.DBGrid1.Visible := true;
jh_yg_find_form.DBGrid2.Visible := false;
jh_yg_find_form.DBGrid3.Visible := false;
jh_yg_find_form.DBGrid4.Visible := false;
jh_yg_find_form.DBGrid5.Visible := false;
jh_yg_find_form.DBGrid6.Visible := false;
end;
procedure Tjh_form.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit3.SetFocus;
end;
procedure Tjh_form.Edit5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit6.SetFocus;
end;
procedure Tjh_form.Edit4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton11click(nil);
end;
procedure Tjh_form.SpeedButton1Click(Sender: TObject);
begin
jh_sp_find_form := Tjh_sp_find_form.create(application);
jh_sp_find_form.show;
jh_sp_find_form.DBGrid1.Visible := true;
jh_sp_find_form.DBGrid2.Visible := false;
jh_sp_find_form.DBGrid3.Visible := false;
jh_sp_find_form.DBGrid4.Visible := false;
end;
procedure Tjh_form.Edit6KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton1click(nil);
end;
procedure Tjh_form.Edit13KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit14.SetFocus;
end;
procedure Tjh_form.Edit14KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton15click(nil);
end;
procedure Tjh_form.FormShow(Sender: TObject);
begin
if pagecontrol1.ActivePageIndex = 0 then
edit2.SetFocus;
if pagecontrol1.ActivePageIndex = 1 then
edit15.SetFocus;
end;
procedure Tjh_form.SpeedButton5Click(Sender: TObject);
begin
jh_ghs_find_form := Tjh_ghs_find_form.create(application);
jh_ghs_find_form.show;
end;
procedure Tjh_form.SpeedButton6Click(Sender: TObject);
begin
jh_yg_find_form := Tjh_yg_find_form.create(application);
jh_yg_find_form.show;
jh_yg_find_form.DBGrid1.Visible := false;
jh_yg_find_form.DBGrid2.Visible := true;
jh_yg_find_form.DBGrid3.Visible := false;
jh_yg_find_form.DBGrid4.Visible := false;
jh_yg_find_form.DBGrid5.Visible := false;
jh_yg_find_form.DBGrid6.Visible := false;
end;
procedure Tjh_form.SpeedButton14Click(Sender: TObject);
begin
close;
end;
procedure Tjh_form.SpeedButton8Click(Sender: TObject);
begin
jh_jhdh_find_form := Tjh_jhdh_find_form.Create(application);
jh_jhdh_find_form.Show;
jh_jhdh_find_form.DBGrid1.Visible := true;
jh_jhdh_find_form.DBGrid2.Visible := true;
jh_jhdh_find_form.DBGrid3.Visible := false;
jh_jhdh_find_form.DBGrid4.Visible := false;
end;
procedure Tjh_form.Edit18KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton8click(nil);
end;
procedure Tjh_form.SpeedButton9Click(Sender: TObject);
begin
jh_sfkfs_find_form := Tjh_sfkfs_find_form.Create(application);
jh_sfkfs_find_form.Show;
jh_sfkfs_find_form.DBGrid1.Visible := true;
jh_sfkfs_find_form.DBGrid2.Visible := false;
end;
procedure Tjh_form.SpeedButton7Click(Sender: TObject);
begin
if (length(edit15.Text) <> 0) and (length(edit18.Text) <> 0) then
begin
with database do
begin
adoq2.Connection := adoc;
if (length(edit20.Text) = 0) then edit20.Text := '0';
if (length(edit21.Text) = 0) then edit21.Text := '0';
if (length(edit22.Text) = 0) then edit22.Text := '0';
if (length(edit23.Text) = 0) then edit23.Text := '0';
if (length(edit36.Text) = 0) then edit36.Text := '0';
//edit23.Text :=floattostr(strtofloat(edit21.Text)-strtofloat(edit20.Text)-strtofloat(edit22.Text));
edit22.Text := floattostr(strtofloat(edit36.Text) + strtofloat(edit20.Text));
edit26.Text := formatdatetime('yy-mm-dd', datetimepicker2.date);
//edit27.Text :=formatdatetime('MM-dd-yy',datetimepicker2.date);
edit28.Text := formatdatetime('MM-dd-yy', datetimepicker2.date);
//edit35.Text :=formatdatetime('MM-dd-yy',datetimepicker2.date);
adoq2.SQL.Clear;
adoq2.SQL.Add('insert into jhfk(录单日期,单据编码,供货商名称,经手人,进货单号,发票类型,付款方式,本次付款,应付总金额,已付金额,未付金额,票号,备注) values(:ldrq,:djbm,:gysmc,:jsr,:jhdh,:fplx,:fkfs,:bcfk,:yfzje,:yfje,:wfje,:ph,:bz)');
adoq2.parameters.ParamByName('ldrq').value := edit26.Text;
adoq2.parameters.ParamByName('djbm').value := edit15.text;
adoq2.parameters.ParamByName('gysmc').value := edit16.text;
adoq2.Parameters.ParamByName('jsr').Value := edit17.Text;
adoq2.Parameters.ParamByName('jhdh').Value := edit18.text;
adoq2.parameters.ParamByName('fplx').value := combobox3.Text;
adoq2.parameters.ParamByName('fkfs').value := edit19.text;
adoq2.parameters.ParamByName('bcfk').value := strtofloat(edit20.text);
adoq2.Parameters.ParamByName('yfzje').Value := strtofloat(edit21.text);
adoq2.Parameters.ParamByName('yfje').Value := strtofloat(edit22.text);
adoq2.parameters.ParamByName('wfje').value := strtofloat(edit23.text);
adoq2.parameters.ParamByName('ph').value := edit24.text;
adoq2.parameters.ParamByName('bz').value := edit25.text;
adoq2.ExecSQL;
adoq2.SQL.Clear;
adoq2.SQL.Add('select * from jhfk where 录单日期 between #' + edit28.text + '# and #' + edit28.text + '#');
//adoq2.Parameters.ParamByName('djbm').Value :=edit2.Text;
adoq2.Active := true;
datas2.DataSet := adoq2;
dbgrid2.DataSource := datas2;
statusbar2.Panels[1].Text := inttostr(adoq2.Recordset.RecordCount);
edit15.Clear; edit16.Clear; edit17.Clear; edit18.Clear; edit19.clear; edit24.Clear; edit25.Clear;
combobox3.Text := '';
edit20.Text := '0'; edit21.Text := '0'; edit22.Text := '0';
edit23.Text := '0';
datetimepicker1.date := date;
edit15.SetFocus;
end;
end
else
begin
showmessage('请正确输入单据编码和进货单号!');
edit15.SetFocus
end;
end;
procedure Tjh_form.Edit15KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit16.SetFocus;
end;
procedure Tjh_form.Edit20KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit24.SetFocus;
end;
procedure Tjh_form.Edit24KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit25.SetFocus;
end;
procedure Tjh_form.Edit25KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton7click(nil);
end;
procedure Tjh_form.Edit16KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton5click(nil);
end;
procedure Tjh_form.Edit17KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton6click(nil);
end;
procedure Tjh_form.Edit19KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton9click(nil);
end;
procedure Tjh_form.ComboBox3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit19.SetFocus;
end;
procedure Tjh_form.SpeedButton20Click(Sender: TObject);
begin
with database do
begin
adoq2.Connection := adoc;
adoq2.SQL.Clear;
adoq2.SQL.Add('select * from jhfk order by 录单日期 ');
adoq2.Active := true;
datas2.DataSet := adoq2;
dbgrid2.DataSource := datas2;
statusbar2.Panels[1].Text := inttostr(adoq2.Recordset.RecordCount);
end;
end;
procedure Tjh_form.Edit18Exit(Sender: TObject);
begin
with database do
begin
adoq4.Connection := adoc;
adoq4.SQL.Clear;
adoq4.SQL.Add('select sum(金额) as je from jhd where 单据编码=:djbm');
adoq4.Parameters.ParamByName('djbm').Value := edit18.Text;
adoq4.Active := true;
if adoq4.Recordset.RecordCount > 0 then
edit21.Text := floattostr(adoq4.Fields.Fields[0].AsFloat);
adoq4.SQL.Clear;
adoq4.SQL.Add('select sum(已付金额) as je1 from jhfk where 进货单号=:jhdh');
adoq4.Parameters.ParamByName('jhdh').Value := edit18.Text;
adoq4.Active := true;
if adoq4.Recordset.RecordCount > 0 then
begin
edit22.Text := floattostr(adoq4.Fields.Fields[0].AsFloat);
edit36.Text := floattostr(adoq4.Fields.Fields[0].AsFloat);
end;
end;
end;
procedure Tjh_form.Edit20Exit(Sender: TObject);
begin
edit23.Text := floattostr(strtofloat(edit21.Text) - strtofloat(edit20.Text) - strtofloat(edit22.Text));
end;
procedure Tjh_form.Edit20KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9', '.', #8, #13]) then
begin
//showmessage('请正确输入数值');
key := #0;
// edit20.SetFocus;
end;
end;
procedure Tjh_form.SpeedButton13Click(Sender: TObject);
begin
with database do
begin
adoq1.Connection := adoc;
if application.MessageBox('是否真的删除?', '记录删除', 4) = 6 then
begin
if length(edit27.text) = 0 then showmessage('请刷新选择记录!');
adoq1.SQL.Clear;
adoq1.SQL.Add('delete from jhfk where 编号=:djbm ');
adoq1.Parameters.ParamByName('djbm').Value := edit27.Text;
adoq1.ExecSQL;
end;
adoq1.SQL.Clear;
adoq1.SQL.Add('select * from jhfk');
adoq1.Active := true;
datas2.DataSet := adoq1;
dbgrid2.DataSource := datas2;
statusbar2.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
end;
end;
procedure Tjh_form.DBGrid2CellClick(Column: TColumn);
begin
if dbgrid2.DataSource.DataSet.RecordCount > 0 then
begin
edit27.Text := dbgrid2.DataSource.DataSet.FieldValues['编号'];
edit38.Text := dbgrid2.DataSource.DataSet.FieldValues['单据编码'];
end;
end;
procedure Tjh_form.SpeedButton16Click(Sender: TObject);
begin
jh_jhd_find_form := Tjh_jhd_find_form.create(application);
jh_jhd_find_form.show;
end;
procedure Tjh_form.SpeedButton12Click(Sender: TObject);
begin
jh_fk_find_form := Tjh_fk_find_form.create(application);
jh_fk_find_form.show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -