{$R *.dfm}
procedure TFormRptConsultaMantenimientos.ppVariable1GetText(
Sender: TObject; var Text: String);
begin
Text := NombreEmpresa;
end;
procedure TFormRptConsultaMantenimientos.ppReportConsultaMantPreviewFormCreate(
Sender: TObject);
begin
ppReportConsultaMant.PreviewForm.WindowState := wsMaximized;
end;
procedure TFormRptConsultaMantenimientos.DarDeAltaCamposEnReport( TamanyoFuente : Double );
Var
i : LongInt;
PosicionCampo : LongInt;
tTitulo : TppLabel;
tCampo : TppDBText;
tCampoDBMemo : TppDBMemo;
tCampoDBMemoRT : TppDBRichText;
tCampoDBImagen : TppDBImage;
tCampoFormula : TppVariable;
tCampoSumado : TppVariable;
tRelacionado : TppDBText; tLineas : TppLine;
begin
PosicionCampo := 0;
With ListaCampos Do
For i := 0 To ( Count - 1 ) Do
If ( StrToInt( ListaLongitud.Strings[ i ] ) > 0 ) Then
Begin
With ppReportConsultaMant Do
Begin
tTitulo := TppLabel.Create( ppReportConsultaMant );
With tTitulo Do
Begin
Band := ppCabecera;
Left := PosicionCampo;
Top := FilaTitulos;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
Font.Style := [ fsBold ];
Caption := ListaTitulos.Strings[ i ];
tTitulo.Name := 'Tit_' + ListaCampos.Strings[ i ];
UserName := 'Titulo' + IntToStr( i );
If ( ListaTablasRelacionadasSQL.Strings[ i ] = '' ) Then
If ( ListaFormulas.Strings[ i ] <> 'S' ) Then
If ( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType <> ftMemo ) And
( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType <> ftFmtMemo ) And
( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType <> ftBlob ) And
( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType <> ftGraphic ) Then
OnDrawCommandClick := ppEtiquetaCampoClick;
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Font.Style := [ fsBold ];
End;
tLineas := TppLine.Create( ppReportConsultaMant );
With tLineas Do
Begin
Band := ppCabecera;
Left := PosicionCampo;
Top := FilaTitulos + 17;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 2;
Visible := TRUE;
End;
If ( ListaTablasRelacionadasSQL.Strings[ i ] <> '' ) Then
Begin
tRelacionado := TppDBText.Create( ppReportConsultaMant );
With tRelacionado Do
Begin
Band := ppDetalle;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
Tag := i;
DataPipeline := ppDBPipeline1;
DataField := ListaCampos.Strings[ i ];
OnGetText := tBuscarDatoCampoRelacionado;
Caption := ListaTitulos.Strings[ i ];
Name := 'ppRelac' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Font.Style := [ ];
End;
End
Else If ( ListaFormulas.Strings[ i ] = 'N' ) Then
Begin
If ( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType = ftFmtMemo ) Or
( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType = ftBlob ) Or
( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).IsBlob ) Then
Begin
tCampoDBMemoRT := TppDBRichText.Create( ppReportConsultaMant );
ppDetalle.PrintHeight := phDynamic;
With tCampoDBMemoRT Do
Begin
Band := ppDetalle;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
DataPipeline := ppDBPipeline1;
DataField := ListaCampos.Strings[ i ];
Tag := i;
Name := 'Campo' + IntToStr( i );
UserName := 'Campo' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Stretch := TRUE;
Font.Style := [ ];
AutoDisplay := TRUE;
End;
End
Else If ( tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType = ftGraphic ) Then
Begin
tCampoDBImagen := TppDBImage.Create( ppReportConsultaMant );
With tCampoDBImagen Do
Begin
Band := ppDetalle;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := StrToInt( ListaLongitud.Strings[ i ] );
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
DataPipeline := ppDBPipeline1;
DataField := ListaCampos.Strings[ i ];
Tag := i;
Name := 'Campo' + IntToStr( i );
UserName := 'Campo' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Stretch := FALSE;
Font.Style := [ ];
End;
End
Else If tTablaConsulta.FieldByName( ListaCampos.Strings[ i ] ).DataType = ftMemo Then
Begin
tCampoDBMemo := TppDBMemo.Create( ppReportConsultaMant );
With tCampoDBMemo Do
Begin
Band := ppDetalle;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
DataPipeline := ppDBPipeline1;
DataField := ListaCampos.Strings[ i ];
Tag := i;
Name := 'Campo' + IntToStr( i );
UserName := 'Campo' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Stretch := TRUE;
Font.Style := [ ];
End;
End
Else
Begin
tCampo := TppDBText.Create( ppReportConsultaMant );
With tCampo Do
Begin
Band := ppDetalle;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
DataPipeline := ppDBPipeline1;
DataField := ListaCampos.Strings[ i ];
OnGetText := tFormateadoCampo;
DisplayFormat := ListaFormatoCampos.Strings[ i ];
Tag := i;
Name := 'Campo' + IntToStr( i );
UserName := 'Campo' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Font.Style := [ ];
End;
End;
End
Else
Begin
tCampoFormula := TppVariable.Create( ppReportConsultaMant );
With tCampoFormula Do
Begin
Band := ppDetalle;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
OnGetText := tCalculoFormulas;
Tag := i;
Name := 'Campo' + IntToStr( i );
UserName := 'Campo' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Font.Style := [ ];
End;
End;
End;
PosicionCampo := PosicionCampo + StrToInt( ListaLongitud.Strings[ i ] ) + 4;
End;
PosicionCampo := 0;
With ListaSumados Do
For i := 0 To ( Count - 1 ) Do
If ( StrToInt( ListaLongitud.Strings[ i ] ) > 0 ) Then
If ( Strings[ i ] = 'S' ) Then
Begin
tLineas := TppLine.Create( ppReportConsultaMant );
With tLineas Do
Begin
Band := ppPiePagina;
Left := PosicionCampo;
Top := 0;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 2;
Visible := TRUE;
End;
With ppReportConsultaMant Do
Begin
tCampoFormula := TppVariable.Create( ppReportConsultaMant );
With tCampoFormula Do
Begin
Band := ppPiePagina;
Left := PosicionCampo;
Top := 4;
Width := StrToInt( ListaLongitud.Strings[ i ] );
Height := 15;
AutoSize := FALSE;
WordWrap := TRUE;
If ListaAlineacion.Strings[ i ] = 'I' Then
AlignMent := taLeftJustify
Else If ListaAlineacion.Strings[ i ] = 'C' Then
AlignMent := taCenter
Else If ListaAlineacion.Strings[ i ] = 'D' Then
AlignMent := taRightJustify;
OnGetText := tCalculoFormulasSumatorio;
Tag := i;
Name := 'SumCampo' + IntToStr( i );
UserName := 'SumCampo' + IntToStr( i );
Visible := TRUE;
Transparent := TRUE;
Font.Name := ppLabelTituloListado.Font.Name;
Font.Size := Trunc( TamanyoFuente );
Font.Style := [ fsBold ];
End;
End;
PosicionCampo := PosicionCampo + StrToInt( ListaLongitud.Strings[ i ] ) + 4;
End
Else
PosicionCampo := PosicionCampo + StrToInt( ListaLongitud.Strings[ i ] ) + 4;
end;
procedure TFormRptConsultaMantenimientos.tCalculoFormulas( sender: TObject; Var Value: String );
begin
Value := CalcularExpresion( ListaFormulasExpresion.Strings[ ( Sender As TppVariable ).Tag ] );
If ( ListaSumados.Strings[ ( Sender As TppVariable ).Tag ] = 'S' ) Then
ListaTotalesSumados.Strings[ ( Sender As TppVariable ).Tag ] := FloatToStr(
StrToFloat( ListaTotalesSumados.Strings[ ( Sender As TppVariable ).Tag ] ) + StrToFloat( Value ) );
If ListaFormatoCampos.Strings[ ( Sender As TppVariable ).Tag ] <> '' Then
Value := FormatFloat( ListaFormatoCampos.Strings[ ( Sender As TppVariable ).Tag ],
StrToFloat( Value ) );
end;