Report Date "Business Start Time" setting?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Report Date "Business Start Time" setting?

Post by nickc » Thu Apr 10, 2008 4:42 pm

Quick inspection of /Admin/Reports/DailySales.aspx shows reporting date initialized to "LocalNow" and manipulated by DateTime.AddDays(), etc. Does the CommerceBuilder report method (ReportDataSource.GetDailySales(DateTime)) have a database or other setting anywhere to control the boundary time for date, which appears to be arbitrarily set around 6am?

User avatar
m_plugables
Commander (CMDR)
Commander (CMDR)
Posts: 149
Joined: Tue Mar 11, 2008 12:44 am
Contact:

Re: Report Date "Business Start Time" setting?

Post by m_plugables » Fri Apr 11, 2008 1:54 am

Well after inspecting the report i do not think so that there is a way to control the boundary time using this ReportDataSource.GetDailySales(DateTime) function.
Image
Visit the links below to Download Plugins for your AC7 Store
http://www.plugables.com
http://blog.plugables.com

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Report Date "Business Start Time" setting?

Post by nickc » Fri Apr 11, 2008 11:39 am

To reconcile your reports with Able reports, you can use this date manipulation:

Code: Select all

/****** Object:  UserDefinedFunction [dbo].[fnGetBusinessDate]    Script Date: 04/11/2008 09:31:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:Nick Cole
-- Create date:4/10/2008
-- Description:Generate Business Date based on passed hour, minute args
-- Defaults to 6:00am boundary time, alternate boundary time can be passed in
-- e.g. "fnGetBusinessDate(Table.DateColumn) between @StartDate and @EndDate" -- 6am boundary time
--       "fnGetBusinessDate(Table.DateColumn, 0, 0) between @StartDate and @EndDate" -- midnight boundary time
-- =============================================
CREATE FUNCTION [dbo].[fnGetBusinessDate] 
(
	@ActualDate datetime,
	@StartHour int = 6,
	@StartMinute int = 0
)
RETURNS datetime
AS
BEGIN
	DECLARE @BusinessDate datetime
	DECLARE @ActualHour int
	DECLARE @ActualMinute int

	SELECT @ActualHour = datepart(hh, @ActualDate)
	SELECT @ActualMinute = datepart(mi, @ActualDate)

	IF ((@ActualHour*60+@ActualMinute) >= (@StartHour*60+@StartMinute))
	BEGIN
		SELECT @BusinessDate = convert(char,@ActualDate,101)
	END
	ELSE
	BEGIN
		SELECT @BusinessDate = convert(char,@ActualDate - 1,101)
	END

	RETURN @BusinessDate

END

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Report Date "Business Start Time" setting?

Post by sohaib » Tue May 20, 2008 5:05 am

.....have a database or other setting anywhere to control the boundary time for date, which appears to be arbitrarily set around 6am?
The boundary time in code is correctly set to midnight. This could possibly be a timezone issue. What timezone offset do you have set in your store settings?

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Report Date "Business Start Time" setting?

Post by sohaib » Fri May 30, 2008 5:30 am

We created a bug in our bug database based on this form post but we couldn't reproduce the bug. We haven't received any further information so we will be closing the bug as invalid.

If you have anything else to add please do let us know.

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Report Date "Business Start Time" setting?

Post by nickc » Fri May 30, 2008 10:37 am

Yes, not worth pursuing. Able version I'm using is too old.

Issue is actually that ac_Orders datetime is UTC, ac_PageViews datetime is UTC + TZ offset.
When I bound the two tables together in a view, couldn't get the numbers to jive as page view data was always 7 hours ahead. I've hacked around it.

-Nick

Post Reply