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.149.24.70
<?php
function getFeeParams($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select distinct fcombcode as `key`, fcombcode as `value`, fcombcode as `text`
from admfeestr where ifnull(fcombcode,'') <> ''";
$result = $aobj_context->pobj_db->GetAll($query);
$res['module'] = $result;
$query = "select distinct fconstype as `key`, fconstype as `value`, fconstype as `text`
from admfeestr where ifnull(fconstype,'') <> ''";
$result = $aobj_context->pobj_db->GetAll($query);
$res['feetype'] = $result;
if (!$result && gettype($result) == 'boolean') {
$arr['msg'] = "Error while fetching data";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
return;
}
if (count($result) > 0) {
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
return;
} else {
$arr['msg'] = 'No Data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getContTypes($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fcombcode = $aobj_context->mobj_data["fcombcode"];
$query = "select distinct fconstype as `key`, fconstype as `value`, fconstype as `text`
from admfeestr where ifnull(fconstype,'') <> '' and fcombcode = '{$fcombcode}'";
$result = $aobj_context->pobj_db->GetAll($query);
$res['feetype'] = $result;
if ($result) {
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
return;
} else {
$arr['msg'] = 'No Data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getFeeHeads($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select fmcombcode, ffeecode, fdescpn, ifnull(fshortname,'') as fshortname,
ifnull(fsequence, '') as fsequence,
if(ifnull(fdeleted,'') = 'T', 'true', 'false') as fdeleted,
if(ifnull(fdeleted,'') = 'T', 'false', 'true') as fdisabled
from masfee where ifnull(fdeleted,'') <> 'T' order by fmcombcode, fsequence";
$result = $aobj_context->pobj_db->GetAll($query);
if (!$result && gettype($result) == 'boolean') {
$arr['msg'] = "Error while fetching data";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
return;
}
if (count($result) > 0) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'No Data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getCategory($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select fcategory, fdescpn, if(ifnull(fdeleted,'') = 'T', 'true', 'false')
as fdeleted from category where ifnull(fdeleted,'') <> 'T'
order by fcategory";
$result = $aobj_context->pobj_db->GetAll($query);
if (!$result && gettype($result) == 'boolean') {
$arr['msg'] = "Error while fetching data";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
return;
}
if (count($result) > 0) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'No Data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function saveFeeHeads($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$data = $req['data'];
if (!array_key_exists('feeheads', $data)) {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
if (count($data['feeheads']) == 0) {
$arr['msg'] = 'Invalid Params data';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
$feeheads = $data['feeheads'];
$values = '';
foreach ($feeheads as $k => $v) {
$deleted = $v['fdeleted'] == 'true' ? 'T' : 'F';
$values .= "('" . $v['fmcombcode'] . "','" . $v['ffeecode'] . "', '" . $v['fdescpn'] . "', '" .
$v['fshortname'] . "', '" . $v['fsequence'] . "', '{$deleted}'),";
}
// var_dump($values);
$values = rtrim($values, ',');
$query = "insert into masfee(fmcombcode, ffeecode, fdescpn, fshortname,fsequence,fdeleted) values " . $values . "
ON DUPLICATE KEY UPDATE
fmcombcode = VALUES(fmcombcode),
fdescpn = VALUES(fdescpn), fshortname = VALUES(fshortname), fsequence = VALUES(fsequence),
fdeleted = VALUES(fdeleted)";
// var_dump($query);
$result = $aobj_context->pobj_db->Execute($query);
if ($result) {
$arr['msg'] = 'Successfully Updated';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
} else {
$arr['msg'] = 'Insertion / Updation Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function displayfeeDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$data = $req['feeStrForm'];
$degreeArr = $data['fdegree'];
$degree = implode("','", $degreeArr);
$examnoArr = $data['fexamno'];
$examno = implode("','", $examnoArr);
$categoryArr = $data['fcategory'];
$category = implode("','", $categoryArr);
$constype = $data['fconstype'];
$combcode = $data['fcombcode'];
$feeHeadCntQuery = "select count(*) as headCnt from masfee where length(ffeecode) > 2
and ifnull(fdeleted,'') <> 'T' and fcombcode = '{$combcode}'";
$feeHeadCntRes = $aobj_context->pobj_db->GetRow($feeHeadCntQuery);
$feeHeadCnt = $feeHeadCntRes['headCnt'];
$query = "select distinct mf.ffeecode, mf.fdescpn, ifnull(am.ffee,0) as ffee,
ifnull(am.fprfee,0) as fprfee, ifnull(am.fmaxfee,0) as fmaxfee,
ifnull(am.frepfee,0) as frepfee, ifnull(am.frepprfee,0) as frepprfee,
ifnull(am.fremaxfee,0) as fremaxfee,
ifnull(am.fvivafee,0) as fvivafee,
ifnull(am.fnoncorefee,0) as fnoncorefee,
ifnull(am.fdissertfee,0) as fdissertfee,
IFNULL(am.fregrange,'') AS fregrange,
IFNULL(am.fmodify,'F') AS fmodify
from masfee mf left outer join admfeestr am
on mf.ffeecode = am.fheadcode and am.fdegree in ('{$degree}')
and am.fexamno in ('{$examno}') and am.fcatcode in ('{$category}')
and am.fconstype = '{$constype}' and am.fcombcode = '{$combcode}'
where length(mf.ffeecode) > 2 and ifnull(am.fdeleted,'') <> 'T'
and ifnull(mf.fdeleted,'') <> 'T'
and mf.fmcombcode = '{$combcode}'
order by mf.fsequence";
// var_dump($query);
$results = $aobj_context->pobj_db->GetAll($query);
$feeRowsCnt = count($results);
$query1 = "select distinct mf.ffeecode, mf.fdescpn, ifnull(am.ffee,0) as ffee,
ifnull(am.fprfee,0) as fprfee, ifnull(am.fmaxfee,0) as fmaxfee,
ifnull(am.frepfee,0) as frepfee, ifnull(am.frepprfee,0) as frepprfee,
ifnull(am.fremaxfee,0) as fremaxfee,
ifnull(am.fvivafee,0) as fvivafee,
ifnull(am.fnoncorefee,0) as fnoncorefee,
ifnull(am.fdissertfee,0) as fdissertfee,
IFNULL(am.fregrange,'') AS fregrange,
IFNULL(am.fmodify,'F') AS fmodify
from masfee mf left outer join admfeestr am
on mf.ffeecode = am.fheadcode and am.fdegree in ('{$degree}')
and am.fexamno in ('{$examno}') and am.fcatcode in ('{$category}')
and am.fconstype = '{$constype}' and am.fcombcode = '{$combcode}'
where length(mf.ffeecode) > 2 and ifnull(am.fdeleted,'') <> 'T'
and ifnull(mf.fdeleted,'') <> 'T'
and mf.fmcombcode = '{$combcode}'
group by mf.ffeecode
order by mf.fsequence, am.fmaxfee desc";
$results1 = $aobj_context->pobj_db->GetAll($query1);
$arr['details'] = $results1;
$arr['feeRowsCnt'] = $feeRowsCnt;
$arr['feeHeadCntRes'] = $feeHeadCnt;
if ($feeRowsCnt == $feeHeadCnt) {
$arr['diff'] = 'F';
} else {
$arr['diff'] = 'T';
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
}
function savefeeInformation($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$data = $req['feeStrForm'];
$degreeArr = $data['fdegree'];
$degree = implode("','", $degreeArr);
$examnoArr = $data['fexamno'];
$examno = implode("','", $examnoArr);
$categoryArr = $data['fcategory'];
$category = implode("','", $categoryArr);
$constype = $data['fconstype'];
// $constype = implode("','", $data['fconstype']);
$combcode = $data['fcombcode'];
$fee_array = $req['feeDetl'];
foreach ($fee_array as $key => $value) {
$delete_query = "delete from admfeestr where fdegree in ('{$degree}')
and fexamno in ('{$examno}') and fcatcode in ('{$category}')
and fcombcode = '{$combcode}'
and fconstype in ('{$constype}') and fheadcode = '{$value['ffeecode']}'";
$result1 = $aobj_context->pobj_db->Execute($delete_query);
if ($result1) {
if($value['ffee'] > 0 || $value['fprfee'] > 0 || $value['fmaxfee'] > 0
|| $value['frepfee'] > 0 || $value['frepprfee'] > 0)
{
$insert_query = "insert into admfeestr (fdegree, fexamno,
fcombcode, fcatcode,
fheadcode, fconstype, ffee, fprfee, fmaxfee, frepfee, frepprfee, fremaxfee, fvivafee,
fnoncorefee, fdissertfee,fregrange,fmodify)
select dg.fdegree, dg.fexamno, '{$combcode}', ct.fcategory,
'{$value['ffeecode']}', '{$constype}', '{$value['ffee']}',
'{$value['fprfee']}', '{$value['fmaxfee']}', '{$value['frepfee']}',
'{$value['frepprfee']}','{$value['fremaxfee']}','{$value['fvivafee']}',
'{$value['fnoncorefee']}','{$value['fdissertfee']}','{$value['fregrange']}','{$value['fmodify']}'
from degree dg, category ct
where dg.fdegree in ('{$degree}') and
dg.fexamno in ('{$examno}')
and ct.FCATEGORY in ('{$category}')";
$result2 = $aobj_context->pobj_db->Execute($insert_query);
if (!$result2) {
break;
}
}
else {
continue;
}
} else {
break;
}
}
// die();
if ($result2 && $result1) {
$arr['msg'] = 'Fees updated successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
} else {
$arr['msg'] = 'Error While updating the fees';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "error");
}
}
function displayfeeDates($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$data = $req['feeStrForm'];
$degreeArr = $data['fdegree'];
$degree = implode("','", $degreeArr);
$examnoArr = $data['fexamno'];
$examno = implode("','", $examnoArr);
//$categoryArr = $data['fcategory'];
//$category = implode("','", $categoryArr);
// $constype = $data['fconstype'];
//$constype = implode( "','", $data['fconstype']);
$combcode = $data['fcombcode'];
// $query1 = "select distinct am.fheadcode, am.fmaxfee,
// date_format(ifnull(am.fadmfeesdate,now()),'%d/%m/%Y') as fromdate,
// date_format(ifnull(am.fadmfeeedate,now()),'%d/%m/%Y') as todate
// from admfeestr am
// where am.fdegree in ('{$degree}')
// and am.fexamno in ('{$examno}') and am.fcatcode in ('{$category}')
// and am.fconstype in ('{$constype}') and am.fcombcode = '{$combcode}'
// and ifnull(am.fdeleted,'') <> 'T'
// group by am.fheadcode
// order by am.fheadcode";
// // var_dump($query1);
// $results1 = $aobj_context->pobj_db->GetAll($query1);
$query1 = "select distinct am.fheadcode, am.fmaxfee,
date_format(ifnull(am.fadmfeesdate,now()),'%d/%m/%Y') as fromdate,
date_format(ifnull(am.fadmfeeedate,now()),'%d/%m/%Y') as todate
from admfeestr am
where am.fdegree in ('{$degree}')
and am.fexamno in ('{$examno}')
and am.fcombcode = '{$combcode}'
and ifnull(am.fdeleted,'') <> 'T'
group by am.fheadcode
order by am.fheadcode";
// var_dump($query1);
$results1 = $aobj_context->pobj_db->GetAll($query1);
echo $aobj_context->mobj_output->ToJSONEnvelope($results1, 0, "success");
}
function savefeeDates($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$data = $req['feeStrForm'];
$degreeArr = $data['fdegree'];
$degree = implode("','", $degreeArr);
$examnoArr = $data['fexamno'];
$examno = implode("','", $examnoArr);
//$categoryArr = $data['fcategory'];
//$category = implode("','", $categoryArr);
//$constype = implode( "','", $data['fconstype']);
$combcode = $data['fcombcode'];
$fee_array = $req['feearray'];
foreach ($fee_array as $key => $value) {
// $update_query = "update admfeestr
// set fadmfeesdate = date_format(str_to_date('{$value['fromdate']}','%d/%m/%Y'), '%Y-%m-%d'),
// fadmfeeedate = date_format(str_to_date('{$value['todate']}','%d/%m/%Y'), '%Y-%m-%d')
// where fdegree in ('{$degree}')
// and fexamno in ('{$examno}') and fcatcode in ('{$category}')
// and fcombcode = '{$combcode}'
// and fconstype in ('{$constype}') and fheadcode = '{$value['fheadcode']}'";
$update_query = "update admfeestr
set fadmfeesdate = date_format(str_to_date('{$value['fromdate']}','%d/%m/%Y'), '%Y-%m-%d'),
fadmfeeedate = date_format(str_to_date('{$value['todate']}','%d/%m/%Y'), '%Y-%m-%d')
where fdegree in ('{$degree}')
and fexamno in ('{$examno}')
and fcombcode = '{$combcode}'
and fheadcode = '{$value['fheadcode']}'";
// var_dump($update_query);
$result1 = $aobj_context->pobj_db->Execute($update_query);
if (!$result1) {
break;
}
}
if ($result1) {
$arr['msg'] = 'Fees updated successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
} else {
$arr['msg'] = 'Error While updating the feess';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "error");
}
}
function getValHeads($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "SELECT IFNULL(fvalcntr,'') AS fvalcntr,
IFNULL(fvalname,'') AS fvalname,
IFNULL(fvaladd1,'') AS fvaladd1,
IFNULL(fvaladd2,'') AS fvaladd2,
IFNULL(fvaladd3,'') AS fvaladd3,
IFNULL(fvaladd4,'') AS fvaladd4,
IFNULL(fvalcont,'') AS fvalcont,
IFNULL(fdeleted,'') AS fdeleted
FROM masvalcntr WHERE fdeleted <> 'T'
order by fvalcntr";
$result = $aobj_context->pobj_db->GetAll($query);
if (count($result) > 0) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'No Data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function savevalheads($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$data = $req['data'];
if (!array_key_exists('valheads', $data)) {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
if (count($data['valheads']) == 0) {
$arr['msg'] = 'Invalid Params data';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
$valheads = $data['valheads'];
$values = '';
foreach ($valheads as $k => $v) {
$deleted = $v['fdeleted'] == 'true' ? 'T' : 'F';
$values .= "('" . $v['fvalcntr'] . "','" . $v['fvalname'] . "', '" . $v['fvaladd1'] . "', '" .
$v['fvaladd2'] . "', '" . $v['fvaladd3'] . "', '" . $v['fvaladd4'] . "', '" . $v['fvalcont'] . "', '{$deleted}'),";
}
// var_dump($values);
$values = rtrim($values, ',');
$query = "insert into masvalcntr(fvalcntr, fvalname, fvaladd1, fvaladd2,fvaladd3,fvaladd4,fvalcont,fdeleted) values " . $values . "
ON DUPLICATE KEY UPDATE
fvalcntr = VALUES(fvalcntr),
fvalname = VALUES(fvalname), fvaladd1 = VALUES(fvaladd1), fvaladd2 = VALUES(fvaladd2),
fvaladd3 = VALUES(fvaladd3),fvaladd4 = VALUES(fvaladd4),fvalcont = VALUES(fvalcont),fdeleted = VALUES(fdeleted)";
$result = $aobj_context->pobj_db->Execute($query);
// var_dump($result);
// die();
if ($result) {
$arr['msg'] = 'Successfully Updated';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
} else {
$arr['msg'] = 'Insertion / Updation Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
|