Changeset 11 for trunk/Ean.pas
- Timestamp:
- Apr 15, 2026, 10:17:17 PM (2 weeks ago)
- File:
-
- 1 edited
-
trunk/Ean.pas (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ean.pas
r10 r11 36 36 Number: string; 37 37 Owner: string; 38 Address: string; 38 39 DistributionTariff: string; 39 40 PriceLow: Double; … … 58 59 TEans = class(TObjectList<TEan>) 59 60 function SearchByNumber(Number: string): TEan; 60 function SearchByOwner (Owner: string): TEan;61 function SearchByOwnerKind(Owner: string; Kind: TEanKind): TEan; 61 62 procedure LoadToStrings(Strings: TStrings; AllowNone: Boolean = False); 62 63 procedure LoadFromXmlNode(Node: TDOMNode); … … 241 242 Number := ReadString(Node, 'Number', Number); 242 243 Owner := ReadString(Node, 'Owner', Owner); 244 Address := ReadString(Node, 'Address', Address); 243 245 DistributionTariff := ReadString(Node, 'DistributionTariff', DistributionTariff); 244 246 PriceLow := ReadDouble(Node, 'PriceLow', PriceLow); … … 258 260 if Number <> '' then WriteString(Node, 'Number', Number); 259 261 if Owner <> '' then WriteString(Node, 'Owner', Owner); 262 if Address <> '' then WriteString(Node, 'Address', Address); 260 263 if DistributionTariff <> '' then WriteString(Node, 'DistributionTariff', DistributionTariff); 261 264 if PriceLow <> 0 then WriteDouble(Node, 'PriceLow', PriceLow); … … 294 297 end; 295 298 296 function TEans.SearchByOwner (Owner: string): TEan;299 function TEans.SearchByOwnerKind(Owner: string; Kind: TEanKind): TEan; 297 300 var 298 301 I: Integer; 299 302 begin 300 303 I := 0; 301 while (I < Count) and ( Items[I].Owner <> Owner) do Inc(I);304 while (I < Count) and ((Items[I].Owner <> Owner) or (Items[I].Kind <> Kind)) do Inc(I); 302 305 if I < Count then Result := Items[I] 303 306 else Result := nil; … … 308 311 I: Integer; 309 312 Shift: Integer; 313 Text: string; 310 314 begin 311 315 if AllowNone then Shift := 1 else Shift := 0; … … 315 319 while Strings.Count < Count + Shift do Strings.Add(''); 316 320 for I := 0 to Count - 1 do begin 317 Strings[I + Shift] := Items[I].Number + ' (' + Items[I].Owner + ')'; 321 Text := EanKindText[Items[I].Kind]; 322 if Items[I].Address <> '' then Text := Items[I].Address + ', ' + Text; 323 if Items[I].Owner <> '' then Text := Items[I].Owner + ', ' + Text; 324 Text := Items[I].Number + ' (' + Text + ')'; 325 Strings[I + Shift] := Text; 318 326 Strings.Objects[I + Shift] := Items[I]; 319 327 end;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/edc-stats/chrome/site/your_project_logo.png)