Your IP : 3.147.78.185
<?php session_start(); ob_start();
error_reporting(0);
@ini_set('display_error', 0); include("../cludes/connect.inc.php");
$did= $_SESSION['dsn'];
$querr=$db->query("select * FROM district WHERE sn='$did' " )or die(mysqli_error());
$ror=mysqli_fetch_array($querr);
$dis = 'for '.$ror['district'].' District';
$y = 17;
?>
<div style="width:40%; min-width:100%;">
<?php
// if(date('m')<=6){ $monthNum = 1 ; } elseif(date('m')<=9){ $monthNum = 4 ; } elseif(date('m')<=12){ $monthNum = 7 ; }
$monthNum = 7;//date('m')-6;
$m1 = date("F", mktime(0, 0, 0, $monthNum, 10));
$m2 = date("F", mktime(0, 0, 0, $monthNum+1, 10));
$m3 = date("F", mktime(0, 0, 0, $monthNum+2, 10));
$m4 = date("F", mktime(0, 0, 0, $monthNum+3, 10));
$m5 = date("F", mktime(0, 0, 0, $monthNum+4, 10));
$m6 = date("F", mktime(0, 0, 0, $monthNum+5, 10));
$m7 = date("F", mktime(0, 0, 0, $monthNum+6, 10));
$m8 = date("F", mktime(0, 0, 0, $monthNum+7, 10));
$n1 = $monthNum;
$n2 = $monthNum+1;
$n3 = $monthNum+2;
$n4 = $monthNum+3;
$n5 = $monthNum+4;
$n6 = $monthNum+5;
$n7 = $monthNum+6;
$n8 = $monthNum+7;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n1' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n1' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a1 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n2' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n2' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a2 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n3' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n3' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a3 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n4' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n4' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a4 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n5' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n5' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a5 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n6' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n6' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a6 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n7' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n7' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a7 = (($roo['value_sum']+0)/$num);
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n8' AND did='$did' AND psn=1 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n8' AND did='$did' AND psn=1 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$a8 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n1' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n1' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b1 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n2' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n2' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b2 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n3' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n3' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b3 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n4' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n4' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b4 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n5' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n5' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b5 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n6' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n6' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b6 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n7' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n7' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b7 = (($roo['value_sum']+0)/$num);
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n8' AND did='$did' AND psn=3 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n8' AND did='$did' AND psn=3 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$b8 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n1' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n1' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c1 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n2' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n2' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c2 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n3' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n3' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c3 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n4' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n4' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c4 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n5' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n5' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c5 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n6' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n6' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c6 = ($roo['value_sum']+0)/$num;
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n7' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n7' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c7 = (($roo['value_sum']+0)/$num);
$result = $db->query("SELECT SUM(total) AS value_sum FROM report WHERE yy = '$y' AND mm = '$n8' AND did='$did' AND psn=4 ");
$res = $db->query("SELECT * FROM report WHERE yy = '$y' AND mm = '$n8' AND did='$did' AND psn=4 ");
$roo = mysqli_fetch_assoc($result);
$num = mysqli_num_rows($res);
$c8 = ($roo['value_sum']+0)/$num;
$u=($a1+$a2)/2;
$v=($a5+$a6)/2;
$w=$v-$u;
$z=($w/$u)*100;
if($z>0){$rem = 'Growing';} else{$rem = 'Not Growing'; }
$p = new chartphp();
$p->data = array(array(array(substr($m1, 0,3),$a1),array(substr($m2, 0,3),$a2),array(substr($m3, 0,3),$a3),array(substr($m4, 0,3),$a4),array(substr($m5, 0,3),$a5),array(substr($m6, 0,3),$a6)),
array(array(substr($m1, 0,3),$b1),array(substr($m2, 0,3),$b2),array(substr($m3, 0,3),$b3),array(substr($m4, 0,3),$b4),array(substr($m5, 0,3),$b5),array(substr($m6, 0,3),$b6)),
array(array(substr($m1, 0,3),$c1),array(substr($m2, 0,3),$c2),array(substr($m3, 0,3),$c3),array(substr($m4, 0,3),$c4),array(substr($m5, 0,3),$c5),array(substr($m6, 0,3),$c6)));
$p->chart_type = "line";
// Common Options
$p->title = "Monthly Church Growth Chart ".$dis;
$p->ylabel = "Attendance";
$p->xlabel = "Comparing Reports of Six Months";
$p->series_label = array('Sun','Mon','Thu');
//$p->options["axes"]["yaxis"]["tickOptions"]["prefix"] = '=N=';
$out3 = $p->render('c3');
?> <?php echo $out3; ?>
Growth Rate: <strong><?php echo number_format($z,2); ?>%</strong> Remark: <strong><?php echo $rem; ?></strong>
</div>