Changeset 20 for trunk/UCore.pas


Ignore:
Timestamp:
Mar 25, 2013, 10:58:03 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Celé číslo účtu rozděleno do samostatných částí jako samotné číslo a kód banky.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r19 r20  
    1111
    1212type
     13  TAccountOperation = class
     14    Id: string;
     15    Time: TDateTime;
     16    Value: Double;
     17    VarSym: string;
     18    SpecSym: string;
     19    ConstSym: string;
     20  end;
    1321
    1422  { TAccount }
     
    1826    Name: string;
    1927    Number: string;
     28    BankCode: string;
    2029    Balance: Double;
    2130    Time: TDateTime;
     31    Operations: TListObject;
    2232    procedure Assign(Source: TAccount);
    2333    procedure LoadFromRegistry(Context: TRegistryContext);
    2434    procedure SaveToRegistry(Context: TRegistryContext);
     35    constructor Create;
     36    destructor Destroy; override;
    2537  end;
    2638
     
    128140    Balance := ReadFloatWithDefault('Balance', 0);
    129141    Number := UTF8Encode(ReadStringWithDefault('Number', ''));
     142    BankCode := UTF8Encode(ReadStringWithDefault('BankCode', ''));
    130143  finally
    131144    Free;
     
    144157    WriteString('Token', UTF8Decode(Token));
    145158    WriteFloat('Balance', Balance);
    146   finally
    147     Free;
    148   end;
     159    WriteString('BankCode', UTF8Decode(BankCode));
     160  finally
     161    Free;
     162  end;
     163end;
     164
     165constructor TAccount.Create;
     166begin
     167  Operations := TListObject.Create;
     168end;
     169
     170destructor TAccount.Destroy;
     171begin
     172  Operations.Free;
     173  inherited Destroy;
    149174end;
    150175
     
    194219    Strings.Delete(Strings.Count - 1);
    195220  for I := 0 to Count - 1 do begin
    196     Strings.Strings[I] := TAccount(Items[I]).Name + ' (' + TAccount(Items[I]).Number + ')';
     221    Strings.Strings[I] := IntToStr(I) + ': ' + TAccount(Items[I]).Name + ' (' +
     222      TAccount(Items[I]).Number + '/' + TAccount(Items[I]).BankCode + ')';
    197223    Strings.Objects[I] := Items[I];
    198224  end;
     
    240266  Result := StringReplace(Result, '%a', CurrentAccount.Number, [rfReplaceAll]);
    241267  Result := StringReplace(Result, '%n', CurrentAccount.Name, [rfReplaceAll]);
     268  Result := StringReplace(Result, '%b', CurrentAccount.BankCode, [rfReplaceAll]);
    242269  Result := StringReplace(Result, '%%', '%', [rfReplaceAll]);
    243270end;
     
    273300      Node2 := Node.FindNode('bankId');
    274301      if Assigned(Node2) then
    275         Account.Number := Account.Number + '/' + UTF8Encode(Node2.TextContent);
     302        Account.BankCode := UTF8Encode(Node2.TextContent);
    276303      Node2 := Node.FindNode('closingBalance');
    277304      if Assigned(Node2) then
     
    279306          DefaultFormatSettings.DecimalSeparator, [rfReplaceAll]));
    280307    end else begin
     308      Account.BankCode := '';
    281309      Account.Number := '';
    282310      Account.Balance := 0;
Note: See TracChangeset for help on using the changeset viewer.