Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calculateTotalByMonth(month){
- var total=0;
- var num =0;
- var inputs = document.getElementsByName('check'+month);
- for (var input of inputs) {
- num = parseInt(input.value);
- total+=num;
- }
- total = total.toFixed(2);
- $('#totalmonth' + month).val(total);
- }
- function calculateGrandTotal(){
- var total=0;
- var num =0;
- var inputs = document.getElementsByName('grand');
- for (var input of inputs) {
- num = parseInt(input.value);
- total+=num;
- }
- total = total.toFixed(2);
- $('#grandTotalBudget').val(total);
- }
- else if (resp.type == C_CALCULATE_FORMULA){
- var data = resp.data.data_value + '';
- var array_value =data.split(',');
- var idx = 1 ;
- var arrIdx = 0;
- $('#table-budgeting-detail tr td').each(function() {
- var value = Number(array_value[arrIdx]);
- $('#budget_' +idx+'_'+resp.data.id_act).val(value.toFixed(2));
- idx ++;
- arrIdx ++;
- });
- addtotal(resp.data.id_act);
- calculateGrandTotal();
- for(i=1; i<=12; i++) {
- calculateTotalByMonth(i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement