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; } }
/// <summary> /// 获取统计起止时间 /// </summary> /// <param name="DateType">时间类型</param> /// <param name="StatDay">统计日</param> /// <param name="InBeginDate">开始时间</param> /// <param name="InEndDate">结束时间</param> /// <param name="OutBeginDate">返回的实际开始时间</param> /// <param name="OutEndDate">返回的实际结束时间</param> public static void GetReportBeginDateAndEndDate(StatDateType DateType, int StatDay, DateTime InBeginDate, DateTime InEndDate, out DateTime OutBeginDate, out DateTime OutEndDate, out string AccountIdList) { string dateBegin = InBeginDate.ToString("yyyy-MM-dd") + " 00:00:00"; string dateEnd = InEndDate.ToString("yyyy-MM-dd") + " 23:59:59"; AccountIdList = null; OutBeginDate = Convert.ToDateTime(dateBegin); OutEndDate = Convert.ToDateTime(dateEnd); }
/// <summary> /// 获取统计起止时间 /// </summary> /// <param name="DateType">时间类型</param> /// <param name="StatDay">统计日</param> /// <param name="InBeginDate">开始时间</param> /// <param name="InEndDate">结束时间</param> /// <param name="OutBeginDate">返回的实际开始时间</param> /// <param name="OutEndDate">返回的实际结束时间</param> public static void GetReportBeginDateAndEndDate(StatDateType DateType, int StatDay, DateTime InBeginDate, DateTime InEndDate, out DateTime OutBeginDate, out DateTime OutEndDate, out string AccountIdList) { string dateBegin = InBeginDate.ToString("yyyy-MM-dd") + " 00:00:00"; string dateEnd = InEndDate.ToString("yyyy-MM-dd") + " 23:59:59"; AccountIdList = null; if (DateType == StatDateType.交账时间) { string sql = @"select accountid from mz_account where accountdate between '" + InBeginDate.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + InEndDate.ToString("yyyy-MM-dd HH:mm:ss") + "' and workid= " + HIS.SYSTEM.Core.EntityConfig.WorkID.ToString( ); DataTable tb = oleDb.GetDataTable(sql); if (tb.Rows.Count > 0) { string accountid = ""; for (int i = 0; i < tb.Rows.Count - 1; i++) { accountid += tb.Rows[i]["accountid"].ToString() + ","; } accountid += tb.Rows[tb.Rows.Count - 1]["accountid"].ToString( ); AccountIdList = accountid; sql = @"select min(costdate) as d1,max(costdate) as d2 from mz_costmaster where accountid<>0 and accountid in (" + accountid + ") and workid=" + HIS.SYSTEM.Core.EntityConfig.WorkID.ToString( ); DataRow dr = oleDb.GetDataRow(sql); OutBeginDate = Convert.IsDBNull(dr["d1"]) ? Convert.ToDateTime("1900-01-01 00:00:00") : Convert.ToDateTime(dr["d1"]); OutEndDate = Convert.IsDBNull(dr["d2"]) ? Convert.ToDateTime("1900-01-01 00:00:00") : Convert.ToDateTime(dr["d2"]); } else { throw new OperatorException("指定的时间内没有交款记录"); //OutBeginDate = Convert.ToDateTime( "1900-01-01 00:00:00" ); //OutEndDate = Convert.ToDateTime( "1900-01-01 00:00:00" ); } return; } if (DateType == StatDateType.统计日) { OutBeginDate = Convert.ToDateTime(InBeginDate.Year.ToString( ) + "-" + InBeginDate.Month + "-" + (StatDay + 1).ToString( ) + " 00:00:00"); OutEndDate = Convert.ToDateTime(InEndDate.Year.ToString( ) + "-" + InEndDate.Month + "-" + StatDay.ToString( ) + " 23:59:59"); return; } if (DateType == StatDateType.自然时间) { OutBeginDate = Convert.ToDateTime(dateBegin); OutEndDate = Convert.ToDateTime(dateEnd); } OutBeginDate = InBeginDate; OutEndDate = InEndDate; }
private void cboDateType_SelectedIndexChanged(object sender, EventArgs e) { StatDateType dateType = StatDateType.统计日; foreach (object obj in Enum.GetValues(typeof(StatDateType))) { if (obj.ToString( ) == cboDateType.Text) { dateType = (StatDateType)obj; break; } } switch (dateType) { case StatDateType.交账时间: panel1.Enabled = false; panel2.Enabled = true; break; case StatDateType.统计日: panel1.Enabled = false; panel2.Enabled = true; break; case StatDateType.自然时间: panel1.Enabled = false; panel2.Enabled = true; break; case StatDateType.自定义时间: panel1.Enabled = true; panel2.Enabled = false; break; } }
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) { 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); } }
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; } }
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); } }