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 : 18.223.159.237
function getdata() {
let url = document.URL;
urlParams = parseURLParams(url);
console.log(urlParams);
$.ajax({
type: "GET",
url:
"https://college.universitysolutions.in/app.php?db=" +
urlParams.db[0] +
"&a=barGraphResult" +
"°grp=" +
urlParams.deggrp[0] +
"&evennoddsem=" +
urlParams.evennoddsem[0] +
"&yearmode=" +
urlParams.yearmode[0] +
"°ree=" +
urlParams.degree[0],
success: function (res) {
let response = JSON.parse(res);
console.log(response);
google.charts.load("current", { packages: ["bar"] });
google.charts.setOnLoadCallback(drawStuff);
//headings
let headings = document.createElement("div");
headings.style.cssText = "line-height: 0.5; margin-bottom:100px;";
let colldet = document.createElement("div");
headings.appendChild(colldet);
if (urlParams.db[0] === "jssstu") {
let heading_1 = document.createElement("p");
heading_1.style.cssText =
"font-size: 16px; font-weight: bold; text-align: center;";
var t = document.createTextNode("JSS MAHAVIDYAPEETHA");
heading_1.appendChild(t);
colldet.appendChild(heading_1);
}
let heading_2 = document.createElement("p");
heading_2.style.cssText =
"font-size: 18px; font-weight: bold; text-align: center;";
var t2 = document.createTextNode(response.data.col_det.FUNIVNAME);
heading_2.appendChild(t2);
let heading_3 = document.createElement("p");
heading_3.style.cssText =
"font-size: 16px; font-weight: bold; text-align: center;";
var t3 = document.createTextNode(response.data.col_det.state);
heading_3.appendChild(t3);
let heading_4 = document.createElement("p");
heading_4.style.cssText =
"font-size: 18px; font-weight: bold; text-align: center;";
var t4 = document.createTextNode(
"College:" + response.data.obj.college_name
);
heading_4.appendChild(t4);
let heading_5 = document.createElement("p");
heading_5.style.cssText =
"font-size: 16px; font-weight: bold; text-align: center;";
var t5 = document.createTextNode(
urlParams.deggrp[0] +
" " +
" and Examinations - " +
urlParams.evennoddsem[0].toUpperCase() +
" " +
"Semester (" +
response.data.obj.fresexamdate +
")"
);
heading_5.appendChild(t5);
let heading_6 = document.createElement("p");
heading_6.style.cssText =
"font-size: 14px; font-weight: bold; text-align: center;";
var t6 = document.createTextNode(
"DEGREE :- ( " + urlParams.degree[0] + " )"
);
heading_6.appendChild(t6);
if (urlParams.db[0] !== "sjbit") {
colldet.appendChild(heading_2);
colldet.appendChild(heading_3);
colldet.appendChild(heading_4);
}
colldet.appendChild(heading_5);
colldet.appendChild(heading_6);
let logo = document.createElement("div");
logo.style.cssText = "margin-top:25px;";
let img = document.createElement("img");
if (urlParams.db[0] === "sjbit") {
img.style.cssText = "height:120px; width:800px;";
img.setAttribute(
"src",
"https://college.universitysolutions.in/" +
urlParams.db[0] +
"/img/log.jpg"
);
} else {
img.style.cssText =
"height:70px; width:140px; position:absolute; right:10px;";
img.setAttribute(
"src",
"https://college.universitysolutions.in/" +
urlParams.db[0] +
"/img/logo.jpg"
);
}
let line = document.createElement("div");
line.style.cssText = "border:1px solid;";
logo.appendChild(img);
headings.appendChild(logo);
headings.appendChild(colldet);
headings.appendChild(line);
//table
let mainHeader = ["", "CLASS OBTAINED"];
let subHeader = [
"Semester",
"No. of Students Appeared",
"FCD",
"FC",
"SC",
"PC",
"FAIL",
"PASS PERCENTAGE",
];
// let resp = response.data.data;
// console.log(resp, "vsdhgcu");
let tableDiv = document.createElement("div");
tableDiv.setAttribute("class", "table-reponsive");
let table = document.createElement("table");
table.setAttribute("class", "table table-bordered");
let thead = document.createElement("thead");
let theadRow1 = document.createElement("tr");
thead.appendChild(theadRow1);
for (var k = 0; k < mainHeader.length; k++) {
let th = document.createElement("th");
th.style.cssText =
"font-size: 20px; font-weight: bold; text-align: center;";
if (k === 0) {
th.colSpan = 2;
} else {
th.colSpan = 6;
}
th.appendChild(document.createTextNode(mainHeader[k]));
theadRow1.appendChild(th);
}
let theadRow2 = document.createElement("tr");
for (var k = 0; k < subHeader.length; k++) {
let td = document.createElement("td");
td.style.cssText =
"font-size: 20px; font-weight: bold; text-align: center;";
td.appendChild(document.createTextNode(subHeader[k]));
theadRow2.appendChild(td);
}
thead.appendChild(theadRow2);
let tbody = document.createElement("tbody");
for (let i of response.data.data) {
let tbodyRow = document.createElement("tr");
let td = document.createElement("td");
let td1 = document.createElement("td");
let td2 = document.createElement("td");
let td3 = document.createElement("td");
let td4 = document.createElement("td");
let td5 = document.createElement("td");
let td6 = document.createElement("td");
let td7 = document.createElement("td");
let sem = "";
if (i.fexamno.toUpperCase() == "A") {
sem = "1";
} else if (i.fexamno.toUpperCase() == "B") {
sem = "2";
} else if (i.fexamno.toUpperCase() == "C") {
sem = "3";
} else if (i.fexamno.toUpperCase() == "D") {
sem = "4";
} else if (i.fexamno.toUpperCase() == "E") {
sem = "5";
} else if (i.fexamno.toUpperCase() == "F") {
sem = "6";
} else if (i.fexamno.toUpperCase() == "G") {
sem = "7";
} else if (i.fexamno.toUpperCase() == "H") {
sem = "8";
} else if (i.fexamno.toUpperCase() == "I") {
sem = "9";
} else if (i.fexamno.toUpperCase() == "J") {
sem = "10";
}
td.appendChild(document.createTextNode(sem));
td1.appendChild(document.createTextNode(i.COUNT));
td2.appendChild(document.createTextNode(i.fcd));
td3.appendChild(document.createTextNode(i.fc));
td4.appendChild(document.createTextNode(i.sc));
td5.appendChild(document.createTextNode(i.pc));
td6.appendChild(document.createTextNode(i.fail));
let perc =
parseFloat(i.fcd) +
parseFloat(i.fc) +
parseFloat(i.sc) +
parseFloat(i.pc);
td7.appendChild(
document.createTextNode(((perc / i.COUNT) * 100).toFixed(2) + "%")
);
// td.appendChild(
// document.createTextNode(
// (
// (records[i] / parseInt(response.data.data[0].COUNT)) *
// 100
// ).toFixed(2) + "%"
// )
// );
tbodyRow.appendChild(td);
tbodyRow.appendChild(td1);
tbodyRow.appendChild(td2);
tbodyRow.appendChild(td3);
tbodyRow.appendChild(td4);
tbodyRow.appendChild(td5);
tbodyRow.appendChild(td6);
tbodyRow.appendChild(td7);
tbody.appendChild(tbodyRow);
}
table.appendChild(thead);
table.appendChild(tbody);
tableDiv.appendChild(table);
//details
let details = document.createElement("p");
let detail_1 = document.createElement("p");
detail_1.style.cssText =
"font-size: 14px; font-weight: bold; text-align: left;";
var title1 = document.createTextNode(
"FCD - First Class with Distinction-SGPA>=7.75"
);
detail_1.appendChild(title1);
let detail_2 = document.createElement("p");
detail_2.style.cssText =
"font-size: 14px; font-weight: bold; text-align: left;";
var title2 = document.createTextNode("FC -First Class -SGPA(6.75-7.74)");
detail_2.appendChild(title2);
let detail_3 = document.createElement("p");
detail_3.style.cssText =
"font-size: 14px; font-weight: bold; text-align: left;";
var title3 = document.createTextNode("SC -Second Class -SGPA(5.25-6.74)");
detail_3.appendChild(title3);
let detail_4 = document.createElement("p");
detail_4.style.cssText =
"font-size: 14px; font-weight: bold; text-align: left;";
var title4 = document.createTextNode("PC -Pass Class -SGPA(4.00-5.24)");
detail_4.appendChild(title4);
let detail_5 = document.createElement("p");
detail_5.style.cssText =
"font-size: 14px; font-weight: bold; text-align: left;";
var title5 = document.createTextNode("Fail - SGPA<=4.00");
detail_5.appendChild(title5);
details.appendChild(detail_1);
details.appendChild(detail_2);
details.appendChild(detail_3);
details.appendChild(detail_4);
details.appendChild(detail_5);
document.getElementById("dual_x_div").appendChild(headings);
// function getValueAt(column, dataTable, row) {
// return dataTable.getFormattedValue(row, column);
// }
function drawStuff() {
let examNoArr = ["CLASS OBTAINED"];
let fcdArr = ["FCD"];
let fcArr = ["FC"];
let scArr = ["SC"];
let pcArr = ["PC"];
let failArr = ["FAIL"];
for (let i of response.data.data) {
let sem = "";
if (i.fexamno.toUpperCase() == "A") {
sem = "1 Semester";
} else if (i.fexamno.toUpperCase() == "B") {
sem = "2 Semester";
} else if (i.fexamno.toUpperCase() == "C") {
sem = "3 Semester";
} else if (i.fexamno.toUpperCase() == "D") {
sem = "4 Semester";
} else if (i.fexamno.toUpperCase() == "E") {
sem = "5 Semester";
} else if (i.fexamno.toUpperCase() == "F") {
sem = "6 Semester";
} else if (i.fexamno.toUpperCase() == "G") {
sem = "7 Semester";
} else if (i.fexamno.toUpperCase() == "H") {
sem = "8 Semester";
} else if (i.fexamno.toUpperCase() == "I") {
sem = "9 Semester";
} else if (i.fexamno.toUpperCase() == "J") {
sem = "10 Semester";
}
examNoArr.push(sem);
fcdArr.push(i.fcd);
fcArr.push(i.fc);
scArr.push(i.sc);
pcArr.push(i.pc);
failArr.push(i.fail);
}
console.log(fcdArr, "jii");
var data = new google.visualization.arrayToDataTable([
examNoArr,
fcdArr,
fcArr,
scArr,
pcArr,
failArr,
]);
var options = {
width: 1000,
height: 500,
chart: {
title: "",
subtitle: [
"CLASS OBTAINED",
"2 Semester",
"4 Semester",
"6 semester",
"8 semester",
],
},
bars: "vertical",
series: {
0: { axis: "2" },
1: { axis: "4" },
2: { axis: "6" },
3: { axis: "8" },
},
axes: {
x: {
semester: { label: "parsecs" },
result: { side: "top", label: "apparent magnitude" },
},
},
};
document.getElementById("dual_x_div").appendChild(tableDiv);
const div = document.createElement(`div`);
var chart = new google.charts.Bar(
document.getElementById("dual_x_div").appendChild(div)
);
chart.draw(data, options);
document.getElementById("dual_x_div").appendChild(details);
}
},
});
}
function parseURLParams(url) {
var queryStart = url.indexOf("?") + 1,
queryEnd = url.indexOf("#") + 1 || url.length + 1,
query = url.slice(queryStart, queryEnd - 1),
pairs = query.replace(/\+/g, " ").split("&"),
parms = {},
i,
n,
v,
nv;
if (query === url || query === "") return;
for (i = 0; i < pairs.length; i++) {
nv = pairs[i].split("=", 2);
n = decodeURIComponent(nv[0]);
v = decodeURIComponent(nv[1]);
if (!parms.hasOwnProperty(n)) parms[n] = [];
parms[n].push(nv.length === 2 ? v : null);
}
return parms;
}
|