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/shifttest.php
<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;">
		<img src="theme/black/images/Rolling-1s_loder.gif">		
		<h3 style="text-align: center;  margin-top: 0px; padding-top: 0px;">
		Please be patient.<br> Complex reports likes this may take a little longer to load.</h3>	 
	</div>
	
	<style>
	.loader.head_loader img {
    width: 44px;
    margin: 0 auto;
}
.loader {
   
    background: none !important;
   
}
.loader.head_loader h3 {
    color: black !important;
}
.loader.head_loader {
    text-align: center !important;
}
.loader { background: none;}
.loader.head_loader {
    position: absolute !important;
    top:50vh !important;
    left: 54% !important;
    transform: translate(-50%,-50%) !important;
    -ms-transform: translate(-50%,-50%);
    position: absolute !important;
  
}
	</style>

	<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="shifttest.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 <?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"> Select Industry </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="shifttest.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>
				
				 <input id="btnHide" type="button" value="Hide Column 3"/>
				 <input id="btnshow" type="button" value="Show Column 3"/ style="display:none;">



			</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) && !empty($IndustryID)){ ?>
						
						<?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 class="table_title">
												<th>Sr.No.</th>
												<th>Date</th>
												<th>Shift</th>
												<th>Overall Score</th>
												<th>Total feedback</th>
												<th>Percentage</th>
												<th>Shift Final Score</th>
												<th>Shift Final Feedback</th>
												<th>Shift Final Percentage</th>
												<th>Final Score</th>
												<th>Final Feedback</th>
												<th>Final Percentage</th>
												
											</tr>
								
								</thead>


								<tbody>
									
									<?php 
									$rsShifts		= $objShift->fetchShiftDataById();

									$countOfShiftLimit = ($rsShifts[0]['feedbackLimit'] + $rsShifts[3]['feedbackLimit']);
						
									if(count($rsShifts)>0){

									if(count($rsCustomerInfo)>0 && count($rsShifts)>0){ 
										$arrDate = array();
										
										$tempFeedCount = 0;
										$ntempFeedCount = 0;
										$tempFeedScore = 0;
										$ntempFeedScore = 0;
										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'];

										 } 
										 /*echo "<pre>";
										print_r($arrDate);
										die();*/
										 $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){ ?> 
									
									<?php 
									$nextloop = false;
									$mTotalFeedScore = 0;
									$mTotalFeedCount = 0;
									 for ($s=0; $s < count($rsShifts); $s++) { 
										
										if($nextloop == false){ 
											$finalScore = 0;
											$feedCount = 0; 
											$mFeedCount = 0;
											$mFeedScore = 0;
											
											for ($k=0; $k < count($value); $k++) {

												$rsPagesIDS_ = IndustryPageIDS('Content',$BranchID,$IndustryID);	
												$totalAvg = 0;
												$noZeroPageConCount = 0;
               									$avgSum = 0;
												foreach($rsPagesIDS_ as $val) {
													
													$rsPagesContent = $objShift->fetchPageListAll($val); 
													//$avgSum = 0;
													for($pgc=0;$pgc<count($rsPagesContent); $pgc++){ 

														$styBorder = '';
														if($pgc == count($rsPagesContent)-1){
															$styBorder = 'style="border-right:1px solid;"';
														}
														$avgVal = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value[$k],$key,$rsShifts[$s]['shiftFrom'],$rsShifts[$s]['shiftTo']);
														if($avgVal != 0){
										            		$noZeroPageConCount++;
										            	} 
														$avgSum = $avgSum + $avgVal;
													}
													//$totalAvg += round($avgSum/count($rsPagesContent),2);
												}
												//$totalAvg = round($totalAvg/count($rsPagesIDS_),2);
												$totalAvg = round($avgSum/$noZeroPageConCount,2);
												if($totalAvg != "0"){
													$feedCount++;
												}
												$finalScore = $finalScore + $totalAvg;
										}
										/*if($feedCount <= $rsShifts[$s]['feedbackLimit']){
												$finalScore = round($finalScore/$rsShifts[$s]['feedbackLimit'],2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}
											if($feedCount < $rsShifts[$s]['feedbackLimit']){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';			
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}*/
										if($s == 0){

											$tempFeedCount = $feedCount;
											$tempFeedScore = $finalScore;

											if($feedCount <= $rsShifts[$s]['feedbackLimit']){
												$finalScore = round($finalScore/$rsShifts[$s]['feedbackLimit'],2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											} 
											if($feedCount < $rsShifts[$s]['feedbackLimit']){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';			
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
											
										}elseif ($s == 1) {
											if($feedCount <= $rsShifts[$s]['feedbackLimit']){
												$finalScore = round($finalScore/$rsShifts[$s]['feedbackLimit'],2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}
											if($feedCount < $rsShifts[$s]['feedbackLimit']){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';			
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
											$mTotalFeedScore = $mTotalFeedScore + $finalScore;
											$mTotalFeedCount = $mTotalFeedCount + $feedCount;
										}elseif ($s == 2) {
											if($feedCount <= $rsShifts[$s]['feedbackLimit']){
												$finalScore = round($finalScore/$rsShifts[$s]['feedbackLimit'],2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}
											if($feedCount < $rsShifts[$s]['feedbackLimit']){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';			
											}else{
											$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
											$mTotalFeedScore = $mTotalFeedScore + $finalScore;
											$mTotalFeedCount = $mTotalFeedCount + $feedCount;

										}elseif ($s == 3) {

											$mFeedScore = $ntempFeedScore + $finalScore;
											$ntempFeedScore = 0;
											$ntempFeedScore = $tempFeedScore;
											$tempFeedScore = 0;

											
											if($feedCount <= $rsShifts[$s]['feedbackLimit']){
												$finalScore = round($finalScore/$rsShifts[$s]['feedbackLimit'],2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}

											if($feedCount < $rsShifts[$s]['feedbackLimit']){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';									
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}

											$mFeedCount = $ntempFeedCount + $feedCount;
											$countOfShift14 = $feedCount + $ntempFeedCount;
											$ntempFeedCount = 0;
											$ntempFeedCount = $tempFeedCount;
											$tempFeedCount = 0;

											$mTotalFeedCount = $mTotalFeedCount + $mFeedCount;
											if($mFeedCount < $countOfShiftLimit){
												$mspanfeedcount = '<span class="badge bg-red" >'.$mFeedCount.'</span>';			
											}else{
												$mspanfeedcount = '<span class="badge bg-green" >'.$mFeedCount.'</span>';
											}

											if($countOfShift14 >= $countOfShiftLimit){
												
												$mFeedScore = round($mFeedScore/$countOfShift14,2);
											}else{
												$mFeedScore = round($mFeedScore/$countOfShiftLimit,2);

											}
											$mTotalFeedScore = $mTotalFeedScore + $mFeedScore;

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

										
										/*if ($s == 3) {
											$mTotalFeedScore = $mTotalFeedScore + $mFeedScore;
										}*/

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


										?>
										<tr class="<?php if($s == 0)echo "n_row"; else {echo "tablerowhide";}?> "> <?php if($s == 0){?>
											<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>
										<?php } ?>
											<td><a href="shiftreportdetails.html?mDate=<?php echo date("m/d/Y",strtotime($key))?>&shiftFrom=<?php echo $rsShifts[$s]['shiftFrom'];?>&shiftTo=<?php echo $rsShifts[$s]['shiftTo'];?>&Organization=<?php echo $OrgID;?>&Branches=<?php echo $BranchID;?>&Industrys=<?php echo $IndustryID;?>" target="_blank"><span><?php echo $rsShifts[$s]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[$s]['shiftTo'];?></span></a></td>
											
											<td><label id="overavg" name="Overall Avg."><?php echo $span?></label></td>
											<td><label id="feedcount"><?php echo $spanfeedcount;?></label></td>
											<td><?php echo ($finalScore / 5)*100;?>%</td>	
											<td><label id="overavg" name="FinalOverallAvg">
												<?php if ($s == 1) {
													echo $span;
												}elseif ($s == 2) {
													echo $span;
												}elseif ($s == 3) {
													echo $mspan;
												}?>
											</label></td>
											<td><label id="overavg" name="FinalFeedbackcount">
												<?php if ($s == 1) {
													echo $spanfeedcount;
												}elseif ($s == 2) {
													echo $spanfeedcount;
												}elseif ($s == 3) {
													echo $mspanfeedcount;
												}?>
											</label></td>
											<td><label id="overavg" name="FinalPercentage">
												<?php if ($s == 1) {
													echo ($finalScore / 5)*100;
													
												}elseif ($s == 2) {
													echo ($finalScore / 5)*100;
													
												}elseif ($s == 3) {
													echo ($mFeedScore / 5)*100;
													
												}
												if($s != 0)echo "%";?>
											</label></td>

											<?php
												$mTotalScore = round($mTotalFeedScore/3,2);
											 if($mTotalScore <= 2){										
												$span = '<span class="badge bg-red" >'.$mTotalScore.'</span>';	
											}else{
												$span = '<span class="badge bg-green">'.$mTotalScore.'</span>';
											}?>
											<td rowspan="" ><label><?php if($s == 3){echo $span;}?></label></td>
											<td rowspan="" ><label><?php if($s == 3){echo $mTotalFeedCount;}?></label></td>
											<td rowspan="" ><label><?php if($s == 3){echo ($mTotalScore/5)*100;echo "%";}?></label></td>
											
										</tr>
										
										<?php }


										if($s == 3){
											$nextloop = true;
											$mTotalFeedScore = 0;
											$mTotalFeedCount = 0;
										}

									}?>
									





<!-- 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -->

























									<?php }else{ ?>
												
									<?php $nextloop = false;
									 for ($s=0; $s < count($rsShifts); $s++) { 
									
										if($nextloop == false){ 

											$finalScore = 0;
											$feedCount = 0; 

												$rsPagesIDS_ = IndustryPageIDS('Content',$BranchID,$IndustryID);	
												$totalAvg = 0;
												foreach($rsPagesIDS_ as $val) {

													$rsPagesContent = $objShift->fetchPageListAll($val); 
													$avgSum = 0;
													for($pgc=0;$pgc<count($rsPagesContent); $pgc++){ 

														$styBorder = '';
														if($pgc == count($rsPagesContent)-1){
															$styBorder = 'style="border-right:1px solid;"';
														}
														$avgVal = $objShift->FetchOverAllAvg("",$OrgID,$BranchID,$IndustryID,'Content',$rsPagesContent[$pgc]['pageConId'],$value,$key,$rsShifts[$s]['shiftFrom'],$rsShifts[$s]['shiftTo']);
														$avgSum = $avgSum + $avgVal;
													}
													$totalAvg += round($avgSum/count($rsPagesContent),2);

												}
												$totalAvg = round($totalAvg/count($rsPagesIDS_),2);
												if($totalAvg != "0"){
													$feedCount++;
												}
												$finalScore = $finalScore + $totalAvg;
										
										//if($s == 0){
											if($feedCount <= $rsShifts[$s]['feedbackLimit']){
												$finalScore = round($finalScore/$rsShifts[$s]['feedbackLimit'],2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
												echo $span = '<span class="badge bg-red" >'.$avgVal.'</span>';
											}

											if($feedCount < $rsShifts[$s]['feedbackLimit']){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';									
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
										/*}elseif ($s == 1) {
											if($feedCount <= 15){
												$finalScore = round($finalScore/15,2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}
											if($feedCount < 15){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
										}elseif ($s == 2) {
											if($feedCount <= 15){
												$finalScore = round($finalScore/15,2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}
											if($feedCount < 15){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
										}elseif ($s == 3) {
											if($feedCount <= 2){
												$finalScore = round($finalScore/2,2);
											}else{ 
												$finalScore = round($finalScore/$feedCount,2);
											}
											if($feedCount < 2){
												$spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';
											}else{
												$spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>';
											}
										}*/

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

										
											// if($feedCount < 7){
												// $spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';
											// }elseif($feedCount >6 && $feedCount < 20){
												// $spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';
											// }elseif($feedCount >6 && $feedCount < 20){
												// $spanfeedcount = '<span class="badge bg-red" >'.$feedCount.'</span>';
											// }else{
											   // $spanfeedcount = '<span class="badge bg-green" >'.$feedCount.'</span>'; 
											// }

										



										?>
										<tr class="<?php if($s == 0)echo "n_row"?>"> <?php if($s == 0){?>
											<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>
										<?php } ?>
											<td><a href="shiftreportdetails.html?mDate=<?php echo date("m/d/Y",strtotime($key))?>&shiftFrom=<?php echo $rsShifts[$s]['shiftFrom'];?>&shiftTo=<?php echo $rsShifts[$s]['shiftTo'];?>&Organization=<?php echo $OrgID;?>&Branches=<?php echo $BranchID;?>&Industrys=<?php echo $IndustryID;?>" target="_blank"><span><?php echo $rsShifts[$s]['shiftFrom'];?></span> To  <span><?php echo $rsShifts[$s]['shiftTo'];?></span></a></td>
											<td><label id="overavg" name="Overall Avg."><?php echo $span?></td>
											<td><label id="feedcount"><?php echo $spanfeedcount;?></td>
											<td><?php echo ($finalScore / 5)*100;?>%</td>	
											
											
											<?php if($s == 0){?>
											<td rowspan="4" class="r-span">aaaa</td>
											<td rowspan="4" class="r-span">bbb</td>
											<td rowspan="4" class="r-span">cccc</td>
											<?php } ?>
										</tr>

											



										<?php }
				

									if($s == 3){
										$nextloop = true;
									}

									}?>
									
										<?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
}
?>





			</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;}
input#btnHide , input#btnshow {
    border: none;
    padding: 6px 16px;
    background: #00a65a;
    color: #FFF;
    border-radius: 3px;
}




 

</style>


 <script type="text/javascript">
        $(document).ready(function() { 
            $('#btnHide').click(function() {
                $('tr.n_row td:nth-child(4)').hide();
				 $('tr.n_row td:nth-child(5)').hide();
				  $('tr.n_row td:nth-child(6)').hide();
				  
				   $('tr.tablerowhide td:nth-child(2)').hide();
				   $('tr.tablerowhide td:nth-child(3)').hide();
				   $('tr.tablerowhide td:nth-child(4)').hide();
				  
				  $('tr.table_title th:nth-child(4)').hide();
				  $('tr.table_title th:nth-child(5)').hide();
				  $('tr.table_title th:nth-child(6)').hide();
				  
				    $('#btnHide').hide();
					$('#btnshow').show();
				  
				   
				   
				   
				  
				
               
            });
			
			$('#btnshow').click(function() {
               $('tr.n_row td:nth-child(4)').show();
				 $('tr.n_row td:nth-child(5)').show();
				  $('tr.n_row td:nth-child(6)').show();
				  
				   $('tr.tablerowhide td:nth-child(2)').show();
				   $('tr.tablerowhide td:nth-child(3)').show();
				   $('tr.tablerowhide td:nth-child(4)').show();
				  
				  $('tr.table_title th:nth-child(4)').show();
				  $('tr.table_title th:nth-child(5)').show();
				  $('tr.table_title th:nth-child(6)').show();
				  
				   $('#btnHide').show();
					$('#btnshow').hide();
				  
               
            });
        });
    </script>