Predmet: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 post je ureden
1
puta. Posljednja izmjena 04.01.2013 19:07 od strane mrkela.