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.143.241.205
<?php
class batch_wise_details
{
public $aobj_context;
public $college_name;
public $town;
public $address;
public $Degree_name;
function __construct($aobj_context)
{
require_once($aobj_context->main_src.'src/format.php');
$this->aobj_context=$aobj_context;
$this->collcode=$_SESSION['collcode'];
}
function GetBatchWiseRegNos()
{
$College_Code = $_SESSION['collcode'];
$range = $this->aobj_context->mobj_data["range"];
$type = $this->aobj_context->mobj_data["type"];
$limit = $this->aobj_context->mobj_data["limit"];
$Subcode = $this->aobj_context->mobj_data["Subcode"];
$Degcode = $this->aobj_context->mobj_data["Degcode"];
$Examno = $this->aobj_context->mobj_data["Examno"];
$batch_nos = $this->aobj_context->mobj_data["batch_nos"];
$valuataion = $this->aobj_context->mobj_data["valuataion"];
$condition_name = trim($this->aobj_context->mobj_data["condition_name"]);
$condition_val = stripcslashes($this->aobj_context->mobj_data["condition_val"]);
$mycondition = ($condition_name=='like')?$condition_name." '%{$condition_val}%' ":$condition_name.$condition_val;
$path = $this->aobj_context->main_src.'/'.$_REQUEST['db'].'/imported_files/';
// var_dump($path);
// var_dump($_REQUEST['db']);
$path_name = "imported_files/bat_{$College_Code}_{$_SESSION['user_id']}.html";
$filename = "{$path}bat_{$College_Code}_{$_SESSION['user_id']}.html";
unlink($filename);
$fp = fopen($filename, 'w+');
$e_data.="<table width='80%' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
$e_data.="<th align='left' colspan='4' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Marks List</th>";
$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
$e_data.="<td style='padding:0px; width:1px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Sl.No.</center></td>";
$e_data.="<td style='padding:2px; width:60px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Reg No</center></td>";
$e_data.="<td style='padding:2px; width:140px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Student Name</center></td>";
$e_data.="<td style='padding:2px; width:20px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Batch</center></td>";
$e_data.="</tr>";
$query = "select FPRACTIVE from control";
$resuts = $this->aobj_context->mobj_db->GetRow($query);
$fpractive = $resuts['FPRACTIVE'];
if($fpractive == 'T')
{
$get_records = "select stu.FREGNO, stu.FNAME,
IFNULL(mak.FMARKS11, -1) as FMARKS,
IFNULL(lpad(mak.FBATCH,2,'0'), '') AS FBATCH
FROM student stu inner join marks_pr mak ON stu.fdegree=mak.fdegree and stu.FREGNO=mak.FREGNO
and mak.fdegree='{$Degcode}' and mak.Fexamno='{$Examno}' and mak.FCOLLCODE='{$College_Code}'
inner join subject sub on sub.fdegree = mak.fdegree and sub.fexamno = mak.fexamno and sub.FCSUBCODE = mak.FSUBCODE
and sub.FDEGREE = '{$Degcode}' and sub.FEXAMNO = '{$Examno}' and sub.FCSUBCODE = '{$Subcode}'
inner join canddet cd on cd.fdegree = sub.fdegree and cd.fexamno = sub.fexamno and cd.fsubcode = sub.fsubcode
and cd.fdegree = mak.fdegree and cd.fexamno = mak.fexamno and cd.fregno = mak.fregno and cd.fpresent = 'P'
inner join candsum cs on cd.fdegree = cs.fdegree and cd.fregno = cs.fregno and ifnull(cs.frecptdate,'') <> '' and ifnull(cs.ftotalfee,0) > 0
WHERE stu.FREGNO != '' and stu.FREGNO {$mycondition}
group by stu.FREGNO order by stu.FREGNO ";
}
else
{
$get_records = "select stu.FREGNO, stu.FNAME,
IFNULL(mak.FMARKS11, -1) as FMARKS,
IFNULL(lpad(mak.FBATCH,2,'0'), '') AS FBATCH
FROM student stu inner join marks_pr mak ON stu.fdegree=mak.fdegree
and stu.FREGNO=mak.FREGNO
and mak.fdegree='{$Degcode}' and mak.Fexamno='{$Examno}' and mak.FCOLLCODE='{$College_Code}'
inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE
and sub.FCSUBCODE='{$Subcode}' and sub.FDEGREE='{$Degcode}' and sub.FEXAMNO='{$Examno}'
WHERE stu.FREGNO != '' and stu.FREGNO {$mycondition}
group by stu.FREGNO order by stu.FREGNO ";
}
//var_dump($get_records);
$lobj_get_records = $this->aobj_context->mobj_db->GetAll($get_records);
$total_student_count = count($lobj_get_records);
//echo $get_records;
$lquery = "SELECT SUM(CASE WHEN IFNULL(Fbatch,'') != '' THEN 1 ELSE 0 END) AS fbatchstud
FROM marks_pr WHERE fcollcode = '{$College_Code}' AND fdegree = '{$Degcode}' AND fexamno = '{$Examno}' AND fsubcode = '{$Subcode}'";
$result = $this->aobj_context->mobj_db->GetRow($lquery);
$batchno = $result['fbatchstud'];
//var_dump($batchno);
$k=1;
$i = 0;
$border_bottom="";
$FBATCH = '00';
$FBATCHSL = '01';
foreach($lobj_get_records as $key=>$value)
{
if($k==count($lobj_get_records))
$border_bottom="border-bottom:1px solid #C5DBEC;";
$FBBATCH = $value['FBATCH'];
$FMARKS = $value['FMARKS'];
if($FBBATCH=="00" || $FBBATCH == "")
{
//var_dump($batchno);
if($batchno == "0" && $batch_nos != "")
{
if($i%$batch_nos == 0)
{
$batch = ++$FBATCH;
$FBATCH = str_pad($batch,2, "0", STR_PAD_LEFT);
$i = 0;
}
}else if($batch_nos == "" )
{
$FBATCH = '';
}
else
{
$FBATCH = '';
}
}
else
{
$FBATCH = $FBBATCH;
}
//var_dump($FBATCH);
$disabled = "";
if($FMARKS != '-1')
$disabled = "disabled";
$e_data.="<tr class='jqgrow'>";
$e_data.="<td tabindex=-1 align='center' style='cursor:pointer;width:1px;{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:0px;'> {$k} </td>";
$e_data.="<td tabindex=-1 align='center' onclick=\"AssignBatchNo('{$value[FREGNO]}')\" style='cursor:pointer;{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'> {$value[FREGNO]} </td>";
$e_data.="<td tabindex=-1 onclick=\"AssignBatchNo('{$value[FREGNO]}')\" align='left' style='cursor:pointer;{$border_bottom};border-right:1px solid #C5DBEC; padding:2px;' id='mes_std_name_{$value[FREGNO]}' > {$value[FNAME]} </td>";
$e_data.="<td tabindex=-1 align='center' style='{$border_bottom};border-right:1px solid #C5DBEC; padding:2px;'> <input {$inp_class} name=marks type=text style='width:30px;{$border}' {$read_only} id='mes_marks_{$value[FREGNO]}' onkeypress='return acceptNumbersOnlyForModule(event);' maxlength=3 onfocusin='changeBackgroundcolortd(this.id)' onfocus='if(!empty(this.value)) \$g_entered_batch=this.value;' onblur='if(!empty(this.value)) this.value=LPad(this.value,2,0); if(!empty(this.value)) \$g_entered_batch=this.value; CheckBatchmaxNo(this);CalculateBatchDetails();' {$disabled} value='{$FBATCH}' > </td>";
$e_data.="</tr>";
$k++;
$i++;
}
if(empty($lobj_get_records))
{
$e_data.="<tr style='height: 20'>";
$e_data.="<td COLSPAN=4 align = 'center'>No Records Found For this Search</td>";
$e_data.="</tr>";
}
$e_data.="</table><br>";
fwrite($fp, $e_data);
$arr['filenme']=$path_name;
$arr['table_data']=$lobj_get_records;
fclose($fp);
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
function SaveBatchWiseDetails()
{
session_start();
include_once($this->aobj_context."/src/JSON.php");
$json = new Services_JSON();
$College_Code = $_SESSION['collcode'];
$VivaSubcode = $this->aobj_context->mobj_data["VivaSubcode"];
$Subcode = $this->aobj_context->mobj_data["Subcode"];
$Degcode = $this->aobj_context->mobj_data["Degcode"];
$Examno = $this->aobj_context->mobj_data["Examno"];
$batch_nos = $this->aobj_context->mobj_data["batch_nos"];
$User_code = $_SESSION['usr'];
$lstr_param = stripslashes($this->aobj_context->mobj_data["output_details"]);
$mobj_jsondata = $json->decode($lstr_param);
$Markentry_details = get_object_vars($mobj_jsondata);
$total_marks_entry = count($Markentry_details);
for( $i = 0; $i<$total_marks_entry; $i++ )
{
if(!empty($VivaSubcode))
{
$update_record = " update marks_pr set FBATCH='{$Markentry_details[$i]->batch_no}'
where FCOLLCODE = '{$College_Code}' and
FDEGREE = '{$Degcode}' and
FEXAMNO = '{$Examno}' and
FREGNO = '{$Markentry_details[$i]->reg_no}' and
FSUBCODE = '{$VivaSubcode}' ";
$lobj_insert_qry = $this->aobj_context->mobj_db->Execute($update_record);
}
$update_record = " update marks_pr set FBATCH='{$Markentry_details[$i]->batch_no}'
where FCOLLCODE = '{$College_Code}' and
FDEGREE = '{$Degcode}' and
FEXAMNO = '{$Examno}' and
FREGNO = '{$Markentry_details[$i]->reg_no}' and
FSUBCODE = '{$Subcode}' ";
//echo $delete_record;
$lobj_insert_qry = $this->aobj_context->mobj_db->Execute($update_record);
}
if($lobj_insert_qry)
{
$rdata = "Inserted Successfully.";
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata = "No Updation / Add..!";
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
return $rdata;
}
}
function Getstudentcount()
{
$College_Code = $_SESSION['collcode'];
$range = $this->aobj_context->mobj_data["range"];
$type = $this->aobj_context->mobj_data["type"];
$limit = $this->aobj_context->mobj_data["limit"];
$Subcode = $this->aobj_context->mobj_data["Subcode"];
$Degcode = $this->aobj_context->mobj_data["Degcode"];
$Examno = $this->aobj_context->mobj_data["Examno"];
$batch_nos = $this->aobj_context->mobj_data["batch_nos"];
$valuataion = $this->aobj_context->mobj_data["valuataion"];
$condition_name = trim($this->aobj_context->mobj_data["condition_name"]);
$condition_val = stripcslashes($this->aobj_context->mobj_data["condition_val"]);
$mycondition = ($condition_name=='like')?$condition_name." '%{$condition_val}%' ":$condition_name.$condition_val;
$path = $this->aobj_context->main_src.'/'.$_REQUEST['db'].'/imported_files/';
$path_name = "imported_files/bat_{$College_Code}_{$_SESSION['user_id']}.html";
$filename = "{$path}bat_{$College_Code}_{$_SESSION['user_id']}.html";
$query = "select FPRACTIVE from control";
$resuts = $this->aobj_context->mobj_db->GetRow($query);
$fpractive = $resuts['FPRACTIVE'];
$lquery = "SELECT SUM(CASE WHEN IFNULL(Fbatch,'') != '' THEN 1 ELSE 0 END) AS fbatchstud
FROM marks_pr WHERE fcollcode = '{$College_Code}' AND fdegree = '{$Degcode}' AND fexamno = '{$Examno}' AND fsubcode = '{$Subcode}'";
$result = $this->aobj_context->mobj_db->GetRow($lquery);
$batchno = $result['fbatchstud'];
if($fpractive == 'T')
{
$get_records = "select stu.FREGNO, stu.FNAME,
IFNULL(mak.FMARKS11, -1) as FMARKS,
IFNULL(lpad(mak.FBATCH,2,'0'), '') AS FBATCH
FROM student stu inner join marks_pr mak ON stu.fdegree=mak.fdegree and stu.FREGNO=mak.FREGNO
and mak.fdegree='{$Degcode}' and mak.Fexamno='{$Examno}' and mak.FCOLLCODE='{$College_Code}'
inner join subject sub on sub.fdegree = mak.fdegree and sub.fexamno = mak.fexamno and sub.FCSUBCODE = mak.FSUBCODE
and sub.FDEGREE = '{$Degcode}' and sub.FEXAMNO = '{$Examno}' and sub.FCSUBCODE = '{$Subcode}'
inner join canddet cd on cd.fdegree = sub.fdegree and cd.fexamno = sub.fexamno and cd.fsubcode = sub.fsubcode
and cd.fdegree = mak.fdegree and cd.fexamno = mak.fexamno and cd.fregno = mak.fregno and cd.fpresent = 'P'
inner join candsum cs on cd.fdegree = cs.fdegree and cd.fregno = cs.fregno and ifnull(cs.frecptdate,'') <> '' and ifnull(cs.ftotalfee,0) > 0
WHERE stu.FREGNO != '' and stu.FREGNO {$mycondition}
group by stu.FREGNO order by stu.FREGNO ";
}
else
{
$get_records = "select stu.FREGNO, stu.FNAME,
IFNULL(mak.FMARKS11, -1) as FMARKS,
IFNULL(lpad(mak.FBATCH,2,'0'), '') AS FBATCH
FROM student stu inner join marks_pr mak ON stu.fdegree=mak.fdegree
and stu.FREGNO=mak.FREGNO
and mak.fdegree='{$Degcode}' and mak.Fexamno='{$Examno}' and mak.FCOLLCODE='{$College_Code}'
inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE
and sub.FCSUBCODE='{$Subcode}' and sub.FDEGREE='{$Degcode}' and sub.FEXAMNO='{$Examno}'
WHERE stu.FREGNO != '' and stu.FREGNO {$mycondition}
group by stu.FREGNO order by stu.FREGNO ";
}
//var_dump($get_records);die();
$lobj_get_records = $this->aobj_context->mobj_db->GetAll($get_records);
$total_student_count = count($lobj_get_records);
$arr['count'] = $total_student_count;
$arr['batchno'] = $batchno;
if($total_student_count != '0' )
{
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else
{
$arr = 'No data found for given details';
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"success");
return;
}
}
}
function GetBatchWiseRegNos($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new batch_wise_details($aobj_context);
$class_obj->GetBatchWiseRegNos();
}
function SaveBatchWiseDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new batch_wise_details($aobj_context);
$class_obj->SaveBatchWiseDetails();
}
function Getstudentcount($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new batch_wise_details($aobj_context);
$class_obj->Getstudentcount();
}
?>
|