Time Sheet with Date Calc - Example please


i new livecycle designer.  i've worked acrobat javascripting in past.  need automate time calculations on timesheet 4 columns (am in, out, pm in, pm out) each day of week.  how code below used in sample pdf?  found , believe work, i'm not sure should go in pdf.

 

function stime2min(stime) {

     var atime = stime.split(":");

     if(atime.length < 2) stime[1] = 0;

     return (60 * number(atime[0])) + number(atime[1]);

}

 

function min2hrsmin(fmins) {

     var fhrs = math.floor(fmins / 60);

     var fmins = fmins % 60;

     var shrs = util.printf("%,302d", fhrs);

     var smins - util.printf("%,302d", fmins):

     return shrs + ":" + smins;

}

 

var fetime = stime2min(endtime.formattedvalue) - stime2min(starttime.formattedvalue);

$.rawvalue = min2hrsmin(fetime);

 

here acbrobat code know works, not work in designer.  can converted designer?  if so, how?

 

var dayworked =

this.getfield("date");

 

var adayworked =

dayworked.getarray();

 

var totalminworked=0;

{

totalminworked + dayminutes(i);

}

 

var minworked=totalminworked % 60;

 

var hrsworked = math.floor(totalminworked / 60);

 

event.value = hrsworked + ":" + minworked;

 

any appreciated.  thanks!!

 

becky

becky,

 

i have attached version of dynamic timesheet uses date/time fields , formcalc.

 

it pretty basic can tweaked set start day current day, calculate days forward, etcetera. might want change way time entered well. attached png highlights fact time has entered in 24 hour format. example, 1:30 pm must entered '13:30'.

 

steve



More discussions in LiveCycle Designer


adobe

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts