
<head>

    <meta charset="utf-8">
    <title>DIGITAL ACCOUNTS MANAGEMENT</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
    <meta name="author" content="KASHIF ALI">

    <!-- The styles -->
    <link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">

    <link href="css/charisma-app.css" rel="stylesheet">
    <link href='bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
    <link href='bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
    <link href='bower_components/chosen/chosen.min.css' rel='stylesheet'>
    <link href='bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
    <link href='bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
    <link href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>
    <link href='css/jquery.noty.css' rel='stylesheet'>
    <link href='css/noty_theme_default.css' rel='stylesheet'>
    <link href='css/elfinder.min.css' rel='stylesheet'>
    <link href='css/elfinder.theme.css' rel='stylesheet'>
    <link href='css/jquery.iphone.toggle.css' rel='stylesheet'>
    <link href='css/uploadify.css' rel='stylesheet'>
    <link href='css/animate.min.css' rel='stylesheet'>


 <link rel="stylesheet" href="css/jquery-ui.css">
  <!-- <link rel="stylesheet" href="/resources/demos/style.css"> -->
  <script src="js/jquery-1.12.4.js"></script>
  <script src="js/jquery-ui.js"></script>
    <link rel="stylesheet" href="css/bootsrap_my.css" />


    <!-- jQuery -->
    <script src="bower_components/jquery/jquery.min.js"></script>

    <link rel="shortcut icon" href="img/favicon.ico">
<!-- ****************************************** -->

  <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"> -->
  <link rel="stylesheet" href="css/font-awesome.min2.css">
  <link rel="stylesheet" href="dist/css/bootstrap-select.css">

<!-- ************************************************ -->
</head>



 <body  style="background-color: white; margin-top: 0%; ">
 <div  class="container"> 



<?php 
 // echo @$_GET['msg'];
 //  session_start();
	// if(isset($_SESSION['userId'])){
	// if(isset($_GET['accid'])){
		require 'connection.php';
        $vno= $_GET['vno'];
		$ftchtype= $_GET['ftchtype'];
	
function dateDiffInDays($date1, $date2)  
{ 
    // Calculating the difference in timestamps 
    $diff = strtotime($date2) - strtotime($date1); 
      
    // 1 day = 24 hours 
    // 24 * 60 * 60 = 86400 seconds 
    return abs(round($diff / 86400)); 

} 

    $qry = "SELECT * from jvvoucher where vno = '$vno'";
        $run_qry = mysqli_query($connect, $qry);
        $row=mysqli_fetch_array($run_qry);
        $craccid=$row['craccid'];
        $draccid=$row['draccid'];
   $date1 = $row['dated'];
   $datechck = $row['dated'];
      $rundate = $date1;
      $dat= date_create($rundate);
      $dated1=date_format($dat,"d-m-Y");

         $qry = "SELECT * from accreg where accid = '$craccid'";
        $run_qry = mysqli_query($connect, $qry);
        $row=mysqli_fetch_array($run_qry);
        $craccname=$row['accname'];


         $qry = "SELECT * from accreg where accid = '$draccid'";
        $run_qry = mysqli_query($connect, $qry);
        $row=mysqli_fetch_array($run_qry);
        $draccname=$row['accname'];
		?>
		 <div style="background-color: white; margin-top: 20px;" class="table-responsive"> 
            <button style="align-self: center; min-width: 50px; min-height: 30px;" class="btn btn-warning btn-sm" id="closebtn"><i class="glyphicon glyphicon-off"></i></button>
               <button style="min-width: 70px;"  class="btn btn-primary btn-sm" id="printbtn"><i class="glyphicon glyphicon-print"></i> Print</button> 

    <h2 style="margin-left: 15%; "> AL-REHMAN POULTRY SERVICE </h2> 

    <div style="border-bottom: 1px solid black;"></div>
    <br>
    <h4 style="margin-left: 10px;">JV: &nbsp;&nbsp;<?php echo $vno; ?></h4>
    <h4 style="margin-left: 10px;">Credit: &nbsp;&nbsp;<?php echo $craccname; ?></h4>
    <h4 class="pull-right" style="margin-top: -29px;">Dated: &nbsp;&nbsp;<?php echo $dated1; ?></h4>

<table style="background-color: white;" class="table  table-stripped col-md-12">    
   
    <tr>
    <th style="min-width: 70px; max-width: 80px; font-size: 12px; min-height: 5px; color: black; border-left: 1px solid; border-left-color: #ECE9E8;">Description</th>
    
    <th style="font-size: 12px; height: 5px; color: black; text-align: right; border-right: 1px solid; border-right-color: #ECE9E8;">Amount</th>
</tr>
<?php
$totalbil = 0;
$srno = 1;
$totlqty=0;

        require 'connection.php';

			$qry = "SELECT * from jvvoucher  where vno = '$vno'";
        $run_qry = mysqli_query($connect, $qry);
        $row=mysqli_fetch_array($run_qry);
				?>

<tr>
<td style=" border-bottom: 1px solid #ECE9E8; font-size: 12px; max-width: 80px; height: auto; min-width: 70px; color: black; width: auto; border-left: 1px solid; border-left-color: #ECE9E8;">

    <?php 
 echo $row['description'];
     ?>
        

    </td>

<td style="font-size: 12px; height: auto; color: black; border-bottom: 1px solid #ECE9E8; text-align: right; border-right: 1px solid; border-color: #ECE9E8;"><?php 
   echo $row['amount']; ?></td>
    
</tr>


</table>
<?php 
if($ftchtype==1){
        $qry154 = "SELECT max(dated) as dated from ledger  where accid = '$draccid' and entrytype='JV' and dated<'$datechck'";
        $run_qry154 = mysqli_query($connect, $qry154);
        $row154=mysqli_fetch_array($run_qry154);
        $datese=$row154['dated'];

         $qry155 = "SELECT  description from ledger  where accid = '$draccid' and dated='$datese' and entrytype='JV'";
        $run_qry155 = mysqli_query($connect, $qry155);
        $row155=mysqli_fetch_array($run_qry155);

        $dates2 = $row154['dated'];
      $rundatees = $dates2;
      $dats= date_create($rundatees);
      $dated1s=date_format($dats,"d-m-Y");
?>
    <h4 style="margin-left: 10px;"> Debit: &nbsp;&nbsp;<?php echo $draccname; ?></h4>
 <br>
    <h5 style="margin-left: 10px;"><?php echo $dated1s.' '.$row155['description']; ?></h5>

<?php
}
else{
    ?>
    <h4 style="margin-left: 10px;"> Debit: &nbsp;&nbsp;<?php echo $draccname; ?></h4>

    <?php
}

?>

<br>
<br>
<br>
<br>
<br>
<br>
    <div style="border-bottom: 1px solid black;"></div>
   <div style="display: inline-flex;" class="col-lg-12 col-md-12">
       <div style="margin-right: 170px;" class="col-4">
    <h3 >Verify</h3>
           
       </div>
       <div style="margin-right: 170px;" class="col-4">
    <h3 >Unpaid</h3>
           
       </div>
       <div class="col-3">
    <h3 >Paid</h3>
           
       </div>
   </div>
    
</div>
 </div>


</div>
<script src="plugins/common/common.min.js"></script>
    <script src="js/custom.min.js"></script>
    <script src="js/settings.js"></script>
    <script src="js/gleek.js"></script>
    <script src="js/styleSwitcher.js"></script>

    <!-- Chartjs -->
    <script src="./plugins/chart.js/Chart.bundle.min.js"></script>
    <!-- Circle progress -->
    <script src="./plugins/circle-progress/circle-progress.min.js"></script>
    <!-- Datamap -->
    <script src="./plugins/d3v3/index.js"></script>
    <script src="./plugins/topojson/topojson.min.js"></script>
    <script src="./plugins/datamaps/datamaps.world.min.js"></script>
    <!-- Morrisjs -->
    <script src="./plugins/raphael/raphael.min.js"></script>
    <script src="./plugins/morris/morris.min.js"></script>
    <!-- Pignose Calender -->
    <script src="./plugins/moment/moment.min.js"></script>
    <script src="./plugins/pg-calendar/js/pignose.calendar.min.js"></script>
    <!-- ChartistJS -->
    <script src="./plugins/chartist/js/chartist.min.js"></script>
    <script src="./plugins/chartist-plugin-tooltips/js/chartist-plugin-tooltip.min.js"></script>
    <script src="./js/dashboard/dashboard-1.js"></script>


<!-- Group Reg Table Script -->
    <script src="./plugins/tables/js/jquery.dataTables.min.js"></script>
    <script src="./plugins/tables/js/datatable/dataTables.bootstrap4.min.js"></script>
    <script src="./plugins/tables/js/datatable-init/datatable-basic.min.js"></script>

<script type="text/javascript">
    $(document).ready(function(e){
        
        $('#printbtn').click(function(){
            $('#printbtn').hide();
            $('#closebtn').hide();

              window.print();
        })

        $('#closebtn').click(function(){
       
              window.close();
        })

    });
</script>
</body>
