-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.pas
87 lines (63 loc) · 1.94 KB
/
main.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Menus, Grids, ValEdit, ExtCtrls, ComCtrls;
type
TForm1 = class(TForm)
StatusBar1: TStatusBar;
Panel1: TPanel;
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
Label1: TLabel;
procedure btnGetClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function fnStringToCurrency(prm:string):Currency;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses untTcMb;
{$R *.dfm}
procedure TForm1.btnGetClick(Sender: TObject);
var
xml : IXMLTarih_DateType;
i : integer;
str : string;
begin
xml := LoadTarih_Date('http://www.tcmb.gov.tr/kurlar/today.xml');
StatusBar1.Panels[0].Text := IntToStr(xml.Count);
memo1.Lines.Clear;
str := 'Cur.Code' //6
+' | Forex Buy'//12
+' | Forex Sel'//12
+' | Bankn Buy'//12
+' | Bankn Sel'//12
;
memo1.Lines.Add(str);
for i := 0 to (xml.Count-1)do
begin
str := xml.Currency[i].Kod + StringOfChar(' ', 12-length(xml.Currency[i].Kod))
+xml.Currency[i].ForexBuying + StringOfChar(' ', 12-length(xml.Currency[i].ForexBuying))
+xml.Currency[i].ForexSelling + StringOfChar(' ', 12-length(xml.Currency[i].ForexSelling))
+xml.Currency[i].BanknoteBuying + StringOfChar(' ', 12-length(xml.Currency[i].BanknoteBuying))
+xml.Currency[i].BanknoteSelling+ StringOfChar(' ', 12-length(xml.Currency[i].BanknoteSelling));
memo1.Lines.Add(str);
end;
end;
function TForm1.fnStringToCurrency(prm: string): Currency;
begin
if(pos(DecimalSeparator, prm)=0)then //or if(pos(FormatSettings.DecimalSeparator, prm)=0)then
prm := StringReplace(prm, '.',DecimalSeparator, [rfReplaceAll]);
result := StrToCurrDef(prm, 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
memo1.Lines.Clear;
end;
end.