0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 13.59.217.1


Current Path : /var/www/oasis/custom_js/
Upload File :
Current File : /var/www/oasis/custom_js/batch_setup.js

function LoadBatchSetup() {
  $g_entered_batch = '';
  $('#page_main_div').load(
    '../html_modules/batch_setup.html?v=25052016',
    function () {
      $geditinternalcode = 0;
      window.enable_proper_module = 'enableLoadRevaluationt';
      document.getElementById('display_module_name').innerHTML =
        'Batch Preparation';
      document.getElementById('module_name_for_save').value = 'SaveBatchSetup';
      document.getElementById('is_add_edit').value = 'Edit';
      getDefaultHeadFooterLinks('Batch Setup');

      if (db == 'demo') {
        $('#batch_sub_degree_code').val('BTCS1');
        $('#batch_sub_degree_name').val(
          'B.Tech (Computer Science & Engineering)',
        );
        $('#batch_sub_Examno').val('A');
        $('#batch_sub_Exam_name').val('First Semester');
        $('#batch_sub_final_subcode').val('A0910');
        $('#batch_sub_fsubname').val('Constitution of India');
        $('#batch_sub_maxmark').val('50');
        $('#countvalue').val('145');
      }

      if (db == 'dypatil') {
        $('#lsubcode').html('Course : ');
        $('#lregno').html('USN : ');
        $('#ldegcode').html('Programme : ');
      }
    },
  );
}

function AssignBatchNo(reg_no) {
  if (empty($('#mes_marks_' + reg_no).val())) {
    $('#mes_marks_' + reg_no).val($g_entered_batch);
  }
  CalculateBatchDetails();
}

function CheckBatchmaxNo(this_obj) {
  return true;
  batch_arr = new Array();
  batch_arr.push(1);
  html_objects = $("input[id*='mes_marks_']");
  jQuery.each(html_objects, function (k, v) {
    var batch_no = parseInt($('#' + v['id']).val());

    if (batch_no > 7) return true;
    if (
      !in_array(batch_no, batch_arr) &&
      batch_no > 0 &&
      this_obj.id != v['id']
    ) {
      batch_arr.push(parseInt(batch_no));
    }
  });

  max_batch = Math.max.apply(null, batch_arr);
  next_batch = eval(max_batch + 1);
  if (this_obj.value > next_batch && next_batch != 1) {
    alert('Max Batch No You can enter is ' + next_batch);
    $('#' + this_obj.id).focus();
    $('#' + this_obj.id).val('');
    return false;
  }
}

function CalculateBatchDetails() {
  html_objects = $("input[id*='mes_marks_']");
  total_batch_obj = new Object();
  for (i = 1; i <= 12; i++) {
    total_batch_obj[i] = new Object();
    total_batch_obj[i] = 0;
    $('#b' + i).html(0);
  }
  console.log(total_batch_obj);
  jQuery.each(html_objects, function (k, v) {
    var batch_no = parseFloat($('#' + v['id']).val());
    console.log(batch_no);
    if (!empty(batch_no) && batch_no > 0 && batch_no != '00')
      total_batch_obj[batch_no] = eval(total_batch_obj[batch_no] + 1);
  });
  jQuery.each(total_batch_obj, function (kk, vv) {
    if (vv > 0) {
      $('#b' + kk).html(vv);
    }
  });
  console.log(total_batch_obj);
}
var $batch;
function gettotalstudentcount() {
  var bw_condition;
  if ($('#batch_sub_range').val() == 'B/W') {
    condition_name = ' between ';
    condition_val =
      "'" +
      $('#batch_sub_range_from').val() +
      "'" +
      ' and ' +
      "'" +
      $('#batch_sub_range_to').val() +
      "'";
  } else {
    condition_name = 'like ';
    condition_val = $('#batch_sub_range_bw').val();
  }

  var list_data = 'Degcode=' + $('#batch_sub_degree_code').val();
  list_data += '&Subcode=' + $('#batch_sub_final_subcode').val();
  list_data += '&Examno=' + $('#batch_sub_Examno').val();
  list_data += '&batch_nos=' + $('#batch_nos').val();
  list_data += '&fssubname=' + $('#batch_sub_fssubname').val();
  list_data += '&condition_name=' + condition_name;
  list_data += '&condition_val=' + condition_val;
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Getting... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: 'POST',
    url: $host_url + 'Getstudentcount',
    data: list_data,
    success: function ($responce) {
      $responce = eval('(' + $responce + ')');
      $.unblockUI();
      if ($responce.error_code == 0) {
        document.getElementById('countvalue').value = $responce.data['count'];
        $batch = $responce.data['batchno'];
        if ($responce.data['batchno'] != 0) {
          document.getElementById('batch_nos').disabled = true;
        } else {
          document.getElementById('batch_nos').disabled = false;
        }
      } else {
        alert($responce.data);
        return;
      }
    },
  });
}

function GetBatchWiseRegNos() {
  $('#mes_default_reg_div').hide();

  if ($('#batch_sub_degree_code').val() == '') {
    alert('Please Enter Degree Name');
    $('#batch_sub_degree_code').focus();
    return;
  }
  if ($('#batch_sub_final_subcode').val() == '') {
    alert('Please Enter Subject Code');
    $('#batch_sub_final_subcode').focus();
    return;
  }
  if ($('#batch_sub_Examno').val() == '') {
    alert('Please Enter Examno');
    $('#batch_sub_Examno').focus();
    return;
  }
  var $batchno = $('#batch_nos').val();
  var batch_stat = $('#batch_stat').val();
  var $count = $('#countvalue').val();

  if (parseInt($count) < parseInt($batchno)) {
    alert('No. of Students Per Batch is greater than students count.');
    $('#batch_nos').focus();
    return;
  }
  if ($batch == 0) {
    /* if($("#batch_nos").val()=="")
		{
			alert("Please Enter No. of Students Per Batch");
			$("#batch_nos").focus();
			return;
		}  */
  }
  var bw_condition;
  if ($('#batch_sub_range').val() == 'B/W') {
    condition_name = ' between ';
    condition_val =
      "'" +
      $('#batch_sub_range_from').val() +
      "'" +
      ' and ' +
      "'" +
      $('#batch_sub_range_to').val() +
      "'";
  } else {
    condition_name = 'like ';
    condition_val = $('#batch_sub_range_bw').val();
  }

  var list_data = 'Degcode=' + $('#batch_sub_degree_code').val();
  list_data += '&Subcode=' + $('#batch_sub_final_subcode').val();
  list_data += '&Examno=' + $('#batch_sub_Examno').val();
  list_data += '&batch_nos=' + $('#batch_nos').val();
  list_data += '&batch_stat=' + $('#batch_stat').val();
  list_data += '&fssubname=' + $('#batch_sub_fssubname').val();

  list_data += '&condition_name=' + condition_name;
  list_data += '&condition_val=' + condition_val;
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Getting... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: 'POST',
    //async:false,
    url: $host_url + 'GetBatchWiseRegNos',
    data: list_data,
    success: GetBatchWiseRegNosResponse,
  });
}

function GetBatchWiseRegNosResponse($responce) {
  $responce = eval('(' + $responce + ')');
  console.log($responce);
  $.unblockUI();
  $('#btc_default_reg_div').html('');
  if ($responce.error_code == 0) {
    $('#btc_default_reg_div').load($responce.data.filenme, function () {
      CalculateBatchDetails();
    });
  }
}

function SaveBatchWiseDetails() {
  var list_data = '&Degcode=' + $('#batch_sub_degree_code').val();
  list_data += '&Subcode=' + $('#batch_sub_final_subcode').val();
  list_data += '&VivaSubcode=' + $('#batch_viva_subject_code').val();
  list_data += '&Examno=' + $('#batch_sub_Examno').val();
  list_data += '&batch_nos=' + $('#batch_nos').val();
  $length_of_marks = $("input[id*='hidden_']").length;

  save_obj = new Object();
  $mes_all_reg_nos = '';
  count_marks = 0;
  html_objects = $("input[id*='mes_marks_']");
  var i = 0;
  jQuery.each(html_objects, function (k, v) {
    var batch_no = $('#' + v['id']).val();
    var reg_no = v['id'].split('mes_marks_')[1];
    save_obj[i] = new Object();
    save_obj[i]['reg_no'] = reg_no;
    save_obj[i]['batch_no'] = batch_no;
    i++;
  });

  var myJSONText = encodeURIComponent(JSON.stringify(save_obj));
  list_data += '&output_details=' + myJSONText;

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'>Saving... <img src='images/spinner.gif' border='0'></h1>",
  });
  $.ajax({
    type: 'POST',
    //async:false,
    url: $host_url + 'SaveBatchWiseDetails',
    data: list_data,
    success: SaveBatchWiseDetailsResponce,
  });
}
function SaveBatchWiseDetailsResponce(responce) {
  responce = eval('(' + responce + ')');
  $.unblockUI();
  alert(responce.data);
  $('#btc_default_reg_div').html('');
}
/*##################### REPORT PART ##################################*/
function GenerateFromBatchPrepration() {
  degree = trim($('#batch_sub_degree_code').val());
  exam = trim($('#batch_sub_Examno').val());
  sub = trim($('#batch_sub_final_subcode').val());
  from_batch = trim($('#from_batch').val());
  to_batch = trim($('#to_batch').val());
  if (empty(degree)) {
    alert('Please Select Degree!!');
    return false;
  } else if (empty(exam)) {
    alert('Please Select exam!!');
    return false;
  } else if (empty(sub)) {
    alert('Please Select sub!!');
    return false;
  }
  /* 	else if(empty(from_batch))
	{
		alert("Please Select From batch!!");
		return false;
	} */
  var str = '&degree=' + degree;
  str += '&degree_name=' + trim($('#batch_sub_degree_name').val());
  str += '&exam=' + exam;
  str += '&sub=' + sub;
  str += '&from_batch=' + from_batch;
  str += '&to_batch=' + to_batch;
  str +=
    '&sub_name=' + encodeURIComponent(trim($('#batch_sub_fsubname').val()));
  str += '&fs_sub_name=' + trim($('#batch_sub_fssubname').val());

  window.open($host_url + 'GenerateBatchSetupDetails' + str);
}
function GenerateBatchWorkSheetsFromBatchPreparation() {
  degree = trim($('#batch_sub_degree_code').val());
  exam = trim($('#batch_sub_Examno').val());
  sub = trim($('#batch_sub_final_subcode').val());
  from_batch = trim($('#from_batch').val());
  to_batch = trim($('#to_batch').val());
  if (empty(degree)) {
    alert('Please Select Degree!!');
    return false;
  } else if (empty(exam)) {
    alert('Please Select exam!!');
    return false;
  } else if (empty(sub)) {
    alert('Please Select sub!!');
    return false;
  }
  /* 	else if(empty(from_batch))
	{
		alert("Please Select From batch!!");
		return false;
	} */
  var str = '&degree=' + degree;
  str += '&degree_name=' + trim($('#batch_sub_degree_name').val());
  str += '&exam=' + exam;
  str += '&sub=' + sub;
  str += '&from_batch=' + from_batch;
  str += '&to_batch=' + to_batch;
  str +=
    '&fs_sub_name=' + encodeURIComponent(trim($('#batch_sub_fssubname').val()));
  str +=
    '&sub_name=' + encodeURIComponent(trim($('#batch_sub_fsubname').val()));

  window.open($host_url + 'GenerateBatchWorkSheets' + str);
}