<?php  
              include('connection.php');
              $select = mysqli_query($conn,"SELECT * FROM students");
              $st = mysqli_num_rows($select);

               $select1 = mysqli_query($conn,"SELECT jan FROM students");
               $k = 0;
               while ($se = mysqli_fetch_object($select1)){
                    $k+= $se->jan;
               }

               $sel2 = mysqli_query($conn,"SELECT apr FROM students");
               $m =0;
               while ($see = mysqli_fetch_object($sel2)){
                    $m+= $see->apr;
               }

               $sle3 = mysqli_query($conn,"SELECT jul FROM students");
               $t=0;
               while ($s = mysqli_fetch_object($sle3)){
                    $t += $s->jul;
               }

               $sd = mysqli_query($conn,"SELECT sep FROM students");
               $p=0;
               while ($kk = mysqli_fetch_object($sd)){
                    $p += $kk->sep;
               }
               $u = mysqli_query($conn,"SELECT ud FROM students");
               $de = 0;
               while ($un = mysqli_fetch_object($u)){
                    $de += $un->ud;
               }
               $ot = mysqli_query($conn,"SELECT others FROM students");
               $kj=0;
               while ($hj = mysqli_fetch_object($ot)){
                    $kj += $hj->others;
               }
              $total = $k + $m +$p+$t+$de+$kj;

              $pa1 = ($k/$total)*100;
              $pa2 = ($m/$total)*100;
              $pa3 = ($t/$total)*100;
              $pa4 = ($p/$total)*100;
              $pa5 = ($de/$total)*100;
              $pa6 = ($kj/$total)*100;

?>
<?php include 'includes/header.php'; ?>

<?php include 'includes/sidebar.php'; ?>
<?php include 'includes/topbar.php'; ?>
            <!-- /menu footer buttons -->
           



        <!-- page content -->
        <div class="right_col" role="main">
          <!-- top tiles -->
            <img src="images/logo.jpg " width="100%" height="150px" style="border-radius: 30px; margin-left:-50px;">
          <div class="row" style="display: inline-block;" >
          <div class="tile_count">
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Total January Payment</span>
              <div class="count green"><?php echo number_format($k); ?></div>
              <span class="count_bottom"><i class="red"><i class="fa fa-sort-asc"></i><?php echo round($pa1).'%'; ?> </i> </span>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-clock-o"></i> Total April Payment</span>
              <div class="count green"><?php echo number_format($m); ?></div>
              <span class="count_bottom"><i class="red"><i class="fa fa-sort-asc"></i><?php echo round($pa2).'%'; ?>  </i> </span>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Total July Payment</span>
              <div class="count green"><?php echo number_format($t); ?></div>
              <span class="count_bottom"><i class="red"><i class="fa fa-sort-asc"></i><?php echo round($pa3).'%'; ?>  </i> </span>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Total Sepetember Payment</span>
              <div class="count green"><?php echo number_format($p); ?></div>
              <span class="count_bottom"><i class="red"><i class="fa fa-sort-asc"></i><?php echo round($pa4).'%'; ?> </i> </span>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Uniform &amp;Development</span>
              <div class="count green"><?php echo number_format($de); ?></div>
              <span class="count_bottom"><i class="red"><i class="fa fa-sort-asc"></i><?php echo round($pa5).'%'; ?> </i> </span>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i>Others Payment</span>
              <div class="count green"><?php echo number_format($kj); ?></div>
              <span class="count_bottom"><i class="red"><i class="fa fa-sort-asc"></i><?php echo round($pa6).'%'; ?> </i> </span>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Total Collections</span>
              <div class="count green"><?php echo number_format($total); ?></div>
            </div>
            <div class="col-md-3 col-sm-4  tile_stats_count">
              <span class="count_top"><i class="fa fa-user"></i> Total Students</span>
              <div class="count green"><?php echo $st; ?></div>
            </div>
          </div>
        </div>
          <!-- /top tiles -->


          <br />

          <div class="row">

            <div class="col-md-6 col-sm-4 ">
              <div class="x_panel tile fixed_height_320 overflow_hidden">
                <div class="x_title">
                  <h2>Payment Chart</h2>
                  <ul class="nav navbar-right panel_toolbox">
                    <li><a class="close-link"><i class=""></i></a>
                    </li>
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                    </li>
                    
                  </ul>
                  <div class="clearfix"></div>
                </div>
                <div class="x_content">
                  <table class="" style="width:100%">
                    
                    <tr>
                      <td>
                        <canvas class="canvasDoughnut" height="140" width="140" style="margin: 15px 10px 10px 0"></canvas>
                      </td>
                      <td>
                        <table class="tile_info">
                          <tr>
                            <td>
                              <p><i class="fa fa-square aero"></i>January Payments </p>
                            </td>
                            <td><?php echo round($pa1).'%'; ?></td>
                          </tr>
                          <tr>
                            <td>
                              <p><i class="fa fa-square purple"></i>April Payments </p>
                            </td>
                            <td><?php echo round($pa2).'%'; ?></td>
                          </tr>
                          <tr>
                            <td>
                              <p><i class="fa fa-square red"></i>July Payments </p>
                            </td>
                            <td><?php echo round($pa3).'%'; ?></td>
                          </tr>
                          <tr>
                            <td>
                              <p><i class="fa fa-square green"></i>Sepetember Payments </p>
                            </td>
                            <td><?php echo round($pa4).'%'; ?></td>
                          </tr>
                          <tr>
                            <td>
                              <p><i class="fa fa-square blue"></i>Uniform &amp;Development</p>
                            </td>
                            <td><?php echo round($pa5).'%'; ?></td>
                          </tr>
                          <tr>
                            <td>
                              <p><i class="fa fa-square black"></i>Others Payments </p>
                            </td>
                            <td><?php echo round($pa6).'%'; ?></td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>


            <div class="col-md-6 col-sm-4 ">
              <div class="x_panel tile fixed_height_320">
                <div class="x_title">
                  <h2>Quick Settings</h2>
                  <ul class="nav navbar-right panel_toolbox">
                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                 #
                    
                  </ul>
                  <div class="clearfix"></div>
                </div>
                <div class="x_content">
                  <div class="dashboard-widget-content">
                    <ul class="quick-list">
                      <li><i class="fa fa-calendar-o"></i><a href="#">Settings</a>
                      </li>
                      <li><i class="fa fa-bars"></i><a href="#">Subscription</a>
                      </li>
                      <li><i class="fa fa-bar-chart"></i><a href="#">Auto Renewal</a> </li>
                      <li><i class="fa fa-line-chart"></i><a href="#">Achievements</a>
                      </li>
                      <li><i class="fa fa-bar-chart"></i><a href="#">Auto Renewal</a> </li>
                      <li><i class="fa fa-line-chart"></i><a href="#">Achievements</a>
                      </li>
                      <li><i class="fa fa-area-chart"></i><a href="#">Logout</a>
                      </li>
                    </ul>

                    <div class="sidebar-widget">
                        <h4>Profile Completion</h4>
                        <canvas width="150" height="80" id="chart_gauge_01" class="" style="width: 160px; height: 100px;"></canvas>
                        <div class="goal-wrapper">
                          <span id="gauge-text" class="gauge-value pull-left">0</span>
                          <span class="gauge-value pull-left">%</span>
                          <span id="goal-text" class="goal-value pull-right">100%</span>
                        </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>

          </div>


         
<?php include 'includes/footer.php'; ?>
