Пример #1
0
        // 打印汽车衡榜单
        private void CarWeightPrint(PrintPageEventArgs e)
        {
            int oX = 20, oY = 40;  //偏移量
             int xStep = 232 + 40;
             int yStep = 25;

             Font headFont = new Font("Arial", 14, FontStyle.Bold);
             Font drawFont = new Font("Arial", 9);
             Pen blackPen = new Pen(Color.Black, 2);
             StringFormat formatCenter = new StringFormat();
             formatCenter.Alignment = StringAlignment.Center;
             formatCenter.LineAlignment = StringAlignment.Center;

             StringFormat formatLeft = new StringFormat();
             formatLeft.Alignment = StringAlignment.Near;
             formatLeft.LineAlignment = StringAlignment.Center;

             StringFormat formatRight = new StringFormat();
             formatRight.Alignment = StringAlignment.Far;
             formatRight.LineAlignment = StringAlignment.Center;

             Rectangle headRec = new Rectangle(oX, oY, 286, yStep);
             Rectangle rec = new Rectangle(oX, oY, xStep, yStep);
             Rectangle rec2 = new Rectangle(oX, oY, xStep, yStep*2);

             //Pen pen = new Pen(Color.Black, 10);

             headRec.X = oX / 2;
             headRec.Y = oY / 8;
             e.Graphics.DrawString("玉溪联合企业物资计量单", headFont, Brushes.Black, headRec, formatCenter);

             //获取服务器时间
             string strDate = Data.Date.ToString("yyyy") + "-" + _lable.Date.ToString("MM") + "-" + _lable.Date.ToString("dd");
             string strTime = Data.Date.ToString("HH") + ":" + Data.Date.ToString("mm") + ":" + Data.Date.ToString("ss");

             #region 外协
             if (!string.IsNullOrEmpty(Data.Charge))
             {
             //车号
             rec.Y = oY;
             rec.Width = xStep; //设置控件宽度
             e.Graphics.DrawString("车号: " + Data.CarNo, drawFont, Brushes.Black, rec, formatLeft);

             //日期
             rec.Y = oY + 1 * yStep;
             e.Graphics.DrawString("日期: " + strDate, drawFont, Brushes.Black, rec, formatLeft);
             //时间
             rec.Y = oY + 1 * yStep;
             //rec.X += 10;
             e.Graphics.DrawString("时间: " + strTime, drawFont, Brushes.Black, rec, formatRight);

             //重量
             rec.Y = oY;
             e.Graphics.DrawString("重量: " + Data.Weight + " t", drawFont, Brushes.Black, rec, formatRight);

             //计量点
             rec.Y = oY + 2 * yStep;
             rec.Width = 300;
             e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, formatLeft);

             //计量员 改为编号
             rec.Y = oY + 3 * yStep;
             rec.Width = xStep;
             e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, formatLeft);

             //卡号
             rec.Y = oY + 3 * yStep;
             e.Graphics.DrawString("卡号: " + Data.CardNumber, drawFont, Brushes.Black, rec, formatRight);

             //备注
             rec.Y = oY + 4 * yStep;
             rec.Width = 300;
             yStep = 36;
             e.Graphics.DrawString("备注: 外协     收费金额:" + Data.Charge + " 元", drawFont, Brushes.Black, rec, formatLeft);

             //打印条码
             Code128 c128 = new Code128();
             c128.printCarCode(Data.BarCode, 320, 60, 2, e);

             //注意
             rec.Y = oY + 6 * yStep - 10;
             //yStep = 66;前面备注那已经赋值了
             rec.Height += 20;
             rec.Width = 300;
             e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, formatLeft);
             return;
             }
             #endregion
             //合同号
             rec.Y = oY;
             rec.Width = 300; //设置控件宽度
             //rec.Width = xStep;
             e.Graphics.DrawString("合同(订单)号: " + Data.ContractNo, drawFont, Brushes.Black, rec, formatLeft);

             //发货单位
             rec.Y = oY + 1 * yStep;
             //rec.Width = 300;
             e.Graphics.DrawString("发货单位: " + Data.SupplierName, drawFont, Brushes.Black, rec, formatLeft);

             //收货单位
             rec.Y = oY + 2 * yStep;
             e.Graphics.DrawString("收货单位: " + Data.Receiver, drawFont, Brushes.Black, rec, formatLeft);

             //物资名称
             rec.Width = 239; //物料名称太长了换行
             rec.Y = oY + 3 * yStep;
             e.Graphics.DrawString("物资名称: " + Data.MaterialName, drawFont, Brushes.Black, rec, formatLeft);
             rec.Width = 300; //物料名称太长了换行后还原

             //承运单位
             rec.Y = oY + 4 * yStep;
             e.Graphics.DrawString("承运单位: " + Data.TransName, drawFont, Brushes.Black, rec, formatLeft);

             if (!string.IsNullOrEmpty(Data.StoveNo))
             {
             //车号
             rec.Y = oY + 8 * yStep;
             rec.Width = xStep; //设置控件宽度
             e.Graphics.DrawString("车号: " + Data.CarNo, drawFont, Brushes.Black, rec, formatLeft);
             }
             else
             {
             //车号
             rec.Y = oY + 5 * yStep;
             rec.Width = xStep; //设置控件宽度
             e.Graphics.DrawString("车号: " + Data.CarNo, drawFont, Brushes.Black, rec, formatLeft);
             }

             ////承运单位
             //rec.Y = oY + 5 * yStep;
             //e.Graphics.DrawString("承运单位:" + comboBox5.Text, drawFont, Brushes.Black, rec, formatLeft);

             //钢坯二次计量打印
             if (!string.IsNullOrEmpty(Data.StoveNo) && Data.WeightNum == "1")
             {
             //炉号
             rec.Y = oY + 5 * yStep;
             rec2.X = rec.X;
             rec2.Y = rec.Y;
             e.Graphics.DrawString("炉号: " + Data.StoveNo, drawFont, Brushes.Black, rec2, formatLeft);

             //支数
             rec.Y = oY + 7 * yStep;
             e.Graphics.DrawString("支(块)数: " + Data.Count, drawFont, Brushes.Black, rec, formatLeft);
             //毛重
             rec.Y = oY + 7* yStep;
             e.Graphics.DrawString("毛重: " + Data.GrossWeight + " t", drawFont, Brushes.Black, rec, formatRight);

             //皮重
             rec.Y = oY + 8 * yStep;
             e.Graphics.DrawString("皮重: " + Data.TareWeight + " t", drawFont, Brushes.Black, rec, formatRight);

             //计量点
             rec.Y = oY + 9* yStep;
             e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, formatLeft);

             //净重
             rec.Y = oY + 9 * yStep;
             e.Graphics.DrawString("净重: " + Data.NetWeight + " t", drawFont, Brushes.Black, rec, formatRight);

             //日期
             rec.Y = oY + 10 * yStep;
             e.Graphics.DrawString("时间: " + strDate + " " + strTime, drawFont, Brushes.Black, rec, formatLeft);

             //计量员
             rec.Y = oY + 11 * yStep;
             rec.Width = xStep;
             e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, formatLeft);

             //卡号
             rec.Y = oY + 11 * yStep;
             e.Graphics.DrawString("卡号: " + Data.CardNumber, drawFont, Brushes.Black, rec, formatRight);

             //备注
             rec.Y = oY + 12 * yStep;
             yStep = 36;
             rec.Width = 300;
             e.Graphics.DrawString("备注:" + Data.CarComment, drawFont, Brushes.Black, rec, formatLeft);

             //打印条码
             Code128 c128 = new Code128();
             c128.printCarCode(Data.BarCode, 320, 60, 3, e);

             //注意
             rec.Y = oY + 13 * yStep - 45;
             rec.Height += 20;
             rec.Width = 300;
             e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, formatLeft);
             return;
             }
             //钢坯一次计量打印
             else if (!string.IsNullOrEmpty(Data.StoveNo) && Data.WeightNum == "")
             {
             //炉号
             rec.Y = oY + 5 * yStep;
             rec2.X = rec.X;
             rec2.Y = rec.Y;
             e.Graphics.DrawString("炉号: " + Data.StoveNo, drawFont, Brushes.Black, rec2, formatLeft);

             //支数
             rec.Y = oY + 7 * yStep;
             e.Graphics.DrawString("支(块)数: " + Data.Count, drawFont, Brushes.Black, rec, formatLeft);

             //重量 ??? 暂时不清楚
             rec.Y = oY + 8 * yStep;
             e.Graphics.DrawString("重量: " + Data.Weight + " t", drawFont, Brushes.Black, rec, formatRight);

             //日期
             rec.Y = oY + 9 * yStep;
             e.Graphics.DrawString("时间: " + strDate + " " + strTime, drawFont, Brushes.Black, rec, formatLeft);
             ////时间
             //rec.Y = oY + 8 * yStep;
             //e.Graphics.DrawString("时间: " + strTime, drawFont, Brushes.Black, rec, formatRight);

             //计量点
             rec.Y = oY + 10 * yStep;
             rec.Width = 300;
             e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, formatLeft);

             //计量员
             rec.Y = oY + 11 * yStep;
             rec.Width = xStep;
             e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, formatLeft);

             //卡号
             rec.Y = oY + 11 * yStep;
             e.Graphics.DrawString("卡号: " + Data.CardNumber, drawFont, Brushes.Black, rec, formatRight);

             //备注
             rec.Y = oY + 12 * yStep;
             rec.Width = 300;
             yStep = 36;
             e.Graphics.DrawString("备注:" + Data.CarComment, drawFont, Brushes.Black, rec, formatLeft);

             //打印条码
             Code128 c128 = new Code128();
             c128.printCarCode(Data.BarCode, 320, 60, 4, e);

             //注意
             rec.Y = oY + 13 * yStep - 45;
             rec.Height += 20;
             rec.Width = 300;
             e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, formatLeft);
             return;
             }
             // 二次计量打印
             if (string.IsNullOrEmpty(Data.StoveNo) && Data.WeightNum == "1")
             {
             //毛重
             rec.Y = oY + 5 * yStep;
             e.Graphics.DrawString("毛重: " + Data.GrossWeight + " t", drawFont, Brushes.Black, rec, formatRight);

             //日期
             rec.Y = oY + 6 * yStep;
             e.Graphics.DrawString("日期: " + strDate + " " + strTime, drawFont, Brushes.Black, rec, formatLeft);
             ////时间
             //rec.Y = oY + 7 * yStep;
             //e.Graphics.DrawString("时间: " + strTime, drawFont, Brushes.Black, rec, formatLeft);

             //皮重
             rec.Y = oY + 6 * yStep;
             e.Graphics.DrawString("皮重: " + Data.TareWeight + " t", drawFont, Brushes.Black, rec, formatRight);

             if (string.IsNullOrEmpty(Data.Rate) && string.IsNullOrEmpty(Data.DeductWeight))
             {
                 //净重
                 rec.Y = oY + 7 * yStep;
                 e.Graphics.DrawString("净重: " + Data.NetWeight + " t", drawFont, Brushes.Black, rec, formatRight);
             }
             else
             {
                 if (!string.IsNullOrEmpty(Data.DeductWeight))
                 {
                     //扣渣
                     rec.Y = oY + 7 * yStep;
                     e.Graphics.DrawString("扣渣量: " + Data.DeductWeight + " t", drawFont, Brushes.Black, rec, formatLeft);
                 }
                 else
                 {
                     //扣渣
                     rec.Y = oY + 7 * yStep;
                     e.Graphics.DrawString("扣渣比例: " + Data.Rate, drawFont, Brushes.Black, rec, formatLeft);
                 }

                 rec.Y = oY + 7 * yStep;
                 e.Graphics.DrawString("净重(扣后): " + Data.DeductAfterWeight + " t", drawFont, Brushes.Black, rec, formatRight);

             }
             //计量点
             rec.Y = oY + 8 * yStep;
             rec.Width = 300;
             e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, formatLeft);

             //计量编号
             rec.Y = oY + 9 * yStep;
             rec.Width = xStep;
             e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, formatLeft);

             //卡号
             rec.Y = oY + 9 * yStep;
             e.Graphics.DrawString("卡号: " + Data.CardNumber, drawFont, Brushes.Black, rec, formatRight);

             //备注
             rec.Y = oY + 10 * yStep;
             rec.Width = 300;
             yStep = 36;
             e.Graphics.DrawString("备注:" + Data.CarComment, drawFont, Brushes.Black, rec, formatLeft);

             //打印条码
             Code128 c128 = new Code128();
             c128.printCarCode(Data.BarCode, 320, 60, 0, e);

             //注意
             rec.Y = oY + 12 * yStep - 70;
             rec.Height += 20;
             rec.Width = 300;
             e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, formatLeft);
             }
             // 一次计量打印
             else
             {
             //重量
             rec.Y = oY + 5 * yStep;
             e.Graphics.DrawString("重量: " + Data.Weight + " t", drawFont, Brushes.Black, rec, formatRight);

             //时间
             rec.Y = oY + 6 * yStep;
             e.Graphics.DrawString("时间: " + strDate + " " + strTime, drawFont, Brushes.Black, rec, formatLeft);

             //计量点
             rec.Y = oY + 7 * yStep;
             rec.Width = 300;
             e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, formatLeft);

             //计量员
             rec.Y = oY + 8 * yStep;
             rec.Width= xStep;
             e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, formatLeft);

             //卡号
             rec.Y = oY + 8 * yStep;
             e.Graphics.DrawString("卡号: " + Data.CardNumber, drawFont, Brushes.Black, rec, formatRight);

             //备注
             rec.Y = oY + 9 * yStep;
             rec.Width = 300;
             e.Graphics.DrawString("备注:" + Data.CarComment, drawFont, Brushes.Black, rec, formatLeft);

             //打印条码
             Code128 c128 = new Code128();
             c128.printCarCode(Data.BarCode, 320, 60, 1, e);

             //注意
             rec.Y = oY + 13 * yStep+10;
             rec.Height += 20;
             rec.Width = 300;
             e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, formatLeft);
             }
             e.HasMorePages = false;
        }
Пример #2
0
        // 二次计量榜单,包括二次钢坯
        private void HandRecodPrint(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("合同号: " + Data.ContractNo, drawFont, Brushes.Black, rec, drawFormat2);

            //发货单位
            rec.Y = oY + 1 * yStep;
            //rec.Width = 300;
            e.Graphics.DrawString("发货单位: " + Data.SupplierName, drawFont, Brushes.Black, rec, drawFormat2);

            //收货单位
            rec.Y = oY + 2 * yStep;
            e.Graphics.DrawString("收货单位: " + Data.Receiver, drawFont, Brushes.Black, rec, drawFormat2);

            //物资名称
            rec.Width = 239; //物料名称太长了换行
            rec.Y = oY + 3 * yStep;
            e.Graphics.DrawString("物资名称: " + Data.MaterialName, drawFont, Brushes.Black, rec, drawFormat2);
            rec.Width = 300; //物料名称太长了换行后还原

            //承运单位
            rec.Y = oY + 4 * yStep;
            e.Graphics.DrawString("承运单位: " + Data.TransName, drawFont, Brushes.Black, rec, drawFormat2);

            if (Data.StoveNo != "")
            {
                //车号
                rec.Y = oY + 7 * yStep;
                rec.Width = xStep; //设置控件宽度
                e.Graphics.DrawString("车号: " + Data.CarNo, drawFont, Brushes.Black, rec, drawFormat2);
            }
            else
            {
                //车号
                rec.Y = oY + 5 * yStep;
                rec.Width = xStep; //设置控件宽度
                e.Graphics.DrawString("车号: " + Data.CarNo, drawFont, Brushes.Black, rec, drawFormat2);
            }

            if (Data.StoveNo != "")
            {
                //炉号
                rec.Y = oY + 5 * yStep;
                e.Graphics.DrawString("炉号: " + Data.StoveNo, drawFont, Brushes.Black, rec, drawFormat2);

                //轧制建议
                //rec.X = oX + 2 * xStep;
                rec.Y = oY + 5 * yStep;
                e.Graphics.DrawString("轧制建议: " + Data.MillComment, drawFont, Brushes.Black, rec, drawFormat3);

                //支数
                //rec.Y = oY + 5 * yStep;
                rec.Y = oY + 6 * yStep;
                e.Graphics.DrawString("支(块)数: " + Data.Count, drawFont, Brushes.Black, rec, drawFormat2);

                //建议轧制规格
                //rec.X = oX + 2 * xStep;
                rec.Y = oY + 6 * yStep;
                e.Graphics.DrawString("建议轧制规格: " + Data.PlanSpec, drawFont, Brushes.Black, rec, drawFormat3);

                //日期
                rec.Y = oY + 8 * yStep;
                e.Graphics.DrawString("日期: " + Data.Date.ToString("yyyy") + "年" + _lable.Date.ToString("MM") + "月" + _lable.Date.ToString("dd") + "日", drawFont, Brushes.Black, rec, drawFormat2);
                //时间
                rec.Y = oY + 9 * yStep;
                e.Graphics.DrawString("时间: " + Data.Date.ToString("HH") + "时" + Data.Date.ToString("mm") + "分" + Data.Date.ToString("ss")+"秒", drawFont, Brushes.Black, rec, drawFormat2);

                //毛重
                //rec.X = oX + 2 * xStep;
                rec.Y = oY + 7 * yStep;
                e.Graphics.DrawString("毛重: " +  Data.GrossWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);

                //皮重
                //rec.X = oX + 2 * xStep;
                rec.Y = oY + 8 * yStep;
                e.Graphics.DrawString("皮重: " + Data.TareWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);

                //净重
                rec.Y = oY + 9 * yStep;
                e.Graphics.DrawString("净重: " + Data.NetWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);

                //计量点
                rec.Y = oY + 10 * yStep;
                rec.Width = 300;
                e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, drawFormat2);

                //计量员
                rec.Y = oY + 11 * yStep;
                e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, drawFormat2);

                //备注
                rec.Y = oY + 12 * yStep;
                yStep = 36;
                e.Graphics.DrawString("备注: " + Data.CarComment, drawFont, Brushes.Black, rec, drawFormat2);

                //打印条码
                Code128 c128 = new Code128();
                //钢坯二次计量
                c128.printCarCode(Data.BarCode, 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("日期: " + Data.Date.ToString(), drawFont, Brushes.Black, rec, drawFormat2);
                //时间
                rec.Y = oY + 7 * yStep;
                e.Graphics.DrawString("时间: " + Data.Date.ToString(), drawFont, Brushes.Black, rec, drawFormat2);

                //毛重
                //rec.X = oX + 2 * xStep;
                rec.Y = oY + 5 * yStep;
                e.Graphics.DrawString("毛重: " + Data.GrossWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);

                //皮重
                //rec.X = oX + 2 * xStep;
                rec.Y = oY + 6 * yStep;
                e.Graphics.DrawString("皮重: " + Data.TareWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);

                // YKL 应扣量 YKBL 应扣比例
                if ((string.IsNullOrEmpty(Data.Rate)) && (string.IsNullOrEmpty(Data.DeductWeight)))
                {
                    //净重
                    rec.Y = oY + 7 * yStep;
                    e.Graphics.DrawString("净重: " +  Data.NetWeight+ " t", drawFont, Brushes.Black, rec, drawFormat3);
                }
                else
                {
                    if (!string.IsNullOrEmpty(Data.DeductWeight))
                    {
                        //扣渣
                        rec.Y = oY + 7 * yStep;
                        e.Graphics.DrawString("扣渣量: " + Data.DeductWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);
                    }
                    else
                    {
                        //扣渣
                        rec.Y = oY + 7 * yStep;
                        e.Graphics.DrawString("扣渣比例: " + Data.Rate, drawFont, Brushes.Black, rec, drawFormat3);
                    }
                    rec.Y = oY + 8 * yStep;
                    e.Graphics.DrawString("净重(扣后): " + Data.DeductAfterWeight + " t", drawFont, Brushes.Black, rec, drawFormat3);

                }
                //计量点
                rec.Y = oY + 8 * yStep;
                rec.Width = 300;
                e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, drawFormat2);

                //计量员
                rec.Y = oY + 9 * yStep;
                e.Graphics.DrawString("编号: " + Data.BarCode, drawFont, Brushes.Black, rec, drawFormat2);

                //备注
                rec.Y = oY + 10 * yStep;
                yStep = 36;
                e.Graphics.DrawString("备注:", drawFont, Brushes.Black, rec, drawFormat2);

                //打印条码
                Code128 c128 = new Code128();
                // 二次重量
                c128.printCarCode(Data.BarCode, 320, 80, 0, e);

                //注意
                rec.Y = oY + 12 * yStep;

                //e.Graphics.DrawString("注意:本凭证请妥善保管遇有问题请致电(8610918)", drawFont, Brushes.Black, rec, drawFormat2);
                e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, drawFormat2);
                e.HasMorePages = false;
            }
        }
Пример #3
0
        //外协计量榜单
        private void AssistDataPrint(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 = xStep; //设置控件宽度
               e.Graphics.DrawString("车号: " + Data.CarNo, drawFont, Brushes.Black, rec, drawFormat2);

               //日期
               rec.Y = oY + 1 * yStep;
               e.Graphics.DrawString("日期: " + Data.Date.ToString("yyyy") + "年" + _lable.Date.ToString("MM") + "月" + _lable.Date.ToString("dd") + "日", drawFont, Brushes.Black, rec, drawFormat2);
               //时间
               rec.Y = oY + 1 * yStep;
               e.Graphics.DrawString("时间: " + Data.Date.ToString("HH") + "时" + Data.Date.ToString("mm") + "分" + Data.Date.ToString("ss") + "秒", drawFont, Brushes.Black, rec, drawFormat3);

               //重量   ???
               rec.Y = oY;
               e.Graphics.DrawString("重量: " + Data.Weight + " t", drawFont, Brushes.Black, rec, drawFormat3);

               //计量点
               rec.Y = oY + 2 * yStep;
               rec.Width = 300;
               e.Graphics.DrawString("计量点: " + Data.WeightPoint, drawFont, Brushes.Black, rec, drawFormat2);

               //计量员 改为编号
               rec.Y = oY + 3 * yStep;
               e.Graphics.DrawString("编号: " +  Data.BarCode, drawFont, Brushes.Black, rec, drawFormat2);

               //备注
               rec.Y = oY + 4 * yStep;
               yStep = 36;
               e.Graphics.DrawString("备注:" + " 外协" + "    收费金额:" + Data.Charge + " 元", drawFont, Brushes.Black, rec, drawFormat2);

               //打印条码
               Code128 c128 = new Code128();
               c128.printCarCode(Data.BarCode, 320, 80, 2, e);

               //注意
               rec.Y = oY + 6 * yStep;
               //yStep = 66;前面备注那已经赋值了
               e.Graphics.DrawString("注意:本凭证请妥善保管,避免高温、潮湿、阳光直射,遇有问题请致电(2992161)", drawFont, Brushes.Black, rec, drawFormat2);
               return;
        }