Solved

Building Invoice Using CrystalReports

Posted on 2007-11-19
6
637 Views
Last Modified: 2008-02-01
I've never worked with CrystalReports (2005) before, but I've done quite a bit of work with ASP/ASP.Net.  Here's my situation.  I've got an application almost completely developed using a 3-tier structure (interface, business layer, data layer).  I need to now integrate CrystalReports for the purpose of printing an invoice.  Basically, when the user views an invoice on the screen two functions are invoked from my BLL - GetInvoiceDetails and GetLineItems.  The first one gets details such as who the customer is, the job it's for, the date, etc.  GetLineItems, interestingly enough, gets all the line items for the invoice.  Both take a parameter for the invoice ID from the query string.  What I can't for the life of me figure out however is how to build a report using these two functions as the data sources.  To provide a little more info, GetInvoiceDetails returns a custom 'Invoice' object, and GetLineItems returns a DataTable.  I would love it if someone can give me some insight into how to do this, preferably with references and/or code samples.  Thanks in advance!
0
Comment
Question by:anoyes
  • 3
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 20317773
Crystal wants either a dataset (the result of your functions) or to link directly to teh database.  I don't believe that it can use your functions.

Can you connect Crystal to the database ?

mlmcc
0
 
LVL 16

Author Comment

by:anoyes
ID: 20344879
Sorry it's taken me so long to respond - haven't had time to get back to this.  Can I dynamically build a dataset from the data from those two functions and bind the report to that?  I'd prefer not to bind the report directly to the database if at all possible.  Thanks.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 20346415
You should be able to.  Idon't know how to do it.

mlmcc
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 22

Assisted Solution

by:Ido Millet
Ido Millet earned 200 total points
ID: 20391348
Just create two stored procedures that accept the Invoice ID as a parameter.  Then, create the invoice as a main report (customer info) and a linked subreport (detail).

You can even denormalize the whole thing into a single stored procedure (repeating the customer info for each detail line.  That woulkd allow you to do this in a main report without a subreport.

- Ido
0
 
LVL 16

Author Comment

by:anoyes
ID: 20469324
Again, sorry for the delay.  I'd really prefer to not directly connect to the database if I can avoid it. mlmcc has indicated that it's possible to bind to a dataset that I've dynamically built - does anyone know how to build the dataset and bind to it?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 20472654
I don't know how to do it in ASP.  Creating the dataset is specific to your database.

Here is code to pass a dataset to Crystal.  It is not in ASP
http://www.emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx

mlmcc
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question