Guest User

Untitled

a guest
May 21st, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. <script type="text/javascript" language="javascript">
  2. $(document).ready(function(){
  3. $('.date').mask("99/99/9999");
  4. $('.account').mask("99-9-999999-9999");
  5. /*calcuating the vertical and horizontal inputs*/
  6. $('.calc').change(function(){
  7. var classArray = $(this).attr('class').split(' ');
  8.  
  9. //Personal gas expense
  10. $('.gasamount').sum("change", "#totals4");
  11. var num = $(this).attr("id").replace(/[A-Za-z$,-]/g, "");
  12. $('#gasmoney'+num).val(<cfoutput>#mileage#</cfoutput> * $(this).val());
  13. $('.gasmoney').sum("change", "#totals5");
  14.  
  15. //////////////////////
  16.  
  17. //Sum of each cell
  18. $.each(classArray, function(){
  19. $('.'+this).sum("change", ".ttl"+this);
  20.  
  21. });
  22.  
  23. //Finding the grandtotal
  24. var grandTotal = $('.row26').parent().children('td:last').children( 'input');
  25. var sum = $('.row25').parent().children('td').children('.calc').sum();
  26. grandTotal.val(Number(sum).toFixed(2));
  27.  
  28. });
  29. /*bottom loop js*/
  30. $('.date-mask').mask("99/99/9999");
  31. });
  32. </script>
  33.  
  34. <cfloop from="1" to="#ArrayLen(labels)#" index="r">
  35. <tr>
  36. <td class="labels"><cfif ArrayIsDefined(labels,r) AND labels[r] NEQ "Open">#labels[r]#</cfif></td>
  37. <cfloop from="1" to="7" index="i">
  38. <cfif labels[r] NEQ "Other: Describe">
  39. <td id="Day#i#" class="row#r# col#i#">
  40. <cfif r EQ 1>#Left(DayOfWeekAsString(i),3)#<cfelse><cfif r EQ 2>
  41. <input type="text" class="date-mask" /><cfelse>
  42. <input type="text"
  43. <cfif labels[r] EQ "Personal Car: Mileage ##"> id="gasamount#i#" <cfelseif labels[r] EQ "Personal Car: Mileage $">id="gasmoney#i#" </cfif><cfif labels[r] EQ "Daily Totals">id="dailytotals#i#"</cfif>
  44. class="<cfif labels[r] EQ "Personal Car: Mileage ##">gasamount<cfelse><cfif labels[r] NEQ "Daily Totals">C#i#</cfif></cfif>
  45. <cfif labels[r] EQ "Personal Car: Mileage $">gasmoney<cfelse>calc R#r#</cfif>
  46. <cfif labels[r] EQ "Daily Totals">ttlC#i#</cfif>
  47. "
  48. <cfif labels[r] EQ "Daily Totals" OR labels[r] EQ "Personal Car: Mileage $">readonly="readonly"</cfif>
  49. /></cfif>
  50. </cfif>
  51. </td>
  52. </cfif>
  53. </cfloop>
  54. <cfif labels[r] NEQ "Other: Describe">
  55. <td class="totals"><cfif r EQ 1>Total<cfelse><input type="text" id="totals#r#" class="ttlR#r#" readonly="readonly" /></cfif></td>
  56. </cfif>
  57. </tr>
  58. </cfloop>
  59.  
  60. $('.calc').keyup(function(){
  61. var classArray = $(this).attr('class').split(' ');
  62.  
  63. $.each(classArray, function(){
  64. $('.'+this).sum("keyup", ".ttl"+this);
  65. var grandTot = $('.ttl'+this).sum("keyup", ".gTtl");
  66. grandTot;
  67. });
  68.  
  69.  
  70. var grandTotal = $('.row25').parent().children('td:last').children( 'input');
  71. var sum = $('.row25').parent().children( 'td').children('.calc').sum();
  72. grandTotal.val( sum );
  73. });
  74.  
  75. var grandTotal = $('.row25').parent().children('td:last').children( 'input');
  76. var sum = $('.row25').parent().children( 'td').children('.calc').sum();
  77. grandTotal.val( sum );
  78.  
  79. <tr class="dailyTotals"> ....</tr>
  80.  
  81. var grandTotal = $('.dailyTotals').children('td:last').children( 'input');
  82. var sum = $('.dailyTotals').children( 'td').children('.calc').sum();
  83. grandTotal.val( sum );
Add Comment
Please, Sign In to add comment