Beispiel #1
0
        /// <summary>
        /// 将数据对象转诊打印对象 用于绑定到控件进行打印预览
        /// </summary>
        /// <returns></returns>
        private PrintInCommonView ConvertPrintEntity()
        {
            //inCommonNoteBiz.GetDetaliInCommonNote(ref m_inCommonNote);
            PrintInCommonView printInCommonView = new CommonNoteUse.PrintInCommonView();

            printInCommonView.PrintFileName    = m_inCommonNote.PrinteModelName;
            printInCommonView.IncommonNoteflow = m_inCommonNote.InCommonNoteFlow;
            printInCommonView.RecordName       = m_commonNoteEntity.CommonNoteName;
            //病人的基本信息构造
            if (inCommonNoteBiz == null)
            {
                inCommonNoteBiz = new InCommonNoteBiz(m_app);
            }
            DataTable          inpatientDt        = inCommonNoteBiz.GetInpatient(m_inCommonNote.NoofInpatient);
            PrintInpatientView printInpatientView = new CommonNoteUse.PrintInpatientView();

            printInpatientView.HospitalName    = m_app.CurrentHospitalInfo.Name;
            printInpatientView.SubHospitalName = m_app.CurrentHospitalInfo.Subname;
            printInpatientView.AdmitDiagnosis  = inpatientDt.Rows[0]["DIAGNOSISNAME"].ToString();
            printInpatientView.Depart          = m_inCommonNote.CurrDepartName;
            printInpatientView.InBedNo         = inpatientDt.Rows[0]["OUTBED"].ToString();
            printInpatientView.RecordName      = m_inCommonNote.InCommonNoteName;
            if (inpatientDt.Rows[0]["INWARDDATE"].ToString().Length >= 10)
            {
                printInpatientView.InDateTime = inpatientDt.Rows[0]["INWARDDATE"].ToString().Substring(0, 10);
            }
            printInpatientView.InNo              = inpatientDt.Rows[0]["PATID"].ToString();
            printInpatientView.OutNo             = inpatientDt.Rows[0]["NOOFCLINIC"].ToString();
            printInpatientView.PatId             = inpatientDt.Rows[0]["PATNOOFHIS"].ToString();
            printInpatientView.InpatientAge      = inpatientDt.Rows[0]["AGESTR"].ToString();
            printInpatientView.InpatientName     = inpatientDt.Rows[0]["NAME"].ToString();
            printInpatientView.Sex               = inpatientDt.Rows[0]["SEX"].ToString();
            printInpatientView.Ward              = m_inCommonNote.CurrWardName;
            printInCommonView.PrintInpatientView = printInpatientView;

            if (m_inCommonNote.InCommonNoteTabList == null)
            {
                return(printInCommonView);
            }
            for (int i = 0; i < m_inCommonNote.InCommonNoteTabList.Count; i++)
            {
                CommonNote_TabEntity commonNote_TabEntity = null;
                foreach (var itemTab in m_commonNoteEntity.CommonNote_TabList)
                {
                    if (itemTab.CommonNote_Tab_Flow == m_inCommonNote.InCommonNoteTabList[i].CommonNote_Tab_Flow)
                    {
                        commonNote_TabEntity = itemTab;
                        break;
                    }
                }
                PrintInCommonTabView printInCommonTabView = new CommonNoteUse.PrintInCommonTabView();  //主要目的是给这个对象复制
                Dictionary <string, List <InCommonNoteItemEntity> > dicitemList;
                List <string> strNames = InCommonNoteBiz.ConvertInCommonTabToPrint(m_inCommonNote.InCommonNoteTabList[i], printInCommonTabView, out dicitemList, commonNote_TabEntity, m_app, m_inCommonNote);

                string proName = "PrintInCommonTabViewList";
                proName = proName + (i + 1);
                PropertyInfo property = printInCommonView.GetType().GetProperty(proName);
                if (property != null)
                {
                    property.SetValue(printInCommonView, printInCommonTabView, null);
                }

                if (i == 0 && m_inCommonNote.InCommonNoteTabList[i] != null)
                {
                    ConverToDuoRow(printInCommonView);
                    //ConvertForDuoLie(printInCommonView);


                    IPrintNurse iPrintNurse = AbstractorFactry.GetNurseRecord(printInCommonView.PrintFileName);
                    if (iPrintNurse != null)
                    {
                        iPrintNurse.commonNoteCountEntity = CommonNoteBiz.GetCommonNoteCount(m_commonNoteEntity.CommonNoteFlow);

                        printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = iPrintNurse.JiSuanZongLiang(printInCommonView);
                    }
                    else
                    {
                        if (printInCommonView != null &&
                            printInCommonView.PrintInCommonTabViewList1 != null &&
                            printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList != null)
                        {
                            InCommonNoteBiz.ConvertForDateTime(printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList);
                            InCommonNoteBiz.SetRowEnd(printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList, printInCommonView.PrintFileName);
                        }
                    }



                    //xll 2013-01-12 处理相同时间数据
                    //ConvertForDateTime(printInCommonView);
                }
            }
            return(printInCommonView);
        }
Beispiel #2
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="printInCommonView"></param>
        private void InitPrintView(PrintInCommonView printInCommonView)
        {
            printPageNowPer           = 0;
            m_printInCommonView       = printInCommonView;
            printPreviewControl1.Rows = 1;
            iPrintNurse = AbstractorFactry.GetNurseRecord(printInCommonView.PrintFileName);
            string      fileName = AppDomain.CurrentDomain.BaseDirectory + @"Report\" + printInCommonView.PrintFileName + ".xml";
            XmlDocument xmldoc   = new XmlDocument();

            xmldoc.Load(fileName);
            iPrintNurse.PageRecordCount = int.Parse(CommonMethods.GetElementAttribute("ImageSize", "rowCount", xmldoc));
            string PaperType = CommonMethods.GetElementAttribute("PrintPageSize", "type", xmldoc);
            int    width;
            int    heigth;

            int.TryParse(CommonMethods.GetElementAttribute("PrintPageSize", "width", xmldoc), out width);
            int.TryParse(CommonMethods.GetElementAttribute("PrintPageSize", "height", xmldoc), out heigth);
            Landscape = CommonMethods.GetElementAttribute("PrintPageSize", "Landscape", xmldoc).ToUpper() == "TRUE" ? true : false;

            PrintDocument printDocumentPre = new PrintDocument();
            PrintDialog   MySettings       = new PrintDialog();

            MySettings.Document = printDocumentPre;

            foreach (PaperSize ps in MySettings.Document.PrinterSettings.PaperSizes)
            {
                if (ps.Kind.ToString().ToUpper().Equals(PaperType.ToUpper()))//这里设置纸张大小,但必须是定义好的
                {
                    paperSize = ps;
                    break;
                }
            }
            if (paperSize == null)
            {
                paperSize           = new PaperSize();
                paperSize.PaperName = PaperType;
                paperSize.Width     = width;
                paperSize.Height    = heigth;
            }
            MySettings.Document.DefaultPageSettings.PaperSize = paperSize;
            MySettings.Document.DefaultPageSettings.Landscape = Landscape;

            //printDocumentPre.DefaultPageSettings.PaperSize = paperSize;

            int PageRecordCount           = iPrintNurse.PageRecordCount; //每张的行数
            var PrintInCommonItemViewList = m_printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList;

            if (PrintInCommonItemViewList == null)
            {
                PrintInCommonItemViewList = new List <PrintInCommonItemView>();
            }
            int allcount  = PrintInCommonItemViewList.Count;
            int pageCount = (allcount + PageRecordCount - 1) / PageRecordCount;  //总页数

            if (pageCount == 0)
            {
                pageCount = 1;
            }
            printEnd = pageCount;

            printDocumentPre.PrintPage   += new PrintPageEventHandler(printDocumentPre_PrintPage);
            printPreviewControl1.Document = printDocumentPre;
            printPreviewControl1.Zoom     = 1;
        }
Beispiel #3
0
        /// <summary>
        /// 切换tab触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tabcontrol_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
        {
            if (tabcontrol.SelectedTabPage != tabPagePrint)
            {
                return;
            }
            WaitDialogForm waitDialog = new WaitDialogForm("正在组织打印数据……", "请稍等。");

            try
            {
                //xll 2013-03-26 获取全部数据 点击全部了 就无需再次查找 点击其他的 需要查找
                foreach (XtraTabPage item in tabcontrol.TabPages)
                {
                    if (item.Controls.Count > 0)
                    {
                        UCIncommonNoteTab uCIncommonNoteTab = item.Controls[0] as UCIncommonNoteTab;
                        if (uCIncommonNoteTab != null)
                        {
                            m_inCommonNote = uCIncommonNoteTab.GetAllDetailDate();
                            break;
                        }
                    }
                }
                PrintInCommonView printInCommonView = ConvertPrintEntity();

                iPrintNurse = AbstractorFactry.GetNurseRecord(printInCommonView.PrintFileName);
                SetWaitDialogCaption("正在绘制预览界面……", waitDialog);
                if (iPrintNurse != null && iPrintNurse.IsCustomPrint == true)
                {
                    if (tabPagePrint.Controls == null || tabPagePrint.Controls.Count <= 0)
                    {
                        PrintForm1 printForm1 = new PrintForm1(printInCommonView);
                        printForm1.Dock            = DockStyle.Fill;
                        printForm1.TopLevel        = false;
                        printForm1.FormBorderStyle = FormBorderStyle.None;
                        printForm1.Show();
                        tabPagePrint.Controls.Add(printForm1);
                    }
                    else
                    {
                        PrintForm1 printForm1 = tabPagePrint.Controls[0] as PrintForm1;
                        if (printForm1 != null)
                        {
                            printForm1.m_printInCommonView = printInCommonView;
                            printForm1.RefreshView();
                        }
                    }
                }
                else
                {
                    if (ucPrintRecord == null)
                    {
                        ucPrintRecord = new UCPrintRecord();
                        tabPagePrint.Controls.Add(ucPrintRecord);
                        ucPrintRecord.Dock = DockStyle.Fill;
                    }
                    ucPrintRecord.LoadPrint(printInCommonView);
                }
                waitDialog.Hide();
                waitDialog.Close();
            }
            catch (Exception ex)
            {
                waitDialog.Hide();
                waitDialog.Close();
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex);
            }
        }