Help me fix my app

Wednesday 15th September, 2004
I purchased a Vacation booking system from a previous employer as I knew it would be of great use in house. It all works well except for one little bug. The HR department sets up a user and give them holiday entitlement for the current year. A summary document is then created which contains the number of days holiday the user has left, who's is authorised to update the document etc. Each time a holiday is approved, this document is updated. Now this works very well each time, except the first time.

After a user is created on the system, everything works as intended except for the first booking which is never taken away from their unused holiday. The book a day off and their "unused" value remains the same. They book another day holiday and this time all is updated as intended. Same form, same docs, same approver, same button.

All of this is done in LotusScript and I haven't got a clue. During the query save it should all happen, which it does second and all subsequent times. The first time never works though. Here's the script code. Can anyone help?

Sub Querysave(Source As Notesuidocument, Continue As Variant)
    Dim HolDates As Variant
    Dim CalDates As String
    Dim wd As Integer, dCtr As Integer
    'If Not uid.FieldGetText("Lock_Formulas")="Y" Then
    Forall Dates In HolDates
            If Not(wd=1 Or wd=7) Then
                    If dCtr=0 Then
                            CalDates=CalDates & Cstr(Dates)
                            CalDates=CalDates & ", " & Cstr(Dates)
                    End If
            End If
    End Forall
    Call uid.FieldSetText("CalDates", CalDates)
    Call uid.FieldSetText("Lock_Formulas", "Y")
    'End If
    'Update the holiday summary document
    If uid.FieldGetText("Deduct")="Y" And uid.FieldGetText("DocLevel")="40" Then
The approver will edit the holiday summary document, so needs to be
1. An editor or higher
2. Present in the authors list (DocAuthors) on the Holiday Summary document.

All approvers for this employee will have been added to DocAuthors when the
entitlement document was last saved. Anybody needing to override the standard
approval (HolAdmin, dbAdmin etc) must have editor or higher access.
            Dim sV As NotesView
            Dim sDoc As NotesDocument, rDoc As NotesDocument
            Dim dc As NotesDocumentCollection
            Dim key As String
            Dim i As Integer
            Dim req As Single
            Set sV=db.GetView("LSUMMARY")
            Set app=New NotesName(uid.FieldGetText("Employee"))
            key=app.Abbreviated & Cstr(Year(uid.FieldGetText("Start_Date")))
            Set sDoc=sV.GetDocumentByKey(key)
            If Not (sDoc Is Nothing) Then 'sDoc should ALWAYS be found
                    Set sV=db.GetView("LDEDUCT")
                    Set dc=sV.GetAllDocumentsByKey(key)
                    Set rDoc=dc.GetFirstDocument
                    Do Until rDoc Is Nothing
                            Set rDoc=dc.GetNextDocument(rDoc)
            'Add this request as it hasn't been saved yet
                    If source.IsNewDoc Then
                    End If
                    Call sDoc.Save(False, False)
            End If
    End If
End Sub

Comments/Trackbacks [0]