private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { int oX = 20, oY = 40; //偏移量 int xStep = 232; int yStep = 33; Font headFont = new Font("Arial", 14, FontStyle.Bold); Font drawFont = new Font("Arial", 9); Pen blackPen = new Pen(Color.Black, 2); StringFormat drawFormat1 = new StringFormat(); drawFormat1.Alignment = StringAlignment.Center; drawFormat1.LineAlignment = StringAlignment.Center; StringFormat drawFormat2 = new StringFormat(); drawFormat2.Alignment = StringAlignment.Near; drawFormat2.LineAlignment = StringAlignment.Center; StringFormat drawFormat3 = new StringFormat(); drawFormat3.Alignment = StringAlignment.Far; drawFormat3.LineAlignment = StringAlignment.Center; Rectangle headRec = new Rectangle(oX, oY, 286, yStep); Rectangle rec = new Rectangle(oX, oY, xStep, yStep); //Pen pen = new Pen(Color.Black, 10); headRec.X = oX / 2; headRec.Y = oY / 8; e.Graphics.DrawString("玉溪联合企业物资计量单", headFont, Brushes.Black, headRec, drawFormat1); //合同号 rec.Y = oY; rec.Width = 300; //设置控件宽度 //rec.Width = xStep; e.Graphics.DrawString("合同号: " + ultraGrid3.ActiveRow.Cells["FS_CONTRACTNO"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //发货单位 rec.Y = oY + 1 * yStep; //rec.Width = 300; e.Graphics.DrawString("发货单位: " + ultraGrid3.ActiveRow.Cells["FS_SUPPLIERNAME"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //收货单位 rec.Y = oY + 2 * yStep; e.Graphics.DrawString("收货单位: " + ultraGrid3.ActiveRow.Cells["FS_Receiver"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //物资名称 rec.Width = 239; //物料名称太长了换行 rec.Y = oY + 3 * yStep; e.Graphics.DrawString("物资名称: " + ultraGrid3.ActiveRow.Cells["FS_MATERIALNAME"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); rec.Width = 300; //物料名称太长了换行后还原 //承运单位 rec.Y = oY + 4 * yStep; e.Graphics.DrawString("承运单位: " + ultraGrid3.ActiveRow.Cells["FS_TRANSNAME"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); if (tbStoveNo.Text.Trim() != "") { //车号 rec.Y = oY + 7 * yStep; rec.Width = xStep; //设置控件宽度 e.Graphics.DrawString("车号: " + ultraGrid3.ActiveRow.Cells["FS_CarNo"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); } else { //车号 rec.Y = oY + 5 * yStep; rec.Width = xStep; //设置控件宽度 e.Graphics.DrawString("车号: " + ultraGrid3.ActiveRow.Cells["FS_CarNo"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); } if (tbStoveNo.Text.Trim() != "") { //炉号 rec.Y = oY + 5 * yStep; e.Graphics.DrawString("炉号: " + ultraGrid3.ActiveRow.Cells["FS_StoveNo"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //轧制建议 //rec.X = oX + 2 * xStep; rec.Y = oY + 5 * yStep; e.Graphics.DrawString("轧制建议: " + ultraGrid3.ActiveRow.Cells["FS_ZZJY"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat3); //支数 //rec.Y = oY + 5 * yStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("支(块)数: " + ultraGrid3.ActiveRow.Cells["FN_Count"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //建议轧制规格 //rec.X = oX + 2 * xStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("建议轧制规格: " + ultraGrid3.ActiveRow.Cells["FS_ADVISESPEC"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat3); //日期 rec.Y = oY + 8 * yStep; e.Graphics.DrawString("日期: " + ultraGrid3.ActiveRow.Cells["FD_TAREDateTime"].Text.Trim().Substring(0, 10), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 9 * yStep; e.Graphics.DrawString("时间: " + ultraGrid3.ActiveRow.Cells["FD_TAREDateTime"].Text.Trim().Substring(11, 8), drawFont, Brushes.Black, rec, drawFormat2); //毛重 //rec.X = oX + 2 * xStep; rec.Y = oY + 7 * yStep; e.Graphics.DrawString("毛重: " + ultraGrid3.ActiveRow.Cells["FN_GrossWEIGHT"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); //皮重 //rec.X = oX + 2 * xStep; rec.Y = oY + 8 * yStep; e.Graphics.DrawString("皮重: " + ultraGrid3.ActiveRow.Cells["FN_TareWEIGHT"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); //净重 rec.Y = oY + 9 * yStep; e.Graphics.DrawString("净重: " + ultraGrid3.ActiveRow.Cells["FN_NetWEIGHT"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); //计量点 rec.Y = oY + 10 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + ultraGrid3.ActiveRow.Cells["FS_TAREPOINTNAME"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //计量员 rec.Y = oY + 11 * yStep; e.Graphics.DrawString("编号: " + ultraGrid3.ActiveRow.Cells["FS_FULLLABELID"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //备注 rec.Y = oY + 12 * yStep; yStep = 36; e.Graphics.DrawString("备注: " + ultraGrid3.ActiveRow.Cells["FS_BZ"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(ultraGrid3.ActiveRow.Cells["FS_FULLLABELID"].Text.Trim(), 320, 80, 3, e); //注意 rec.Y = oY + 14 * yStep; //yStep = 66;前面备注那已经赋值了 e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, drawFormat2); e.HasMorePages = false; } else { //日期 rec.Y = oY + 6 * yStep; e.Graphics.DrawString("日期: " + ultraGrid3.ActiveRow.Cells["FD_TAREDateTime"].Text.Trim().Substring(0, 10), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("时间: " + ultraGrid3.ActiveRow.Cells["FD_TAREDateTime"].Text.Trim().Substring(11, 8), drawFont, Brushes.Black, rec, drawFormat2); //毛重 //rec.X = oX + 2 * xStep; rec.Y = oY + 5 * yStep; e.Graphics.DrawString("毛重: " + ultraGrid3.ActiveRow.Cells["FN_GrossWEIGHT"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); //皮重 //rec.X = oX + 2 * xStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("皮重: " + ultraGrid3.ActiveRow.Cells["FN_TareWEIGHT"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); bool isYKL = false; if (tbYKL.Text.Trim() != "" && tbYKL.Text.Trim() != "0") isYKL = true; bool isYKBL = false; if (tbYKBL.Text.Trim() != "" && tbYKBL.Text.Trim() != "0") isYKBL = true; if ((!isYKL) && (!isYKBL)) { //净重 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("净重: " + ultraGrid3.ActiveRow.Cells["FN_NetWEIGHT"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); } else { if (isYKL) { //扣渣 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("扣渣量: " + ultraGrid3.ActiveRow.Cells["FS_YKL"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); } else { //扣渣 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("扣渣比例: " + ultraGrid3.ActiveRow.Cells["FS_YKBL"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat3); } rec.Y = oY + 8 * yStep; e.Graphics.DrawString("净重(扣后): " + ultraGrid3.ActiveRow.Cells["FS_KHJZ"].Text.Trim() + " t", drawFont, Brushes.Black, rec, drawFormat3); } //计量点 rec.Y = oY + 8 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + ultraGrid3.ActiveRow.Cells["FS_TAREPOINTNAME"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //计量员 rec.Y = oY + 9 * yStep; e.Graphics.DrawString("编号: " + ultraGrid3.ActiveRow.Cells["FS_FULLLABELID"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat2); //备注 rec.Y = oY + 10 * yStep; yStep = 36; e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(ultraGrid3.ActiveRow.Cells["FS_FULLLABELID"].Text.Trim(), 320, 80, 0, e); //注意 rec.Y = oY + 12 * yStep; //e.Graphics.DrawString("注意:本凭证请妥善保管遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, drawFormat2); e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, drawFormat2); e.HasMorePages = false; } }
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { int oX = 20, oY = 40; //偏移量 int xStep = 232; int yStep = 33; Font headFont = new Font("Arial", 14, FontStyle.Bold); Font drawFont = new Font("Arial", 9); Pen blackPen = new Pen(Color.Black, 2); StringFormat drawFormat1 = new StringFormat(); drawFormat1.Alignment = StringAlignment.Center; drawFormat1.LineAlignment = StringAlignment.Center; StringFormat drawFormat2 = new StringFormat(); drawFormat2.Alignment = StringAlignment.Near; drawFormat2.LineAlignment = StringAlignment.Center; StringFormat drawFormat3 = new StringFormat(); drawFormat3.Alignment = StringAlignment.Far; drawFormat3.LineAlignment = StringAlignment.Center; Rectangle headRec = new Rectangle(oX, oY, 286, yStep); Rectangle rec = new Rectangle(oX, oY, xStep, yStep); //Pen pen = new Pen(Color.Black, 10); headRec.X = oX / 2; headRec.Y = oY / 8; e.Graphics.DrawString("昆钢公司物资计量单", headFont, Brushes.Black, headRec, drawFormat1); //获取服务器时间 string strServerTime = getImage.GetServerTime(); string[] serverTime = strServerTime.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); DateTime date = Convert.ToDateTime(serverTime[0]); string time = serverTime[1]; //DateTime dtCode = Convert.ToDateTime(strServerTime); //string strCode = dtCode.ToString("yyyyMMddHHmmss") + strJLDID; if (print.printJLLX == "外协") { //车号 rec.Y = oY; rec.Width = xStep; //设置控件宽度 e.Graphics.DrawString("车号: " + print.printCH, drawFont, Brushes.Black, rec, drawFormat2); //日期 rec.Y = oY + 1 * yStep; e.Graphics.DrawString("日期: " + date.ToShortDateString(), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 1 * yStep; e.Graphics.DrawString("时间: " + time, drawFont, Brushes.Black, rec, drawFormat3); //重量 rec.Y = oY; e.Graphics.DrawString("重量: " + print.printJZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //计量点 rec.Y = oY + 2 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + print.printJLD, drawFont, Brushes.Black, rec, drawFormat2); //计量员 改为编号 rec.Y = oY + 3 * yStep; e.Graphics.DrawString("编号: " + strCode, drawFont, Brushes.Black, rec, drawFormat2); //备注 rec.Y = oY + 4 * yStep; yStep = 36; e.Graphics.DrawString("备注:" + print.printJLLX + " 收费金额:" + this.tbCharge.Text.Trim() + " 元", drawFont, Brushes.Black, rec, drawFormat2); //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(strCode, 320, 80, 2, e); //注意 rec.Y = oY + 6 * yStep; //yStep = 66;前面备注那已经赋值了 e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2); return; } //合同号 rec.Y = oY; rec.Width = 300; //设置控件宽度 //rec.Width = xStep; e.Graphics.DrawString("合同(订单)号: " + print.printHTH, drawFont, Brushes.Black, rec, drawFormat2); //string strMonth = DateTime.Now.Month.ToString(); //string strYear = DateTime.Now.Year.ToString(); //string strXTBH = strYear + strMonth; //发货单位 rec.Y = oY + 1 * yStep; //rec.Width = 300; e.Graphics.DrawString("发货单位: " + print.printFHDW, drawFont, Brushes.Black, rec, drawFormat2); //收货单位 rec.Y = oY + 2 * yStep; e.Graphics.DrawString("收货单位: " + print.printSHDW, drawFont, Brushes.Black, rec, drawFormat2); //物资名称 //string s_printWLMC1 = ""; //string s_printWLMC2 = ""; //if (print.printWLMC.Length > 12) //{ // s_printWLMC1 = print.printWLMC.Substring(0, 12); // s_printWLMC2 = print.printWLMC.Substring(13); // rec.Y = oY + 3 * yStep; // e.Graphics.DrawString("物资名称: " + print.printWLMC, drawFont, Brushes.Black, rec, drawFormat2); //} rec.Width = 239; //物料名称太长了换行 rec.Y = oY + 3 * yStep; e.Graphics.DrawString("物资名称: " + print.printWLMC, drawFont, Brushes.Black, rec, drawFormat2); rec.Width = 300; //物料名称太长了换行后还原 //承运单位 rec.Y = oY + 4 * yStep; e.Graphics.DrawString("承运单位: " + print.printCYDW, drawFont, Brushes.Black, rec, drawFormat2); if (print.printLH.Length > 0) { //车号 rec.Y = oY + 7 * yStep; rec.Width = xStep; //设置控件宽度 e.Graphics.DrawString("车号: " + print.printCH, drawFont, Brushes.Black, rec, drawFormat2); } else { //车号 rec.Y = oY + 5 * yStep; rec.Width = xStep; //设置控件宽度 e.Graphics.DrawString("车号: " + print.printCH, drawFont, Brushes.Black, rec, drawFormat2); } ////承运单位 //rec.Y = oY + 5 * yStep; //e.Graphics.DrawString("承运单位:" + comboBox5.Text, drawFont, Brushes.Black, rec, drawFormat2); //钢坯打印 if (print.printLH.Length > 0 && print.pringJLCS == "1") { //炉号 rec.Y = oY + 5 * yStep; e.Graphics.DrawString("炉号: " + print.printLH, drawFont, Brushes.Black, rec, drawFormat2); //轧制建议 //rec.X = oX + 2 * xStep; rec.Y = oY + 5 * yStep; e.Graphics.DrawString("轧制建议: " + print.printZZJY, drawFont, Brushes.Black, rec, drawFormat3); //支数 //rec.Y = oY + 5 * yStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("支(块)数: " + print.printZS, drawFont, Brushes.Black, rec, drawFormat2); //建议轧制规格 //rec.X = oX + 2 * xStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("建议轧制规格: " + print.printAdviseSpec, drawFont, Brushes.Black, rec, drawFormat3); ////钢种 //rec.Y = oY + 6 * yStep; //e.Graphics.DrawString("钢种: " + print.printGZ, drawFont, Brushes.Black, rec, drawFormat2); ////规格 //rec.Y = oY + 6 * yStep; //e.Graphics.DrawString("规格: " + print.printGG, drawFont, Brushes.Black, rec, drawFormat3); //日期 rec.Y = oY + 8 * yStep; e.Graphics.DrawString("日期: " + date.ToShortDateString(), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 9 * yStep; e.Graphics.DrawString("时间: " + time, drawFont, Brushes.Black, rec, drawFormat2); //毛重 //rec.X = oX + 2 * xStep; rec.Y = oY + 7 * yStep; e.Graphics.DrawString("毛重: " + print.printMZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //皮重 //rec.X = oX + 2 * xStep; rec.Y = oY + 8 * yStep; e.Graphics.DrawString("皮重: " + print.printPZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //净重 rec.Y = oY + 9 * yStep; e.Graphics.DrawString("净重: " + print.printJZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //计量点 rec.Y = oY + 10 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + print.printJLD, drawFont, Brushes.Black, rec, drawFormat2); //计量员 rec.Y = oY + 11 * yStep; e.Graphics.DrawString("编号: " + strCode, drawFont, Brushes.Black, rec, drawFormat2); if (print.printJLLX == "") { //备注 rec.Y = oY + 12 * yStep; yStep = 36; e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); } if (print.printJLLX != "") { //备注 rec.Y = oY + 12 * yStep; yStep = 36; e.Graphics.DrawString("备注:" + print.printJLLX, drawFont, Brushes.Black, rec, drawFormat2); } //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(strCode, 320, 80, 3, e); //注意 rec.Y = oY + 14 * yStep; //yStep = 66;前面备注那已经赋值了 e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2); if (print.printLH2.Length > 0 && print.printCS == "1" || print.printLH2.Length > 0 && print.printCS == "0") { print.printCS = "2"; } if (print.printLH3.Length > 0 && print.printCS == "2") { print.printCS = "3"; } if (print.printLH1.Length > 0 && print.printCS == "3") { print.printCS = "1"; } return; } else if (print.printLH.Length > 0 && print.pringJLCS == "") { //炉号 rec.Y = oY + 5 * yStep; e.Graphics.DrawString("炉号: " + print.printLH, drawFont, Brushes.Black, rec, drawFormat2); //轧制建议 //rec.X = oX + 2 * xStep; rec.Y = oY + 5 * yStep; e.Graphics.DrawString("轧制建议: " + ultraGrid3.ActiveRow.Cells["FS_ZZJY"].Text.Trim(), drawFont, Brushes.Black, rec, drawFormat3); //支数 //rec.Y = oY + 5 * yStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("支(块)数: " + print.printZS, drawFont, Brushes.Black, rec, drawFormat2); //建议轧制规格 //rec.X = oX + 2 * xStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("建议轧制规格: " + print.printAdviseSpec, drawFont, Brushes.Black, rec, drawFormat3); ////钢种 //rec.Y = oY + 6 * yStep; //e.Graphics.DrawString("钢种: " + print.printGZ, drawFont, Brushes.Black, rec, drawFormat2); ////规格 //rec.Y = oY + 6 * yStep; //e.Graphics.DrawString("规格: " + print.printGG, drawFont, Brushes.Black, rec, drawFormat3); //日期 rec.Y = oY + 8 * yStep; e.Graphics.DrawString("日期: " + date.ToShortDateString(), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 8 * yStep; e.Graphics.DrawString("时间: " + time, drawFont, Brushes.Black, rec, drawFormat3); //重量 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("重量: " + print.printJZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //计量点 rec.Y = oY + 9 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + print.printJLD, drawFont, Brushes.Black, rec, drawFormat2); //计量员 rec.Y = oY + 10 * yStep; e.Graphics.DrawString("编号: " + strCode, drawFont, Brushes.Black, rec, drawFormat2); ////备注 //rec.Y = oY + 9 * yStep; //yStep = 36; //e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); if (print.printJLLX == "") { //备注 rec.Y = oY + 11 * yStep; yStep = 36; e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); } if (print.printJLLX != "") { //备注 rec.Y = oY + 11 * yStep; yStep = 36; e.Graphics.DrawString("备注:" + print.printJLLX, drawFont, Brushes.Black, rec, drawFormat2); } //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(strCode, 320, 80, 4, e); //注意 rec.Y = oY + 13 * yStep; //e.Graphics.DrawString("注意:本凭证请妥善保管遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2); e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2); if (print.printLH2.Length > 0 && print.printCS == "1" || print.printLH2.Length > 0 && print.printCS == "0") { print.printCS = "2"; } if (print.printLH3.Length > 0 && print.printCS == "2") { print.printCS = "3"; } if (print.printLH1.Length > 0 && print.printCS == "3") { print.printCS = "1"; } return; } if (print.printLH.Length == 0 && print.pringJLCS == "1") { //日期 rec.Y = oY + 6 * yStep; e.Graphics.DrawString("日期: " + date.ToShortDateString(), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("时间: " + time, drawFont, Brushes.Black, rec, drawFormat2); //毛重 //rec.X = oX + 2 * xStep; rec.Y = oY + 5 * yStep; e.Graphics.DrawString("毛重: " + print.printMZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //皮重 //rec.X = oX + 2 * xStep; rec.Y = oY + 6 * yStep; e.Graphics.DrawString("皮重: " + print.printPZ + " t", drawFont, Brushes.Black, rec, drawFormat3); if (print.printYKL == "" && print.printYKBL == "") { //净重 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("净重: " + print.printJZ + " t", drawFont, Brushes.Black, rec, drawFormat3); } else { if (print.printYKL != "") { //扣渣 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("扣渣量: " + print.printYKL + " t", drawFont, Brushes.Black, rec, drawFormat3); } else { //扣渣 rec.Y = oY + 7 * yStep; e.Graphics.DrawString("扣渣比例: " + print.printYKBL, drawFont, Brushes.Black, rec, drawFormat3); } rec.Y = oY + 8 * yStep; e.Graphics.DrawString("净重(扣后): " + print.printKHJZ + " t", drawFont, Brushes.Black, rec, drawFormat3); } //计量点 rec.Y = oY + 8 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + print.printJLD, drawFont, Brushes.Black, rec, drawFormat2); //计量员 rec.Y = oY + 9 * yStep; e.Graphics.DrawString("编号: " + strCode, drawFont, Brushes.Black, rec, drawFormat2); if (print.printJLLX == "") { //备注 rec.Y = oY + 10 * yStep; yStep = 36; e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); } if (print.printJLLX != "") { //备注 rec.Y = oY + 10 * yStep; yStep = 36; e.Graphics.DrawString("备注:" + print.printJLLX, drawFont, Brushes.Black, rec, drawFormat2); } //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(strCode, 320, 80, 0, e); //注意 rec.Y = oY + 12 * yStep; //yStep = 66;前面备注那已经赋值了 e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2); } else { //日期 rec.Y = oY + 6 * yStep; e.Graphics.DrawString("日期: " + date.ToShortDateString(), drawFont, Brushes.Black, rec, drawFormat2); //时间 rec.Y = oY + 6 * yStep; e.Graphics.DrawString("时间: " + time, drawFont, Brushes.Black, rec, drawFormat3); //重量 rec.Y = oY + 5 * yStep; e.Graphics.DrawString("重量: " + print.printJZ + " t", drawFont, Brushes.Black, rec, drawFormat3); //计量点 rec.Y = oY + 7 * yStep; rec.Width = 300; e.Graphics.DrawString("计量点: " + print.printJLD, drawFont, Brushes.Black, rec, drawFormat2); //计量员 rec.Y = oY + 8 * yStep; e.Graphics.DrawString("编号: " + strCode, drawFont, Brushes.Black, rec, drawFormat2); ////备注 //rec.Y = oY + 9 * yStep; //yStep = 36; //e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); if (print.printJLLX == "") { //备注 rec.Y = oY + 9 * yStep; yStep = 36; e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2); } if (print.printJLLX != "") { //备注 rec.Y = oY + 9 * yStep; yStep = 36; e.Graphics.DrawString("备注:" + print.printJLLX, drawFont, Brushes.Black, rec, drawFormat2); } //打印条码 Code128 c128 = new Code128(); //strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; c128.printCode(strCode, 320, 80, 1, e); //注意 rec.Y = oY + 11 * yStep; //yStep = 66;前面备注那已经赋值了 e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2); } ////条码打印编号 //rec.Y = oY; //e.Graphics.DrawString("编号: " + strCode, drawFont, Brushes.Black, rec, drawFormat3); //e.Graphics.DrawRectangle(pen, rec); e.HasMorePages = false; }