/// <summary> /// 用于重印上一次账单 /// </summary> public void RepeatPrint() { try { if (listPrint.Count > 0) { LPTControl.Port = Info.printPort; LPTControl.NewRow(1); LPTControl.WriteLine("----账单重印----"); foreach (string s in listPrint) { LPTControl.WriteLine(s); } LPTControl.NewRow(1); LPTControl.OpenBox(); LPTControl.CutPaper(); LPTControl.Close(); } else { MessageBox.Show("抱歉,当前没有账单可用于重印!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { } }
/// <summary> ///主线程调用用于打印下线小票 /// </summary> public void Run() { try { getmoney_income = new GetMoney_income(); getSale00_data = new GetSale00_data(); getSale01_data = new GetSale01_data(); List <string> list = new List <string>(); //list.Add(this.mainForm.OperPara.TicketHead); this.mainForm.AddExtraInfo(list, this.mainForm.OperPara.TicketHead); list.Add("**********下线处理**********"); list.Add("收银台号:" + Info.pos_id + " " + "员工号:" + Info.emp_id); list.Add("----" + Info.exit_date + "----"); list.Add("班次:" + Info.shift_num + " " + "零用金:" + Info.cashier_sum); list.Add("现金收入:" + " " + "¥:" + getmoney_income.ReturenMoney_income); list.Add("作废总额:" + " " + "¥:" + getSale00_data.ReturenWaste_amount); list.Add("招待餐饮:" + " " + "¥:" + getSale00_data.ReturenTreat_amount); list.Add("员工餐饮:" + " " + "¥:" + getSale00_data.ReturenEmp_amount); list.Add("VIP卡收入:" + " " + "¥:" + getSale00_data.ReturenVIP_amount); list.Add("促销金额:" + " " + "¥:" + getSale01_data.ReturenPromotion_amount); list.Add("折扣总额:" + " " + "¥:" + getSale01_data.ReturenDiscount_amount); list.Add("抽大钞金额:" + " " + "¥:" + Decimal.ToInt32(Info.largeBillsNum)); list.Add(" "); //list.Add(this.mainForm.OperPara.TicketTail); this.mainForm.AddExtraInfo(list, this.mainForm.OperPara.TicketTail); LPTControl.Port = Info.printPort; //LPTControl.NewRow(2); foreach (string s in list) { LPTControl.WriteLine(s); } LPTControl.NewRow(1); LPTControl.OpenBox(); LPTControl.CutPaper(); LPTControl.Close(); } catch { } }
/// <summary> /// 账单重印 打印账单 /// </summary> public void printAgain() { showMessageDia(); double cash = 0; double cashnum = 0; double changenum = 0; decimal goodsnum = 0; int counttotle = dataGridView2.Rows.Count; List <string> list = new List <string>(); //list.Add(mainForm.OperPara.TicketHead);//外界设置 mainForm.AddExtraInfo(list, mainForm.OperPara.TicketHead); list.Add("销售时间: " + dataGridView1.CurrentRow.Cells["SALE_DATE"].Value.ToString()); list.Add("款台:" + dataGridView1.CurrentRow.Cells["POS号"].Value.ToString() + " 收银员:" + dataGridView1.CurrentRow.Cells["收银员"].Value.ToString()); list.Add("编号:" + dataGridView1.CurrentRow.Cells["销售单编号"].Value.ToString()); if (dataGridView1.CurrentRow.Cells["MEAL_KIND"].Value.ToString() == "1") { list.Add("结账类型:员工餐"); } else if (dataGridView1.CurrentRow.Cells["MEAL_KIND"].Value.ToString() == "2") { list.Add("结账类型:招待"); } list.Add("品名 数量 小计"); list.Add("---------------------------"); for (int i = 0; i < counttotle; i++) { try { //组合餐的子产品不打印 if (dataGridView2.Rows[i].Cells["组合类型"].Value.ToString() != "2") { decimal qty = Convert.ToDecimal(dataGridView2.Rows[i].Cells["数量"].Value); goodsnum += qty; string price = (decimal.Round(Convert.ToDecimal(dataGridView2.Rows[i].Cells["单价"].Value) * qty + Convert.ToDecimal(dataGridView2.Rows[i].Cells["折扣"].Value), 2)).ToString(); string prod_name = dataGridView2.Rows[i].Cells["商品名称"].Value.ToString(); string prod_id = dataGridView2.Rows[i].Cells["商品ID"].Value.ToString(); list.Add(prod_name.PadRight(10, ' ') + qty.ToString() + " " + price.ToString()); } } catch { } } list.Add(" "); list.Add("数量合计:" + " " + goodsnum.ToString()); decimal saletotal = decimal.Round(Convert.ToDecimal(dataGridView1.CurrentRow.Cells["总销售额"].Value.ToString()), 2); list.Add("合计:" + " " + saletotal); for (int j = 0; j < dataGridView3.Rows.Count; j++) { cash = Convert.ToDouble(dataGridView3.Rows[j].Cells["金额"].Value); if (cash > 0) { cashnum += cash; } else { changenum += cash; } } if (changenum < 0) { changenum = -changenum; } list.Add("现金" + " " + cashnum.ToString("0.00")); list.Add("找回" + " " + changenum.ToString("0.00")); list.Add("--------账单重印--------"); //list.Add(mainForm.OperPara.TicketTail); mainForm.AddExtraInfo(list, mainForm.OperPara.TicketTail); LPTControl.Port = Info.printPort; //LPTControl.NewRow(2); foreach (string s in list) { if (!LPTControl.WriteLine(s)) { MessageBox.Show("没有安装打印机", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } LPTControl.NewRow(1); LPTControl.CutPaper(); LPTControl.Close(); }
/// <summary> /// 打印发票 /// </summary> /// <param name="saleid">销售单号</param> /// <param name="shopid">分店编号</param> /// <param name="posid">pos机号</param> /// <param name="empid">收银员编号</param> /// <param name="totalPrice">应付金额</param> /// <param name="btnInput">已付金额</param> /// <param name="type">结账类型</param> /// <param name="datetime">当前时间</param> public void PrintInvoice(string saleid, string shopid, string posid, string empid, decimal totalPrice, decimal btnInput, string type, DateTime datetime) { //实例GetSale对象用来返回销售id号 GetSaleTmp01 getSale01 = new GetSaleTmp01(saleid, shopid); int counttotle = getSale01.ReturenRecordNumber; //先清空账单 listPrint.Clear(); //listPrint.Add(this.mainForm.OperPara.TicketHead);//外界设置 this.mainForm.AddExtraInfo(listPrint, this.mainForm.OperPara.TicketHead); listPrint.Add("日期: " + datetime.ToShortDateString() + " 时间: " + datetime.ToString("HH:mm:ss")); listPrint.Add("款台:" + posid + " 收银员:" + empid); listPrint.Add("编号:" + saleid); if (type.Equals("员工餐") || type.Equals("招待")) { listPrint.Add("结账类型:" + type); } listPrint.Add("品名 数量 小计 "); listPrint.Add("----------------------------"); decimal totqunt = 0; for (int i = 0; i < counttotle; i++) { try { //组合餐的子产品不打印 if (getSale01.ReturnComb_Type(i) != "2") { decimal qty = decimal.Round(getSale01.ReturnQty(i), 0); totqunt += qty; //小计 string price = (decimal.Round(Convert.ToDecimal(getSale01.ReturnSale_Price(i)) * qty + Convert.ToDecimal(getSale01.ReturnItem_Disc_Tot(i)), 2)).ToString(); string prod_name = getSale01.ReturnProd_Name1(getSale01.ReturnProdID(i)); string Prod_id = getSale01.ReturnProdID(i); //设置打印内容 listPrint.Add(prod_name.PadRight(10, ' ') + qty.ToString() + " " + price.ToString()); } //总金额实现 } catch { } } // decimal totqunt = decimal.Round(GetSaleTmp00.InitGetSaleTmp00(shopid, saleid).SaleTmp00TotQuan(), 0); listPrint.Add(" "); listPrint.Add("数量合计:" + " " + decimal.Round(totqunt, 0).ToString()); listPrint.Add("合计:" + " " + decimal.Round(totalPrice, 2).ToString()); listPrint.Add("现金" + " " + decimal.Round(btnInput, 2).ToString()); listPrint.Add("找回" + " " + decimal.Round((btnInput - totalPrice), 2).ToString()); this.mainForm.AddExtraInfo(listPrint, this.mainForm.OperPara.TicketTail); LPTControl.Port = Info.printPort; //如果选择打印按钮则打印小票 if (enablePrint || type.Equals("员工餐") || type.Equals("招待")) { //LPTControl.NewRow(2); foreach (string s in listPrint) { LPTControl.WriteLine(s); } LPTControl.NewRow(1); LPTControl.CutPaper(); } PoleDisplayer.Clear(); PoleDisplayer.Change(this.txtGiveBack.Text); LPTControl.OpenBox(); LPTControl.Close(); }