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 : 3.22.242.169
const { split } = require("lodash");
function loadcopomaxmarksexternal() {
// console.log('hi');
$("#page_main_div").load(
"../html_modules/copomaxmarksexternal.html",
function () {
document.getElementById("display_module_name").innerHTML =
"CO PO Mark Entry (External)";
document.getElementById("module_name_for_save").value =
"CO PO Mark Entry (External)";
getDefaultHeadFooterLinks("CO PO Mark Entry (External)");
}
);
loadcopoqpcode();
}
function loadcopoqpcode() {
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
url: $host_url + "loadcopoqpcode",
success: function (response) {
var res = JSON.parse(response);
var qpcodeOptions = "<option value=''>----Select----</option>";
for (var i = 0; i < res.data.length; i++) {
qpcodeOptions += `<option value='${res.data[i].fsubcode}'>${res.data[i].fsubcode} - ${res.data[i].fsubname}</option>`;
}
$("#qpcodeexternal").html(qpcodeOptions);
$.unblockUI();
},
});
}
function loadpacketno() {
var qpcode = document.getElementById("qpcodeexternal").value;
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
data: "&qpcode=" + qpcode,
url: $host_url + "loadcopopacketno",
success: function (response) {
var res = JSON.parse(response);
var packetOptions = "<option value=''>----Select----</option>";
for (var i = 0; i < res.data.length; i++) {
packetOptions += `<option value='${res.data[i].fcollcode}'>${res.data[i].fcollcode}</option>`;
}
$("#packnoexternal").html(packetOptions);
$.unblockUI();
},
});
}
function loadvaluation() {
var qpcode = document.getElementById("qpcodeexternal").value;
var packet = document.getElementById("packnoexternal").value;
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
data: "&qpcode=" + qpcode + "&packet=" + packet,
url: $host_url + "loadcopovalno",
success: function (response) {
var res = JSON.parse(response);
var valOptions = "<option value=''>----Select----</option>";
for (var i = 0; i < res.data.length; i++) {
valOptions += `<option value='${res.data[i].fvalno}'>${res.data[i].fvalno}</option>`;
}
$("#valnoexternal").html(valOptions);
$.unblockUI();
},
});
}
function viewscripts() {
var qpcode = document.getElementById("qpcodeexternal").value;
var packet = document.getElementById("packnoexternal").value;
var valno = document.getElementById("valnoexternal").value;
if (qpcode == "") {
alert("Select QP Code");
return;
}
if (packet == "") {
alert("Select Packet No.");
return;
}
if (valno == "") {
alert("Select Valution No.");
return;
}
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "GET",
data: "packet=" + packet + "&valno=" + valno + "&qpcode=" + qpcode,
url: $host_url + "viewmarksentryexternal",
success: function (response) {
var res = JSON.parse(response);
$("#marksentryexternaltab").html(res.data["tabledata"]);
qpcnt = res.data["qpcnt"];
tablecnt = res.data["tablecnt"];
qno = res.data["qno"];
$.unblockUI();
},
});
}
function SaveCopoMarkEntryExternal() {
var slno = 1;
var maxmarks = "";
var finarr = [];
var qpcode = document.getElementById("qpcodeexternal").value;
var packet = document.getElementById("packnoexternal").value;
var valno = document.getElementById("valnoexternal").value;
if (qpcode == "") {
alert("Select QP Code");
return;
}
if (packet == "") {
alert("Select Packet No.");
return;
}
if (valno == "") {
alert("Select Valution No.");
return;
}
for (var z = 0; z <= tablecnt; z++) {
let regno = $(`#${slno}hregno`).val();
let totmarks = $(`#${slno}totmarks`).html();
let onlinetot = $(`#${slno}onlinetot`).html();
let upd = $(`#${slno}hcregno`).val();
let arr = [];
if (upd == "U") {
for (var i = 0; i < qpcnt; i++) {
let arr1 = {};
qp = $(`#${slno}_hqp_${i}`).val();
let qparry = qp.split("_");
console.log(`${slno}_qp_${qparry[1]}_${i}`);
if(qparry[0] == 'fq1' || qparry[0] == 'fq2' || qparry[0] == 'fq3' || qparry[0] == 'fq4' || qparry[0] == 'fq5' || qparry[0] == 'fq6' || qparry[0] == 'fq7' || qparry[0] == 'fq8' || qparry[0] == 'fq9' || qparry[0] == 'fq10')
maxmarks = $(`#${slno}_${qparry[0]}_${qparry[1]}`).val();
else
maxmarks = $(`#${slno}_qp_${qparry[1]}_${i}`).val();
arr1["maxmarks"] = maxmarks;
arr1["qp"] = qparry[0];
arr1["regno"] = regno;
arr1["totmarks"] = totmarks;
arr1["onlinetot"] = onlinetot;
arr.push(arr1);
}
finarr.push(arr);
}
slno++;
}
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "SaveCopoMarkEntryExternal",
data:
`&packet=` +
packet +
`&valno=` +
valno +
`&qpcode=` +
qpcode +
`&submarks=` +
JSON.stringify(finarr),
success: SaveCopoMarkEntrySuccessExternal,
});
}
function SaveCopoMarkEntrySuccessExternal(response) {
var res = JSON.parse(response);
alert(res.data);
$.unblockUI();
// loadcopomaxmarksexternal();
}
function getregupd(x) {
let idval = x.id;
let myArray = idval.split("_");
$(`#${myArray[0]}hcregno`).val("U");
}
function valmaxmarks(valmax) {
let idval = valmax.id;
let value = valmax.value;
let myArray = idval.split("_");
$(`#${myArray[0]}hcregno`).val("U");
if (parseInt(value) > parseInt($(`#${myArray[2]}qnmax`).val())) {
alert("Please Enter Valid Marks");
$(`#${idval}`).val("");
document.getElementById(`${idval}`).focus();
return;
}
let totqp = $(`#${myArray[0]}totqp`).val();
let totmarks = 0;
for (let i = 0; i < totqp; i++) {
if (
$(`#${myArray[0]}_qp_${i}`).val() != "" &&
$(`#${myArray[0]}_qp_${i}`).val() != "-1"
)
totmarks =
parseInt(totmarks) + parseInt($(`#${myArray[0]}_qp_${i}`).val());
}
$(`#${myArray[0]}totmarks`).html(totmarks);
}
function valmaxmarksExt(valmax) {
let idval = valmax.id;
let value = valmax.value;
let myArray = idval.split("_");
$(`#${myArray[0]}hcregno`).val("U");
if (parseInt(value) > parseInt($(`#${myArray[2]}qnmax`).val())) {
alert("Please Enter Valid Marks");
$(`#${idval}`).val("");
document.getElementById(`${idval}`).focus();
return;
}
let totqp = $(`#${myArray[0]}totqp`).val();
let totmarks = 0;
for (let i = 0; i < totqp; i++) {
if (
$(`#${myArray[0]}_qp_${i}`).val() != "" &&
$(`#${myArray[0]}_qp_${i}`).val() != "-1"
)
totmarks =
parseInt(totmarks) + parseInt($(`#${myArray[0]}_qp_${i}`).val());
}
//$(`#${myArray[0]}totmarks`).html(totmarks);
}
function valmaxmarksNewExt(valmax) {
let idval = valmax.id;
let value = valmax.value;
let myArray = idval.split("_");
console.log(myArray);
$(`#${myArray[0]}hcregno`).val("U");
console.log(parseInt(value));
if (parseInt(value) > parseInt($(`#${myArray[3]}qnmax`).val())) {
alert("Please Enter Valid Marks");
$(`#${idval}`).val("");
document.getElementById(`${idval}`).focus();
return;
}
let totqp = $(`#${myArray[0]}totqp`).val();
let totmarks = 0;
for (let i = 0; i < totqp; i++) {
if (
$(`#${myArray[0]}_qp_${i}`).val() != "" &&
$(`#${myArray[0]}_qp_${i}`).val() != "-1"
)
totmarks =
parseInt(totmarks) + parseInt($(`#${myArray[0]}_qp_${i}`).val());
}
// $('#showteachsub tbody tr').each(function (i) {
// console.log($(this).id());
// });
let oldqp = '';
let newqp = '';
let z = 0;
let qtot = 0;
$('#showteachsub tbody').each(function(){
$(`#${myArray[0]}_fq1_1`).val('-1');
$(`#${myArray[0]}_fq2_2`).val('-1');
$(`#${myArray[0]}_fq3_3`).val('-1');
$(`#${myArray[0]}_fq4_4`).val('-1');
$(`#${myArray[0]}_fq5_5`).val('-1');
$(`#${myArray[0]}_fq6_6`).val('-1');
$(`#${myArray[0]}_fq7_7`).val('-1');
$(`#${myArray[0]}_fq8_8`).val('-1');
$(`#${myArray[0]}_fq9_9`).val('-1');
$(`#${myArray[0]}_fq10_10`).val('-1');
$(this).find(`#td_${myArray[0]} td input:text`).each(function(){
//do your stuff, you can use $(this) to get current cell
//console.log($(this).val());
//console.log($(this).attr("type"));
let idval = $(this).attr("id");
let qpArray = idval.split("_");
console.log(idval);
newqp = qpArray[2];
qtot = ($(this).val() == '-1'?parseInt('0'):parseInt($(this).val()))+parseInt(qtot);
if(oldqp != newqp)
{
if(z > 0)
{
console.log(`#${qpArray[0]}_fq${qpArray[2]}_${qpArray[2]}`);
$(`#${qpArray[0]}_fq${oldqp}_${oldqp}`).val(qtot);
console.log(qpArray[2]);
}
oldqp = qpArray[2];
qtot = 0;
}
z++;
})
$(`#${myArray[0]}_fq10_10`).val(qtot);
})
let onlinetot = 0;
let q1 = parseInt($(`#${myArray[0]}_fq1_1`).val());
let q2 = parseInt($(`#${myArray[0]}_fq2_2`).val());
let q3 = parseInt($(`#${myArray[0]}_fq3_3`).val());
let q4 = parseInt($(`#${myArray[0]}_fq4_4`).val());
let q5 = parseInt($(`#${myArray[0]}_fq5_5`).val());
let q6 = parseInt($(`#${myArray[0]}_fq6_6`).val());
let q7 = parseInt($(`#${myArray[0]}_fq7_7`).val());
let q8 = parseInt($(`#${myArray[0]}_fq8_8`).val());
let q9 = parseInt($(`#${myArray[0]}_fq9_9`).val());
let q10 = parseInt($(`#${myArray[0]}_fq10_10`).val());
if(q1 >q2)
onlinetot = parseInt(onlinetot)+ parseInt(q1);
else
onlinetot = parseInt(onlinetot)+ parseInt(q2);
if(q3 >q4)
onlinetot = parseInt(onlinetot)+ parseInt(q3);
else
onlinetot = parseInt(onlinetot)+ parseInt(q4);
if(q5 >q6)
onlinetot = parseInt(onlinetot)+ parseInt(q5);
else
onlinetot = parseInt(onlinetot)+ parseInt(q6);
if(q7 >q8)
onlinetot = parseInt(onlinetot)+ parseInt(q7);
else
onlinetot = parseInt(onlinetot)+ parseInt(q8);
if(q9 >q10)
onlinetot = parseInt(onlinetot)+ parseInt(q9);
else
onlinetot = parseInt(onlinetot)+ parseInt(q10);
$(`#${myArray[0]}onlinetot`).html(onlinetot);
}
function copomarksexternal() {
loadcopomaxmarksexternal();
}
function freezeCopoMarksEntry() {
let qpcode = document.getElementById("qpcodeexternal").value;
let packet = document.getElementById("packnoexternal").value;
let valno = document.getElementById("valnoexternal").value;
console.log(valno, "valno");
if (qpcode == "") {
alert("Select QP Code");
return;
}
if (packet == "") {
alert("Select Packet No.");
return;
}
if (valno == "") {
alert("Select Valution No.");
return;
}
if (window.confirm("Do you want to freeze?")) {
$.blockUI({
message:
"<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
});
$.ajax({
type: "POST",
url: $host_url + "freezeCopoSeeMarksEntry",
data: "qpcode=" + qpcode + "&packet=" + packet + "&valno=" + valno,
success: function (data) {
let res = JSON.parse(data);
alert(res.data);
$.unblockUI();
return;
},
});
} else {
console.log("freeze cancelled");
}
}
function getCopoMarksEntrySeeReport() {
let qpcode = document.getElementById("qpcodeexternal").value;
let packet = document.getElementById("packnoexternal").value;
let valno = document.getElementById("valnoexternal").value;
console.log(valno, "valno");
if (qpcode == "") {
alert("Select QP Code");
return;
}
if (packet == "") {
alert("Select Packet No.");
return;
}
if (valno == "") {
alert("Select Valution No.");
return;
}
window.open(
$host_url +
"getCopoMarksEntrySeeReport" +
"&qpcode=" +
qpcode +
"&packet=" +
packet +
"&valno=" +
valno
);
}
|