<?php
include("common/connection.php");


?>
<!doctype html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Operation | Buurtzorg</title>
  
    <?php include("headerlink.php"); ?>

     	<link rel="stylesheet" href="css/data-table/bootstrap-table.css">
    	<link rel="stylesheet" href="css/data-table/bootstrap-editable.css">
        
        
        <style>
	.table-scroll {
	position:relative;
	margin:auto;
	overflow:hidden;
	margin-top: 40px;
}
.table-wrap {
	width:100%;
	overflow:auto;
}
.table-scroll table {
	width:100%;
	margin:auto;
	border-collapse:separate;
	border-spacing:0;
}
.table-scroll th, .table-scroll td {
	padding:5px 10px;
	border:1px solid #ddd;
	background:#fff;
	white-space:nowrap;
	vertical-align:top;
}
.table-scroll thead, .table-scroll tfoot {
	background:#f9f9f9;
}
.clone {
	position:absolute;
	top:0;
	left:0;
	pointer-events:none;
}
.clone th, .clone td {
	visibility:hidden
}
.clone td, .clone th {
	border-color:transparent
}
.clone tbody th {
	visibility:visible;
	color:red;
}
.clone .fixed-side {
	border:1px solid #ddd;
	background:#fff;
	visibility:visible;
}
.clone thead, .clone tfoot{background:transparent;}
		</style>
</head>

<body>
   
    
    <?php include("left-menu.php"); ?>
    
    
    
    <!-- End Left menu area -->
    <!-- Start Welcome area -->
    <div class="all-content-wrapper">
        
        
       <?php include("header-menu.php"); ?> 
        
        
        <!-- Static Table Start -->
    
            <div class="container-fluid">
                <div class="row">
                
                
                
                
                    
                    <div class="col-lg-12 col-md-6 col-sm-6 col-xs-12" >
                        <div class="sparkline9-list mt-b-30 res-mg-t-30 analysis-progrebar-ctn">
                        
                        
                        
                        
                        
                            <div class="sparkline9-hd">
                                <div class="main-sparkline9-hd">
                                    <h1>Physiotherapy Operational Report <?php echo date('F Y',Strtotime('m')) ?> </h1>
                                </div>
                            </div>
                            
                            
                            <div  id="table-scroll" class="table-scroll">
                                <div class="table-wrap">
                                   <form method="post">
			    <div class="row" style="margin:0px;">
			
														 
				<select name="post_year" class="form-control" id="post_year" style="width:130px; float:left; margin-top: 10px; margin-left:10px;">
														<option value="">Select Year</option>
														<option value="2021">2021</option>
														<option value="2022">2022</option>
														<option value="2023">2023</option>
														<option value="2024">2024</option>
														<option value="2025">2025</option>
														<option value="2026">2026</option>
													
														 </select>
														 
				<select name="post_month" class="form-control" id="post_month" style="width:130px; float:left; margin-top: 10px;  margin-left:10px;">
														<option value="">Select Month</option>
														<option value="1">Jan</option>
														<option value="2">Feb</option>
														<option value="3">Mar</option>
														<option value="4">Apr</option>
														<option value="5">May</option>
														<option value="6">Jun</option>
														<option value="7">Jul</option>
														<option value="8">Aug</option>
														<option value="9">Sep</option>
														<option value="10">Oct</option>
														<option value="11">Nov</option>
														<option value="12">Dec</option>
													
														 </select>											 
														 
														 
			<input type="submit" name="submit" id="submit" value="submit" style="width:100px;height:38px; float:left; margin-top: 10px;margin-left:10px;">											 
				</div>										 
            </form>
                                    
 										

                                    <table id="Table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="false" data-key-events="true" data-show-toggle="false" data-resizable="true" data-cookie="true"
                                        data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar" class="textcenter table-striped">
                                        <thead>
                                        
                                            <tr align="center">
                                                <?php
												$date="1-".$_REQUEST['post_month']."-".$_REQUEST['post_year'];
												$first_day_this_month = date('Y-m-d', strtotime($date));
												
					                            $last_day_this_month  = date('Y-m-t', strtotime($date));
												?>
                                                <th class="fixed-side">Location</th>
												<th class="fixed-side">Sl No</th>
                                                <th class="fixed-side">Patient ID</th>
                                                <th class="fixed-side">Patient Name</th>
                                                <th class="fixed-side">Gender</th>
                                                <th>Physiotherapist</th>
                                                <th>Service Start Date</th>
												<?php
												for($d=$first_day_this_month;$d<=$last_day_this_month;$d++)
												{
												?>
                                                <th><?php echo date('d M Y',strtotime($d)); ?></th>
                                                <!--<th>2-Jan-21</th>
                                                <th>3-Jan-21</th>
                                                <th>4-Jan-21</th>
                                                <th>5-Jan-21</th>
                                                <th>6-Jan-21</th>
                                                <th>7-Jan-21</th>
                                                <th>8-Jan-21</th>
                                                <th>9-Jan-21</th>
                                                <th>10-Jan-21</th>
                                                <th>11-Jan-21</th>-->
                                                <?php 
												}
												?>
                                                
                                                
                                                
                                            </tr>
                                        </thead>
                                        <tbody>
                                       
                                        <?php
										
										if($_REQUEST['post_report']!="")
					{
					$condition.=" Control_Location='".$_REQUEST['post_report']."' and Month(Treatment_Service_Date)='".$_REQUEST['post_month']."' and Year(Treatment_Service_Date)='".$_REQUEST['post_year']."' and Active='0' group by Patient_Id";
					}
					else
					{
					$condition=" Month(Treatment_Service_Date)='".$_REQUEST['post_month']."' and Year(Treatment_Service_Date)='".$_REQUEST['post_year']."' group by Patient_Id";	
					}
					$roster_master_sql="select * from roster_master where {$condition}";
					$roster_master=mysqli_query($con,$roster_master_sql);
					if(mysqli_num_rows($roster_master)>0)
					{
										$i=1;
										while($fetch_patient=mysqli_fetch_array($roster_master))
										{
										$patient_name=mysqli_fetch_array(mysqli_query($con,"select Patient_Name,Gender,Lead_ID from patient_master where Patient_Id='".$fetch_patient['Patient_Id']."'"));	
										$employee=mysqli_fetch_array(mysqli_query($con,"select First_Name,Last_Name from employee_master where SLN='". $fetch_patient['TNA_Name']."'"));
										
										$patient_agreement=mysqli_fetch_array(mysqli_query($con,"select Start_Date,Service_Type from patient_agreement where Lead_ID='".$patient_name['Lead_ID']."'"));
										
										$Location=mysqli_fetch_array(mysqli_query($con,"select Location_Name from location_master where SLN='".$fetch_patient['Control_Location']."'"));
										
										if($patient_agreement['Service_Type']!=2 && $patient_agreement['Service_Type']!=3 && $patient_agreement['Service_Type']!=4 && $patient_agreement['Service_Type']!=7 && $patient_agreement['Service_Type']!=8 && $patient_agreement['Service_Type']!=9 && $patient_agreement['Service_Type']!=12 && $patient_agreement['Service_Type']!=13 && $patient_agreement['Service_Type']!=15 && $patient_agreement['Service_Type']!=16 && $patient_agreement['Service_Type']!=17 && $patient_agreement['Service_Type']!=18 && $patient_agreement['Service_Type']!=10)
										{
										?>
                                            <tr class="">
                                          
                                               <td class="fixed-side"><?php echo $Location['Location_Name'] ?></td>
                                               <td class="fixed-side"><?php echo $i; ?></td>
                                               <td class="fixed-side"><?php echo $patient_name['Lead_ID']; ?></td>
                                               <td class="fixed-side"><?php echo $patient_name['Patient_Name']; ?></td>
                                               <td class="fixed-side"><?php echo $patient_name['Gender']; ?></td>
                                               <td><?php echo $employee['First_Name']." ".$employee['Last_Name']; ?></td>
                                               <td><?php echo $patient_agreement['Start_Date']; ?></td>
											   <?php
											   for($t=$first_day_this_month;$t<=$last_day_this_month;$t++)
										{
											$count=mysqli_num_rows(mysqli_query($con,"select Number_Of_Working_Hour from roster_master where Patient_Id='".$fetch_patient['Patient_Id']."' and Treatment_Service_Date='".$t."'"));	
											   ?>
                                               <td><?php echo $count; ?></td>
                                               <!--<td></td>
                                               <td></td>
                                               <td></td>
                                               <td></td>
                                               <td></td>
                                               <td></td>
                                               <td></td>
                                               <td></td>
                                               <td></td>
                                                <td></td>-->
                                             <?php
										}
											?>
                                               
                                            </tr>
                                         <?php
										 $i++;
										}
										}
										
					}
					
					else
					{
						?>
						<tr><td>No Data Found</td></tr>
						<?php
					}
										 ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                
            </div>
        </div>
        <!-- Static Table End -->
        <div class="footer-copyright-area">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="footer-copy-right">
                            <p>Copyright © 2019. All rights reserved.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- jquery
		============================================ -->
    <script src="js/vendor/jquery-1.12.4.min.js"></script>
    <!-- bootstrap JS
		============================================ -->
    <script src="js/bootstrap.min.js"></script>
    <!-- wow JS
		============================================ -->
    <script src="js/wow.min.js"></script>
    <!-- price-slider JS
		============================================ -->
    <script src="js/jquery-price-slider.js"></script>
    <!-- meanmenu JS
		============================================ -->
    <script src="js/jquery.meanmenu.js"></script>
    <!-- owl.carousel JS
		============================================ -->
    <script src="js/owl.carousel.min.js"></script>
    <!-- sticky JS
		============================================ -->
    <script src="js/jquery.sticky.js"></script>
    <!-- scrollUp JS
		============================================ -->
    <script src="js/jquery.scrollUp.min.js"></script>
    
    
    
    <!-- datepicker JS
		============================================ -->
    <script src="js/datepicker/jquery-ui.min.js"></script>
    <script src="js/datepicker/datepicker-active.js"></script>
    
    
    
    <!-- data table JS
		============================================ -->
    <script src="js/data-table/bootstrap-table.js"></script>
    <script src="js/data-table/tableExport.js"></script>
    <script src="js/data-table/data-table-active.js"></script>
    <script src="js/data-table/bootstrap-table-editable.js"></script>
    <script src="js/data-table/bootstrap-editable.js"></script>
    <script src="js/data-table/bootstrap-table-resizable.js"></script>
    <script src="js/data-table/colResizable-1.5.source.js"></script>
    <script src="js/data-table/bootstrap-table-export.js"></script>
    
    
    
    <!-- mCustomScrollbar JS
		============================================ -->
    <script src="js/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="js/scrollbar/mCustomScrollbar-active.js"></script>
    <!-- metisMenu JS
		============================================ -->
    <script src="js/metisMenu/metisMenu.min.js"></script>
    <script src="js/metisMenu/metisMenu-active.js"></script>
    <!-- peity JS
		============================================ -->
    <script src="js/peity/jquery.peity.min.js"></script>
    <script src="js/peity/peity-active.js"></script>
    <!-- sparkline JS
		============================================ -->
    <script src="js/sparkline/jquery.sparkline.min.js"></script>
    <script src="js/sparkline/sparkline-active.js"></script>
    <!-- tab JS
		============================================ -->
    <script src="js/tab.js"></script>
    <!-- plugins JS
		============================================ -->
    <script src="js/plugins.js"></script>
    <!-- main JS
		============================================ -->
    <script src="js/main.js"></script>
    <!-- tawk chat JS
		============================================ -->
        
         <script>
$(document).ready(function() {
   $("body").tooltip({ 
   	selector: '[data-toggle=tooltip]' 
	 });
});
 
</script>
<!------------------------Fancybox---------------------------------->
 
 <script type="text/javascript" src="lib/jquery.mousewheel.pack.js"></script>

<script type="text/javascript" src="source/jquery.fancybox.pack.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css" media="screen" />

<style type="text/css">
	.fancybox-custom .fancybox-skin {
		box-shadow: 0 0 50px #222;
	}
</style> 
<script>
$(document).ready(function() {
	$(".various").fancybox({
		maxWidth	: 380,
		maxHeight	: 410,
		fitToView	: true,
		width		: '100%',
		height		: '100%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none',
		
		
		
		
	});
	
 
});

</script>
<script>
jQuery(document).ready(function() {
   jQuery(".main-table").clone(true).appendTo('#table-scroll').addClass('clone');   
 });
</script>
<!--    <script src="js/tawk-chat.js"></script>-->
</body>

</html>