<?php
include('db_con.php');
//include('db_coni.php');
include('function.php');
if (isset($_SESSION['user_id'])) {
        $user_type = $_SESSION['user_type'];
        $user_id = $_SESSION['user_id'];
        $user_name = $_SESSION['user_name'];
        $branch_id = $_SESSION['branch_id'];
        $branch_name = $_SESSION['branch_name'];
        $store_id = $_SESSION['store_id'];
        $store_name = $_SESSION['store_name'];
}else{
    header('Location: login');
    die();
}
$sql = "SELECT IFNULL(doc_status,'ON') FROM user_rights WHERE user_id = '".$user_id."' and doc_name = 'sale_target'";
            $statement = $connect->prepare($sql);
            $statement->execute(); // no need to add `$sql` here, you can take that out
            $sale_target = 'ON';
            if($sale_target=='OFF'){header('Location: dashboard');}
$dated = date('Y-m-d');
$fdated = date('Y-m-01');
if(isset($_POST["print"]))
  {
   
  
   $sm_id = $_POST['sm_id'];
   $city = $_POST['city'];
    $area = $_POST['area'];
   
      
      //$result = $statement->fetchAll();
      header('location:rpt_cust_recovery_status_preview?print=1&sm_id='.$sm_id.'&city='.$city.'&area='.$area.'');
  }
  
?>
<!DOCTYPE html>
<html>
<head>
  <title>Status Report - City Or Area Wise</title>
  <?php include('include/head.php'); ?>
  
</head>
<body>
  <?php include('include/header.php'); ?>
  <?php include('include/sidebar.php'); ?>
   <?php include('include/script.php'); ?>
<div class="main-container">
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark"></h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item active">Accounts Receivable</li>
              <li class="breadcrumb-item active">Reports </li>
              <li class="breadcrumb-item active">Sales & Recovery </li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
     <span id="alert_action"></span>
    <div class="row">
        <div class="col-12">
          <div class="card">
            <div class="card-header">
            <div class="row">
                          <div class="col-lg-10 col-md-10 col-sm-8 col-xs-6">
                              <h3 class="panel-title">Accounts Receivable Report</h3>
                            </div>
                            
                        </div>
            </div>
            <!-- /.card-header -->
            <div class="card-body">
       <form method="post" id="report_form">
      <br />
      
        <div class="table-responsive">
          <table class="table table-bordered">
            <tr>
              <td colspan="2" align="center"><h2 style="margin-top:10.5px">Sales & Recovery Report</h2></td>
            </tr>
            <tr>
                <td colspan="2">
                  <div class="row">
                    
                    <div class="col-md-6">
                        <br />
                      
                         <select name="sm_id" id="sm_id" class="form-control input-sm sm_id"  />
                           <?php echo fill_sm($connect);?>
                        </select>   

                    
                        <br />
                         <select name="city" id="city" class="form-control input-sm city" />
                       
                          <?php echo fill_city($connect);?>
                        </select>

                       
                        <br />
                         <select name="area" id="area" class="form-control input-sm area" />
                       
                          <?php echo fill_area($connect);?>
                        </select>
              
                    </div>
                  
                
                    </div>
                    
                  </div>
                  
                 
                  </td>
                  </tr>
                 </td>
          
            <table class="table-responsive table-bordered table">
              <tr>
                <td>
                <input type="submit" name="print" id="print" class="form-control btn btn-info" value="Preview" />
                 
                 
                </td>
            
                 </tr></table>
                 
               
             
          </table>
        </div>
      </form>
     </div>
              </div>
          </div>
      </div>
             
        
        
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
 
  <!-- /.content-wrapper -->
 
  
  <script src="js/jquery-ui.js"></script>
  <script src="js/jquery-ui.min.js"></script>
    </div>
    </div>
 
  
</body>
</html>
 <script>
 
  $(document).ready(function(){
    $('#fdate').datepicker({
      dateFormat: 'yy-mm-dd',
      changeMonth: true,
      changeYear: true
    });
  })
  </script>
<script>
 
  $(document).ready(function(){
    $('#tdate').datepicker({
      dateFormat: 'yy-mm-dd',
      changeMonth: true,
      changeYear: true
    });
  })
  </script>
  <script>
  $('.select2').select2();
  </script>
     
      
