public int PrintPreview() { Neusoft.NFC.Interface.Classes.Print print = new Neusoft.NFC.Interface.Classes.Print(); print.PrintPreview(0, 0, this); return(1); }
/// <summary> /// 对调用该控件的父控件进行打印 /// </summary> /// <param name="parentControl">父控件</param> public void PrintPreview(System.Windows.Forms.Control parentControl) { Neusoft.NFC.Interface.Classes.Print pr = new Neusoft.NFC.Interface.Classes.Print(); pr.IsDataAutoExtend = false; this.IsShowArrow = false; pr.PrintPreview(parentControl); this.IsShowArrow = true; }
public void PrintRecipe() { Neusoft.NFC.Interface.Classes.Print p = new Neusoft.NFC.Interface.Classes.Print(); p.IsDataAutoExtend = true; p.ControlBorder = Neusoft.NFC.Interface.Classes.enuControlBorder.None; p.PrintPreview(this); this.GetArgument(); }
/// <summary> /// 打印预览 /// </summary> /// <returns></returns> public int PrintPreview() { try { Neusoft.NFC.Interface.Classes.Print print = null; Neusoft.HISFC.Object.Base.PageSize ps = null; try { print = new Neusoft.NFC.Interface.Classes.Print(); } catch (Exception ex) { MessageBox.Show("初始化打印机失败!" + ex.Message); return(-1); } string paperName = string.Empty; //if (this.InvoiceType == "ZY02") //{ // paperName = "ZYZF"; //} //else if (this.InvoiceType == "ZY01") //{ paperName = "ZYFP"; //} ps = new Neusoft.HISFC.Object.Base.PageSize(paperName, 0, 0); ps.Top = 0; ps.Left = 0; print.SetPageSize(ps); print.PrintPreview(0, 0, this); } catch (Exception e) { MessageBox.Show(e.Message); return(1); } return(1); }
/// <summary> /// 打印 /// </summary> private void PrintOrder() { Neusoft.NFC.Interface.Classes.Print pf = new Neusoft.NFC.Interface.Classes.Print(); if (this.tabControl1.SelectedIndex == 0) { //pf.PageLabel = (Control)this.lblPage; this.SetLongRePrint(false); //this.sheetLong.RowCount = 0; int pageCount = Neusoft.NFC.Function.NConvert.ToInt32(alLongPrint.Count / this.intLineNum); for (int iPage = 0; iPage < pageCount; iPage++) { Neusoft.NFC.Management.PublicTrans.BeginTransaction(); orderBillManager.SetTrans(Neusoft.NFC.Management.PublicTrans.Trans); this.sheetLong.RowCount = 0; bool needPrint = false; for (int i = 0; i < intLineNum; i++) { sheetLong.Rows.Add(i, 1); Neusoft.HISFC.Object.Order.Inpatient.Order ord = null; try { ord = alLongPrint[i + iPage * intLineNum] as Neusoft.HISFC.Object.Order.Inpatient.Order; } catch { } if (ord != null && ord.ID != null && ord.ID != "") { Neusoft.HISFC.Object.Order.OrderBill orderBill = new Neusoft.HISFC.Object.Order.OrderBill(); orderBill = orderBillManager.GetOrderBillByOrderID(ord.ID); if (Neusoft.NFC.Function.NConvert.ToBoolean(orderBill.PrintFlag)) { this.sheetLong.SetValue(i, 0, ""); this.sheetLong.SetValue(i, 1, ""); this.sheetLong.SetValue(i, 2, ""); this.sheetLong.SetValue(i, 3, ""); this.sheetLong.SetValue(i, 4, ""); this.sheetLong.SetValue(i, 5, ""); this.sheetLong.SetValue(i, 6, ""); this.sheetLong.SetValue(i, 7, ""); this.sheetLong.SetValue(i, 8, ""); this.sheetLong.SetValue(i, 9, ""); this.sheetLong.SetValue(i, 10, ""); } else { needPrint = true; this.sheetLong.SetValue(i, 0, ord.BeginTime.Month.ToString() + "." + ord.BeginTime.Day.ToString());//.ToShortDateString()); sheetLong.SetValue(i, 1, ord.BeginTime.ToShortTimeString()); sheetLong.SetValue(i, 2, ord.Item.Name + " " + ord.Frequency.Name + " " + ord.Usage.Name); sheetLong.SetValue(i, 3, ord.ReciptDoctor.Name); sheetLong.SetValue(i, 4, ord.Nurse.Name); sheetLong.SetValue(i, 5, ord.ConfirmTime); if (ord.EndTime != DateTime.MinValue) { sheetLong.SetValue(i, 6, ord.EndTime.Month.ToString() + "." + ord.EndTime.Day.ToString()); sheetLong.SetValue(i, 7, ord.EndTime.ToShortTimeString());//.ExecOper.OperTime.ToShortTimeString()); sheetLong.SetValue(i, 8, ord.DCOper.Name); sheetLong.SetValue(i, 9, ord.ExecOper.Name); sheetLong.SetValue(i, 10, ord.ExecOper.OperTime.ToShortTimeString()); } else { this.sheetLong.SetValue(i, 6, ""); this.sheetLong.SetValue(i, 7, ""); this.sheetLong.SetValue(i, 8, ""); this.sheetLong.SetValue(i, 9, ""); this.sheetLong.SetValue(i, 10, ""); } int myLineNo = 0; int myPageNo = 0; int myPrnSeq = 0; this.orderBillManager.GetLastOrderBillArg(this.pInfo.ID, orderBill.Order.OrderType.ID, out myPrnSeq, out myPageNo, out myLineNo); if (myPageNo > 0) { if (myLineNo < this.intLineNum) { myLineNo = i + 1; } else { myLineNo = i + 1; myPageNo = iPage + 1; this.SetLongRePrint(false); } } else { myLineNo = i + 1; myPageNo = 1; this.SetLongRePrint(false); } if (Neusoft.NFC.Function.NConvert.ToBoolean(orderBill.PrintDCFlag) && orderBill.PageNO > 0) { this.sheetLong.SetValue(i, 0, ""); this.sheetLong.SetValue(i, 1, ""); this.sheetLong.SetValue(i, 2, ""); this.sheetLong.SetValue(i, 3, ""); this.sheetLong.SetValue(i, 4, ""); this.sheetLong.SetValue(i, 5, ""); } if (orderBill.PageNO == 0) { if (orderBillManager.UpdateLineNoPageNo(ord.ID, myLineNo, myPageNo) < 0) { Neusoft.NFC.Management.PublicTrans.RollBack(); MessageBox.Show(Neusoft.NFC.Management.Language.Msg("更新医嘱单行号、页码失败!" + orderBillManager.Err)); return; } } if (orderBillManager.UpdatePrnFlag(ord.ID, "1") < 0) { Neusoft.NFC.Management.PublicTrans.RollBack(); MessageBox.Show(Neusoft.NFC.Management.Language.Msg("更新医嘱单打印标志失败!" + orderBillManager.Err)); return; } } } else { this.sheetLong.SetValue(i, 0, ""); this.sheetLong.SetValue(i, 1, ""); this.sheetLong.SetValue(i, 2, ""); this.sheetLong.SetValue(i, 3, ""); this.sheetLong.SetValue(i, 4, ""); this.sheetLong.SetValue(i, 5, ""); this.sheetLong.SetValue(i, 6, ""); this.sheetLong.SetValue(i, 7, ""); this.sheetLong.SetValue(i, 8, ""); this.sheetLong.SetValue(i, 9, ""); this.sheetLong.SetValue(i, 10, ""); } } //this.neuLabel15.Text = "第"; //this.neuLabel19.Text = "页"; this.lblPage.Text = "第" + (iPage + 1).ToString() + "页"; if (needPrint) { pf.PrintPreview(this.plLong); } Neusoft.NFC.Management.PublicTrans.Commit(); } } else { //pf.PageLabel = (Control)this.lblPages; this.SetShortRePrint(false); this.sheetShort.RowCount = 0; int pageCount = Neusoft.NFC.Function.NConvert.ToInt32(alShortPrint.Count / this.intLineNum); for (int iPage = 0; iPage < pageCount; iPage++) { Neusoft.NFC.Management.PublicTrans.BeginTransaction(); orderBillManager.SetTrans(Neusoft.NFC.Management.PublicTrans.Trans); bool needPrint = false; for (int i = 0; i < intLineNum; i++) { sheetShort.Rows.Add(i, 1); Neusoft.HISFC.Object.Order.Inpatient.Order ord = null; try { ord = alShortPrint[i + iPage * intLineNum] as Neusoft.HISFC.Object.Order.Inpatient.Order; } catch { } if (ord != null && ord.ID != null && ord.ID != "") { Neusoft.HISFC.Object.Order.OrderBill orderBill = new Neusoft.HISFC.Object.Order.OrderBill(); orderBill = orderBillManager.GetOrderBillByOrderID(ord.ID); if (Neusoft.NFC.Function.NConvert.ToBoolean(orderBill.PrintFlag)) { this.sheetShort.SetValue(i, 0, ""); this.sheetShort.SetValue(i, 1, ""); this.sheetShort.SetValue(i, 2, ""); this.sheetShort.SetValue(i, 3, ""); this.sheetShort.SetValue(i, 4, ""); this.sheetShort.SetValue(i, 5, ""); this.sheetShort.SetValue(i, 6, ""); this.sheetShort.SetValue(i, 7, ""); this.sheetShort.SetValue(i, 8, ""); } else { needPrint = true; sheetShort.Rows.Add(i, 1); this.sheetShort.SetValue(i, 0, ord.BeginTime.ToShortDateString()); sheetShort.SetValue(i, 1, ord.BeginTime.ToShortTimeString()); sheetShort.SetValue(i, 2, ord.Item.Name + " " + ord.Frequency.Name + " " + ord.Usage.Name); sheetShort.SetValue(i, 3, ord.ReciptDoctor.Name); sheetShort.SetValue(i, 4, ord.BeginTime); sheetShort.SetValue(i, 5, ord.ExecOper.Name); sheetShort.SetValue(i, 6, ord.EndTime.ToShortDateString()); sheetShort.SetValue(i, 7, ord.EndTime.ToShortTimeString()); int myLineNo = 0; int myPageNo = 0; int myPrnSeq = 0; this.orderBillManager.GetLastOrderBillArg(this.pInfo.ID, orderBill.Order.OrderType.ID, out myPrnSeq, out myPageNo, out myLineNo); if (myPageNo > 0) { if (i < this.intLineNum) { myLineNo = i + 1; } else { myLineNo = i + 1; myPageNo = iPage + 1; this.SetShortRePrint(false); } } else { myLineNo = i + 1; myPageNo = 1; this.SetShortRePrint(false); } if (orderBill.PageNO == 0) { if (orderBillManager.UpdateLineNoPageNo(ord.ID, myLineNo, myPageNo) < 0) { Neusoft.NFC.Management.PublicTrans.RollBack(); MessageBox.Show(Neusoft.NFC.Management.Language.Msg("更新医嘱单行号、页码失败!" + orderBillManager.Err)); return; } } if (orderBillManager.UpdatePrnFlag(ord.ID, "1") < 0) { Neusoft.NFC.Management.PublicTrans.RollBack(); MessageBox.Show(Neusoft.NFC.Management.Language.Msg("更新医嘱单打印标志失败!" + orderBillManager.Err)); return; } } } else { this.sheetShort.SetValue(i, 0, ""); this.sheetShort.SetValue(i, 1, ""); this.sheetShort.SetValue(i, 2, ""); this.sheetShort.SetValue(i, 3, ""); this.sheetShort.SetValue(i, 4, ""); this.sheetShort.SetValue(i, 5, ""); this.sheetShort.SetValue(i, 6, ""); this.sheetShort.SetValue(i, 7, ""); this.sheetShort.SetValue(i, 8, ""); this.SetShortRePrint(false); } } this.lblPages.Text = "第" + (iPage + 1).ToString() + "页"; if (needPrint) { pf.PrintPreview(this.plShort); } Neusoft.NFC.Management.PublicTrans.Commit(); } } this.SetShortRePrint(false); this.SetLongRePrint(false); this.SetPatient(this.pInfo); }