procedure TMainPostForm.BBtn_PostClick(Sender: TObject);
var
s_fullname:
string;
sqltext1, sqltext2:
string;
begin
with MainDataModule.ZQueryTemp
do
begin
SQL.Clear;
SQL.Text := '
SELECT count(*) from buchungen where serialnumber = ''
' + LEdt_Serialnumber.Text + '
''
;';
Open;
Active := true;
if (
not RBtn_Lager.Checked)
and (
not RBtn_Schrott.Checked)
then
if Fields[0].AsInteger = 1
then
s_fullname := LEdt_Fullname.Text
else
s_fullname := LEdt_Fullname.Text
else
begin
if RBtn_Lager.Checked
then
s_fullname := rsLagerStg;
if RBtn_Schrott.Checked
then
s_fullname := rsSchrott;
end;
if Fields[0].AsInteger = 1
then
begin
sqltext1 := Format(s_toolexists, [s_fullname,
LEdt_UserID.Text, CB_Department.Text, LEdt_Room.Text,
CB_Company.Text, LEdt_CostCentre.Text, DateToStr(now),
GetCurrUserName, M_Comment.Lines.Text, LEdt_SerialNumber.Text]);
end
else
begin
sqltext1 := s_toolcreate1 + #13#10 + Format(s_toolcreate2, [s_fullname,
LEdt_UserID.Text, CB_Department.Text, LEdt_Room.Text,
CB_Company.Text, CB_Department.Text, copy(LEdt_UserID.Text, 1, 2)]);
sqltext2 := Format(s_toolcreate3, [LEdt_ProductID.Text,
LEdt_ProductID.Text, LEdt_SerialNumber.Text, DateToStr(now),
GetCurrUserName, M_Comment.Lines.Text]);
end;
Active := false;
end;
with MainDataModule.ZQuery
do
begin
SQL.Clear;
SQL.Add(sqltext1);
SQL.Add(sqltext2);
SQL.SaveToFile('
D:\Buchungen.txt');
ExecSQL;
end;
close;
end;