/// <summary> /// hàm thực hiện việc in phiếu báo cáo tổng hợp /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdInPhieuXN_Click(object sender, EventArgs e) { _dtData = SPs.BaocaoThongkeSobenhan(dtFromDate.Value, dtToDate.Value, Utility.Int16Dbnull(cboDoituongKCB.SelectedValue, -1), Utility.sDbnull(cboBenhAn.SelectedValue, "-1"), Utility.sDbnull(cboKhoa.SelectedValue, "KKB"), thamso, -1).GetDataSet(). Tables[0]; Utility.SetDataSourceForDataGridEx(grdList, _dtData, false, true, "1=1", ""); THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_thongke_sobenhan.XML"); if (_dtData.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy dữ liệu báo cáo theo điều kiện bạn chọn", "Thông báo", MessageBoxIcon.Information); return; } Utility.UpdateLogotoDatatable(ref _dtData); reportname = "baocao_thongke_sobenhan"; string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} - Khoa KCB :{3} - Người tiếp đón: {4}", dtFromDate.Text, dtToDate.Text, cboDoituongKCB.SelectedIndex >= 0 ? Utility.sDbnull(cboDoituongKCB.Text) : "Tất cả", cboKhoa.SelectedIndex > 0 ? Utility.sDbnull(cboKhoa.Text) : "Tất cả", cboBenhAn.SelectedValue == "-1" ? "Tất cả" : cboBenhAn.Text); ReportDocument crpt = Utility.GetReport(reportname, ref tieude, ref reportname); if (crpt == null) { return; } string StaffName = globalVariables.gv_strTenNhanvien; if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien)) { StaffName = globalVariables.UserName; } try { var objForm = new frmPrintPreview(tieude, crpt, true, _dtData.Rows.Count <= 0 ? false : true); //try //{ crpt.SetDataSource(_dtData); objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = reportname; crpt.SetParameterValue("StaffName", StaffName); crpt.SetParameterValue("ParentBranchName", globalVariables.ParentBranch_Name); crpt.SetParameterValue("BranchName", globalVariables.Branch_Name); crpt.SetParameterValue("Address", globalVariables.Branch_Address); crpt.SetParameterValue("FromDateToDate", Condition); crpt.SetParameterValue("sTitleReport", tieude); crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value)); crpt.SetParameterValue("BottomCondition", THU_VIEN_CHUNG.BottomCondition()); Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate)); objForm.crptViewer.ReportSource = crpt; objForm.ShowDialog(); } catch (Exception exception) { Utility.ShowMsg("Lỗi:" + exception.Message); } finally { Utility.FreeMemory(crpt); } }