示例#1
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            DateTime      beginDate;
            DateTime      endDate;
            BaseReport    report = null;
            string        accountIdList;
            StatDateType  dateType       = StatDateType.自然时间;
            StatClassType statType       = StatClassType.门诊发票分类;
            StatObjctType statObjectType = StatObjctType.医生;
            ReportStyle   style          = ReportStyle.科目为标题列;

            #region 统计条件
            foreach (object obj in Enum.GetValues(typeof(StatClassType)))
            {
                if (obj.ToString( ) == cboStatType.Text)
                {
                    statType = (StatClassType)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, 0, 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);

                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;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetButtonEnable(true);
                Cursor = Cursors.Default;
            }
        }
        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;
            }
        }