You've already forked lazarus-ccr
RxFPC: RXDBGrid export to PDF component
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5082 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -2481,17 +2481,7 @@ function TRxDBGrid.GetFooterRowCount: integer;
|
||||
begin
|
||||
Result:=FFooterOptions.RowCount;
|
||||
end;
|
||||
{
|
||||
function TRxDBGrid.GetMarkerDown: TBitmap;
|
||||
begin
|
||||
Result:=FMarkerDown;
|
||||
end;
|
||||
|
||||
function TRxDBGrid.GetMarkerUp: TBitmap;
|
||||
begin
|
||||
Result:=FMarkerUp;
|
||||
end;
|
||||
}
|
||||
function TRxDBGrid.GetDrawFullLine: boolean;
|
||||
begin
|
||||
Result := FFooterOptions.FDrawFullLine;
|
||||
@ -6031,433 +6021,6 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
(*
|
||||
{ TRxColumnFooter }
|
||||
|
||||
procedure TRxColumnFooter.SetValue(const AValue: string);
|
||||
begin
|
||||
if FValue = AValue then
|
||||
exit;
|
||||
FValue := AValue;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.SetDisplayFormat(const AValue: string);
|
||||
begin
|
||||
if FDisplayFormat = AValue then
|
||||
exit;
|
||||
FDisplayFormat := AValue;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.SetAlignment(const AValue: TAlignment);
|
||||
begin
|
||||
if FAlignment = AValue then
|
||||
exit;
|
||||
FAlignment := AValue;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.FontChanged(Sender: TObject);
|
||||
begin
|
||||
FisDefaultFont := False;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.GetFont: TFont;
|
||||
begin
|
||||
result := FFont;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.IsFontStored: Boolean;
|
||||
begin
|
||||
result := not FisDefaultFont;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.SetFieldName(const AValue: string);
|
||||
begin
|
||||
if FFieldName = AValue then
|
||||
exit;
|
||||
FFieldName := AValue;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.SetFont(AValue: TFont);
|
||||
begin
|
||||
if not FFont.IsEqual(AValue) then
|
||||
FFont.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.SetLayout(const AValue: TTextLayout);
|
||||
begin
|
||||
if FLayout = AValue then
|
||||
exit;
|
||||
FLayout := AValue;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.SetValueType(const AValue: TFooterValueType);
|
||||
begin
|
||||
if FValueType = AValue then
|
||||
exit;
|
||||
FValueType := AValue;
|
||||
if FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||
TRxDBGrid(FOwner.Grid).CalcStatTotals;
|
||||
FOwner.ColumnChanged;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.DisplayText: string;
|
||||
begin
|
||||
case FValueType of
|
||||
fvtSum,
|
||||
fvtAvg,
|
||||
fvtMax,
|
||||
fvtMin: Result := GetStatTotal;
|
||||
fvtCount: Result := GetRecordsCount;
|
||||
fvtFieldValue: Result := GetFieldValue;
|
||||
fvtStaticText: Result := FValue;
|
||||
fvtRecNo: Result := GetRecNo;
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.FillDefaultFont;
|
||||
var
|
||||
AGrid: TCustomGrid;
|
||||
begin
|
||||
AGrid := FOwner.Grid;
|
||||
if (AGrid<>nil) then
|
||||
begin
|
||||
FFont.Assign(AGrid.Font);
|
||||
FIsDefaultFont := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.GetFieldValue: string;
|
||||
begin
|
||||
if (FFieldName <> '') and TRxDBGrid(FOwner.Grid).DatalinkActive then
|
||||
Result := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName).AsString
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.GetRecordsCount: string;
|
||||
begin
|
||||
if TRxDBGrid(FOwner.Grid).DatalinkActive then
|
||||
begin
|
||||
if DisplayFormat <> '' then
|
||||
Result := Format(DisplayFormat,
|
||||
[{TRxDBGrid(FOwner.Grid).DataSource.DataSet.RecordCount} FCountRec])
|
||||
else
|
||||
Result := IntToStr(FCountRec); //TRxDBGrid(FOwner.Grid).DataSource.DataSet.RecordCount);
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.GetRecNo: string;
|
||||
begin
|
||||
if TRxDBGrid(FOwner.Grid).DatalinkActive then
|
||||
begin
|
||||
if DisplayFormat <> '' then
|
||||
Result := Format(DisplayFormat, [TRxDBGrid(FOwner.Grid).DataSource.DataSet.RecNo])
|
||||
else
|
||||
Result := IntToStr(TRxDBGrid(FOwner.Grid).DataSource.DataSet.RecNo);
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.GetStatTotal: string;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
if (FFieldName <> '') and TRxDBGrid(FOwner.Grid).DatalinkActive and
|
||||
(TRxDBGrid(FOwner.Grid).DataSource.DataSet.RecordCount <> 0) then
|
||||
begin
|
||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
||||
if Assigned(F) then
|
||||
begin
|
||||
if F.DataType in [ftSmallint, ftInteger, ftWord, ftFloat, ftCurrency,
|
||||
ftDate, ftTime, ftDateTime, ftTimeStamp, ftLargeint, ftBCD] then
|
||||
begin
|
||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
begin
|
||||
if FValueType in [fvtSum, fvtAvg] then
|
||||
Result := ''
|
||||
else
|
||||
if FTestValue = 0 then
|
||||
Result := ''
|
||||
else
|
||||
if FDisplayFormat = '' then
|
||||
Result := DateToStr(FTestValue)
|
||||
else
|
||||
Result := FormatDateTime(FDisplayFormat, FTestValue);
|
||||
end
|
||||
else
|
||||
if F.DataType in [ftSmallint, ftInteger, ftWord, ftLargeint] then
|
||||
begin
|
||||
if FDisplayFormat = '' then
|
||||
Result := IntToStr(Round(FTestValue))
|
||||
else
|
||||
Result := Format(FDisplayFormat, [Round(FTestValue)]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if FDisplayFormat <> '' then
|
||||
Result := FormatFloat(FDisplayFormat, FTestValue)
|
||||
else
|
||||
if F.DataType = ftCurrency then
|
||||
Result := FloatToStrF(FTestValue, ffCurrency, 12, 2)
|
||||
else
|
||||
Result := FloatToStr(FTestValue);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.ResetTestValue;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
FTestValue := 0;
|
||||
FCountRec:=0;
|
||||
|
||||
if (ValueType in [fvtMin, fvtMax]) and (TRxDBGrid(
|
||||
FOwner.Grid).DataSource.DataSet.RecordCount <> 0) then
|
||||
begin
|
||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
||||
if (Assigned(F)) and not (F.IsNull) then
|
||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
FTestValue := F.AsDateTime
|
||||
else
|
||||
FTestValue := F.AsFloat;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.UpdateTestValue;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
if ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||
begin
|
||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FindField(FFieldName);
|
||||
if Assigned(F) then
|
||||
begin
|
||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
begin
|
||||
case FValueType of
|
||||
fvtMax: FTestValue := Max(FTestValue, F.AsDateTime);
|
||||
fvtMin: FTestValue := Min(FTestValue, F.AsDateTime);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
case FValueType of
|
||||
fvtSum: FTestValue := FTestValue + F.AsFloat;
|
||||
// fvtAvg:
|
||||
fvtMax: FTestValue := Max(FTestValue, F.AsFloat);
|
||||
fvtMin: FTestValue := Min(FTestValue, F.AsFloat);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.DeleteTestValue: boolean;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
Result := True;
|
||||
if ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||
begin
|
||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
||||
if (Assigned(F)) and not (F.IsNull) then
|
||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
Result := not ((FValueType in [fvtMax, fvtMin]) and (FTestValue = F.AsDateTime))
|
||||
else
|
||||
if FValueType in [fvtMax, fvtMin] then
|
||||
Result := (FTestValue <> F.AsFloat)
|
||||
else
|
||||
FTestValue := FTestValue - F.AsFloat;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.PostTestValue: boolean;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
Result := True;
|
||||
if ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||
begin
|
||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
||||
if Assigned(F) then
|
||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
begin
|
||||
if FValueType in [fvtMax, fvtMin] then
|
||||
if F.DataSet.State = dsinsert then
|
||||
begin
|
||||
if not (F.IsNull) then
|
||||
case FValueType of
|
||||
fvtMax: FTestValue := Max(FTestValue, F.AsDateTime);
|
||||
fvtMin: FTestValue := Min(FTestValue, F.AsDateTime);
|
||||
end;
|
||||
end
|
||||
else
|
||||
if (F.OldValue <> null) and (FTestValue = TDateTime(F.OldValue)) then
|
||||
Result := False
|
||||
else
|
||||
if not F.IsNull then
|
||||
case FValueType of
|
||||
fvtMax: FTestValue := Max(FTestValue, F.AsDateTime);
|
||||
fvtMin: FTestValue := Min(FTestValue, F.AsDateTime);
|
||||
end;
|
||||
end
|
||||
else
|
||||
if F.DataSet.State = dsinsert then
|
||||
begin
|
||||
if not F.IsNull then
|
||||
case FValueType of
|
||||
fvtSum: FTestValue := FTestValue + F.AsFloat;
|
||||
fvtMax: FTestValue := Max(FTestValue, F.AsFloat);
|
||||
fvtMin: FTestValue := Min(FTestValue, F.AsFloat);
|
||||
end;
|
||||
end
|
||||
else
|
||||
if (FValueType in [fvtMax, fvtMin]) and (F.OldValue <> null) and
|
||||
(FTestValue = Float(F.OldValue)) then
|
||||
Result := False
|
||||
else
|
||||
case FValueType of
|
||||
fvtSum:
|
||||
begin
|
||||
if not F.IsNull then
|
||||
begin
|
||||
if F.OldValue <> null then
|
||||
FTestValue := FTestValue - Float(F.OldValue);
|
||||
FTestValue := FTestValue + F.AsFloat;
|
||||
end;
|
||||
end;
|
||||
fvtMax: if not F.IsNull then
|
||||
FTestValue := Max(FTestValue, F.AsFloat);
|
||||
fvtMin: if not F.IsNull then
|
||||
FTestValue := Min(FTestValue, F.AsFloat);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRxColumnFooter.ErrorTestValue: boolean;
|
||||
var
|
||||
F: TField;
|
||||
begin
|
||||
Result := True;
|
||||
if ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||
begin
|
||||
F := TRxDBGrid(FOwner.Grid).DataSource.DataSet.FieldByName(FFieldName);
|
||||
if Assigned(F) then
|
||||
begin
|
||||
if F.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
begin
|
||||
if (FValueType in [fvtMax, fvtMin]) and not (F.IsNull) then
|
||||
begin
|
||||
if not (F.IsNull) and (FTestValue = F.AsDateTime) then
|
||||
Result := False
|
||||
else
|
||||
if (F.DataSet.RecordCount <> 0) and (F.OldValue <> null) then
|
||||
begin
|
||||
case FValueType of
|
||||
fvtMax: FTestValue := Max(FTestValue, TDateTime(F.OldValue));
|
||||
fvtMin: FTestValue := Min(FTestValue, TDateTime(F.OldValue));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if (FValueType in [fvtMax, fvtMin]) and not (F.IsNull) and (FTestValue = F.AsFloat) then
|
||||
Result := False
|
||||
else
|
||||
begin
|
||||
case FValueType of
|
||||
fvtSum:
|
||||
if F.DataSet.RecordCount = 0 then
|
||||
begin
|
||||
{ if not F.IsNull then
|
||||
FTestValue := FTestValue - F.AsFloat;}
|
||||
{ TODO -oalexs : need rewrite this code - where difficult! }
|
||||
end
|
||||
else
|
||||
begin
|
||||
if F.OldValue <> null then
|
||||
FTestValue := FTestValue + Float(F.OldValue);
|
||||
if not F.IsNull then
|
||||
FTestValue := FTestValue - F.AsFloat;
|
||||
end;
|
||||
fvtMax:
|
||||
if (F.DataSet.RecordCount <> 0) and (F.OldValue <> null) then
|
||||
FTestValue := Max(FTestValue, Float(F.OldValue));
|
||||
fvtMin:
|
||||
if (F.DataSet.RecordCount <> 0) and (F.OldValue <> null) then
|
||||
FTestValue := Min(FTestValue, Float(F.OldValue));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFooter.UpdateTestValueFromVar(AValue: Variant);
|
||||
begin
|
||||
if FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin] then
|
||||
begin
|
||||
if (not VarIsEmpty(AValue)) and (AValue <> null) and Assigned(FField) then
|
||||
begin
|
||||
if FField.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then
|
||||
begin
|
||||
case FValueType of
|
||||
fvtMax: FTestValue := Max(FTestValue, AValue);
|
||||
fvtMin: FTestValue := Min(FTestValue, AValue);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
case FValueType of
|
||||
fvtSum,
|
||||
fvtAvg: FTestValue := FTestValue + AValue;
|
||||
fvtMax: FTestValue := Max(FTestValue, AValue);
|
||||
fvtMin: FTestValue := Min(FTestValue, AValue);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///!
|
||||
constructor TRxColumnFooter.Create(Owner: TRxColumn);
|
||||
begin
|
||||
inherited Create;
|
||||
FOwner := Owner;
|
||||
FTestValue := 0;
|
||||
FLayout := tlCenter;
|
||||
|
||||
FFont := TFont.Create;
|
||||
FillDefaultFont;
|
||||
FFont.OnChange := @FontChanged;
|
||||
end;
|
||||
|
||||
destructor TRxColumnFooter.Destroy;
|
||||
begin
|
||||
FreeThenNil(FFont);
|
||||
inherited Destroy;
|
||||
end;
|
||||
*)
|
||||
|
||||
{ TFilterListCellEditor }
|
||||
|
||||
procedure TFilterListCellEditor.WndProc(var TheMessage: TLMessage);
|
||||
|
Reference in New Issue
Block a user