public static void drawItem(BaseReport Base, ViewScroll parent, int offset)
        {
            int boxHeight = 110;

            ViewBox Box = new ViewBox();

            Box.setRelativeTo(parent);
            Box.setWidth(parent.getWidth() - 20);
            Box.setHeight(boxHeight);
            Box.setLeft(0);
            Box.setTop((boxHeight + 10) * offset);
            Box.setColor(Color.white);
            parent.Components.Add(Box);

            string    label     = "[" + Base.name + " is Landed At " + Base.entity + "]";
            ViewLabel BaseLabel = new ViewLabel(label);

            BaseLabel.setRelativeTo(Box);
            BaseLabel.setTop(5);
            BaseLabel.setLeft(5);
            BaseLabel.setHeight(15);
            BaseLabel.setPercentWidth(100);
            BaseLabel.setColor(Color.green);
            parent.Components.Add(BaseLabel);

            ViewLabel FuelLabel = new ViewLabel("Fuel: " + Base.fuel);

            FuelLabel.setRelativeTo(Box);
            FuelLabel.setTop(25);
            FuelLabel.setLeft(5);
            FuelLabel.setHeight(15);
            FuelLabel.setWidth(150);
            FuelLabel.setColor(Color.white);
            parent.Components.Add(FuelLabel);

            ViewLabel OreLabel = new ViewLabel("Ore: " + Base.ore);

            OreLabel.setRelativeTo(Box);
            OreLabel.setTop(45);
            OreLabel.setLeft(5);
            OreLabel.setHeight(20);
            OreLabel.setWidth(150);
            OreLabel.setColor(Color.white);
            parent.Components.Add(OreLabel);

            ViewLabel CrewLabel = new ViewLabel("Crew: " + Base.crew);

            CrewLabel.setRelativeTo(Box);
            CrewLabel.setTop(65);
            CrewLabel.setLeft(5);
            CrewLabel.setHeight(20);
            CrewLabel.setWidth(150);
            CrewLabel.setColor(Color.white);
            parent.Components.Add(CrewLabel);

            ViewLabel CrewCapacityLabel = new ViewLabel("Crew Capacity: " + Base.crewCapacity);

            CrewCapacityLabel.setRelativeTo(Box);
            CrewCapacityLabel.setTop(85);
            CrewCapacityLabel.setLeft(5);
            CrewCapacityLabel.setHeight(20);
            CrewCapacityLabel.setWidth(150);
            CrewCapacityLabel.setColor(Color.white);
            parent.Components.Add(CrewCapacityLabel);

            ViewLabel DockingPortsLabel = new ViewLabel("Docking Ports: " + Base.dockingPorts);

            DockingPortsLabel.setRelativeTo(Box);
            DockingPortsLabel.setTop(25);
            DockingPortsLabel.setLeft(155);
            DockingPortsLabel.setHeight(15);
            DockingPortsLabel.setWidth(150);
            DockingPortsLabel.setColor(Color.white);
            parent.Components.Add(DockingPortsLabel);

            ViewLabel DockedVesselsLabel = new ViewLabel("Docked Vessels: " + Base.dockedVessels);

            DockedVesselsLabel.setRelativeTo(Box);
            DockedVesselsLabel.setTop(45);
            DockedVesselsLabel.setLeft(155);
            DockedVesselsLabel.setHeight(15);
            DockedVesselsLabel.setWidth(150);
            DockedVesselsLabel.setColor(Color.white);
            parent.Components.Add(DockedVesselsLabel);

            ViewLabel ScienceLabLabel = new ViewLabel("Science Lab: " + Base.scienceLab);

            ScienceLabLabel.setRelativeTo(Box);
            ScienceLabLabel.setTop(65);
            ScienceLabLabel.setLeft(155);
            ScienceLabLabel.setHeight(15);
            ScienceLabLabel.setWidth(150);
            ScienceLabLabel.setColor(Color.white);
            parent.Components.Add(ScienceLabLabel);

            ViewLabel HasDrillLabel = new ViewLabel("Has Drill: " + Base.drill);

            HasDrillLabel.setRelativeTo(Box);
            HasDrillLabel.setTop(85);
            HasDrillLabel.setLeft(155);
            HasDrillLabel.setHeight(15);
            HasDrillLabel.setWidth(150);
            HasDrillLabel.setColor(Color.white);
            parent.Components.Add(HasDrillLabel);

            ViewLabel SCLabel = new ViewLabel("PO: " + Base.po);

            SCLabel.setRelativeTo(Box);
            SCLabel.setTop(25);
            SCLabel.setLeft(310);
            SCLabel.setHeight(15);
            SCLabel.setWidth(150);
            SCLabel.setColor(Color.white);
            parent.Components.Add(SCLabel);

            ViewLabel POLabel = new ViewLabel("SC: " + Base.sc);

            POLabel.setRelativeTo(Box);
            POLabel.setTop(45);
            POLabel.setLeft(310);
            POLabel.setHeight(15);
            POLabel.setWidth(150);
            POLabel.setColor(Color.white);
            parent.Components.Add(POLabel);
        }
Beispiel #2
0
        private IActionResult RenderReport(BaseReport report)
        {
            var(result, exception) = report.GenerateModel(cache);

            return(exception != null?RedirectToError(exception) : View("Index", result));
        }
        private void btnStat_Click(object sender, EventArgs e)
        {
            SetControlEnable(false);

            DateTime     beginDate;
            DateTime     endDate;
            BaseReport   report = null;
            string       accountIdList;
            string       patTypeCode = "";
            int          statDay     = Convert.ToInt32(txtDay.Text);
            StatDateType dateType    = StatDateType.统计日;
            OPDBillKind  invoiceType = OPDBillKind.所有发票;

            #region 统计条件
            foreach (object obj in Enum.GetValues(typeof(StatDateType)))
            {
                if (obj.ToString( ) == cboDateType.Text)
                {
                    dateType = (StatDateType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(OPDBillKind)))
            {
                if (obj.ToString( ) == cboInvoiceType.Text)
                {
                    invoiceType = (OPDBillKind)obj;
                    break;
                }
            }
            if (chkPatType.Checked)
            {
                patTypeCode = cboPatType.SelectedValue.ToString( );
            }
            #endregion
            ReportController.GetReportBeginDateAndEndDate(dateType, statDay, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
            lblDate.Text = beginDate.ToString("yyyy-MM-dd HH:mm:ss") + "--" + endDate.ToString("yyyy-MM-dd HH:mm:ss");
            try
            {
                report           = new PatientFeeReport( );
                report.BeginDate = beginDate;
                report.EndDate   = endDate;
                ((PatientFeeReport)report).PatientTypeCode = patTypeCode;
                ((PatientFeeReport)report).InvoiceType     = invoiceType;
                ((PatientFeeReport)report).CurDocName      = chkCureDoc.Checked ? cboDoc.Text : "";
                ((PatientFeeReport)report).CurDeptName     = chkDept.Checked ? cboDept.Text : "";
                ((PatientFeeReport)report).ChargeName      = chkSfy.Checked ? cboCharge.Text : "";
                report.StatDateType  = dateType;
                report.AccountIdList = accountIdList;
                report.ReportTitle   = "门诊病人费用统计表";
                report.Lister        = BaseDataController.GetName(BaseDataCatalog.人员列表, employeeId); //PublicDataReader.GetEmployeeNameById( employeeId );

                ReportController.FillReport(report);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;

                for (int i = 0; i < dgvReport.Columns.Count; i++)
                {
                    if (i >= 7)
                    {
                        dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvReport.Columns[i].Width = 80;
                    }
                    if (i < 8)
                    {
                        dgvReport.Columns[i].Frozen = true;
                    }
                }
            }
            catch
            {
                MessageBox.Show("统计发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetControlEnable(true);
            }
        }
Beispiel #4
0
        public JsonTable buildJsonTable(BaseReport report)
        {
            var table = new JsonTable();

            switch (report.GetType().Name)
            {
            case "StandardReport":
                var data = (StandardReport)report;
                if (data.ResultDataTable.Rows.Count > 0)
                {
                    table.ReportDate = ((DateTime)data.ResultDataTable.Rows[0]["REDATE"]).ToString("yyyy-MM");
                }

                foreach (var column in data.Columns)
                {
                    table.ColumTemplate.Add(new JsonColumn()
                    {
                        ColumnName  = column.ColumnName.ToLower(),
                        ColumnStyle = column.ColumnStyle,
                        ColumnType  = column.ColumnType,
                        Name        = column.Culture == "zh-CN" ? column.ColumnHeaderCN : column.ColumnHeaderEN
                    });
                }

                table.ExtraHeaders = new List <JsonExtraColumn>();
                foreach (var extraHeader in data.ExtraHeaderCollection)
                {
                    table.ExtraHeaders.Add(new JsonExtraColumn()
                    {
                        Name        = extraHeader.Culture == "zh-CN" ? extraHeader.HeaderTextCN : extraHeader.HeaderTextEN,
                        ColumnStyle = extraHeader.HeaderStyle,
                        ColSpan     = extraHeader.HeaderColumnSpan,
                        HeaderLevel = extraHeader.HeaderLevel
                    });
                }

                table.RowData = new List <Dictionary <string, string> >();

                foreach (DataRow row in data.ResultDataTable.Rows)
                {
                    var currentRow = new Dictionary <string, string>();

                    foreach (var column in data.Columns)
                    {
                        if (!currentRow.Keys.Contains(column.ColumnName))
                        {
                            if (Thread.CurrentThread.CurrentUICulture.Name == "zh-CN")
                            {
                                currentRow.Add(column.ColumnName.ToLower(), UIGenerator.FormatCellValue(row, column));
                            }
                            else
                            {
                                currentRow.Add(column.ColumnName.ToLower(),
                                               row.Table.Columns.Contains(column.ColumnName + "EN")
                                            ? UIGenerator.FormatCellValue(row[column.ColumnName + "EN"],
                                                                          column.ColumnType, column.ColumnFormat)
                                            : UIGenerator.FormatCellValue(row, column));
                            }
                        }
                    }
                    if (row.Table.Columns.Contains("id"))
                    {
                        currentRow.Add("id", row["id"].ToString());
                    }
                    if (row.Table.Columns.Contains("last_update"))
                    {
                        currentRow.Add("last_update", row["last_update"].ToString());
                    }
                    if (row.Table.Columns.Contains("row_index"))
                    {
                        currentRow.Add("row_index", row["row_index"].ToString());
                    }
                    if (row.Table.Columns.Contains("chart_source"))
                    {
                        currentRow.Add("chart_source", row["chart_source"].ToString());
                    }
                    if (row.Table.Columns.Contains("row_level"))
                    {
                        currentRow.Add("row_level", row["row_level"].ToString());
                    }

                    table.RowData.Add(currentRow);
                }

                break;
            }
            return(table);
        }
Beispiel #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PrintPosItem(BaseReport rp)
     : base(rp)
 {
 }
        private void btnStat_Click(object sender, EventArgs e)
        {
            DateTime   beginDate;
            DateTime   endDate;
            BaseReport report = null;
            string     accountIdList;

            StatDateType  dateType = StatDateType.自定义时间;
            StatClassType statType = StatClassType.门诊发票分类;
            ReportStyle   style    = ReportStyle.科目为标题列;

            foreach (object obj in Enum.GetValues(typeof(StatClassType)))
            {
                if (obj.ToString() == cboStatType.Text)
                {
                    statType = (StatClassType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(ReportStyle)))
            {
                if (obj.ToString() == cboStyle.Text)
                {
                    style = (ReportStyle)obj;
                    break;
                }
            }
            StatObjctType statObjectType = StatObjctType.收费员;

            try
            {
                Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
                ReportController.GetReportBeginDateAndEndDate(dateType, 15, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
                report           = new TollerIncomeReport();
                report.BeginDate = dtpFrom.Value;
                report.EndDate   = dtpEnd.Value;

                report.StatType     = statType;
                report.Reportstyle  = style;
                report.StatDateType = dateType;
                // report.AccountIdList = accountIdList;
                report.StatObjectType = statObjectType;
                report.ReportTitle    = "门诊收费员工作量统计报表";

                report.Lister = BaseDataController.GetName(BaseDataCatalog.人员列表, currentEmployeeId);
                ReportController.FillReport(report, dtpFrom.Value, dtpEnd.Value);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;

                for (int i = 1; i < dgvReport.Columns.Count; i++)
                {
                    dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    dgvReport.Columns[i].Width = 80;
                }
                dgvReport.Columns[0].Frozen = true;
                dgvReport.Columns[1].Frozen = true;
            }
            catch (OperatorException oe)
            {
                MessageBox.Show(oe.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                MessageBox.Show("统计报表中发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Beispiel #7
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            DateTime      beginDate;
            DateTime      endDate;
            BaseReport    report = null;
            string        accountIdList;
            int           statDay        = Convert.ToInt32(txtDay.Text);
            StatDateType  dateType       = StatDateType.统计日;
            StatClassType statType       = StatClassType.门诊发票分类;
            StatObjctType statObjectType = StatObjctType.医生;
            ReportStyle   style          = ReportStyle.科目为标题列;

            #region 统计条件
            foreach (object obj in Enum.GetValues(typeof(StatDateType)))
            {
                if (obj.ToString( ) == cboDateType.Text)
                {
                    dateType = (StatDateType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(StatClassType)))
            {
                if (obj.ToString( ) == cboStatType.Text)
                {
                    statType = (StatClassType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(ReportStyle)))
            {
                if (obj.ToString( ) == cboStyle.Text)
                {
                    style = (ReportStyle)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(StatObjctType)))
            {
                if (obj.ToString( ) == cboType.Text)
                {
                    statObjectType = (StatObjctType)obj;
                    break;
                }
            }
            #endregion
            try
            {
                Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor( );
                SetButtonEnable(false);
                ReportController.GetReportBeginDateAndEndDate(dateType, statDay, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
                lblDate.Text = beginDate.ToString("yyyy-MM-dd HH:mm:ss") + "  ——  " + endDate.ToString("yyyy-MM-dd HH:mm:ss");
                switch (statObjectType)
                {
                case StatObjctType.医生:
                    report = new DoctorIncomeReport( );
                    break;

                case StatObjctType.科室:
                    report = new DepartmentIncomeReport( );
                    break;

                case StatObjctType.收费员:
                    report = new TollerIncomeReport( );
                    break;

                case StatObjctType.病人类型:
                    report = new PatientTypeIncomReport( );
                    break;
                }
                report.BeginDate      = beginDate;
                report.EndDate        = endDate;
                report.StatType       = statType;
                report.Reportstyle    = style;
                report.StatDateType   = dateType;
                report.AccountIdList  = accountIdList;
                report.StatObjectType = statObjectType;
                report.ReportTitle    = "门诊" + cboType.Text + "收入报表";
                //report.Lister = PublicDataReader.GetEmployeeNameById( currentEmployeeId );
                report.Lister = BaseDataController.GetName(BaseDataCatalog.人员列表, currentEmployeeId);

                ReportController.FillReport(report);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;

                for (int i = 1; i < dgvReport.Columns.Count; i++)
                {
                    dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    dgvReport.Columns[i].Width = 80;
                }
                dgvReport.Columns[0].Frozen = true;
                dgvReport.Columns[1].Frozen = true;


                if (chkChargeTotalInfo.Checked)
                {
                    StatTotalInfo();
                }
                else
                {
                    dgvTotalInfo.DataSource = null;
                }
            }
            catch (OperatorException oe)
            {
                MessageBox.Show(oe.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                MessageBox.Show("统计报表中发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetButtonEnable(true);
                Cursor = Cursors.Default;
            }
        }
Beispiel #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="rp">Report, the owner of the item</param>
 public ReportItem(BaseReport rp)
 {
     FReport = rp;
     FName   = "";
 }
        public async Task <JobStatus> RunReportJobAsync(int jobId,
                                                        CancellationToken token,
                                                        IProgress <JobStatus> progress = null)
        {
            var job = await _jobRepository.GetByIdAsync(jobId);

            var jobDetails
                = JsonConvert
                  .DeserializeObject <JobDetailsRunReport>(job.SerializedParameters);

            int reportRequestId = jobDetails.ReportRequestId;

            if (HasPermission(Permission.ViewAllReporting))
            {
                BaseReport    report   = null;
                ReportRequest _request = null;

                token.Register(() =>
                {
                    string duration = "immediately";
                    if (report?.Elapsed != null)
                    {
                        duration = $"after {((TimeSpan)report.Elapsed).TotalSeconds.ToString("N2")} seconds";
                    }
                    if (_request != null)
                    {
                        _logger.LogWarning("Report {ReportRequestId} for user {UserId} was cancelled {Duration}.",
                                           reportRequestId,
                                           _request.CreatedBy,
                                           duration);
                    }
                    else
                    {
                        _logger.LogWarning("Report {ReportRequestId} was cancelled {Duration}.",
                                           reportRequestId,
                                           duration);
                    }
                });

                try
                {
                    _request = await _reportRequestRepository.GetByIdAsync(reportRequestId)
                               ?? throw new GraException($"Cannot find report request id {reportRequestId}");
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex,
                                     "Could not find report request {ReportRequestId}: {Message}",
                                     reportRequestId,
                                     ex.Message);
                    return(new JobStatus
                    {
                        Status = "Could not find the report request.",
                        Error = true,
                        Complete = true
                    });
                }

                var reportDetails = new Catalog().Get()
                                    .SingleOrDefault(_ => _.Id == _request.ReportId);

                using (Serilog.Context.LogContext.PushProperty(LoggingEnrichment.ReportName,
                                                               reportDetails.Name))
                {
                    if (reportDetails == null)
                    {
                        _logger.LogError("Cannot find report id {ReportId} requested by request {ReportRequestId}",
                                         _request.ReportId,
                                         reportRequestId);

                        return(new JobStatus
                        {
                            Status = "Could not find the requested report.",
                            Error = true,
                            Complete = true
                        });
                    }

                    try
                    {
                        report = _serviceProvider.GetService(reportDetails.ReportType) as BaseReport;
                    }
                    catch (Exception ex)
                    {
                        _logger.LogCritical(ex,
                                            "Couldn't instantiate report: {Message}",
                                            ex.Message);
                        return(new JobStatus
                        {
                            Status = "Unable to run report.",
                            Error = true,
                            Complete = true
                        });
                    }

                    try
                    {
                        await report.ExecuteAsync(_request, token, progress);
                    }
                    catch (Exception ex)
                    {
                        await _jobRepository.UpdateStatusAsync(jobId, $"An error occurred: {ex.Message}");

                        return(new JobStatus
                        {
                            Status = $"A software error occurred: {ex.Message}.",
                            Complete = true,
                            Error = true
                        });
                    }

                    if (token.IsCancellationRequested)
                    {
                        await _jobRepository.UpdateStatusAsync(jobId,
                                                               $"Report request id {reportRequestId} cancelled.");

                        return(new JobStatus
                        {
                            Status = "Report processing cancelled.",
                            Complete = true,
                            Error = true
                        });
                    }
                    else
                    {
                        await _jobRepository.UpdateStatusAsync(jobId,
                                                               $"Report request id {reportRequestId} completed.");

                        return(new JobStatus
                        {
                            PercentComplete = 100,
                            Complete = true,
                            Status = "Report processing complete.",
                        });
                    }
                }
            }
            else
            {
                var requestingUser = GetClaimId(ClaimType.UserId);
                _logger.LogError("User {UserId} doesn't have permission to view all reporting.",
                                 requestingUser);
                return(new JobStatus
                {
                    Status = "Permission denied.",
                    Complete = true,
                    Error = true
                });
            }
        }
Beispiel #10
0
        public BaseReport GetBaseReportData([FromBody] List <ReportParameter> param, string reportId)
        {
            DataTable     dt      = new DataTable();
            DataTable     dtChart = new DataTable();
            ReportManager rm      = new ReportManager(conStr);
            int           id      = 0;

            if (reportId != "")
            {
                id = int.Parse(reportId);
            }
            ReportDefinition        rd  = rm.GetReportObj(id);
            List <ReportDataColumn> lst = new List <ReportDataColumn>();
            QueryManager            qm  = new QueryManager(conStr);
            //connenct to parameters

            List <IDataParameter> dbp = null;

            if (param != null)
            {
                if (param.Count > 0)
                {
                    dbp = new List <IDataParameter>();
                    foreach (var item in param)
                    {
                        if (item.Type == "date")
                        {
                            if (item.Value == "")
                            {
                                item.Value = DateTime.Now.ToString();
                            }
                            dbp.Add(new NpgsqlParameter(item.ParameterKey, DateTime.Parse(item.Value)));
                        }
                        else
                        {
                            dbp.Add(new NpgsqlParameter(item.ParameterKey, item.Value));
                        }
                    }
                }
            }

            dt = qm.GetQueryResultDataTable(Convert.ToInt32(rd.QueryId), dbp);
            if (rd.ChartQueryId != null && rd.ChartQueryId > 0)
            {
                dtChart = qm.GetQueryResultDataTable((int)rd.ChartQueryId, dbp);
            }
            foreach (DataColumn column in dt.Columns)
            {
                lst.Add(new ReportDataColumn {
                    title = column.ColumnName
                });
            }

            BaseReport      br          = new BaseReport();
            List <string[]> dataStrList = new List <string[]>();

            foreach (DataRow item in dt.Rows)
            {
                string[] str = new string[dt.Columns.Count];
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    str[i] = item[i].ToString();
                }
                dataStrList.Add(str);
            }
            br.columns     = lst.ToArray <ReportDataColumn>();
            br.data        = dataStrList;
            br.ReportChart = GenereateChartData(dtChart);
            return(br);
        }
        private void btnStat_Click(object sender, EventArgs e)
        {
            SetControlEnable(false);
            DateTime     beginDate;
            DateTime     endDate;
            BaseReport   report = null;
            string       accountIdList;
            string       patTypeCode = "";
            StatDateType dateType    = StatDateType.自然时间;
            OPDBillKind  invoiceType = OPDBillKind.所有发票;

            #region 统计条件
            #endregion
            if (chkIsUseTime.Checked)
            {
                ReportController.GetReportBeginDateAndEndDate(dateType, 0, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
            }
            else
            {
                ReportController.GetReportBeginDateAndEndDate(dateType, 0, new DateTime(1, 1, 1), new DateTime(9999, 12, 30),
                                                              out beginDate, out endDate, out accountIdList);
            }
            lblDate.Text = beginDate.ToString("yyyy-MM-dd HH:mm:ss") + "--" + endDate.ToString("yyyy-MM-dd HH:mm:ss");
            try
            {
                report = new PatientFeeReport( );
                ((PatientFeeReport)report).PatName = txtPatName.Text;
                ((PatientFeeReport)report).VisitNo = txtVisitNo.Text;
                report.BeginDate = beginDate;
                report.EndDate   = endDate;
                ((PatientFeeReport)report).PatientTypeCode = patTypeCode;
                ((PatientFeeReport)report).InvoiceType     = invoiceType;
                report.StatDateType  = dateType;
                report.AccountIdList = accountIdList;
                report.ReportTitle   = "门诊病人费用统计表";
                report.Lister        = PublicDataReader.GetEmployeeNameById(employeeId);
                ReportController.FillReport(report);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;
                for (int i = 0; i < dgvReport.Columns.Count; i++)
                {
                    if (i >= 3)
                    {
                        dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvReport.Columns[i].Width = 80;
                    }
                    if (i < 4)
                    {
                        dgvReport.Columns[i].Frozen = true;
                    }
                }
            }
            catch
            {
                MessageBox.Show("统计发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetControlEnable(true);
            }
        }
        public async Task <OperationStatus> RunReport(string reportRequestIdString,
                                                      CancellationToken token,
                                                      IProgress <OperationStatus> progress = null)
        {
            if (HasPermission(Permission.ViewAllReporting))
            {
                BaseReport    report   = null;
                ReportRequest _request = null;

                int reportRequestId = 0;
                if (!int.TryParse(reportRequestIdString, out reportRequestId))
                {
                    _logger.LogError($"Couldn't covert report request id {reportRequestIdString} to a number.");
                    return(new OperationStatus
                    {
                        PercentComplete = 100,
                        Status = $"Could not find report request {reportRequestIdString}.",
                        Error = true,
                        Complete = false
                    });
                }

                token.Register(() =>
                {
                    string duration = "";
                    if (report != null && report.Elapsed != null)
                    {
                        duration = $" after {((TimeSpan)report.Elapsed).TotalSeconds.ToString("N2")} seconds";
                    }
                    if (_request != null)
                    {
                        _logger.LogWarning($"Report {reportRequestId} for user {_request.CreatedBy} was cancelled{duration}.");
                    }
                    else
                    {
                        _logger.LogWarning($"Report {reportRequestId} was cancelled{duration}.");
                    }
                });

                try
                {
                    _request = await _reportRequestRepository.GetByIdAsync(reportRequestId)
                               ?? throw new GraException($"Cannot find report request id {reportRequestId}");
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Could not find report request {reportRequestId}: {ex.Message}");
                    return(new OperationStatus
                    {
                        PercentComplete = 0,
                        Status = "Could not find the report request.",
                        Error = true
                    });
                }

                var reportDetails = new Catalog().Get()
                                    .Where(_ => _.Id == _request.ReportId)
                                    .SingleOrDefault();

                if (reportDetails == null)
                {
                    _logger.LogError($"Cannot find report id {_request.ReportId} requested by request {reportRequestId}");
                    return(new OperationStatus
                    {
                        PercentComplete = 0,
                        Status = "Could not find the requested report.",
                        Error = true
                    });
                }

                try
                {
                    report = _serviceProvider.GetService(reportDetails.ReportType) as BaseReport;
                }
                catch (Exception ex)
                {
                    _logger.LogCritical($"Couldn't instantiate report: {ex.Message}");
                    return(new OperationStatus
                    {
                        PercentComplete = 100,
                        Status = "Unable to run report.",
                        Error = true
                    });
                }

                try
                {
                    await report.ExecuteAsync(_request, token, progress);
                }
                catch (Exception ex)
                {
                    return(new OperationStatus
                    {
                        PercentComplete = 100,
                        Status = $"A software error occurred: {ex.Message}.",
                        Error = true
                    });
                }

                if (!token.IsCancellationRequested)
                {
                    return(new OperationStatus
                    {
                        PercentComplete = 100,
                        Status = "Report processing complete.",
                    });
                }
                else
                {
                    return(new OperationStatus
                    {
                        PercentComplete = 100,
                    });
                }
            }
            else
            {
                var requestingUser = GetClaimId(ClaimType.UserId);
                _logger.LogError($"User {requestingUser} doesn't have permission to view all reporting.");
                return(new OperationStatus
                {
                    PercentComplete = 0,
                    Status = "Permission denied.",
                    Error = true
                });
            }
        }
Beispiel #13
0
 public LabelItem(BaseReport rp)
     : base(rp)
 {
     FAllStrings = new Strings();
 }
Beispiel #14
0
 public VariableGraph(Evaluator eval, BaseReport rp)
     : base(eval)
 {
     Report = rp;
 }
Beispiel #15
0
        private void LoadReportHeader(/*CompanyOperator Operator*/)
        {
            string rid = Request.QueryString["id"];

            if (this.Session["ReportID"] != null)
            {
                ird = this.Session["ReportID"].ToString();
            }
            if (ird == null || ird.Trim() == "")
            {
                ird = "1";                                 // return;
            }
            if (!this.IsPostBack || rid != ird)
            {
                list   = new List <FiledItem>();
                report = new BaseReport(Convert.ToInt32(rid));
                this.Session["ReportID"] = rid;

                bool isHaveCompany = false;
                bool isHaveOper    = false;

                foreach (DefineSqlParameter par in report.DataSource.DbParameterCollection)
                {
                    if (!par.ParameterName.StartsWith("_"))
                    {
                        //创建输入
                        FiledItem item = new FiledItem(par);
                        list.Add(item);
                    }
                    else
                    {
                        switch (par.ParameterName)
                        {
                        case "_CompanyID":
                            par.Value = "";    // loginOperator == null ? "" : loginOperator.CompanyID;
                            break;

                        case "_OperatorID":
                            par.Value = "";    // loginOperator == null ? "" : loginOperator.OperID;
                            break;

                        default:
                            par.Value = string.Empty;
                            break;
                        }
                    }

                    if (par.ParameterName == "_CompanyID")
                    {
                        isHaveCompany = true;
                    }
                    if (par.ParameterName == "_OperatorID")
                    {
                        isHaveOper = true;
                    }
                }


                if (!isHaveCompany)
                {
                    DefineSqlParameter parCompanyId = new DefineSqlParameter("_CompanyID", SqlDbType.VarChar, 50, "");
                    parCompanyId.Value = "";// Operator.CompanyID;
                    report.DataSource.DbParameterCollection.Add(parCompanyId);
                }
                if (!isHaveOper)
                {
                    DefineSqlParameter parOperatorId = new DefineSqlParameter("_OperatorID", SqlDbType.VarChar, 50, "");
                    parOperatorId.Value = "";// Operator.OperID;
                    report.DataSource.DbParameterCollection.Add(parOperatorId);
                }


                this.Session["Rlist"] = list;
                this.Session.Add("Report", report);
            }
            else
            {
                list   = (List <FiledItem>) this.Session["Rlist"];
                report = (BaseReport)this.Session["Report"];
            }
            if (list == null)
            {
                return;
            }

            LoadCondition(list);
            btnQuery_Click(null, null);
        }