Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Sum hours
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Sum hours

 Post Reply Post Reply
Author
drico View Drop Down
New Member
New Member


Joined: 09 Jun 2016
Points: 4
Post Options Post Options   Quote drico Quote  Post ReplyReply Direct Link To This Post Topic: Sum hours
    Posted: 31 Mar 2017 at 11:11am
Hi
I have this

i have a function Time2Num in the right place, i think so!

i have this script below in calculte event script and show me (SintaError: missing) after condition4: line 5)

why???

var fullTime = 0

var breakTime = 0

 

if (amIN ne null and pmOUT ne null) then

          if (Time2Num(amIN.formattedValue, "HH:MM") lt Time2Num(pmOUT.formattedValue, "HH:MM")) then

                    fullTime = Abs(Time2Num(amIN.formattedValue, "HH:MM") - Time2Num(pmOUT.formattedValue, "HH:MM")) / (60 * 60 * 1000)

          else

                    fullTime = 24 - Abs(Time2Num(pmOUT.formattedValue, "HH:MM") - Time2Num(amIN.formattedValue, "HH:MM")) / (60 * 60 * 1000)

          endif

          if (amOUT ne null and pmIN ne null) then

                    if (Time2Num(amOUT.formattedValue, "HH:MM") lt Time2Num(pmIN.formattedValue, "HH:MM")) then

                              breakTime = Abs(Time2Num(pmIN.formattedValue, "HH:MM") - Time2Num(amOUT.formattedValue, "HH:MM")) /(60 * 60 * 1000)

                    else

                              breakTime = 24 - Abs(Time2Num(pmIN.formattedValue, "HH:MM") - Time2Num(amOUT.formattedValue, "HH:MM")) / (60 * 60 * 1000)

                    endif

          endif    

          hours  = fullTime - breakTime

elseif (amIN ne null and amOUT ne null and pmIN eq null and pmOUT eq null) then

          if (Time2Num(amIN.formattedValue, "HH:MM") lt Time2Num(amOUT.formattedValue, "HH:MM")) then

              hours  =  Abs(Time2Num(amOUT.formattedValue, "HH:MM") - Time2Num(amIN.formattedValue, "HH:MM")) / (60 * 60 * 1000)

    else

             hours  =  24 - Abs(Time2Num(amOUT.formattedValue, "HH:MM") - Time2Num(amIN.formattedValue, "HH:MM")) / (60 * 60 * 1000)

    endif

else

          hours = fullTime

endif


Back to Top
Sponsored Links


Back to Top
Merlin View Drop Down
New Member
New Member
Avatar

Joined: 03 Jun 2012
Location: 43.95 N / 4.82
Points: 39
Post Options Post Options   Quote Merlin Quote  Post ReplyReply Direct Link To This Post Posted: 31 Mar 2017 at 12:06pm
Hi.

I would not reinvent the wheel.
Got to: http://practicalpdf.com/the-practicalpdf-date-library-for-adobe-acrobat/
And enjoy this free library.
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4076
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 31 Mar 2017 at 4:15pm
Your code is not JavaScript. It looks like FormCalc which is one of the scripting languages used in LiveCycle forms. Also the Time2Num function you have blindly copied, state the return value is in minutes and not milliseconds.

Your task could be simplified is you computed the elapsed am and pm time intervals and then adding them.
Back to Top
drico View Drop Down
New Member
New Member


Joined: 09 Jun 2016
Points: 4
Post Options Post Options   Quote drico Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2017 at 12:11pm
hi 

that was i suspicious...

i solved with a excel sheet

thanks anyway.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.