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.24.110
<?php
include ("database.php");
$usertype = $_POST['usertype'];;
$user = $_POST['user'];
$user_condition = '';
if($usertype == 'usr')
$user_condition = "AND fapprusername ='{$user}' ";
$dashboard_query = "SELECT COUNT(fappno) AS totalappcount,
SUM(CASE WHEN IFNULL(fapprstatus,'') = 'APPROVED'
THEN 1 ELSE 0 END) AS approvecount,
SUM(CASE WHEN IFNULL(fapprstatus,'') <> 'APPROVED'
THEN 1 ELSE 0 END) AS notapprovecount,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'DEBIT/CREDIT/NET BANKING'
THEN 1 ELSE 0 END) AS onlinepaycount,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'DEBIT/CREDIT/NET BANKING'
AND IFNULL(fpaymentstatus,'') = 'success'
THEN 1 ELSE 0 END) AS onlinepaysuccesscount,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'SBM'
THEN 1 ELSE 0 END) AS challanpaycount,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'SBM'
AND IFNULL(fapprstatus,'') = 'APPROVED'
THEN 1 ELSE 0 END) AS challanpayackcount,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'SBM'
AND IFNULL(fapprstatus,'') <> 'APPROVED'
THEN 1 ELSE 0 END) AS challanpayackpencount,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'DEBIT/CREDIT/NET BANKING'
AND IFNULL(fpaymentstatus,'') = 'success'
THEN ftotfee ELSE 0 END) AS onlinepaymentdone,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'DEBIT/CREDIT/NET BANKING'
AND IFNULL(fpaymentstatus,'') <> 'success'
THEN ftotfee ELSE 0 END) AS onlinepaymentpending,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'SBM'
AND IFNULL(fapprstatus,'') = 'APPROVED'
THEN ftotfee ELSE 0 END) AS sbmpaymentdone,
SUM(CASE WHEN IFNULL(fpaymenttype,'') = 'SBM'
AND IFNULL(fapprstatus,'') <> 'APPROVED'
THEN ftotfee ELSE 0 END) AS sbmpaymentpending,
SUM(CASE WHEN IFNULL(fexamno,'') = 'A'
THEN 1 ELSE 0 END) AS freshstudcount,
SUM(CASE WHEN IFNULL(fexamno,'') = 'B'
THEN 1 ELSE 0 END) AS secondstudcount,
SUM(CASE WHEN IFNULL(fexamno,'') = 'B'
THEN 1 ELSE 0 END) AS trirdstudcount,
SUM(CASE WHEN IFNULL(flateral_entry,'') = 'T'
THEN 1 ELSE 0 END) AS lateralstudcount
FROM studadm
WHERE IFNULL(fpaymenttype,'') NOT IN ('', 'undefined', 'null') $user_condition";
$result = mysqli_query($conn,$dashboard_query);
$counts = mysqli_fetch_array($result,MYSQLI_ASSOC);
echo json_encode($counts);
|