Bosna i Hercegovina



#1 04.01.2013-19:06
mrkela Offline
Clan
Registrovan/a od: 10.11.2008-08:27
Komentari: 7


Subject: Loop petlja
Public Function NapraviFiskal(brojDokumenta As Long)
Dim lnText, lnInText, lnGotovina, lnCek, lnKartica, lnVirman As String

lnGotovina = ""
lnCek = ""
lnKartica = ""
lnVirman = ""

myfiscalfile = fiscalCopyPath + "\" + Format(brojDokumenta, "#####") + ".xml"
fnum = FreeFile()
Open myfiscalfile For Output As fnum

Set kon = New ADODB.Connection
kon.ConnectionString = constr

kon.Open
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM QRepRacunFiskal WHERE Skladiste=1310 and BROJ=" & brojDokumenta, kon, adOpenDynamic, adLockBatchOptimistic

rs.MoveFirst

lnText = "<TremolFpServer Command=""Receipt"" " 'Description="" Fiskalni Racun "">"
If (rs!Gotovina > 0) Then
lnGotovina = "<Payment Type=""Gotovina"" Amount=""" + FormatMe(rs!Gotovina) + """ />"
End If
If (rs!Virman > 0) Then
lnVirman = "<Payment Type=""Virman"" Amount=""" + FormatMe(rs!Virman) + """ />"
End If
If (rs!Kartica > 0) Then
lnVirman = "<Payment Type=""Kartica"" Amount=""" + FormatMe(rs!Kartica) + """ />"
End If
If (rs!Cek > 0) Then
lnCek = "<Payment Type=""Ček"" Amount=""" + FormatMe(rs!Cek) + """ />"
End If

Print #fnum, "<?xml version=""1.0"" encoding=""utf-8"" ?>"
If (Trim(rs!Komitent) <> "" And Trim(rs!Komitent <> "010") And rs!Komitent <> "010 ") Then
lnText = lnText + "CompanyID=""" + rs!KomitentID + """ CompanyName=""" + rs!KomitentNaziv _
+ """ CompanyHQ=""" + rs!KomitentSjediste + """ CompanyAddress=""" + rs!KomitentAdresa _
+ """ CompanyCity=""" + rs!KomitentGrad + """"
End If

lnText = lnText + " Description="" Fiskalni Racun "">"
Print #fnum, lnText '"<TremolFpServer Command=""Receipt"" Description="" Fiskalni Racun "">"

Do While (rs.EOF = False)

lnInText = "<Item Description=""" + rs!NazivArtikla + """ Discount=""" + FormatMe(rs!RabatP) + "%"" Quantity=""" + _
FormatMe(rs!Kolicina) + """ Price=""" + FormatMe(rs!Cijena) + _
""" VatInfo=""" + Format(rs!FiskalTarifa, "0") + """ Department=""1"" />"
Print #fnum, lnInText

rs.MoveNext

Loop 'Kako zaustaviti petlju kad doda sve artikle s liste i da doda ove doli dvije (AdditionalLine Message) linije.Jer ovako sad kako je javi mi grešku na ovim dvima dolje linijama..'

'Print #fnum, "<Payment Type=""Gotovina"" Amount=""100.95"" />"
'Print #fnum, "<Payment Type=""Gotovina"" Amount=""100.95"" />"
If lnGotovina <> "" Then Print #fnum, lnGotovina
If lnKartica <> "" Then Print #fnum, lnKartica
If lnVirman <> "" Then Print #fnum, lnVirman
If lnCek <> "" Then Print #fnum, lnCek

Print #fnum, "<AdditionalLine Message=""Br. fakt.:" + rs!PuniiBroj + """ />"
Print #fnum, "<AdditionalLine Message=""" + rs!Nefiskal + """ />"
Print #fnum, "</TremolFpServer>"
Close #fnum
rs.Close
CekajFiskalOdgovor brojDokumenta
End Function
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 04.01.2013-19:07 od strane mrkela. ↑  ↓

#2 04.01.2013-21:53
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,742


Subject: Re: Loop petlja
Nij emi jasno.
Morat ces staviti primjer.
U doo petlji si rekao da broji dok ima sto znaci da sama treba da iskoci.
Do While (rs.EOF = False)
Pozdrav
↑  ↓

#3 05.01.2013-09:25
mrkela Offline
Clan
Registrovan/a od: 10.11.2008-08:27
Komentari: 7


Subject: Re: Loop petlja
Mislio sam da mi je problem u Loop petlji al očito nije, jer meni neće da se izvrše donje dvije linije tu mi iskoči i javi grešku, ne znam više gdje sam fulao.. Ovo mi je primjer kad ide na fiskalni sa svim stavkama(artiklima), a isti primjer imam i Ukupno po stavki gdje nemam Loop petlju a gdje mi to sve radi.

Print #fnum, "<AdditionalLine Message=""Br. fakt.:" + rs!PuniiBroj + """ />"
Print #fnum, "<AdditionalLine Message=""" + rs!Nefiskal + """ />"
↑  ↓

#4 05.01.2013-10:00
dex Offline
Super Moderator
Registrovan/a od: 23.02.2012-19:59
Komentari: 605


Subject: Re: Loop petlja
iza loop stavi rs.movelast

ovako citas podatke iz praznog recorda
↑  ↓

#5 05.01.2013-15:29
mrkela Offline
Clan
Registrovan/a od: 10.11.2008-08:27
Komentari: 7


Subject: Re: Loop petlja
Hvala dexxxl to je to..
↑  ↓

Stranice (1): 1


All times are GMT +01:00. Current time: 24.09.2018-12:41.