<?php
/*include 'stacked_bar_classes.php';
$chart = array ( array ("", "Jan", "Feb", "Mar", "Apr" ), array ( "Serie 1", 100, 45, 25), 
						array ( "Serie 2", 80, 65, 35 ), array ( "Serie C", 55, 30, 80 ), array ( "Serie D", 55, 30, 80 ) );

	$tittle = "CHART TITTLE";
	$serie = array ( "0","FFFF00", "FF0000", "2F97FF", "564546", "784e3a", "677b75" );
	$width = 700;
	$height = 400;
	$hex_color = 'ffffff';
	$bg = new grafico($tittle,$width,$height,$hex_color,$chart,$serie);
	$bg->draw_graph();	*/
session_name('CAKEPHP'); session_start();
$conn = mysql_connect('localhost', 'root', '');
mysql_select_db('wacorp2');

$sql = "select sum(target_assigned) as `totcount`,start_date from xpert_sales_targets where financial_id=2 and user_id=14 group by start_date";
//echo $sql;
$result = mysql_query($sql);
$i = 0;
while ($row = mysql_fetch_array($result)) {

	$targ_asgn[] = $row["totcount"];
}
$sql1 = "select sum(total) as totcount from xpert_invoice inv, xpert_crmentity crm where crm.crmid = inv.invoiceid and crm.smownerid = 14 group by inv.invoicedate";
//echo $sql;
$result1 = mysql_query($sql1);
$i = 0;
while ($row1 = mysql_fetch_array($result1)) {

	$targ_ach[] = number_format($row1["totcount"], 2);
}
//echo count($targ_asgn)-1;

$target_assign = implode(', ', $targ_asgn);
//echo $target_assign;
$target_achieve = implode(', ', $targ_ach);
include 'stacked_bar_classes.php';
$chart = array(
	array("", "Jan", "Feb", "Mar"),
	array("Assigned", 190, 590),
	array("Achieved", 800, 7877)
);

$tittle = "CHART TITTLE";
$serie = array("0", "FFFF00", "FF0000", "2F97FF", "564546", "784e3a", "677b75");
$width = 700;
$height = 400;
$hex_color = 'ffffff';
$bg = new grafico($tittle, $width, $height, $hex_color, $chart, $serie);
$bg->draw_graph();
