Solved

Help with script to meet date and content requirements(used to be imjamesw)

Posted on 2003-11-11
3
176 Views
Last Modified: 2013-12-18
Hello All

I have a new handle
ADSPMO

In the continuing saga the requiements are getting tricky

http://www.experts-exchange.com/Applications/Email/Lotus_Notes/Q_20791200.html

The above link will take you to the previous question around this issue

One of the reuirements is for a field on the Leave Tracking named CarriedOverAH to contain any days off that maybe left over from the previous year.
The issue around this is it may not exceed five days and must be used by June 30

So when a new year starts and vacation is booked the first five or less days must come off the CarriedOverAH field after that it will subtract from the regular TotalAH field

I have included the script that I have thus far

If Not doc Is Nothing Then
 If note.type(0) = "Vac" Then
 doc.TotalDaysOffCalc = note.TotalDaysOff(0)
 doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
 End If
            
If note.type(0) = "Per" Then
 tmpPersonalDays =doc.PersonalDaysAH(0) - note.NewDaysTotal(0)      
 doc.PersonalDaysAH = tmpPersonalDays
 doc.TotalDaysOffCalc = note.TotalDaysOff(0)
 doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)  
 End If

If note.type(0) = "WFH" Then
End If


Also I have come up with the following, I am note sure about how to add the requirements of subtracting the carried overdays first and they must be gone before July 1

tmpCarriedOver = doc.CarriedOverAH(0) - note.NewDaysTotal(0)      
doc.CarriedOverAH = tmpCarriedOver
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)

Best Regards

James

formerly imjamesw
0
Comment
Question by:adspmo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 300 total points
ID: 9723377
James

In previous question we did reduce total vaccation when leave is approved, we have to do some manipulation to accomodate the carriedover leave

I am still confused with your calculcation but anyway I will try

eg:
     If note.ApprovalStatus(0) = "Cancelled" Then  
          note.NewDaysTotal = 0    'This is the number of new days booked--- which will be 0 if it is not approved
          tmpTotal = 0
          Goto CalcIT
     End If

     tmpTotal = note.NewDaysTotal(0)

     if month(note.StartDate(0)) > 6 then
          tmpHolidaysAH = doc.HolidaysAH(0) 'This is the number of days used
     else
          if doc.CarriedOverAH(0) >= note.NewDaysTotal(0) then
               doc.CarriedOverAH = doc.CarriedOverAH(0) - note.NewDaysTotal(0)
               Goto SaveIt      ' Skip normal calc and save the doc
          else
               doc.CarriedOverAH = 0
               tmpTotal = note.NewDaysTotal(0) - doc.CarriedOverAH(0)
          end if
     end if

CalcIT:
          tmpNew = tmpHolidaysAH - tmpTotal  'This will reset the value removing the value that was added when approved
          tmpRemainingAH = doc.RemainingAH(0) ' This is the number of days remaining
          tmpRemain = tmpTotal + tmpRemainingAH ' This adds the number that was subtracted when the leave was approved
          doc.TotalDaysOffCalc = tmpNew 'This resets the Total days used    
          doc.RemainingCalc = tmpRemain 'This resets the remainig days to what it was prior to the new leave being approved
          doc.RemainingAH = doc.RemaingCalc 'See above
SaveIT:
     doc.ComputeWithForm True, False  
     doc.save True, False

~Hemanth
0
 

Author Comment

by:adspmo
ID: 9724302
Hi
What I did is in the queryave I put my conditions

bla bla bla Then Approve

Bla Bla Bla the Cancelled
In the Global I created Approved and Cancelled

I will modify the approve with what we CarriedOver first and then get to the cancelled

I will paste in the Approved script thus far

It is really important that he carried over days are used first and then from there the balance of available days will bee in the TotalAH field. I think you have adressed that with the script you provided

If note.type(0) = "Vac" And  Month(note.StartDate(0)) > 6 Then
                  doc.TotalDaysOffCalc = note.TotalDaysOff(0)
                  doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
            Else
                  If doc.CarriedOverAH(0) >= note.NewDaysTotal(0) Then
                        doc.CarriedOverAH = doc.CarriedOverAH(0) - note.NewDaysTotal(0)
                        Goto SaveIt      ' Skip normal calc and save the doc
                  End If
            End If
            
            If note.type(0) = "Per" Then
                  tmpPersonalDays =doc.PersonalDaysAH(0) - note.NewDaysTotal(0)      
                  doc.PersonalDaysAH = tmpPersonalDays
                  doc.TotalDaysOffCalc = note.TotalDaysOff(0)
                  doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)  
            End If
            
            If note.type(0) = "WFH" Then
            End If
            
SaveIT:
            doc.ComputeWithForm True, False  
            doc.save True, False
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9724357
Yes that is what I did.. take care of CarriedOver leave first.. I will be mad if someone expires my CarriedOver leave :-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question