File: /home/barbeatleanalyti/www/manage.beatleanalytics.com/site/template 19-3-2018 1_10/reports.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
$objReports = object;
// Assing object
$objReports = $objDB->objController;
// Assign all variable's value
$pg = $objReports->pg;
$acn = $objReports->acn;
$v = $objReports->v;
$State = $objReports->State;
$ReligionName = $objReports->ReligionName;
$sort = $objReports->sort;
$ReligionID = $objReports->ReligionID;
$field = $objReports->field;
$error = $objReports->error;
$msg = $objReports->msg;
$perpage = $objReports->perpage;
$start = $objReports->start;
$limit = $objReports->limit;
$SearchValue = $objReports->SearchValue;
$s = $objReports->s;
$CustomerID = $objReports->CustomerID;
$SurveyID = $objReports->SurveyID;
$TokenID = $objReports->TokenID;
$pType = $objReports->pType;
$OrgID = $objReports->OrgID;
$BranchID = $objReports->BranchID;
$IndustryID = $objReports->IndustryID;
$FromDate = $objReports->FromDate;
$ToDate = $objReports->ToDate;
/*$rsCustomerInfo = $objReports->FetchCustomerData("All");
if($start == 1)
$limit = 0;
else if($start == 2)
$limit = $perpage;
else
$limit = ($start-1) * $perpage;
$objReports->limit = $limit;
$nume = count($rsCustomerInfo);
$totalpage = @ceil(count($rsCustomerInfo)/$perpage); */
$rsCustomerInfo = $objReports->FetchCustomerData();
if($sort == '0'){
$sort = '1';
}
else{
$sort = '0';
}
$link = "";
if( $start != "" && $start != 0 ){
$link .= "&start={$start}";
}
if( $perpage != "" && $perpage != 0 ){
$link .= "&perpage={$perpage}";
}
if(trim($s) != ""){
$link .= "&s={$s}";
}
$Dash = "";
if($_SESSION['UserInfo']['UType'] == 'MasterAdmin'){
$Dash = "dashboardma";
}else if($_SESSION['UserInfo']['UType'] == 'Admin'){
$Dash = "dashboardadmin";
}
?>
<div class="content-wrapper" style="height:990px !important;">
<?php
if( strtolower($v)=='add'|| strtolower($v)=='edit')
{}
else if($v=='list'){ ?>
<section class="content-header">
<?php if(strtolower($v) == 'list'){?>
<?php if(empty($CustomerID)) {?>
<h1>Reports </h1>
<ol class="breadcrumb">
<li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
<li class="active">Reports </li>
</ol>
<?php }else{ ?>
<h1> Customer Profile </h1>
<ol class="breadcrumb">
<li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
<li><a href="reports.html"><i class="fa fa-user"></i> Customer</a></li>
<li class="active">Profile</li>
</ol>
<?php } ?>
<?php } ?>
</section>
<?php
// Error or success message display
$objDB->NotificaitonForResult($msg,$error);
$objReports->setDefineValue();
?>
<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="reports.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 = $objReports->fetchOrganization(); ?>
<!--<span id="span_select" style="width:120px; 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 = $objReports->fetchBranches(); ?>
<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
<select class="form-control input-md" name="Branches">
<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>
<!--</span>-->
</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 = $objReports->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 any ind. found</option>
<?php } ?>
</select>
<!--</span>-->
</div>
<div class="col-xs-12 col-md-2 col-lg-2 form-group">
<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
<select class="form-control input-md" id="pType" name="ptype">
<option style="font-weight:bold;" <?php if($pType == 'content') echo 'selected="selected"'; ?> value="content">Content</option>
<option style="font-weight:bold;" <?php if($pType == 'question') echo 'selected="selected"'; ?> value="question">Question</option>
</select>
<!--</span>-->
</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="reports.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> GO !</button> -->
<a class="btn btn-success btn-sm" onclick="javascript: document.getElementById('frmSearch').submit();" href="#"> <i class="fa fa-search"></i> GO </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>
<div class="col-xs-6 col-sm-2 col-md-2 col-lg-1 form-group pull-right">
<?php if(!empty($OrgID) && !empty($BranchID) && !empty($IndustryID)) { ?>
<input class="btn btn-info pull-right " type="button" name="sendemailall" onclick="javascript: return validateCheckboxToEmail();" id="sendemailall" value="Email" style="width:100%;" />
<?php } ?>
<!--data-toggle="modal" data-target="#modal-default-bulk" -->
</div>
</div>
<!--<div class="col-md-2 col-xs-6 col-sm-4 form-group "><a class="btn btn-sm btn-success col-xs-12" href="reports.html?v=add"> <i class="fa fa-plus"></i> Add Religions </a>
</div> -->
<?php if($pType == 'content') { ?></form> <?php } ?>
</div>
<?php if($pType == 'question') { ?>
<div class="col-md-12">
<?php
echo $titleQue = $objReports->SelectPageNameFilter($rsPagesIDS);
?>
</form>
</div>
<?php } ?>
<?php if($pType == 'content') { ?>
<div class="col-md-12">
<div class="col-md-12 col-xs-12 form-group">
<span class="badge bg-red" > BETWEEN 0.00 TO 2.00 </span>
<span class="badge bg-green" > BETWEEN 2.01 TO 4.00 </span>
</div>
</div>
<?php } ?>
</div>
<div class="row">
<?php
if(count($rsCustomerInfo) > 0 ) {
//echo pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v);
}
//$rsPagesIDS = IndustryPageIDS($pType,$BranchID,$IndustryID);
?>
<style>
th td {border:1px solid !important;}
</style>
<div id="holder">
<div class="col-md-12" id="scroll">
<div class="table-responsive" id="propertyThumbnails" >
<?php if(!empty($OrgID) && !empty($BranchID) && !empty($IndustryID) ){ ?>
<?php if($pType == 'content') {?>
<table id="imgs" class="table table-striped table-bordered fixed_headers " >
<?php if(count($rsPagesIDS) > 0) {?>
<thead style="margin-right: 6px;">
<tr>
<th style="text-align:center; border:1px solid !important; border-right:1px solid;"> Email </th>
<th align="center" style="text-align:center; border:1px solid !important; border-right:1px solid;" colspan="3">FEEDBACK DETAILS</th>
<?php
foreach($rsPagesIDS as $val) {
?>
<th class="tab_d" style="border:1px solid;" id="tbl-<?php echo $val;?>" class="text-center"><?php echo $objReports->SelectPageName($val);?></th>
<?php } ?>
</tr>
<tr style="font-size:12px;">
<th class="hed-a" style="border:1px solid !important;" class="text-center"><input class="chek" type="checkbox" name="chkbox_main" id="chkbox_main" /></th>
<!--<td style="border:1px solid !important;" class="text-center">Email</td> -->
<th class="hed-a" style="border:1px solid !important;" class="text-center">Date</th>
<th class="hed-a" style="border:1px solid !important;" class="text-center">Customer ID</th>
<th class="hed-a" style="border:1px solid !important;" class="text-center">Overall Score</th>
<?php
foreach($rsPagesIDS as $val) {
?>
<!--<th class="text-center"> -->
<?php $rsPagesContent = $objReports->fetchPageList($val); ?>
<script>
$("#tbl-<?php echo $val;?>").attr("colspan",<?php echo count($rsPagesContent);?>);
</script>
<?php for($pgc=0;$pgc<count($rsPagesContent); $pgc++){
$styBorder = '';
if($pgc == count($rsPagesContent)-1){
$styBorder = 'style="border-right:1px solid;"';
}
?>
<th class="had_b" style="border:1px solid; padding: 9px 6px; " <?php echo $styBorder;?>><?php echo $rsPagesContent[$pgc]['db_pageConTitle'] ?> </th>
<?php } ?>
<?php } ?>
</tr>
<!-----7-3-2018------>
<tr style="font-size:12px; text-align: center; ">
<th class="had_c" colspan="4" style="border:1px solid !important;" class="text-center"><b>Average</b></th>
<?php
foreach($rsPagesIDS as $val) {
?>
<!--<th class="text-center"> -->
<?php $rsPagesContent = $objReports->fetchPageList($val); ?>
<script>
$("#tbl-<?php echo $val;?>").attr("colspan",<?php echo count($rsPagesContent);?>);
</script>
<?php for($pgc=0;$pgc<count($rsPagesContent); $pgc++){
$styBorder = '';
if($pgc == count($rsPagesContent)-1){
$styBorder = 'style="border-right:1px solid;"';
}
?>
<th style="border:1px solid;" <?php echo $styBorder;?>>
<?php
$pageId = $rsPagesContent[$pgc]['pageConId'];
$totalAvg = $objReports->FetchContentAvg($OrgID,$BranchID,$IndustryID,$pageId);
//$totalAvg = 3.55;
if($totalAvg <= 2){
echo $span = '<span class="badge bg-red" >'.$totalAvg.'</span>';
}else{
echo $span = '<span class="badge bg-green">'.$totalAvg.'</span>';
//echo $FromDate.' to '.$ToDate;
}
?>
</th>
<?php } ?>
<?php } ?>
</tr>
<!-----end-7-3-2018------>
</thead>
<tbody>
<?php
if(count($rsCustomerInfo)>0){
?>
<form name="frmEmail" id="frmEmail" action="reports.html?pg=reports&acn=sendemultiplemailtocustomer" method="post" class="form-horizontal" enctype="multipart/form-data">
<?php
$idArr = array();
for ($i=0;$i< count($rsCustomerInfo);$i++)
{
if($i%2)
$bgclass='altrow';
else
$bgclass='oddrow';
$objReports->FromDate = date("Y-m-d",strtotime($rsCustomerInfo[$i]['created_date']));
$objReports->ToDate = date("Y-m-d",strtotime($rsCustomerInfo[$i]['created_date']));
//$dis = 'N';
//if(!in_array($rsCustomerInfo[$i]['db_surveyUserid'],$idArr)){
// $dis = 'Y';
// $idArr[] = $rsCustomerInfo[$i]['db_surveyUserid'];
//}
?>
<tr class="<?php echo $bgclass;?>" >
<td class="hed-a" style="border-left:1px solid !important;" class="text-center">
<?php if(empty($rsCustomerInfo[$i]['db_email']) || strtolower($rsCustomerInfo[$i]['db_username']) == 'guest'){ ?>
<!--<input class="chek" type="checkbox" name="sendemail[]" value="<?php echo $rsCustomerInfo[$i]['db_surveyUserid'] ?>" disabled="disabled" id="sendemail_<?php echo $i?>" /> -->
<i class="fa fa-times" aria-hidden="true"></i>
<input style="display:none;" class="chek" type="checkbox" name="" value="" id="sendemail_<?php echo $i?>" />
<?php }else { ?>
<input class="chek" type="checkbox" name="sendemail[]" value="<?php echo $rsCustomerInfo[$i]['db_surveyUserid'] ?>" id="sendemail_<?php echo $i?>" />
<?php } ?>
</td>
<!--<td style="border-left:1px solid !important;" class="text-center">
<?php
$det = $rsCustomerInfo[$i]['db_phone'];
$det1 = $rsCustomerInfo[$i]['db_email'];
$det2 = $rsCustomerInfo[$i]['db_username'];
if(!empty($rsCustomerInfo[$i]['db_userLoginName'])){
$det = $rsCustomerInfo[$i]['db_userLoginName'];
}
if(empty($rsCustomerInfo[$i]['db_email']) || strtolower($rsCustomerInfo[$i]['db_username']) == 'guest'){ ?>
<a class="btn btn-info disabled" > EMAIL </a>
<?php }else{ ?>
<a class="btn btn-info" onclick="javascript: return setEmailData('<?php echo $rsCustomerInfo[$i]['db_surveyUserid'] ?>','<?php echo $det?>','<?php echo $det1?>','<?php echo $det2?>')" data-toggle="modal" data-target="#modal-default"> EMAIL </a>
<?php } ?>
<?php ?>
</td> -->
<td class="hed-a" class="text-center"><label name="Date"><?php echo date("d/m/Y",strtotime($rsCustomerInfo[$i]['created_date'])); ?></label></td>
<td class="hed-a" class="text-center"><label name="User ID"><a target="_blank" href="customers.html?v=list&cid=<?php echo $rsCustomerInfo[$i]['db_surveyUserid']."&tid=".$rsCustomerInfo[$i]['tokenid']."&Industrys=".$rsCustomerInfo[$i]['db_surveyIndId'].$lnk;?>">
<?php if(!empty($rsCustomerInfo[$i]['db_userLoginName'])) echo $rsCustomerInfo[$i]['db_userLoginName']; else echo $rsCustomerInfo[$i]['db_phone']; ?></a><?php //echo $rsCustomerInfo[$i]['db_phone']; ?></label></td>
<td class="hed-a" class="text-center" style="border-right:1px solid;" ><label id="oavg_<?php echo $i?>" name="Overall Avg."></label></td>
<?php
$totalAvg = 0;
foreach($rsPagesIDS as $val) {
?>
<!--<th class="text-center"> -->
<?php $rsPagesContent = $objReports->fetchPageList($val);
$avgSum = 0;
for($pgc=0;$pgc<count($rsPagesContent); $pgc++){
$styBorder = '';
if($pgc == count($rsPagesContent)-1){
$styBorder = 'style="border-right:1px solid;"';
}
?>
<td class="had_b" style="padding: 9px 6px;" <?php echo $styBorder;?> class="text-center"><?php $avgVal = $objReports->FetchOverAllAvg($rsCustomerInfo[$i]['db_surveyUserid'],$OrgID,$BranchID,$IndustryID,$pType,$rsPagesContent[$pgc]['pageConId'],$rsCustomerInfo[$i]['tokenid']);
$avgSum = $avgSum + $avgVal;
//echo $avgVal;
$span = '';
if($avgVal <= 2){
echo $span = '<span class="badge bg-red" >'.$avgVal.'</span>';
}else{
echo $span = '<span class="badge bg-green">'.$avgVal.'</span>';
}
//echo $avgSum;
?> </td>
<?php }
$totalAvg += round($avgSum/count($rsPagesContent),2);
?>
<?php }
$totalAvg = round($totalAvg/count($rsPagesIDS),2);
//echo "<br />";
if($totalAvg <= 2){
$span = '<span class="badge bg-red" >'.$totalAvg.'</span>';
}else{
$span = '<span class="badge bg-green">'.$totalAvg.'</span>';
}
?>
<script>
$("#oavg_<?php echo $i?>").html('<?php echo $span ;?>');
</script>
</tr>
<?php } ?>
<tr class="<?php echo $bgclass;?>" style="border-top:1px solid #000;">
<td style="border: 1px solid #000; border-right: none !important; border-top:1px solid #000;">
<input class="chek" type="checkbox" name="chkbox_main_all" id="chkbox_main_all" />
</td>
<td style="border: 1px solid #000; border-right: none; border-left: none; border-top:1px solid #000;">
<!--<input class="btn btn-info" type="button" name="sendemailall" data-toggle="modal" data-target="#modal-default-bulk" disabled="disabled" id="sendemailall" value="EMAIL TO ALL" /> -->
</td>
<td style="border-bottom: 1px solid #000; border-right:1px solid #000;border-top:1px solid #000;" colspan="100"></td>
</tr>
<div class="modal fade in" id="modal-default-bulk" style="display:none; padding-right: 17px;">
<div class="modal-dialog products-add email-modal " style="width:60%;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" onclick="javascript: document.getElementById('modal-default-bulk').style.display = 'none';" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title " style="text-align:center">Send email </h4>
</div>
<div class="modal-body">
<div class="email" style="text-align:center;"><img src="theme/black/images/email2.gif" style="width:100%;"></div>
<!-- <h3 style="color:#900; text-align:center;">Your email will be sent on your behalf from a universal email ID</h3>-->
<p>
<!--<form name="frmBulkEmail" id="frmBulkEmail" action="reports.html?pg=reports&acn=sendemultiplemailtocustomer" method="post" class="form-horizontal" enctype="multipart/form-data"> -->
<!--<input type="hidden" name="emailid_" id="emailid_" value="" />
<input type="hidden" name="username_" id="username_" value="" />
<input type="hidden" name="phone_" id="phone_" value="" /> -->
<?php if(fetchRemainPointClient('email') > 0) {?>
<input type="hidden" name="orgid_" id="orgid_" value="<?php echo $OrgID?>" />
<input type="hidden" name="branchic_" id="branchic_" value="<?php echo $BranchID?>" />
<input type="hidden" name="indid_" id="branchic_" value="<?php echo $IndustryID?>" />
<!--<div class="form-group">
<div style="background:#fff !important; padding:10px; width:550px; margin:0 auto;">
<h4> <p><strong>SEND MAIL TO BULK CUSTOMER DETAILS-- </strong></p> </h4>
<h4> <p><strong> CREDENTIALS'S KEYWORD FOR EMAIL BODY ONLY </strong></p> </h4>
<p> <strong>UserID : </strong> {{CUSTOMER_USER_ID}} </p>
<p> <strong>Email : </strong> {{CUSTOMER_EMAIL_ID}} </p>
<p> <strong>Name : </strong> {{CUSTOMER_NAME}} </p>
<p> <strong>Phone : </strong> {{CUSTOMER_PHONE}} </p>
<p> <strong style="color:green;">Example : Hello {{CUSTOMER_NAME}},</strong> </p>
</div>
</div>--->
<div class="col-md-2"></div>
<div class="col-md-8 cus-pro ">
<div class=" email-cust-detail">
<!--<div class="box-header headline email-cust"></div> -->
<!-- /.box-header -->
<div class="box-body" id="emial-report">
<h4> <p><strong> CREDENTIALS'S KEYWORD FOR EMAIL BODY ONLY </strong></p> </h4>
<p> <strong>UserID : </strong> {{CUSTOMER_USER_ID}} </p>
<p> <strong>Email : </strong> {{CUSTOMER_EMAIL_ID}} </p>
<p> <strong>Name : </strong> {{CUSTOMER_NAME}} </p>
<p> <strong>Phone : </strong> {{CUSTOMER_PHONE}} </p>
<p> <strong style="color:green;">Example : Hello {{CUSTOMER_NAME}},</strong> </p>
</div>
</div>
</div>
<div class="col-md-2"></div>
<div class="clearfix"></div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" for="product_name" style="text-align: right;">Email Subject</label>
<div class="col-md-8">
<input id="subjectbulk" name="subject" placeholder="Subject" class="form-control input-md" type="text">
</div>
</div>
<script>
$(document).ready(function(e) {
$('#messagebody').wysihtml5()
});
</script>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" for="percentage_discount" style="text-align: right;">Email body (Message)</label>
<div class="col-md-8" id="messagevalbulk">
<div style="background: #98a991; color:#fff !important;text-align: center;line-height: 49px;margin-bottom: 16px;font-size: 18px;">
<p> <strong>FROM : </strong> <?php echo $objReports->FetchOrganizationName($OrgID)?> - <?php echo $objReports->FetchIndustryName($IndustryID)?> - <?php echo $objReports->FetchBranchName($BranchID)?></p>
</div>
<textarea rows="6" cols="12" class="form-control input-md" placeholder="Type your text here" name="message" id="messagebody"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="text-align:center;">
<input type="submit" id="singlebutton" onclick="javascript: return validateBulkEmail();" name="singlebutton" class="btn btn-warning btn-lg producat-upload" value="Send Now">
</div>
</div>
<?php } else{ ?>
<div class="form-group">
<div class="col-md-12 text-center">
<h1 style="font-size: 65px; color: red;line-height: 115px;"> OOPS, <br />YOU DON'T HAVE SUFFICIANT<br />EMAIL POINTS.</h1>
</div>
</div>
<?php } ?>
</p>
</div>
<!--- <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>---->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</form>
<?php
}else{
?>
<tr class="altrow" > <td colspan="25" align="center"> No any record found. </td> </tr>
<?php } ?>
</tbody>
<?php }else{ ?>
<tbody>
<tr>
<td class="text-center">No any data found.</td>
</tr>
</tbody>
<?php } ?>
</table>
<?php } else { ?>
</div>
</div>
<div class="col-md-12" >
<div class="table-responsive" id="propertyThumbnails" >
<table id="thumbs" class="table table-striped table-bordered dragscroll" style=" height: 160px; overflow: scroll; cursor: grab; cursor : -o-grab; cursor : -moz-grab; cursor : -webkit-grab;">
<?php if(count($rsPagesIDS) > 0) {?>
<tbody>
<tr>
<th align="center" style="text-align:center; border:1px solid;">Email</th>
<th align="center" style="text-align:center; border:1px solid;" colspan="3">FEEDBACK DETAILS</th>
<?php
foreach($rsPagesIDS as $val) {
?>
<th style="border:1px solid;" id="tbl-<?php echo $val;?>" class="text-center"><?php
echo $titleQue = $objReports->SelectPageName($val);
$fltverVal = 0;
//echo $val."#".$titleQue."#<br />".QUESTION_DEFAULT_SENTENCE_FILTER;
if(strtolower($titleQue) == strtolower(QUESTION_DEFAULT_SENTENCE_FILTER)){
$fltverVal = $val;
}
?></th>
<?php } ?>
</tr>
<tr style="font-size:12px; font-weight:bold !important;">
<td style="border:1px solid !important;" class="text-center"><input class="chek" type="checkbox" name="chkbox_main" id="chkbox_main" /></td>
<!--<td style="border:1px solid !important;" class="text-center">Email</td> -->
<td align="center" style="border-right:1px solid; border-bottom:1px solid;" class="text-center">Date</td>
<td align="center" style="border-right:1px solid; border-bottom:1px solid;" class="text-center">Customer ID</td>
<!--<td class="text-center">Overall Score</td> -->
<?php
foreach($rsPagesIDS as $val) {
?>
<!--<th class="text-center"> -->
<?php $rsPagesContent = $objReports->fetchPageList($val); ?>
<script>
$("#tbl-<?php echo $val;?>").attr("colspan",<?php echo count($rsPagesContent);?>);
</script>
<?php for($pgc=0;$pgc<count($rsPagesContent); $pgc++){
$styBorder = 'style="border-right:1px solid; border-bottom:1px solid;"';
if($pgc == count($rsPagesContent)-1){
$styBorder = 'style="border-right:1px solid; border-bottom:1px solid;"';
}
?>
<td align="center" <?php echo $styBorder;?>>
<?php
echo $rsPagesContent[$pgc]['db_pageConTitle'];
?> </td>
<?php } ?>
<?php } ?>
</tr>
<?php
//echo "<pre>";
//print_r($rsCustomerInfo);
//echo "</pre>";
if(count($rsCustomerInfo)>0){ ?>
<form name="frmEmail" id="frmEmail" action="reports.html?pg=reports&acn=sendemultiplemailtocustomer" method="post" class="form-horizontal" enctype="multipart/form-data">
<?php for ($i=0;$i< count($rsCustomerInfo);$i++)
{
if($i%2)
$bgclass='altrow';
else
$bgclass='oddrow';
$objReports->FromDate = date("Y-m-d",strtotime($rsCustomerInfo[$i]['created_date']));
$objReports->ToDate = date("Y-m-d",strtotime($rsCustomerInfo[$i]['created_date']));
?>
<tr class="<?php echo $bgclass;?>" >
<td style="border-left:1px solid !important;" class="text-center">
<input class="chek" type="checkbox" name="sendemail[]" value="<?php echo $rsCustomerInfo[$i]['db_surveyUserid'] ?>" id="sendemail_<?php echo $i?>" />
</td>
<!--<td style="border-left:1px solid !important;" class="text-center">
<?php
$det = $rsCustomerInfo[$i]['db_phone'];
$det1 = $rsCustomerInfo[$i]['db_email'];
$det2 = $rsCustomerInfo[$i]['db_username'];
if(!empty($rsCustomerInfo[$i]['db_userLoginName'])){
$det = $rsCustomerInfo[$i]['db_userLoginName'];
}
?>
<a class="btn btn-info" onclick="javascript: return setEmailData('<?php echo $rsCustomerInfo[$i]['db_surveyUserid'] ?>','<?php echo $det?>','<?php echo $det1?>','<?php echo $det2?>')" data-toggle="modal" data-target="#modal-default"> EMAIL </a>
<?php ?>
</td> -->
<td class="text-center"><label name="Date"><?php echo date("d/m/Y",strtotime($rsCustomerInfo[$i]['created_date'])); ?></label></td>
<td style="border-right:1px solid;" class="text-center"><a target="_blank" href="customers.html?v=list&cid=<?php echo $rsCustomerInfo[$i]['db_surveyUserid']."&tid=".$rsCustomerInfo[$i]['tokenid']."&Industrys=".$rsCustomerInfo[$i]['db_surveyIndId'].$lnk;?>">
<?php //echo $rsCustomerInfo[$i]['db_phone'];
if(!empty($rsCustomerInfo[$i]['db_userLoginName'])) echo $rsCustomerInfo[$i]['db_userLoginName']; else echo $rsCustomerInfo[$i]['db_phone']; ?>
</a>
<label name="User ID">
<?php //echo $rsCustomerInfo[$i]['db_phone']; ?></label></td>
<!--<td class="text-center"><label name="Organization Name"><?php $ovrAllAvg = $objReports->FetchOverAllAvg($rsCustomerInfo[$i]['db_surveyUserid'],$OrgID,$BranchID,$IndustryID,$pType,"",$rsCustomerInfo[$i]['surveyId']);
$avgVal = round($ovrAllAvg/count($rsPagesIDS),2);
$span = '';
if($avgVal <= 2){
echo $span = '<span class="badge bg-red" >'.$avgVal.'</span>';
}else{
echo $span = '<span class="badge bg-green">'.$avgVal.'</span>';
}
?></label></td> -->
<?php
foreach($rsPagesIDS as $val) {
$rsPagesContent = $objReports->fetchPageList($val);
for($pgc=0;$pgc<count($rsPagesContent); $pgc++){ $styBorder = '';
if($pgc == count($rsPagesContent)-1){
$styBorder = 'style="border-right:1px solid;"';
}
?>
<td <?php echo $styBorder;?> class="text-center"><?php $avgVal = $objReports->FetchQuestionValue($rsCustomerInfo[$i]['db_surveyUserid'],$OrgID,$BranchID,$IndustryID,$pType,$rsPagesContent[$pgc]['pageConId'],$rsCustomerInfo[$i]['tokenid']);
//echo $avgVal;
if(strlen($avgVal) > 30) {
echo substr($avgVal,0,30)."..<a data-toggle='modal' data-target='#modal_".$rsCustomerInfo[$i]['db_surveyUserid'].$OrgID.$BranchID.$IndustryID.$pType.$rsPagesContent[$pgc]['pageConId'].$rsCustomerInfo[$i]['tokenid']."' href=''> more </a>"; ?>
<div class="modal" id="<?php echo "modal_".$rsCustomerInfo[$i]['db_surveyUserid'].$OrgID.$BranchID.$IndustryID.$pType.$rsPagesContent[$pgc]['pageConId'].$rsCustomerInfo[$i]['tokenid'];?>" style="padding-right: 17px;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">More details</h4>
</div>
<div class="modal-body" style="text-align:left;">
<p><?php echo $avgVal; ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-right" data-dismiss="modal">Close</button>
<!--<button type="button" class="btn btn-primary">Save changes</button> -->
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<?php }
else
echo $avgVal;
?> </td>
<?php } ?>
<?php }
?>
</tr>
<?php } ?>
<tr class="<?php echo $bgclass;?>" style="border-top:1px solid #000;">
<td style="border: 1px solid #000; border-right: none !important; border-top:1px solid #000;">
<input class="chek" type="checkbox" name="chkbox_main_all" id="chkbox_main_all" />
</td>
<td style="border: 1px solid #000; border-right: none; border-left: none; border-top:1px solid #000;">
<!--<input class="btn btn-info" type="button" name="sendemailall" data-toggle="modal" data-target="#modal-default-bulk" disabled="disabled" id="sendemailall" value="EMAIL TO ALL" /> -->
</td>
<td style="border-bottom: 1px solid #000; border-right:1px solid #000;border-top:1px solid #000;" colspan="100"></td>
</tr>
<div class="modal fade in" id="modal-default-bulk" style="display:none; padding-right: 17px;">
<div class="modal-dialog products-add email-modal " style="width:60%;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" onclick="javascript: document.getElementById('modal-default-bulk').style.display = 'none';" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title " style="text-align:center">Send email </h4>
</div>
<div class="modal-body">
<div class="email" style="text-align:center;"><img src="theme/black/images/email2.gif" style="width:100%;"></div>
<!-- <marquee behavior="alternate">
<h3 style="color:#900; text-align:center;">Your email will be sent on your behalf from a universal email ID</h3> </marquee>--->
<div class="clearfix"></div>
<p>
<!--<form name="frmBulkEmail" id="frmBulkEmail" action="reports.html?pg=reports&acn=sendemultiplemailtocustomer" method="post" class="form-horizontal" enctype="multipart/form-data"> -->
<!--<input type="hidden" name="emailid_" id="emailid_" value="" />
<input type="hidden" name="username_" id="username_" value="" />
<input type="hidden" name="phone_" id="phone_" value="" /> -->
<?php if(fetchRemainPointClient('email') > 0) {?>
<input type="hidden" name="orgid_" id="orgid_" value="<?php echo $OrgID?>" />
<input type="hidden" name="branchic_" id="branchic_" value="<?php echo $BranchID?>" />
<input type="hidden" name="indid_" id="branchic_" value="<?php echo $IndustryID?>" />
<!--<div class="form-group">
<div style="background:#fff !important; padding:10px; width:550px; margin:0 auto;">
<h4> <p><strong>SEND MAIL TO BULK CUSTOMER DETAILS-- </strong></p> </h4>
<h4> <p><strong> CREDENTIALS'S KEYWORD FOR EMAIL BODY ONLY </strong></p> </h4>
<p> <strong>UserID : </strong> {{CUSTOMER_USER_ID}} </p>
<p> <strong>Email : </strong> {{CUSTOMER_EMAIL_ID}} </p>
<p> <strong>Name : </strong> {{CUSTOMER_NAME}} </p>
<p> <strong>Phone : </strong> {{CUSTOMER_PHONE}} </p>
<p> <strong style="color:green;">Example : Hello {{CUSTOMER_NAME}},</strong> </p>
</div>
</div>--->
<div class="col-md-2"></div>
<div class="col-md-8 cus-pro ">
<div class=" email-cust-detail">
<!--<div class="box-header headline email-cust"></div> -->
<!-- /.box-header -->
<div class="box-body" id="emial-report">
<h4> <p><strong> CREDENTIALS'S KEYWORD FOR EMAIL BODY ONLY </strong></p> </h4>
<p> <strong>UserID : </strong> {{CUSTOMER_USER_ID}} </p>
<p> <strong>Email : </strong> {{CUSTOMER_EMAIL_ID}} </p>
<p> <strong>Name : </strong> {{CUSTOMER_NAME}} </p>
<p> <strong>Phone : </strong> {{CUSTOMER_PHONE}} </p>
<p> <strong style="color:green;">Example : Hello {{CUSTOMER_NAME}},</strong> </p>
</div>
</div>
</div>
<div class="col-md-2"></div>
<div class="clearfix"></div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" for="product_name" style="text-align: right;">Email Subject</label>
<div class="col-md-8">
<input id="subjectbulk" name="subject" placeholder="Subject" class="form-control input-md" type="text">
</div>
</div>
<script>
$(document).ready(function(e) {
$('#messagebody').wysihtml5()
});
</script>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" for="percentage_discount" style="text-align: right;">Email body (Message)</label>
<div class="col-md-8" id="messagevalbulk">
<div style="background: #98a991;color:#fff !important;text-align: center;line-height: 49px;margin-bottom: 16px;font-size: 18px;">
<p> <strong>FROM : </strong> <?php echo $objReports->FetchOrganizationName($OrgID)?> - <?php echo $objReports->FetchIndustryName($IndustryID)?> - <?php echo $objReports->FetchBranchName($BranchID)?></p>
</div>
<textarea rows="6" cols="12" class="form-control input-md" placeholder="Type your text here" name="message" id="messagebody"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="text-align:center;">
<input type="submit" id="singlebutton" onclick="javascript: return validateBulkEmail();" name="singlebutton" class="btn btn-warning btn-lg producat-upload" value="Send Now">
</div>
</div>
<?php } else{ ?>
<div class="form-group">
<div class="col-md-12 text-center">
<h1 style="font-size: 65px; color: red;line-height: 115px;"> OOPS, <br />YOU DON'T HAVE SUFFICIANT<br />EMAIL POINTS.</h1>
</div>
</div>
<?php } ?>
</p>
</div>
<!--- <div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>---->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</form>
<?php }else{
?>
<tr class="altrow" > <td colspan="25" align="center"> No any record found. </td> </tr>
<?php } ?>
</tbody>
<?php }else{ ?>
<tbody>
<tr>
<td class="text-center">No any data found.</td>
</tr>
</tbody>
<?php } ?>
</table>
<?php }?>
<?php }else{ ?>
</div>
</div>
<table class="table table-striped table-bordered" >
<tbody>
<tr>
<td class="text-center">Please select proper data from filter.</td>
</tr>
</tbody>
</table>
<?php }?>
<!------auto scroll-------->
<!--------
<script>
var sum = 0;
$("#propertyThumbnails").each(function() {
sum += $(this).width() + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('paddingRight'))
});
$("#scroll").css('width', sum);
$("#holder").mousemove(function(e) {
x = -(((e.pageX - $('#scroll').position().left) / $("#holder").width()) * ($("#scroll").width() + parseInt($("#scroll").css('paddingLeft')) + parseInt($("#scroll").css('paddingRight')) - $("#holder").width()));
$("#scroll").css({
'marginLeft': x + 'px'
});
});
</script>
<script>
jQuery(function($) {
$(window).load(function() {
var $gal = $("#propertyThumbnails"),
galW = $gal.outerWidth(true),
galSW = $gal[0].scrollWidth,
wDiff = (galSW / galW) - 1, // widths difference ratio
mPadd = 60, // Mousemove Padding
damp = 20, // Mousemove response softness
mX = 0, // Real mouse position
mX2 = 0, // Modified mouse position
posX = 0,
mmAA = galW - (mPadd * 2), // The mousemove available area
mmAAr = (galW / mmAA); // get available mousemove fidderence ratio
$gal.mousemove(function(e) {
mX = e.pageX - $(this).offset().left;
mX2 = Math.min(Math.max(0, mX - mPadd), mmAA) * mmAAr;
});
setInterval(function() {
posX += (mX2 - posX) / damp; // zeno's paradox equation "catching delay"
$gal.scrollLeft(posX * wDiff);
}, 10);
});
});
</script>
-------->
<!-----//-auto scroll-------->
<?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>";
?>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<? } ?>
</section>
<section>
<div class="report-search-info">
<h1>Check Your report following video</h1>
<video width="900" height="auto" poster="theme/black/images/video-screen-beatle.png" controls>
<source src="theme/black/images/video.mp4" type="video/mp4" />
<source src="theme/black/images/video.ogv" type="video/ogg" />
<source src="theme/black/images/video.webm" type="video/webm" />
</video>
<!---
<img src="theme/black/images/video.gif">-->
</div>
</section>
</div>
<script>
function validateBulkEmail(){
var subject = document.getElementById('subjectbulk');
var message = document.getElementById('messagebody');
var error = 0;
if(subject.value.trim() == '')
{
subject.style.border = '1px solid red';
error = 1;
}
if(message.value.trim() == '')
{
document.getElementById('messagevalbulk').style.border = '1px solid red';
error = 1;
}
if(error == 1)
return false;
}
function validateEmail(){
var subject = document.getElementById('subject');
var message = document.getElementById('message');
var error = 0;
if(subject.value.trim() == '')
{
subject.style.border = '1px solid red';
error = 1;
}
if(message.value.trim() == '')
{
document.getElementById('messageval').style.border = '1px solid red';
error = 1;
}
if(error == 1)
return false;
}
</script>
<script>
$(document).ready(function(e) {
$("#chkbox_main,#chkbox_main_all").click(function () {
$("INPUT[type='checkbox']").prop('checked', $(this).prop('checked'));
if($(this).prop('checked') == true){
$('#sendemailall').removeAttr('disabled');
}else {
$('#sendemailall').attr('disabled','disabled');
}
$('#frmEmail').attr('action','reports.html?pg=reports&acn=sendemultiplemailtocustomer');
});
$("INPUT[type='checkbox']").click(function () {
var cnt = '<?php echo $i?>';
var err = 0;
for(var i=0; i<cnt; i++){
if(document.getElementById('sendemail_'+i).checked == true){
$('#sendemailall').removeAttr('disabled');
err = 1;
}
}
if(err == 0) {
//alert('No Data Selected to Send Email');
$('#sendemailall').attr('disabled','disabled');
}
});
});
function validateCheckboxToEmail(){
var cnt = '<?php echo $i?>';
var err = 0;
var cnt1 = 0;
var valX = '';
var balance = '<?php echo fetchRemainPointClient('email');?>';
balance = parseInt(balance);
for(var i=0; i<cnt; i++){
if(document.getElementById('sendemail_'+i).checked == true){
//$('#sendemailall').removeAttr('disabled');
err = 1;
cnt1 = cnt1 + 1;
valX = valX+"_"+document.getElementById('sendemail_'+i).value;
}
}
if(balance < cnt1){
alert('Oops, You selected morethan your credit limit, \nPlease purchase email credits to send email!');
return false;
}
if(err == 0) {
alert('No Data Selected to Send Email');
return false;
//$('#sendemailall').attr('disabled','disabled');
}else{
//alert(valX);
var xhttpp9 = new XMLHttpRequest();
xhttpp9.onreadystatechange = function() {
if (xhttpp9.readyState == 4 && xhttpp9.status == 200) {
document.getElementById("emial-report").innerHTML = xhttpp9.responseText;
//alert(xhttpp9.responseText);
}
};
xhttpp9.open("GET", "runajax.php?acn=FetchEmailSendData&point="+cnt1+"&sid="+valX, true);
xhttpp9.send();
$('#modal-default-bulk').show();
}
}
function setEmailData(uid,phone,email,uname){
$('#customerid').val(uid);
$('#emailid_').val(email);
$('#username_').val(uname);
$('#phone_').val(phone);
$('#cdetails').html('<h4> <p><strong>CUSTOMER DETAILS </strong></p> </h4><p> <strong>UserID : </strong> '+phone+' </p><p> <strong>Email : </strong> '+email+' </p><p> <strong>Name : </strong> '+uname+' </p>')
}
</script>
<style>
div#cdetails p {
text-align:left;
}
tr td .chek {
width: 25px !IMPORTANT;
height: 25px !IMPORTANT;
}
.box-header.headline.email-cust {
background: #ddd;
}
.email-cust-detail {
border: 1px solid #ddd;
border-radius: 3px;
}
.email-cust-detail {
height: 205px;
margin-bottom: 25px;
}
.email-modal .modal-title {
font-size: 26px !IMPORTANT;
}
</style>