Fix fmtBCD data type

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8009 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo 2021-05-09 08:22:00 +00:00
parent 3925ebaa0d
commit d9914d4650

View File

@ -199,7 +199,7 @@ type
implementation
uses
Math, dateutils;
Math, FMTBcd, dateutils;
{ TJDbGridStringCtrl }
@ -1015,7 +1015,11 @@ begin
Field.DataSet.Edit;
if decimals > 0 then
theValue := ScaleTo(theValue, fDecimals);
Field.Value := theValue;
if Field.FieldDef.DataType = ftFMTBcd then
Field.AsBCD := StrToBCD(FormatFloat('0.' +
StringOfChar('0', Decimals), theValue))
else
Field.Value := theValue;
Field.DataSet.EnableControls;
updated := True;
end;
@ -1083,7 +1087,10 @@ begin
Field.DataSet.Edit;
if decimals > 0 then
theValue := ScaleTo(theValue, fDecimals);
Field.Value := theValue;
if Field.FieldDef.DataType = ftFMTBcd then
Field.AsBCD := StrToBCD(FormatFloat('0.' + StringOfChar('0', Decimals), theValue))
else
Field.Value := theValue;
CellEditor.Text := Field.AsString;
updated := True;
end;