Sub Export2TP
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim Zeitraum As NotesDocument
Dim vw As NotesView
Dim collection As NotesDocumentCollection
Dim PZNNummer As String
Dim Kundennummer As String
Dim menge As Double
Dim Rabatt As Double
Dim fileNum As Integer
Dim pzn As String
Dim id As String
Dim rabattpos As Double
Dim Zeilenz As Long
Dim Eingabe As String
Dim tempEingabe As String
Dim workspace As New NotesUIWorkspace
Dim starttime As New notesdatetime("")
Dim endtime As New notesdatetime("")
Dim differenceinseconds As Double
Dim objErrorContainer As ErrorContainer
Dim satz As rec
Dim vwEntryCount As Long
Dim wert As String
Dim wert1 As String
Dim delim As String
Dim daten As Variant
Dim objProgressBar As ProgressBar
Dim I As Integer
Dim K As Integer
%REM Debug-Modus
0 = False
1 = True
%END REM
Const DEBUG = 0
If DEBUG = 0 Then
On Error Goto err_handler
End If
Call starttime.setnow()
Eingabe = Inputbox$("Datum eingeben (Format: z.B. 200409) für Sept. 2004:","Export2TurboPlan - Auswahl des Zeitraums")
If Eingabe = "" Then
Msgbox "Achtung!" & Chr(13) & "Sie haben nichts eingegeben."
Exit Sub
End If
fileNum% = Freefile()
Open "c:\GKVRabatte.txt" For Output As fileNum%
satz.pzn = "pzn"
satz.id = "id"
satz.menge = "menge"
satz.rabatt = "rabatt"
Print #fileNum%, satz.pzn, satz.id, satz.menge, satz.rabatt
Set db = s.CurrentDatabase
Set vw = db.GetView("(LookupbyAbgabeDatum)")
Set vwEntryCollection = vw.GetAllEntriesByKey(Eingabe,True)
vwEntryCount = vwEntryCollection.Count
If vwEntryCount > 0 Then
Set objProgressBar = New ProgressBar(False)
objProgressBar.Title = "Export nach TurboPlan"
objProgressBar.Information = "Jetzt geht es los"
Set vwEntry = vwEntryCollection.GetFirstEntry
Do
Zeilenz = Zeilenz + 1
objProgressBar.Value = Cint((Zeilenz/vwEntryCount)*100)
delim = "~"
wert = Cstr(vwEntry.ColumnValues(1))
daten = vwEntry.ColumnValues(2)
If Isarray(daten) Then
For i = 0 To Ubound(daten)
satz.pzn = Strtoken(daten(i),delim,3)
satz.menge = Strtoken(daten(i),delim,4)
satz.rabatt = Strtoken(daten(i),delim,6) * (-1)
satz.rabatt = Format$(Strtoken(daten(i),delim,6),"##0.00") * (-1)
Print #fileNum%, satz.pzn, wert, satz.menge, satz.rabatt
Next
Else
satz.pzn = Strtoken(vwEntry.ColumnValues(2),delim,3)
satz.menge = Strtoken(vwEntry.ColumnValues(2),delim,4)
satz.rabatt = Strtoken(vwEntry.ColumnValues(2),delim,6) * (-1)
Print #fileNum%, satz.pzn, wert, satz.menge, satz.rabatt
End If
Set vwEntry = vwEntryCollection.GetNextEntry(vwEntry)
Loop Until (vwEntry Is Nothing)
End If
Close fileNum%
Call endtime.setnow()
differenceinseconds = starttime.timedifferencedouble(endtime) * (-1)
Print "Zeit in Sekunden " & differenceinseconds
Exit Sub
err_handler:
Set objErrorContainer = New ErrorContainer (Err, Erl, Error)
objErrorContainer.Procedure = "Export2TP"
Call ErrorProcessingUI(objErrorContainer, doc)
Resume err_resume
err_resume:
End Sub