Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i generate invoice bill like this using report or any other way please see link for image ......

http://www.codeproject.com/KB/cs/PrintInvoice_CS/Img027.JPG[^]

i take products details form DatagridView and add to the listView
id>> product name>> quantity >> price
1 >> abc >> 1 >> 12
2 >> abc >> 5 >> 15
this all info i store in listView like above. now tell me how this listview data show in my invoice .


this is my print view code
C#
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
       {
           e.Graphics.DrawString("Invoice No: " + txtInvoiceNo.Text, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 180));

          // e.Graphics.DrawString("Invoice Date: " + dtpInvoiceDate.Text, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 200));
           e.Graphics.DrawString("Invoice Date: " + DateTime.Now, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 220));


           e.Graphics.DrawString(label1.Text, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 250));

           e.Graphics.DrawString("Item No", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 280));
           e.Graphics.DrawString("Product Name", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(180, 280));
           e.Graphics.DrawString("Quantity", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(400, 280));
           e.Graphics.DrawString("Unit Price", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(550, 280));
           e.Graphics.DrawString("Total Amount", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(670, 280));
           e.Graphics.DrawString(label1.Text, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 300));



           e.Graphics.DrawString("Total:", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(550, 400));
           e.Graphics.DrawString("Rs." + txtSubTotal.Text, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(670, 400));
           e.Graphics.DrawString(label1.Text, new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 380));

       }
Posted
Updated 11-Nov-14 5:13am
v3
Comments
raajaakhan 12-Nov-14 1:41am    
@OriginalGriff

Hi raajaakhan,

Please go through reportviewer/crystalreports controls. this will solve all your problem and they are easy to use too..
 
Share this answer
 
There are multiple ways of doing this job in .NET, you can use already built-in solutions to create invoices for your softwares or you can use WPF or Win Forms Controls to create an interface of your own. Adding an image in the question doesn't explain the problem.

In that invoice, he is using an image in the top, then a bunch of TextBlock, a line, a few more TextBlocks, a line, then a Table to contain all of the products in each of the row of its.

Then in the final paragraph (kind of thing) he is adding up the details of the products that were selected and shows the result of them. Now this depends on your approach for the application whether you're using C++'s Win32, C#'s Win Forms or WPF application to develop the software. You can somehow in every case get the details on creating the UI from the .NET Controls from MSDN[^] documents.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900