/// <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 = BAOCAO_NGOAITRU.BaocaoTamungHoanung(Utility.Int16Dbnull(txtNhanvien.MyID, -1), chkByDate.Checked?dtFromDate.Value.ToString("dd/MM/yyyy"):"01/01/1900",
                                                          chkByDate.Checked ? dtToDate.Value.ToString("dd/MM/yyyy") : "01/01/1900",
                                                          Utility.Int16Dbnull(cbokhoa.SelectedValue, -1),
                                                          Utility.Int16Dbnull(cboDoituongKCB.SelectedValue, -1),
                                                          Utility.Bool2byte(optHoanung.Checked)
                                                          );

            Utility.SetDataSourceForDataGridEx(grdList, _dtData, false, true, "1=1", "");


            Utility.UpdateLogotoDatatable(ref _dtData);
            THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_tamung.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;
            }
            string Condition = string.Format("Từ ngày {0} đến {1} - Thu ngân viên :{2} ", dtFromDate.Text, dtToDate.Text, txtNhanvien.Text);
            var    crpt      = Utility.GetReport(optTamung.Checked?"baocao_tamung":"baocao_hoanung", ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }

            string StaffName = globalVariables.gv_strTenNhanvien;

            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                StaffName = globalVariables.UserName;
            }
            try
            {
                frmPrintPreview 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     = optTamung.Checked?"baocao_tamung":"baocao_hoanung";
                Utility.SetParameterValue(crpt, "StaffName", StaffName);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address);
                Utility.SetParameterValue(crpt, "Phone", globalVariables.Branch_Phone);
                Utility.SetParameterValue(crpt, "FromDateToDate", Condition);
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "Tongtien_chu", new MoneyByLetter().sMoneyToLetter(_dtData.Compute("SUM(so_tien)", "1=1").ToString()));
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
        }
        /// <summary>
        /// hàm thực hiện việc in phiếu xét nghiêm
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            try
            {
                string nhomdichvu = "-1";
                if (!string.IsNullOrEmpty(cboNhomdichvuCLS.Text) && cboNhomdichvuCLS.CheckedValues != null)
                {
                    var query = (from chk in cboNhomdichvuCLS.CheckedValues.AsEnumerable()
                                 let x = Utility.sDbnull(chk)
                                         select x).ToArray();
                    if (query.Count() > 0)
                    {
                        nhomdichvu = string.Join(",", query);
                    }
                }
                if (chkChitiet.Checked)
                {
                    _reportTable =
                        BAOCAO_NGOAITRU.BaocaoThutientheokhoaChitiet(Utility.sDbnull(cboPhong.SelectedValue, -1),
                                                                     chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                                                                     chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.sDbnull(cboDoituongKCB.SelectedValue, -1), nhomdichvu,
                                                                     Utility.sDbnull(cbonhanvien.SelectedValue, -1), Utility.sDbnull(cbokhoa.SelectedValue, -1));

                    Utility.SetDataSourceForDataGridEx(grdChitiet, _reportTable, false, true, "1=1", "");
                    Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdChitiet.RootTable.Columns["Thanh_Tien"];
                    tong_tien = Utility.Int32Dbnull(grdChitiet.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
                }
                else
                {
                    _reportTable =
                        BAOCAO_NGOAITRU.BaocaoThutientheokhoaTonghop(Utility.sDbnull(cboPhong.SelectedValue, -1),
                                                                     chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                                                                     chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.sDbnull(cboDoituongKCB.SelectedValue, -1), nhomdichvu,
                                                                     Utility.sDbnull(cbonhanvien.SelectedValue, -1), Utility.sDbnull(cbokhoa.SelectedValue, -1));

                    Utility.SetDataSourceForDataGridEx(grdList, _reportTable, false, true, "1=1", "");
                    Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdList.RootTable.Columns["Thanh_Tien"];
                    tong_tien = Utility.Int32Dbnull(grdList.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
                }

                if (_reportTable.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu cho báo cáo", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                string StaffName = globalVariables.gv_strTenNhanvien;
                if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
                {
                    StaffName = globalVariables.UserName;
                }
                string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} - Nhân viên :{3} - Khoa chỉ định :{4} - Phòng thực hiện :{5} - Nhóm dịch vụ: {6}", dtFromDate.Text, dtToDate.Text,
                                                 cboDoituongKCB.SelectedIndex > 0
                                            ? Utility.sDbnull(cboDoituongKCB.Text)
                                            : "Tất cả",
                                                 cbonhanvien.SelectedIndex > 0
                                            ? Utility.sDbnull(cbonhanvien.Text)
                                            : "Tất cả", cbokhoa.SelectedIndex > 0 ? Utility.sDbnull(cbokhoa.Text) : "Tất cả",
                                                 cboPhong.SelectedIndex > 0 ? Utility.sDbnull(cboPhong.Text) : "Tất cả", cboNhomdichvuCLS.CheckedValues != null ? Utility.sDbnull(cboNhomdichvuCLS.Text) : "Tất cả");
                Utility.UpdateLogotoDatatable(ref _reportTable);
                string reportCode = chkChitiet.Checked ? "baocao_thutientheokhoa_chitiet" : "baocao_thutientheokhoa_tonghop";
                var    crpt       = Utility.GetReport(reportCode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }


                frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, _reportTable.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(_reportTable);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportCode;
                Utility.SetParameterValue(crpt, "StaffName", StaffName);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address);
                Utility.SetParameterValue(crpt, "Phone", globalVariables.Branch_Phone);
                Utility.SetParameterValue(crpt, "FromDateToDate", Condition);
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "Tongtien_chu", new MoneyByLetter().sMoneyToLetter(tong_tien.ToString()));
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());

                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi in báo cáo", ex);
            }
        }
        /// <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)
        {
            if (chkTachCDHA.Checked)
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaocaoDoanhthuphongkham(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.sDbnull(cboDoituongKCB.SelectedValue, -1), Utility.sDbnull(cboNhanvien.SelectedValue, -1), Utility.ByteDbnull(cboLoaidichvu.SelectedValue, 2), Utility.sDbnull(cboKhoa.SelectedValue, -1));

                Utility.SetDataSourceForDataGridEx(grdChitiet, _dtData, false, true, "1=1", "");
                Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdChitiet.RootTable.Columns["TONGCONG"];
                tong_tien = Utility.Int32Dbnull(grdChitiet.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
            }
            else
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaocaoDoanhthuphongkhamTonghop(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.sDbnull(cboDoituongKCB.SelectedValue, -1), Utility.sDbnull(cboNhanvien.SelectedValue, -1), Utility.ByteDbnull(cboLoaidichvu.SelectedValue, -1), Utility.sDbnull(cboKhoa.SelectedValue, -1));

                Utility.SetDataSourceForDataGridEx(grdList, _dtData, false, true, "1=1", "");
                Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdList.RootTable.Columns["TONGCONG"];
                tong_tien = Utility.Int32Dbnull(grdList.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
            }

            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);


            string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} - Nhân viên :{3}", dtFromDate.Text, dtToDate.Text,
                                             cboDoituongKCB.SelectedIndex >= 0
                                              ? Utility.sDbnull(cboDoituongKCB.Text)
                                              : "Tất cả",
                                             cboNhanvien.SelectedIndex > 0
                                              ? Utility.sDbnull(cboNhanvien.Text)
                                              : "Tất cả");
            string reportcode = chkTachCDHA.Checked ? "baocao_doanhthuphongkham_chitiet" : "baocao_doanhthuphongkham_tonghop";
            var    crpt       = Utility.GetReport(reportcode, ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }

            string StaffName = globalVariables.gv_strTenNhanvien;

            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                StaffName = globalVariables.UserName;
            }
            try
            {
                frmPrintPreview 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     = reportcode;
                crpt.SetParameterValue("StaffName", StaffName);
                crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                crpt.SetParameterValue("Address", globalVariables.Branch_Address);
                crpt.SetParameterValue("Phone", globalVariables.Branch_Phone);
                crpt.SetParameterValue("FromDateToDate", Condition);
                crpt.SetParameterValue("sTitleReport", tieude);
                crpt.SetParameterValue("sMoneybyLetter", new MoneyByLetter().sMoneyToLetter(tong_tien.ToString()));
                crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                crpt.SetParameterValue("BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
            }
        }
Пример #4
0
        private void cmdInPhieuXN_Click(object sender, EventArgs e)
        {
            _dtData = new DataTable();
            if (chkChitiet.Checked)
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaoCaoThongkeTheoMaBenhICD10ChiTiet(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.sDbnull(cboDoituongKCB.SelectedValue, ""), Utility.sDbnull(cboKhoa.SelectedValue, ""),
                        Utility.sDbnull(txtListICD.Text, ""));
                THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_thongketheomabenh_icd10_chitiet.xml");
                Utility.SetDataSourceForDataGridEx(grdChitiet, _dtData, false, true, "1=1", "");
            }
            else
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaoCaoThongkeTheoMaBenhICD10TongHop(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.sDbnull(cboDoituongKCB.SelectedValue, ""), Utility.sDbnull(cboKhoa.SelectedValue, ""),
                        Utility.sDbnull(txtListICD.Text, ""));
                THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_thongketheomabenh_icd10_tonghop.xml");
                Utility.SetDataSourceForDataGridEx(grdList, _dtData, false, true, "1=1", "");
            }

            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);


            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ả", txtMaBenhICD10.MyCode == "-1" ? "Tất cả" : txtMaBenhICD10.Text);
            ReportDocument crpt =
                Utility.GetReport(
                    chkChitiet.Checked
                        ? "baocao_thongketheomabenh_icd10_chitiet"
                        : "baocao_thongketheomabenh_icd10_tonghop", 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);
                crpt.SetDataSource(_dtData);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = chkChitiet.Checked
                                             ? "baocao_thongketheomabenh_icd10_chitiet"
                                             : "baocao_thongketheomabenh_icd10_tonghop";
                crpt.SetParameterValue("StaffName", StaffName);
                crpt.SetParameterValue("ParentBranchName", globalVariables.ParentBranch_Name);
                crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                crpt.SetParameterValue("Address", globalVariables.Branch_Address);
                crpt.SetParameterValue("Phone", globalVariables.Branch_Phone);
                crpt.SetParameterValue("FromDateToDate", Condition);
                crpt.SetParameterValue("sTitleReport", tieude);
                crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                crpt.SetParameterValue("BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
                Utility.ShowMsg("Lỗi:" + exception.Message);
            }
        }
        /// <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)
        {
            string kieutimkiem = "-1";

            if (chktienkham.Checked == true && chktientiem.Checked == false && chktienvacxin.Checked == false)
            {
                kieutimkiem = "1";
            }
            if (chktienkham.Checked == true && chktientiem.Checked == true && chktienvacxin.Checked == false)
            {
                kieutimkiem = "1,11";
            }
            if (chktienkham.Checked == false && chktientiem.Checked == true && chktienvacxin.Checked == false)
            {
                kieutimkiem = "11";
            }
            if (chktienkham.Checked == true && chktientiem.Checked == false && chktienvacxin.Checked == true)
            {
                kieutimkiem = "1,3";
            }
            if (chktienkham.Checked == false && chktientiem.Checked == true && chktienvacxin.Checked == true)
            {
                kieutimkiem = "11,3";
            }

            if (chkChitiet.Checked)
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaocaoThutientiemchungchitiet(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.sDbnull(cboDoituongKCB.SelectedValue, -1),
                        Utility.sDbnull(cboNhanvien.SelectedValue, -1),
                        Utility.sDbnull(cboLoaidichvu.SelectedValue, ""),
                        Utility.sDbnull(thamso, ""),
                        Utility.sDbnull(cboKhoa.SelectedValue, -1), kieutimkiem);
                THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_thutien_tiemchung_chitiet.xml");
                Utility.SetDataSourceForDataGridEx(grdChitiet, _dtData, false, true, "1=1", "");
                Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdChitiet.RootTable.Columns["Thanh_Tien"];
                tong_tien = Utility.Int32Dbnull(grdChitiet.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
            }
            else
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaocaoThutientiemchungtonghop(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.sDbnull(cboDoituongKCB.SelectedValue, -1),
                        Utility.sDbnull(cboNhanvien.SelectedValue, -1),
                        Utility.Int16Dbnull(cboLoaidichvu.SelectedValue, -1), Utility.sDbnull(thamso, ""), Utility.sDbnull(cboKhoa.SelectedValue, -1));
                THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_thutien_tiemchung_tonghop.xml");
                Utility.SetDataSourceForDataGridEx(grdList, _dtData, false, true, "1=1", "");
                Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdList.RootTable.Columns["Thanh_Tien"];
                tong_tien = Utility.Int32Dbnull(grdList.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
            }

            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;
            }

            if (chktienkham.Checked == false && chktientiem.Checked == false && chktienvacxin.Checked == true)
            {
                kieutimkiem = "3";
            }

            Utility.UpdateLogotoDatatable(ref _dtData);
            string condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} - Nhân viên :{3} - Phương thức thanh toán: {4}", dtFromDate.Text, dtToDate.Text,
                                             cboDoituongKCB.SelectedIndex >= 0
                                              ? Utility.sDbnull(cboDoituongKCB.Text)
                                              : "Tất cả",
                                             cboNhanvien.SelectedIndex > 0
                                              ? Utility.sDbnull(cboNhanvien.Text)
                                              : "Tất cả", cboLoaidichvu.SelectedIndex > 0 ?Utility.sDbnull(cboLoaidichvu.Text):"Tất cả");
            var crpt = Utility.GetReport(chkChitiet.Checked ? "baocao_thutien_tiemchung_chitiet" : "baocao_thutien_tiemchung_tonghop", ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }

            string staffName = globalVariables.gv_strTenNhanvien;

            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                staffName = globalVariables.UserName;
            }
            try
            {
                frmPrintPreview 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     = chkChitiet.Checked ? "baocao_thutien_tiemchung_chitiet" : "baocao_thutien_tiemchung_tonghop";
                crpt.SetParameterValue("StaffName", staffName);
                crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                crpt.SetParameterValue("Address", globalVariables.Branch_Address);
                crpt.SetParameterValue("Phone", globalVariables.Branch_Phone);
                crpt.SetParameterValue("FromDateToDate", condition);
                crpt.SetParameterValue("sTitleReport", tieude);
                crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                crpt.SetParameterValue("BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
                Utility.ShowMsg("Lỗi:" + exception.Message);
            }
        }
        /// <summary>
        /// hàm thực hiện việc in báo cáo thống kê chuyển viện
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            try
            {
                if (radChuyenDi.Checked)
                {
                    _reportTable =
                        BAOCAO_NGOAITRU.BaoCaoThongkeChuyenVienDi(
                            chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                            chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.sDbnull(txtTenBenh.MyCode, "-1"), Utility.Int32Dbnull(txtBacSy.MyID, -1),
                            Utility.Int32Dbnull(txtBenhVien.MyID, -1), Utility.Int32Dbnull(cboNTNT.SelectedValue, -1),
                            Utility.Int32Dbnull(cboDoituongKCB.SelectedValue, -1));
                    THU_VIEN_CHUNG
                    .CreateXML(_reportTable, "baocao_thongke_chuyendi.XML");
                    Utility.SetDataSourceForDataGridEx(grdChuyendi, _reportTable, false, true, "1=1", "");
                }
                else
                {
                    _reportTable =
                        BAOCAO_NGOAITRU.BaoCaoThongkeChuyenVienDen(
                            chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                            chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                            Utility.Int32Dbnull(txtBenhVien.MyID, -1), Utility.Int32Dbnull(cboNTNT.SelectedValue, -1),
                            Utility.Int32Dbnull(cboDoituongKCB.SelectedValue, -1));
                    THU_VIEN_CHUNG
                    .CreateXML(_reportTable, "baocao_thongke_chuyenden.XML");
                    Utility.SetDataSourceForDataGridEx(grdChuyenDen, _reportTable, false, true, "1=1", "");
                }

                if (_reportTable.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu cho báo cáo", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                string StaffName = globalVariables.gv_strTenNhanvien;
                if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
                {
                    StaffName = globalVariables.UserName;
                }
                string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} - Loại điều trị :{3} ", dtFromDate.Text, dtToDate.Text,
                                                 cboDoituongKCB.SelectedIndex > 0
                                            ? Utility.sDbnull(cboDoituongKCB.Text)
                                            : "Tất cả", cboNTNT.SelectedIndex > 0 ? Utility.sDbnull(cboNTNT.Text) : "Tất cả");
                Utility.UpdateLogotoDatatable(ref _reportTable);
                string reportCode = radChuyenDen.Checked ? "baocao_thongke_chuyenden" : "baocao_thongke_chuyendi";
                var    crpt       = Utility.GetReport(reportCode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }


                frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, _reportTable.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(_reportTable);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportCode;
                Utility.SetParameterValue(crpt, "StaffName", StaffName);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address);
                Utility.SetParameterValue(crpt, "Phone", globalVariables.Branch_Phone);
                Utility.SetParameterValue(crpt, "FromDateToDate", Condition);
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi in báo cáo", ex);
            }
        }
Пример #7
0
        /// <summary>
        /// hàm thực hiện việc in phiếu xét nghiêm
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            try
            {
                if (chkChitiet.Checked)
                {
                    _reportTable =
                        BAOCAO_NGOAITRU.BaocaoThuvienphiChitiet(Utility.sDbnull(cbokhoa.SelectedValue, "-1"), chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                                                                chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.sDbnull(cbonhanvien.SelectedValue, -1),
                                                                Utility.sDbnull(cboDoituongKCB.SelectedValue, -1),
                                                                Utility.Int32Dbnull(cboNTNT.SelectedValue, -1), Utility.Int32Dbnull(cboHoadon.SelectedValue, -1), chkLoaitimkiem.Checked ? 1 : 0);

                    Utility.SetDataSourceForDataGridEx(grdChitiet, _reportTable, false, true, "1=1", "");
                    //Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdChitiet.RootTable.Columns["tong_Tien"];
                    //tong_tien = Utility.Int32Dbnull(grdList.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
                }
                else
                {
                    _reportTable =
                        BAOCAO_NGOAITRU.BaocaoThuvienphiTonghop(Utility.sDbnull(cbokhoa.SelectedValue, "-1"), chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                                                                chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.sDbnull(cbonhanvien.SelectedValue, "-1"),
                                                                Utility.sDbnull(cboDoituongKCB.SelectedValue, "-1"),
                                                                Utility.Int32Dbnull(cboNTNT.SelectedValue, -1), Utility.Int32Dbnull(cboHoadon.SelectedValue, -1), chkLoaitimkiem.Checked ? 1 : 0);

                    Utility.SetDataSourceForDataGridEx(grdList, _reportTable, false, true, "1=1", "");
                    //Janus.Windows.GridEX.GridEXColumn gridExColumnTientong = grdList.RootTable.Columns["tong_Tien"];
                    //tong_tien = Utility.Int32Dbnull(grdList.GetTotal(gridExColumnTientong, Janus.Windows.GridEX.AggregateFunction.Sum));
                }
                THU_VIEN_CHUNG.CreateXML(_reportTable, chkChitiet.Checked ? "baocao_thuvienphi_chitiet" : "baocao_thuvienphi_tonghop");
                if (_reportTable.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu cho báo cáo", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                string StaffName = globalVariables.gv_strTenNhanvien;
                if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
                {
                    StaffName = globalVariables.UserName;
                }
                string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} -TNV :{3} - Loại điều trị :{4} ", dtFromDate.Text, dtToDate.Text,
                                                 cboDoituongKCB.SelectedIndex > 0
                                            ? Utility.sDbnull(cboDoituongKCB.Text)
                                            : "Tất cả",
                                                 cbonhanvien.SelectedIndex > 0
                                            ? Utility.sDbnull(cbonhanvien.Text)
                                            : "Tất cả", cboNTNT.SelectedIndex > 0 ? Utility.sDbnull(cboNTNT.Text) : "Tất cả");
                Utility.UpdateLogotoDatatable(ref _reportTable);
                string reportCode = chkChitiet.Checked ? "baocao_thuvienphi_chitiet" : "baocao_thuvienphi_tonghop";
                var    crpt       = Utility.GetReport(reportCode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }


                frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, _reportTable.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(_reportTable);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportCode;
                Utility.SetParameterValue(crpt, "StaffName", StaffName);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address);
                Utility.SetParameterValue(crpt, "Phone", globalVariables.Branch_Phone);
                Utility.SetParameterValue(crpt, "FromDateToDate", Condition);
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());

                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi in báo cáo", ex);
            }
        }
Пример #8
0
        /// <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)
        {
            try
            {
                _dtData =
                    BAOCAO_NGOAITRU.BaoCaoThongkeSoluongBenhNhanTheoBacsy(
                        chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                        chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                        Utility.Int32Dbnull(cboDoituongKCB.SelectedValue, -1), Utility.Int32Dbnull(txtNhanvien.MyID, -1),
                        Utility.Int32Dbnull(cboKhoaPhong.SelectedValue, -1), Utility.sDbnull(cboKhoa.SelectedValue, "KKB"));
                //THU_VIEN_CHUNG.CreateXML(_dtData,"baocao_soluongbenhnhantheobacsy.XML");
                Utility.SetDataSourceForDataGridEx(grdChitiet, _dtData, true, true, "1=1", "");
                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);


                string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2}, Bác sỹ: {3}", dtFromDate.Text, dtToDate.Text,
                                                 cboDoituongKCB.SelectedIndex >= 0
                                                  ? Utility.sDbnull(cboDoituongKCB.Text)
                                                  : "Tất cả", Utility.Int32Dbnull(txtNhanvien.txtMyID) > 0 ? Utility.sDbnull(txtNhanvien.Text) : "Tất cả");
                string reportcode = "baocao_soluongbenhnhan_theobacsy";
                var    crpt       = Utility.GetReport(reportcode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }

                string StaffName = globalVariables.gv_strTenNhanvien;
                if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
                {
                    StaffName = globalVariables.UserName;
                }



                frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, _dtData.Rows.Count <= 0 ? false : true);

                crpt.SetDataSource(_dtData);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportcode;
                crpt.SetParameterValue("StaffName", StaffName);
                crpt.SetParameterValue("ParentBranchName", globalVariables.ParentBranch_Name);
                crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                crpt.SetParameterValue("Address", globalVariables.Branch_Address);
                crpt.SetParameterValue("Phone", globalVariables.Branch_Phone);
                crpt.SetParameterValue("FromDateToDate", Condition);
                crpt.SetParameterValue("sTitleReport", tieude);
                crpt.SetParameterValue("sMoneybyLetter", new MoneyByLetter().sMoneyToLetter(tong_tien.ToString()));
                crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                crpt.SetParameterValue("BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
                Utility.ShowMsg("Lỗi: " + exception.Message);
            }
        }
        /// <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)
        {
            baocaO_TIEUDE1.Init();
            _dtData =
                BAOCAO_NGOAITRU.BaoCaoThongKeBNTheoDotuoiCT(Utility.Int32Dbnull(cboDoituongKCB.SelectedValue, -1),
                                                            chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                                                            chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.Int32Dbnull(cboGT.SelectedValue, -1),
                                                            Utility.sDbnull(cboKhoa.SelectedValue, -1));

            Utility.SetDataSourceForDataGridEx(grdChitiet, _dtData, false, true, "1=1", "");

            if (chkDoTuoi.Checked)
            {
                if (!string.IsNullOrEmpty(txtTuTuoi.Text))
                {
                    if (string.IsNullOrEmpty(txtDenTuoi.Text))
                    {
                        Utility.ShowMsg("Bạn phải chọn khoảng tuổi", "Thông báo");
                        txtDenTuoi.Focus();
                        return;
                    }
                    else
                    {
                        RowFiler = "Tuoi >=" + Utility.Int32Dbnull(txtTuTuoi.Text, -1) + " and Tuoi <=" + Utility.Int32Dbnull(txtDenTuoi.Text, -1) + "";
                    }
                }
            }
            else
            {
                switch (cboEqual.SelectedIndex)
                {
                case 1:
                    RowFiler = "Tuoi=" + Utility.Int32Dbnull(txtDenTuoi.Text, -1);
                    break;

                case 3:
                    RowFiler = "Tuoi<=" + Utility.Int32Dbnull(txtDenTuoi.Text, -1);
                    break;

                case 2:
                    RowFiler = "Tuoi>=" + Utility.Int32Dbnull(txtDenTuoi.Text, -1);
                    break;

                default:
                    RowFiler = "1=1";
                    break;
                }
            }

            _dtData.DefaultView.RowFilter = RowFiler;
            if (_dtData.DefaultView.Count <= 0)
            {
                Utility.ShowMsg("Không có dữ liệu  theo các điều kiện bạn chọn!");
                Utility.DefaultNow(this);
                cboDoituongKCB.Focus();
                return;
            }
            else
            {
                _dtData = _dtData.DefaultView.ToTable();
            }

            Utility.UpdateLogotoDatatable(ref _dtData);


            string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} - Khoa KCB :{3} - Giới tính: {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ả", cboGT.SelectedIndex > 0?Utility.sDbnull(cboGT.Text):"Tất cả");
            string reportCode = "baocao_thongkebn_theodotuoi_ct";
            var    crpt       = Utility.GetReport(reportCode, ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }

            string StaffName = globalVariables.gv_strTenNhanvien;

            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                StaffName = globalVariables.UserName;
            }
            try
            {
                frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, _dtData.Rows.Count <= 0 ? false : true);
                //try
                //{
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportCode;
                crpt.SetDataSource(_dtData);
                crpt.SetParameterValue("StaffName", StaffName);
                crpt.SetParameterValue("BranchName", globalVariables.Branch_Name);
                crpt.SetParameterValue("Address", globalVariables.Branch_Address);
                crpt.SetParameterValue("Phone", globalVariables.Branch_Phone);
                crpt.SetParameterValue("FromDateToDate", Condition);
                crpt.SetParameterValue("sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                crpt.SetParameterValue("sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                crpt.SetParameterValue("BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
                Utility.ShowMsg("Lỗi:" + exception.Message);
            }
        }
Пример #10
0
        /// <summary>
        /// hàm thực hiện việc in phiếu xét nghiêm
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            _reportTable = BAOCAO_NGOAITRU.BaoCaoThongkeKhamChuaBenh(dtFromDate.Value, dtToDate.Value,
                                                                     Utility.Int32Dbnull(cboDoituongKCB.SelectedValue, -1),
                                                                     Utility.Int32Dbnull(chkLoaitimkiem.Checked, 0),
                                                                     Utility.Int32Dbnull(cboGT.SelectedValue, -1),
                                                                     Utility.Int32Dbnull(txtNhanvien.txtMyID, -100), sThamSo);
            THU_VIEN_CHUNG.CreateXML(_reportTable, "baocao_thongke_thutienchitiet.XML");
            if (_reportTable.Rows.Count <= 0)
            {
                Utility.ShowMsg("Không tìm thấy dữ liệu cho báo cáo", "Thông báo", MessageBoxIcon.Warning);
                return;
            }
            Utility.SetDataSourceForDataGridEx(grdChitiet, _reportTable, true, true, "", "");
            string StaffName = globalVariables.gv_strTenNhanvien;

            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                StaffName = globalVariables.UserName;
            }
            //string Condition = "";
            string Condition = string.Format("Từ ngày {0} đến {1} - Đối tượng : {2} -TNV :{3} - Giới tính :{4} ",
                                             dtFromDate.Text, dtToDate.Text,
                                             cboDoituongKCB.SelectedIndex > 0
                                                     ? Utility.sDbnull(cboDoituongKCB.Text)
                                                     : "Tất cả",
                                             txtNhanvien.SelectedIndex > 0
                                                     ? Utility.sDbnull(txtNhanvien.txtMyName)
                                                     : "Tất cả",
                                             cboGT.SelectedIndex > 0 ? Utility.sDbnull(cboGT.Text) : "Tất cả");

            Utility.UpdateLogotoDatatable(ref _reportTable);
            string reportCode = "baocao_thongke_thutienchitiet";

            ReportDocument crpt = Utility.GetReport(reportCode, ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }
            try
            {
                var objForm = new frmPrintPreview(tieude, crpt, true,
                                                  _reportTable.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(_reportTable);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportCode;
                Utility.SetParameterValue(crpt, "StaffName", StaffName);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address);
                Utility.SetParameterValue(crpt, "Phone", globalVariables.Branch_Phone);
                Utility.SetParameterValue(crpt, "FromDateToDate", Condition);
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:" + ex.Message);
            }
            finally
            {
                Utility.FreeMemory(crpt);
            }
        }