473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 4682
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Luis Serrano | last post by:
Hi all, I'm trying to generate labels to print in several different formats, all of them with their own height,width and page margins. We've got this done in MS Access 2000, using a designed...
0
by: banderas | last post by:
Just wondering if it is possible to use access to create grpahs and even print reports? Is it possible to link excell with access so one can be the date base and when graphs and analytical reports...
0
by: Ian | last post by:
(Sorry if I have repeated this, it did not appear the first time) I have the following code on a button. The idea is that when this button is clicked it prints several reports automatically then...
0
by: Ann | last post by:
I have a C# application that uses PrintDocument and PrintPage to draw reports. Now I need to integrate a tax form printing from a legacy VC++ DLL into the C# application. One of the important...
8
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that...
3
by: Przemo | last post by:
Hi, I have an ASP.NET 2.0 application. I need to generate some documents (reports) like invoices, orders, etc. Users need them to preview and print. Which of methods is the best for doing it:...
2
by: Hexman | last post by:
Hello All, I'm now getting into the reporting phase of my application development. I need to print not only continuous page reports from a datasource (database, datagridview, listboxes, etc),...
2
by: Thall | last post by:
Hey Gurus - I've seen a few solutions to this problem, but none of which I can do without a little help. Here's the situation The following code loops thru a sales report, using the sales rep ID...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.