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.191.118.36
Current Path : /var/www/oasis/src_old/ |
| Current File : /var/www/oasis/src_old/bundledispatchdatewise.php |
<?php
/*error_reporting(E_ALL);
ini_set('display_errors','on');*/
class room_allotment
{
function __construct($aobj_context)
{
session_start();
$this->aobj_context=$aobj_context;
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->user_id = $_SESSION['user_id'];
$this->funivcode = $_SESSION['FUNIVCODE'];
$this->collcode = $_SESSION['collcode'];
$this->log_name = $_SESSION['usr'];
}
function DisplayBundalDetailsDatewise()
{
session_start();
$this->collcode = $_SESSION['collcode'];
$edate = ($this->aobj_context->mobj_data["edate"]);
$session = ($this->aobj_context->mobj_data["session"]);
if($this->collcode == '')
{
$data="Please login and try again";
echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
$this->collcode = $this->collcode;
$qyer = "delete from colldesp where fcollcode = '{$this->collcode}' and fdoe = date_format(STR_TO_DATE('{$edate}', '%d/%m/%Y'),'%Y-%m-%d')";
$lobj_insert = $this->aobj_context->mobj_db->Execute($qyer);
$query = "select b.fpresent,b.fqpcode,b.fsubname,ifnull(a.abcnt,0) as abcnt,ifnull(a.MPcnt,0) as MPcnt,
(b.fpresent-(ifnull(a.abcnt,0)+ifnull(a.MPcnt,0))) as buncnt,b.fbundscript from (
select count(distinct cd.fregno) as fpresent,fqpcode,fsubname,'{$this->collcode}' as fcollcode,fbundscript
from control cl, canddet cd
inner join subject s
on cd.fdegree = s.fdegree and cd.fexamno = s.fexamno and cd.fsubcode = s.fsubcode
and ifnull(s.fqpcode,'') <> ''
inner join candsum cs on cd.fcollcode = cs.fcollcode and cd.fdegree = cs.fdegree
and cd.fregno = cs.fregno
where fpresent = 'P' and cs.fcntrcode = '{$this->collcode}'
and ifnull(frecptdate,'0000-00-00') <> '0000-00-00'
and s.fdoe = date_format(STR_TO_DATE('{$edate}', '%d/%m/%Y'),'%Y-%m-%d')
and s.fsession like '{$session}%'
group by fqpcode
order by fqpcode) b
left join
(select ifnull(sum(if(fabstype = 'QpA',1,0)),0) as abcnt,
ifnull(sum(if(fabstype = 'QpM',1,0)),0) as MPcnt,fcollcode,FQPCODE from absent
where fcollcode = '{$this->collcode}'
and fdoe = date_format(STR_TO_DATE('{$edate}', '%d/%m/%Y'),'%Y-%m-%d')
group by fqpcode) a
on a.fqpcode = b.fqpcode and a.fcollcode = b.fcollcode";
$results = $this->aobj_context->mobj_db->GetAll($query);
$str_reval.="<br>";
$str_reval.="<table style='padding:' class='tr_ventor_row' id='reval_table_data' width='95%' name = 'HALL' border='0' cellspacing='0' cellpadding='0'>";
$str_reval.="<tr class='tr_bg1'>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl. No.</td>";
$str_reval.="<td align='center' style='width:40%;font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Subject Name</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>QP Code</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Total Present</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Total Absent</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Total Malpractice</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>No. of Scripts</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Bundle No.</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Scripts in Bundle</td>";
$str_reval.="<td align='center' style='width:8%; font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Actions</td>";
$str_reval.="</tr>";
if($session == 'M')
$am = 'AM';
if($session == 'N')
$am = 'PM';
$i=1;
foreach($results as $value)
{
$fqpcode = $value['fqpcode'];
$fsubanme = $value['fsubname'];
$fpresent = $value['fpresent'];
$abcnt = $value['abcnt'];
$MPcnt = $value['MPcnt'];
$qpcnt = $value['buncnt'];
$qpcnt1 = $value['buncnt'];
$fbundscript = $value['fbundscript'];
do{
//$qpcnt = $qpcnt - $fbundscript;
$cnt = 0;
if($qpcnt > $fbundscript)
{
$qpcnt = $qpcnt - $fbundscript;
$cnt = $fbundscript;
}else
{
$cnt = $qpcnt;
$qpcnt = 0;
}
$query = "insert into colldesp(FCOLLCODE,FDOE,FSESSION,FQPCODE,FTOTSCRIPT)
values('{$this->collcode}',date_format(STR_TO_DATE('{$edate}', '%d/%m/%Y'),'%Y-%m-%d'),'{$am}',
'{$fqpcode}','{$cnt}')";
$lobj_insert = $this->aobj_context->mobj_db->Execute($query);
$id = $this->aobj_context->mobj_db->Insert_ID();
$str_reval.="<tr>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$i</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border :1px solid #C5DBEC; padding:5px;' >$fsubanme</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$fqpcode</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$fpresent</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$abcnt</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$MPcnt</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$qpcnt1</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$id</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >$cnt</td>";
$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border :1px solid #C5DBEC; padding:5px;' >
<span
style='margin-top: 2px;float:left;margin-left:0px;cursor: pointer; color:#35721F;line-height: 19px;font-size:14px;font-weight:bold;'
onclick='generateBundleNosDispatchQPWise(\"{$id}\");''
>Print</span
></td>";
$str_reval.="</tr>";
$i++;
}while($qpcnt >0);
}
$str_reval.="</table>";
$arr['html']=$str_reval;
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
function SaveRoomAllotmentDatewise()
{
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);
include_once($this->aobj_context->main_src."/src/json.php");
$json = new Services_JSON();
$hall_arr = stripslashes($this->aobj_context->mobj_data["hall_arr"]);
//$faculty = ($this->aobj_context->mobj_data["faculty"]);
$mobj_jsondata = $json->decode($hall_arr);
$hall_arr = get_object_vars($mobj_jsondata);
//var_dump($hall_arr);
$i = 0;
$oldqp = '';
$newqp = '';
$j = 0;
$mpcnd = "and ifnull(ab.fabstype,'') <> 'QpM'";
if($this->funivcode == '027')
$mpcnd = "";
for($k=1;$k<=count($hall_arr);$k++)
{
$newqp = $hall_arr[$k]->qpcode;
if($newqp != $oldqp)
{
$i = 0;
$query1 = "SET SESSION group_concat_max_len=100000";
$results1 = $this->aobj_context->mobj_db->Execute($query1);
$query1 = "SET SESSION group_concat_max_len=10000000";
$results = $this->aobj_context->mobj_db->Execute($query1);
$query = "SELECT s.fqpcode, group_concat(distinct concat(\"'\",concat(cd.fdegree,cd.fsubcode,cd.FREGNO),\"'\") order by cd.fdegree,
cd.fsubcode, cd.fregno) as fregno,cd.FEXAMNO,cd.FDEGREE,cd.FSUBCODE
FROM canddet cd INNER JOIN subject s ON s.fdegree = cd.fdegree
AND s.fexamno = cd.fexamno AND s.FSUBCODE=cd.FSUBCODE
INNER JOIN candsum cs ON cs.fdegree = cd.fdegree and cs.FCOLLCODE = cd.FCOLLCODE and cs.FREGNO=cd.FREGNO
inner join degree dd on dd.fdegree=cd.fdegree and dd.fexamno=cd.fexamno
WHERE cs.FCNTRCODE='{$this->collcode}' AND TRIM(s.FQPCODE)='{$hall_arr[$k]->qpcode}'
AND FPRESENT='P' AND IFNULL(cd.fpassmth,'') = ''
AND IFNULL(cs.FRECPTDATE,'0000-00-00')<>'0000-00-00'
group by s.fqpcode";
$results = $this->aobj_context->mobj_db->GetRow($query);
}
if($hall_arr[$j]->remaing > 0)
{
$hall_arr[$k]->capacity = $hall_arr[$j]->remaing;
}
$insert = " insert into room_allotment(FCOLLCODE,FQPCODE,FHALLNO,FCAPACITY,FLOGNAME,FLOGDATE,FDOE,FSESSION,FORDER)
values ('{$this->collcode}','{$hall_arr[$k]->qpcode}' ,'{$hall_arr[$k]->hallno}','{$hall_arr[$k]->alloted}',
'{$this->log_name}',now(),'{$hall_arr[$k]->fdoe}','{$hall_arr[$k]->sestion}','{$k}')
ON DUPLICATE KEY UPDATE
FCOLLCODE = '{$this->collcode}',
FQPCODE = '{$hall_arr[$k]->qpcode}',
FHALLNO = '{$hall_arr[$k]->hallno}',
FCAPACITY = '{$hall_arr[$k]->alloted}',
FLOGNAME = '{$this->log_name}',
FLOGDATE = now(),
FDOE = '{$hall_arr[$k]->fdoe}',
FSESSION = '{$hall_arr[$k]->sestion}',
FORDER = '{$k}'";
$lobj_insert = $this->aobj_context->mobj_db->Execute($insert);
//var_dump($insert);
$fregno = explode(',',$results['fregno']);
//var_dump($fregno);
$FSUBCODE = $results['FSUBCODE'];
$regnoin = array_slice($fregno,$i,$hall_arr[$k]->capacity);
$regnoin = implode(',',$regnoin);
//var_dump($regnoin);
$update = "update canddet,candsum
set canddet.FHALLNO='{$hall_arr[$k]->hallno}'
where canddet.FDEGREE = candsum.FDEGREE
and canddet.FCOLLCODE = candsum.FCOLLCODE
and canddet.FREGNO = candsum.FREGNO
and candsum.FCNTRCODE='{$this->collcode}'
and concat(canddet.fdegree,canddet.fsubcode,canddet.FREGNO) in({$regnoin})";
$lobj_update = $this->aobj_context->mobj_db->Execute($update);
//var_dump($update);
$i = $i+$hall_arr[$k]->capacity;
$oldqp = $hall_arr[$k]->qpcode;
$j++;
}
if($lobj_update)
{
$data="Update Successfully.";
echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
}
else
{
$data="Failed";
echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
}
function DisplayBundalDetailsDatewise($aobj_context)
{
$class_obj=new room_allotment($aobj_context);
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj->DisplayBundalDetailsDatewise();
}
function SaveRoomAllotmentDatewise($aobj_context)
{
$class_obj=new room_allotment($aobj_context);
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj->SaveRoomAllotmentDatewise();
}
function getRoomdetails($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$query = "select froomno as id, froomname as value from masroom
where ifnull(fdeleted,'') <>'T' and fcollcode = '{$collcode}' order by ifnull(forder,0), froomno ";
//var_dump($query);die();
$rst = $aobj_context->mobj_db->getAll($query); //forder,
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}
?>
|