- Timestamp:
- Apr 15, 2026, 9:35:17 AM (2 weeks ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
Ean.pas (modified) (5 diffs)
-
FormMain.lfm (modified) (3 diffs)
-
FormMain.lrj (modified) (1 diff)
-
FormMain.pas (modified) (2 diffs)
-
Languages/EdcStats.cs.po (modified) (1 diff)
-
Languages/EdcStats.pot (modified) (1 diff)
-
SpotPrice.pas (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ean.pas
r9 r10 47 47 function GetSharedPercent(TimeFrom, TimeTo: TDateTime): Double; 48 48 function GetSavings(TimeFrom, TimeTo: TDateTime; SpotPrices: TSpotPrices): Currency; 49 function GetPrice(TimeFrom, TimeTo: TDateTime; SpotPrices: TSpotPrices ): Currency;49 function GetPrice(TimeFrom, TimeTo: TDateTime; SpotPrices: TSpotPrices; MinPrice: Currency): Currency; 50 50 procedure LoadFromXmlNode(Node: TDOMNode); 51 51 procedure SaveToXmlNode(Node: TDOMNode); … … 198 198 I: Integer; 199 199 SpotPrice: TSpotPrice; 200 SpotPriceIndex: Integer; 200 201 begin 201 202 if PriceLow = 0 then begin … … 203 204 for I := 0 to Values.Count - 1 do 204 205 if (Values[I].Time >= TimeFrom) and (Values[I].Time < TimeTo) then begin 205 SpotPrice := SpotPrices.SearchByTime(Values[I].Time);206 if SpotPrice .Value <> 0then207 Result := Result + (Values[I].ValueIn - Values[I].ValueOut) * (SpotPrice .Value - PriceSpot);206 SpotPriceIndex := SpotPrices.SearchByTime(Values[I].Time); 207 if SpotPriceIndex <> -1 then 208 Result := Result + (Values[I].ValueIn - Values[I].ValueOut) * (SpotPrices[SpotPriceIndex].Value - PriceSpot); 208 209 end; 209 210 end else begin … … 214 215 end; 215 216 216 function TEan.GetPrice(TimeFrom, TimeTo: TDateTime; SpotPrices: TSpotPrices): Currency; 217 var 218 I: Integer; 219 SpotPrice: TSpotPrice; 217 function TEan.GetPrice(TimeFrom, TimeTo: TDateTime; SpotPrices: TSpotPrices; MinPrice: Currency): Currency; 218 var 219 I: Integer; 220 SpotPriceIndex: Integer; 221 SpotPrice: Currency; 220 222 begin 221 223 if PriceLow = 0 then begin … … 223 225 for I := 0 to Values.Count - 1 do 224 226 if (Values[I].Time >= TimeFrom) and (Values[I].Time < TimeTo) then begin 225 SpotPrice := SpotPrices.SearchByTime(Values[I].Time); 226 if SpotPrice.Value <> 0 then 227 Result := Result + Values[I].ValueIn * (SpotPrice.Value - PriceSpot); 227 SpotPriceIndex := SpotPrices.SearchByTime(Values[I].Time); 228 if (SpotPriceIndex <> -1) then begin 229 SpotPrice := SpotPrices[SpotPriceIndex].Value - PriceSpot; 230 if SpotPrice > MinPrice then 231 Result := Result + Values[I].ValueIn * SpotPrice; 232 end; 228 233 end; 229 234 end else Result := GetTotalIn(TimeFrom, TimeTo) * PriceLow; -
trunk/FormMain.lfm
r9 r10 1 1 object FormMain: TFormMain 2 Left = 3 622 Left = 357 3 3 Height = 884 4 Top = 35 64 Top = 351 5 5 Width = 1203 6 6 Caption = 'EDC Stats' … … 20 20 Top = 56 21 21 Width = 1176 22 ActivePage = TabSheet SpotPrices22 ActivePage = TabSheetOverview 23 23 Anchors = [akTop, akLeft, akRight, akBottom] 24 TabIndex = 424 TabIndex = 0 25 25 TabOrder = 0 26 26 object TabSheetOverview: TTabSheet … … 83 83 item 84 84 Caption = 'Tariff' 85 Width = 100 86 end 87 item 88 Caption = 'Price above zero [Kč]' 85 89 Width = 100 86 90 end> -
trunk/FormMain.lrj
r9 r10 14 14 {"hash":215185821,"name":"tformmain.listviewoverview.columns[10].caption","sourcebytes":[83,97,118,105,110,103,115,32,91,75,196,141,93],"value":"Savings [K\u010D]"}, 15 15 {"hash":94932934,"name":"tformmain.listviewoverview.columns[11].caption","sourcebytes":[84,97,114,105,102,102],"value":"Tariff"}, 16 {"hash":73101837,"name":"tformmain.listviewoverview.columns[12].caption","sourcebytes":[80,114,105,99,101,32,97,98,111,118,101,32,122,101,114,111,32,91,75,196,141,93],"value":"Price above zero [K\u010D]"}, 16 17 {"hash":21335,"name":"tformmain.tabsheetlog.caption","sourcebytes":[76,111,103],"value":"Log"}, 17 18 {"hash":4843668,"name":"tformmain.tabsheetchart.caption","sourcebytes":[67,104,97,114,116],"value":"Chart"}, -
trunk/FormMain.pas
r9 r10 224 224 procedure TFormMain.MenuItemImportSpotPricesClick(Sender: TObject); 225 225 begin 226 EdcProject.SpotPrices.Import(SpotPricesDir); 227 //EdcProject.SpotPrices.LoadSpotPricesFromWeb(StrToDate('1.4.2026')); 226 //EdcProject.SpotPrices.Import(SpotPricesDir); 227 EdcProject.SpotPrices.LoadFromWeb; 228 228 229 ShowActiveTab; 229 230 end; … … 366 367 ListItem.SubItems.Add(FloatToStr(PriceHigh)); 367 368 ListItem.SubItems.Add(FloatToStr(PriceSpot)); 368 ListItem.SubItems.Add(CurrToStr(GetPrice(IntervalFrom, IntervalTo, EdcProject.SpotPrices )));369 ListItem.SubItems.Add(CurrToStr(GetPrice(IntervalFrom, IntervalTo, EdcProject.SpotPrices, Low(Integer)))); 369 370 ListItem.SubItems.Add(CurrToStr(GetSavings(IntervalFrom, IntervalTo, EdcProject.SpotPrices))); 370 371 ListItem.SubItems.Add(DistributionTariff); 372 ListItem.SubItems.Add(CurrToStr(GetPrice(IntervalFrom, IntervalTo, EdcProject.SpotPrices, 0))); 371 373 end; 372 374 finally -
trunk/Languages/EdcStats.cs.po
r9 r10 158 158 msgstr "Tarif" 159 159 160 #: tformmain.listviewoverview.columns[12].caption 161 msgid "Price above zero [Kč]" 162 msgstr "Cena nad nulou [Kč]" 163 160 164 #: tformmain.listviewoverview.columns[1].caption 161 165 msgctxt "tformmain.listviewoverview.columns[1].caption" -
trunk/Languages/EdcStats.pot
r9 r10 148 148 msgstr "" 149 149 150 #: tformmain.listviewoverview.columns[12].caption 151 msgid "Price above zero [Kč]" 152 msgstr "" 153 150 154 #: tformmain.listviewoverview.columns[1].caption 151 155 msgctxt "tformmain.listviewoverview.columns[1].caption" -
trunk/SpotPrice.pas
r9 r10 26 26 procedure LoadSpotReport(FileName: string); 27 27 public 28 procedure ClearInterval(IntervalFrom, IntervalTo: TDateTime); 28 29 function GetBlock(var Text: string; StartText, EndText: string): string; 29 procedure LoadSpotPricesFromWeb(Date: TDate); 30 procedure LoadFromWebDate(Date: TDate); 31 procedure LoadFromWeb; 30 32 procedure Import(Directory: string); 31 33 procedure LoadFromXmlNode(Node: TDOMNode); 32 34 procedure SaveToXmlNode(Node: TDOMNode); 33 function SearchByTime(Time: TDateTime): TSpotPrice;35 function SearchByTime(Time: TDateTime): Integer; 34 36 end; 35 37 … … 62 64 end; 63 65 64 procedure TSpotPrices.Load SpotPricesFromWeb(Date: TDate);66 procedure TSpotPrices.LoadFromWebDate(Date: TDate); 65 67 var 66 68 URL: string; … … 73 75 Value: Double; 74 76 begin 75 Clear; 77 ClearInterval(Date, Date + 1); 78 76 79 URL := 'https://spotovaelektrina.cz/denni-ceny/' + DateToStr(Date, XmlFormatSettings); 77 80 with TFPHttpClient.Create(nil) do … … 102 105 end; 103 106 107 procedure TSpotPrices.LoadFromWeb; 108 var 109 I: Integer; 110 begin 111 for I := 1 to 15 do 112 LoadFromWebDate(StrToDate(IntToStr(I) + '.4.2026')); 113 114 Sort(TComparer<TSpotPrice>.Construct(Comparer)); 115 end; 116 104 117 function TSpotPrices.FileNameFilter(FileName: string): Boolean; 105 118 begin … … 134 147 end; 135 148 149 procedure TSpotPrices.ClearInterval(IntervalFrom, IntervalTo: TDateTime); 150 var 151 I: Integer; 152 begin 153 for I := Count - 1 downto 0 do 154 if (Items[I].Time >= IntervalFrom) and (Items[I].Time < IntervalTo) then 155 Delete(I); 156 end; 157 136 158 procedure TSpotPrices.Import(Directory: string); 137 159 var … … 178 200 end; 179 201 180 function TSpotPrices.SearchByTime(Time: TDateTime): TSpotPrice;202 function TSpotPrices.SearchByTime(Time: TDateTime): Integer; 181 203 var 182 204 I: Integer; … … 184 206 I := 0; 185 207 while (I < Count) and (Items[I].Time <> Time) do Inc(I); 186 if I < Count then Result := I tems[I]187 else Result := TSpotPrice.Create(0, 0);208 if I < Count then Result := I 209 else Result := -1; 188 210 end; 189 211
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)