Changeset 8 for trunk/Packages


Ignore:
Timestamp:
Apr 13, 2026, 11:12:39 PM (2 weeks ago)
Author:
chronos
Message:
  • Fixed: Data tab populating and refreshing.
  • Fixed: Used currency as decimal type for measured values instead inaccurate double type.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/XML.pas

    r7 r8  
    1515procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime);
    1616procedure WriteDouble(Node: TDOMNode; Name: string; Value: Double);
     17procedure WriteCurrency(Node: TDOMNode; Name: string; Value: Currency);
    1718function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer;
    1819function ReadInt64(Node: TDOMNode; Name: string; DefaultValue: Int64): Int64;
     
    2122function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime;
    2223function ReadDouble(Node: TDOMNode; Name: string; DefaultValue: Double): Double;
     24function ReadCurrency(Node: TDOMNode; Name: string; DefaultValue: Currency): Currency;
    2325procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string);
    2426
     
    6062  if Assigned(NewNode) then
    6163    Result := StrToFloat(string(NewNode.TextContent), XmlFormatSettings);
     64end;
     65
     66function ReadCurrency(Node: TDOMNode; Name: string; DefaultValue: Currency
     67  ): Currency;
     68var
     69  NewNode: TDOMNode;
     70begin
     71  Result := DefaultValue;
     72  NewNode := Node.FindNode(DOMString(Name));
     73  if Assigned(NewNode) then
     74    Result := StrToCurr(string(NewNode.TextContent), XmlFormatSettings);
    6275end;
    6376
     
    247260end;
    248261
     262procedure WriteCurrency(Node: TDOMNode; Name: string; Value: Currency);
     263var
     264  NewNode: TDOMNode;
     265begin
     266  NewNode := Node.OwnerDocument.CreateElement(DOMString(Name));
     267  NewNode.TextContent := DOMString(CurrToStr(Value, XmlFormatSettings));
     268  Node.AppendChild(NewNode);
     269end;
     270
    249271function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer;
    250272var
Note: See TracChangeset for help on using the changeset viewer.