<?php
$permission  		= explode(',',$_SESSION['permission_id']);
$sub_permission  	= explode(',',$_SESSION['sub_permission_id']);
if(!in_array(3,$permission) && !in_array(1,$permission)  ){

?>
<script>
window.location="starter.php";
</script>
<?php
}
?>
<style >
	tfoot {
    display: table-header-group !important;
	}

	.dataTable {
        font-size: 11.5px;
	}

	.thumb img:not(.media-preview) {
    height: 100px;
}

</style>

	
	<div id="loader_modal" class="modal fade" style="display: none;">
		<div class="modal-dialog modal-lg">
				<div class="modal-content">
					
					
					<div class="modal-body" >
						<h1>
							
							<i class="icon-spinner3 spinner position-left" style="font-size: 40px;"></i>
							<span id="loader_msg"></span>
						</h1>	
					</div>
				
					
				</div>
		</div>
	</div>
	


	<div class="row">
										
		<div class="col-sm-6 col-md-12">
			<div class="panel panel-body">
				<div class="media no-margin">
					<div class="media-body">
						<div class="col-sm-12">
							<h1 class="bg-info text-center">Report Options</h1>
						</div>
						<div class="col-sm-4">
								<label> First Date</label>
							
								<input class="form-control" type="date" name="first_date" id="first_date">

						</div>

						<div class="col-sm-4">
							<label> Second Date</label>
							
							<input class="form-control" type="date" name="second_date" id="second_date">
					
						</div>


						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">City</label>
							<select name="city_id" id="city_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>
						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Zone</label>
							<select name="zone_id" id="zone_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>
						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Sub-Zone</label>
							<select name="sub_zone_id" id="sub_zone_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>
						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Quarter</label>
							<select name="quarter_id" id="quarter_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>
						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Street</label>
							<select name="street_id" id="street_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<?php if($_SESSION['profile_type'] > 0){ ?>
						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Category</label>
							<select name="category_id" id="category_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Supervisor</label>
							<select name="supervisor_id" id="supervisor_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Team-Leader</label>
							<select name="teamleader_id" id="teamleader_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Salesman</label>
							<select name="saleman_id" id="saleman_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Doctor</label>
							<select name="doctor_id" id="doctor_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Pharmacy</label>
							<select name="pharmacy_id" id="pharmacy_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>


						

						<div class="form-group form-group-material1 col-sm-4" >

							<label class="control-label animate">Products</label>
							<select name="product_id" id="product_id" class="form-control"  data-live-search="true">
								
							</select>
						</div>

					<?php } ?>
						
					</div>

					<div class="row">

						

						<?php if(in_array(1,$sub_permission)  ){ ?>


						<div class="col-sm-3" style="margin-top: 10px;">

						
							<button id="product_filter_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter" class="multi_lang">
								تقرير عن المواد في تقارير المندوبين
							</span> </button>
							
						</div>

						<?php } ?>
						<?php if(in_array(2,$sub_permission)  ){ ?>

						<div class="col-sm-3" style="margin-top: 10px;">

							<button id="offer_doctor_filter_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter" class="multi_lang">
							تقرير عن العروض المقدمة للاطباء
						</span> </button>
							
						</div>
						<?php } ?>
						<?php if(in_array(3,$sub_permission)  ){ ?>
						
						<div class="col-sm-3" style="margin-top: 10px;">

							<button id="product_by_ordered_qty_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter" class="multi_lang">
							تقرير عن الكمية التي تم طلبها لكل مادة
						</span> </button>
							
						</div>
						<?php } ?>
						<?php if(in_array(4,$sub_permission)  ){ ?>
						
						<div class="col-sm-3" style="margin-top: 10px;">

							<button id="saleman_visit_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter" class="multi_lang">
							تقرير عن زيارات المندوبين
						</span> </button>
							
						</div>
						<?php } ?>
						<?php if(in_array(5,$sub_permission)  ){ ?>
						
						<div class="col-sm-3" style="margin-top: 10px;">

							<button id="total_saleman_visit_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">
							تقرير عن مجمل زيارات كل مندوب
						</span> </button>
							
						</div>
						<?php } ?>

						<!-- <div class="col-sm-3" style="margin-top: 10px;">

							<button id="saleman_cover_ratio_btn" type="button" class="btn bg-teal-400 btn-labeled btn-block"><b><i class="icon-filter4"> </i></b> <span id="inv_filter">نسبة تغطية المندوبين للاطباء</span> </button>
							
						</div> -->

						

						

						<div class="col-sm-3" style="margin-top: 10px;">

							

							<a href="index.php?p=report"  class="btn bg-pink-400 btn-labeled btn-block"><b><i class="icon-close2"> </i></b> <span id="inv_filter">ازالة الفلتر</span> </a>
							
						</div>

						



					</div>

					
				</div>
			</div>
		</div>
		
	</div>




	


	<!-- Individual column searching (text inputs) -->
	<div class="panel panel-flat">
		
		<table id="table1"  class="table datatable-column-search-inputs table-bordered ">
			
			
		</table>


		<table id="table2" style="display: none;" class="table datatable-column-search-inputs table-bordered ">
			<thead>
				<tr class="bg-blue-300">
	        		<th>ID</th>
					<th class="multi_lang">Bill No.</th>
					<th class="multi_lang">Amount</th>
					<th class="multi_lang">Date</th>
					<th class="multi_lang">Transaction</th>
					<th class="multi_lang">Type</th>
					<th class="multi_lang">Staff</th>
					<th class="multi_lang"> Branch </th>
					<th class="multi_lang"> Note </th>
	        		<!-- <th class="multi_lang" width="10%">Action</th> -->
	      		</tr>
			</thead>
			<tbody id="table_report_safe">
				
			</tbody>
			<tfoot>
				<tr class="alpha-info">
	                <td></td>
	                <td class="multi_lang">Total In to Safe</td>
	                <td id="total_in"></td>
	               	<td class="multi_lang">Total Out from Safe</td>
	                <td id="total_out"></td>
	                
	                <td></td>
	                <td></td>
	                <td></td>
	                <td></td>
	                <!-- <td></td> -->
	                
	                
	            </tr>
			</tfoot>
		</table>
	</div>
	<!-- /individual column searching (text inputs) -->



<script type="text/javascript" src="controllers/report.js?random=<?php echo uniqid(); ?>"></script>