<?php require_once('../auth/auth.php');?>
<section class="content">
 <div class="container-fluid">
  <div class="row">
  	<div class="col-md-4"></div>
    <div class="col-md-4">
      <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
        <div class="card-header" style="padding: 3px 8px;">
          <h3 class="card-title">Balence Statment</h3>
          <div class="card-tools">
            <button type="button" class="btn btn-tool" data-card-widget="remove">
              <i class="fas fa-times"></i>
            </button>
          </div>
        </div>

        <form id="b_search" action="#" autocomplete="off">
        	<div class="card-body">
        		<div class="col-md-12">
        			<div class="row">
              <?php if($uid==1) { ?>
                <div class="col-md-12">
                  <div class="form-group">
                    <label>Select Company <b class="text-danger"> *</b></label>
                    <select name="gcoid" class="form-control select2" style="width: 100%;" required="true">
                      <option value="0">All Company</option>
                      <?php 
                          $scom= mysqli_query($conn,"SELECT coid,co_name,co_phone FROM company WHERE coid") or die(mysqli_error($conn));
                            while($rcoid= mysqli_fetch_assoc($scom)){
                            echo '<option value='.$rcoid["coid"].'>'.$rcoid["co_name"]."-".$rcoid["co_phone"].'</option>';
                      }?>
                    </select>
                  </div>
                </div>
              <?php } else { ?>
                 <input type="hidden" name="gcoid" value="<?php echo $coid;?>">
              <?php } ?>

        				<div class="col-md-6">
        					<div class="form-group">
        					  <label>From Date..?</label>
        						<input type="text" name="fdate" class="form-control form-control-sm" onmouseover="lcdate(this)" style="text-align:center;" readonly="true" required="true"value="<?php echo $date;?>">
        					</div>
        				</div>
        				<div class="col-md-6">
        					<div class="form-group">
        					  <label>End Date..?</label>
        						<input type="text" name="edate" class="form-control form-control-sm" onmouseover="lcdate(this)" style="text-align:center;" readonly="true" required="true" value="<?php echo $date;?>">
        					</div>
        				</div>
        			</div>
        		</div>
        	</div>

        	<center>
        		<div class="card-footer" style="padding: 8px 5px;">
        			<button type="submit" id="save" class="btn btn-primary btn-xs">View Report</button>
        		</div>
        	</center>
        </form>



       </div> 
     </div>
     <div class="col-md-4"></div>
   </div>
 </div>
</section>


<script>
$(document).ready(function() {
$('select').select2();
$('#b_search').on('submit', function(e){
  e.preventDefault(); 
     $('#save').prop('disabled', true);
     $('#save').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+'Loading...'); 
     $(".preloader").css('display','flex');
     $.post("../bill_package/balance_statment_view.php",$(this).serialize(),function(data) {
     $('.preloader').hide();	
     $('#packagegview').html(data);
   });
  });
});  
</script>