显示单据信息(类似打印)

展示效果

代码

/// <summary>
        /// 处方签展示
        /// </summary>
        private void PrescriptionLabelDisplay()
        {
            ///处方签
            if (tbDtl.SelectedTab == tpPrescriptionLabel)
            {

                #region 获取主单据信息
                ChgDtlVo chg = dgvBill.Grid.ActiveRow?.ListObject as ChgDtlVo ?? new ChgDtlVo();
                List<ChgDtlVo> chgList = new List<ChgDtlVo>();
                chgList.Add(chg);
                DataTable chgDtlVoMian = GeneralPrint.GetInstance.List2DataTable<ChgDtlVo>(chgList);
                #endregion

                #region 获取单据明细信息
                List<ChgDtlVo> dtlDatas = dgvDtl.DataSource as List<ChgDtlVo> ?? new List<ChgDtlVo>();
                DataTable dtlDt = GeneralPrint.GetInstance.List2DataTable<ChgDtlVo>(dtlDatas);
                #endregion 获取单据明细信息

                #region 获取用户信息
                PrintArgs printArgs = new PrintArgs();
                if (odPatient?.OdAppnoList?.Count > 0)
                {
                    foreach (var s in odPatient?.OdAppnoList)
                    {
                        odPatient.OdAppnoListStr = $"【{s}】";
                    }
                }
                List<OdExecPatientVo> opUserInfo = new List<OdExecPatientVo>();
                opUserInfo.Add(odPatient);
                DataTable UserInfo = GeneralPrint.GetInstance.List2DataTable<OdExecPatientVo>(opUserInfo);
                #endregion 获取用户信息 
                Dictionary<string, object> dictionary = new Dictionary<string, object>();
                dictionary.Add("ChgDtlVoList", dtlDt);
                dictionary.Add(nameof(chgDtlVoMian), chgDtlVoMian);
                dictionary.Add(nameof(OdExecPatientVo), UserInfo);
                DicCircpVo dicCircp = GeneralPrint.GetInstance.GetPrintDicCirpsBySfName(SubFuncName.HERBALMEDICINE_PRINT)?.Count > 0 ? GeneralPrint.GetInstance.GetPrintDicCirpsBySfName(SubFuncName.HERBALMEDICINE_PRINT).First() : new DicCircpVo();
                if (dicCircp != null)
                {
                    string reportPath = TemplateDownloader.GetCircpTemplatePath(dicCircp.DcrId);
                    MzReport.ReportEntity reportControl = new MzReport.ReportEntity();
                    if (reportControl == null)
                    {
                        reportControl = new MzReport.ReportEntity();
                    }
                    reportControl.Preview(reportPath, dicCircp.DcrId, dictionary, null, reportsView);
                }
            }
        }
原文地址:https://www.cnblogs.com/yuanshuo/p/13878389.html