Weekly Sales Report using Crystal Reports
The following source code will teach you on how to create a “Weekly Sales Report” using Crystal Reports.
The most important part of this project is the use of SQL Statement. Here’s the statement that create a weekly sales report.
- SELECT TOP (100) PERCENT CONVERT(VARCHAR, DATEADD(WEEK, DATEDIFF(WEEK, CONVERT(DATETIME, '1900-01-01 00:00:00', 102), DATE), CONVERT(DATETIME,
- '1900-01-01 00:00:00', 102)), 101) AS DATE, SUM(Amount) AS Amount
- FROM dbo.Sales
- GROUP BY CONVERT(VARCHAR, DATEADD(WEEK, DATEDIFF(WEEK, CONVERT(DATETIME, '1900-01-01 00:00:00', 102), DATE), CONVERT(DATETIME, '1900-01-01 00:00:00', 102)),
- ORDER BY DATE
This statement can be found on the SQL Server database that is included in the zip file.
You need to change the connection string just in case you’re using a different name like the one I used here - “LOCALHOST\SQLEXPRESS”.
Follow the tutorial on “How to Change Connection String of VB.NET Project at Design Time”
Additionally, you will need to change the “ServerName” that is found under frmReports form as follows:
myConnectionInfo.ServerName = "LOCALHOST\SQLEXPRESS"
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.