469,344 Members | 6,511 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,344 developers. It's quick & easy.

What is the best way to create and print reports?

Hi,
I'm writing a program that helps manging a store. i have one form that deals
with products selling, in this form the user enters the customers details and
the products which he bought. after the user payed for these products, i want
to print a invoice, and now i don't know which way is the best one? one
option i know, is to draw the invoice by myself (using drawlines and etc.),
second way is using crystal reports, i'm not sure which way is better, and if
there any other ways.. so if any one can help me, i will appreciate it.

Thanks,
Gidi.
Nov 17 '05 #1
4 4540
Hi,

Between the two options that you mention I thnk that CR is the best, you set
the ReportDocument.SetDataSource() to a dataset containing the invoice data
you want and that's all

making & printing a report manually is a big pain..... you have to deal
with page break, margins, printers, etc
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:2F**********************************@microsof t.com...
Hi,
I'm writing a program that helps manging a store. i have one form that
deals
with products selling, in this form the user enters the customers details
and
the products which he bought. after the user payed for these products, i
want
to print a invoice, and now i don't know which way is the best one? one
option i know, is to draw the invoice by myself (using drawlines and
etc.),
second way is using crystal reports, i'm not sure which way is better, and
if
there any other ways.. so if any one can help me, i will appreciate it.

Thanks,
Gidi.

Nov 17 '05 #2
Actually you write your own printable components and alignment panels
that know how to print themselves, slide and print across page
borders... so you just drag, drop and print :)

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3
If I were you I would use Crystal Reports.

That said, there are two ways to use CR. One is the way that Ignacio
mentioned: the "push" model. Put your data in a DataSet, and push your
DataSet at CR by calling ReportDocument.SetDataSource(). The other way
is to write your invoice to a database (which maybe you were going to
do anyway) and then write a Crystal report that knows how to get the
invoice information back out of the database and report it.

We do things the first way (the way that Ignacio suggested). It's a bit
tricky, but once you get it figured out it works OK.

However, if you're using a database, the second way may be superior.
It's the more "usual" way of using CR, and CR tends to behave better
when used as a "pull" reporting tool rather than accepting a "push". As
well, it serves as a confirmation that you have, in fact, committed the
invoice information to the database. No commit, no report.

Either way, it's not terribly difficult, and CR gives you the
flexibility to easily change the look of your invoices, or even have
multiple invoice formats that you can switch between depending upon the
situation.

CR also gives you export-to-PDF and other nifty features for free. Why
reinvent the wheel? CR isn't the best reporting package out there, but
it beats anything you can do yourself.

Nov 17 '05 #4

"Bruce Wood" <br*******@canada.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
If I were you I would use Crystal Reports.

That said, there are two ways to use CR. One is the way that Ignacio
mentioned: the "push" model. Put your data in a DataSet, and push your
DataSet at CR by calling ReportDocument.SetDataSource(). The other way
is to write your invoice to a database (which maybe you were going to
do anyway) and then write a Crystal report that knows how to get the
invoice information back out of the database and report it.

We do things the first way (the way that Ignacio suggested). It's a bit
tricky, but once you get it figured out it works OK.

However, if you're using a database, the second way may be superior.
It's the more "usual" way of using CR, and CR tends to behave better
when used as a "pull" reporting tool rather than accepting a "push". As
well, it serves as a confirmation that you have, in fact, committed the
invoice information to the database. No commit, no report.


Hi,

Regarding accesing the DB directly you should always set the connection info
using code, put the DB info in the config file and use the code below to
make sure you don't get a nasty popup ( or an Exception) asking for the
connection info. Notice that you need to set this info to all the tables of
the report:
TableLogOnInfos crTableLogonInfos = new TableLogOnInfos();
ReportDocument reportDocument1 = new OpenRecords(); //this is the
report

ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName =
System.Configuration.ConfigurationSettings.AppSett ings["Server"];
crConnectionInfo.DatabaseName =
System.Configuration.ConfigurationSettings.AppSett ings["DataBase"] ;
crConnectionInfo.UserID =
System.Configuration.ConfigurationSettings.AppSett ings["User"] ;
crConnectionInfo.Password =
System.Configuration.ConfigurationSettings.AppSett ings["Password"] ;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in
reportDocument1.Database.Tables)
{
TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
crTableLogonInfo.TableName = table.Name;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTableLogonInfos.Add( crTableLogonInfo);
table.ApplyLogOnInfo( crTableLogonInfo);

}
CrystalReportViewer1.LogOnInfo = crTableLogonInfos;
CrystalReportViewer1.ReportSource = reportDocument1;
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ian | last post: by
8 posts views Thread by Midnight Java Junkie | last post: by
3 posts views Thread by Przemo | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.