Skip to content

Commit

Permalink
Updated TemplatePro
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Dec 31, 2024
1 parent fa8f4a7 commit f7a139a
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion sources/TemplatePro.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,34 @@ function TTProCompiledTemplate.ExecuteFilter(aFunctionName: string; var aParamet
begin
CheckParNumber(1, aParameters);
CheckParamType('formatfloat', @aParameters[0], [TFilterParameterType.fptString]);
Result := FormatFloat(aParameters[0].ParStrText, aValue.AsExtended, fLocaleFormatSettings);
if aValue.IsType<Integer> then
begin
Result := FormatFloat(aParameters[0].ParStrText, aValue.AsInteger, fLocaleFormatSettings);
end
else if aValue.IsType<Int64> then
begin
Result := FormatFloat(aParameters[0].ParStrText, aValue.AsInt64, fLocaleFormatSettings);
end
else if aValue.IsType<UInt64> then
begin
Result := FormatFloat(aParameters[0].ParStrText, aValue.AsUInt64, fLocaleFormatSettings);
end
else if aValue.IsType<TBcd> then
begin
Result := FormatFloat(aParameters[0].ParStrText, BcdToDouble(aValue.AsType<TBcd>), fLocaleFormatSettings);
end
else if aValue.IsType<Currency> then
begin
Result := FormatFloat(aParameters[0].ParStrText, aValue.AsCurrency, fLocaleFormatSettings);
end
else if aValue.IsType<Extended> or aValue.IsType<Double> then
begin
Result := FormatFloat(aParameters[0].ParStrText, aValue.AsExtended, fLocaleFormatSettings);
end
else
begin
Error('Invalid type passed to FormatFloat filter');
end;
end
else if SameText(aFunctionName, 'totrue') then
begin
Expand Down

0 comments on commit f7a139a

Please sign in to comment.