From 63f549bb78df12067411c3fd29eb8d08d4df5da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ljubomir=20=C4=90oki=C4=87?= Date: Mon, 27 Feb 2017 08:05:24 +0100 Subject: [PATCH] =?UTF-8?q?Provera=20mati=C4=8Dnih=20brojeva=20nerezidenat?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do sada program nije prepoznavao matične brojeve nerezidenata. --- unNBS.pas | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/unNBS.pas b/unNBS.pas index c831436..12fdf08 100644 --- a/unNBS.pas +++ b/unNBS.pas @@ -18,7 +18,7 @@ TNBSPodaci = record pib: String; end; -function NBSPretraga(maticniBroj: String): TNBSPodaci; +function NBSPretraga(maticniBroj: String; rezidenti: Boolean = true): TNBSPodaci; implementation @@ -88,7 +88,7 @@ procedure ExtractDelatnostAndPib(htmlTR: IHTMLElement; pib := NasaSlova(pib); end; -function NBSPretraga(maticniBroj: String): TNBSPodaci; +function NBSPretraga(maticniBroj: String; rezidenti: Boolean = true): TNBSPodaci; var lParamList: TStringList; lHTTP: TIdHTTP; Doc: IHTMLDocument2; @@ -109,13 +109,26 @@ function NBSPretraga(maticniBroj: String): TNBSPodaci; lParamList.Add('korisnik='); lParamList.Add('mesto='); lParamList.Add('tip_racuna=1'); - lParamList.Add('rezident=1'); + if rezidenti then + lParamList.Add('rezident=1') + else + lParamList.Add('rezident=0'); lParamList.Add('Submit=Pretra%C5%BEi'); + Result.naziv := ''; + Result.adresa := ''; + Result.racun := ''; + Result.mesto := ''; + Result.status := ''; + Result.opstina := ''; + Result.delatnost := ''; + Result.PIB := ''; + lHTTP := TIdHTTP.Create(nil); lHTTP.Request.CustomHeaders.Add('Content-Type=application/x-www-form-urlencoded'); try Doc := coHTMLDocument.Create as IHTMLDocument2; // create IHTMLDocument2 instance + Doc.Clear; V := VarArrayCreate([0,0], varVariant); V[0] := lHTTP.Post('http://www.nbs.rs/rir_pn/pn_rir.html.jsp?type=rir_results&lang=SER_CIR&konverzija=yes', lParamList); Doc.Write(PSafeArray(TVarData(v).VArray)); // write data from IdHTTP