strongsReport in Delphi

6

Would anyone have a mini application for me to learn about the operation of the strongs Report?

I've already done a report with the strong report, but what I'm hooking on, is that I have to put a Bane SubDetails so I try to reference 2 querys in the same report and I'm not sure how to do that.

SoyouseeValorpagoandTrocobelow,they'rewhatIwanttogetfromanotherquery.Ex.:allvaluesabove,arequery4andthebottomones,justthebottomtwoarequery7.

Fromthisfunctionbelow,itwouldreturnthevaluesquoted(ValorpagoandTroco).

Code:

AssignFile(txt,frmSelection.FileListBox1.FileName);Reset(txt);whilenoteof(txt)dobeginReadln(txt,lTemp);if(copy(lTemp,1,3)='E01')thenbegindate1:=StrToDateTime(copy(lTemp,134,2)+'/'+copy(lTemp,132,2)+'/'+copy(lTemp,128,4));date2:=StrToDateTime(copy(lTemp,142,2)+'/'+copy(lTemp,140,2)+'/'+copy(lTemp,136,4));date1treg:=FormatDateTime('yyyy/MM/dd',date1);date2treg:=FormatDateTime('yyyy/MM/dd',date2);end;if(copy(lTemp,1,3)='E21')thenbeginDModuleGrid.ZQuery7.Close;DModuleGrid.ZQuery7.SQL.Clear;DModuleGrid.ZQuery7.SQL.Add('SELECT*FROMfinafimWHEREccf=:ccfAND'+'numcup=:cooANDimpcaixa=:ecfANDdescfina=:formpagANDvlfina='+':valorfinalANDchfina=:pchfinaANDdtcompBETWEEN"'+date1treg+'" ' +
        'AND "'+date2treg+'"');
      DModuleGrid.ZQuery7.ParamByName('ccf').AsString := copy(lTemp, 53, 6);
      DModuleGrid.ZQuery7.ParamByName('coo').AsString := copy(lTemp,47,6);
      DModuleGrid.ZQuery7.ParamByName('ecf').AsString := copy(lTemp,4,20);
      DModuleGrid.ZQuery7.ParamByName('formpag').AsString := copy(lTemp,65,15);
      DModuleGrid.ZQuery7.ParamByName('valorfinal').AsFloat := StrToFloat(copy(lTemp,80,13))/100;
      DModuleGrid.ZQuery7.Open;


      if (DModuleGrid.ZQuery7.ParamByName('ccf').AsString = DModuleGrid.ZQuery7.FieldByName('ccf').AsString)
      and (DModuleGrid.ZQuery7.ParamByName('coo').AsString = DModuleGrid.ZQuery7.FieldByName('numcupom').AsString)
      and (DModuleGrid.ZQuery7.ParamByName('ecf').AsString = DModuleGrid.ZQuery7.FieldByName('impcaixa').AsString)
      then
      begin

        if (DModuleGrid.ZQuery7.FieldByName('descfina').AsString = 'DINHEIRO')
        and (DModuleGrid.ZQuery7.FieldByName('chfina').AsInteger = 1)
        and (DModuleGrid.ZQuery7.FieldByName('numcup').AsString = DModuleGrid.ZQuery4.FieldByName('numcupom').AsString)
        and (DModuleGrid.ZQuery7.FieldByName('ccf').AsString = DModuleGrid.ZQuery4.FieldByName('ccf').AsString)
        and (DModuleGrid.ZQuery7.FieldByName('impcaixa').AsString =
          DModuleGrid.ZQuery4.FieldByName('NSerie').AsString)
        then
        begin
          frmDivIt.RLDBText13.DataField := 'vlfina';
        end;

        if (DModuleGrid.ZQuery7.FieldByName('descfina').AsString = 'TROCO')
        and (DModuleGrid.ZQuery7.FieldByName('chfina').AsInteger = 91)
        and (DModuleGrid.ZQuery7.FieldByName('numcup').AsString = DModuleGrid.ZQuery4.FieldByName('numcupom').AsString)
        and (DModuleGrid.ZQuery7.FieldByName('ccf').AsString = DModuleGrid.ZQuery4.FieldByName('ccf').AsString)
        and (DModuleGrid.ZQuery7.FieldByName('impcaixa').AsString =
          DModuleGrid.ZQuery4.FieldByName('NSerie').AsString)
        then
        begin
          frmDivIt.RLDBText14.DataField := 'vlfina';
        end;
      end;
    end;
  end;
  CloseFile(txt);

Additionally, SubDetail did not receive any data.

    
asked by anonymous 27.05.2014 / 16:28

1 answer

3

First a comment about your architecture.

Try to condense your report into a query, you're probably leaving the information redundant.

Returning to the subject, I found here a master-detail example for strongs Reports.

PAS:

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
  case RadioGroup1.ItemIndex of
    0:begin
        ClientDataSet1.IndexFieldNames :='City';
        RLGroup1.DataFields := 'City';
        RLLabel1.Caption := 'City';
        RLDBText1.DataField := 'City';
      end;
    1:begin
        ClientDataSet1.IndexFieldNames :='State';
        RLGroup1.DataFields := 'State';
        RLLabel1.Caption := 'State';
        RLDBText1.DataField := 'State';
      end;
  end;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  RadioGroup1.OnClick(Sender);
  RLReport1.Preview();
end;

procedure TForm1.RLDBText1BeforePrint(Sender: TObject; var Text: String;
  var PrintIt: Boolean);
begin
  if PrintFirst then
  begin
    PrintIt := true;
    PrintFirst := false;
  end
  else
    PrintIt := false;
end;

procedure TForm1.RLGroup1AfterPrint(Sender: TObject);
begin
  PrintFirst := true;
end;
    
30.05.2014 / 14:12