<?php 
  // echo @$_GET['msg'];
  // session_start();
  // if(isset($_SESSION['userId'])){ 
  //   $uid= $_SESSION['userId'];
  //   $chk=1;
  //   if($uid==$chk){
  //     $txt='hidden';
  //   }
  //   else{
  //     $txt='csdfa';
  //   }
include 'template/header.php';
 
include 'template/sidebar.php';



 ?>

 <style type="text/css">
   .filter-option{
    border: 1px solid grey;
    /*border-radius: 10px;*/
   }
   .form-control{
    height: 10px;
    border: 1px solid grey;
    
   }
  /* #dated:focus {
  -ms-transform: scale(1.5); /* IE 9 */
  /*-webkit-transform: scale(1.5); /* Safari 3-8 */
  /*transform: scale(1.5); */
/*}*/
 </style>
        <!--**********************************
            Sidebar end
        ***********************************-->

        <!--**********************************
            Content body start
        ***********************************-->

<div class="content-body">
        <!-- <div class="content-body" style="background-color: black !important;"> -->

            <div class="container-fluid mt-3">
               <h3 style="color: white;">FCR Report</h3>
                <div class="row">
                    <div class="col-md-12">
                        <div class="row">
                            <!-- <div class="col-12"> -->
                                <div class="card col-12">
                                    <style type="text/css">
                                        .form-group{
                                            display: inline-block;
                                        }
                                    </style>
                                    <div class="card-body">
                                          <div class="row">
                                        <div class="col-xs-12 col-md-12">
                                        <div class="form-group col-md-5 col-xs-12">
                                       <label>Account Name</label>
                                     <select style="border: 1px solid red !important;" id="selaccid" class="form-control selectpicker"data-live-search="true">
                    <?php
                    require 'connection.php';

                    if($uid==58){
                        $qry = "SELECT * FROM accreg where groupid='11'";

                    } else{
                        $qry = "SELECT * FROM accreg";

                    }
               
             $run = mysqli_query($connect, $qry) or die(mysqli_error($connect));
    while($row = mysqli_fetch_array($run)){
?>
                                         <option value="<?php echo $row['accid']; ?>"><?php echo $row['accname']; ?></option>
                                     <?php } ?>
                                     </select>

                                       </div>
                                       <?php 
require 'connection.php';

                 $qry = "SELECT max(prid) as prid FROM purchase";
             $run = mysqli_query($connect, $qry) or die(mysqli_error($connect));
    $row2 = mysqli_fetch_array($run)


 ?>                          

                                       <div class="form-group col-xs-12">
                                        <label>From</label>
                                      <input  id="dated" onclick="getDate()" class="form-control" type="date" class="form-control input-default" name="">
                                      <!-- <p>Date: <input type="text" id="datepicker dated" size="30"></p> -->
                                       </div>
                                       <div class="form-group col-xs-12">
                                        <label>To</label>
                                       
                                      <input id="dated2" onclick="getDate()" class="form-control" type="date" class="form-control input-default" name="">
                                      <!-- <p>Date: <input type="text" id="datepicker dated" size="30"></p> -->
                                       </div>
                                       <div class="form-group col-12 col-xs-12">
                                      <button style="min-width: 100px; color: white;" id="showbtn" class="btn btn-success">PDF Report</button>
                                     <!--  <button <?php //echo $txt; ?> id="reportbtn" class="btn btn-primary">Show Report</button> -->
                                       </div>
<?php 

if($uid==58){
  ?>

  <div class="form-group col-12 col-xs-12">
                                      <button style="min-width: 100px; color: white;" id="createsms" class="btn btn-success">Create Sms</button>
                                     
  <?php
}


?>



                                    </div>
                                </div>

                                <!-- **************************** -->
                                
                                
                               
                                    </div>
                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>
                <!-- </div> -->

            </div>
            <!-- #/ container -->
        </div>
        <!--**********************************
            Content body end
        ***********************************-->
        
        
        <!--**********************************
            Footer start
        ***********************************-->
       <?php 
include 'template/footer.php';
 ?>

<!-- <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Datepicker - Animations</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#datepicker" ).datepicker();
    $( "#anim" ).on( "change", function() {
      $( "#datepicker" ).datepicker( "option", "showAnim", $( this ).val() );
    });
  } );
  </script> -->

 <script type="text/javascript">
    var today = new Date();

document.getElementById("dated").value = today.getFullYear() + '-' + ('0' + (today.getMonth() + 1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2);

 </script>
  <script type="text/javascript">
    var today = new Date();

document.getElementById("dated2").value = today.getFullYear() + '-' + ('0' + (today.getMonth() + 1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2);

 </script>
 <!-- Show Ledger -->
<script type="text/javascript">
  $('#showbtn').click(function(){

    // alert("Being Processed...")
var accid= $('#selaccid').val();
    var from= $('#dated').val();
    var to= $('#dated2').val();
    event.preventDefault();
 // printaccledger
       var win = window.open('printfcrledger.php?accid='+accid+'& from='+from+'& to='+to+'', '_blank');
  })


</script>

<script type="text/javascript">
  $('#createsms').click(function(){

    // alert("Being Processed...")
var accid= $('#selaccid').val();
    var from= $('#dated').val();
    var to= $('#dated2').val();
    event.preventDefault();
 // printaccledger
       var win = window.open('brlsms.php?accid='+accid+'& from='+from+'& to='+to+'', '_blank');
  })


</script>


<script type="text/javascript">
  
  $('#reportbtn').click(function(){
    var accid= $('#selaccid').val();
    var from= $('#dated').val();
    var to= $('#dated2').val();
    event.preventDefault();
 
       var win = window.open('ldgr.php?accid='+accid+'& from='+from+'& to='+to+'', '_blank');

  })
</script>

//  <?php 
// else{
//    header('location: index.php');
// }
 ?>
