1

Konu: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

Arkadaşlar kendimde kullanmayı düşündüğüm bir sey geliştirdim sizlerlede paylaşmak istedim

Visual Fox Pro
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
PUBLIC odaily_currency

 
odaily_currency=NEWOBJECT("daily_currency")
odaily_currency.Show
RETURN
 
 
    **************************************************
*-- Form:         daily_currency (d:\soykan\mysoftware\depomatik\form\daily_currency.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   02/15/10 11:35:04 AM
*
DEFINE CLASS daily_currency AS form
 
 
    Top = 0
    Left = 0
    Height = 410
    Width = 211
    DoCreate = .T.
    Tag = "daily_currency"
    BorderStyle = 0
    Caption = "Döviz Kurları"
    MaxButton = .F.
    MinButton = .F.
    Movable = .F.
    Icon = "..\static\vs_ico.ico"
    Name = "daily_currency"
 
 
    ADD OBJECT oie AS olecontrol WITH ;
        Top = 0, ;
        Left = 0, ;
        Height = 410, ;
        Width = 210, ;
        Name = "OIE",;
     OleClass = 'Shell.Explorer'
 
 
 
    PROCEDURE Destroy
        ERASE 'doviz.htm'
        ERASE 'NoDoviz.htm'
    ENDPROC
 
 
    PROCEDURE Init
        Local lcDovizHtml,lcNoDovizHtml
        lcDovizHtml = Sys(5)+Curdir()+'doviz.htm'
        lcNoDovizHtml = Sys(5)+Curdir()+'Nodoviz.htm'
 
        Local lcURL
        lcURL=[http://www.google.com/]
 
        Declare Integer InternetCheckConnection In Wininet.Dll String Url, Long dwFlags, Long Reserved
        If InternetCheckConnection(lcURL, 1, 0) != 0
            *Return .T.
            TEXT TO m.lcDoviz TEXTMERGE noshow
        <script type="text/javascript" src="http://www.doviz.com/script/widget.js">
        </script>
        <script type="text/javascript">_dovizCurrency('USD_EUR','','http://www.doviz.com/')</script>
        <div style="width:100%;text-align:center;font-size:11px">
        <a style="text-decoration:none;color:#000000" href="http://www.doviz.com/" title="Döviz, Dolar, Euro, Sterlin" target="_blank">
        </a>
        </div>
            ENDTEXT
 
 
            If ! File('doviz.htm')
                Strtofile(m.lcDoviz,m.lcDovizHtml)
            Endif
 
            With Thisform.OIE
                .Navigate2('file://'+m.lcDovizHtml)
                Do While .ReadyState # 4 && Wait for ready state
                Enddo
            Endwith
 
        Else
            *Return .F.
            *Messagebox('bla bla',16,_Screen.Caption)
            Local NoInternetImage
            NoInternetImage = 'static/internet-main_full.jpg'
 
            TEXT TO m.lcNoDoviz TEXTMERGE noshow
        <html>
        <head>
        <title>Doviz Kurları</title>
        <style type="text/css">
        .Soykan {
        font-family:,Georgia,ms trebuchet,tahoma,Verdana, Arial, Helvetica, sans-serif;
        font-size:12px;
        font-weight: bold;
        color:Red;
        text-align:center;
        }
        .GreyBox {border: 1px solid #CCCCCC;}
        #fox4um
        {
            width:160px;
            height:330px;
            padding:1px;
        }
        </style>
        </head>
        <body>
        <div id="fox4um"class="GreyBox">
        <span class="Soykan">Internet Baglantiniz Yok !!! </span>
        <br />
        <img src= "static/internet-main_full.jpg" width="159" height="329" /></img>
        </div>
        </body>
        </html>
            ENDTEXT
 
            If ! File('NoDoviz.htm')
                Strtofile(m.lcNoDoviz,m.lcNoDovizHtml)
            Endif
 
 
            With Thisform.OIE
                .Navigate2('file://'+m.lcNoDovizHtml)
                Do While .ReadyState # 4 && Wait for ready state
                Enddo
            Endwith
        Endif
 
        With This As Form
            .Width = .OIE.Width
            .Height = .OIE.Height
            .Left = (Sysmetric(1)-.Width)-10
        Endwith
    ENDPROC
 
 
ENDDEFINE
*
*-- EndDefine: daily_currency
**************************************************
http://www.soykansoft.com/images/twitter.jpghttp://www.soykansoft.com/images/wp.jpghttp://www.soykansoft.com/images/blogger.jpg

2

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

Soykan abi kod çalışmıyor ( yada bende bir sorun var ) Daha doğrusu ekranda bir şey göstermiyor

Son düzenleyen, ugurlu2001 (15.02.2010 12:17:52)

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

3

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

doviz.htm olusmus ise gostermesi gerek

http://www.soykansoft.com/images/twitter.jpghttp://www.soykansoft.com/images/wp.jpghttp://www.soykansoft.com/images/blogger.jpg

4

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

ben test ettim çok güzel çalışıyor gerçekten işe yarayacak bir kod

5

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

Soykan bey kod bende çalışıyor. Gayet güzel olmuş. Elinize bilginize sağlık.

6

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

Bu da aynı siteden veriyi XML olarak alan kod:

Visual Fox Pro
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
clea

create cursor xmlcurs1(kod c(3),adi c(20),alis c(6),satis c(6),saat c(20),b c(35))
xurl1="http://www.doviz.com/feed/doviz.php?bank=free"
oxml=createobject("msxml2.domdocument")
oxml.async=.f.
oxml.load(xurl1)
xsaat="-"
xmlkatoku(oxml,2)
delete for alltrim(xmlcurs1.adi)="DOVIZ.COM"
brow
retu
 
 
************************
proc xmlkatoku(okat,xmc)
    for each mkat in okat.childnodes
        if mkat.nodetype<3 and mkat.childnodes.length=1
            nn=upper(allt(mkat.nodename))
            mt=upper(allt(mkat.text))
            do case
                case nn="PUBDATE"
                    xsaat=left(right(mt,14),8)
                case nn="TITLE"
                    append blank
                    replace adi with mt
                    replace saat with xsaat
                    xkod="-"
                    do case
                        case mt="AVUSTRALYA"
                            xkod="AUD"
                        case mt="KANADA"
                            xkod="CAD"
                        case mt="İSVIÇRE"
                            xkod="CHF"
                        case mt="İNGILIZ"
                            xkod="GBP"
                        case mt="JAPON"
                            xkod="JPY"
                        case mt="NORVEÇ"
                            xkod="NOK"
                        case mt="DANIMARKA"
                            xkod="DKK"
                        case mt="EURO"
                            xkod="EUR"
                        case mt="ARABISTAN"
                            xkod="SAR"
                        case mt="İSVEÇ"
                            xkod="SEK"
                        case mt="AMERIKAN"
                            xkod="USD"
                        case mt="ÇIN"
                            xkod="CNY"
                        case mt="RUS"
                            xkod="RUB"
                        case mt="IRAK"
                            xkod="IQD"
                    endcase
                    replace kod with xkod
                case nn="DESCRIPTION"
                    replace b with mt
                    xcal=alltrim(strextract(mt,'ALıŞ','TL',1,1))
                    xsat=alltrim(strextract(mt,'SATıŞ:','TL',1,1))
                    replace alis  with xcal
                    replace satis with xsat
            endcase
        endif
        if (mkat.haschildnodes)
            xmlkatoku(mkat,xmc+1)
        endif
    next
endproc


Kod daha uzundu, gereksiz kısımları ayıklamaya çalıştım. Anlamsız parçalar kalmış olabilir.

7

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

Birol alternatif kod için teşekkür bu aklıma başka bir şey getirdi smile

arkadaslar ayrica
<script type="text/javascript">_dovizCurrency('USD_EUR','','http://www.doviz.com/')</script>
satirindaki USD_EUR yi USD_EUR_GBP_JPY gibi degistirerek daha fazla döviz gösterebilirsiniz

http://www.soykansoft.com/images/twitter.jpghttp://www.soykansoft.com/images/wp.jpghttp://www.soykansoft.com/images/blogger.jpg

8

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

ben yıllardır TCMB kullanıyorum.
kurları aşağıdaki kodla alabiliyorum, kodun kaynağını hatırlayamadım

Visual Fox Pro
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
lcURL = "http://www.tcmb.gov.tr/kurlar/today.xml"

 
oForm = Createobject('readxml', m.lcURL)
Select Doviz
browse
COPY TO den
 
Define Class readxml As Form
Add Object htmlviewer As OleControl With ;
OleClass = 'Shell.Explorer'
 
Procedure Init
Lparameters tcURL
With Thisform.htmlviewer
.Navigate2(m.tcURL)
Do While .ReadyState # 4 && Wait for ready state
EndDo
XMLToCursor(this.htmLVIEWER.Object.Document.XMLDocument.XML,'Doviz')
Return .F.
Endwith
Endproc
Enddefine
VFP9 SP2

9

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

Ben de sanirim bu kodu birisi sordugu icin yazmistim ve sonra Foxite'da bir tartisma nedeniyle biraz daha gelismisti diye hatirliyorum:

Visual Fox Pro
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
GetDailyCurrencies() && date(), doviz - bugun, 'doviz' adli cursore

Select doviz
Browse
 
GetDailyCurrencies(DATE()-10,'myCursor') && 10 gun oncesini 'myCursor' adli cursore
Select myCursor
Browse
 
 
PROCEDURE GetDailyCurrencies(tdDate,tcCursorName)
tdDate = EVL(m.tdDate,DATE())
tcCursorName = EVL(m.tcCursorName,'doviz')
Local lcURL,lcLocalFile,lcXML,lnSelect
lcURL = "http://www.tcmb.gov.tr/kurlar/"
If m.tdDate = Date()
  lcURL = m.lcURL + "today.xml"
Else
  lcURL = m.lcURL +   ;
    Left(Ttoc(m.tdDate,1),6)+"/"+;
    PADL(Day(m.tdDate),2,'0')+;
    PADL(Month(m.tdDate),2,'0')+;
    padl(Year(m.tdDate),4)+".xml"
Endif
 
lnSelect = SELECT()
lcLocalFile = Forcepath(Sys(2015)+'.xml',Sys(2023))
If getFileFromURL(m.lcURL,m.lcLocalFile) = 0
  lcXML = Filetostr(m.lcLocalFile)
  Erase (m.lcLocalFile)
  ParseDoviz(m.lcXML,tcCursorName)
ENDIF
SELECT (m.lnSelect)
 
Procedure getFileFromURL
  Lparameters tcRemoteFile,tcLocalFile
  Declare Integer URLDownloadToFile In urlmon.Dll;
    INTEGER pCaller, String szURL, String szFileName,;
    INTEGER dwReserved, Integer lpfnCB
  Return URLDownloadToFile(0, m.tcRemoteFile, m.tcLocalFile, 0, 0)
 
 
Procedure ParseDoviz(tcXML,tcCursorName)
  Local lcCurrencyCode
  Local Array aReplacement[OCCURS('<Currency ',m.tcXML),2]
  For ix=1 To Occurs('<Currency ',m.tcXML)
    lcCurrencyCode = Strextract(m.tcXML,'<Currency ','>',m.ix,1+4)
    aReplacement[m.ix,1] = m.lcCurrencyCode
    aReplacement[m.ix,2] = ;
      GETWORDNUM(m.lcCurrencyCode,1)+'>'+;
      '<Kod>'+Strextract(Getwordnum(m.lcCurrencyCode,2),'"','"')+'</Kod>'+;
      '<CurrencyCode>'+Strextract(Getwordnum(m.lcCurrencyCode,3),'"','"')+'</CurrencyCode>'
  Endfor
  For ix=1 To Alen(aReplacement,1)
    m.tcXML = Strtran(m.tcXML,aReplacement[m.ix,1],aReplacement[m.ix,2])
  Endfor
  Xmltocursor(m.tcXML,m.tcCursorName)
Endproc
Yen yaz 1907'ye yolla FB gelsin evinde yensin.
(sonra salaklar ciksin alin terine şike desin)

10

Re: Form Üzerinde Html Sayfada Döviz Kurları Gösterimi

kurlari bir tabloda saklamak ve uygulama icinde kullanmak icin bende Cetin hocamin kodlarini kullaniyorum ,
buda serbest piyasa + bankalarin verilerini görsel olarak göstermek için yaptığım bir çalışma idi.

http://www.soykansoft.com/images/twitter.jpghttp://www.soykansoft.com/images/wp.jpghttp://www.soykansoft.com/images/blogger.jpg