Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi EveryBody,

I want to print a bill below like this
Date :- 10/25/14
abc
Date Amount Qty
---------------------------------------------------
21-10-2014
---------------------------------------------------
Sales = 33.00 3
Purchase = 30.00 3
Sliver Coins
(Worth Rs.) = 0 0
G.P. = 3.00
Bal = 30.00
----------------------------------------------------

Cancel = 0
23-10-2014
----------------------------------------------------
Sales = 33.00 3
Purchase = 30.00 3
Sliver Coins
(Worth Rs.) = 0 0
G.P. = 3.00
Bal = 30.00
----------------------------------------------------

Cancel = 0
----------------------------------------------------
Payable : 60.00
----------------------------------------------------

How's this posslible in c#.
I am make the code like below for making this type of receipt in c#.

// Code
C#
DataSet _dtRecord = _clsComm.GetPurchaseReportNew(userId: clsCommonOperations.UserID, startDate: StartDate, endDate: EndDate);
            if (_dtRecord.Tables[0].Rows.Count > 0)
            {
                sb.AppendLine("\t\t Date :- " + DateTime.Now.ToShortDateString());
                sb.AppendLine("\t\t " + clsCommonOperations.USERNAME.ToString());
                sb.AppendLine("\t Date \t\t Amount \t Qty");
                sb.AppendLine("-------------------------------------------------------------------");

                for (int i = 0; i < _dtRecord.Tables[1].Rows.Count; i++)
                {
                    DataRow[] drw = _dtRecord.Tables[0].Select("recordDate='" + _dtRecord.Tables[1].Rows[i][0].ToString()+"'");
                    if (drw.Length > 0)
                    {
                        sb.AppendLine(_dtRecord.Tables[1].Rows[i][0].ToString());
                        sb.AppendLine("-------------------------------------------------------------------");
                        sb.AppendLine("Sales \t\t = \t " + drw[0]["Sales"].ToString().Trim() + " \t " + drw[0]["qty"].ToString().Trim());
                        sb.AppendLine("Purchase \t = \t " + drw[0]["Purchase"].ToString().Trim() + " \t " + drw[0]["qty"].ToString().Trim());
                        sb.AppendLine("Sliver Coins");
                        sb.AppendLine("(Worth Rs.)\t = \t "+drw[0]["Receipt"].ToString().Trim()+" \t "+ drw[0]["TotalPendingReceipt"].ToString().Trim());
                        sb.AppendLine("G.P. \t\t = \t "+drw[0]["GP"].ToString().Trim());
                        sb.AppendLine("Bal \t\t = \t "+drw[0]["Bal"].ToString().Trim());
                        sb.AppendLine("-------------------------------------------------------------------");
                        sb.AppendLine("");
                        sb.AppendLine("Cancel \t\t = \t "+drw[0]["cancel"].ToString().Trim());
                    }
                }
                if (_dtRecord.Tables[2].Rows.Count > 0)
                {
                    sb.AppendLine("-------------------------------------------------------------------");
                    sb.AppendLine("Payable \t\t : \t " + _dtRecord.Tables[2].Rows[0][0].ToString().Trim());
                    sb.AppendLine("-------------------------------------------------------------------");
                }
richTextBox1.AppendText(sb.ToString());


But I do not want to know how to print this record as bill

Please help me how to print this bill as pos espon print
Posted
Comments
Marc Gabrie 25-Oct-14 7:37am    
Is your project a desktop Windows app or ASP.NET website?
Ram Kumar(Webunitech) 27-Oct-14 1:36am    
window app

1 solution

To print anything, don't use a rich text box: just use a PrintDocument[^] - it's designed for it, and allows you to specify the exact layout of your print.

The link includes an example.
 
Share this answer
 
Comments
Ram Kumar(Webunitech) 27-Oct-14 1:38am    
Dear Sir,
I use this but i want to print on roll paper not a a4 paper.
Just like a billing receipt paper just like an atm paper

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