|
@@ -1923,24 +1923,37 @@ end;
|
|
class function TAccountComp.TxtToMoney(const moneytxt: String;
|
|
class function TAccountComp.TxtToMoney(const moneytxt: String;
|
|
var money: Int64): Boolean;
|
|
var money: Int64): Boolean;
|
|
Var s : String;
|
|
Var s : String;
|
|
|
|
+ LPosThousand, LPosDecimal : Integer;
|
|
|
|
+ LMoneyString : String;
|
|
begin
|
|
begin
|
|
money := 0;
|
|
money := 0;
|
|
- if Trim(moneytxt)='' then begin
|
|
|
|
|
|
+ LMoneyString := Trim(moneytxt);
|
|
|
|
+ if LMoneyString.Length=0 then begin
|
|
Result := true;
|
|
Result := true;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
try
|
|
try
|
|
- If pos({$IFDEF DELPHIXE}FormatSettings.{$ENDIF}DecimalSeparator,moneytxt)<=0 then begin
|
|
|
|
- // No decimal separator, consider ThousandSeparator as a decimal separator
|
|
|
|
- s := StringReplace(moneytxt,{$IFDEF DELPHIXE}FormatSettings.{$ENDIF}ThousandSeparator,{$IFDEF DELPHIXE}FormatSettings.{$ENDIF}DecimalSeparator,[rfReplaceAll]);
|
|
|
|
- end else begin
|
|
|
|
- s := StringReplace(moneytxt,{$IFDEF DELPHIXE}FormatSettings.{$ENDIF}ThousandSeparator,'',[rfReplaceAll]);
|
|
|
|
|
|
+ LPosThousand := LMoneyString.IndexOf( TPCJSONData.JSONFormatSettings.ThousandSeparator );
|
|
|
|
+ LPosDecimal := LMoneyString.IndexOf( TPCJSONData.JSONFormatSettings.DecimalSeparator );
|
|
|
|
+
|
|
|
|
+ if (LPosThousand>0) then begin
|
|
|
|
+ if (LPosThousand < LPosDecimal ) then begin
|
|
|
|
+ // Remove thousand values
|
|
|
|
+ LMoneyString := LMoneyString.Replace(String(TPCJSONData.JSONFormatSettings.ThousandSeparator),'',[rfReplaceAll]);
|
|
|
|
+ end else begin
|
|
|
|
+ // Possible 15.123.456,7890 format ( coma (,) = decimal separator )
|
|
|
|
+ // Remove decimal "." and convert thousand to decimal
|
|
|
|
+ LMoneyString := LMoneyString.Replace(String(TPCJSONData.JSONFormatSettings.DecimalSeparator),'',[rfReplaceAll]);
|
|
|
|
+ LMoneyString := LMoneyString.Replace(TPCJSONData.JSONFormatSettings.ThousandSeparator,TPCJSONData.JSONFormatSettings.DecimalSeparator,[rfReplaceAll]);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
- money := Round( StrToFloat(s)*10000 );
|
|
|
|
|
|
+
|
|
|
|
+ money := Round( StrToFloat(LMoneyString,TPCJSONData.JSONFormatSettings)*10000 );
|
|
Result := true;
|
|
Result := true;
|
|
Except
|
|
Except
|
|
result := false;
|
|
result := false;
|
|
end;
|
|
end;
|
|
|
|
+
|
|
end;
|
|
end;
|
|
|
|
|
|
class procedure TAccountComp.ValidsEC_OpenSSL_NID(list: TList<Word>);
|
|
class procedure TAccountComp.ValidsEC_OpenSSL_NID(list: TList<Word>);
|