procedure TUebersicht.TabSheet2Show(Sender: TObject);
var Cols: TCols;
Rows: TRows;
query:
string;
i: integer;
begin
if (Beobachten1.Cells[0,Beobachten1.row]<>'
ArtikelNr')
and (Beobachten1.Cells[0,Beobachten1.row]<>'
')
then
begin
query:='
select waaunr as FA_Nr, WAAUPO as FA_PO, WATENR as ArtikelNr, TEBEZ1 as Bezeichnung, '+
'
WAFEMG as FA_Menge, OAAGNR as AG, OAAGBZ as AG_Bezeichnung, OAMANR as Maschine, '+
'
OATLKZ as Fertig, REPLACE(FORMAT(OARMMG, 0),'+#39+'
,'+#39+'
,'+ #39+ '
.'+#39+'
) as R_Menge, '+
'
DATE_FORMAT(OARMDA,'+#39+'
%d.%m.%Y'+#39+'
) as R_Datum from as400 where waaunr= ' + Beobachten1.Cells[1,Beobachten1.row]+
'
order by OAAGNR';
MainUnit.connect;
MainUnit.ExecQuery(
DB,
query, cols, Rows);
MainUnit.disconnect;
MainUnit.FillGrid(DetailFA, Cols, Rows);
DetailFA.ColWidths[0]:=round(DetailFa.Width*0.057);
DetailFA.ColWidths[1]:=round(DetailFa.Width*0.050);
DetailFA.ColWidths[2]:=round(DetailFa.Width*0.077);
DetailFA.ColWidths[3]:=round(DetailFa.Width*0.180);
DetailFA.ColWidths[4]:=round(DetailFa.Width*0.087);
DetailFA.ColWidths[5]:=round(DetailFa.Width*0.043);
DetailFA.ColWidths[6]:=round(DetailFa.Width*0.197);
DetailFA.ColWidths[7]:=round(DetailFa.Width*0.087);
DetailFA.ColWidths[8]:=round(DetailFa.Width*0.045);
DetailFA.ColWidths[9]:=round(DetailFa.Width*0.082);
DetailFA.ColWidths[10]:=round(DetailFa.Width*0.082);
for i := 1
to DetailFA.RowCount - 1
do
begin
DetailFA.Cells[4,i]:=FormatFloat('
###,###,###', strtofloat(DetailFA.Cells[4,i])*1.0)
end;
if DetailFA.RowCount<2
then
detailFA.RowCount:=2;
DetailFA.FixedRows:=1;
end
else
begin
showmessage('
Es wurde kein Artikel in "Beobachtete FAs [Gesamt]" ausgewählt.');
MainUnit.ClearGrid(DetailFA);
end;
setlength(Cols,0);
setlength(rows,0,0);
end;