/// <summary> /// Gọi form hiển thị báo cáo chi tiết /// </summary> private void ViewReport() { // frmBusyBar frmbusy = new frmBusyBar(); // frmbusy.Show(); if (lstDetailReport.SelectedIndex < 0) { string str = WorkingContext.LangManager.GetString("frmListReport_btnView_thongBao"); string str1 = WorkingContext.LangManager.GetString("frmListReport_btnView_thongBao_Title"); //MessageBox.Show("Bạn phải chọn một loại báo cáo chi tiết!", "Xem báo cáo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { switch (lstGroupReport.SelectedIndex) { case 0:// báo cáo nhân sự switch (lstDetailReport.SelectedIndex) { case 2: if (!CheckValidDate(dtpFromDate.Value, dtpToDate.Value)) { string str2 = WorkingContext.LangManager.GetString("Bosung1"); string str3 = WorkingContext.LangManager.GetString("frmShift_Update_Title1"); //MessageBox.Show("Ngày chọn không hợp lệ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); MessageBox.Show(str2, str3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case 5: if (!CheckValidDate(dtpFromDate.Value, dtpToDate.Value)) { string str2 = WorkingContext.LangManager.GetString("Bosung1"); string str3 = WorkingContext.LangManager.GetString("frmShift_Update_Title1"); //MessageBox.Show("Ngày chọn không hợp lệ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); MessageBox.Show(str2, str3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; } break; case 1:// báo cáo chấm công switch (lstDetailReport.SelectedIndex) { case 0: if (!CheckValidDate(dtpFromDate.Value, dtpToDate.Value)) { string str2 = WorkingContext.LangManager.GetString("Bosung1"); string str3 = WorkingContext.LangManager.GetString("frmShift_Update_Title1"); //MessageBox.Show("Ngày chọn không hợp lệ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); MessageBox.Show(str2, str3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case 5: if (!CheckValidDate(dtpFromDate.Value, dtpToDate.Value)) { string str4 = WorkingContext.LangManager.GetString("Bosung1"); string str5 = WorkingContext.LangManager.GetString("frmShift_Update_Title1"); //MessageBox.Show("Ngày chọn không hợp lệ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); MessageBox.Show(str4, str5, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; case 6: if (cboDepartment.SelectedIndex == 0) { string str6 = WorkingContext.LangManager.GetString("Bosung2"); string str7 = WorkingContext.LangManager.GetString("frmShift_Update_Title1"); //MessageBox.Show("Ngày chọn không hợp lệ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); MessageBox.Show(str6, str7, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; } break; case 3:// báo cáo thưởng phạt switch (lstDetailReport.SelectedIndex) { case 0: if (!CheckValidDate(dtpFromDate.Value, dtpToDate.Value)) { string str2 = WorkingContext.LangManager.GetString("Bosung1"); string str3 = WorkingContext.LangManager.GetString("frmShift_Update_Title1"); //MessageBox.Show("Ngày chọn không hợp lệ","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); MessageBox.Show(str2, str3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } break; } break; } } ReportDocument rptDocument = new ReportDocument(); PleaseWait.ShowProcess(); if (this.Text == "Danh sách báo cáo") { rptDocument = SetReport(); } else { rptDocument = SetReport_JP(); } PleaseWait.CloseProcess(); frmReportPreview frm = new frmReportPreview(); frm.SetReportDocument = rptDocument; frm.ReportName = reportName; frm.ReportDate = reportDate; frm.Show(); // frmbusy.CloseBusyBar(); // frmbusy.Close(); }
public void ViewEmpInsurance(int departmentID) { //ReportDocument rptDoc = new ReportDocument(); ReportDocument rptDoc = null; PleaseWait.ShowProcess(); ParameterValues pvUserName = new ParameterValues(); ParameterDiscreteValue pdvUserName = new ParameterDiscreteValue(); ParameterValues pvDepartmentID = new ParameterValues(); ParameterDiscreteValue pdvDepartmentID = new ParameterDiscreteValue(); pdvDepartmentID.Value = departmentID; pdvUserName.Value = WorkingContext.Username; pvUserName.Add(pdvUserName); try { // Load the report //rptDoc.Load(@"Reports/BHXH/InsuranceSDH02.rpt"); rptDoc = new Reports.BHXH.InsuranceSDH02(); pvDepartmentID.Add(pdvDepartmentID); rptDoc.DataDefinition.ParameterFields["@DepartmentID"].ApplyCurrentValues(pvDepartmentID); rptDoc.DataDefinition.ParameterFields["@UserName"].ApplyCurrentValues(pvUserName); reportName = "InsuranceSDH02"; } catch (LoadSaveReportException Exp) { //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo."); string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1"); string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2"); //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo."); MessageBox.Show(str, str1); } catch (Exception Exp) { //MessageBox.Show(Exp.Message, "Có lỗi xảy ra"); string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3"); //MessageBox.Show(Exp.Message, "Có lỗi xảy ra"); MessageBox.Show(Exp.Message, str2); } if (rptDoc != null) { SetDBLogonForReport(rptDoc); } PleaseWait.CloseProcess(); frmReportPreview frm = new frmReportPreview(); frm.SetReportDocument = rptDoc; frm.Show(); }
private void btnHelp_Click(object sender, EventArgs e) { settings = ModuleConfig.GetSettings(); //string reportPart = settings.ReportPath; OpenFileDialog ofd = new OpenFileDialog(); //ofd.Filter = "All File|*.*|CrystalReports|*.rpt"; ofd.InitialDirectory = WorkingContext.Setting.ReportPath; ofd.FilterIndex = 1; string ReportFilePath = ""; if (ofd.ShowDialog() == DialogResult.OK) { ReportFilePath = ofd.FileName; ReportFileName = Path.GetFileName(ReportFilePath); #region ShowReport ReportDocument rptDoc = new ReportDocument(); PleaseWait.ShowProcess(); try { // Load the report //rptDoc.Load(@"Reports/BHXH/InsuranceSDH02.rpt"); rptDoc.Load(ReportFilePath); } catch (LoadSaveReportException Exp) { //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo."); string str = WorkingContext.LangManager.GetString("frmListReport_Error_Messa1"); string str1 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa2"); //MessageBox.Show("Không tìm thấy đường dẫn của file báo cáo..", "Lỗi đọc file báo cáo."); MessageBox.Show(str, str1); } catch (Exception Exp) { //MessageBox.Show(Exp.Message, "Có lỗi xảy ra"); string str2 = WorkingContext.LangManager.GetString("frmListReport_Error_Messa3"); //MessageBox.Show(Exp.Message, "Có lỗi xảy ra"); MessageBox.Show(Exp.Message, str2); } if (rptDoc != null) { SetDBLogonForReport(rptDoc); } PleaseWait.CloseProcess(); frmReportPreview frm = new frmReportPreview(); frm.ExportReport = false; frm.SetReportDocument = rptDoc; frm.Show(); } #endregion }
private void btnToReport_Click(object sender, System.EventArgs e) { // frmReportPreview frm = new frmReportPreview(); // frm.crvDetail = ReportDocument rptDocument = new ReportDocument(); if (this.Text== "Quản lý bảo hiểm xã hội") { rptDocument = SetReport(); } else { rptDocument = SetReport_JP(); } frmReportPreview frm = new frmReportPreview(); frm.SetReportDocument = rptDocument; frm.Show(); }