如何在c#中打印pos打印等帐单报表 [英] How to print billing report like pos printing in c#

查看:244
本文介绍了如何在c#中打印pos打印等帐单报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi EveryBody,



我想打印下面这样的账单

日期: - 10/25/14
abc

日期金额数量

------------------------- --------------------------

21-10-2014

--- ------------------------------------------------ <无线电通信/>
销售额= 33.00 3

购买= 30.00 3

Sliver硬币

(值得)= 0 0

GP = 3.00

Bal = 30.00

----------------------------- -----------------------



取消= 0

2014年10月23日

------------------------------------- ---------------

销售= 33.00 3

购买= 30.00 3

Sliver Coins

(值得)= 0 0

GP = 3.00

Bal = 30.00

----------------------------- -----------------------



取消= 0

-------------------------------------------------- -

应付款:60.00

----------------------------- -----------------------



如何在c#中实现这一点。

我在c#中制作这种收据的代码如下所示。



//代码

 DataSet _dtRecord = _clsComm.GetPurchaseReportNew(userId:clsCommonOperations.UserID,startDate:StartDate,endDate:EndDate); 
if (_dtRecord.Tables [ 0 ]。Rows.Count > 0
{
sb.AppendLine( \t\t日期: - + 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 ]。选择( recordDate =' + _dtRecord.Tables [ 1 ]。行[i] [ 0 ]。ToString()+ ' );
if (drw.Length > 0
{
sb.AppendLine(_dtRecord.Tables [ 1 ]。行[i] [ 0 ]的ToString());
sb.AppendLine( ----------------- -------------------------------------------------- );
sb.AppendLine( Sales \t\t = \t + drw [ 0 ] [ 销售 ] .ToString()。修剪()+ \t + drw [ 0 ] [ qty]。ToString()。修剪());
sb.AppendLine( Purchase \t = \t + drw [< span class =code-digit> 0
] [ 购买]。ToString ()。Trim()+ \t + drw [ 0 ] [ qty]。ToString()。Trim() );
sb.AppendLine( Sliver Coins);
sb.AppendLine( (Worth Rs。)\t = \t + drw [ 0 ] [ 收据]。ToString()。修剪()+ \t + drw [ 0 ] [ TotalPendingReceipt]。ToString() 。修剪());
sb.AppendLine( GP \t\t = \t + drw [ 0 ] [ GP ]的ToString()修剪());
sb.AppendLine( Bal \t\t = \t + drw [ 0 ] [ Bal ]的ToString()修剪());
sb.AppendLine( ----------------- -------------------------------------------------- );
sb.AppendLine( );
sb.AppendLine( 取消\t\t = \t + drw [ 0 ] [ 取消 ]的ToString()修剪());
}
}
如果(_dtRecord.Tables [ 2 ] .Rows.Count > 0
{
sb.AppendLine(< span class =code-string>
-------------------------- -----------------------------------------);
sb.AppendLine( Payable \t\t:\t + _dtRecord.Tables [ 2 ]。行[ 0 ] [ 0 ]的ToString()修剪())。。
sb.AppendLine( ----------------- -------------------------------------------------- );
}
richTextBox1.AppendText(sb.ToString());





但我不想知道如何打印此记录作为账单



请帮我如何打印此账单作为pos espon print

解决方案

< blockquote>要打印任何内容,请不要使用富文本框:只需使用 PrintDocument [ ^ ] - 它是专为它设计的,允许您指定打印的确切布局。



该链接包含一个示例。


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

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

解决方案

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.


这篇关于如何在c#中打印pos打印等帐单报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆