<?php

ini_set('session.gc_maxlifetime', 360000);
// each client should remember their session id for EXACTLY 4days
session_set_cookie_params(360000);
$page = 'home';
$menu = 'no';


session_start();
require_once('../connect.php');
require_once('sql_required.php');

if (!isset($_SESSION['username'])) { ?>
  <script language="javascript">
    window.location.href = '../index.php';
  </script>
<?php }



 $datetoday = date('Y-m-d'); 

 $active_tab = "dashboard"; 

 if (isset($_POST['save_data'])) {
  
 $readingdate = $_POST ['reading'];
 $duedate = $_POST ['due'];
 $disconnectiondate = $_POST ['disconnection'];

  $update_reading= "UPDATE tbl_reading_sched SET reading_date = '$readingdate',due_date = '$duedate',disconnection_date = '$disconnectiondate'  WHERE status = 1";
  mysqli_query($conn, $update_reading);
   
      $success = '<span class="text-success"><b>Successfully Upgraded!</b></span>';
  
 
 }


 if (isset($_POST['save_data_1'])) {
  
  $select_readingdate = $_POST ['select_readingdate']; 


  $update_reading= "UPDATE tbl_reading_sched SET status = 0";
  mysqli_query($conn, $update_reading);



   $update_reading= "UPDATE tbl_reading_sched SET status = 1  WHERE  reading_date = '$select_readingdate' ";
   mysqli_query($conn, $update_reading);
    
       $success = '<span class="text-success"><b>Successfully updated!</b></span>';
   
  
  }

 
 
  
  ?> 
  
  
<!DOCTYPE html>
<html>
<head>
  <title>AWS Admin  Dashboard</title>

 
</head>
<body class="hold-transition   layout-footer-fixed layout-fixed sidebar-collapse">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
 
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-colvis-1.6.1/b-html5-1.6.1/b-print-1.6.1/r-2.2.3/datatables.min.css" />
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-colvis-1.6.1/b-html5-1.6.1/b-print-1.6.1/r-2.2.3/datatables.min.js"></script>


  <?php include_once('linkStyle.php'); ?>
  
<style>
  .currencyinput {
    border: 1px inset #ccc;
}
.currencyinput input {
    border: 0;
}
  </style>
<div id="preloader" style="display:none;"></div>
<div class="wrapper">
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <ul class="navbar-nav">
   
      <li class="nav-item ml-2">
        <span class="brand-text title-form-brand font-weight-bolder fontSize-20">Dashboard</span>
      </li>
    </ul>

    <ul class="navbar-nav ml-auto">
      <li class="nav-item minBars">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      <li class="nav-item dropdown" id="dropDownFullScreen">
        <a class="nav-link" data-toggle="dropdown" href="#">
          <i class="fas fa-user"></i>
        </a>
        <div class="dropdown-menu dropdown-menu-sm dropdown-menu-right">
          <a href="#" class="dropdown-item">
            <i class="fas fa-user mr-2"></i> 
            <span class="text-muted text-sm">Profile</span>
          </a>
          <div class="dropdown-divider"></div>
          <a href="../logout.php" class="dropdown-item dropdown-footer">Logout</a>
        </div>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->
  <?php include_once('navbar.php'); ?>

  <div class="content-wrapper" style="min-height: 363px;background: #fff;">
  <?php  
   
  include_once('referral_link.php');  
  
  include_once('dashboardDetails.php');  
  

      ?>

      
 <div class="row">
          <div class="col-12 col-sm-12">
            <div class="card card-primary card-outline card-tabs">
              <div class="card-header p-0 pt-1 border-bottom-0">
                <ul class="nav nav-tabs" id="custom-tabs-three-tab" role="tablist">
                <li class="nav-item">
                    <a class="nav-link active" id="custom-tabs-three-home-tab" data-toggle="pill" href="#custom-tabs-three-allmembers" role="tab" aria-controls="custom-tabs-three-home" aria-selected="true">Active Accounts</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-profile-tab" data-toggle="pill" href="#custom-tabs-three-alldisconnected" role="tab" aria-controls="custom-tabs-three-profile" aria-selected="false">Disconnected</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" id="custom-tabs-three-messages-tab" data-toggle="pill" href="#custom-tabs-three-allarchived" role="tab" aria-controls="custom-tabs-three-messages" aria-selected="false">Archived</a>
                  </li>
                  </ul>
 </div>

 <div class="card-body">
                <div class="tab-content" id="custom-tabs-three-tabContent">
                  <div class="tab-pane fade active show" id="custom-tabs-three-allmembers" role="tabpanel" aria-labelledby="custom-tabs-three-home-tab">
                <?php  include_once('all_members2.php');?>
                </div>
                  <div class="tab-pane fade" id="custom-tabs-three-alldisconnected" role="tabpanel" aria-labelledby="custom-tabs-three-profile-tab">
                  <?php  include_once('all_members_discon.php');?>
                </div>

                <div class="tab-pane fade" id="custom-tabs-three-allarchived" role="tabpanel" aria-labelledby="custom-tabs-three-messages-tab">
                  - 
                 </div>
                 

                </div>
              </div>
              <!-- /.card -->
            </div>
          </div>
           

  </div>


      <?
      include_once('others.php');
      include_once 'add_billspayment.php';
      include_once 'add_meterreading.php';
      include_once 'add_otherbalance.php';
       
  
  ?>
 
   
  
  <br>
  <?php include_once('footer.php'); ?>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
</div>
<!-- ./wrapper -->
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>


  
  
<script src="https://cdn.datatables.net/buttons/2.3.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.bootstrap4.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.print.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.colVis.min.js"></script>

 
 
<!-- page script -->
<script>
 


$(function () {
  
  
  $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,

      
      dom: 'Bfrtip',
      buttons: [
            { extend: 'copyHtml5', footer: true },
            { extend: 'excelHtml5', footer: true },
            { extend: 'pdfHtml5', footer: true },
            { extend: 'print', footer: true }
        ]
    
 
 } );

    $('#example_discon').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,

      
      dom: 'Bfrtip',
      buttons: [
            { extend: 'copyHtml5', footer: true },
            { extend: 'excelHtml5', footer: true },
            { extend: 'pdfHtml5', footer: true },
            { extend: 'print', footer: true }
        ]
    
    });
  
       
    
  $('#example1').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,

      
      dom: 'Bfrtip',
      buttons: [
            { extend: 'copyHtml5', footer: true },
            { extend: 'excelHtml5', footer: true },
            { extend: 'pdfHtml5', footer: true },
            { extend: 'print', footer: true }
        ]
    
 
 } );

});

  
 
</script>

<script type="text/javascript"> 

//add meter reading
$(document).on("click", ".addmeterreading", function (e) {
  var id1 = $(this).attr("data-id");
  var acctholder1 = $(this).attr("data-name");
  var prevreading = $(this).attr("data-prevreading");

  $("#id_u1").val(id1);
  $("#txt_acct_holder1").val(acctholder1);
  $("#id-1").val(prevreading);
 
});

 

$(function () {
  $("#id-1, #id-2, #id-3,#id-4,#id-5").keyup(function () {
      (+$("#id-3").val
    (+$("#id-2").val() - +$("#id-1").val())) ;
 
    
    if ($("#id-5").val < 5) {
      $("#id-5").val = 200;
    }else {
    (+$("#id-5").val
    (+$("#id-3").val() * +$("#id-4").val())) ;
  }
  });
});
</script>


</body>
</html>
	<script src="index_3.js"></script>
  
   