コード例 #1
0
        private void OnView()
        {
            Result result = ReportBus.GetTonKhoCapCuu(_tuNgay, _denNgay, _maCapCuus);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    tabReport.SelectedTabIndex = 1;
                    dgCapCuuTonKho.DataSource  = result.QueryResult;
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetTonKhoCapCuu"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetTonKhoCapCuu"));
            }
        }
コード例 #2
0
        private void OnView()
        {
            Result result = ReportBus.GetCapCuuHetHanList(_soNgayHetHan, _capCuuKeyList);

            if (result.IsOK)
            {
                ReportDataSource reportDataSource = new ReportDataSource("CapCuuResult",
                                                                         (List <CapCuuResult>)result.QueryResult);

                MethodInvoker method = delegate
                {
                    tabReport.SelectedTabIndex = 1;
                    _ucReportViewer.ViewReport("MM.Templates.rptCapCuuHetHan.rdlc", reportDataSource);
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetCapCuuHetHanList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetCapCuuHetHanList"));
            }
        }
コード例 #3
0
ファイル: uThongKeHoaDon.cs プロジェクト: itcthienkhiem/LIS
        private void OnDisplayInvoiceList()
        {
            Result result = ReportBus.GetTatCaHoaDon(_isFromDateToDate, _fromDate, _toDate, _tenBenhNhan, _type);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    dgInvoice.DataSource = result.QueryResult;
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetTatCaHoaDon"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetTatCaHoaDon"));
            }
        }
コード例 #4
0
        private void OnView()
        {
            DateTime tuNgay  = new DateTime(dtpkTuNgay.Value.Year, dtpkTuNgay.Value.Month, dtpkTuNgay.Value.Day, 0, 0, 0);
            DateTime denNgay = new DateTime(dtpkDenNgay.Value.Year, dtpkDenNgay.Value.Month, dtpkDenNgay.Value.Day, 23, 59, 59);

            string thuocGUID = string.Empty;

            if (txtThuoc.Text.Trim() != string.Empty)
            {
                thuocGUID = txtThuoc.Tag.ToString();
            }

            ClearData();

            Result result = ReportBus.GetDanhSachKhachHangMuaThuoc(tuNgay, denNgay, thuocGUID);

            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                dgDSKhachHang.DataSource = dt;

                int count = 0;
                foreach (DataRow row in dt.Rows)
                {
                    count += Convert.ToInt32(row["SoLuong"]);
                }

                lbCount.Text = string.Format("Tổng số thuốc bán: {0}", count);
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetDanhSachKhachHangMuaThuoc"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetDanhSachKhachHangMuaThuoc"));
            }
        }
コード例 #5
0
        private void OnExportToExcel()
        {
            Cursor.Current = Cursors.WaitCursor;
            if (_uThuocList.CheckedRows == null || _uThuocList.CheckedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn ít nhất 1 thuốc để xuất excel.", IconType.Information);
                return;
            }

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title  = "Export Excel";
            dlg.Filter = "Excel Files(*.xls,*.xlsx)|*.xls;*.xlsx";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _thuocKeyList.Clear();
                foreach (DataRow row in _uThuocList.CheckedRows)
                {
                    _thuocKeyList.Add(row["ThuocGUID"].ToString());
                }

                Result result = ReportBus.GetThuocTonKhoList(_thuocKeyList);
                if (result.IsOK)
                {
                    List <ThuocResult> thuocList = (List <ThuocResult>)result.QueryResult;
                    ExportExcel.ExportThuocTonKhoToExcel(dlg.FileName, thuocList);
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetThuocTonKhoList"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetThuocTonKhoList"));
                }
            }
        }
コード例 #6
0
        private void OnViewData()
        {
            Cursor.Current = Cursors.WaitCursor;
            if (dtpkFromDate.Value > dtpkToDate.Value)
            {
                MsgBox.Show(Application.ProductName, "Từ ngày phải nhỏ hơn hoặc bằng đến ngày.", IconType.Information);
                dtpkFromDate.Focus();
                return;
            }

            DateTime fromDate  = new DateTime(dtpkFromDate.Value.Year, dtpkFromDate.Value.Month, dtpkFromDate.Value.Day, 0, 0, 0);
            DateTime toDate    = new DateTime(dtpkToDate.Value.Year, dtpkToDate.Value.Month, dtpkToDate.Value.Day, 23, 59, 59);
            bool     isDenKham = raDenKham.Checked;
            int      type      = chkMaBenhNhan.Checked ? 1 : 0;

            ClearData();

            Result result = ReportBus.GetDanhSachBenhNhanKhamBenh(fromDate, toDate, txtMaBenhNhan.Text.Trim(), isDenKham, type);

            if (result.IsOK)
            {
                DataTable dt = result.QueryResult as DataTable;
                dgBenhNhan.DataSource = dt;
                lbKetQua.Text         = string.Format("kết quả được tìm thấy: {0}", dt.Rows.Count);
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetDanhSachBenhNhanKhamBenh"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetDanhSachBenhNhanKhamBenh"));
            }
        }
コード例 #7
0
        private void OnExportToExcel()
        {
            Cursor.Current = Cursors.WaitCursor;
            if (_uKhoCapCuu.CheckedRows == null || _uKhoCapCuu.CheckedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn ít nhất 1 thông tin cấp cứu để xem báo cáo.", IconType.Information);
                return;
            }

            if (dtpkDenNgay.Value < dtpkTuNgay.Value)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng nhập từ ngày nhỏ hơn hoặc bằng đến ngày.", IconType.Information);
                dtpkTuNgay.Focus();
                return;
            }

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title  = "Export Excel";
            dlg.Filter = "Excel Files(*.xls,*.xlsx)|*.xls;*.xlsx";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _maCapCuus = string.Empty;
                foreach (DataRow row in _uKhoCapCuu.CheckedRows)
                {
                    _maCapCuus += string.Format("{0},", row["MaCapCuu"].ToString());
                }

                _maCapCuus = _maCapCuus.Substring(0, _maCapCuus.Length - 1);

                _tuNgay  = new DateTime(dtpkTuNgay.Value.Year, dtpkTuNgay.Value.Month, dtpkTuNgay.Value.Day, 0, 0, 0);
                _denNgay = new DateTime(dtpkDenNgay.Value.Year, dtpkDenNgay.Value.Month, dtpkDenNgay.Value.Day, 23, 59, 59);

                Result result = ReportBus.GetTonKhoCapCuu(_tuNgay, _denNgay, _maCapCuus);
                if (result.IsOK)
                {
                    List <spCapCuuTonKhoResult> capCuuTonKhoList = (List <spCapCuuTonKhoResult>)result.QueryResult;
                    ExportExcel.ExportCapCuuTonKhoToExcel(dlg.FileName, capCuuTonKhoList, _tuNgay, _denNgay);
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetTonKhoCapCuu"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetTonKhoCapCuu"));
                }
            }
        }
コード例 #8
0
        private void OnView()
        {
            Result result = ReportBus.GetDichVuHopDong(_contractGUID, _tuNgay, _denNgay, _type);

            if (result.IsOK)
            {
                _results = (List <spDichVuHopDongResult>)result.QueryResult;

                ReportDataSource reportDataSource = new ReportDataSource("spDichVuHopDongResult", _results);

                MethodInvoker method = delegate
                {
                    if (_results == null || _results.Count <= 0)
                    {
                        txtKetQua.Text = "0";
                    }
                    else
                    {
                        txtKetQua.Text = _results.Count.ToString();
                    }

                    _ucReportViewer.ViewReport("MM.Templates.rptDichVuHopDong.rdlc", reportDataSource);
                    btnExportExcel.Enabled = AllowExport && _results.Count > 0;
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetDichVuHopDong"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetDichVuHopDong"));
            }
        }
コード例 #9
0
        private void OnView()
        {
            Result result = null;

            if (_isTongHop)
            {
                result = ReportBus.GetDoanhThuNhanVienTongHop(_fromDate, _toDate, _docStaffGUID, _type);
                if (result.IsOK)
                {
                    ReportDataSource reportDataSource = new ReportDataSource("spDoanhThuNhanVienTongHopResult",
                                                                             (List <spDoanhThuNhanVienTongHopResult>)result.QueryResult);

                    MethodInvoker method = delegate
                    {
                        if (result == null || result.QueryResult == null)
                        {
                            txtKetQua.Text = "0";
                        }
                        else
                        {
                            txtKetQua.Text = ((List <spDoanhThuNhanVienTongHopResult>)result.QueryResult).Count.ToString();
                        }

                        _ucReportViewer.ViewReport("MM.Templates.rptDoanhThuNhanVienTongHop.rdlc", reportDataSource);
                    };

                    if (InvokeRequired)
                    {
                        BeginInvoke(method);
                    }
                    else
                    {
                        method.Invoke();
                    }
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetDoanhThuNhanVienTongHop"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetDoanhThuNhanVienTongHop"));
                }
            }
            else
            {
                result = ReportBus.GetDoanhThuNhanVienChiTiet(_fromDate, _toDate, _docStaffGUID, _type);
                if (result.IsOK)
                {
                    ReportDataSource reportDataSource = new ReportDataSource("spDoanhThuNhanVienChiTietResult",
                                                                             (List <spDoanhThuNhanVienChiTietResult>)result.QueryResult);

                    MethodInvoker method = delegate
                    {
                        if (result == null || result.QueryResult == null)
                        {
                            txtKetQua.Text = "0";
                        }
                        else
                        {
                            List <spDoanhThuNhanVienChiTietResult> doanhThuChiTietList = (List <spDoanhThuNhanVienChiTietResult>)result.QueryResult;
                            int    count    = 0;
                            string fullName = string.Empty;
                            foreach (var doanhThu in doanhThuChiTietList)
                            {
                                if (fullName.ToLower() != doanhThu.FullName.ToLower())
                                {
                                    count++;
                                    fullName = doanhThu.FullName;
                                }
                            }

                            txtKetQua.Text = count.ToString();
                        }

                        _ucReportViewer.ViewReport("MM.Templates.rptDoanhThuNhanVienChiTiet.rdlc", reportDataSource);
                    };

                    if (InvokeRequired)
                    {
                        BeginInvoke(method);
                    }
                    else
                    {
                        method.Invoke();
                    }
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetDoanhThuNhanVienChiTiet"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetDoanhThuNhanVienChiTiet"));
                }
            }
        }
コード例 #10
0
ファイル: uPatient.cs プロジェクト: itcthienkhiem/LIS
        private bool OnTaoHoSo(DataRow row)
        {
            string patientGUID = row["PatientGUID"].ToString();

            Result result = ReportBus.GetNgayKhamCuoiCung(patientGUID);

            if (!result.IsOK)
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetNgayKhamCuoiCung"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetNgayKhamCuoiCung"));
                return(false);
            }

            List <DateTime> ngayKhamCuoiCungList = (List <DateTime>)result.QueryResult;

            string maBenhNhan  = row["FileNum"].ToString();
            string tenBenhNhan = Utility.ConvertToUnSign(row["FullName"].ToString());
            string path        = string.Format("{0}\\{1}@{2}", Global.HoSoPath, maBenhNhan, tenBenhNhan);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string ketQuaKhamTongQuatFileName = string.Format("{0}\\Temp\\KetQuaKhamSucKhoeTongQuat.xls", Application.StartupPath);//string.Format("{0}\\KetQuaKhamSucKhoeTongQuat_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));

            if (!Exports.ExportExcel.ExportKetQuaKhamTongQuatToExcel(ketQuaKhamTongQuatFileName, row, ngayKhamCuoiCungList))
            {
                return(false);
            }

            string pdfFileName = string.Format("{0}\\KetQuaKhamSucKhoeTongQuat_{1}.pdf", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));

            if (!Exports.ConvertExcelToPDF.Convert(ketQuaKhamTongQuatFileName, pdfFileName, Utility.GetPageSetup(Const.KhamSucKhoeTongQuatTemplate)))
            {
                return(false);
            }

            //Kết quả nội soi
            if (ngayKhamCuoiCungList[5] != Global.MinDateTime)
            {
                DateTime fromDate = new DateTime(ngayKhamCuoiCungList[5].Year, ngayKhamCuoiCungList[5].Month, ngayKhamCuoiCungList[5].Day, 0, 0, 0);
                DateTime toDate   = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59);

                result = KetQuaNoiSoiBus.GetKetQuaNoiSoiList2(patientGUID, fromDate, toDate);
                if (!result.IsOK)
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaNoiSoiBus.GetKetQuaNoiSoiList2"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaNoiSoiBus.GetKetQuaNoiSoiList2"));
                    return(false);
                }

                DataTable dt = result.QueryResult as DataTable;
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        LoaiNoiSoi loaiNoiSoi           = (LoaiNoiSoi)Convert.ToInt32(dr["LoaiNoiSoi"]);
                        string     ketQuaNoiSoiFileName = string.Format("{0}\\Temp\\KetQuaNoiSoi.xls", Application.StartupPath);
                        //string.Format("{0}\\KetQuaNoiSoi_{1}_{2}.xls", path, loaiNoiSoi.ToString(), DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        PageSetup p = null;

                        switch (loaiNoiSoi)
                        {
                        case LoaiNoiSoi.Tai:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiTaiToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiTaiTemplate);
                            break;

                        case LoaiNoiSoi.Mui:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiMuiToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiMuiTemplate);
                            break;

                        case LoaiNoiSoi.Hong_ThanhQuan:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiHongThanhQuanToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiHongThanhQuanTemplate);
                            break;

                        case LoaiNoiSoi.TaiMuiHong:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiTaiMuiHongToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiTaiMuiHongTemplate);
                            break;

                        case LoaiNoiSoi.TongQuat:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiTongQuatToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiTongQuatTemplate);
                            break;
                        }

                        pdfFileName = string.Format("{0}\\KetQuaNoiSoi_{1}_{2}.xls", path, loaiNoiSoi.ToString(), DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        if (!Exports.ConvertExcelToPDF.Convert(ketQuaNoiSoiFileName, pdfFileName, p))
                        {
                            return(false);
                        }
                    }
                }
            }

            //Kết quả soi CTC
            if (ngayKhamCuoiCungList[6] != Global.MinDateTime)
            {
                DateTime fromDate = new DateTime(ngayKhamCuoiCungList[6].Year, ngayKhamCuoiCungList[6].Month, ngayKhamCuoiCungList[6].Day, 0, 0, 0);
                DateTime toDate   = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59);

                result = KetQuaSoiCTCBus.GetKetQuaSoiCTCList2(patientGUID, fromDate, toDate);
                if (!result.IsOK)
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList2"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList2"));
                    return(false);
                }

                DataTable dt = result.QueryResult as DataTable;
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string ketQuaSoiCTCFileName = string.Format("{0}\\Temp\\KetQuaSoiCTC.xls", Application.StartupPath);
                        //string.Format("{0}\\KetQuaSoiCTC_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        if (!Exports.ExportExcel.ExportKetQuaSoiCTCToExcel(ketQuaSoiCTCFileName, row, dr))
                        {
                            return(false);
                        }

                        pdfFileName = string.Format("{0}\\KetQuaSoiCTC_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        if (!Exports.ConvertExcelToPDF.Convert(ketQuaSoiCTCFileName, pdfFileName, Utility.GetPageSetup(Const.KetQuaSoiCTCTemplate)))
                        {
                            return(false);
                        }
                    }
                }
            }

            //Kết quả siêu âm
            if (ngayKhamCuoiCungList[7] != Global.MinDateTime)
            {
                DateTime fromDate = new DateTime(ngayKhamCuoiCungList[7].Year, ngayKhamCuoiCungList[7].Month, ngayKhamCuoiCungList[7].Day, 0, 0, 0);
                DateTime toDate   = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59);

                result = SieuAmBus.GetKetQuaSieuAmList2(patientGUID, fromDate, toDate);
                if (!result.IsOK)
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList2"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList2"));
                    return(false);
                }

                DataTable dt = result.QueryResult as DataTable;
                if (dt != null && dt.Rows.Count > 0)
                {
                    MethodInvoker method = delegate
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            string tenSieuAm            = Utility.ConvertToUnSign(dr["TenSieuAm"].ToString());
                            string ketQuaSieuAmFileName = string.Format("{0}\\KetQuaSieuAm_{1}_{2}.pdf", path, tenSieuAm,
                                                                        DateTime.Now.ToString("ddMMyyyyHHmmssms"));

                            _uPrintKetQuaSieuAm.PatientRow = row;
                            _uPrintKetQuaSieuAm.ExportToPDF(dr, ketQuaSieuAmFileName);
                        }
                    };
                    if (InvokeRequired)
                    {
                        BeginInvoke(method);
                    }
                    else
                    {
                        method.Invoke();
                    }
                }
            }

            return(true);
        }
コード例 #11
0
        private void OnExportToExcel()
        {
            Cursor.Current = Cursors.WaitCursor;
            if (_uThuocList.CheckedRows == null || _uThuocList.CheckedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn ít nhất 1 thuốc để xem báo cáo.", IconType.Information);
                return;
            }

            if (dtpkDenNgay.Value < dtpkTuNgay.Value)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng nhập từ ngày nhỏ hơn hoặc bằng đến ngày.", IconType.Information);
                dtpkTuNgay.Focus();
                return;
            }

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title  = "Export Excel";
            dlg.Filter = "Excel Files(*.xls,*.xlsx)|*.xls;*.xlsx";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _maThuocList.Clear();
                _maThuocs = string.Empty;
                _maThuocStrList.Clear();
                foreach (DataRow row in _uThuocList.CheckedRows)
                {
                    _maThuocList.Add(row["MaThuoc"].ToString());
                    string temp = _maThuocs + string.Format("{0},", row["MaThuoc"].ToString());
                    if (temp.Length < 4000)
                    {
                        _maThuocs += string.Format("{0},", row["MaThuoc"].ToString());
                    }
                    else
                    {
                        _maThuocs = _maThuocs.Substring(0, _maThuocs.Length - 1);
                        _maThuocStrList.Add(_maThuocs);
                        _maThuocs = string.Format("{0},", row["MaThuoc"].ToString());
                    }
                }

                if (_maThuocs != string.Empty)
                {
                    _maThuocs = _maThuocs.Substring(0, _maThuocs.Length - 1);
                    _maThuocStrList.Add(_maThuocs);
                }

                _tuNgay  = new DateTime(dtpkTuNgay.Value.Year, dtpkTuNgay.Value.Month, dtpkTuNgay.Value.Day, 0, 0, 0);
                _denNgay = new DateTime(dtpkDenNgay.Value.Year, dtpkDenNgay.Value.Month, dtpkDenNgay.Value.Day, 23, 59, 59);

                Result result = ReportBus.GetThuocTonKhoTheoKhoangThoiGian(_tuNgay, _denNgay, _maThuocStrList);
                if (result.IsOK)
                {
                    List <spThuocTonKhoResult> thuocTonKhoList = (List <spThuocTonKhoResult>)result.QueryResult;
                    ExportExcel.ExportThuocTonKhoTheoKhoangThoiGianToExcel(dlg.FileName, thuocTonKhoList, _tuNgay, _denNgay);
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetThuocTonKhoTheoKhoangThoiGian"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetThuocTonKhoTheoKhoangThoiGian"));
                }
            }
        }