Example #1
0
 /// <summary>
 /// 当DateTimeShow相同时  下面的DateTimeShow不显示
 /// </summary>
 /// <param name="printInCommonView"></param>
 private void ConvertForDateTime(PrintInCommonView printInCommonView)
 {
     if (printInCommonView != null || printInCommonView.PrintInCommonTabViewList1 != null)
     {
         InCommonNoteBiz.ConvertForDateTime(printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList);
     }
 }
Example #2
0
        /// <summary>
        /// 将一列变成可绑定的多列  最大只有5大列
        /// </summary>
        /// <param name="printInCommonView"></param>
        private void ConvertForDuoLie(PrintInCommonView printInCommonView)
        {
            List <PrintInCommonItemView> printInCommonItemViewListOld = printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList;

            if (printInCommonItemViewListOld == null)
            {
                return;
            }
            Dictionary <string, string> dicstr = InCommonNoteBiz.GetReportxmlCol(printInCommonView);

            if (!dicstr.ContainsKey("maxCols"))
            {
                return;
            }
            string maxcols = dicstr["maxCols"]; //大列数
            int    maxcolsint;                  //大列
            bool   ismax = int.TryParse(maxcols, out maxcolsint);

            if (maxcolsint <= 1 || maxcolsint > 5)
            {
                return;
            }
            List <PrintInCommonItemView> printInCommonItemViewListNew = new List <PrintInCommonItemView>();

            for (int i = 0; i < printInCommonItemViewListOld.Count; i++)
            {
                int yushu = i % maxcolsint;
                if (yushu == 0)
                {
                    PrintInCommonItemView printInCommonItemView = new PrintInCommonItemView();
                    if (maxcolsint >= 5 &&
                        (i + 4 < printInCommonItemViewListOld.Count))
                    {
                        printInCommonItemView.PrintInCommonItemView5 = printInCommonItemViewListOld[i + 4];
                    }
                    if (maxcolsint >= 4 &&
                        (i + 3 < printInCommonItemViewListOld.Count))
                    {
                        printInCommonItemView.PrintInCommonItemView4 = printInCommonItemViewListOld[i + 3];
                    }
                    if (maxcolsint >= 3 &&
                        (i + 2 < printInCommonItemViewListOld.Count))
                    {
                        printInCommonItemView.PrintInCommonItemView3 = printInCommonItemViewListOld[i + 2];
                    }
                    if (maxcolsint >= 2 &&
                        (i + 1 < printInCommonItemViewListOld.Count))
                    {
                        printInCommonItemView.PrintInCommonItemView2 = printInCommonItemViewListOld[i + 1];
                    }
                    printInCommonItemView.PrintInCommonItemView1 = printInCommonItemViewListOld[i];

                    printInCommonItemViewListNew.Add(printInCommonItemView);  //添加整理好的一行
                }
            }

            printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = printInCommonItemViewListNew;
        }
Example #3
0
        private void tabcontrol_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
        {
            if (tabcontrol.SelectedTabPage != tabPagePrint)
            {
                return;
            }
            WaitDialogForm waitDialog = new WaitDialogForm("正在组织打印数据……", "请稍等。");

            try
            {
                PrintInCommonView printInCommonView = ConvertPrintEntity();
                iPrintNurse = AbstractorFactry.GetNurseRecord(printInCommonView.PrintFileName);
                SetWaitDialogCaption("正在绘制预览界面……", waitDialog);
                if (iPrintNurse != null && iPrintNurse.IsCustomPrint == true)
                {
                    tabPagePrint.Controls.Clear();
                    PrintForm1 printForm1 = new PrintForm1(printInCommonView);
                    printForm1.Dock            = DockStyle.Fill;
                    printForm1.TopLevel        = false;
                    printForm1.FormBorderStyle = FormBorderStyle.None;
                    printForm1.Show();
                    tabPagePrint.Controls.Add(printForm1);
                }
                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();
                YiDanCommon.Ctrs.DLG.YiDanMessageBox.Show(ex.Message);
            }
        }
Example #4
0
 public PrintForm(PrintInCommonView printInCommonView)
 {
     m_printInCommonView = printInCommonView;
     InitializeComponent();
     GetBitmap();
 }
Example #5
0
        public void ConverToDuoRow(PrintInCommonView printInCommonView)
        {
            List <PrintInCommonItemView> printInCommonItemViewListOld = printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList;

            if (printInCommonItemViewListOld == null)
            {
                return;
            }
            Dictionary <string, ColmonXMLEntity> dicwordcounts = InCommonNoteBiz.GetReportxmlwords(printInCommonView);  //xml中属性 和最大字符数

            if (dicwordcounts == null || dicwordcounts.Count == 0)
            {
                return;
            }
            List <PrintInCommonItemView> printInCommonItemViewListOut = new List <PrintInCommonItemView>(); //存放处理好的对象
            List <PrintInCommonItemView> printInCommonItemViewListNew = new List <PrintInCommonItemView>();

            Dictionary <string, List <PrintInCommonItemView> > dicIncommList = new Dictionary <string, List <PrintInCommonItemView> >();

            //将datetime时间相同的分组
            for (int i = 0; i < printInCommonItemViewListOld.Count; i++)
            {
                if (!dicIncommList.ContainsKey(printInCommonItemViewListOld[i].DateTimeShow))
                {
                    dicIncommList.Add(printInCommonItemViewListOld[i].DateTimeShow, new List <PrintInCommonItemView>());
                }
                dicIncommList[printInCommonItemViewListOld[i].DateTimeShow].Add(printInCommonItemViewListOld[i]);
            }


            foreach (List <PrintInCommonItemView> incommItemList in dicIncommList.Values)
            {
                #region 处理数据
                printInCommonItemViewListNew = incommItemList;
                int maxrow = -1;                                                             //用于获取一个对象中被分成的最大行数
                Dictionary <string, string> dicNeedRows = new Dictionary <string, string>(); //需要换行的列 值
                foreach (var item in dicwordcounts)
                {
                    string valueStr = "";
                    if (item.Value == null)
                    {
                        break;
                    }
                    string proName = item.Key;  //属性名

                    foreach (var inCommonItem in printInCommonItemViewListNew)
                    {
                        PropertyInfo property = inCommonItem.GetType().GetProperty(proName); //获取该对象的该属性
                        if (property != null)
                        {
                            object valueobj = property.GetValue(inCommonItem, null);
                            if (valueobj != null)
                            {
                                valueStr += valueobj.ToString();
                            }
                            property.SetValue(inCommonItem, "", null);
                        }
                    }
                    dicNeedRows.Add(proName, valueStr);
                    int zheshu = GetNeedRows(valueStr, item.Value).Count;
                    if (zheshu > maxrow)
                    {
                        maxrow = zheshu;
                    }
                }   //获得需要换行的属性和值的集合 并获得需要的最大行数


                //处理数据 最终的分行处理
                for (int j = 0; j < maxrow; j++)
                {
                    foreach (var itemneed in dicNeedRows)  //对各列进行截取
                    {
                        string proName = itemneed.Key;
                        if (j >= printInCommonItemViewListNew.Count)
                        {
                            PrintInCommonItemView printInCommonItemView = new CommonNoteUse.PrintInCommonItemView();
                            printInCommonItemView.Date                = printInCommonItemViewListNew[0].Date;
                            printInCommonItemView.Time                = printInCommonItemViewListNew[0].Time;
                            printInCommonItemView.DateTimeShow        = printInCommonItemViewListNew[0].DateTimeShow;
                            printInCommonItemView.RecordDoctorId      = printInCommonItemViewListNew[0].RecordDoctorId;
                            printInCommonItemView.RecordDoctorName    = printInCommonItemViewListNew[0].RecordDoctorName;
                            printInCommonItemView.RecordDoctorImg     = printInCommonItemViewListNew[0].RecordDoctorImg;
                            printInCommonItemView.RecordDoctorImgbyte = printInCommonItemViewListNew[0].RecordDoctorImgbyte;
                            printInCommonItemViewListNew.Add(printInCommonItemView);
                        }

                        PropertyInfo property      = printInCommonItemViewListNew[j].GetType().GetProperty(proName); //获取该对象的该属性
                        string       rowindexvalue = GetIndexStr(j, GetNeedRows(itemneed.Value, dicwordcounts[proName]));
                        property.SetValue(printInCommonItemViewListNew[j], rowindexvalue, null);
                    }
                }
                #endregion
                //将处理好的对象集合存放到最新的数据集中
                printInCommonItemViewListOut.AddRange(printInCommonItemViewListNew);
            }
            printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = printInCommonItemViewListOut;
        }
Example #6
0
        /// <summary>
        /// 打印表格时一行不过换行显示
        /// </summary>
        /// <param name="printInCommonView"></param>
        private void ConvertForChangeRow(PrintInCommonView printInCommonView)
        {
            List <PrintInCommonItemView> printInCommonItemViewListOld = printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList;

            if (printInCommonItemViewListOld == null)
            {
                return;
            }
            List <PrintInCommonItemView>         printInCommonItemViewListNew = new List <PrintInCommonItemView>();
            Dictionary <string, ColmonXMLEntity> dicwordcounts = InCommonNoteBiz.GetReportxmlwords(printInCommonView);  //xml中属性 和最大字符数

            if (dicwordcounts == null || dicwordcounts.Count == 0)
            {
                return;
            }
            foreach (var inCommonItem in printInCommonItemViewListOld)
            {
                int maxrow = -1;                                                             //用于获取一个对象中被分成的最大行数
                Dictionary <string, string> dicNeedRows = new Dictionary <string, string>(); //需要换行的列 值
                foreach (var item in dicwordcounts)
                {
                    if (item.Value == null)
                    {
                        break;
                    }
                    string       proName  = item.Key;                                    //属性名
                    PropertyInfo property = inCommonItem.GetType().GetProperty(proName); //获取该对象的该属性
                    if (property != null)
                    {
                        string valuestr = "";
                        object valueobj = property.GetValue(inCommonItem, null);
                        if (valueobj != null)
                        {
                            valuestr = valueobj.ToString();
                        }
                        dicNeedRows.Add(proName, valuestr);
                        int zheshu = GetNeedRows(valuestr, item.Value).Count;
                        if (zheshu > maxrow)
                        {
                            maxrow = zheshu;
                        }
                    }
                }
                if (maxrow == -1)
                {
                    continue;
                }
                if (maxrow == 1 || maxrow == 0)
                {
                    PrintInCommonItemView printInCommonItemView = inCommonItem;
                    printInCommonItemViewListNew.Add(printInCommonItemView);
                }
                else
                {
                    List <PrintInCommonItemView> printInCommonItemOnemore = new List <PrintInCommonItemView>();  //一个正常行最终变成的多行
                    for (int i = 0; i < maxrow; i++)
                    {
                        PrintInCommonItemView printInCommonItemView;
                        if (i == 0)
                        {
                            printInCommonItemView = inCommonItem;
                        }
                        else
                        {
                            printInCommonItemView = new PrintInCommonItemView();
                        }
                        foreach (var itemneed in dicNeedRows)  //对各列进行截取
                        {
                            string       proName       = itemneed.Key;
                            PropertyInfo property      = printInCommonItemView.GetType().GetProperty(proName); //获取该对象的该属性
                            string       rowindexvalue = GetIndexStr(i, GetNeedRows(itemneed.Value, dicwordcounts[proName]));
                            property.SetValue(printInCommonItemView, rowindexvalue, null);
                        }
                        printInCommonItemOnemore.Add(printInCommonItemView);
                    }
                    printInCommonItemOnemore[printInCommonItemOnemore.Count - 1].RecordDoctorName = printInCommonItemOnemore[0].RecordDoctorName;
                    printInCommonItemOnemore[printInCommonItemOnemore.Count - 1].RecordDoctorId   = printInCommonItemOnemore[0].RecordDoctorId;
                    printInCommonItemOnemore[printInCommonItemOnemore.Count - 1].RecordDoctorImg  = printInCommonItemOnemore[0].RecordDoctorImg;
                    printInCommonItemOnemore[0].RecordDoctorName = "";
                    printInCommonItemOnemore[0].RecordDoctorId   = "";
                    printInCommonItemOnemore[0].RecordDoctorImg  = "";
                    printInCommonItemViewListNew.AddRange(printInCommonItemOnemore);
                }
            }
            printInCommonView.PrintInCommonTabViewList1.PrintInCommonItemViewList = printInCommonItemViewListNew;
        }