- Timestamp:
- Apr 13, 2026, 11:12:39 PM (2 weeks ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
Ean.pas (modified) (6 diffs)
-
EdcProject.pas (modified) (2 diffs)
-
FormMain.lfm (modified) (5 diffs)
-
FormMain.lrj (modified) (2 diffs)
-
FormMain.pas (modified) (4 diffs)
-
Languages/EdcStats.cs.po (modified) (4 diffs)
-
Languages/EdcStats.pot (modified) (2 diffs)
-
Packages/Common/XML.pas (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ean.pas
r7 r8 13 13 TEanValue = record 14 14 Time: TDateTime; 15 ValueIn: Single;16 ValueOut: Single;17 class function Create(Time: TDateTime; ValueIn, ValueOut: Single): TEanValue; static;15 ValueIn: Currency; 16 ValueOut: Currency; 17 class function Create(Time: TDateTime; ValueIn, ValueOut: Currency): TEanValue; static; 18 18 function GetShared: Double; 19 19 procedure LoadFromXmlNode(Node: TDOMNode); … … 45 45 function GetTotalOut(TimeFrom, TimeTo: TDateTime): Double; 46 46 function GetShared(TimeFrom, TimeTo: TDateTime): Double; 47 function GetSavings(TimeFrom, TimeTo: TDateTime): Integer; 47 48 procedure LoadFromXmlNode(Node: TDOMNode); 48 49 procedure SaveToXmlNode(Node: TDOMNode); … … 87 88 { TEanValue } 88 89 89 class function TEanValue.Create(Time: TDateTime; ValueIn, ValueOut: Single90 class function TEanValue.Create(Time: TDateTime; ValueIn, ValueOut: Currency 90 91 ): TEanValue; 91 92 begin … … 104 105 begin 105 106 Time := ReadDateTime(Node, 'Time', Time); 106 ValueIn := Read Double(Node, 'ValueIn', ValueIn);107 ValueOut := Read Double(Node, 'ValueOut', ValueOut);107 ValueIn := ReadCurrency(Node, 'ValueIn', 0); 108 ValueOut := ReadCurrency(Node, 'ValueOut', 0); 108 109 end; 109 110 … … 111 112 begin 112 113 if Time <> 0 then WriteDateTime(Node, 'Time', Time); 113 if ValueIn <> 0 then Write Double(Node, 'ValueIn', ValueIn);114 if ValueOut <> 0 then Write Double(Node, 'ValueOut', ValueOut);114 if ValueIn <> 0 then WriteCurrency(Node, 'ValueIn', ValueIn); 115 if ValueOut <> 0 then WriteCurrency(Node, 'ValueOut', ValueOut); 115 116 end; 116 117 … … 176 177 if TotalIn <> 0 then Result := (1 - GetTotalOut(TimeFrom, TimeTo) / TotalIn) * 100 177 178 else Result := 0; 179 end; 180 181 function TEan.GetSavings(TimeFrom, TimeTo: TDateTime): Integer; 182 var 183 TotalIn: Double; 184 TotalOut: Double; 185 begin 186 TotalIn := GetTotalIn(TimeFrom, TimeTo); 187 TotalOut := GetTotalOut(TimeFrom, TimeTo); 188 Result := Trunc((TotalIn - TotalOut) * PriceLow); 178 189 end; 179 190 -
trunk/EdcProject.pas
r7 r8 147 147 TimeFrom: TDateTime; 148 148 TimeTo: TDateTime; 149 CellValueIn: Double;150 CellValueOut: Double;149 CellValueIn: Currency; 150 CellValueOut: Currency; 151 151 Ean: TEan; 152 152 EanKind: TEanKind; 153 153 Number: string; 154 A: Currency; 154 155 begin 155 156 CSVDoc := TCSVDocument.Create; … … 186 187 187 188 CellValueIn := 0; 188 if TryStrTo Float(CSVDoc.Cells[3 + C * 2, R], CellValueIn) then begin189 if TryStrToCurr(CSVDoc.Cells[3 + C * 2, R], CellValueIn) then begin 189 190 if EanKind = ekConsumption then CellValueIn := -CellValueIn; 190 191 end; 191 192 192 193 CellValueOut := 0; 193 if TryStrTo Float(CSVDoc.Cells[3 + C * 2 + 1, R], CellValueOut) then begin194 if TryStrToCurr(CSVDoc.Cells[3 + C * 2 + 1, R], CellValueOut) then begin 194 195 if EanKind = ekConsumption then CellValueOut := -CellValueOut; 195 196 end; -
trunk/FormMain.lfm
r7 r8 20 20 Top = 56 21 21 Width = 1176 22 ActivePage = TabSheet Overview22 ActivePage = TabSheetData 23 23 Anchors = [akTop, akLeft, akRight, akBottom] 24 TabIndex = 024 TabIndex = 3 25 25 TabOrder = 0 26 26 object TabSheetOverview: TTabSheet … … 62 62 end 63 63 item 64 Caption = 'Low price' 65 Width = 100 66 end 67 item 68 Caption = 'High price' 69 Width = 100 70 end 71 item 72 Caption = 'Spot price' 73 Width = 135 64 Caption = 'Low price [Kč]' 65 Width = 100 66 end 67 item 68 Caption = 'High price [Kč]' 69 Width = 100 70 end 71 item 72 Caption = 'Spot price [Kč]' 73 Width = 100 74 end 75 item 76 Caption = 'Savings [Kč]' 74 77 end> 75 78 PopupMenu = PopupMenuOverview … … 228 231 item 229 232 Caption = 'Time' 230 Width = 100233 Width = 200 231 234 end 232 235 item … … 235 238 end 236 239 item 240 Caption = 'Result' 241 Width = 100 242 end 243 item 237 244 Caption = 'Shared [%]' 238 Width = 929245 Width = 729 239 246 end> 240 247 ReadOnly = True … … 258 265 Style = csDropDownList 259 266 TabOrder = 1 260 OnSelect = ComboBoxEan Select267 OnSelect = ComboBoxEanDataSelect 261 268 end 262 269 end -
trunk/FormMain.lrj
r7 r8 8 8 {"hash":145998637,"name":"tformmain.listview1.columns[4].caption","sourcebytes":[83,104,97,114,101,100,32,91,37,93],"value":"Shared [%]"}, 9 9 {"hash":335940,"name":"tformmain.listview1.columns[5].caption","sourcebytes":[75,105,110,100],"value":"Kind"}, 10 {"hash":158850293,"name":"tformmain.listview1.columns[6].caption","sourcebytes":[76,111,119,32,112,114,105,99,101],"value":"Low price"}, 11 {"hash":175333445,"name":"tformmain.listview1.columns[7].caption","sourcebytes":[72,105,103,104,32,112,114,105,99,101],"value":"High price"}, 12 {"hash":108144885,"name":"tformmain.listview1.columns[8].caption","sourcebytes":[83,112,111,116,32,112,114,105,99,101],"value":"Spot price"}, 10 {"hash":237609437,"name":"tformmain.listview1.columns[6].caption","sourcebytes":[76,111,119,32,112,114,105,99,101,32,91,75,196,141,93],"value":"Low price [K\u010D]"}, 11 {"hash":221060461,"name":"tformmain.listview1.columns[7].caption","sourcebytes":[72,105,103,104,32,112,114,105,99,101,32,91,75,196,141,93],"value":"High price [K\u010D]"}, 12 {"hash":19813853,"name":"tformmain.listview1.columns[8].caption","sourcebytes":[83,112,111,116,32,112,114,105,99,101,32,91,75,196,141,93],"value":"Spot price [K\u010D]"}, 13 {"hash":215185821,"name":"tformmain.listview1.columns[9].caption","sourcebytes":[83,97,118,105,110,103,115,32,91,75,196,141,93],"value":"Savings [K\u010D]"}, 13 14 {"hash":21335,"name":"tformmain.tabsheetlog.caption","sourcebytes":[76,111,103],"value":"Log"}, 14 15 {"hash":4843668,"name":"tformmain.tabsheetchart.caption","sourcebytes":[67,104,97,114,116],"value":"Chart"}, … … 20 21 {"hash":372789,"name":"tformmain.listview2.columns[0].caption","sourcebytes":[84,105,109,101],"value":"Time"}, 21 22 {"hash":193645956,"name":"tformmain.listview2.columns[1].caption","sourcebytes":[77,101,97,115,117,114,101,100],"value":"Measured"}, 22 {"hash":145998637,"name":"tformmain.listview2.columns[2].caption","sourcebytes":[83,104,97,114,101,100,32,91,37,93],"value":"Shared [%]"}, 23 {"hash":93105204,"name":"tformmain.listview2.columns[2].caption","sourcebytes":[82,101,115,117,108,116],"value":"Result"}, 24 {"hash":145998637,"name":"tformmain.listview2.columns[3].caption","sourcebytes":[83,104,97,114,101,100,32,91,37,93],"value":"Shared [%]"}, 23 25 {"hash":300570,"name":"tformmain.label4.caption","sourcebytes":[69,65,78,58],"value":"EAN:"}, 24 26 {"hash":19081,"name":"tformmain.comboboxperiod.text","sourcebytes":[68,97,121],"value":"Day"}, -
trunk/FormMain.pas
r7 r8 65 65 procedure ButtonIntervalRightClick(Sender: TObject); 66 66 procedure CheckBoxShowResultChange(Sender: TObject); 67 procedure ComboBoxEanDataSelect(Sender: TObject); 67 68 procedure ComboBoxEanSelect(Sender: TObject); 68 69 procedure ComboBoxPeriodSelect(Sender: TObject); … … 139 140 end; 140 141 142 procedure TFormMain.ComboBoxEanDataSelect(Sender: TObject); 143 begin 144 ReloadListViewData; 145 end; 146 141 147 procedure TFormMain.ButtonIntervalRightClick(Sender: TObject); 142 148 begin … … 348 354 ListItem.SubItems.Add(FloatToStr(PriceHigh)); 349 355 ListItem.SubItems.Add(FloatToStr(PriceSpot)); 356 ListItem.SubItems.Add(IntToStr(GetSavings(IntervalFrom, IntervalTo))); 350 357 end; 351 358 finally … … 367 374 ListView2.BeginUpdate; 368 375 try 369 for I := 0 to Ean.Values.Count - 1 do begin 376 for I := 0 to Ean.Values.Count - 1 do 377 with Ean.Values[I] do 378 if (Time >= IntervalFrom) and (Time < IntervalTo) then begin 370 379 ListItem := ListView2.Items.Add; 371 ListItem.Caption := DateTimeToStr(Ean.Values[I].Time); 372 ListItem.SubItems.Add(FloatToStr(Ean.Values[I].ValueIn)); 373 ListItem.SubItems.Add(IntToStr(Trunc(Ean.Values[I].GetShared))); 380 ListItem.Caption := DateTimeToStr(Time); 381 ListItem.SubItems.Add(FloatToStr(ValueIn)); 382 ListItem.SubItems.Add(FloatToStr(ValueOut)); 383 ListItem.SubItems.Add(IntToStr(Trunc(GetShared))); 374 384 end; 375 385 finally -
trunk/Languages/EdcStats.cs.po
r7 r8 154 154 155 155 #: tformmain.listview1.columns[6].caption 156 msgid "Low price "157 msgstr "Nízk a cena"156 msgid "Low price [Kč]" 157 msgstr "Nízká cena [Kč]" 158 158 159 159 #: tformmain.listview1.columns[7].caption 160 msgid "High price "161 msgstr "Vysoká cena "160 msgid "High price [Kč]" 161 msgstr "Vysoká cena [Kč]" 162 162 163 163 #: tformmain.listview1.columns[8].caption 164 msgid "Spot price" 165 msgstr "Spotová cena" 164 msgid "Spot price [Kč]" 165 msgstr "Spotová cena [Kč]" 166 167 #: tformmain.listview1.columns[9].caption 168 msgid "Savings [Kč]" 169 msgstr "Úspory [Kč]" 166 170 167 171 #: tformmain.listview2.columns[0].caption … … 177 181 #: tformmain.listview2.columns[2].caption 178 182 msgctxt "tformmain.listview2.columns[2].caption" 183 msgid "Result" 184 msgstr "Výsledek" 185 186 #: tformmain.listview2.columns[3].caption 187 msgctxt "tformmain.listview2.columns[3].caption" 179 188 msgid "Shared [%]" 180 189 msgstr "Sdíleno [%]" … … 182 191 #: tformmain.menuitemfile.caption 183 192 msgid "File" 184 msgstr " "193 msgstr "Soubor" 185 194 186 195 #: tformmain.menuitemimportreports.caption 187 196 msgid "Import reports" 188 msgstr " "197 msgstr "Import hlášení" 189 198 190 199 #: tformmain.menuitemimportspotprices.caption 191 200 msgctxt "tformmain.menuitemimportspotprices.caption" 192 201 msgid "Import spot prices" 193 msgstr " "202 msgstr "Import spotových cen" 194 203 195 204 #: tformmain.menuitemload.caption 196 205 msgid "Load" 197 msgstr " "206 msgstr "Načíst" 198 207 199 208 #: tformmain.menuitemremove.caption 200 209 msgid "Remove" 201 msgstr " "210 msgstr "Odstranit" 202 211 203 212 #: tformmain.menuitemsave.caption 204 213 msgid "Save" 205 msgstr " "214 msgstr "Uložit" 206 215 207 216 #: tformmain.menuitemtools.caption 208 #, fuzzy209 217 msgctxt "tformmain.menuitemtools.caption" 210 218 msgid "Tools" … … 227 235 msgid "Overview" 228 236 msgstr "Přehled" 229 -
trunk/Languages/EdcStats.pot
r7 r8 144 144 145 145 #: tformmain.listview1.columns[6].caption 146 msgid "Low price "146 msgid "Low price [Kč]" 147 147 msgstr "" 148 148 149 149 #: tformmain.listview1.columns[7].caption 150 msgid "High price "150 msgid "High price [Kč]" 151 151 msgstr "" 152 152 153 153 #: tformmain.listview1.columns[8].caption 154 msgid "Spot price" 154 msgid "Spot price [Kč]" 155 msgstr "" 156 157 #: tformmain.listview1.columns[9].caption 158 msgid "Savings [Kč]" 155 159 msgstr "" 156 160 … … 167 171 #: tformmain.listview2.columns[2].caption 168 172 msgctxt "tformmain.listview2.columns[2].caption" 173 msgid "Result" 174 msgstr "" 175 176 #: tformmain.listview2.columns[3].caption 177 msgctxt "tformmain.listview2.columns[3].caption" 169 178 msgid "Shared [%]" 170 179 msgstr "" -
trunk/Packages/Common/XML.pas
r7 r8 15 15 procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime); 16 16 procedure WriteDouble(Node: TDOMNode; Name: string; Value: Double); 17 procedure WriteCurrency(Node: TDOMNode; Name: string; Value: Currency); 17 18 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 18 19 function ReadInt64(Node: TDOMNode; Name: string; DefaultValue: Int64): Int64; … … 21 22 function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime; 22 23 function ReadDouble(Node: TDOMNode; Name: string; DefaultValue: Double): Double; 24 function ReadCurrency(Node: TDOMNode; Name: string; DefaultValue: Currency): Currency; 23 25 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); 24 26 … … 60 62 if Assigned(NewNode) then 61 63 Result := StrToFloat(string(NewNode.TextContent), XmlFormatSettings); 64 end; 65 66 function ReadCurrency(Node: TDOMNode; Name: string; DefaultValue: Currency 67 ): Currency; 68 var 69 NewNode: TDOMNode; 70 begin 71 Result := DefaultValue; 72 NewNode := Node.FindNode(DOMString(Name)); 73 if Assigned(NewNode) then 74 Result := StrToCurr(string(NewNode.TextContent), XmlFormatSettings); 62 75 end; 63 76 … … 247 260 end; 248 261 262 procedure WriteCurrency(Node: TDOMNode; Name: string; Value: Currency); 263 var 264 NewNode: TDOMNode; 265 begin 266 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 267 NewNode.TextContent := DOMString(CurrToStr(Value, XmlFormatSettings)); 268 Node.AppendChild(NewNode); 269 end; 270 249 271 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 250 272 var
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)