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.117.254.202
Current Path : /var/www/oasis/src/ |
| Current File : /var/www/oasis/src/marksentryquestionwise.php |
<?php
function viewIAQuestionWisewise($aobj_context){
session_start();
$collcode=$_SESSION['collcode'];
$teachcode = $aobj_context->mobj_data["teachcode"];
$classid = $aobj_context->mobj_data["classid"];
$subject = $aobj_context->mobj_data["subelement"];
$txtmarks = $aobj_context->mobj_data["txtmarks"];
$testName = $aobj_context->mobj_data["testName"];
$sort = $aobj_context->mobj_data["fsort"];
$split = explode("*", $subject);
$subelement = $split[0];
$subdet = $split[1];
$queryView = "select * from maxmarksint
where fclassid='{$classid}' and ftestname='{$testName}'
and fsubcode = '{$subelement}'";
$resMarks=$aobj_context->mobj_db->GetAll($queryView);
if(count($resMarks) == 0){
$arr['msg'] = "Questionwise maximum marks and CO not entered";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure"));
return;
}
$query = "select distinct fcollcode, fdegree, fexamno from attendsum where fclassid = '{$classid}'";
$res=$aobj_context->mobj_db->GetRow($query);
$collcode = $res['fcollcode'];
$degree = $res['fdegree'];
$exam = $res['fexamno'];
if($testName == "Test 1"){
$dateCond = "DATE_FORMAT(fia1from,'%Y-%m-%d')
and DATE_FORMAT(fia1to,'%Y-%m-%d')";
}else if($testName == "Test 2"){
$dateCond = "DATE_FORMAT(fia2from,'%Y-%m-%d')
and DATE_FORMAT(fia2to,'%Y-%m-%d')";
}else if($testName == "Test 3"){
$dateCond = "DATE_FORMAT(fia3from,'%Y-%m-%d')
and DATE_FORMAT(fia3to,'%Y-%m-%d')";
}else if($testName == "Test 4"){
$dateCond = "DATE_FORMAT(fia4from,'%Y-%m-%d')
and DATE_FORMAT(fia4to,'%Y-%m-%d')";
}
$query = "select * from subdet
where fcollcode = '{$collcode}' and DATE_FORMAT(NOW(),'%Y-%m-%d') between
{$dateCond}
and concat(fcsubcode,fsubcode) = '{$subelement}'
and fdegree='{$degree}'";
$res3 = $aobj_context->mobj_db->GetAll($query);
if(count($res3) == 0){
$arr['msg'] = "Dates not enabled";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure"));
return;
} else {
$query = "select * from control";
$res9=$aobj_context->mobj_db->GetRow($query);
$FREGROLL = $res9['FREGROLL'];
if(strtolower($subdet) == "cie"){
$colcond = "ifnull(mak.fmarks11, '-1')as fmarks11, ifnull(mak.fmarks12, '-1')as fmarks12, ifnull(mak.fmarks13, '-1')as fmarks13, ifnull(mak.fmarks14, '-1')as fmarks14, ifnull(ftotal1, '')as ftotal1,
ifnull(mak.fmarks21, '-1')as fmarks21, ifnull(mak.fmarks22, '-1')as fmarks22, ifnull(mak.fmarks23, '-1')as fmarks23, ifnull(mak.fmarks24, '-1')as fmarks24, ifnull(ftotal2, '')as ftotal2,
ifnull(mak.fmarks31, '-1')as fmarks31, ifnull(mak.fmarks32, '-1')as fmarks32, ifnull(mak.fmarks33, '-1')as fmarks33, ifnull(mak.fmarks34, '-1')as fmarks34, ifnull(ftotal3, '')as ftotal3,
ifnull(mak.fmarks41, '-1')as fmarks41, ifnull(mak.fmarks42, '-1')as fmarks42, ifnull(mak.fmarks43, '-1')as fmarks43, ifnull(mak.fmarks44, '-1')as fmarks44, ifnull(ftotal4, '')as ftotal4";
}else {
$colcond = "ifnull(mak.fmarks11, '-1')as fmarks11, ifnull(mak.fmarks12, '-1')as fmarks12, ifnull(mak.fmarks13, '-1')as fmarks13,
ifnull(mak.fmarks14, '-1')as fmarks14, ifnull(mak.fmarks15, '-1')as fmarks15, ifnull(mak.fmarks16, '-1')as fmarks16, ifnull(ftotal1, '')as ftotal1";
}
$query1 = "select stu.FREGNO, stu.FNAME, sd.fexamno, sd.fdegree, stu.fcollcode,
{$colcond}, mak.FTOTAL, mak.facttotal,
mak.fsubcode, mak.fdegree, mak.fexamno,
fnotest as FTEST, fu1max, fu2max, fqnno
FROM attendsum a inner join student stu on stu.FREGNO=a.FREGNO and stu.fdegree = a.fdegree
inner join degree d on d.FDEGREE =a.FDEGREE and d.Fexamno=a.Fexamno
inner join subdet sd on a.fdegree = sd.fdegree and a.fexamno = sd.fexamno
and left(a.fsubcode,4) = left(sd.fcsubcode,4)
left join marksint mak ON a.fdegree = mak.fdegree and a.FREGNO=mak.FREGNO
and mak.ftest = '{$testName}' and mak.fsubcode='{$subelement}'
where a.fteachcode = '{$teachcode}' and a.fclassid = '{$classid}'
and a.FCOLLCODE='{$collcode}'
and left(a.fsubcode,4) = left('{$subelement}',4)
group by fregno order by {$sort}";
// var_dump($query1);die();
$result=$aobj_context->mobj_db->GetAll($query1);
$queryView = "select FQNNO, FMARKS, FCO, FPO, FPSO from maxmarksint
where fclassid='{$classid}' and ftestname='{$testName}'
and fsubcode='{$subelement}'";
$resMarks=$aobj_context->mobj_db->GetAll($queryView);
if(strtolower($subdet) == "cie"){
$e_data.="<table id='tabledata' class='table' width='100%' cellspacing='0' cellpadding='0' border='0' >";
$e_data.="<thead style='position:sticky; top:0; z-index:1'>";
$e_data.="<tr style='position: sticky;
top: 0;background: white;'>
<th colspan='26' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper'><input type='text' style='width:99%; padding:4px;margin:2px; border-radius:20px;' id='myInput' onkeyup='searchRegCode()' placeholder='Search by Name....'></th>
</tr>";
// $e_data.="<tr><th colspan='21' align='left' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>Marks Entry (Question Wise)</th></tr>";
$e_data.="<tr align='center' class='ui-state-default ui-jqgrid-hdiv'>";
$e_data.="<td class='column' rowspan='2'>Sl. No.</td>";
$e_data.="<td class='column' rowspan='2'>USN</td>";
$e_data.="<td class='column' rowspan='2'>Student Name</td>";
$e_data.="<td class='column' rowspan='2'>Total</td>";
$e_data.="<td class='column' rowspan='2'>Act. Tot.</td>";
$e_data.="<td class='column' rowspan='2'>Absent?</td>";
for($m=1; $m<=4; $m++){
$e_data.="<td class='column' colspan='5'>{$m}. Max. Marks(25)</td>";
}
$e_data.="</tr>";
$e_data.="<tr align='center' id='max_marks' class='ui-state-default ui-jqgrid-hdiv'>";
$a=1;
foreach($resMarks as $val){
$id = strtolower($val['FQNNO'])."max";
$e_data.="<td class='column'>{$val['FQNNO']}<br/>(<span id='$id'>".floatval($val['FMARKS']). "</span>)</td>";
if($a % 4 == 0){
$e_data.="<td class='column'>Total</td>";
}
$a++;
}
$a1 = intval($resMarks[0]['FMARKS']);
$b1 = intval($resMarks[1]['FMARKS']);
$c1 = intval($resMarks[2]['FMARKS']);
$d1 = intval($resMarks[3]['FMARKS']);
$a2 = intval($resMarks[4]['FMARKS']);
$b2 = intval($resMarks[5]['FMARKS']);
$c2 = intval($resMarks[6]['FMARKS']);
$d2 = intval($resMarks[7]['FMARKS']);
$a3 = intval($resMarks[8]['FMARKS']);
$b3 = intval($resMarks[9]['FMARKS']);
$c3 = intval($resMarks[10]['FMARKS']);
$d3 = intval($resMarks[11]['FMARKS']);
$a4 = intval($resMarks[12]['FMARKS']);
$b4 = intval($resMarks[13]['FMARKS']);
$c4 = intval($resMarks[14]['FMARKS']);
$d4 = intval($resMarks[15]['FMARKS']);
$e_data.="</tr>";
$e_data.="</thead>";
$e_data.="<tbody>";
$k=1;
for($m=0;$m<count($result);$m++){
$fmarks11 = $result[$m]['fmarks11'] == "-1.00" ? '-1' : $result[$m]['fmarks11'] ;
$fmarks12 = $result[$m]['fmarks12'] == "-1.00" ? '-1' : $result[$m]['fmarks12'] ;
$fmarks13 = $result[$m]['fmarks13'] == "-1.00" ? '-1' : $result[$m]['fmarks13'] ;
$fmarks14 = $result[$m]['fmarks14'] == "-1.00" ? '-1' : $result[$m]['fmarks14'] ;
$fmarks21 = $result[$m]['fmarks21'] == "-1.00" ? '-1' : $result[$m]['fmarks21'] ;
$fmarks22 = $result[$m]['fmarks22'] == "-1.00" ? '-1' : $result[$m]['fmarks22'] ;
$fmarks23 = $result[$m]['fmarks23'] == "-1.00" ? '-1' : $result[$m]['fmarks23'] ;
$fmarks24 = $result[$m]['fmarks24'] == "-1.00" ? '-1' : $result[$m]['fmarks24'] ;
$fmarks31 = $result[$m]['fmarks31'] == "-1.00" ? '-1' : $result[$m]['fmarks31'] ;
$fmarks32 = $result[$m]['fmarks32'] == "-1.00" ? '-1' : $result[$m]['fmarks32'] ;
$fmarks33 = $result[$m]['fmarks33'] == "-1.00" ? '-1' : $result[$m]['fmarks33'] ;
$fmarks34 = $result[$m]['fmarks34'] == "-1.00" ? '-1' : $result[$m]['fmarks34'] ;
$fmarks41 = $result[$m]['fmarks41'] == "-1.00" ? '-1' : $result[$m]['fmarks41'] ;
$fmarks42 = $result[$m]['fmarks42'] == "-1.00" ? '-1' : $result[$m]['fmarks42'] ;
$fmarks43 = $result[$m]['fmarks43'] == "-1.00" ? '-1' : $result[$m]['fmarks43'] ;
$fmarks44 = $result[$m]['fmarks44'] == "-1.00" ? '-1' : $result[$m]['fmarks44'] ;
$fmarks11 = $result[$m]['fmarks11'] == "-2.00" ? 'Ab' : $result[$m]['fmarks11'] ;
$fmarks12 = $result[$m]['fmarks12'] == "-2.00" ? 'Ab' : $result[$m]['fmarks12'] ;
$fmarks13 = $result[$m]['fmarks13'] == "-2.00" ? 'Ab' : $result[$m]['fmarks13'] ;
$fmarks14 = $result[$m]['fmarks14'] == "-2.00" ? 'Ab' : $result[$m]['fmarks14'] ;
$fmarks21 = $result[$m]['fmarks21'] == "-2.00" ? 'Ab' : $result[$m]['fmarks21'] ;
$fmarks22 = $result[$m]['fmarks22'] == "-2.00" ? 'Ab' : $result[$m]['fmarks22'] ;
$fmarks23 = $result[$m]['fmarks23'] == "-2.00" ? 'Ab' : $result[$m]['fmarks23'] ;
$fmarks24 = $result[$m]['fmarks24'] == "-2.00" ? 'Ab' : $result[$m]['fmarks24'] ;
$fmarks31 = $result[$m]['fmarks31'] == "-2.00" ? 'Ab' : $result[$m]['fmarks31'] ;
$fmarks32 = $result[$m]['fmarks32'] == "-2.00" ? 'Ab' : $result[$m]['fmarks32'] ;
$fmarks33 = $result[$m]['fmarks33'] == "-2.00" ? 'Ab' : $result[$m]['fmarks33'] ;
$fmarks34 = $result[$m]['fmarks34'] == "-2.00" ? 'Ab' : $result[$m]['fmarks34'] ;
$fmarks41 = $result[$m]['fmarks41'] == "-2.00" ? 'Ab' : $result[$m]['fmarks41'] ;
$fmarks42 = $result[$m]['fmarks42'] == "-2.00" ? 'Ab' : $result[$m]['fmarks42'] ;
$fmarks43 = $result[$m]['fmarks43'] == "-2.00" ? 'Ab' : $result[$m]['fmarks43'] ;
$fmarks44 = $result[$m]['fmarks44'] == "-2.00" ? 'Ab' : $result[$m]['fmarks44'] ;
$ftotal1 = $result[$m]['ftotal1'] == "-2.00" ? 'Ab' : $result[$m]['ftotal1'] ;
$ftotal2 = $result[$m]['ftotal2'] == "-2.00" ? 'Ab' : $result[$m]['ftotal2'] ;
$ftotal3 = $result[$m]['ftotal3'] == "-2.00" ? 'Ab' : $result[$m]['ftotal3'] ;
$ftotal4 = $result[$m]['ftotal4'] == "-2.00" ? 'Ab' : $result[$m]['ftotal4'] ;
$facttot = $result[$m]['facttotal'] == "-2.00" ? 'Ab' : $result[$m]['facttotal'] ;
$total = $result[$m]['FTOTAL'] == "-2.00" ? 'Ab' : $result[$m]['FTOTAL'] ;
if($fmarks11 === 'Ab'){
$co = "disabled";
$coc = "checked";
}else{
$co = "";
$coc = "";
}
if($a1 == 0){
$a1disabled = "disabled";
}if($b1 == 0){
$b1disabled = "disabled";
}if($c1 == 0){
$c1disabled = "disabled";
}if($d1 == 0){
$d1disabled = "disabled";
}if($a2 == 0){
$a2disabled = "disabled";
}if($b2 == 0){
$b2disabled = "disabled";
}if($c2 == 0){
$c2disabled = "disabled";
}if($d2 == 0){
$d2disabled = "disabled";
}if($a3 == 0){
$a3disabled = "disabled";
}if($b3 == 0){
$b3disabled = "disabled";
}if($c3 == 0){
$c3disabled = "disabled";
}if($d3 == 0){
$d3disabled = "disabled";
}if($a4 == 0){
$a4disabled = "disabled";
}if($b4 == 0){
$b4disabled = "disabled";
}if($c4 == 0){
$c4disabled = "disabled";
}if($d4 == 0){
$d4disabled = "disabled";
}
$e_data.="<tr align='center' class='ui-widget-content jqgrow'>";
$e_data.="<td class='column'>{$k}</td>";
$e_data.="<td class='column'>{$result[$m]['FREGNO']}</td>";
$e_data.="<td class='column' align='left'>{$result[$m]['FNAME']}</td>";
$e_data.="<td class='column'><input type='text' class='total_{$k}' id='total_{$k}' style='width:30px;text-align: center;{$border};' value='{$total}' disabled></td>";
$e_data.="<td class='column'><input type='text' class='act_tot_{$k}' id='act_tot_{$k}' style='width:30px;text-align: center;{$border};' value='{$facttot}' disabled></td>";
$e_data.="<td class='column'><input type='checkbox' id='absent_{$k}' style='width:30px;text-align: center;{$border};' value='' onchange='frezstd($k,this)' $coc></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark1A_`, $k, `1`)' class='mark1A_{$k}' id='mark1A_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks11}' $co $a1disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark1B_`, $k, `1`)' class='mark1B_{$k}' id='mark1B_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks12}' $co $b1disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark1C_`, $k, `1`)' class='mark1C_{$k}' id='mark1C_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks13}' $co $c1disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark1D_`, $k, `1`)' class='mark1D_{$k}' id='mark1D_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks14}' $co $d1disabled></td>";
$e_data.="<td class='column'><input type='text' class='total1_{$k}' id='total1_{$k}' style='width:35px;text-align: center;{$border};' value='{$ftotal1}' disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark2A_`, $k, `2`)' class='mark2A_{$k}' id='mark2A_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks21}' $co $a2disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark2B_`, $k, `2`)' class='mark2B_{$k}' id='mark2B_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks22}' $co $b2disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark2C_`, $k, `2`)' class='mark2C_{$k}' id='mark2C_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks23}' $co $c2disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark2D_`, $k, `2`)' class='mark2D_{$k}' id='mark2D_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks24}' $co $d2disabled></td>";
$e_data.="<td class='column'><input type='text' class='total2_{$k}' id='total2_{$k}' style='width:35px;text-align: center;{$border};' value='{$ftotal2}' disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark3A_`, $k, `3`)' class='mark3A_{$k}' id='mark3A_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks31}' $co $a3disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark3B_`, $k, `3`)' class='mark3B_{$k}' id='mark3B_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks32}' $co $b3disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark3C_`, $k, `3`)' class='mark3C_{$k}' id='mark3C_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks33}' $co $c3disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark3D_`, $k, `3`)' class='mark3D_{$k}' id='mark3D_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks34}' $co $d3disabled></td>";
$e_data.="<td class='column'><input type='text' class='total3_{$k}' id='total3_{$k}' style='width:35px;text-align: center;{$border};' value='{$ftotal3}' disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark4A_`, $k, `4`)' class='mark4A_{$k}' id='mark4A_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks41}' $co $a4disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark4B_`, $k, `4`)' class='mark4B_{$k}' id='mark4B_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks42}' $co $b4disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark4C_`, $k, `4`)' class='mark4C_{$k}' id='mark4C_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks43}' $co $c4disabled></td>";
$e_data.="<td class='column'><input type='text' oninput='getTotal($k)' onkeypress='return isNumber(event)' onblur='checkValidMarks(`mark4D_`, $k, `4`)' class='mark4D_{$k}' id='mark4D_{$k}' style='width:35px;text-align: center;{$border};' value='{$fmarks44}' $co $d4disabled></td>";
$e_data.="<td class='column'><input type='text' class='total4_{$k}' id='total4_{$k}' style='width:35px;text-align: center;{$border};' value='{$ftotal4}' disabled></td>";
$e_data.="</tr>";
$k++;
}
$e_data.="</tbody>";
}else {
$e_data.="<table id='tabledata' class='table' style='width: 100%;' cellspacing='0' cellpadding='0' border='0' >";
$e_data.="<thead style='position:sticky; top:0; z-index:1'>";
$e_data.="<tr><th colspan='21' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>
<input type='text' style='width:96%; padding:4px;margin:2px; border-radius:20px;' id='myInput' onkeyup='searchRegCode()' placeholder='Search by Name....'>
</th></tr>";
$e_data.="<tr align='center' class='ui-state-default ui-jqgrid-hdiv'>";
$e_data.="<td rowspan='2' class='column'>Sl. No.</td>";
$e_data.="<td rowspan='2' class='column'>USN</td>";
$e_data.="<td rowspan='2' class='column'>Name</td>";
$e_data.="<td rowspan='2' class='column'>Total</td>";
$e_data.="<td rowspan='2' class='column'>Ab?</td>";
$e_data.="<td colspan='6' class='column'>1. Max. Marks(50)</td>";
$e_data.="</tr>";
$e_data.="<tr align='center' class='ui-state-default ui-jqgrid-hdiv'>";
foreach($resMarks as $val){
$id = strtolower($val['FQNNO'])."max";
$e_data.="<td class='column'>{$val['FQNNO']}<br/>(<span id='$id'>".intval($val['FMARKS']). "</span>)</td>";
}
$e_data.="</tr>";
$e_data.="</thead>";
$e_data.="<tbody>";
$k=1;
$a1 = intval($resMarks[0]['FMARKS']);
$b1 = intval($resMarks[1]['FMARKS']);
$c1 = intval($resMarks[2]['FMARKS']);
$d1 = intval($resMarks[3]['FMARKS']);
$e1 = intval($resMarks[4]['FMARKS']);
$f1 = intval($resMarks[5]['FMARKS']);
for($m=0; $m < count($result); $m++){
$fmarks11 = $result[$m]['fmarks11'] == "-1.00" ? '-1' : $result[$m]['fmarks11'];
$fmarks12 = $result[$m]['fmarks12'] == "-1.00" ? '-1' : $result[$m]['fmarks12'] ;
$fmarks13 = $result[$m]['fmarks13'] == "-1.00" ? '-1' : $result[$m]['fmarks13'] ;
$fmarks14 = $result[$m]['fmarks14'] == "-1.00" ? '-1' : $result[$m]['fmarks14'] ;
$fmarks15 = $result[$m]['fmarks15'] == "-1.00" ? '-1' : $result[$m]['fmarks15'] ;
$fmarks16 = $result[$m]['fmarks16'] == "-1.00" ? '-1' : $result[$m]['fmarks16'] ;
$fmarks11 = $result[$m]['fmarks11'] == "-2.00" ? 'Ab' : $result[$m]['fmarks11'] ;
$fmarks12 = $result[$m]['fmarks12'] == "-2.00" ? 'Ab' : $result[$m]['fmarks12'] ;
$fmarks13 = $result[$m]['fmarks13'] == "-2.00" ? 'Ab' : $result[$m]['fmarks13'] ;
$fmarks14 = $result[$m]['fmarks14'] == "-2.00" ? 'Ab' : $result[$m]['fmarks14'] ;
$fmarks15 = $result[$m]['fmarks15'] == "-2.00" ? 'Ab' : $result[$m]['fmarks15'] ;
$fmarks16 = $result[$m]['fmarks16'] == "-2.00" ? 'Ab' : $result[$m]['fmarks16'] ;
$total = $result[$m]['FTOTAL'] == "-2.00" ? 'Ab' : $result[$m]['FTOTAL'] ;
if($fmarks11 === 'Ab'){
$co = "disabled";
$coc = "checked";
}else{
$co = "";
$coc = "";
}
if($a1 == 0){
$a1disabled = "disabled";
}if($b1 == 0){
$b1disabled = "disabled";
}if($c1 == 0){
$c1disabled = "disabled";
}if($d1 == 0){
$d1disabled = "disabled";
}if($e1 == 0){
$e1disabled = "disabled";
}if($f1 == 0){
$f1disabled = "disabled";
}
$e_data.="<tr id='co_marks_{$k}' align='center' class='ui-widget-content jqgrow'>";
$e_data.="<td class='column'>{$k}</td>";
$e_data.="<td class='column'>{$result[$m]['FREGNO']}</td>";
$e_data.="<td align='left' class='column'>{$result[$m]['FNAME']}</td>";
$e_data.="<td class='column'>
<input type='text' class='COTotal_{$k}' id='COTotal_{$k}' style='width:35px; text-align: center;' value='{$total}' disabled />
</td>";
$e_data.="<td class='column'>
<input type='checkbox' id='coabsent_{$k}' onchange='checkCOAbsent($k)'
style='width:35px;text-align: center;' $coc />
</td>";
$e_data.="<td class='column textbox'>
<input type='text' oninput='getTotalCO(`CO1`,$k)'
onkeypress='return isNumber(event)' onblur='checkValidCO(`CO1`,$k)'
class='CO1_{$k}' id='CO1_{$k}'
style='width:35px;text-align: center;'
value='{$fmarks11}' $co $a1disabled>
</td>";
$e_data.="<td class='column textbox'>
<input type='text' oninput='getTotalCO(`CO2`,$k)'
onkeypress='return isNumber(event)' onblur='checkValidCO(`CO2`,$k)'
class='CO2_{$k}' id='CO2_{$k}'
style='width:35px;text-align: center;'
value='{$fmarks12}' $co $b1disabled>
</td>";
$e_data.="<td class='column textbox'>
<input type='text' oninput='getTotalCO(`CO3`,$k)'
onkeypress='return isNumber(event)' onblur='checkValidCO(`CO3`,$k)'
class='CO3_{$k}' id='CO3_{$k}'
style='width:35px;text-align: center;'
value='{$fmarks13}' $co $c1disabled>
</td>";
$e_data.="<td class='column textbox'>
<input type='text' oninput='getTotalCO(`CO4`,$k)'
onkeypress='return isNumber(event)' onblur='checkValidCO(`CO4`,$k)'
class='CO4_{$k}' id='CO4_{$k}'
style='width:35px;text-align: center;'
value='{$fmarks14}' $co $d1disabled>
</td>";
$e_data.="<td class='column textbox'>
<input type='text' oninput='getTotalCO(`CO5`,$k)'
onkeypress='return isNumber(event)' onblur='checkValidCO(`CO5`,$k)'
class='CO5_{$k}' id='CO5_{$k}'
style='width:35px;text-align: center;'
value='{$fmarks15}' $co $e1disabled>
</td>";
$e_data.="<td class='column textbox'>
<input type='text' oninput='getTotalCO(`CO6`,$k)'
onkeypress='return isNumber(event)' onblur='checkValidCO(`CO6`,$k)'
class='CO6_{$k}' id='CO6_{$k}'
style='width:35px;text-align: center;'
value='{$fmarks16}' $co $f1disabled>
</td>";
$e_data.="</tr>";
$k++;
}
$e_data.="</tbody>";
}
$arr['html'] = $e_data;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
}
function saveIAEntryQuestionwise($aobj_context){
session_start();
include("error_log.php");
$collcode=$_SESSION['collcode'];
$User_code = $_SESSION['usr'];
$techcode = $aobj_context->mobj_data["techcode"];
$classid = $aobj_context->mobj_data["classid"];
$subject = $aobj_context->mobj_data["subelement"];
$testName = $aobj_context->mobj_data["testName"];
$remarks = $aobj_context->mobj_data["remarks"];
$subarry = json_decode($aobj_context->mobj_data["subarry"], true);
$split = explode("*", $subject);
$subcode = $split[0];
$subject = $split[1];
if($_SESSION['usrtype'] == '17'){
$cond = "ifnull(fiateachfreez, '')as";
$user = "Teacher";
}else if($_SESSION['usrtype'] == '14'){
$cond = "ifnull(fiapricfreez, '')as";
$user = "Principal";
}
$queryFreez = "select {$cond} fiateachfreez from classfreez
where fclassid='{$classid}' and fcollcode='{$collcode}' and fteachcode='{$techcode}' and
left(fsubcode, 4) = left('{$subcode}', 4)";
$resFreez = $aobj_context->mobj_db->GetRow($queryFreez);
if($resFreez['fiateachfreez'] === 'T'){
$rdata = "{$user} entry freezed for this class";
echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"failue"));
return $rdata;
}
if(strtolower($subject) === 'cie'){
foreach($subarry as $value){
$qrySelect = "select * from marksint where fregno='{$value['fregno']}'
and fsubcode='{$subcode}' and ftest='{$testName}'";
$upd = $aobj_context->mobj_db->GetRow($qrySelect);
if($value['absent'] == 'T'){
$fmarks1A = '-2';
$fmarks1B = '-2';
$fmarks1C = '-2';
$fmarks1D = '-2';
$fmarks2A = '-2';
$fmarks2B = '-2';
$fmarks2C = '-2';
$fmarks2D = '-2';
$fmarks3A = '-2';
$fmarks3B = '-2';
$fmarks3C = '-2';
$fmarks3D = '-2';
$fmarks4A = '-2';
$fmarks4B = '-2';
$fmarks4C = '-2';
$fmarks4D = '-2';
$total1 = '-2';
$total2 = '-2';
$total3 = '-2';
$total4 = '-2';
$total = '-2';
$acttot = '-2';
}else{
$fmarks1A = "{$value['marks1A']}";
$fmarks1B = "{$value['marks1B']}";
$fmarks1C = "{$value['marks1C']}";
$fmarks1D = "{$value['marks1D']}";
$fmarks2A = "{$value['marks2A']}";
$fmarks2B = "{$value['marks2B']}";
$fmarks2C = "{$value['marks2C']}";
$fmarks2D = "{$value['marks2D']}";
$fmarks3A = "{$value['marks3A']}";
$fmarks3B = "{$value['marks3B']}";
$fmarks3C = "{$value['marks3C']}";
$fmarks3D = "{$value['marks3D']}";
$fmarks4A = "{$value['marks4A']}";
$fmarks4B = "{$value['marks4B']}";
$fmarks4C = "{$value['marks4C']}";
$fmarks4D = "{$value['marks4D']}";
$total1 = "{$value['total1']}";
$total2 = "{$value['total2']}";
$total3 = "{$value['total3']}";
$total4 = "{$value['total4']}";
$acttot = "{$value['acttot']}";
$total = $value['total'];
}
if(count($upd) > 0){
$queryUpd = "update marksint set
FMARKS11='$fmarks1A', FMARKS12='$fmarks1B', FMARKS13='$fmarks1C', FMARKS14='$fmarks1D', FTOTAL1='{$total1}',
FMARKS21='$fmarks2A', FMARKS22='$fmarks2B', FMARKS23='$fmarks2C', FMARKS24='$fmarks2D', FTOTAL2='{$total2}',
FMARKS31='$fmarks3A', FMARKS32='$fmarks3B', FMARKS33='$fmarks3C', FMARKS34='$fmarks3D', FTOTAL3='{$total3}',
FMARKS41='$fmarks4A', FMARKS42='$fmarks4B', FMARKS43='$fmarks4C', FMARKS44='$fmarks4D', FTOTAL4='{$total4}',
FTOTAL='{$total}', FACTTOTAL='{$acttot}', FCREATEUSER='{$User_code}', FCREATEDATE=now(), FREMARKS='{$remarks}'
where fregno = '{$value['fregno']}'
and fsubcode = '{$subcode}' and ftest='{$testName}'
and fcollcode = '{$collcode}'";
}else{
$select = "select fdegree, fexamno from attendsum where fregno='{$value['fregno']}'
and fclassid='{$classid}'";
$res = $aobj_context->mobj_db->GetRow($select);
$queryUpd = "insert into marksint(FREGNO, fexamno, fsubcode, fdegree, fcollcode, ftest,
fmarks11, fmarks12, fmarks13, fmarks14, ftotal1,
fmarks21, fmarks22, fmarks23, fmarks24, ftotal2,
fmarks31, fmarks32, fmarks33, fmarks34, ftotal3,
fmarks41, fmarks42, fmarks43, fmarks44, ftotal4,
ftotal, facttotal, FCREATEDATE, FCREATEUSER, FREMARKS)
values('{$value['fregno']}', '{$res['fexamno']}', '{$subcode}', '{$res['fdegree']}', '{$collcode}', '{$testName}',
'$fmarks1A', '$fmarks1B', '$fmarks1C', '$fmarks1D', '{$total1}',
'$fmarks2A', '$fmarks2B', '$fmarks2C', '$fmarks2D', '{$total2}',
'$fmarks3A', '$fmarks3B', '$fmarks3C', '$fmarks3D', '{$total3}',
'$fmarks4A', '$fmarks4B', '$fmarks4C', '$fmarks4D', '{$total4}',
'{$total}', '{$acttot}', now(), '{$User_code}', '{$remarks}')";
}
$upd = $aobj_context->mobj_db->Execute($queryUpd);
}
}else{
// var_dump($subarry);die();
foreach($subarry as $value){
$qrySelect = "select * from marksint where fregno='{$value['fregno']}'
and fsubcode='{$subcode}' and ftest='{$testName}'";
$upd = $aobj_context->mobj_db->GetRow($qrySelect);
if($value['absent'] == 'T'){
$fmarks1A = '-2';
$fmarks1B = '-2';
$fmarks1C = '-2';
$fmarks1D = '-2';
$fmarks1E = '-2';
$fmarks1F = '-2';
$total = '-2';
}else{
$fmarks1A = "{$value['marks1A']}";
$fmarks1B = "{$value['marks1B']}";
$fmarks1C = "{$value['marks1C']}";
$fmarks1D = "{$value['marks1D']}";
$fmarks1E = "{$value['marks1E']}";
$fmarks1F = "{$value['marks1F']}";
$total = $value['total'];
}
if(count($upd) > 0){
$queryUpd = "update marksint set
FMARKS11='$fmarks1A', FMARKS12='$fmarks1B', FMARKS13='$fmarks1C',
FMARKS14='$fmarks1D', FMARKS15='$fmarks1E', FMARKS16='$fmarks1F',
FTOTAL='{$total}', facttotal='{$total}', FCREATEUSER='{$User_code}', FCREATEDATE=now(), FREMARKS='{$remarks}'
where fregno = '{$value['fregno']}'
and fsubcode = '{$subcode}' and ftest='{$testName}'
and fcollcode = '{$collcode}'";
}else{
$select = "select fdegree, fexamno from attendsum where fregno='{$value['fregno']}'
and fclassid='{$classid}'";
$res = $aobj_context->mobj_db->GetRow($select);
$queryUpd = "insert into marksint(FREGNO, fexamno, fsubcode, fdegree, fcollcode, ftest,
fmarks11, fmarks12, fmarks13, fmarks14, fmarks15, fmarks16,
ftotal, facttotal, FCREATEDATE, FCREATEUSER, FREMARKS)
values('{$value['fregno']}', '{$res['fexamno']}', '{$subcode}', '{$res['fdegree']}', '{$collcode}', '{$testName}',
'$fmarks1A', '$fmarks1B', '$fmarks1C', '$fmarks1D', '$fmarks1E', '$fmarks1F',
'{$total}', '{$total}', now(), '{$User_code}', '{$remarks}')";
}
$upd = $aobj_context->mobj_db->Execute($queryUpd);
}
}
if($upd){
$rdata = "Updated Successfully.";
echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
} else {
$rdata = "No Updation / Add..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
return $rdata;
}
}
function saveMarksDetailsEntry($aobj_context){
$collcode=$_SESSION['collcode'];
$user = $_SESSION['usr'];
$classid = $aobj_context->mobj_data["classId"];
$testName = $aobj_context->mobj_data["testName"];
$subelement = $aobj_context->mobj_data["subelement"];
$data = json_decode($aobj_context->mobj_data["data"], true);
// var_dump($data);die();
foreach($data as $val){
$query = "INSERT INTO maxmarksint (FCLASSID, FTESTNAME, FSUBCODE, FQNNO, FMARKS, FCO, FCUSR, FCDATE, FDELETED)
VALUES('{$classid}', '{$testName}', '{$subelement}', '{$val['qnno']}', '{$val['marks']}',
'{$val['co']}', '{$user}', now(), 'F')
on duplicate key update
FMARKS='{$val['marks']}', FCO='{$val['co']}', FCUSR='{$user}', FCDATE=now(), FDELETED='F'";
$res = $aobj_context->mobj_db->Execute($query);
}
if($res){
$msg = "Updated Successfully.";
echo($aobj_context->mobj_output->ToJSONEnvelope($msg,0,"success"));
return $msg;
} else {
$msg = "No Updation / Add..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($msg,-1,"Failure"));
return $msg;
}
}
function editQnMarksDetails($aobj_context){
$testName = $aobj_context->mobj_data["testName"];
$classid = $aobj_context->mobj_data["classid"];
$subject = $aobj_context->mobj_data["subject"];
$split = explode("*", $subject);
$subelement = $split[0];
$queryView = "select FCLASSID, FTESTNAME, FQNNO,
ifnull(FMARKS, '') as FMARKS, ifnull(FCO, '')as FCO, ifnull(FPO, '')as FPO,
ifnull(FPSO, '')as FPSO
from maxmarksint
where fclassid='{$classid}' and ftestname='{$testName}'
and fsubcode='{$subelement}'";
$resMarks = $aobj_context->mobj_db->GetAll($queryView);
if(count($resMarks) == 0){
$arr['msg'] = "Marks details not entered";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return;
}else{
echo($aobj_context->mobj_output->ToJSONEnvelope($resMarks, 0, "Success"));
return;
}
}
function saveActMarksEntry($aobj_context){
$collcode=$_SESSION['collcode'];
$user = $_SESSION['usr'];
$classid = $aobj_context->mobj_data["classId"];
$testName = $aobj_context->mobj_data["testName"];
$subelement = $aobj_context->mobj_data["subelement"];
$data = json_decode($aobj_context->mobj_data["data"], true);
$split = explode("*", $subelement);
$subcode = $split[0];
foreach($data as $val){
$query = "INSERT INTO maxmarksint (FCLASSID, FTESTNAME, FSUBCODE, FQNNO, FMARKS, FCUSR, FCDATE, FDELETED)
VALUES('{$classid}', '{$testName}', '{$subcode}', '{$val['qnno']}', '{$val['marks']}',
'{$user}', now(), 'F')
on duplicate key update
FMARKS='{$val['marks']}', FCUSR='{$user}', FCDATE=now(), FDELETED='F'";
$res = $aobj_context->mobj_db->Execute($query);
}
if($res){
$msg = "Updated Successfully.";
echo($aobj_context->mobj_output->ToJSONEnvelope($msg,0,"success"));
return $msg;
} else {
$msg = "No Updation / Add..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($msg,-1,"Failure"));
return $msg;
}
}
function viewCOMarksData($aobj_context){
$classid = $aobj_context->mobj_data["classid"];
$subcode = $aobj_context->mobj_data["subcode"];
$testname = $aobj_context->mobj_data["testName"];
$query = "select ifnull(FMARKS, '')as FMARKS, ifnull(FCO, '')as FCO,
ifnull(FQNNO, '')as FQNNO from maxmarksint where
fclassid='{$classid}' and ftestname='{$testname}'
and fsubcode='{$subcode}'";
$res = $aobj_context->mobj_db->GetAll($query);
if($res){
echo($aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"));
return $msg;
} else {
$msg = "No data found";
echo($aobj_context->mobj_output->ToJSONEnvelope($msg,-1,"Failure"));
return $msg;
}
}
?>
|