/// <summary> /// 构造函数 /// </summary> public OPDInvoice() { // // TODO: 在此处添加构造函数逻辑 // paperInfo = PrintClass.GetPaperInfo(InvoiceType.门诊发票); paperSize = new PaperSize(paperInfo.PaperName, paperInfo.PaperWidth, paperInfo.PaperHeight); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void doc_PrintPage(object sender, PrintPageEventArgs e) { try { Font font = null; Brush brush = Brushes.Black; ItemPrintSetting setting; #region 打印内容 //打印医院名称 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "医院名称"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_hisName, font, brush, setting.X, setting.Y); } //打印科室 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "科室"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_departmentName, font, brush, setting.X, setting.Y); } //打印医生 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "医生"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_doctorName, font, brush, setting.X, setting.Y); } //打印电脑发票号 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "发票号"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_invoiceNo, font, brush, setting.X, setting.Y); } //打印年月日 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "年"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_year.ToString( ), font, brush, setting.X, setting.Y); } setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "月"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_month.ToString( ), font, brush, setting.X, setting.Y); } setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "日"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_day.ToString( ), font, brush, setting.X, setting.Y); } //打印病人姓名 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "姓名"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_patientName, font, brush, setting.X, setting.Y); } //打印门诊号 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "门诊号"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_outPatientNo, font, brush, setting.X, setting.Y); } //打印发票项目 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "发票项目"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); float x = setting.X; float y = setting.Y; for (int i = 0; i < _items.Length; i++) { e.Graphics.DrawString(_items[i].ItemName + ":" + _items[i].ItemMoney.ToString("0.0") + "元", font, brush, x, y); y = y + font.Height; } } //打印小写金额 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "小写金额"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_totalMoneynum.ToString("0.0") + "元", font, brush, setting.X, setting.Y); } //打印大写金额 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "大写金额"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_totalMoneycn, font, brush, setting.X, setting.Y); } //打印收款人 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "收款人"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(_payee, font, brush, setting.X, setting.Y); } //其他信息 setting = PrintClass.GetItemPrintSetting(InvoiceType.门诊发票, "其他信息"); if (setting.NeedPrint) { font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(otherInfo, font, brush, setting.X, setting.Y); } #endregion } catch (Exception ex) { throw ex; } }
private void doc_PrintPage(object sender, PrintPageEventArgs e) { try { Font font = null; Brush brush = Brushes.Black; ItemPrintSetting setting; #region 打印内容 //打印医院名称 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "收款单位"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.HisName, font, brush, setting.X, setting.Y); //打印科室 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "诊病科别"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.DepartmentName, font, brush, setting.X, setting.Y); //打印医生 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "医生"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.DoctorName, font, brush, setting.X, setting.Y); //打印电脑发票号 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "发票号"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.InvoiceNo, font, brush, setting.X, setting.Y); //打印年月日 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "年"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.Year.ToString( ), font, brush, setting.X, setting.Y); setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "月"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.Month.ToString( ), font, brush, setting.X, setting.Y); setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "日"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.Day.ToString( ), font, brush, setting.X, setting.Y); //打印病人姓名 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "姓名"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.PatientName, font, brush, setting.X, setting.Y); //打印门诊号 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "门诊号"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.OutPatientNo, font, brush, setting.X, setting.Y); //打印挂号级别 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "医师职级"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(register_type, font, brush, setting.X, setting.Y); //打印发票项目 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "挂号费"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(register_fee, font, brush, setting.X, setting.Y); //打印诊查费 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "诊查费"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(examine_fee, font, brush, setting.X, setting.Y); //打印检查费 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "检查费"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(jerque_fee, font, brush, setting.X, setting.Y); //打印材料费 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "材料费"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(material_fee, font, brush, setting.X, setting.Y); //打印小写金额 //setting = PrintClass.GetItemPrintSetting( InvoiceType.挂号发票 , "小写金额" ); //font = new Font( setting.FontName , setting.FontSize ); //e.Graphics.DrawString( base.TotalMoneyNum.ToString( "0.0" ) + "元" , font , brush , setting.X , setting.Y ); //打印大写金额 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "大写金额"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.TotalMoneyCN, font, brush, setting.X, setting.Y); //打印收款人 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "收款人"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.Payee, font, brush, setting.X, setting.Y); //其他信息 setting = PrintClass.GetItemPrintSetting(InvoiceType.挂号发票, "其他信息"); font = new Font(setting.FontName, setting.FontSize); e.Graphics.DrawString(base.OtherInfo, font, brush, setting.X, setting.Y); #endregion } catch (Exception ex) { ErrorWriter.WriteLog(ex.Message); throw new Exception("打印发生错误!"); } }