<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This method writes the inventory by product data for a given category.
$strCat = $_GET['category'];
//XML Data container
$strXML = "<chart caption='" . $strCat . " - Inventory by Products' PYAxisName='Cost of Inventory' SYAxisName='Units in Inventory' xAxisName='Products' palette='" . getPalette() . "' animation='" . getAnimationState() . "' showValues='0' formatNumberScale='0' numberPrefix='\$' labelDisplay='STAGGER' seriesNameInToolTip='0'>";
//Add the data
$strXML .= getInventoryByProdXML($strCat, true);
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
//Output it
header('Content-type: text/xml');
echo $strXML;
if (!isset($_GET['year']) || $_GET['year'] == "") {
    $intYear = 1996;
} else {
    $intYear = $_GET['year'];
}
//Render page headers
echo render_pageHeader();
//Render the main table open
echo render_pageTableOpen();
?>
<table width='875' align='center' cellspacing='0' cellpadding='0'>
	<tr>
	<td align='center'>
	<?php 
//Generate the XML data for the main pie chart.
$strXML = "<chart caption='Sales By Country for " . $intYear . "' palette='" . getPalette() . "' animation='" . getAnimationState() . "' formatNumberScale='0' numberPrefix='\$' labeldisplay='ROTATE' slantLabels='1' seriesNameInToolTip='0' sNumberSuffix=' pcs.' showValues='0' plotSpacePercent='0'>";
$strXML .= getSalesByCountryXML($intYear, -1, true, false);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
echo renderChart("FusionCharts/MSColumn3DLineDY.swf", "", $strXML, "NewChart", 850, 300, false, false);
?>
	</td>
	</tr>
</table>

<?php 
//Separator line
echo drawSepLine();
?>
	
?>
);"><OPTION value='5'>5<OPTION value='10'>10<OPTION value='20'>20<OPTION value='30'>30</SELECT>&nbsp;&nbsp;Expensive Products</span>
</FORM>
</CENTER>
<?php 
//Separator line
echo drawSepLine();
?>
	


<table width='875' align='center' cellspacing='0' cellpadding='0'>
	<tr>
	<td align='center'>
	<?php 
$strXML = "<chart caption='" . $intYear . " - Top 5 Cities By Sales ' palette='" . getPalette() . "' animation='" . getAnimationState() . "' formatNumberScale='0' numberPrefix='\$' seriesNameInToolTip='0' sNumberSuffix=' pcs.' showValues='0' plotSpacePercent='0' labelDisplay='STAGGER'>";
$strXML .= getSalesByCityXML($intYear, 5, false);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
echo renderChart("FusionCharts/Column3D.swf", "", $strXML, "TopCities", 700, 250, false, true);
?>
	</td>
	</tr>
</table>

<?php 
//Separator line
echo drawSepLine();
?>
	
//If year has not been provided, we default to 1996
if (!isset($_GET['year']) || $_GET['year'] == "") {
    $intYear = 1996;
} else {
    $intYear = $_GET['year'];
}
//Render page headers
echo render_pageHeader();
//Render the main table open
echo render_pageTableOpen();
?>
<table width='875' align='center' cellspacing='0' cellpadding='0'>
	<tr>
	<td align='center'>
	<?php 
$strXML = "<chart caption='Sales By Category for " . $intYear . "' palette='" . getPalette() . "' animation='" . getAnimationState() . "' formatNumberScale='0' PYAXisName='Revenue' SYAxisName='Units Sold' numberPrefix='\$' labeldisplay='STAGGER' seriesNameInToolTip='0' showValues='0' plotSpacePercent='0'>";
$strXML .= getYrlySalesByCatXML($intYear, true, false);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
echo renderChart("FusionCharts/MSColumn3DLineDY.swf", "", $strXML, "CatCum", 850, 300, false, false);
?>
	</td>
	</tr>
</table>

<?php 
//Separator line
echo drawSepLine();
?>
	
<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This method writes the sales by product data for a given category for a given year
$intYear = $_GET['year'];
$intCatId = $_GET['catId'];
//XML Data container
$strXML = "<chart caption='" . getCategoryName($intCatId) . " - Product wise sales in " . $intYear . "' PYAXisName='Revenue' SYAxisName='Units Sold' xAxisName='Products' palette='" . getPalette() . "' animation='" . getAnimationState() . "' showValues='0' formatNumberScale='0' numberPrefix='\$' labelDisplay='STAGGER' seriesNameInToolTip='0'>";
//Add the data
$strXML .= getSalesByProdCatXML($intYear, $intCatId, true);
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
//Output it
header('Content-type: text/xml');
echo $strXML;
<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This page outputs the sales by category XML data for the the specified year.
//Request the year for which we've to show data.
//If year has not been provided, we default to 1996
if (!isset($_GET['year']) || $_GET['year'] == "") {
    $intYear = 1996;
} else {
    $intYear = $_GET['year'];
}
$strXML = "<chart caption='Category wise Sales for " . $intYear . "' subcaption='(Click on a column to see monthly sales for that category in the chart below this)' XAxisName='Month' palette='" . getPalette() . "' animation='" . getAnimationState() . "' formatNumberScale='0' numberPrefix='\$' showValues='0' numDivLines='4' legendPosition='BOTTOM'>";
$strXML .= getCumulativeSalesByCatXML($intYear, true);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' color='" . getCaptionFontColor() . "' size='15' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
//Write the XML data to output stream - WITHOUT ANY HTML Tag.
header('Content-type: text/xml');
echo $strXML;
	}
	</SCRIPT>
	<LINK REL='stylesheet' HREF='Style.css' />
</HEAD>
<BODY topmargin='0' leftmargin='0' bottomMargin='0' rightMargin='0' bgColor='#EEEEEE'>
<?php 
//Render page headers
echo render_pageHeader();
//Render the main table open
echo render_pageTableOpen();
?>
<table width='875' align='center' cellspacing='0' cellpadding='0'>
	<tr>
	<td align='center'>
	<?php 
$strXML = "<chart caption='Inventory by Product Categories' subcaption='(Click on a category to see product-wise details)' PYAxisName='Cost of Inventory' SYAxisName='Units in Inventory' xAxisName='Product Category' palette='" . getPalette() . "' animation='" . getAnimationState() . "' showValues='0' formatNumberScale='0' numberPrefix='\$' labelDisplay='STAGGER' seriesNameInToolTip='0'>";
$strXML .= getInventoryByCatXML(true, false);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
echo renderChart("FusionCharts/MSColumn3DLineDY.swf", "", $strXML, "ByCategory", 800, 300, false, false);
?>
	</td>
	</tr>
</table>

<?php 
//Separator line
echo drawSepLine();
?>
	
<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This method writes the top n employees  and their sales quantity for a given year.
//To this page, we're provided year and count
$intYear = $_GET['year'];
$count = $_GET['count'];
//XML Data container
$strXML = "<chart caption='Top 5 Employees for " . $intYear . "' palette='" . getPalette() . "' animation='" . getAnimationState() . "' subCaption='(Click to slice out or right click to choose rotation mode)' YAxisName='Sales Achieved' YAxisName='Quantity' showValues='0' numberPrefix='\$' formatNumberScale='0' showPercentInToolTip='0'>";
$strXML .= getSalePerEmpXML($intYear, $count, false, false, true);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
//Output it
header('Content-type: text/xml');
echo $strXML;
<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This method writes the number of orders the employee processes yearly data as XML.
//To this page, we're provided employeed Id.
$eId = $_GET['id'];
//XML Data container
$strXML = "<chart caption='Number of Orders - " . getEmployeeName($eId) . "' xAxisName='Year' palette='" . getPalette() . "' animation='" . getAnimationState() . "' >";
//Get the data for employee for 3 years - 1994,95,96
$strXML .= "<set label='1994' value='" . getNumOrders($eId, 1994) . "' />";
$strXML .= "<set label='1995' value='" . getNumOrders($eId, 1995) . "' />";
$strXML .= "<set label='1996' value='" . getNumOrders($eId, 1996) . "' />";
$strXML .= "</chart>";
//Output it
header('Content-type: text/xml');
echo $strXML;
function getNumOrders($eId, $intYear)
{
    // Function to connect to the DB
    $link = connectToDB();
    //Retrieve the data
    $strSQL = "SELECT Count(OrderID) As Total FROM FC_Orders WHERE YEAR(OrderDate)=" . $intYear . " and EmployeeID=" . $eId;
    $result = mysql_query($strSQL) or die(mysql_error());
    if ($result) {
        if (mysql_num_rows($result) > 0) {
            $ors = mysql_fetch_array($result);
            $getNumOrders = $ors['Total'];
        } else {
            $getNumOrders = 0;
<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This method writes the top n customers  and their purchase quantity for a given year.
//To this page, we're provided year and count
$intYear = $_GET['year'];
$count = $_GET['count'];
//XML Data container
//We do a conditional label formatting
//If number of items to show on chart is less than 10, we wrap them
//else we show as rotated
if ($count > 10) {
    $labelFormatting = " labelDisplay='ROTATE' slantLabels='1' ";
} else {
    $labelFormatting = " labelDisplay='WRAP' ";
}
$strXML = "<chart caption='Top " . $count . " Customers for " . $intYear . "' palette='" . getPalette() . "' animation='" . getAnimationState() . "' PYAxisName='Amount' SYAxisName='Quantity' showValues='0' numberPrefix='\$' sNumberSuffix=' pcs.' seriesNameInToolTip='0' formatNumberScale='0' " . $labelFormatting . ">";
$strXML .= getTopCustomersXML($intYear, $count, true);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
//Output it
header('Content-type: text/xml');
echo $strXML;
<?php

include "Includes/Connection_inc.php";
include "Includes/Functions.php";
include "DataGen.php";
//This method writes the top n expensive items and its sales quantity for a given year.
//To this page, we're provided year and count
$intYear = $_GET['year'];
$count = $_GET['count'];
//We do a conditional label formatting
//If number of items to show on chart is less than 10, we wrap them
//else we show as rotated
if ($count > 10) {
    $labelFormatting = " labelDisplay='ROTATE' slantLabels='1' ";
} else {
    $labelFormatting = " labelDisplay='WRAP' ";
}
//XML Data container
$strXML = "<chart caption='Sale of " . $count . " Most Expensive Products for " . $intYear . "' PYAxisName='Unit Price' SYAxisName='Units Sold for the year' palette='" . getPalette() . "' animation='" . getAnimationState() . "' formatNumberScale='0' numberPrefix='\$' seriesNameInToolTip='0' sNumberSuffix=' pcs.' showValues='0' plotSpacePercent='0' " . $labelFormatting . ">";
$strXML .= getExpensiveProdXML($intYear, $count, true);
//Add some styles to increase caption font size
$strXML .= "<styles><definition><style type='font' name='CaptionFont' size='15' color='" . getCaptionFontColor() . "' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles>";
$strXML .= "</chart>";
//Output it
header('Content-type: text/xml');
echo $strXML;