 <!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Highcharts Example</title>

		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
		
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
		
		
		<style type="text/css">
${demo.css}
		</style>
		

	</body>
</html>


        <noscript>
            <div class="alert alert-block col-md-12">
                <h4 class="alert-heading">Warning!</h4>

                <p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
                    enabled to use this site.</p>
            </div>
        </noscript>

        <div id="content" class="col-lg-10 col-sm-10">
            <!-- content starts -->
            <div>
    <ul class="breadcrumb">
        <li>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#">main page</a>
        </li>
    </ul>
</div>
 





<div class="row">
    
    <div class="box col-md-6">
        <div class="box-inner homepage-box">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-list-alt"></i> Views Per Device </h2>

                <div class="box-icon">
                    <a href="#" class="btn btn-minimize btn-round btn-default"><i
                            class="glyphicon glyphicon-chevron-up"></i></a>
                    <a href="#" class="btn btn-close btn-round btn-default"><i
                            class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
               
            
               
               <script type="text/javascript">
			// var  ProjectSt= new Array();
			 
$(function () {

    $(document).ready(function () {

        // Build the chart
        $('#containerStatus').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                type: 'pie'
            },
            title: {
                text: ''
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
            },
            plotOptions: {
                pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    format: '{point.name}<br>{point.percentage:.1f} %',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                    }
                }
            }
            },
            series: [{
                name: 'Brands',
                colorByPoint: true,
                data:[ 
			      <?php  $sqlStatus=mysqli_query($connect," 

SELECT 
count(*) total
,count( case when `affil_landingLogs_device` like '%Mobile%'  then  1 end ) mobile
,count( case when `affil_landingLogs_device` like '%Tablet%'  then  1 end ) Tablet

,count( case when `affil_landingLogs_device` like '%desktop%'  then  1 end ) desktop

FROM `affil_landinglogs2017917`  
where date(`affil_landingLogs_date`)=date(now())");
$x=0;
$num=mysqli_num_rows($sqlStatus);

$totaldevices=0;
while($rowStatus=mysqli_fetch_array($sqlStatus)){ $x++;
	 $totaldevices=$rowStatus['total'];
	?>
	 
	 {name:"Mobile = " + <?php echo($rowStatus['mobile']); ?> ,   y: <?php echo($rowStatus['mobile']); ?>} 
	 ,{name:"Tablet =" + <?php echo($rowStatus['Tablet']); ?>,  y: <?php echo($rowStatus['Tablet']); ?>} 
	 ,{name:"desktop = " + <?php echo($rowStatus['desktop']); ?>,  y: <?php echo($rowStatus['desktop']); ?>} 
	  
	<?php 
	
	
	
/*if($num!=$x){ 
 ?>
	 ,
	 <?php }*/ } ?>
	 ]/*[{
                    name: 'Microsoft Internet Explorer',
                    y: 56.33
                }, {
                    name: 'Chrome',
                    y: 24.03,
                    sliced: true,
                    selected: true
                }, {
                    name: 'Firefox',
                    y: 10.38
                }, {
                    name: 'Safari',
                    y: 4.77
                }, {
                    name: 'Opera',
                    y: 0.91
                }, {
                    name: 'Proprietary or Undetectable',
                    y: 0.2
                }]*/
            }]
        });
    });
});
		</script>
	 

<div id="containerStatus" style="min-width: 280px; height: 300px; max-width: 600px; margin: 0 auto"></div>
               
               
               Total = <?php echo($totaldevices); ?>
               
               
               
               
               
            </div>
        </div>
    </div>
    
    
    
    
    
    
    <!--/span-->
<div class="box col-md-6">
        <div class="box-inner homepage-box">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-list-alt"></i>Subscribers </h2>

                <div class="box-icon">
                    <a href="#" class="btn btn-minimize btn-round btn-default"><i
                            class="glyphicon glyphicon-chevron-up"></i></a>
                    <a href="#" class="btn btn-close btn-round btn-default"><i
                            class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
               
               
               
               
               
               
               
               
               <script type="text/javascript">
			// var  ProjectSt= new Array();
			 
$(function () {

    $(document).ready(function () {

        // Build the chart
        $('#containerSector').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                type: 'pie'
            },
            title: {
                text: ''
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
						format: '{point.name}<br>{point.percentage:.1f} %',
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                name: 'Brands',
                colorByPoint: true,
                data:[ 
			      <?php  $sqlStatus=mysqli_query($connect,"
SELECT 
count(*) total
,count( case when   `hadaraAPILogs` =0 then  1 end ) sucess
,count( case when   `hadaraAPILogs` =-1 then  1
when   `hadaraAPILogs` =1 then  1


 end ) Faild

,count( case when   `hadaraAPILogs` =11 then  1 end ) WrongCode

,count( case when   hadaraAPILogs is null  then  1 end ) NextStepEmpty


FROM `SubscribersLogs` WHERE date(`SubscribersLogs_date`)=date(now())
");
$x=0;
$num=mysqli_num_rows($sqlStatus);
$totalSubs=0;
while($rowStatus=mysqli_fetch_array($sqlStatus)){ $x++;
	$totalSubs=$rowStatus['total']; 
	?>
	
	
	 {name:"sucess = <?php echo($rowStatus['sucess']); ?> ",  y: <?php echo($rowStatus['sucess']); ?>} 
	 ,{name:"Faild  = <?php echo($rowStatus['Faild']); ?> ",  y: <?php echo($rowStatus['Faild']); ?>} 
	 ,{name:"WrongCode  = <?php echo($rowStatus['WrongCode']); ?> ",  y: <?php echo($rowStatus['WrongCode']); ?>} 
	  ,{name:"NextStepEmpty  = <?php echo($rowStatus['NextStepEmpty']); ?> ",  y: <?php echo($rowStatus['NextStepEmpty']); ?>} 
	
	<?php 
	
	
	
/*if($num!=$x){ 
 ?>
	 ,
	 <?php }*/ } ?>
	 ]/*[{
                    name: 'Microsoft Internet Explorer',
                    y: 56.33
                }, {
                    name: 'Chrome',
                    y: 24.03,
                    sliced: true,
                    selected: true
                }, {
                    name: 'Firefox',
                    y: 10.38
                }, {
                    name: 'Safari',
                    y: 4.77
                }, {
                    name: 'Opera',
                    y: 0.91
                }, {
                    name: 'Proprietary or Undetectable',
                    y: 0.2
                }]*/
            }]
        });
    });
});
		</script>
	 

<div id="containerSector" style="min-width: 280px; height: 300px; max-width: 600px; margin: 0 auto"></div>
               
              
               Total=<?php echo($totalSubs); ?>
               
               
               
               
               
               
               
               
            </div>
        </div>
    </div>
    <!--/span-->










    
    <!--/span-->
<div class="box col-md-6">
        <div class="box-inner homepage-box">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-list-alt"></i> Views Per Affilates</h2>

                <div class="box-icon">
                    <a href="#" class="btn btn-minimize btn-round btn-default"><i
                            class="glyphicon glyphicon-chevron-up"></i></a>
                    <a href="#" class="btn btn-close btn-round btn-default"><i
                            class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
                
               
               
               <?php /*?>
               
               <script type="text/javascript">
			// var  ProjectSt= new Array();
			 
$(function () {

    $(document).ready(function () {

        // Build the chart
        $('#containerDonor').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                type: 'pie'
            },
            title: {
                text: ''
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
							format: '{point.name}<br>{point.percentage:.1f} %',
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                name: 'Brands',
                colorByPoint: true,
                data:[ 
			      <?php  $sqlStatus=mysqli_query($connect,"
SELECT count(*) c,`affiliates_name` FROM `affil_landinglogs2017917`
inner join  affiliates on `affil_landingLogs_affid`=`affiliates_id`

where date(`affil_landingLogs_date`)=date(now())
group by `affiliates_id`

");
$x=0;
$num=mysqli_num_rows($sqlStatus);

while($rowStatus=mysqli_fetch_array($sqlStatus)){ $x++;
	 
	?>
	//ProjectSt[]={name:"<?php echo($rowStatus['affiliates_name']); ?>",  y: <?php echo($rowStatus['c']); ?>}
	 {name:"<?php echo($rowStatus['affiliates_name']); ?> " + <?php echo($rowStatus['c']); ?>,  y: <?php echo($rowStatus['c']); ?>}  
	<?php 
	
	
	
if($num!=$x){ 
 ?>
	 ,
	 <?php } } ?>
	 ] 
            }]
        });
    });
});
		</script>
	 

<div id="containerDonor" style="min-width: 280px; height: 300px; max-width: 600px; margin: 0 auto"></div><?php */?>
               
               
               <?php /*?>
               
<div id="containerafferDEvice" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script>
Highcharts.chart('containerafferDEvice', {
    chart: {
        type: 'column'
    },
    title: {
        text: 'Monthly Average Rainfall'
    },
    subtitle: {
        text: 'Source: WorldClimate.com'
    },
    xAxis: {
        categories: [ <?php 
		$sqlStatusAffilates=mysqli_query($connect,"SELECT 
affiliates_name
,
count(0) total
 

,count( case when `affil_landingLogs_device` like '%Mobile%'  then  1 end ) mobile
,count( case when `affil_landingLogs_device` like '%Tablet%'  then  1 end ) Tablet

,count( case when `affil_landingLogs_device` like '%desktop%'  then  1 end ) desktop
,hour(`affil_landingLogs_date`) hro


FROM `affil_landinglogs2017917`  inner join affiliates on `affil_landingLogs_affid`=affiliates_id
 where date(`affil_landingLogs_date`)=date(now())
group by hour(`affil_landingLogs_date`)
order by 
hour(`affil_landingLogs_date`) asc
");
$x=0;
$num=mysqli_num_rows($sqlStatusAffilates);
$totalSubs=0;
while($rowStatusaff=mysqli_fetch_array($sqlStatusAffilates)){ $x++;
echo($rowStatusaff['hro']);

 if($num!=$x){ 
 ?>
	 ,
	 <?php } }  ?>
			
			
			
        ],
        crosshair: true
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Rainfall (mm)'
        }
    },
    tooltip: {
        headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
        pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
            '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
        footerFormat: '</table>',
        shared: true,
        useHTML: true
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0
        }
    },
    series: [{
		
		
		
		
        name: 'Tokyo',
        data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]

    }, {
        name: 'New York',
        data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3]

    }, {
        name: 'London',
        data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2]

    }, {
        name: 'Berlin',
        data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]

    }
	
	
	
	
	
	
	]
}); 

</script>
               <?php */?>
               
              
              
              
           
<div id="containeraffeDevices"  style="width:100%; height:300px"></div>   
              
              
              
              
              <script>
var colors = Highcharts.getOptions().colors,
    categories = [<?php 
		$sqlStatusAffilates=mysqli_query($connect,"SELECT 
affiliates_name
,
count(0) total
 

,count( case when `affil_landingLogs_device` like '%Mobile%'  then  1 end ) mobile
,count( case when `affil_landingLogs_device` like '%Tablet%'  then  1 end ) Tablet

,count( case when `affil_landingLogs_device` like '%desktop%'  then  1 end ) desktop
,hour(`affil_landingLogs_date`) hro


FROM `affil_landinglogs2017917`  inner join affiliates on `affil_landingLogs_affid`=affiliates_id
 where date(`affil_landingLogs_date`)=date(now())
group by affiliates_id
 
");
$x=0;
$num=mysqli_num_rows($sqlStatusAffilates);
$totalSubs=0;
while($rowStatusaff=mysqli_fetch_array($sqlStatusAffilates)){ $x++;
?>"<?php  echo($rowStatusaff['affiliates_name']); ?>"<?php 


 if($num!=$x){ 
 ?>
	 ,
	 <?php } }  ?>
			
			
			
			
			],
    data = [
	
	
	
	
	 
	<?php 
		$sqlStatusAffilates=mysqli_query($connect,"SELECT 
affiliates_name
,
count(0) total
 

,count( case when `affil_landingLogs_device` like '%Mobile%'  then  1 end ) mobile
,count( case when `affil_landingLogs_device` like '%Tablet%'  then  1 end ) Tablet

,count( case when `affil_landingLogs_device` like '%desktop%'  then  1 end ) desktop
,hour(`affil_landingLogs_date`) hro


FROM `affil_landinglogs2017917`  inner join affiliates on `affil_landingLogs_affid`=affiliates_id
 where date(`affil_landingLogs_date`)=date(now())
group by affiliates_id
 
");
$x=0;
$num=mysqli_num_rows($sqlStatusAffilates);
$totalSubs=0;
while($rowStatusaff=mysqli_fetch_array($sqlStatusAffilates)){ $x++;
 
?>

	{
        y: <?php echo($rowStatusaff['total']); ?>,
        color: colors[0],
        drilldown: {
            name: 'MSIE versions',
            categories: ['Desktop ', 'mobile', 'tablet'],
            data: [<?php  echo($rowStatusaff['desktop']); ?>,<?php  echo($rowStatusaff['mobile']); ?>,<?php  echo($rowStatusaff['Tablet']); ?>],
            color: colors[<?php echo($x -1 ); ?>]
        }
    }
	

<?php 
 if($num!=$x){ 
 ?>
	 ,
	 <?php } }  ?>
	
	 
	
	
	
	
	
	
	],
    browserData = [],
    versionsData = [],
    i,
    j,
    dataLen = data.length,
    drillDataLen,
    brightness;


// Build the data arrays
for (i = 0; i < dataLen; i += 1) {

    // add browser data
    browserData.push({
        name: categories[i],
        y: data[i].y,
        color: data[i].color
    });

    // add version data
    drillDataLen = data[i].drilldown.data.length;
    for (j = 0; j < drillDataLen; j += 1) {
        brightness = 0.2 - (j / drillDataLen) / 5;
        versionsData.push({
            name: data[i].drilldown.categories[j],
            y: data[i].drilldown.data[j],
            color: Highcharts.Color(data[i].color).brighten(brightness).get()
        });
    }
}

// Create the chart
Highcharts.chart('containeraffeDevices', {
    chart: {
        type: 'pie'
    },
    title: {
        text: 'Devices Views per Affiliates '
    },
    subtitle: {
        text: ''
    },
    yAxis: {
        title: {
            text: ' '
        }
    },
    plotOptions: {
        pie: {
			 allowPointSelect: true,
            shadow: false,
            center: ['50%', '50%'],
			
			  dataLabels: {
					//	format: '{point.name}<br>{point.percentage:.1f} %',
                        enabled: true
                    }
					//,                    showInLegend: true
			
			
        }
    },
    tooltip: {
        valueSuffix: '%'
    },
    series: [{
        name: 'Browsers',
        data: browserData,
        size: '60%',
        dataLabels: {
            formatter: function () {
                return this.y > 5 ? this.point.name : null;
            },
            color: '#ffffff',
            distance: -30
        }
    }, {
        name: 'Versions',
        data: versionsData,
        size: '80%',
        innerSize: '60%',
        dataLabels: {
            formatter: function () {
                // display only if larger than 1
                return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '' : null;
            }
        }
    }]
});</script>
              
              
              
               
              
              
              
              
              
               
               
            </div>
        </div>
    </div>
    <!--/span-->





<div class="box col-md-6">
        <div class="box-inner homepage-box">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-list-alt"></i>Cost </h2>

                <div class="box-icon">
                    <a href="#" class="btn btn-minimize btn-round btn-default"><i
                            class="glyphicon glyphicon-chevron-up"></i></a>
                    <a href="#" class="btn btn-close btn-round btn-default"><i
                            class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
                 
               
               
               <script type="text/javascript">
			// var  ProjectSt= new Array();
			 
$(function () {

    $(document).ready(function () {

        // Build the chart
        $('#containerInv').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                type: 'pie'
            },
            title: {
                text: ''
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
							format: '{point.name}<br>{point.percentage:.1f} %',
                        enabled: true
                    },
                    showInLegend: true
                }
            },
            series: [{
                name: 'Brands',
                colorByPoint: true,
                data:[ 
			      <?php  $sqlStatus=mysqli_query($connect,"

select sum(projects_budget) c,sector_name  from projects inner join  
sector on   projects_sectorID=sector_id
group by sector_id
");
$x=0;
$num=mysqli_num_rows($sqlStatus);

while($rowStatus=mysqli_fetch_array($sqlStatus)){ $x++;
	 
	?>
	//ProjectSt[]={name:"<?php echo($rowStatus['sector_name']); ?>",  y: <?php echo($rowStatus['c']); ?>}
	 {name:"<?php echo($rowStatus['sector_name']); ?>",  y: <?php echo($rowStatus['c']); ?>}  
	<?php 
	
	
	
if($num!=$x){ 
 ?>
	 ,
	 <?php } } ?>
	 ]/*[{
                    name: 'Microsoft Internet Explorer',
                    y: 56.33
                }, {
                    name: 'Chrome',
                    y: 24.03,
                    sliced: true,
                    selected: true
                }, {
                    name: 'Firefox',
                    y: 10.38
                }, {
                    name: 'Safari',
                    y: 4.77
                }, {
                    name: 'Opera',
                    y: 0.91
                }, {
                    name: 'Proprietary or Undetectable',
                    y: 0.2
                }]*/
            }]
        });
    });
});
		</script>
	 

<div id="containerInv" style="min-width: 280px; height: 300px; max-width: 600px; margin: 0 auto"></div>
               
             
             
             <a href="#" style="    float: right;">More...</a>
             
            </div>
        </div>
    </div>







    
</div><!--/row-->


</div><!--/row-->
    <!-- content ends -->
    </div><!--/#content.col-md-0-->
</div><!--/fluid-row-->

  
   

    <hr> 