Пример #1
0
        public override void PaintPrinter()
        {
            MessageBoxHelper.Show("请放入申请表正面进行打印! ");
            this.PrintExcelF6();
            if (Vehicle.DyHtzbh.Length > 0)
            {
                MessageBoxHelper.Show("请放入抵押表进行打印! ");
                this.PrintExcelF7();
            }
            MessageBoxHelper.Show("请放入申请表背面进行打印! ");
            BaseVehicleInfoPrinter printer       = new F5Printer(this.Vehicle);
            CommonPrinter          commonPrinter = new CommonPrinter(printer);
            //commonPrinter.ShowPreviewPrinter();
            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                commonPrinter.Print();
            }
            else if (printSetting.PrintModel == "选择打印机")
            {
                commonPrinter.ShowPreviewPrinter();
            }
            else
            {
                commonPrinter.Preview();
            }
            //todo,excelprinteer
        }
Пример #2
0
        protected void PrintExcelF7()
        {
            if (vehicle.DyHtzbh.Length > 0)
            {
                GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
                string strExcelTemplateFile   = Application.StartupPath
                                                + "/template/" + "抵押登记表.xls";
                excel.Open(strExcelTemplateFile);
                excel.IsVisibledExcel = false;
                //excel.SetCellText(5, 6, "R"+"抵押登记  □解除抵押登记  □质押  □解除质押");
                //excel.SetFont(5, 6, 5, 6, this.GouFont);

                excel.SetCellText(7, 6, " " + vehicle.BaseSyrName);
                excel.SetCellText(8, 6, " " + comp.Name);
                excel.SetCellText(10, 6, " " + comp.Address);
                excel.SetCellText(12, 6, " " + comp.PostCode.Substring(0, 4) + "00");
                excel.SetCellText(12, 12, " " + comp.Phone);
                excel.SetCellText(13, 6, " " + comp.Email);
                excel.SetCellText(14, 6, " " + vehicle.BaseJbrName);
                excel.SetCellText(14, 12, " " + comp.Phone);

                excel.SetCellText(15, 6, " " + vehicle.DyDyqrName);
                excel.SetCellText(17, 6, " " + vehicle.DyDyqrConnAddress);
                excel.SetCellText(18, 6, " " + vehicle.DyDyqrPostCode);
                excel.SetCellText(18, 12, " " + vehicle.DyDyqrPhone);

                excel.SetCellText(20, 6, " " + comp.Name);
                excel.SetCellText(22, 6, " " + comp.Address);
                excel.SetCellText(24, 6, " " + comp.PostCode.Substring(0, 4) + "00");
                excel.SetCellText(24, 12, " " + comp.Phone);
                excel.SetCellText(26, 6, " " + vehicle.DyJbrName);
                excel.SetCellText(26, 12, " " + vehicle.DyDldwPhone);


                GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();
                if (printSetting.PrintModel == "直接打")
                {
                    excel.Print();
                }
                else
                {
                    excel.PrintPreview();
                }
                excel.Close();
            }
            else
            {
                MessageBoxHelper.Show("抵押登记主合同编号为空的时候不打印抵押登记表!");
            }
        }
Пример #3
0
        public static void Print(IPrinter printer)
        {
            CommonPrinter commonPrinter = new CommonPrinter(printer);
            //commonPrinter.ShowPreviewPrinter();
            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                commonPrinter.Print();
            }
            else if (printSetting.PrintModel == "选择打印机")
            {
                commonPrinter.ShowPreviewPrinter();
            }
            else
            {
                commonPrinter.Preview();
            }
        }
Пример #4
0
        protected void PrintExcelF6()
        {
            GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
            string strExcelTemplateFile   = Application.StartupPath
                                            + "/template/" + "注册登记表.xls";

            excel.Open(strExcelTemplateFile);
            excel.IsVisibledExcel = false;
            // excel.SetCellText(5, 7, "R注册登记");
            // excel.SetFont(5, 7, 5, 7, this.GouFont);



            excel.SetCellText(8, 7, " " + vehicle.TecZwpp + vehicle.TecClxh);
            excel.SetCellText(8, 21, " " + vehicle.TecClsbm);
            int row = 10, col = 7;

            switch (vehicle.XuGetFrom)
            {
            case "购买":
                row = 10;
                col = 7;
                break;

            case "境外自带":
                row = 10;
                col = 8;
                break;

            case "继承":
                row = 10;
                col = 10;
                break;

            case "赠予":
                row = 10;
                col = 14;
                break;

            case "协议抵偿债务":
                row = 10;
                col = 18;
                break;

            case "协议离婚":
                row = 10;
                col = 25;
                break;

            case "中奖":
                row = 10;
                col = 28;
                break;

            case "调拨":
                row = 11;
                col = 7;
                break;

            case "资产重组":
                row = 11;
                col = 8;
                break;

            case "资产整体买卖":
                row = 11;
                col = 10;
                break;

            case "仲裁裁决":
                row = 11;
                col = 18;
                break;

            case "法院调解":
                row = 11;
                col = 25;
                break;

            case "法院裁定":
                row = 11;
                col = 28;
                break;

            case "法院判决":
                row = 12;
                col = 7;
                break;

            case "其他":
                row = 12;
                col = 8;
                break;

            default:
                row = 10;
                col = 7;
                break;
            }
            excel.SetCellText(row, col, "R" + vehicle.XuGetFrom);
            excel.SetFont(row, col, row, col, this.GouFont);



            switch (vehicle.XuUseFor)
            {
            case "非营运":
                row = 14;
                col = 7;
                break;

            case "公路客运":
                row = 14;
                col = 8;
                break;

            case "公交客运":
                row = 14;
                col = 10;
                break;

            case "出租客运":
                row = 14;
                col = 15;
                break;

            case "旅游客运":
                row = 14;
                col = 21;
                break;

            case "租赁":
                row = 14;
                col = 27;
                break;

            case "教练":
                row = 14;
                col = 28;
                break;

            case "幼儿校车":
                row = 15;
                col = 7;
                break;

            case "小学生校车":
                row = 15;
                col = 8;
                break;

            case "其他校车":
                row = 15;
                col = 10;
                break;

            case "货运":
                row = 15;
                col = 15;
                break;

            case "危险化学品运输":
                row = 15;
                col = 21;
                break;

            case "警用":
                row = 15;
                col = 28;
                break;

            case "消防":
                row = 16;
                col = 7;
                break;

            case "救护":
                row = 16;
                col = 8;
                break;

            case "工程救险":
                row = 16;
                col = 10;
                break;

            case "营转非":
                row = 16;
                col = 15;
                break;

            case "出租营转非":
                row = 16;
                col = 21;
                break;

            default:
                row = 14;
                col = 7;
                break;
            }
            excel.SetCellText(row, col, "R" + vehicle.XuUseFor);
            //Microsoft.Office.Interop.Excel.Range rang=excel.GetRange(row, col);
            //rang.Font.Name = "wingdings 2";
            excel.SetFont(row, col, row, col, this.GouFont);


            excel.SetCellText(17, 7, " " + vehicle.BaseSyrName);
            excel.SetCellText(18, 7, " " + vehicle.BaseSyrRegAddress);
            excel.SetCellText(19, 7, " " + vehicle.BaseSyrPostCode);
            excel.SetCellText(19, 11, " " + vehicle.BaseSyrPhone);
            excel.SetCellText(20, 7, " " + vehicle.BaseSyrEmail);
            excel.SetCellText(20, 11, " " + vehicle.BaseSyrMobile);

            excel.SetCellText(23, 7, " " + comp.Name);
            excel.SetCellText(25, 7, " " + comp.Address);
            excel.SetCellText(26, 7, " " + comp.PostCode.Substring(0, 4) + "00");
            excel.SetCellText(26, 11, " " + comp.Phone);
            excel.SetCellText(27, 7, " " + comp.Email);
            excel.SetCellText(28, 7, " " + vehicle.BaseJbrName);
            excel.SetCellText(28, 11, " " + comp.Phone);

            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                excel.Print();
            }
            else
            {
                //excel.SaveAs("c:\\测试打印表.xls", true);
                excel.PrintPreview();
            }
            excel.Close();
        }
Пример #5
0
        public static void Print(StudentInfo student, Keys key)
        {
            BaseStudentPrinter printer = null;

            if (key == Keys.F1)
            {
                printer = new AllPrinter(student);
            }
            else if (key == Keys.F2)
            {
                printer = new F2Printer(student);
            }
            else if (key == Keys.F3)
            {
                printer = new F3Printer(student);
            }
            else if (key == Keys.F4)
            {
                printer = new F4Printer(student);
            }
            else if (key == Keys.F5)
            {
                printer = new F5Printer(student);
                //printer = new F5Printer(this.student);
            }
            else if (key == Keys.F6)
            {
                SetPrinted(student);
                printer = new ApplyPrinter(student);
            }
            else if (key == Keys.F7)
            {
                SetPrinted(student);
                printer = new ApplyExcelPrinter(student);
                ApplyExcelPrinter tmp = printer as ApplyExcelPrinter;
                tmp.PrintExcel(false);
                return;
            }
            else if (key == Keys.F8)
            {
                printer = new F8Printer(student);
            }
            else if (key == Keys.F9)
            {
                printer = new F9Printer(student);
            }
            if (printer != null)
            {
                CommonPrinter commonPrinter = new CommonPrinter(printer);
                //commonPrinter.ShowPreviewPrinter();
                GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();
                if (printSetting.PrintModel == "直接打")
                {
                    commonPrinter.Print();
                }
                else if (printSetting.PrintModel == "选择打印机")
                {
                    commonPrinter.ShowPreviewPrinter();
                }
                else
                {
                    commonPrinter.Preview();
                }
            }
        }
Пример #6
0
        /// <summary>
        /// 直接打印
        /// </summary>
        public void PrintExcel(bool saveInk)
        {
            GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();


            if (!saveInk)
            {
                string strExcelTemplateFile = Application.StartupPath + "/template/" + "驾驶证申请表";
                strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt";
                //System.IO.Path.GetFullPath(@"驾驶证申请表.xlt");
                excel.Open(strExcelTemplateFile);
            }//用模板文件
            else
            {
                string strExcelTemplateFile = Application.StartupPath + "/template/" + "套打-驾驶证申请表";
                //System.IO.Path.GetFullPath(@"驾驶证申请表.xlt");
                strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt";
                excel.Open(strExcelTemplateFile);
                //excel.Open();
            }
            excel.IsVisibledExcel = false;

            Code39 code39 = new Code39();

            code39.WidthCU    = 2;
            code39.LineHeight = 20;
            try
            {
                //SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont);
                code39.Height = code39.topHeight + code39.LineHeight + (int)20;//定义图片高度
                Bitmap map        = code39.CreateBarCode(Student.IdCard);
                string pathcode39 = Application.StartupPath + "/tempcode39.jpg";
                ImageHelper.SaveCoderPic(map, pathcode39);
                // map.Save(pathcode39, System.Drawing.Imaging.ImageFormat.Jpeg);
                excel.InsertPicture(3, 1, pathcode39, 155, 26, 0);
            }
            catch (Exception ex)
            {
                //LogFactoryWrapper.Debug("由于证件号码有汉字,不支持code39编码!");
            }

            //excel.SetCellText(1, 24, 1, 30, "驾校:" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName);
            //excel.SetCellText(2, 24, 2, 30, "驾校-" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName);
            // excel.SetCellText(1, 1, "  " + this.name);
            // excel.SetCellText(1, 20, "  " + this.name);
            //excel.SetCellText(1, 21, "  " + this.name);
            CompanyInfo comp = StaticCacheManager.GetConfig <CompanyInfo>();

            excel.SetCellText(1, 22, "驾校:" + comp.NickName);
            //excel.SetCellText(1, 23, "  " + this.name);
            // excel.SetCellText(2, 24, 2, 30, "  " + this.name);

            excel.SetCellText(4, 3, 4, 11, "  " + Student.Name);

            excel.SetCellText(4, 14, 4, 15, Student.Sex);
            excel.SetCellText(4, 19, 4, 24, Student.Birthday);
            excel.SetCellText(4, 27, 4, 30, Student.Nation);
            excel.SetCellText(5, 3, 5, 4, Student.IdCardType);
            if (Student.IdCardType.Length < IdCardTypeMaxLen)
            {
                excel.SetFont(5, 3, 6, 4, new Font("宋体", 15f));
            }


            for (int i = 0; i < Student.IdCard.Length; i++)
            {
                excel.SetCellText(5, 7 + i, Student.IdCard[i].ToString());
            }
            if (Student.TempId.Length > 0)
            {
                excel.SetCellText(6, 3, 6, 4, "暂住证");

                for (int i = 0; i < Student.TempId.Length; i++)
                {
                    excel.SetCellText(6, 7 + i, Student.TempId[i].ToString());
                }
            }
            excel.SetCellText(7, 3, 7, 24, "  " + Student.RegAddress);
            string connadd = this.GetConnAddress();

            excel.SetCellText(8, 3, 8, 24, "  " + connadd);
            if (connadd.Length < ConnAddressMaxLen)
            {
                excel.SetFont(8, 3, 8, 24, new Font("宋体", 15f));
            }

            excel.SetCellText(9, 3, 9, 13, "  " + Student.Phone);
            excel.SetCellText(9, 18, 9, 24, Student.PostCode);
            excel.SetCellText(10, 11, 10, 17, Student.NewCarType);
            DateTime regDate = System.DateTime.Now;

            if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintApplyDate)
            {
                excel.SetCellText(35, 25, 36, 30, regDate.Year + " 年 " + regDate.Month + " 月 " + regDate.Day + "日");
            }
            string path = Application.StartupPath + "/temp.jpg";

            if (Student.LearnType == "初学")
            {
                if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.Allow2Dimension)
                {
                    //this.GetQRImage(Student.Dimension).Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
                    ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path);
                    //excel.InsertPicture(25, 23, path, 110, 110, 5);
                    excel.InsertPicture(27, 16, path, 100, 100, 5);
                }
            }
            else
            {
                excel.SetCellText(10, 25, 10, 30, Student.OldCarType);
                if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintProfile)
                {
                    excel.SetCellText(3, 25, 3, 30, Student.Profile);
                }
            }


            /*if (this.LearnTypeString == "初学")
             * {
             *  if (!this.saveInk)
             *  {
             *      excel.SetCellText(10, 3, "□初次申领");
             *  }
             *  else
             *  {
             *      excel.SetCellText(10, 3, "√");
             *  }
             *
             * }
             * else
             * {
             *  if (!this.saveInk)
             *  {
             *      excel.SetCellText(11, 3, "□增加准驾车型");
             *  }
             *  else
             *  {
             *      excel.SetCellText(11, 3, "√");
             *  }
             *  excel.SetCellText(10, 25, 10, 30, this.HaveCarType);
             * }
             */
            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                excel.Print();
            }
            else
            {
                excel.PrintPreview();
            }


            excel.Close();
        }