Page 1 of 1

Cannot Get Monthly Sales Report Page Crashes

Posted: Tue Jan 28, 2014 7:43 pm
by rlopez
We are running Gold R6 Build 6169 Live. We cannot get the Monthly Sales report to run. When clicking on the button in Admin we receive and error.

Code: Select all


Server Error in '/' Application
Year, Month, and Day parameters describe an un-representable DateTime. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
Stack Trace: 
[ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.]
   System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day) +12728000
   AbleCommerce.Admin.Reports.MonthlySales.Page_Load(Object sender, EventArgs e) +375
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
 
What's ironic is we can't get to the page to set any Params Year, Month, day i.e. Also I see that when R6 build was released this [AC8-1910] - Monthly Sales Report should allow for a custom date range] was included with the build. I can't find any other set-up we may have missed. I searched the forums but did not find anyone else with this problem. All other reports under the sales category in admin run fine.

Re: Cannot Get Monthly Sales Report Page Crashes

Posted: Wed Jan 29, 2014 5:48 am
by jmestep
I just tried on a couple of sites and got the same crash. I will post a bug. It can possibly be fixed with code change on the page but I don't have time to do it. Here is a screenshot of the error with debug turned on.

Re: Cannot Get Monthly Sales Report Page Crashes

Posted: Wed Jan 29, 2014 9:15 am
by AbleMods
Easy to fix. Just modify the /admin/reports/MonthlySales.aspx.cs file.

Find this code:

Code: Select all

        fromDate = new DateTime(localNow.Year, localNow.Month - 1, 1);
and replace it with this code:

Code: Select all

        // BEGIN MOD: AbleMods LLC
        // DATE:  01/29/2014
        // BUG FIX: math to subtract from current date is flawed when current month is January

        //fromDate = new DateTime(localNow.Year, localNow.Month - 1, 1);

        fromDate = localNow.AddMonths(-1);
        fromDate = new DateTime(fromDate.Year, fromDate.Month, 1);

        // END MOD: AbleMods LLC

Re: Cannot Get Monthly Sales Report Page Crashes

Posted: Wed Jan 29, 2014 6:29 pm
by rlopez
Joe, thanks for the fix. Applied and is now working.

Re: Cannot Get Monthly Sales Report Page Crashes

Posted: Fri Jan 31, 2014 4:58 am
by mazhar
Thanks for reporting this. I just confirmed and registered it in our logs.