• Resolved jebachristy

    (@jebachristy)


    Hi
    I have referred this post to add new options in addition to Reg and PTO.

    https://ww.wp.xz.cn/support/topic/adding-new-dropdowns/

    And i want 2 fields like double and time2.5

    if user chooses double then the time will be multiplied by 2

    and if chooses the other option then time multiplied by 2.5

    And now its calculated individually but not able to include the multiplied values with the total hours.

    Instead it adds only the non multiplied hours.

    Please help me to calculate the total hours with multiplied by 2 and multiplied by 2.5

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jebachristy

    (@jebachristy)

    Please review the sumrows() function

    function sumrows(){var e,t,d,n,a,o,i,s,m,l,r,u,y,_,td,th,tdouble,thalf;e=t=d=n=a=o=i=s=m=td=th=tdouble=thalf=0,l=r=u=y=_=””;
    var p,c,g=document.getElementById(“Reg”),v=document.getElementById(“PTO”),h=document.getElementById(“pto_row”),thalf=document.getElementById(“thalf”),tdouble=document.getElementById(“tdouble”),thalfrow=document.getElementById(“thalf_row”),tdoublerow=document.getElementById(“tdouble_row”),b=document.getElementById(“OT”),f=document.getElementById(“ot_row”),w=document.getElementById(“Bonus”),E=document.getElementById(“TOT”),B=document.getElementById(“TOTamt”),k=document.getElementsByName(“hours[]”),T=document.getElementsByName(“date[]”),I=rate,F=0;
    if(exempt<=0&&15<=period){var M=parseInt(T[0].value),x=new Date(864e5*M);for(c=weekday[x.getDay()];weekbegin!=weekday.indexOf(c);)c=weekday[x.getDay()],x.setDate(x.getDate()-1);for(x/=864e5;db_date[F]<x;)F++;if(M-7<x)for(;db_date[F]<M;)”Reg”==db_hourtype[F]&&(s=parseFloat(db_hours[F]),db_date[F+1]?next_entry=db_date[F+1]:next_entry=db_date[F]+1,db_date[F]==next_entry?m+=s:(s+=m,m=0),0==m&&(i=exempt<0&&8<s?8:parseFloat(s),a=(parseFloat(a)+i).toFixed(2))),F++,x++;i=s=m=0}
    for(F=0;F<T.length;)0<k[F].value&&(k[F].style.backgroundColor=”#555″,k[F].style.color=”#FFF”,s=parseFloat(k[F].value),_=k[F].nextSibling.value,next_entry=0,exempt<=0&&”Reg”==_&&(T[F+1]&&(next_entry=T[F+1].value),T[F].value==next_entry&&”Reg”==k[F+1].nextSibling.value?m+=s:(s+=m,m=0)),0==m&&(“Reg”==_&&(i=exempt<0&&8<s?parseFloat(s)-8:0,exempt<0&&(n=(parseFloat(n)+i).toFixed(2)),exempt<=0&&(a=(parseFloat(a)+s-i).toFixed(2))),exempt<0&&0<n&&(d=(parseFloat(d)+parseFloat(n)).toFixed(2),n=0),”Reg”==_&&(e=(parseFloat(e)+s).toFixed(2)),”PTO”==_&&(t=(parseFloat(t)+s).toFixed(2)),”T15″==_&&(th=(parseFloat(th)+s).toFixed(2)*1.5),”DT”==_&&(td=(parseFloat(td)+s).toFixed(2)*2),o=(parseFloat(o)+s).toFixed(2))),0==m&&exempt<=0&&(p=(c=new Date(864e5*(parseInt(T[F].value)+2))).getDay(),weekbegin!=p&&T[F+1]||(40<a&&(d=(parseFloat(d)+(parseFloat(a)-40)).toFixed(2)),a=0)),F++;0<(e=(parseFloat(e)-parseFloat(d)).toFixed(2))&&(l=1<e?” hrs”:” hr”),0<t?(r=1<t?” hrs”:” hr”,h.style.display=”table-row”):h.style.display=”none”,0<th?(yy=1<th?” hrs”:” hr”,thalfrow.style.display=”table-row”):thalfrow.style.display=”none”,0<td?(qq=1<td?” hrs”:” hr”,tdoublerow.style.display=”table-row”):tdoublerow.style.display=”none”,0<d?(u=1<d?” hrs”:” hr”,f.style.display=”table-row”):f.style.display=”none”,0<o&&(y=1<o?” hrs”:” hr”),g.value=e+l,v.value=t+r,thalf.value=th+yy,tdouble.value=td+qq,b.value=d+u,E.value=o+y,w.value=0<pay_bonus?currency+pay_bonus:0,alert(I),0<I&&(B.value=(parseFloat(o)*parseFloat(I)).toFixed(2),B.value=currency+(parseFloat(B.value)+parseFloat(pay_bonus)+parseFloat(d)*(.5*parseFloat(I))).toFixed(2)),0===summary_updated&&set_opacity(1),show_save(0);
    }

    Plugin Author RLDD

    (@rermis)

    Hi,
    The time and a half overtime standard types are well ingrained in the logic and meets the requirements of 99% or more of businesses that use this plugin. At this time I cannot provide direction for these changes because it will affect the ability of the altered plugin to receive functional or security related updates.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding new dropdowns and total changes’ is closed to new replies.