Solved

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

Posted on 2003-11-11
3
174 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Saving email w/ attachments using lotus notes 7 296
names.nsf ODS upgrade 4 446
Lotus Notes Calendar Issue 5 110
Permanent Lotus Notes Connection for all users in a Domino Domain 15 108
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 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