资源简介

C# 小票打印代码,支持市面上常用的小票打印机

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SLDESS.Helper;
using System.Drawing.Printing;

namespace zc_pos_client
{
    public class pos_printer
    {
        public string header_ = frmSystemSet.get_value(frmSystemSet.key_title_ “中储万能POS“);
        public string foot_ = frmSystemSet.get_value(frmSystemSet.key_foot_ ““);
        public string saild_id_ = “201210220001“;
        public string date_ = DateTime.Now.ToString();
        public List> datas_ = new List>();

        public string num_ = “5“;
        public string total_ = “0.00“;

        public string discount_ = “5.00“;
        public string amount_ = “43.00“; // 应收金额
        public string recv_cash_ = “45.00“;  // 收款金额
        public string ret_cash = “2.00“; // 找零金额

        public string card_no_ = “350104198311155470“; // 会员卡号
        public string mark_in_ = “43“; // 本次积分
        public string mark_available_  = “5000“; // 可用积分
        public string car_use_ = “0.00“; // 卡 消 费
        public string car_available_ = “300.00“; // 可用余额

        private System.Windows.Forms.PrintPreviewDialog printv_pos = null;
        private System.Drawing.Printing.PrintDocument printd_pos = null;

        public pos_printer()
        {
            this.printv_pos = new System.Windows.Forms.PrintPreviewDialog();
            this.printd_pos = new System.Drawing.Printing.PrintDocument();


            this.printv_pos.AutoScrollMargin = new System.Drawing.Size(0 0);
            this.printv_pos.AutoScrollMinSize = new System.Drawing.Size(0 0);
            this.printv_pos.ClientSize = new System.Drawing.Size(400 300);
            this.printv_pos.Document = this.printd_pos;
            this.printv_pos.Enabled = true;
           // this.printv_pos.Icon = ((System.Drawing.Icon)(resources.Getobject(“printv_pos.Icon“)));
            this.printv_pos.Name = “printPreviewDialog1“;
            this.printv_pos.Visible = false;
            // 
            // printd_pos
            // 
            this.printd_pos.DocumentName = “中储POS小票“;
            this.printd_pos.OriginAtMargins = true;
            this.printd_pos.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printd_pos_PrintPage);


           datas_.Clear();

           for (int i = 0; i < 5; i++)
           {
                List item1 = new List();
                this.datas_.Add(item1);
                item1.Add(“商品名称“);
                item1.Add(“6913027817039“); 
                item1.Add(“1.0“);
                item1.Add(“25.00“);
                item1.Add(“25.00“);
           }
        }

        private int getYc(double cm)
        {
            return (int)(cm / 25.4) * 100;
        }

        public string GetPrintStr()
        {
            StringBuilder sb = new StringBuilder()

评论

共有 条评论