<?PHP
//set_time_limit(300);
include 'connection.php';
error_reporting(0);








// $sql4 = "SELECT count(*) as TOT_MEM FROM NAA_EVENTS_REG WHERE EVENT_CODE = '02' AND PAYMENT_STATUS = 'P'";
$sql4 = "SELECT SUM(NO_OF_MEM + NO_OF_SPOUSE + NO_OF_CHILD + NO_OF_DRIVER) AS TOTAL_MEMBERS, SUM(NO_OF_MEM) AS TOTAL_ALUMNI FROM NAA_EVENTS_REG a, naa_members 
b WHERE a.EVENT_CODE = '05' AND a.PAYMENT_STATUS = 'P' and a.mem_id=b.mem_id";
$parse = ociparse($conn, $sql4);
oci_execute($parse);

while ($row = oci_fetch_assoc($parse)) {
    $TOT_MEM[] = $row;
}

// var_dump($cadre);
oci_free_statement($parse);


$sql5 = "SELECT to_char(UPDATE_DATE,'DD/MM/RRRR  HH:MI:SS') LD
FROM NAA_EVENTS_REG
WHERE EVENT_CODE = '01' AND PAYMENT_STATUS = 'P' AND UPDATE_DATE IS NOT NULL
ORDER BY UPDATE_DATE ASC";
// print_r($sql5);


$parse = ociparse($conn, $sql5);
oci_execute($parse);


while ($row = oci_fetch_assoc($parse)) {
    $tr_time = $row['LD'];
}







/* Retrive batch */
$curs = oci_new_cursor($conn);

$stid = oci_parse($conn, "begin PKG_DASH_BOARD.DPD_ADM_batch(:cur_data); end;");

oci_bind_by_name($stid, ":cur_data", $curs, -1, OCI_B_CURSOR);

oci_execute($stid);
oci_execute($curs);

while (($row = oci_fetch_array($curs, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {

    $adm_batch[] = $row;
}





// var_dump($cadre);
oci_free_statement($parse);

$report = "";


$bool = false;
/* Data Filter Start */


// $CAT_CODE = $_POST['CAT_CODE'];
$DGR_CODE = 'P';
// $CHANNEL = $_POST['CHANNEL'];
$REPORT_LEVEL_CODE = 1;



/* Start Procedure for GRAPH */
$curs_sql_graph = oci_new_cursor($conn);

$sql_graph = oci_parse($conn, "begin PKG_DASH_BOARD.DPD_DF_GRAPH(:cur_data,:CAT_CODE,:DGR_CODE,:CHANNEL,:REPORT_LEVEL_CODE); end;");

oci_bind_by_name($sql_graph, ":cur_data", $curs_sql_graph, -1, OCI_B_CURSOR);
oci_bind_by_name($sql_graph, ":CAT_CODE", $CAT_CODE, -1, SQLT_CHR);
oci_bind_by_name($sql_graph, ":DGR_CODE", $DGR_CODE, -1, SQLT_CHR);
oci_bind_by_name($sql_graph, ":CHANNEL", $CHANNEL, -1, SQLT_CHR);
oci_bind_by_name($sql_graph, ":REPORT_LEVEL_CODE", $REPORT_LEVEL_CODE, -1, SQLT_CHR);


oci_execute($sql_graph);
oci_execute($curs_sql_graph);

while (($row_curs_sql_graph = oci_fetch_array($curs_sql_graph, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {

    $graph_output[] = $row_curs_sql_graph;
}
/* End Procedure for GRAPH */




/*  Donation List for GRAPH */
$curs = oci_new_cursor($conn);

$stid = oci_parse($conn, "begin PKG_DASH_BOARD.DPD_Batch_Dep_GRAPH_DATA(:cur_data); end;");


oci_bind_by_name($stid, ":cur_data", $curs, -1, OCI_B_CURSOR);


oci_execute($stid);
oci_execute($curs);


while (($row = oci_fetch_array($curs, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {


    $department[] = $row;
}

















$bool = true;

/* Data Filter End */

?>



 <!-- pdf and excel data css starts  -->
    <!-- datatable  -->
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
    <link href="https://nightly.datatables.net/buttons/css/buttons.dataTables.css?_=c6b24f8a56e04fcee6105a02f4027462.css" rel="stylesheet" type="text/css" />
    <!-- pdf and excel data css ends  -->

    <!-- Add Font Awesome CSS (you can customize the link according to your needs) -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">


<div class="container-fluid">
<div class="card" style="height: auto;background-color: #FFF;">
            <div class="card-body ">
                <div class="row back">
                    <div class="col-md-2"></div>
                    <div class="col-md-8">
                        <header class="col-lg-12 col-md-12 col-sm-12 text-center">

                            <div class="header">
                                <!-- <img src="images/social_welfare.jpg" alt="logo" width="60px" height="60px" /> -->
                                <h4 style="text-align: center; color: #0c0a8a; font-weight: bold;">Social Welfare Alumni Association </h4>
                                <h4 style="text-align: center; color: #0c0a8a; font-weight: bold;">Dhaka University</h4>
                                <h5 style="text-align: center; color: red;font-weight: bold;">Reunion 2024</h5>
                            </div>

                        </header>

                    </div>
                    <div class="col-md-2"></div>

                </div>
                <hr>







                <div class="row">
                    <!-- <div class="col-md-7 col-lg-7 col-sm-12 queen">
                    <div>
                                <img src="images/ndc_75.png" width="200" height="200" alt="">
                            </div>

                    </div>


                    <div class="col-md-5 col-lg-5 col-sm-12">
                        <div class="col-md-12 col-lg-12 col-sm-12 " style="margin-top: 70px;">
                            <a href="https://ndc75register.net/profile-update" target="_blank" class="btn btn-info" style="width: 220px; margin-top: 15px;background-color:brown; color: white; font-weight: bold;text-align:center;"> Profile Update</a>
                        </div>
                    </div> -->




                    <div class="col-sm-12 col-md-6" id="graph5" style="margin-top: 50px;">
                        <div class="card shadow mb-4">



                        <div class="card-body">
                                <div class="d-flex justify-content-center p-1" style="background-color: #e8b742;">


                                    <h4 class="text-center text-weight-bolder" style="color: #212121;">
                                        <?php
                                        if (!empty($graph_output[0]['REPORT_HDR'])) {
                                            if ($bool) {

                                                echo '<span class="your-span-class">' . $graph_output[0]['REPORT_HDR'] . " Wise Registered Alumni </span> (Total Alumni : <span style='color: #4257BF;'>   " . $TOT_MEM[0]['TOTAL_ALUMNI'] . ",</span> Total Participants : <span style='color: #362E3B;'>   " . $TOT_MEM[0]['TOTAL_MEMBERS'] . ",</span>  <br> Last Transaction Time: <span style='color: red;'>  " . $tr_time . ") </span>";
                                            }
                                        }
                                        ?>
                                    </h4>



                                </div>


                                <div id="" style="margin-top: 30px;">


                                    <canvas id="myChart" style="width:100%;height: 300px;"></canvas>


                                    <!-- <div id="piechart" style="width: 900px; height: 300px; margin-left: 20px;"></div> -->
                                </div>



                            </div>

                        </div>
                    </div>



                    
                    <div class="col-sm-12 col-md-6" style="margin-top: 50px;">
                        <div class="card shadow mb-4">



                            <div class="card-body">
                                <div class="d-flex justify-content-center p-1" style="background-color: #e8b742;">
                                    <h5 class="text-center">Degree Optained Wise REGISTERED ALUMNI</h5>



                                </div>

                                <style>
                                .big_height{
                                    margin-top: 30px;
                                    height: 360px;
                                }

                                @media screen and (max-width: 1000px) {
                                    .big_height{
                                    margin-top: 30px;
                                    height: 660px;
                                }
                                    
                                }
                                </style>


                                <div class="table-responsive big_height" >
                                    <table class="table table-bordered table-striped" id="example">
                                        <thead>
                                            <tr>
                                                <th scope="col" style="text-align: center;color:#BF4196;">SL No.</th>
                                                <th scope="col" style="text-align: center;color:#BF4196;">Degree Optained</th>
                                                <th scope="col" style="text-align: center;color:#BF4196;">Total Reg</th>
                                                
                                            </tr>
                                        </thead>


                                        <tbody>
                                            <?php

                                            $serialNumber = 1;

                                            for ($i = 0; $i < count($department); $i++) {

                                            ?>

                                                <tr>
                                                    <td style="text-align: center;color:#66aa00;font-weight: bold;"><?php echo $serialNumber; ?></td>
                                                    <td style="text-align: center;color:brown;font-weight: bold;"><?php echo $department[$i]['SECT_NAME'] ?></td>

                                                    <td scope="row" style="text-align: center;color:#C1AD1F ;font-weight: bold;"><?php echo $department[$i]['NO_OF_REG'] ?></td>
                                                   

                                                </tr>




                                            <?php
                                                $serialNumber++;
                                            }
                                            ?>





                                        </tbody>



                                    </table>
                                </div>



                            </div>

                        </div>
                    </div>





                </div>

                
            </div>
        </div>
</div>

