Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-11-11
3
Medium Priority
?
181 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 1200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

604 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