Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TfmMain.BuildReport;
var
Id, P, LeftPos: integer;
begin
LeftPos := 0;
for P := 0 to grdStk.ColCount-1 do
begin
Id := ColsId[P];
if Visbl[Id] then
begin
PrtFld[P] := TQRLabel.Create(RptDetailBand); { if column is visible, create print field }
PrtFld[P].Parent := RptDetailBand; { must have a parent }
PrtFld[P].Left := LeftPos; { location of the column }
PrtFld[P].Width := grdStk.ColWidths[P];
if RJust[Id] then
PrtFld[P].Alignment := taRightJustify
else
PrtFld[P].Alignment := taLeftJustify;
prtColHdr[P] := TQRLabel.Create(prtHeaderBand); { similarly create column header }
prtColHdr[P].Parent := prtHeaderBand;
prtColHdr[P].Top := prtHeaderBand.Height - prtColHdr[P].Height;
prtColHdr[P].Left := LeftPos;
prtColHdr[P].Width := grdStk.ColWidths[P];
prtColHdr[P].Caption := grdStk.Cells[P,0];
if RJust[Id] then
PrtFld[P].Alignment := taRightJustify
else
PrtFld[P].Alignment := taLeftJustify;
LeftPos := LeftPos + grdStk.ColWidths[P] +12;{ calculate next column position }
end;
end;
RptGroupBand.Height := 0; { by default group headers not printed }
prtTotalValue.Caption := Format('%m',[(grdStk.Objects[colSeq,grdStk.RowCount-1] as TGrpTitle).GrpValue]);
prtHeading.Caption := 'STOCK VALUATION REPORT ' + FormatDateTime('dd mmm yyyy',ListDate);
grdStk.Row := 0;
end;
procedure TfmMain.qrStkNeedData(Sender: TObject; var MoreData: Boolean);
var
Id, P: integer;
begin
with grdStk do
if Row < RowCount-2 then
begin
MoreData := True;
Row := Row +1;
if not (Objects[colSeq,Row] as TGrpTitle).IsTitle then
RptGroupBand.Height := 0
else
begin
RptGroupBand.Height := 20;
prtGrpDescrip.Caption := (Objects[colSeq,Row] as TGrpTitle).Caption;
prtGrpValue.Caption := Format('%m',[(Objects[colSeq,Row] as TGrpTitle).GrpValue]);
Row := Row +1;
end;
for Id := 1 to ColCount-1 do
begin
P := Posn[Id];
if Visbl[Id] then
PrtFld[P].Caption := Cells[P,Row];
end
end
else
MoreData := False;
end;