Page 1 of 1
Custom reports
Posted: Tue Apr 20, 2010 5:17 pm
by KCarlson
Is it possible to do custom reports in AC7 without having the source code? I did some custom reports in AC5, but looking at the code for reports in AC7 it looks much harder to do your own. I need to get a report by payment type, like the daily sales report, but with the utilized payment methods as the rows instead of the individual order ids.
Re: Custom reports
Posted: Tue Apr 20, 2010 5:53 pm
by Shopping Cart Admin
Hello,
Both are written in asp.net which is pretty easy to access the database information. So I wouldn't think either product has an edge in report creation. The source code wouldn't be needed at all.
Re: Custom reports
Posted: Tue Apr 20, 2010 6:09 pm
by KCarlson
But the new ones use the ReportDataSource class which has methods that I can't change or add to. The reports in Able 5 used SQL which made them easier to modify. I could write them from scratch using SQL, but some of them I just want to add a field to. For example, I would like to add item counts to the daily sales report.
Re: Custom reports
Posted: Wed Apr 21, 2010 7:26 am
by mazhar
Either you are looking to show order items count against each order entry in reprot or want to show total order numbers on report I think its possiable without source ReportDataSource. If this is the order item count then add new column to gridview. Add a new method called int CountOrderItems(Object dataItem) in back end code. Finally use this method in new column something like
Code: Select all
<%#CountOrderItems(Container.DataItem)%>
and method code should be something like
Code: Select all
protected int CountOrderItems(Object dataItem)
{
OrderSummary summary = (OrderSummary)dataItem;
Order order = OrderDataSource.Load(summary.OrderId);
int productCount = 0;
foreach (OrderItem orderItem in order.Items)
if (orderItem.OrderItemType == OrderItemType.Product)
productCount++;
return productCount;
}
Re: Custom reports
Posted: Wed Apr 21, 2010 10:39 am
by KCarlson
Thanks. That will really help. I will try that this morning. I would also like the ability to add new reports. For example, a report on the payment types used for a date range of orders. Would I need to add a method for ReportDataSource to do that?
Re: Custom reports
Posted: Wed Apr 21, 2010 11:08 am
by mazhar
You don't need to add any thing to ReportDataSource. You can crate your custom class under with custom queries under App_Code folder of your website. Finally you can create your report UI and make use of your custom class to fetch the desired data against desired input.
Re: Custom reports
Posted: Wed Apr 21, 2010 1:17 pm
by KCarlson
While I have you in a discussion, one example of a modification to an existing report I need is the product breakdown report. It would be good if we could see the variants in that.
Re: Custom reports
Posted: Thu Apr 22, 2010 7:37 am
by mazhar
We have number of partners who provide custom development services. Have a look at partners page.
http://www.ablecommerce.com/Development ... 11C33.aspx