HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/public_html/manage.beatleanalytics.com/site/template/shift.php 28-1-2019
<script>
	$(document).ready(function(){
		$("#FromDate").datepicker({format:'dd-mm-yyyy'});
		$("#ToDate").datepicker({format:'dd-mm-yyyy'});
	});

	function validateDate(){

		var D1 = document.getElementById("ToDate");
		var D2 = document.getElementById("FromDate");

		if(D1.value.trim() == ""){
			D1.style.border = "1px solid red";
			return false;
		}

		if(D2.value.trim() == ""){
			D2.style.border = "1px solid red";
			return false;
		}
	}	

</script>


<?php
	// Declare new object
$objShift = object;

	// Assing object 
$objShift = $objDB->objController;

	// Assign all variable's value
$pg 			= $objShift->pg;
$acn 			= $objShift->acn;
$v 				= $objShift->v;
$State 			= $objShift->State;
$ReligionName 	= $objShift->ReligionName;
$sort			= $objShift->sort;
$ReligionID		= $objShift->ReligionID;
$field			= $objShift->field;
$error 			= $objShift->error;
$msg 			= $objShift->msg;
$perpage 		= $objShift->perpage;
$start	 		= $objShift->start;
$limit	 		= $objShift->limit;
$SearchValue	= $objShift->SearchValue;
$s				= $objShift->s;

$CustomerID		= $objShift->CustomerID;
$SurveyID		= $objShift->SurveyID;
$TokenID		= $objShift->TokenID;
$pType			= $objShift->pType;

$OrgID			= $objShift->OrgID;
$BranchID		= $objShift->BranchID;
$IndustryID		= $objShift->IndustryID;
$FromDate 		= $objShift->FromDate;
$ToDate 		= $objShift->ToDate;


$valck[] = array();


$rsCustomerInfo = $objShift->FetchCustomerData();

//$rsShifts		= $objShift->fetchShiftDataById();

//echo($uInfo___[0]['db_pagepermistion']);
//die();
$rsPerm = explode(",",$uInfo___[0]['db_pagepermistion']);
if (!in_array('shift', $rsPerm)) {
  ReturnPostFormData($ValidateArr = array(),"error.html","<span class='error-msg'>this page details does not exist in <strong>".$pg."</strong> file !</span>",2);
}

?>

<div class="content-wrapper cust_hight normal_report">

	<?php

	if( strtolower($v)=='add'|| strtolower($v)=='edit')
	{} 

else if($v=='list'){  ?>


	<?php
	// Error or success message display
	$objDB->NotificaitonForResult($msg,$error);
	
	$objShift->setDefineValue();
	
	
	?>


	<!--Fetching Data loder---->
	<div class="loader head_loader" style="display:none;">
		<div class="sk-double-bounce" style="margin-bottom:10px; margin-top:10px;">
			<div class="sk-child sk-double-bounce1"></div>
			<div class="sk-child sk-double-bounce2"></div>
		</div>			
		<h3 style="text-align: center;  margin-top: 0px; padding-top: 0px;">Fetching Data...</h3>	 
	</div>

	<section class="content">
		<div class="row">
			<div class="col-md-12">
				<div class="box box-primary">
					<div class="box-header">
						<div class="col-md-12 col-xs-12 no-padding">  	

							<?php if(empty($CustomerID) && empty($SurveyID)) {
								$rsPagesIDS = IndustryPageIDS($pType,$BranchID,$IndustryID); ?>
								<div class="row">
									<div class="col-md-12">
										<form method="post" action="shift.html" name="frmSearch" id="frmSearch">
											<input type="hidden" name="start" id="start" value="<?php echo $start?>" />
											<input type="hidden" name="perpage" id="perpage" value="<?php echo $perpage?>" />


											<div class=" col-xs-3 col-sm-2 col-md-1 col-lg-1 pull-left form-group no-padding ">
												<a class="btn btn-info btn-sm" href="dashboardma.html"> <i class="fa fa-long-arrow-left"></i> Back </a>
												</div>


											<div class=" col-xs-12 col-md-3 col-lg-2 form-group">
												<?php $rsOrganization = $objShift->fetchOrganization(); ?>
												<!--<span id="span_select" style="width:120pf; height:35px; float:right;">-->
													<select class="form-control input-md" id="org_list" onchange="javascript: getBranchData(this.value)" name="Organization">
														<option value="0">Select Organization</option> 
														<?php if(count($rsOrganization) > 0) { ?>
															<option style="font-weight:bold;" <?php if(!empty($OrgID)) echo 'selected="selected"'; ?>  value="<?php echo $rsOrganization[0]['OrgId']?>"><?php echo $rsOrganization[0]['db_Orgname']?></option>
														<?php  }else{ ?>
															<option value="0">No any org. found</option>
														<?php  } ?>
													</select>
													<!--</span>-->
												</div>

												<script>
													function getBranchData(orgid){

														var xhttp = new XMLHttpRequest();
														xhttp.onreadystatechange = function() {
															if (xhttp.readyState == 4 && xhttp.status == 200) {
																document.getElementById("branch_list").innerHTML = xhttp.responseText;
															}
														};
														xhttp.open("GET", "runajax.php?acn=FetchBranchDetails&orgid="+orgid, true);
														xhttp.send();
													}

													function FetchIndustryDetails(branchid){

														var xhttpI = new XMLHttpRequest();
														xhttpI.onreadystatechange = function() {
															if (xhttpI.readyState == 4 && xhttpI.status == 200) {
																document.getElementById("industry_list").innerHTML = xhttpI.responseText;
															}
														};
														xhttpI.open("GET", "runajax.php?acn=FetchIndustryDetails&branchid="+branchid, true);
														xhttpI.send();
													}


												</script>



												<div class="col-xs-12 col-md-3 col-lg-2 form-group" id="branch_list" >

													<?php $rsBranches = $objShift->fetchBranches();  ?>
													<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
														<select class="form-control input-md" name="Branches" onchange="javascript: getBranchData(this.value)">
															<option value="0"> Select Branch </option> 
															<?php if(count($rsBranches) > 0) { for($b=0; $b<count($rsBranches); $b++) { ?>
																<option <?php if($BranchID === $rsBranches[$b]['branchId']) echo 'selected="selected"'; ?> value="<?php echo $rsBranches[$b]['branchId']?>"><?php echo $rsBranches[$b]['db_branchName']?></option>
															<?php }
														}else{ ?>
															<option value="0">No any branch found</option>
														<?php } ?>
													</select>
												</div>

												<div class="col-xs-12 col-md-3 col-lg-2 form-group" id="industry_list">
													<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
														<?php $rsIndustrys = $objShift->fetchIndustrys($OrgID,$BranchID,$IndustryID);  ?>
														<select class="form-control input-md" id="state_list" name="Industrys">
															<option value="0"> All Report </option> 
															<?php if(count($rsIndustrys) > 0) { for($b=0; $b<count($rsIndustrys); $b++) { ?>
																<option <?php if($IndustryID === $rsIndustrys[$b]['IndId']) echo 'selected="selected"'; ?> value="<?php echo $rsIndustrys[$b]['IndId']?>"><?php echo $rsIndustrys[$b]['db_industry']?></option>

															<?php }

														}else{ ?>
															<option value="0">No Data Found</option>
														<?php } ?>

													</select>
												</div>

												<div class="col-xs-6 col-sm-2 col-md-2 col-lg-1 pull-right text-right form-group ">
													<a class="btn btn-sm btn-danger pull-left text-left "  href="shift.html"> <i class="fa fa-refresh"></i> Reset  </a>
												</div>

												<div class="col-xs-6 col-sm-2 col-md-2 col-lg-1 pull-right text-right">

													<div class="input-group input-group-sm pull-right text-right">
														<!--<input type="text" id="s" name="s" placeholder="Search content here .." class="form-control" value=""> -->                      
														<span class="pull-right text-right form-group no-padding">
															<!--<button class="btn btn-block btn-success btn-md no-padding" type="submit"><i class="fa fa-search" aria-hidden="true"></i> &nbsp; GO !</button> -->
															<a class="btn btn-success btn-sm" onclick="myFunction()" href="#"> <i class="fa fa-search"></i> GO  </a>
															
															
															<script>

																function myFunction() {
																	$(".loader").show();
																	document.getElementById("frmSearch").submit();

																}
																$(window).bind("load", function() {
								//$(".loader").hide();
							});
						</script>
					</span>
						
					
				</div>        

			</div>
			
			
<!-- 			<div class="col-xs-6 col-sm-2 col-md-2 col-lg-1 pull-right text-right">
				<div class="input-group input-group-sm pull-right text-right">
					<span class="pull-right text-right form-group no-padding">
						<a class="btn btn-success btn-sm" onclick="myFunction()" href="#"> <i class="fa fa-search"></i>  All Report </a>
					</span>
				</div>
			</div> -->
			
			<div class="clearfix"></div>

			<div class="col-md-12 no-padding">

				<div class="col-md-2 col-xs-6 form-group">
					<input type="text" readonly="readonly" id="FromDate" name="FromDate" placeholder="Start date.." class="form-control input-md" value="<?php echo $FromDate;?>">
				</div>

				<div class="col-md-2 col-xs-6 form-group">
					<input type="text" readonly="readonly" id="ToDate" name="ToDate" placeholder="End date.." class="form-control input-md" value="<?php echo $ToDate;?>">
				</div>
				
				<button type="button" class="ex-download" onclick="tableToExcel('testTable', 'W3C Example Table')" value="">
				<i class="fa fa-file-excel-o" aria-hidden="true"></i> Download Excel  </button>



			</div>

		</div>
		<?php if($pType == 'question') { ?>
		<div class="col-md-12">
				

			</form>


		</div>


	<?php } ?>

	<?php if($pType == 'content') { ?>


	<?php } ?>
</div>


<div class="question">	

	<div class="row">
		<?php



		if(count($rsCustomerInfo) > 0 ) {
							//echo   pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v);  
		}

						//$rsPagesIDS = IndustryPageIDS($pType,$BranchID,$IndustryID);
		?>


		


		<div id="holder">





			<div class="col-md-12 " id="scroll--">
				<div  class="table-responsive-- table_download" id="propertyThumbnails--" >

					<?php if(!empty($OrgID) && !empty($BranchID) ){ ?>

						<?php //if($pType == 'content') {?>

							

							
							<?php //} else { ?>



							</div>
						</div> 



						


						<div class="col-md-12"  id="scroll----" >
							<div  class="table-responsive--" id="propertyThumbnails" >
							
							
								<table id="testTable" class="table table-bordered" style="width:100%">


									<?php if(count($rsPagesIDS) > 0) {?>



										<thead class="" >

										
										<tr>
											<th colspan="5" style="display:none;">
											<span><?php echo $objShift->FetchOrganizationName($OrgID);?></span> >  
											<span><?php echo $objShift->FetchBranchName($BranchID);?></span> > 
											<span><?php echo $objShift->FetchIndustryName($IndustryID);?></span><br>
											<span><?php echo $FromDate;?></span> to  <span><?php echo $ToDate;?></span>
											</th>	
										</tr>
										
										
											<tr>
												<th>Sr.No.</th>
												<th>Date</th>
												<th>Shift</th>
												<th>Overall scroll</th>
												<th>Total feedback</th>
												<th>Percentage</th>
											</tr>
								
								</thead>


								<tbody>
									
									<?php 
									$rsShifts		= $objShift->fetchShiftDataById();
									if(count($rsShifts)>0){

									if(count($rsCustomerInfo)>0 && count($rsShifts)>0){ 
										$arrDate = array();
										
										for ($i=0;$i< count($rsCustomerInfo);$i++){

											$arrDate[$i]["date"] = date("Y-m-d",strtotime($rsCustomerInfo[$i]['created_date']));
											$arrDate[$i]["tokenid"] = $rsCustomerInfo[$i]['tokenid'];

										 } 

										 $new_array = array();
										// loop the array
										foreach($arrDate as $key=>$value){
											// if the option/answer is already set to to question key 
											if(isset($new_array[$value['date']])){
											    // if question key is an array, push new option to that array
											    if(is_array($new_array[$value['date']])){
											        array_push($new_array[$value['date']], $value['tokenid']);
											    }else{
											        // convert question key to array with the old value and new option value
											        $new_array[$value['date']] = array($new_array[$value['date']],$value['tokenid']);
											    } 
											} 
											else{
											    // assing option as value to question key
											    $new_array[$value['date']] = $value['tokenid'];

											}
										}
											
										/*echo "<pre>";
										print_r($new_array);
										die();*/
										$q=1;
									foreach($new_array as $key=>$value){
											/*echo count($value);
											echo "<br>";*/

											if(count($value) > 1){
												//for ($k=0; $k < count($value); $k++) { ?> 
													
										<tr class="n_row">
										<td rowspan="4" class="r-span"><?php echo $q; ?></td>
										<td rowspan="4" class="r-span"><?php echo date("d/m/Y",strtotime($key)); ?></td>
										<td><span><?php echo $rsShifts[0]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[0]['shiftTo'];?></span></td>
										<?php //for ($k=0; $k < count($value); $k++) {?>
										
										
										<td><label id="overavg1__<?php echo $key;?>" name="Overall Avg."></td>
										<td><label id="feedcount1__<?php echo $key;?>" ></td>
										
											<?php 
											$finalScore1 = 0;
											$finalScore2 = 0;
											$finalScore3 = 0;
											$finalScore4 = 0;
											$feedCount1 = 0;
											$feedCount2 = 0;
											$feedCount3 = 0;
											$feedCount4 = 0;
											for ($k=0; $k < count($value); $k++) {
												
												?>
											
										<?php
										$rsPagesIDS_ = IndustryPageIDS('Content',$BranchID,$IndustryID);	
										$totalAvg1 = 0;
										$totalAvg2 = 0;
										$totalAvg3 = 0;
										$totalAvg4 = 0;
										foreach($rsPagesIDS_ as $val) {

										?>
										
											<?php  $rsPagesContent = $objShift->fetchPageListAll($val); 

											$avgSum1 = 0;
											$avgSum2 = 0;
											$avgSum3 = 0;
											$avgSum4 = 0;
											for($pgc=0;$pgc<count($rsPagesContent); $pgc++){ 

												$styBorder = '';
												if($pgc == count($rsPagesContent)-1){
													$styBorder = 'style="border-right:1px solid;"';
												}
												?>
												<?php 
												$avgVal1 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value[$k],$rsShifts[0]['shiftFrom'],$rsShifts[0]['shiftTo']);
												$avgVal2 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value[$k],$rsShifts[1]['shiftFrom'],$rsShifts[1]['shiftTo']);
												$avgVal3 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value[$k],$rsShifts[2]['shiftFrom'],$objShift->fetchShiftDataById()[2]['shiftTo']);
												$avgVal4 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value[$k],$rsShifts[3]['shiftFrom'],$objShift->fetchShiftDataById()[3]['shiftTo']);

												?>
												<?php //$avgName = $objShift->FetchContentName($avgVal,$rsPagesContent[$pgc]['pageConId']);?>
												<?php  
												$avgSum1 = $avgSum1 + $avgVal1;
												$avgSum2 = $avgSum2 + $avgVal2; //23
												$avgSum3 = $avgSum3 + $avgVal3;
												$avgSum4 = $avgSum4 + $avgVal4;
												
											} 
											/*echo "<pre>";
											echo count($rsPagesContent);*/
											$totalAvg1 += round($avgSum1/count($rsPagesContent),2);
											$totalAvg2 += round($avgSum2/count($rsPagesContent),2);
											$totalAvg3 += round($avgSum3/count($rsPagesContent),2);
											$totalAvg4 += round($avgSum4/count($rsPagesContent),2);
											
											
								  		} 
											$totalAvg1 = round($totalAvg1/count($rsPagesIDS_),2);
											$totalAvg2 = round($totalAvg2/count($rsPagesIDS_),2);
											$totalAvg3 = round($totalAvg3/count($rsPagesIDS_),2);
											$totalAvg4 = round($totalAvg4/count($rsPagesIDS_),2);
											// echo $totalAvg1.'<br>';
											if($totalAvg1 != "0"){
												$feedCount1++;
											}
											if($totalAvg2 != "0"){
												$feedCount2++;
											}
											if($totalAvg3 != "0"){
												$feedCount3++;
											}
											if($totalAvg4 != "0"){
												$feedCount4++;
											}
											$finalScore1 = $finalScore1 + $totalAvg1;
											$finalScore2 = $finalScore2 + $totalAvg2;
											$finalScore3 = $finalScore3 + $totalAvg3;
											$finalScore4 = $finalScore4 + $totalAvg4;
										}

										if($feedCount1 <= 7){
											$finalScore1 = round($finalScore1/7,2);
										}else{ 
											$finalScore1 = round($finalScore1/$feedCount1,2);
										}

										if($feedCount2 <= 20){
											$finalScore2 = round($finalScore2/20,2);
										}else{ 
											$finalScore2 = round($finalScore2/$feedCount2,2);
										}

										if($feedCount3 <= 20){
											$finalScore3 = round($finalScore3/20,2);
										}else{ 
											$finalScore3 = round($finalScore3/$feedCount3,2);
										}

										if($feedCount4 <= 3){
											$finalScore4 = round($finalScore4/3,2);
										}else{ 
											$finalScore4 = round($finalScore4/$feedCount4,2);
										}
										
										
										

										if($finalScore1 <= 2){										
											$span1 = '<span class="badge bg-red" >'.$finalScore1.'</span>';											
										}else{
											$span1 = '<span class="badge bg-green">'.$finalScore1.'</span>';
										}

										if($finalScore2 <= 2){
											$span2 = '<span class="badge bg-red" >'.$finalScore2.'</span>';	
										}else{
											$span2 = '<span class="badge bg-green">'.$finalScore2.'</span>';
										}

										if($finalScore3 <= 2){
											$span3 = '<span class="badge bg-red" >'.$finalScore3.'</span>';	
										}else{
											$span3 = '<span class="badge bg-green">'.$finalScore3.'</span>';
										}

										if($finalScore4 <= 2){
											$span4 = '<span class="badge bg-red" >'.$finalScore4.'</span>';	
										}else{
											$span4 = '<span class="badge bg-green">'.$finalScore4.'</span>';
										}
										
										?>
										
										<td><?php echo ($finalScore1 / 5)*100;?>%</td>

										
									</tr>
									
									<tr>
									
										<td><span><?php echo $rsShifts[1]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[1]['shiftTo'];?></span></td>
										<td><label id="overavg2__<?php echo $key;?>" name="Overall Avg."></td>
										<td><label id="feedcount2__<?php echo $key;?>" ></td>
										
										<td><?php echo ($finalScore2 / 5)*100;?>%</td>
										
									</tr>
									<tr>
								
										<td><span><?php echo $rsShifts[2]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[2]['shiftTo'];?></span></td>
										<td><label id="overavg3__<?php echo $key;?>" name="Overall Avg."></td>
										<td><label id="feedcount3__<?php echo $key;?>" ></td>
										<td><?php echo ($finalScore3 / 5)*100;?>%</td>
									</tr>
									<tr>
								
										<td><span><?php echo $rsShifts[3]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[3]['shiftTo'];?></span></td>
										<td><label id="overavg4__<?php echo $key;?>" name="Overall Avg."></td>
										<td><label id="feedcount4__<?php echo $key;?>" ></td>
										<td><?php echo ($finalScore4 / 5)*100;?>%</td>
									</tr>
										<script>
											$("#overavg1__<?php echo $key;?>").html('<?php echo $span1;?>');
											$("#overavg2__<?php echo $key;?>").html('<?php echo $span2;?>');
											$("#overavg3__<?php echo $key;?>").html('<?php echo $span3;?>');
											$("#overavg4__<?php echo $key;?>").html('<?php echo $span4;?>');

											$("#feedcount1__<?php echo $key;?>").html('<?php echo $feedCount1;?>');
											$("#feedcount2__<?php echo $key;?>").html('<?php echo $feedCount2;?>');
											$("#feedcount3__<?php echo $key;?>").html('<?php echo $feedCount3;?>');
											$("#feedcount4__<?php echo $key;?>").html('<?php echo $feedCount4;?>');
										</script> 
									
											<?php	//}
											}else{ ?>
												
													<tr class="n_row">
										<td rowspan="4" class="r-span"><?php echo $q; ?></td>
										<td rowspan="4" class="r-span"><?php echo date("d/m/Y",strtotime($key)); ?></td>
										<td><span><?php echo $rsShifts[0]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[0]['shiftTo'];?></span></td>
										<td><label id="overavg_<?php echo $q?>" name="Overall Avg."></td>
										
										<?php
									$rsPagesIDS_ = IndustryPageIDS('Content',$BranchID,$IndustryID);	
									$totalAvg1 = 0;
									$totalAvg2 = 0;
									$totalAvg3 = 0;
									$totalAvg4 = 0;

									$feedCount1 = 0;
									$feedCount2 = 0;
									$feedCount3 = 0;
									$feedCount4 = 0;

									foreach($rsPagesIDS_ as $val) {

										?>
										
											<?php  $rsPagesContent = $objShift->fetchPageListAll($val); 
										
											$avgSum1 = 0;
											$avgSum2 = 0;
											$avgSum3 = 0;
											$avgSum4 = 0;
											for($pgc=0;$pgc<count($rsPagesContent); $pgc++){ 

												$styBorder = '';
												if($pgc == count($rsPagesContent)-1){
													$styBorder = 'style="border-right:1px solid;"';
												}
												?>
												<?php 
												$avgVal1 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value,$rsShifts[0]['shiftFrom'],$rsShifts[0]['shiftTo']);
												$avgVal2 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value,$rsShifts[1]['shiftFrom'],$rsShifts[1]['shiftTo']);
												$avgVal3 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value,$rsShifts[2]['shiftFrom'],$rsShifts[2]['shiftTo']);
												$avgVal4 = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value,$rsShifts[3]['shiftFrom'],$rsShifts[3]['shiftTo']);
												?>
												<?php //$avgName = $objShift->FetchContentName($avgVal,$rsPagesContent[$pgc]['pageConId']);?>
												<?php  
												$avgSum1 = $avgSum1 + $avgVal1;
												$avgSum2 = $avgSum2 + $avgVal2;
												$avgSum3 = $avgSum3 + $avgVal3;
												$avgSum4 = $avgSum4 + $avgVal4;


											} 

											$totalAvg1 += round($avgSum1/count($rsPagesContent),2);
											$totalAvg2 += round($avgSum2/count($rsPagesContent),2);
											$totalAvg3 += round($avgSum3/count($rsPagesContent),2);
											$totalAvg4 += round($avgSum4/count($rsPagesContent),2);

										} 

										$totalAvg1 = round($totalAvg1/count($rsPagesIDS_),2);
										$totalAvg2 = round($totalAvg2/count($rsPagesIDS_),2);
										$totalAvg3 = round($totalAvg3/count($rsPagesIDS_),2);
										$totalAvg4 = round($totalAvg4/count($rsPagesIDS_),2);

											if($totalAvg1 != "0"){
												$feedCount1++;
											}
											if($totalAvg2 != "0"){
												$feedCount2++;
											}
											if($totalAvg3 != "0"){
												$feedCount3++;
											}
											if($totalAvg4 != "0"){
												$feedCount4++;
											}
												

										if($feedCount1 <= 7){
											$totalAvg1 = round($totalAvg1/7,2);
										}else{ 
											$totalAvg1 = round($totalAvg1/$feedCount1,2);
										}

										if($feedCount2 <= 20){
											$totalAvg2 = round($totalAvg2/20,2);
										}else{ 
											$totalAvg2 = round($totalAvg2/$feedCount2,2);
										}

										if($feedCount3 <= 20){
											$totalAvg3 = round($totalAvg3/20,2);
										}else{ 
											$totalAvg3 = round($totalAvg3/$feedCount3,2);
										}

										if($feedCount4 <= 3){
											$totalAvg4 = round($totalAvg4/3,2);
										}else{ 
											$totalAvg4 = round($totalAvg4/$feedCount4,2);
										}

										if($totalAvg1 <= 2){
											
											$span1 = '<span class="badge bg-red" >'.$totalAvg1.'</span>';
											
										}else{
											$span1 = '<span class="badge bg-green">'.$totalAvg1.'</span>';
										}

										if($totalAvg2 <= 2){
											
											$span2 = '<span class="badge bg-red" >'.$totalAvg2.'</span>';						
											
										}else{
											$span2 = '<span class="badge bg-green">'.$totalAvg2.'</span>';
										}

										if($totalAvg3 <= 2){
											
											$span3 = '<span class="badge bg-red" >'.$totalAvg3.'</span>';				
											
										}else{
											$span3 = '<span class="badge bg-green">'.$totalAvg3.'</span>';
										}
										
										if($totalAvg4 <= 2){
											
											$span4 = '<span class="badge bg-red" >'.$totalAvg4.'</span>';				
											
										}else{
											$span4 = '<span class="badge bg-green">'.$totalAvg4.'</span>';
										}

										?>
										<td><label id="feedcount1__<?php echo $q;?>" ></td>
										<td><?php echo ($totalAvg1 / 5)*100;?>%</td>
										
									</tr>
									<tr>
									
										<td><span><?php echo $rsShifts[1]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[1]['shiftTo'];?></span></td>
										<td><label id="overavg1_<?php echo $q?>" name="Overall Avg."></td>
										<td><label id="feedcount2__<?php echo $q;?>" ></td>
										<td><?php echo ($totalAvg2 / 5)*100;?>%</td>
										
									</tr>
									<tr>
								
										<td><span><?php echo $rsShifts[2]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[2]['shiftTo'];?></span></td>
										<td><label id="overavg2_<?php echo $q?>" name="Overall Avg."></td>
										<td><label id="feedcount3__<?php echo $q;?>" ></td>
										<td><?php echo ($totalAvg3 / 5)*100;?>%</td>
									</tr>

									<tr>
								
										<td><span><?php echo $rsShifts[3]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[3]['shiftTo'];?></span></td>
										<td><label id="overavg3_<?php echo $q?>" name="Overall Avg."></td>
										<td><label id="feedcount4__<?php echo $q;?>" ></td>
										<td><?php echo ($totalAvg4 / 5)*100;?>%</td>
									</tr>
										<script>
											$("#overavg_<?php echo $q?>").html('<?php echo $span1 ;?>');
											$("#overavg1_<?php echo $q?>").html('<?php echo $span2 ;?>');
											$("#overavg2_<?php echo $q?>").html('<?php echo $span3 ;?>');
											$("#overavg3_<?php echo $q?>").html('<?php echo $span4 ;?>');

											$("#feedcount1__<?php echo $q;?>").html('<?php echo $feedCount1;?>');
											$("#feedcount2__<?php echo $q;?>").html('<?php echo $feedCount2;?>');
											$("#feedcount3__<?php echo $q;?>").html('<?php echo $feedCount3;?>');
											$("#feedcount4__<?php echo $q;?>").html('<?php echo $feedCount4;?>');
											
										</script>
									
										<?php	}
										$q++;
										}
									}else{ ?>
											<tr>
												<td colspan="5" class="text-center">No data found.</td>
											</tr>
									<?php }

										}else{ ?>
											
												<tr>
													<td colspan="5" class="text-center">Sorry..! this industry has no shift report rights.</td>
												</tr>

											
										<?php } ?>
								</tbody>

								



								<tbody  class="question_fixed">
									<tr class="<?php echo $bgclass;?> " style="border-top:1px solid #000;">
                                        	
                                        </tr>


</form>

<?php //}else{
	?>
	<!--<tr class="altrow"> <td colspan="25" align="center" style="float: none;"> No record found. </td> </tr>-->

<?php// } ?>
</tbody>

<?php }else{ ?>

	<tbody>
		<tr>
			<td class="text-center">No data found.</td>
		</tr>

	</tbody>



<?php } ?>
</table>

<?php }?>

<?php }else{ ?>
</div>





</div>
<table class="table table-striped table-bordered" >
	<tbody>
		<tr>
			<!----search feedback----->  <td class="text-center"><img src="theme/black/images/searchfeedback4.jpg" style="width:100%;"></td>
		</tr>
	</tbody>
</table>





<?php }?>





<?php
if(count($rsCustomerInfo) > 0 ) {
	?>
	<?php 	//echo  pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v); ?>

	<?php
}
?>



<script type="text/javascript">
	$('.submitFeeback').click(function(){
						//alert("hola");
			$.ajax({
		      type: "POST",
		      url: "runajax.php",
		      data: {
		      	method:'deleteReviewFeedbackDetails',
		      	reviewid:'<?php echo $_SESSION['ReviewInfo']['reviewId'];?>'
		      },
		      cache: false,
		      success: function(data) {
		        
		        var val = [];
		        $('.feedback_checkbox:checked').each(function(i){
		          val[i] = $(this).val();
		          var tokenid = $(this).val();
		          var userId = $(this).attr('data-uid');
		          var date = $('#date_'+tokenid).attr('data-date');
		          var username = $('#username_'+tokenid).attr('data-username');
		          var avgrat = $('#avgrat_'+tokenid).attr('data-avgrat');
		          var feedback = $('#feedback_'+tokenid).attr('data-feedback');
		          //var date = $('#date_'+tokenid).attr('data-date');
		          //alert(userId+"\n"+date+"\n"+username+"\n"+avgrat+"\n"+feedback);

		          $.ajax({
				      type: "POST",
				      url: "runajax.php",
				      data: {
				      	method:'insertReviewFeedbackDetails',
				      	userId:userId,
				      	username:username,
				      	avgrat:avgrat,
				      	feedback:feedback,
				      	tokenid:tokenid,
				      	date:date,
				      	reviewid:'<?php echo $_SESSION['ReviewInfo']['reviewId'];?>'
				      },
				      cache: false,
				      success: function(data) {
				        //$('#loader_image').hide();
				        //alert(data);
				        //$("#row"+atteId).hide('500');
				        window.location = "restohotelinfo.html?rid=<?php echo $_SESSION['ReviewInfo']['reviewId'];?>&type=<?php echo $_SESSION['ReviewInfo']['reviewType'];?>";	
				        
				      }
				    });

		        });
		      }
		    });

		
	});
</script>


			</div>

		<?php } else{ ?>

			<?php
					//echo "<pre>";
					//print_r($rsCustomerInfo);
					//echo "</pre>";
			?>


		</div>
	</div>


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





<? } ?>  


</div>
</div>



</section>




</div>







<script>
	$.fn.dataTable.ext.type.detect.unshift(
		function ( d ) {
			return d === 'Low' || d === 'Medium' || d === 'High' ?
			'salary-grade' :
			null;
		}
		);

	$.fn.dataTable.ext.type.order['salary-grade-pre'] = function ( d ) {
		switch ( d ) {
			case 'Low':    return 1;
			case 'Medium': return 2;
			case 'High':   return 3;
		}
		return 0;
	};


	$(document).ready(function() {
		$('.tblCustomers').DataTable();
	} );
</script>





<!-----excel conver--->								
<script type="text/javascript">
var tableToExcel = (function() {
  var uri = 'data:application/vnd.ms-excel;base64,'
    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
  return function(table, name) {
    if (!table.nodeType) table = document.getElementById(table)
    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
    window.location.href = uri + base64(format(template, ctx))
  }
})()
</script>

<style>
th td {border:1px solid !important;}
.fixed .dataTables_scrollHeadInner { width:100% !IMPORTANT; margin:0px !IMPORTANT;}
.fixed table.example420.order-table.table.table-striped.table-bordered.dragscroll.dataTable.no-footer {width: 100% !IMPORTANT; padding-right: 5px; }
.dataTables_scrollBody {height: auto !IMPORTANT; max-height: 500px !IMPORTANT;}
.dataTables_scroll { border: 1px solid #909090; border-radius: 3px;}
.table_fix_heder{    background:  #48a9d4;color: #FFF !IMPORTANT;}
.table_fix_heder tr th{ color: #FFF !IMPORTANT;}
tr.average_rating { background: #fff;}
tr.average_rating th { color: #dedede !IMPORTANT;}
.red { color: red !IMPORTANT;}
div#propertyThumbnails-- { position: relative;}
.loader {position: absolute; top: 46%;left: 46%; background: #000000c7; padding: 8px 24px; border-radius: 7px; color: #FFFF;}
.sk-double-bounce .sk-child {background-color: #fff;}
div.dataTables_wrapper {max-width:2000px;min-width:1400px;margin: 0 auto;}
div#propertyThumbnails td {  color: black !IMPORTANT;}
.dataTables_scroll {  box-shadow: 1px 1px 20px 1px #7c7c7c;}
</style>


<!-- <tbody>
									
									<?php 
									
									if(count($rsCustomerInfo)>0){ 
										for ($i=0;$i< count($rsCustomerInfo);$i++){?>
									 <tr class="n_row">
										<td rowspan="3" class="r-span"><?php echo $i+1; ?></td>
										<td rowspan="3" class="r-span"><?php echo date("d/m/Y",strtotime($rsCustomerInfo[$i]['created_date'])); ?></td>
										<td><span><?php echo date("h:i a", strtotime($rsShifts[0]['shiftFrom']));?></span> To  <span><?php echo date("h:i a", strtotime($rsShifts[0]['shiftTo']));?></span></td>
										<td><label id="overavg_<?php echo $i?>" name="Overall Avg."></td>
										<?php
									$rsPagesIDS_ = IndustryPageIDS('Content',$BranchID,$IndustryID);	
									$totalAvg1 = 0;
									$totalAvg2 = 0;
									$totalAvg3 = 0;

									foreach($rsPagesIDS_ as $val) {

										?>
										
											<?php  $rsPagesContent = $objShift->fetchPageListAll($val); 

											$avgSum1 = 0;
											$avgSum2 = 0;
											$avgSum3 = 0;
											for($pgc=0;$pgc<count($rsPagesContent); $pgc++){ 

												$styBorder = '';
												if($pgc == count($rsPagesContent)-1){
													$styBorder = 'style="border-right:1px solid;"';
												}
												?>
												<?php 
												$avgVal1 = $objShift->FetchOverAllAvg($rsCustomerInfo[$i]['db_surveyUserid'],$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$rsCustomerInfo[$i]['tokenid'],$rsShifts[0]['shiftFrom'],$rsShifts[0]['shiftTo']);
												$avgVal2 = $objShift->FetchOverAllAvg($rsCustomerInfo[$i]['db_surveyUserid'],$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$rsCustomerInfo[$i]['tokenid'],$rsShifts[1]['shiftFrom'],$rsShifts[1]['shiftTo']);
												$avgVal3 = $objShift->FetchOverAllAvg($rsCustomerInfo[$i]['db_surveyUserid'],$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$rsCustomerInfo[$i]['tokenid'],$rsShifts[2]['shiftFrom'],$rsShifts[2]['shiftTo']);
												?>
												<?php //$avgName = $objShift->FetchContentName($avgVal,$rsPagesContent[$pgc]['pageConId']);?>
												<?php  
												$avgSum1 = $avgSum1 + $avgVal1;
												$avgSum2 = $avgSum2 + $avgVal2;
												$avgSum3 = $avgSum3 + $avgVal3;


											} 
											$totalAvg1 += round($avgSum1/count($rsPagesContent),2);
											$totalAvg2 += round($avgSum2/count($rsPagesContent),2);
											$totalAvg3 += round($avgSum3/count($rsPagesContent),2);
											?>
										<?php  } 
										$totalAvg1 = round($totalAvg1/count($rsPagesIDS_),2);
										$totalAvg2 = round($totalAvg2/count($rsPagesIDS_),2);
										$totalAvg3 = round($totalAvg3/count($rsPagesIDS_),2);
												

										if($totalAvg1 <= 2){
											
											$span1 = '<span class="badge bg-red" >'.$totalAvg1.'</span>';
											
											
										}else{
											$span1 = '<span class="badge bg-green">'.$totalAvg1.'</span>';
										}
										if($totalAvg2 <= 2){
											
											$span2 = '<span class="badge bg-red" >'.$totalAvg2.'</span>';
											
											
										}else{
											$span2 = '<span class="badge bg-green">'.$totalAvg2.'</span>';
										}
										if($totalAvg3 <= 2){
											
											$span3 = '<span class="badge bg-red" >'.$totalAvg3.'</span>';
											
											
										}else{
											$span3 = '<span class="badge bg-green">'.$totalAvg3.'</span>';
										}
										?>
										
										<td><?php echo ($totalAvg1 / 5)*100;?>%</td>
										
									</tr>
									<tr>
									
										<td><span><?php echo date("h:i a", strtotime($rsShifts[1]['shiftFrom']));?></span> To  <span><?php echo date("h:i a", strtotime($rsShifts[1]['shiftTo']));?></span></td>
										<td><label id="overavg1_<?php echo $i?>" name="Overall Avg."></td>
										<td><?php echo ($totalAvg2 / 5)*100;?>%</td>
										
									</tr>
									<tr>
								
										<td><span><?php echo date("h:i a", strtotime($rsShifts[2]['shiftFrom']));?></span> To  <span><?php echo date("h:i a", strtotime($rsShifts[2]['shiftTo']));?></span></td>
										<td><label id="overavg2_<?php echo $i?>" name="Overall Avg."></td>
										<td><?php echo ($totalAvg3 / 5)*100;?>%</td>
										
										<script>
											$("#overavg_<?php echo $i?>").html('<?php echo $span1 ;?>');
											$("#overavg1_<?php echo $i?>").html('<?php echo $span2 ;?>');
											$("#overavg2_<?php echo $i?>").html('<?php echo $span3 ;?>');
											
										</script>
									</tr>
									<?php } } ?>
								</tbody> -->