Advertisement
metalx1000

Untitled

Apr 20th, 2020
1,418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.   <head>
  3.     <style>
  4.       input,span {
  5.         float: right;
  6.         clear: both;
  7.       }
  8.       #shwwk{
  9.  
  10.         float: left;
  11.       }
  12.     </style>
  13.   </head>
  14.   <body>
  15.  
  16.     <table>
  17.       <p>Select Hours Per Year
  18.       <select id="hyr">
  19.         <option value="2704">2704</option>
  20.         <option value="2080">2080</option>
  21.       </select></p>
  22.       <th>Old</th>
  23.       <th>New</th>
  24.       <tr>
  25.         <td>Old Annual Salary: <input id='oannu' type="number"></td>
  26.         <td>New Annual Salary: <input id='nannu' type="number"></td>
  27.       </tr>
  28.       <tr>
  29.         <td >Semi: <span id='osem'>NA</span></td>
  30.         <td >Semi: <span id='nsem'>NA</span></td>
  31.       </td>
  32.     </tr>
  33.     <tr>
  34.       <td>Hourly:<span id='ohr'> NA</td>
  35.         <td>Hourly: <span id='nhr'> NA</td>
  36.         </td>
  37.       </tr>
  38.       <tr>
  39.         <td>Old Degree: <input id='degold' float="right"></td>
  40.         <td>New Degree: <input id='degnew'></td>
  41.       </tr>
  42.       <tr>
  43.         <td>Old Team Leader<input id='otl' float="right"></td>
  44.         <td>New Team Leader<input id='ntl'></td>
  45.       </tr>
  46.       <tr>
  47.         <td><input id='onoz'>Old Nozzle</td>
  48.         <td><input id='nnoz'>New Nozzle</td>
  49.       </tr>
  50.       <tr>
  51.         <td><input id='oss'>Old State Supplimental</td>
  52.         <td><input id='nss'>New State Supplimental</td>
  53.       </tr>
  54.       <tr>
  55.         <td><br></td>
  56.       </tr>
  57.       <tr>
  58.         <td><br></td>
  59.       </tr>
  60.       <tr>
  61.         <td><input id='obhr'>Old Base Hourly</td>
  62.         <td><input id='nbhr'>New Base Hourly</td>
  63.       </tr>
  64.       <tr>
  65.         <td><input id='oems'>Old EMS Hourly</td>
  66.         <td><input id='nems'>New EMS Hourly</td>
  67.       </tr>
  68.       <tr>
  69.         <td><input id='oaar'>Old AAR Hourly</td>
  70.         <td><input id='nbhr'>New AAR Hourly</td>
  71.       </tr>
  72.       <tr>
  73.         <td><input id='obhr'>Old Cerificate Hourly</td>
  74.         <td><input id='nbhr'>New Certificate Hourly</td>
  75.       </tr>
  76.       <tr>
  77.         <td><br></td>
  78.       </tr>
  79.  
  80.       <tr>
  81.         <td><input type="date" id='sto'>Start Old</td>
  82.         <td><input type="date" id='stn'>Start New</td>
  83.       </tr>
  84.       <tr>
  85.         <td><input type="date" id='eo'>End Old</td>
  86.         <td><input type="date" id='en'>End New</td>
  87.       </tr>
  88.       <tr>
  89.         <td id="spr">Pro Rated Old</td>
  90.         <td id="epr">Pro Rated New</td>
  91.       </tr>
  92.       <tr>
  93.         <td>Start Days Per FULL Pay Period<select id="sdpp">
  94.             <option value="15">15</option>
  95.             <option value="16">16</option>
  96.         </select></td>
  97.         <td>End Days Per FULL Pay Period<select id="edpp">
  98.             <option value="15">15</option>
  99.             <option value="16">16</option>
  100.         </select></td>
  101.       </tr>
  102.     </table>
  103.     <p >Prorated Amount for Old Calculated: = <strong><span id="txtst"> NA</span></strong></p>
  104.     <p >Prorated Amount for New Calculated: = <strong><span id="txtend"> NA</span></strong></p>
  105.     <p >Prorated Amount for Total Calculated: = <strong><span id="txttot"> NA</span></strong></p>
  106.     <button id='btn'>Check word</button>
  107.     <p>Show work:</p>
  108.     <p><span id='shwwk'></span></p>
  109.  
  110.  
  111.     <script type="text/javascript">
  112.       id('btn').onclick = submit();
  113.       // Execute a function when the user releases a key on the keyboard
  114.       window.addEventListener("keyup", function(event) {
  115.         // Number 13 is the "Enter" key on the keyboard
  116.         if (event.keyCode === 13) {
  117.           // Cancel the default action, if needed
  118.           event.preventDefault();
  119.           submit();
  120.         }
  121.       });
  122.  
  123.       function submit(){
  124.         setoannu = id('oannu').value;
  125.         setoannu1 = setoannu/24
  126.         id("osem").innerHTML = "<strong>"+ round(setoannu1) + "</strong>";
  127.         setnannu = id('nannu').value;
  128.         setnannu1 = setnannu / 24;
  129.         id("nsem").innerHTML = " <span ><strong>"+round(setnannu1)+"</strong></span>";
  130.  
  131.         hyr = id('hyr').value;
  132.         setohr = setoannu/hyr;
  133.         id("ohr").innerHTML = " <strong> " + round(setohr) + "</strong>";
  134.         setnhr = setnannu / hyr;
  135.         id("nhr").innerHTML = "<strong> " + round(setnhr) + "</strong>";
  136.         newlength =((new Date(id("en").value) - new Date(id("stn").value)) / (1000 * 3600 * 24))+1;
  137.         id("epr").innerHTML = "Pro Rated New: <strong> " + newlength + "</strong>";
  138.         oldlength = ((new Date(id("eo").value) - new Date(id("sto").value)) / (1000 * 3600 * 24))+1;
  139.         id("spr").innerHTML = "Pro Rated Old: <strong> " + oldlength + "</strong>";
  140.         sdpp = id("sdpp").value;
  141.         stcalc = (setoannu1 / sdpp * oldlength);
  142.         id("txtst").innerHTML = stcalc
  143.         edpp = id("sdpp").value;
  144.         endcalc = (setoannu1 / edpp * newlength);
  145.         id("txtend").innerHTML =endcalc;
  146.         id("txttot").innerHTML = (stcalc+endcalc);
  147.         document.getElementById("shwwk").innerHTML = ('For Old Period claculations - Take Semi monthly Salary: '+setoannu1+'    /(divided) Days in pay period: ' + sdpp +'  * (multiplied) by days in prorated start period: '+ oldlength + '<p>For New period Calculations - Take Semi monthly Salary: ' + setnannu1 + '    /(divided) Days in pay period: ' + edpp + '  * (multiplied) by days in prorated start period: ' + newlength +'</p>' + '<p>For Total Calculated - Take Old Calculated: ' +endcalc+ ' +(plus) New Calculated: '+stcalc);
  148.       }
  149.  
  150.       function id(id){
  151.         return document.getElementById(id);
  152.       }
  153.  
  154.       function round(number){
  155.         number = Math.round(number * 100) / 100;
  156.         number = number.toFixed(2);
  157.         return number;
  158.       }
  159.     </script>
  160.  
  161.   </body>
  162. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement