Predmet:Re: Ideje i rjesenja iz teme fiskalizacija
Evo prvi dio provjere pa probaj kako radi.
Znaci provjerava dali je obrisan file.
Drugi dio cemo provjeravati dali je sve ok.
PreuzmiIzvorni kôd (Visual Basic):Const PutTO = "C:\HCP\TO_FP"
Const PutFrom = "C:\HCP\FROM_FP"
Function ProvjeraP(BrojRac As String) As String
Dim temp As String
Dim ImeF(1 To 2) As String
Dim fs, R, F
Dim Brojac As Integer
Dim i As Integer
BrojRac = "RCP_" & BrojRac & ".XML" ' Broj rac iz polja me.Me.BROIZD + RCP_ tekst
Provjera1:
Set fs = Application.FileSearch
With fs
.LookIn = PutTO
.FileType = 1
If .Execute > 0 Then
For i = 1 To .foundfiles.Count
F = Right(.foundfiles(i), 3)
If F = "XML" Then
ImeF(1) = .foundfiles(i)
ImeF(1) = ImeFajla(ImeF(1))
If ImeF(1) = BrojRac Then
DoEvents
Brojac = Brojac + 1
If Brojac > 5 Then GoTo Izlaz
Zaustavi (Brojac)
GoTo Provjera1
End If
End If
Next i
End If
End With
Provjera2:
Set fs = Application.FileSearch
With fs
.LookIn = PutFrom
.FileType = 1
If .Execute > 0 Then
For i = 1 To .foundfiles.Count
If Right(.foundfiles(1), 3) = "ERR" Then
ImeF(2) = ImeFajla(.foundfiles(1))
ElseIf Right(.foundfiles(1), 2) = "OK" Then
ImeF(2) = PutTO
GoTo Kraj
End If
Next i
End If
End With
Kraj:
Exit Function
Izlaz:
MsgBox " Ra
un nije oštampan"
GoTo Kraj
End Function
Function ImeFajla(PutanjaF As String) As String
'*******************************************
'Ime: ImeDir (Function)
'Sadržaj: Odvaja ime fajla od putanje
'Autor: ZXZ
'Datum: 09 01, 2010, 11:36:53
'Adresa: Tuzla BiH
'Email: zxz@icentar.ba
'Ulazni parametri:Putanja
'Izlazni parametri:Zadnj dir od putanja
'*******************************************
Dim X As Integer
Dim Putanja As String
On Error Resume Next
Putanja = PutanjaF
Start:
Do Until Right$(Putanja, 1) = "\"
Putanja = Left$(Putanja, Len(Putanja) - 1)
Loop
ImeFajla = Mid(PutanjaF, Len(Putanja) + 1)
End Function
Function Zaustavi(Trajanje)
Dim Vrijeme
DoEvents
Trajanje = Trajanje + Timer()
Start:
Vrijeme = Timer()
If Vrijeme < Trajanje Then GoTo Start
End Function
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.