Sales
Performance by
Region
write(WriteCustomSelections())
Empty1 = 1;
Empty2 = 1;
Empty3 = 1;
Empty4 = 1;
Inc1 = 0;
Inc2 = 0;
Inc3 = 0;
Inc4 = 0;
cursor = database.cursor( "Select c.Region, "+
" (SUM(CurrentSales) / SUM(PriorSales)-1.0) * 100 Inc "+
"from SalesInformation s, Customer c, Product p "+
"where c.CustID = s.CustID "+
"and s.ProdID = p.ProdID "+
BuildQuery(client.CustID, client.ProdID, client.CustGroupID, client.ProdGroupID)+
"group by c.Region "+
"order by c.region, Inc desc ");
while( cursor.next() )
{
if (cursor.Region == 1)
{
Inc1 = cursor.Inc;
Empty1 = 0;
}
if (cursor.Region == 2)
{
Inc2 = cursor.Inc;
Empty2 = 0;
}
if (cursor.Region == 3)
{
Inc3 = cursor.Inc;
Empty3 = 0;
}
if (cursor.Region == 4)
{
Inc4 = cursor.Inc;
Empty4 = 0;
}
}
cursor.close();
write("" + DisplayRegion("4", Inc4, "West", Empty4) + " | ");
write("" + DisplayRegion("2", Inc2, "Midwest", Empty2) + " | ");
write("" + DisplayRegion("1", Inc1, "East", Empty1) + " |
");
write("" + DisplayRegion("3", Inc3, "Southeast", Empty3) + " | ");
write(" | ");