Exemple #1
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            try
            {
                btnStat.Enabled  = false;
                btnPrint.Enabled = false;
                btnClose.Enabled = false;
                Cursor           = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor( );
                StatDateType dateType = StatDateType.统计日;
                foreach (object obj in Enum.GetValues(typeof(StatDateType)))
                {
                    if (obj.ToString( ) == cboDateType.Text)
                    {
                        dateType = (StatDateType)obj;
                        break;
                    }
                }

                DateTime dateBegin;
                DateTime dateEnd;
                short    month = Convert.ToInt16(cboMonth.Text);
                GetStatDate(dateType, month, out dateBegin, out dateEnd);
                StatType statType = StatType.门诊发票分类;
                foreach (object obj in Enum.GetValues(typeof(StatType)))
                {
                    if (obj.ToString( ) == cboStatType.Text)
                    {
                        statType = (StatType)obj;
                        break;
                    }
                }
                int showtype = cboType.SelectedIndex;

                lblDate.Text = "当前统计时间范围:" + dateBegin.ToString("yyyy-MM-dd HH:mm:ss") + " — " + dateEnd.ToString("yyyy-MM-dd HH:mm:ss");
                int       fixcol;
                DataTable tbData = ReportClass.GetDeptDocIncomeData(statType, dateBegin, dateEnd, showtype, out fixcol);

                dgvReport.Columns.Clear( );
                dgvReport.DataSource = tbData;
                for (int i = 0; i < fixcol; i++)
                {
                    dgvReport.Columns[i].Frozen = true;
                }
                for (int i = fixcol - 1; i < dgvReport.Columns.Count; i++)
                {
                    dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("统计报表时发生错误!请重试", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                btnStat.Enabled  = true;
                btnPrint.Enabled = true;
                btnClose.Enabled = true;
                Cursor           = Cursors.Default;
            }
        }