Skip to content

Instantly share code, notes, and snippets.

@htormey
Created September 27, 2010 00:23
Show Gist options
  • Save htormey/598439 to your computer and use it in GitHub Desktop.
Save htormey/598439 to your computer and use it in GitHub Desktop.
/* <![CDATA[ */
// Function
function three()
{
// Validate Correct Entry Data
if ( isNaN(hrswork1) | isNaN(hrswork2) | isNaN(hrswork3) | isNaN(hrsrt1) | isNaN(hrsrt2) | isNaN(hrsrt3) ){
alert("Please enter valid numbers.");
else {
// Calculate Gross Pay
if(h1 > straight_time){
pay1 = ( (h1 - straight_time) * (r1 * time_half)) + (straight_time * r1) );
}else{
pay1= h1 * r1;
}-------
if(hrswork2 > straight_time){
pay2 = ( (h2 - straight_time) * (r2 * time_half)) + (straight_time * r2) );
}else{
pay2= h2 * r2;
}
if(hrswork3 > straight_time){
pay3 = ( (h3 - straight_time) * (r3 * time_half)) + (straight_time * r) );
}else{
pay3= h3 * r3;
}
// Write Gross Pay to XHTML Table
document.wages.pay1.value = ("$" + pay1.toFixed(2));
document.wages.pay2.value = ("$" + pay2.toFixed(2));
document.wages.pay3.value = ("$" + pay3.toFixed(2));
}
}
//End function-
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment