Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let noOfRow = $('#ajaxSalarytable tbody tr').length - 1; // Total No Of Row
- let range_td_total = arrayRange(5, 45, 1); // Range Start From 5 To 45. Array
- var calculationArray = [];
- // 5 is Start Calculation from Column Index
- for (var j = 5; j < range_td_total.length; j++)
- {
- this["value"+j] = 0.00;
- // console.log('=== index.js [196] ===', this["value"+j]);
- for(var i = 0; i < noOfRow; i++)
- {
- // console.log('=== index.js [199] ===', this["value"+j]);
- this["temp_value"+j] = $('#ajaxSalarytable tbody tr').eq(i).find("td").eq(j).html();
- // console.log('=== index.js [201] ===', this["temp_value"+j]);
- // console.log('=== index.js [202] ===', $('#ajaxSalarytable tbody tr').eq(i).find("td").eq(j));
- this["value"+j] = parseFloat(this["temp_value"+j]) + parseFloat(this["value"+j]);
- this["value"+j] = this["value"+j].toFixed(2); // working_hrs
- }
- calculationArray.push(this["value"+j]);
- // console.log('=== index.js [206] ===', this["value"+j]);
- }
- // console.log('=== index.js [209] ===', calculationArray);
- c_index = 0; // Total Row Cell Start From 0 Index
- var TotalNotShowCols = [32, 34]; // Add Column Index To Remove From Total Row
- for (var i = 1; i < calculationArray.length; i++)
- {
- if(!isInArray(c_index, TotalNotShowCols)){
- $('#ajaxSalarytable tbody tr').eq(4).find("th").eq(i).text(calculationArray[c_index]);
- }
- c_index = c_index + 1;
- }
- const arrayRange = (start, stop, step) =>
- Array.from(
- { length: (stop - start) / step + 1 },
- (value, index) => start + index * step
- );
- function isInArray(value, array) {
- return array.indexOf(value) > -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement