Change default number of days on dashboard order summary
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Change default number of days on dashboard order summary
Anyone know how to do this? I played with the code but could not get it to work. Having it default to today could make someone easily miss printing orders from the night before.
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Change default number of days on dashboard order summary
Not thoroughly tested, but I think the following works.
BTW: Yes, "DateRangeList" is misspelled "DateRageList"; if it bothers you enough you can correct the spelling while you're messing around in there anyway
.
In Admin\Dashboard\OrderSummary.aspx, add another item to the list and make it selected:
In Admin\Dashboard\OrderSummary.aspx.cs, adjust the value of todayStart in Page_Load (rename it yesterdayStart if desired):
Also in Admin\Dashboard\OrderSummary.aspx.cs, there is a GetSelectedDateFilter method. It doesn't appear to be used anywhere, but just for completeness, you could add another item to the case statement and adjust the return values (original code jumps from returning 3 for case 14 to returning 5 for case 30, so in this example I added case 1 and adjusted the return values for case 7 and case 14):
BTW: Yes, "DateRangeList" is misspelled "DateRageList"; if it bothers you enough you can correct the spelling while you're messing around in there anyway

In Admin\Dashboard\OrderSummary.aspx, add another item to the list and make it selected:
Code: Select all
<asp:DropDownList ID="DateRageList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DateRageList_SelectedIndexChanged">
<asp:ListItem Text ="Today" Value="0" />
<asp:ListItem Text ="Yesterday & Today" Value="1" Selected="True" />
<asp:ListItem Text ="Last 7 Days" Value="7" />
<asp:ListItem Text ="Last 14 Days" Value="14" />
<asp:ListItem Text ="Last 30 Days" Value="30" />
<asp:ListItem Text ="Last 60 Days" Value="60" />
<asp:ListItem Text ="Last 90 Days" Value="90" />
<asp:ListItem Text ="Last 120 Days" Value="120" />
</asp:DropDownList>
Code: Select all
DateTime todayStart = new DateTime(localNow.Year, localNow.Month, localNow.Day, 0, 0, 0).AddDays(-1);
Code: Select all
switch (selectedRange)
{
case 0:
return 1;
case 1:
return 2;
case 7:
return 3;
case 14:
return 4;
case 30:
return 5;
case 60:
return 6;
case 90:
return 7;
case 120:
return 8;
default:
return 1;
}
Jay
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Change default number of days on dashboard order summary
This worked perfectly, thanks. I just changed the 120 days option to be selected and then added this.
Code: Select all
).AddDays(-120);