📄 xsh_unit.pas
字号:
jh_ghs_find_form.DBGrid2.Visible := false;
jh_ghs_find_form.DBGrid3.Visible := true;
jh_ghs_find_form.DBGrid4.Visible := false;
end;
procedure Txsh_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 := false;
jh_yg_find_form.DBGrid2.Visible := false;
jh_yg_find_form.DBGrid3.Visible := true;
jh_yg_find_form.DBGrid4.Visible := false;
jh_yg_find_form.DBGrid5.Visible := false;
jh_yg_find_form.DBGrid6.Visible := false;
end;
procedure Txsh_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 := false;
jh_sp_find_form.DBGrid2.Visible := false;
jh_sp_find_form.DBGrid3.Visible := false;
jh_sp_find_form.DBGrid4.Visible := true;
//jh_sp_find_form.DBGrid1.Visible :=false;
end;
procedure Txsh_form.Edit4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton11click(nil);
end;
procedure Txsh_form.Edit6KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton1click(nil);
end;
procedure Txsh_form.Edit13KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit14.SetFocus;
end;
procedure Txsh_form.Edit13KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9', '.', #8, #13]) then
begin
showmessage('请正确输入数值');
key := #0;
edit13.SetFocus;
end;
end;
procedure Txsh_form.Edit14KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9', '.', #8, #13]) then
begin
showmessage('请正确输入数值');
key := #0;
edit14.SetFocus;
end;
end;
procedure Txsh_form.Edit14KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
speedbutton15click(nil);
end;
procedure Txsh_form.SpeedButton5Click(Sender: TObject);
begin
jh_ghs_find_form := Tjh_ghs_find_form.create(application);
jh_ghs_find_form.show;
jh_ghs_find_form.DBGrid1.Visible := false;
jh_ghs_find_form.DBGrid2.Visible := false;
jh_ghs_find_form.DBGrid3.Visible := false;
jh_ghs_find_form.DBGrid4.Visible := true;
end;
procedure Txsh_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 := false;
jh_yg_find_form.DBGrid3.Visible := false;
jh_yg_find_form.DBGrid4.Visible := true;
jh_yg_find_form.DBGrid5.Visible := false;
jh_yg_find_form.DBGrid6.Visible := false;
end;
procedure Txsh_form.Edit5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_return then
edit6.SetFocus;
end;
procedure Txsh_form.SpeedButton19Click(Sender: TObject);
begin
with database do
begin
adoq1.Connection := adoc;
adoq1.SQL.Clear;
adoq1.SQL.Add('select 单据编码,录单日期,供货商名称,经手人,备注,商品简码,商品编码,商品名称,类别,规格,型号,单位 from xshd');
adoq1.Active := true;
FrmMain.AddData(LV, adoq1);
statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
end;
end;
procedure Txsh_form.SpeedButton16Click(Sender: TObject);
begin
xsh_find_form := Txsh_find_form.create(application);
xsh_find_form.show;
end;
procedure Txsh_form.SpeedButton7Click(Sender: TObject);
var
SqlStr: string;
ValueArray: array of string;
ArrayCount: Integer;
begin
try
if Edit18.text = '' then
begin
showmessage('销售单号为空,请填写');
Edit18.SetFocus;
Exit;
end;
if Edit15.text = '' then
begin
showmessage('单据编码为空,请填写');
Edit15.SetFocus;
Exit;
end;
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';
edit22.Text := floattostr(strtofloat(edit36.Text) +
strtofloat(edit20.Text));
edit26.Text := formatdatetime('yy-mm-dd', datetimepicker2.date);
edit28.Text := formatdatetime('MM-dd-yy', datetimepicker2.date);
//销售单信息的录入
SqlStr :=
'insert into xsfk (录单日期,单据编码,供货商名称,经手人,销售单号,发票类型,付款方式,本次付款,应付总金额,已付金额,未付金额,票号,备注) values(';
//通过函数InsStr把sql语句连接起来。组成一个完成的sql语句,通过ExceSql来完成添加操作。当增加操作失误时,返回事务处理。
FRMMAIN.InsStr(SqlStr, edit26.Text, ',');
FRMMAIN.InsStr(SqlStr, edit15.text, ',');
FRMMAIN.InsStr(SqlStr, edit16.text, ',');
FRMMAIN.InsStr(SqlStr, edit17.Text, ',');
FRMMAIN.InsStr(SqlStr, edit18.text, ',');
FRMMAIN.InsStr(SqlStr, combobox3.Text, ',');
FRMMAIN.InsStr(SqlStr, edit19.text, ',');
FRMMAIN.InsStr(SqlStr, edit20.text, ',');
FRMMAIN.InsStr(SqlStr, edit21.text, ',');
FRMMAIN.InsStr(SqlStr, edit22.text, ',');
FRMMAIN.InsStr(SqlStr, edit23.text, ',');
FRMMAIN.InsStr(SqlStr, edit24.text, ',');
FRMMAIN.InsStr(SqlStr, edit25.text, '');
//通过ExecSQL来完成修改和增加操作。若是错误,提醒用户,并且返回事务处理
if FRMMAIN.ExecSQL(SqlStr) then
else
begin
ShowMessage('对不起,销售单插入记录失败,请检查!');
exit;
end;
SetLength(ValueArray,12);
QryTemp.Close;
QryTemp.SQL.Text:='Select Max(编号) From xsfk';
QryTemp.Open;
Edit27.Text:=QryTemp.FieldByName('编号').AsString;
ValueArray[0] := edit27.text;
ValueArray[1] := edit26.text;
ValueArray[2] := edit16.text;
ValueArray[3] := edit17.text;
ValueArray[4] := edit18.text;
ValueArray[5] := combobox3.Text;
ValueArray[6] := edit19.text;
ValueArray[7] := edit20.text;
ValueArray[8] := edit21.text;
ValueArray[9] := edit22.text;
ValueArray[10] := edit23.text;
ValueArray[11] := edit24.text;
ArrayCount := 11;
FrmMain.AddListView(ValueArray, ArrayCount, lv1);
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;
except
showmessage('数据操作错误,请检查');
Exit;
end;
end;
procedure Txsh_form.SpeedButton13Click(Sender: TObject);
begin
if lv1.Items.Count = 0 then
begin
ShowMessage('记录集为空,不能够删除');
exit;
end;
if LV1.SelCount = 0 then
begin
ShowMessage('请选中一条要删除的记录');
exit;
end;
if MessageDlg('是否删除所选中的记录,请确定', mtConfirmation, [mbYes, mbNo], 0)
= mrYes then
begin
if FrmMain.ExecSQL('delete from xshd where 编号=''' + edit27.Text + '''')
then
else
begin
ShowMessage('删除记录时操作失误,记录未删除,请检查');
exit;
end;
end;
LV.Selected.Delete;
statusbar1.Panels[1].Text := inttostr(StrToInt(statusbar1.Panels[1].Text) -
1);
end;
procedure Txsh_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;
FrmMain.AddData(LV1,Adoq2);
statusbar2.Panels[1].Text := inttostr(adoq2.Recordset.RecordCount);
end;
end;
procedure Txsh_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 := false;
jh_jhdh_find_form.DBGrid2.Visible := false;
jh_jhdh_find_form.DBGrid3.Visible := true;
jh_jhdh_find_form.DBGrid4.Visible := true;
end;
procedure Txsh_form.SpeedButton12Click(Sender: TObject);
begin
xshfk_find_form := Txshfk_find_form.create(application);
xshfk_find_form.show;
end;
procedure Txsh_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 := false;
jh_sfkfs_find_form.DBGrid2.Visible := true;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -