zoukankan      html  css  js  c++  java
  • 发票管理及打印系统的部分代码

    这里是发票管理及打印系统的部分代码,不才,献丑了,有需要的可以参考一下 

     代码

            PrinterSettings printerSets = new PrinterSettings();
            PageSettings pageSets 
    = new PageSettings();

           
    private void printdoc_PrintPage(object sender, PrintPageEventArgs e)
            {
                XmlDocument _xdoc 
    = new XmlDocument();
                _xdoc.LoadXml(
    this.printFaPiaoXml);

                PrintDrawString(e, 
    065, _xdoc.SelectSingleNode("/row/开票日期").InnerText.Trim());
                PrintDrawString(e, 
    0275, fapiaoSets.行业);

                PrintDrawString(e, 
    20"付款方:" + _xdoc.SelectSingleNode("/row/付款方").InnerText.Trim()); //河南新互联通信服务咨询有限公司
                PrintDrawString(e, 2370"付款方纳税人识别号:" + _xdoc.SelectSingleNode("/row/付款方税号").InnerText.Trim());
                PrintDrawString(e, 
    30"收款方:" + fapiaoSets.收款方);
                PrintDrawString(e, 
    3370"收款方纳税人识别号:" + fapiaoSets.收款方税号);

                PrintDrawString(e, 
    40"项目明细");
                PrintDrawString(e, 
    50"项目");
                PrintDrawString(e, 
    5260"金额");
                PrintDrawString(e, 
    5400"备注");
                
    int i = 6;
                
    foreach (XmlNode node in _xdoc.SelectNodes("/row/项目明细/项目"))
                {
                    PrintDrawString(e, i, 
    0, node.InnerText.Trim());
                    PrintDrawString(e, i, 
    260, node.Attributes["金额"].Value.Trim());
                    PrintDrawString(e, i, 
    400, node.Attributes["备注"].Value.Trim());
                    i
    ++;
                }

                PrintDrawString(e, 
    130"合计人民币(大写):" + MoneyConvertChinese.MoneyToChinese(_xdoc.SelectSingleNode("/row/金额合计").InnerText.Trim()));
                PrintDrawString(e, 
    13380"合计人民币(小写):CNY" + _xdoc.SelectSingleNode("/row/金额合计").InnerText.Trim());
                
    //PrintDrawString(e, 13, 600, "付款方式:" + "现金");

                PrintDrawString(e, 
    150"开票人:" + fapiaoSets.开票人);
                PrintDrawString(e, 
    15150"审核人:" + fapiaoSets.审核人);

                PrintDrawString(e, 
    160"主管税务机关:" + fapiaoSets.主管税务机关);
            }
            
    /// <summary>
            
    /// 处理打印文字
            
    /// </summary>
            
    /// <param name="e">PrintPageEventArgs</param>
            
    /// <param name="lineIndex">行号</param>
            
    /// <param name="PointX">X轴偏移量</param>
            
    /// <param name="drawString">文字</param>
            private void PrintDrawString(PrintPageEventArgs e, int lineIndex, int PointX, string drawString)
            {
                
    //Y轴预设偏移量
                int defaultY = 110;
                
    //X轴预设偏移量
                int defaultX = 60;
                
    //行距
                int defaultLineHeight = 22;

                e.Graphics.DrawString(drawString, 
    new Font("KaiTi_GB2312"10), Brushes.Black, new PointF(defaultX + PointX, defaultY + (lineIndex * defaultLineHeight)));
            }
     
           
    /// <summary>
            
    /// 打印前事件,设定打印参数
            
    /// </summary>
            
    /// <param name="sender"></param>
            
    /// <param name="e"></param>
            private void printdoc_BeginPrint(object sender, PrintEventArgs e)
            {
                
    this.pageSets.PrinterSettings.PrinterName = getPrinterName();
                
    this.pageSets.PaperSize = this.fapiaoSize;
                
    this.pageSets.Landscape = false;

                
    this.printerSets.DefaultPageSettings.PaperSize = this.pageSets.PaperSize;
                
    this.printerSets.PrinterName = getPrinterName();

                
    this.printdoc.DocumentName = "机打发票";
                
    this.printdoc.DefaultPageSettings = this.pageSets;
                
    this.printdoc.PrinterSettings = this.printerSets;
            }
  • 相关阅读:
    tomcat配置多实例
    内存溢出的三种情况及解决办法分析
    se最佳设置
    Squid 3.1.7通过mysql_auth方式认证
    java在linux下显示中文解决方法
    AD域批量的导入导出账号 转
    JSP技术分享:常用禁止缓存的四种方法
    大幅优化myeclipse的速度&关闭自动更新
    迷你图标集大集合:5000+ 30套免费的图标(不得不下,设计必备)
    【转】开发实战:舍得网44587行代码开发经验
  • 原文地址:https://www.cnblogs.com/hope250/p/1956457.html
Copyright © 2011-2022 走看看