Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am currently working on a web application. In this I have to display today's sales, weekly sale's and monthly sales. I didn't get the idea to display weekly sales. I want to display both details and chart. Anybody have the idea to get the current weeks details...?

Thank you....
Posted
Updated 6-Aug-12 20:05pm
v2
Comments
Prabhakaran Soundarapandian 7-Aug-12 0:59am    
You want to show in Chart or as details?
Neha Thanka 7-Aug-12 1:01am    
I have to display in both ways in 2 different pages.

1 solution

if you are asking for getting current week range then below is the function code for getting current week range
C#
// to get First date of week
        public string fDate()
        {
            DayOfWeek weekStart = new DayOfWeek();
            DateTime startdate = DateTime.Today.AddDays(weekStart - DateTime.Today.DayOfWeek);
            string Fdateofweek= startdate.ToShortDateString();
            return Fdateofweek;
        }
        // to get today date
        public string cDate()
        {
            DateTime enddate = DateTime.Today;
            string CurrnetDay =enddate.ToShortDateString();
            return CurrnetDay;
        }


Now Make Sql Query
like
C#
string query = "select * from tablename WHERE Date BETWEEN '" + fDate() + "' AND '" + cDate() + "'";
 
Share this answer
 
v2
Comments
Neha Thanka 7-Aug-12 6:26am    
Thank you so much.....
Volynsky Alex 8-Aug-12 18:21pm    
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900