Change default number of days on dashboard order summary

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Change default number of days on dashboard order summary

Post by compunerdy » Mon Oct 19, 2015 8:06 am

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.

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Change default number of days on dashboard order summary

Post by jguengerich » Tue Oct 20, 2015 4:26 am

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:

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>
In Admin\Dashboard\OrderSummary.aspx.cs, adjust the value of todayStart in Page_Load (rename it yesterdayStart if desired):

Code: Select all

            DateTime todayStart = new DateTime(localNow.Year, localNow.Month, localNow.Day, 0, 0, 0).AddDays(-1);
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):

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

User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Re: Change default number of days on dashboard order summary

Post by compunerdy » Tue Oct 20, 2015 5:36 am

This worked perfectly, thanks. I just changed the 120 days option to be selected and then added this.

Code: Select all

).AddDays(-120);

Post Reply