$(document).ready(function(){ $('#id_studentacademicrecord_set-0-academic_total_marks').on('change keypress keyup', function(){ let total = $('#id_studentacademicrecord_set-0-academic_total_marks').val() let obtain = $('#id_studentacademicrecord_set-0-academic_obtain_marks').val() let sum = (obtain/total)*100; $('#id_studentacademicrecord_set-0-academic_grades').val(parseFloat(sum).toFixed(2)); }) $('#id_studentacademicrecord_set-0-academic_obtain_marks').on('change keypress keyup', function(){ let total = $('#id_studentacademicrecord_set-0-academic_total_marks').val() let obtain = $('#id_studentacademicrecord_set-0-academic_obtain_marks').val() let sum = (obtain/total)*100; $('#id_studentacademicrecord_set-0-academic_grades').val(parseFloat(sum).toFixed(2)); }) $('#id_studentacademicrecord_set-1-academic_total_marks').on('change keypress keyup', function(){ let obtain = $('#id_studentacademicrecord_set-1-academic_obtain_marks').val() let sum = (obtain/total)*100; $('#id_studentacademicrecord_set-1-academic_grades').val(parseFloat(sum).toFixed(2)); }) $('#id_studentacademicrecord_set-1-academic_obtain_marks').on('change keypress keyup', function(){ let total = $('#id_studentacademicrecord_set-1-academic_total_marks').val() let obtain = $('#id_studentacademicrecord_set-1-academic_obtain_marks').val() let sum = (obtain/total)*100; $('#id_studentacademicrecord_set-1-academic_grades').val(parseFloat(sum).toFixed(2)); }) $('#id_studentacademicrecord_set-2-academic_total_marks').on('change keypress keyup', function(){ let total = $('#id_studentacademicrecord_set-2-academic_total_marks').val() let obtain = $('#id_studentacademicrecord_set-2-academic_obtain_marks').val() let sum = (obtain/total)*100; $('#id_studentacademicrecord_set-2-academic_grades').val(parseFloat(sum).toFixed(2)); }) $('#id_studentacademicrecord_set-2-academic_obtain_marks').on('change keypress keyup', function(){ let total = $('#id_studentacademicrecord_set-2-academic_total_marks').val() let obtain = $('#id_studentacademicrecord_set-2-academic_obtain_marks').val() let sum = (obtain/total)*100; $('#id_studentacademicrecord_set-2-academic_grades').val(parseFloat(sum).toFixed(2)); }) // code $('#id_std_tution_fee').on('change keypress keyup', function(){ calculate(); }) $('#id_std_utility_charges').on('change keypress keyup', function(){ calculate(); }) $('#id_std_it_funds').on('change keypress keyup', function(){ calculate(); }) $('#id_std_lab_funds').on('change keypress keyup', function(){ calculate(); }) $('#id_std_lab_breakage').on('change keypress keyup', function(){ calculate(); }) $('#id_std_sports_funds').on('change keypress keyup', function(){ calculate(); }) $('#id_std_college_dev_fund').on('change keypress keyup', function(){ calculate(); }) $('#id_std_hospital_fee').on('change keypress keyup', function(){ calculate(); }) $('#id_std_thesis_project').on('change keypress keyup', function(){ calculate(); }) $('#id_std_lib_sec').on('change keypress keyup', function(){ calculate(); }) $('#id_std_lab_sec').on('change keypress keyup', function(){ calculate(); }) $('#id_std_welfare_fund').on('change keypress keyup', function(){ calculate(); }) $('#id_std_pu_charges').on('change keypress keyup', function(){ calculate(); }) $('#id_std_registration_fee').on('change keypress keyup', function(){ calculate(); }) $('#id_std_pu_sports_fee').on('change keypress keyup', function(){ calculate(); }) $('#id_std_enrollment_fee').on('change keypress keyup', function(){ calculate(); }) function professional(){ var result = 0; var num1 = document.getElementById('id_std_tution_fee').value; num1 = num1.replace(',','') if (num1 != ''){ result += parseInt(num1); } var num2 = document.getElementById('id_std_utility_charges').value; num2 = num2.replace(',','') if (num2 != ''){ result += parseInt(num2); } var num4 = document.getElementById('id_std_hospital_fee').value; num4 = num4.replace(',','') if (num4 != ''){ result += parseInt(num4); } var num5 = document.getElementById('id_std_thesis').value; num5 = num5.replace(',','') if (num5 != ''){ result += parseInt(num5); } if (!isNaN(result)) { document.getElementById('id_std_total').value = result; } } // to change values according to Professionals // var prof = ''; $("#id_std_profs").change(function() { var prof = document.getElementById('id_std_profs').value; switch(prof){ case '1prof': prof_change1(); break; case '2prof': prof_change2(); break; case '3prof': prof_change3(); break; case '4prof': prof_change4(); break; case '5prof': prof_change5(); break; } }); function calculate(){ let id_std_tution_fee = $('#id_std_tution_fee').val(); let id_std_admission_fee = $('#id_std_admission_fee').val(); let id_std_utility_charges = $('#id_std_utility_charges').val(); let id_std_it_funds = $('#id_std_it_funds').val(); let id_std_lab_funds = $('#id_std_lab_funds').val(); let id_std_lab_breakage = $('#id_std_lab_breakage').val(); let id_std_sports_funds = $('#id_std_sports_funds').val(); let id_std_internal_exam_assessment = $('#id_std_internal_exam_assessment').val(); let id_std_hospital_fee = $('#id_std_hospital_fee').val(); let id_std_thesis_project = $('#id_std_thesis_project').val(); let id_std_lib_sec = $('#id_std_lib_sec').val(); let id_std_lab_sec = $('#id_std_lab_sec').val(); let id_std_welfare_fund = $('#id_std_welfare_fund').val(); let id_std_pu_charges = $('#id_std_pu_charges').val(); let id_std_registration_fee = $('#id_std_registration_fee').val(); let id_std_pu_sports_fee = $('#id_std_pu_sports_fee').val(); let id_std_enrollment_fee = $('#id_std_enrollment_fee').val(); let sum_fee = parseInt(id_std_tution_fee) + parseInt(id_std_admission_fee) + parseInt(id_std_utility_charges) + parseInt(id_std_it_funds) + parseInt(id_std_lab_funds) + parseInt(id_std_lab_breakage) + parseInt(id_std_sports_funds) + parseInt(id_std_internal_exam_assessment) + parseInt(id_std_hospital_fee) + parseInt(id_std_thesis_project); console.log(sum_fee) if(sum_fee >= 200000){ let tax_cal = (sum_fee * 5) / 100; } else{ let tax_cal = 00; } console.log(tax_cal) let id_std_total_fee_tax = $('#id_std_total_fee_tax').val(tax_cal); let sum = parseInt(id_std_lib_sec) + parseInt(id_std_lab_sec) + parseInt(id_std_thesis_project) + parseInt(id_std_welfare_fund) + parseInt(id_std_pu_charges) + parseInt(id_std_registration_fee) + parseInt(id_std_pu_sports_fee) + parseInt(id_std_enrollment_fee) + parseInt(tax_cal); let id_std_total_fee = $('#id_std_total_fee').val(sum); } // NO MORE NEEDED // Functions to change Values of Professionals function prof_change1(){ var std_check = document.getElementById('id_std_check').value; if (std_check === 'Orphan'){ document.getElementById('id_std_tution_fee').value = '70000'; document.getElementById('id_std_total_fee').value = '195670'; document.getElementById('id_std_total_fee_tax').value = '00'; } else { document.getElementById('id_std_tution_fee').value = '140000'; document.getElementById('id_std_total_fee').value = '265670'; document.getElementById('id_std_total_fee_tax').value = '0'; } document.getElementById('id_std_admission_fee').value = '5000'; document.getElementById('id_std_utility_charges').value = '15000'; document.getElementById('id_std_it_funds').value = '10000'; document.getElementById('id_std_lab_funds').value = '5000'; document.getElementById('id_std_lab_breakage').value = '5000'; document.getElementById('id_std_sports_funds').value = '4500'; document.getElementById('id_std_internal_exam_assessment').value = '15000'; document.getElementById('id_std_hospital_fee').value = '0'; document.getElementById('id_std_thesis_project').value = '0'; document.getElementById('id_std_pu_charges').value = '19950'; document.getElementById('id_std_registration_fee').value = '3720'; document.getElementById('id_std_pu_sports_fee').value = '2500'; document.getElementById('id_std_enrollment_fee').value = '5000'; document.getElementById('id_std_lib_sec').value = '10000'; document.getElementById('id_std_lab_sec').value = '10000'; document.getElementById('id_std_welfare_fund').value = '15000'; // professional(); } function prof_change2(){ var std_check = document.getElementById('id_std_check').value; if (std_check === 'Orphan'){ document.getElementById('id_std_tution_fee').value = '75000'; document.getElementById('id_std_total_fee').value = '182700'; document.getElementById('id_std_total_fee_tax').value = '0'; } else { document.getElementById('id_std_tution_fee').value = '150000'; document.getElementById('id_std_total_fee').value = '269300'; document.getElementById('id_std_total_fee_tax').value = '11600'; } document.getElementById('id_std_admission_fee').value = '5000'; document.getElementById('id_std_utility_charges').value = '20500'; document.getElementById('id_std_it_funds').value = '16500'; document.getElementById('id_std_lab_funds').value = '8500'; document.getElementById('id_std_lab_breakage').value = '7500'; document.getElementById('id_std_sports_funds').value = '7000'; document.getElementById('id_std_internal_exam_assessment').value = '17000'; document.getElementById('id_std_hospital_fee').value = '00'; document.getElementById('id_std_thesis_project').value = '00'; document.getElementById('id_std_pu_charges').value = '23200'; document.getElementById('id_std_registration_fee').value = '00'; document.getElementById('id_std_pu_sports_fee').value = '2500'; document.getElementById('id_std_enrollment_fee').value = '00'; document.getElementById('id_std_lib_sec').value = '00'; document.getElementById('id_std_lab_sec').value = '00'; document.getElementById('id_std_welfare_fund').value = '00'; // professional(); } function prof_change3(){ var std_check = document.getElementById('id_std_check').value; if (std_check === 'Orphan'){ document.getElementById('id_std_tution_fee').value = '80000'; document.getElementById('id_std_total_fee').value = '197500'; document.getElementById('id_std_total_fee_tax').value = '0'; } else { document.getElementById('id_std_tution_fee').value = '160000'; document.getElementById('id_std_total_fee').value = '290000'; document.getElementById('id_std_total_fee_tax').value = '12500'; } document.getElementById('id_std_admission_fee').value = '5000'; document.getElementById('id_std_utility_charges').value = '20500'; document.getElementById('id_std_it_funds').value = '20500'; document.getElementById('id_std_lab_funds').value = '10500'; document.getElementById('id_std_lab_breakage').value = '8500'; document.getElementById('id_std_sports_funds').value = '8000'; document.getElementById('id_std_internal_exam_assessment').value = '17000'; document.getElementById('id_std_hospital_fee').value = '00'; document.getElementById('id_std_thesis_project').value = '00'; document.getElementById('id_std_pu_charges').value = '25000'; document.getElementById('id_std_registration_fee').value = '00'; document.getElementById('id_std_pu_sports_fee').value = '2500'; document.getElementById('id_std_enrollment_fee').value = '00'; document.getElementById('id_std_lib_sec').value = '00'; document.getElementById('id_std_lab_sec').value = '00'; document.getElementById('id_std_welfare_fund').value = '00'; } function prof_change4(){ var std_check = document.getElementById('id_std_check').value; if (std_check === 'Orphan'){ document.getElementById('id_std_tution_fee').value = '85000'; document.getElementById('id_std_total_fee').value = '258250'; document.getElementById('id_std_total_fee_tax').value = '10750'; } else { document.getElementById('id_std_tution_fee').value = '170000'; document.getElementById('id_std_total_fee').value = '347500'; document.getElementById('id_std_total_fee_tax').value = '15000'; } document.getElementById('id_std_admission_fee').value = '5000'; document.getElementById('id_std_utility_charges').value = '20500'; document.getElementById('id_std_it_funds').value = '20500'; document.getElementById('id_std_lab_funds').value = '10500'; document.getElementById('id_std_lab_breakage').value = '8500'; document.getElementById('id_std_sports_funds').value = '8000'; document.getElementById('id_std_internal_exam_assessment').value = '17000'; document.getElementById('id_std_hospital_fee').value = '25000'; document.getElementById('id_std_thesis_project').value = '15000'; document.getElementById('id_std_pu_charges').value = '30000'; document.getElementById('id_std_registration_fee').value = '00'; document.getElementById('id_std_pu_sports_fee').value = '2500'; document.getElementById('id_std_enrollment_fee').value = '00'; document.getElementById('id_std_lib_sec').value = '00'; document.getElementById('id_std_lab_sec').value = '00'; document.getElementById('id_std_welfare_fund').value = '00'; document.getElementById('id_std_total_fee').value = '347500'; document.getElementById('id_std_total_fee_tax').value = '15000'; } function prof_change5(){ var std_check = document.getElementById('id_std_check').value; if (std_check === 'Orphan'){ document.getElementById('id_std_tution_fee').value = '85000'; document.getElementById('id_std_total_fee').value = '258250'; document.getElementById('id_std_total_fee_tax').value = '10750'; } else { document.getElementById('id_std_tution_fee').value = '170000'; document.getElementById('id_std_total_fee').value = '347500'; document.getElementById('id_std_total_fee_tax').value = '15000'; } document.getElementById('id_std_admission_fee').value = '5000'; document.getElementById('id_std_utility_charges').value = '20500'; document.getElementById('id_std_it_funds').value = '20500'; document.getElementById('id_std_lab_funds').value = '10500'; document.getElementById('id_std_lab_breakage').value = '8500'; document.getElementById('id_std_sports_funds').value = '8000'; document.getElementById('id_std_internal_exam_assessment').value = '17000'; document.getElementById('id_std_hospital_fee').value = '25000'; document.getElementById('id_std_thesis_project').value = '15000'; document.getElementById('id_std_pu_charges').value = '30000'; document.getElementById('id_std_registration_fee').value = '00'; document.getElementById('id_std_pu_sports_fee').value = '2500'; document.getElementById('id_std_enrollment_fee').value = '00'; document.getElementById('id_std_lib_sec').value = '00'; document.getElementById('id_std_lab_sec').value = '00'; document.getElementById('id_std_welfare_fund').value = '00'; document.getElementById('id_std_total_fee').value = '347500'; document.getElementById('id_std_total_fee_tax').value = '15000'; } $("#id_std_registration, #id_std_admission, #id_std_welfare, #id_std_lib_sec, #id_std_lab_sec").on("keydown keyup keypress", function() { admission(); }); function admission(){ var result = 0; var num1 = document.getElementById('id_std_registration').value; num1 = num1.replace(',','') if (num1 != ''){ result += parseInt(num1); } var num2 = document.getElementById('id_std_admission').value; num2 = num2.replace(',','') if (num2 != ''){ result += parseInt(num2); } var num3 = document.getElementById('id_std_welfare').value; num3 = num3.replace(',','') if (num3 != ''){ result += parseInt(num3); } var num4 = document.getElementById('id_std_lib_sec').value; num4 = num4.replace(',','') if (num4 != ''){ result += parseInt(num4); } var num5 = document.getElementById('id_std_lab_sec').value; num5 = num5.replace(',','') if (num5 != ''){ result += parseInt(num5); } if (!isNaN(result)) { document.getElementById('id_std_total').value = result; } } })