L
ead
S
ources
G
raph (% of Plan vs % of Actual)
write(WriteCustomSelections())
var TotalCount = 0.00; var TotalCurrent = 0.00; var TotalPlan = 0.00; var Rank = "0"; cursor = database.cursor( "SELECT Count(*) TotalCount, SUM(CurrentSales) TotalCurrent, "+ "SUM(PlanSales) TotalPlan "+ "FROM SalesInformation "); while( cursor.next() ) { TotalCount = cursor.TotalCount; TotalCurrent = cursor.TotalCurrent; TotalPlan= cursor.TotalPlan; } cursor.close(); cursor = database.cursor( "SELECT LeadName, Count(*) Cnt, "+ " SUM(s.PlanSales) SumPS, "+ " SUM(s.CurrentSales) SUMCS "+ " FROM LeadSources l, Salesinformation s, Customer c, Product p "+ " WHERE l.LeadID = c.LeadID AND s.CustID=c.CustID "+ " AND s.ProdID = p.ProdID "+ BuildQuery(client.CustID, client.ProdID, client.CustGroupID, client.ProdGroupID)+ " GROUP BY c.LeadID, LeadName "); while( cursor.next() ) { Rank = parseInt(Rank,10) + 1; write("
\n"); write("
\n") write("
\n"); } cursor.close();