<?php include "layouts/menu.php"; ?>
		<script type="text/javascript">
	  $(function() {
   $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' });
  });
</script>
<script type="text/javascript">
function zp(n){
return n<10?("0"+n):n;
}
function insertDate(t,format){
var now=new Date();
var DD=zp(now.getDate());
var MM=zp(now.getMonth()+1);
var YYYY=now.getFullYear();
format=format.replace(/DD/,DD);
format=format.replace(/MM/,MM);
format=format.replace(/YYYY/,YYYY);
t.value=format;
}
</script>
    <script>
  $(function() {
   $("#datepicker1").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
   <script type="text/javascript">

    function PrintElem(elem)
    {
        Popup($(elem).html());
    }

    function Popup(data) 
    {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        mywindow.document.write('<html><head><title>INFOSSEL SOFT SOLUTIONS</title>');
        /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
        mywindow.document.write(' <h1 style="color:green;text-align:center;" >INFOSSEL SOFT SOLUTIONS</h1><body >');
        mywindow.document.write(data);
        mywindow.document.write('<h3 style="text-align:right;">Signed by</h3><h3 style="color:blue;text-align:right;">For INFOSSEL SOFT SOLUTIONS</h3></body></html>');

        mywindow.print();
        mywindow.close();

        return true;
    }

</script>
    <script>
  $(function() {
   $("#datepicker2").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
      <script>
  $(function() {
   $("#datepicker8").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
    <script>
  $(function() {
   $("#datepicker9").datepicker({ dateFormat: 'dd-mm-yy' });
  });
  </script>
   <script type="text/javascript">
function CollapseForm()
{
// Two places to customize:

// Specify the id of the form.
var IDofForm = "form1";

// Specify the id of the div containing the form.
var IDofDivWithForm = "demo";

// This line submits the form. (If Ajax processed, call Ajax function, instead.)
document.getElementById(IDofForm).submit();

// This line collapses the form.
document.getElementById(IDofDivWithForm).style.display = "none";
}
</script>
     
<?php include "layouts/menu1.php"; ?>
            <!-- Right side column. Contains the navbar and content of the page -->
           <div class="right_col" role="main">
                <!-- Content Header (Page header) -->
 
                   <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>User Report <small>Activity report</small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
    <form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
 <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Name</label>
    <div class="col-sm-4">
      <select type="text" class="form-control" id="inputPassword3" name="name" value="" placeholder="">
	  <option>Select</option>
	  <?php $qry=mysqli_query($conn, "select * from customer");
	  while($row2=mysqli_fetch_array($qry))
						{ ?>
						<option><?php echo $row2['name'];?></option> <?php } ?></select> 
    </div>
  </div>	   
	<div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">From</label>
    <div class="col-sm-4">
    <input type="date" class="form-control" id="datepicker" name="fdate" value="<?php echo date('01-m-Y'); ?>" placeholder="DD/MM/YYYY" onfocus="insertDate(this,'DD-MM-YYYY')">
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">To</label>
    <div class="col-sm-4">
    <input type="date" class="form-control" id="datepicker" name="tdate" value="<?php echo date('t-m-Y'); ?>" placeholder="DD/MM/YYYY" onfocus="insertDate(this,'DD-MM-YYYY')">
    </div>
  </div>
			<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-success" name="s129">Goto</button>
    </div>
  </div></div>
    <?php
								if(isset($_POST['s129']))
								{
									extract($_POST);
									$nna = $name;
									$ffdate= $fdate; $tdy = date("d-m-Y");
								$staff111 = $name;
								$qry50 = mysqli_query($conn, "select * from customer where name='$staff111'"); 
	$row50 = mysqli_fetch_array($qry50);
	$staff11 = $row50['code'];
	$qry235=mysqli_query($conn, "select * from user where scode='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$totrcpt=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from userw where scode='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$totrcptw=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from userm where scode='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$totrcptm=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from user where altby='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$totrcptalt=mysqli_num_rows($qry235);
	$qry235=mysqli_query($conn, "select * from net where scode='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$net=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from net where altby='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$netalt=mysqli_num_rows($qry235);
	$qry235=mysqli_query($conn, "select * from customerdetails where scode='$staff11' && hpdate5 between '$fdate' and '$tdate'"); 
$cust=mysqli_num_rows($qry235);
	$qry235=mysqli_query($conn, "select * from customerdetailsw where scode='$staff11' && hpdate5 between '$fdate' and '$tdate'"); 
$custw=mysqli_num_rows($qry235);
	$qry235=mysqli_query($conn, "select * from customerdetailsm where scode='$staff11' && hpdate5 between '$fdate' and '$tdate'"); 
$custm=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from customerdetails where altby='$staff11' && hpdate5 between '$fdate' and '$tdate'"); 
$custalt=mysqli_num_rows($qry235);
	$qry235=mysqli_query($conn, "select * from entry where scode='$staff11' && hpdate5 between '$fdate' and '$tdate'"); 
$hloan=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from otherentry where scode='$staff11' && postdate2 between '$fdate' and '$tdate'"); 
$oentry=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from cancel where cby='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$can1=mysqli_num_rows($qry235);
$qry235=mysqli_query($conn, "select * from cancels where cby='$staff11' && paydate2 between '$fdate' and '$tdate'"); 
$can2=mysqli_num_rows($qry235);


								 ?>
					</br>				 
<input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;">
					<div id="mydiv">
<div class="x_content">
                    <div class="col-md-3 col-sm-3 col-xs-12 profile_left">
                      <div class="profile_img">
                        <div id="crop-avatar">
                          <!-- Current avatar -->
                          <img class="img-responsive avatar-view" src="user/<?php echo $row50['uimg']; ?>" alt="Avatar" title="Change the avatar">
                        </div>
                      </div>
                      <h3><?php echo $row50['name']; ?> - <?php echo $row50['code']; ?></h3>

                      <ul class="list-unstyled user_data">
					  <li>
                          <i class="fa fa-briefcase user-profile-icon"></i> <?php echo $row50['fname']; ?>
                        </li>
                        <li><i class="fa fa-map-marker user-profile-icon"></i> <?php echo $row50['id']; ?>
                        </li>
<li>
                          <i class="fa fa-briefcase user-profile-icon"></i> <?php echo $row50['mno']; ?>
                        </li>
                        <li>
                          <i class="fa fa-briefcase user-profile-icon"></i> <?php echo $row50['postt']; ?>
                        </li>

                        <li class="m-top-xs">
                          <i class="fa fa-external-link user-profile-icon"></i>
                          <a href="" target="_blank"> <?php echo $row50['mail']; ?></a>
                        </li>
                      </ul>

                      <a class="btn btn-success"><i class="fa fa-edit m-right-xs"></i>Edit Profile</a>
                      <br />

                      
                      <!-- end of skills -->

                    </div>
                    <div class="col-md-9 col-sm-9 col-xs-12">
<table class="table table-striped" table class="table" border="1" align="center" cellspacing="0" cellpadding="10" >
				<tr> <th>No of Entries</th><th>Value</th></tr>
				<tr><td>Document Entry Monthly - </td><td><?php echo $cust; ?></td></tr>
				<tr><td>Document Entry Weekly - </td><td><?php echo $custw; ?></td></tr>
				<tr><td>Document Entry 10Days - </td><td><?php echo $custm; ?></td></tr>
				<tr><td>Document Alter - </td><td><?php echo $custalt; ?></td></tr>
				<tr><td>Receipt Entry  Monthly- </td><td><?php echo $totrcpt; ?></td></tr>
				<tr><td>Receipt Entry  Weekly- </td><td><?php echo $totrcptw; ?></td></tr>
				<tr><td>Receipt Entry  10Days- </td><td><?php echo $totrcptm; ?></td></tr>
				<tr><td>Receipt Alter - </td><td><?php echo $totrcptalt; ?></td></tr>
				<tr><td>Receipt Cancel - </td><td><?php echo $can1; ?></td></tr>
				
				<tr><td>Preloan Entry - </td><td><?php echo $hloan; ?></td></tr>
				 </table>
                    </div>
                  </div>
<h4><b><?php echo $name; ?> Report - <?php $qsm = 0; $ij = 0;
$fdate = date("d-m-Y",strtotime($fdate)); $tdate = date("d-m-Y",strtotime($tdate));
 echo $fdate; ?> To <?php echo $tdate; ?></b></h4>

									<?php $i5 = 1; $a = 0; $h = 0; $p = 0; $tot = 0; $dde = 0;
									$p12h = 0; $p1h = 0; $p2h = 0; $p3h = 0; $p4h = 0;
$qry3=mysqli_query($conn, "select * from customer");
while($row3=mysqli_fetch_array($qry3))
						{ $ij++;
							$qqw = $row3['name'];
							if($qqw == $nna){
								$qsm = $ij;
							}
							$i++;
						 } $as = "as".$qsm.""; 
								while (strtotime($fdate) <= strtotime($tdate)) 
								{
									$paydate = $fdate;
					$qryy=mysqli_query($conn, "select * from attt where  date='$paydate'");
				
                ?>
					
								<?php 		while($roww=mysqli_fetch_array($qryy))
						{ ?>
					
				<?php $dde++;
                           
						$ax1 = $roww[$as]; 
						if($ax1 == 'p')
						{
						$p = $p + 1; ?>
						<?php }
						
						elseif($ax1 == 'a')
						{ $a = $a + 1; ?>
						 <?php }
						 
						  elseif($ax1 == 'h')
						{ $h = $h + 1; ?>
						<?php }
						  elseif($ax1 == 'P1/2H')
						{ $p12h = $p12h + 1; ?>
						<?php }
						elseif($ax1 == 'P1H')
						{ $p1h = $p1h + 1; ?>
						<?php }
						elseif($ax1 == 'P2H')
						{ $p2h = $p2h + 1; ?>
						<?php }
						elseif($ax1 == 'P3H')
						{ $p3h = $p3h + 1; ?>
						<?php }
						elseif($ax1 == 'P4H')
						{ $p4h = $p4h + 1; ?>
						<?php }
												  ?>
				
					
					<?php } ?>				
					 <?php
						 
									
									$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate))); 
									}
?>
						</br>
				 <?php $tott = $p + ($h / 2) + $p12h + $p1h + $p2h + $p3h + ($p4h/2); 
				 $subb = $dde - $tott;
				 ?> 
			<table class="table table-striped" table class="table" border="1" align="center" cellspacing="0" cellpadding="10" >
				<tr> <th>Content</th><th>Value</th></tr>
				<tr><td>No of Working Days - </td><td><?php echo $dde; ?></td></tr>
				<tr><td>Attendance - </td><td><?php echo $tott; ?></td></tr>
				<tr><td>Leave - </td><td><?php echo $subb; ?></td></tr>
				<tr><td>Permission 1/2 Hour - </td><td><?php echo $p12h; ?></td></tr>
				<tr><td>Permission 1 Hour - </td><td><?php echo $p1h; ?></td></tr>
				<tr><td>Permission 2 Hour - </td><td><?php echo $p2h; ?></td></tr>
				<tr><td>Permission 3 Hour - </td><td><?php echo $p3h; ?></td></tr>
				<tr><td>Permission 4 Hour - </td><td><?php echo $p4h; ?></td></tr>
				<?php $ttp = ($p12h/2) + $p1h + ($p2h*2) + ($p3h*3) + ($p4h*4); ?>
				<tr><td>Total Permission Hour - </td><td><?php echo $ttp; ?></td></tr>	
				 </table><?php
					 
									 ?>
<table class="table table-striped" table class="table" border="1" align="center" cellspacing="0" cellpadding="10" >
					 
                                        <thead>
                                            <tr>
												<th>Date</th>
												<th>Amount</th>
												<th>Cat</th>
												<th>Details</th>
												
                                            </tr>
                                        </thead>
										<?php
$fdate = $ffdate; 
										while (strtotime($fdate) <= strtotime($tdate)) 
								{ 
							 $paydate = $fdate;
							$qry22=mysqli_query($conn, "select * from salary where mfin='$mfin' &&  date='$paydate' && name='$name'");
					while($row2=mysqli_fetch_array($qry22))
					{ 
					?>
                                        <tbody>
                                           <tr><col width="100px">
                                               <td><?php echo $row2['date'];?></td>
						<td><?php echo $row2['debit']; ?></td><td><?php echo $row2['cat']; ?></td>
						<td><?php echo $row2['details']; ?></td>
						
                                            </tr>
                                          </tbody>
                                        <?php

								} 
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate))); 
								}
				
					?>
					                    
                                    </table>		
                <?php
									}
					
				
					?>
						</form> </DIV>
                                  	
                                </div><!-- /.box-body -->
                            </div><!-- /.box -->
                        </div>
                    </div>

        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
       <?php include "layouts/footer.php"; ?>

    </body>
</html>