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);
}