![]() |
PowerPoint Report Template - Monthly Sales 3See Microsoft ® PowerPoint ® Report
Function and SQL
/*********************************************************
Sales by Categories
*********************************************************/
/* Calculate the total */
@F3_1=REPORT(slide=3 type=fix cell=B3)
SELECT SUM(d.Quantity)
, Sum(d.UnitPrice * d.Quantity * (1-d.Discount))
FROM Orders o
,OrderDetails d
,Products p
,Categories c
WHERE o.OrderID = d.OrderID
AND d.ProductID = p.ProductID
AND p.CategoryID = c.CategoryID
AND YEAR(o.OrderDate) = YEAR('$ReportMonth-01')
AND MONTH(o.OrderDate) = MONTH('$ReportMonth-01')
/* Calculate the sales amount and quantity by categories */
@F3_2=REPORT(slide=3 type=var cell=A2)
SELECT c.CategoryName
, SUM(d.Quantity)
, Sum(d.UnitPrice * d.Quantity * (1-d.Discount))
FROM Orders o
,OrderDetails d
,Products p
,Categories c
WHERE o.OrderID = d.OrderID
AND d.ProductID = p.ProductID
AND p.CategoryID = c.CategoryID
AND YEAR(o.OrderDate) = YEAR('$ReportMonth-01')
AND MONTH(o.OrderDate) = MONTH('$ReportMonth-01')
GROUP BY c.CategoryName
ORDER BY c.CategoryName
/* For chart */
@F3_3=CHART(slide=3 cell=A0)
SELECT c.CategoryName
, Sum(d.UnitPrice * d.Quantity * (1-d.Discount))
FROM Orders o
,OrderDetails d
,Products p
,Categories c
WHERE o.OrderID = d.OrderID
AND d.ProductID = p.ProductID
AND p.CategoryID = c.CategoryID
AND YEAR(o.OrderDate) = YEAR('$ReportMonth-01')
AND MONTH(o.OrderDate) = MONTH('$ReportMonth-01')
GROUP BY c.CategoryName
ORDER BY c.CategoryName
These sample reports are generated by PTReportGen (Report Generator for Microsoft PowerPoint). The sample reports in Microsoft PowerPoint format can be download for your report templates, and changed to adapt to your own needs. It is free. Download the report samples in Microsoft PowerPoint format PPT (560KB)
|
Copyright © 2006 LJZsoft Corporation. All rights reserved.