Example #1
0
 /// <summary>
 /// hàm thực hiện in phiếu báo cáo
 /// thông tin
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdBaoCao_Click(object sender, EventArgs e)
 {
     try
     {
         int       trangthai       = Trangthai();
         int       kieungaytimkiem = chkKieungaytimkiem.Checked ? 1 : 0;
         DataTable m_dtReport      =
             BAOCAO_THUOC.ThuocBaocaoTinhhinhxuatvacxintuyenhuyen(
                 chkByDate.Checked ? dtFromDate.Value.ToString("dd/MM/yyyy") : "01/01/1900",
                 chkByDate.Checked ? dtToDate.Value.ToString("dd/MM/yyyy") : "01/01/1900", trangthai,
                 Utility.Int32Dbnull(txtKho.MyID), Utility.Int32Dbnull(txtthuoc.MyID, -1),
                 (byte)LoaiPhieu.PhieuXuatkhoTuyenXaHuyen, kieungaytimkiem, KIEU_THUOC_VT);
         THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_baocao_xuatvacxin_tuyenhuyen.xml");
         Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, true, true, "1=1", "");
         if (m_dtReport.Rows.Count <= 0)
         {
             Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning);
             return;
         }
         string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
         thuoc_baocao.Baocaoxuatvacxintuyehuyen(m_dtReport,
                                                "thuoc_baocao_xuatvacxin_tuyenhuyen", baocaO_TIEUDE1.TIEUDE,
                                                dtNgayIn.Value, FromDateToDate);
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:" + ex.Message);
     }
 }
Example #2
0
        private void LoadTh()
        {
            try
            {
                if (chktuyen.Checked)
                {
                    m_dataTH =
                        new BAOCAO_BHYT().BHYT_21A_PHANTUYEN(dtpFromDate.Value, dtpToDate.Value,
                                                             "BHYT", -1, txtNhomBHYT.myCode, Utility.Int32Dbnull(cboTuyen.SelectedIndex - 1, -1),
                                                             Utility.sDbnull(globalVariables.gv_strNoiDKKCBBD, "01"), globalVariables.gv_strNoicapBHYT, Utility.sDbnull(txtKCBBDCode.Text, -1),
                                                             chkKhacMa.Checked ? "KHAC" : "BANG");

                    THU_VIEN_CHUNG.CreateXML(m_dataTH, "BHYT21A.xml");
                    Utility.SetDataSourceForDataGridEx(grdListPhanTuyen, m_dataTH, true, true, "1=1", "");
                    grdExcel.DataSource = m_dataTH;
                }
                else
                {
                    m_dataTH =
                        new BAOCAO_BHYT().BHYT_21A(dtpFromDate.Value, dtpToDate.Value,
                                                   "BHYT", -1, txtNhomBHYT.myCode, Utility.Int32Dbnull(cboTuyen.SelectedIndex - 1, -1),
                                                   Utility.sDbnull(globalVariables.gv_strNoiDKKCBBD, "01"), globalVariables.gv_strNoicapBHYT, Utility.sDbnull(txtKCBBDCode.Text, -1),
                                                   chkKhacMa.Checked ? "KHAC" : "BANG");

                    THU_VIEN_CHUNG.CreateXML(m_dataTH, "BHYT21A.xml");
                    Utility.SetDataSourceForDataGridEx(grdList, m_dataTH, true, true, "1=1", "");
                    grdExcel.DataSource = m_dataTH;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
        }
        private void cmdInPhieu_Click(object sender, EventArgs e)
        {
            int trangthai = -1;

            DataTable dtDanhsach =
                SPs.BhytBaocaoDongchitra(dtFromDate.Value, dtToDate.Value,
                                         Utility.sDbnull(cboKhoa.SelectedValue, "KKB"), globalVariables.gv_intIDNhanvien, trangthai)
                .GetDataSet().Tables[0];

            Utility.SetDataSourceForDataGridEx(grdResult, dtDanhsach, false, false, "", "");

            THU_VIEN_CHUNG.CreateXML(dtDanhsach, "BHYT_baocao_dongchitra.XML");
            Utility.UpdateLogotoDatatable(ref dtDanhsach);
            string reportCode = "BHYT_baocao_dongchitra";

            string Condition =
                string.Format("Từ ngày {0} đến {1} - Khoa KCB :{2}",
                              dtFromDate.Text, dtToDate.Text, globalVariables.MA_KHOA_THIEN);
            ReportDocument 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
            {
                var objForm = new frmPrintPreview(tieude, crpt, true, dtDanhsach.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(dtDanhsach);
                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("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);
            }
        }
        /// <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);
            }
        }
Example #5
0
        void cmdPrint_Click(object sender, EventArgs e)
        {
            Utility.WaitNow(this);
            DataTable dtData =
                SPs.KcbThamkhamPhieuchuyenvien(Utility.DoTrim(txtMaluotkham.Text)).GetDataSet().Tables[0];

            if (dtData.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;
            }
            THU_VIEN_CHUNG.CreateXML(dtData, "thamkham_phieuchuyenvien.XML");
            Utility.UpdateLogotoDatatable(ref dtData);
            string StaffName = globalVariables.gv_strTenNhanvien;

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

            string         tieude = "", reportname = "";
            ReportDocument crpt = Utility.GetReport("thamkham_phieuchuyenvien", ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }
            try
            {
                frmPrintPreview objForm = new frmPrintPreview("PHIẾU CHUYỂN TUYẾN", crpt, true, dtData.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(dtData);

                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "thamkham_phieuchuyenvien";
                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, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTimeWithThanhPho(dtpNgayin.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(ex);
            }
            finally
            {
                Utility.DefaultNow(this);
                GC.Collect();
                Utility.FreeMemory(crpt);
            }
        }
        /// <summary>
        /// hàm thực hiện in phiếu báo cáo
        /// thông tin
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdBaoCao_Click(object sender, EventArgs e)
        {
            try
            {
                string nhomthuoc = "-1";

                nhomthuoc = txtLoaithuoc.MyID.ToString();


                DataTable m_dtReport = null;
                if (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked))
                {
                    m_dtReport = BAOCAO_THUOC.ThuocBaocaoBiendongthuocTrongkhotong(chkByDate.Checked ? dtFromDate.Text : Utility.sDbnull("01/01/1900"),
                                                                                   chkByDate.Checked ? dtToDate.Text : globalVariables.SysDate.ToString(),
                                                                                   Utility.Int32Dbnull(cboKho.SelectedValue), nhomthuoc, Utility.Int32Dbnull(txtthuoc.MyID, -1), chkBiendong.Checked ? 1 : 0);
                }
                else
                {
                    m_dtReport = BAOCAO_THUOC.ThuocBaocaoBiendongthuocTrongkhole(chkByDate.Checked ? dtFromDate.Text : Utility.sDbnull("01/01/1900"),
                                                                                 chkByDate.Checked ? dtToDate.Text : globalVariables.SysDate.ToString(),
                                                                                 Utility.Int32Dbnull(cboKho.SelectedValue), Utility.Int32Dbnull(txtthuoc.MyID, -1), nhomthuoc, chkBiendong.Checked ? 1 : 0);
                }

                Utility.SetDataSourceForDataGridEx(_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked) ? grdListKhoChan : grdListKhole, m_dtReport, true, true, "1=1", "");
                if (m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
                if (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked))
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport, "baocao_xuatnhapton_khochan.xml");
                    thuoc_baocao.BaocaoNhapxuattonKhochan(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                          dtNgayIn.Value, FromDateToDate,
                                                          Utility.sDbnull(cboKho.Text), chkTheoNhomThuoc.Checked);
                }
                else
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport, "baocao_xuatnhapton_khole.xml");
                    thuoc_baocao.BaocaoNhapxuattonKhole(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                        dtNgayIn.Value, FromDateToDate,
                                                        Utility.sDbnull(cboKho.Text), chkTheoNhomThuoc.Checked);
                }
                //else
                //{
                //    thuoc_baocao.BaocaoNhapxuattonKhochanTheonhom(m_dtReport, baocaO_TIEUDE1.TIEUDE,
                //                                                                         dtNgayIn.Value, FromDateToDate,
                //                                                                         Utility.sDbnull(cboKho.Text));
                //}
            }
            catch (Exception)
            {
            }
        }
Example #7
0
 void LoadDataView()
 {
     try
     {
         mdtReport = new BAOCAO_BHYT().BHYT_14A_NEW(dtpFromDate.Value, dtpToDate.Value, "BHYT", txtNhomBHYT.myCode);
         ModifyCommands();
         THU_VIEN_CHUNG.CreateXML(mdtReport, "BHYT14A.xml");
         grdList.DataSource = mdtReport;
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }
 private void cmdInphieuhen_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dtphienhen =
             SPs.KcbThamkhamInphieuhenBenhnhan(Utility.sDbnull(txtPatient_Code.Text, ""),
                                               Utility.Int64Dbnull(txtPatient_ID.Text, -1)).
             GetDataSet().Tables[0];
         THU_VIEN_CHUNG.CreateXML(dtphienhen, "thamkham_inphieuhen_benhnhan.xml");
         KcbInphieu.INPHIEU_HEN(dtphienhen, "PHIẾU HẸN KHÁM");
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            try
            {
                //Truyền dữ liệu vào datatable
                DataTable m_dtReport = BAOCAO_THUOC.ThuocLaythongtinInphieuDutruthuoc(Utility.Int16Dbnull(cboKhoxuat.SelectedValue, -1), KIEU_THUOC_VT);
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_PhieuDutru.xml");

                if (m_dtReport.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;
                }

                //Add logo vào datatable
                Utility.UpdateLogotoDatatable(ref m_dtReport);
                string tieude = "", reportname = "";
                string mabaocao = "thuoc_PhieuDutru";
                var    crpt     = Utility.GetReport(mabaocao, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }

                //baocaO_TIEUDE1.TIEUDE
                frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(m_dtReport);

                objForm.mv_sReportFileName = System.IO.Path.GetFileName(reportname);
                objForm.mv_sReportCode     = mabaocao;
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(globalVariables.SysDate));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "txtTrinhky", "");
                Utility.SetParameterValue(crpt, "tenkho", cboKhoxuat.Text);


                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
                Utility.ShowMsg("Lỗi:" + exception.Message);
            }
        }
Example #10
0
        public static void InphieuNhapkho(int IDPhieuNhap, string sTitleReport, DateTime NgayIn)
        {
            DataTable m_dtReport = new THUOC_NHAPKHO().Laythongtininphieunhapkhothuoc(IDPhieuNhap);

            if (m_dtReport.Rows.Count <= 0)
            {
                Utility.ShowMsg("Không tìm thấy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                return;
            }
            THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_phieu_nhapkho.xml");
            MoneyByLetter _moneyByLetter = new MoneyByLetter();
            string        tinhtong = TinhTong(m_dtReport, TPhieuNhapxuatthuocChitiet.ThanhTienColumn.ColumnName);
            string        tieude = "", reportname = "";
            var           crpt = Utility.GetReport("thuoc_phieunhapkho", ref tieude, ref reportname);

            // VNS.HIS.UI.BaoCao.PhieuNhapKho.CRPT_PHIEU_NHAPKHO crpt =new CRPT_PHIEU_NHAPKHO();
            var objForm = new frmPrintPreview(sTitleReport, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);

            Utility.UpdateLogotoDatatable(ref m_dtReport);
            try
            {
                m_dtReport.AcceptChanges();
                crpt.SetDataSource(m_dtReport);

                ////crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + "  PHÒNG TIẾP ĐÓN   ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "thuoc_phieunhapkho";
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "sMoneyLetter", _moneyByLetter.sMoneyToLetter(tinhtong));

                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(NgayIn));
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                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();
                // Utility.DefaultNow(this);
            }
            catch (Exception ex)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(ex.ToString());
                }
            }
        }
Example #11
0
        public static void InBienBanGiaoHang(int IDPhieuNhap, string sTitleReport, DateTime NgayIn)
        {
            DataTable m_dtReport = SPs.ThuocLaydulieuinphieuchuyenkho2lien(IDPhieuNhap).GetDataSet().Tables[0];

            if (m_dtReport.Rows.Count <= 0)
            {
                Utility.ShowMsg("Không tìm thấy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                return;
            }
            THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_phieu_bienbangiaohang");
            string tieude = "", reportname = "";
            var    crpt = Utility.GetReport("thuoc_phieu_bienbangiaohang", ref tieude, ref reportname);

            Utility.UpdateLogotoDatatable(ref m_dtReport);
            var objForm = new frmPrintPreview(sTitleReport, crpt, true, true);

            try
            {
                m_dtReport.AcceptChanges();
                crpt.SetDataSource(m_dtReport);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "thuoc_phieu_bienbangiaohang";
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(NgayIn));
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                //  Utility.SetParameterValue(crpt, "sMoneyLetter", new MoneyByLetter().sMoneyToLetter(tinhtong));
                Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;

                objForm.ShowDialog();
                // Utility.DefaultNow(this);
            }
            catch (Exception ex)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(ex.ToString());
                }
            }
            finally
            {
                Utility.FreeMemory(crpt);
            }
        }
Example #12
0
        public static void InphieuThanhly(int IDPhieuNhap, string sTitleReport, DateTime NgayIn)
        {
            DataTable m_dtReport = SPs.ThuocLaythongtininphieuXuatkhothuoc(IDPhieuNhap).GetDataSet().Tables[0];

            if (m_dtReport.Rows.Count <= 0)
            {
                Utility.ShowMsg("Không tìm thấy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                return;
            }
            MoneyByLetter _moneyByLetter = new MoneyByLetter();
            string        tinhtong       = TinhTong(m_dtReport, TPhieuNhapxuatthuocChitiet.ThanhTienColumn.ColumnName);

            THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_bienban_thanhly");
            string tieude = "", reportname = "";
            var    crpt = Utility.GetReport("thuoc_bienban_thanhly", ref tieude, ref reportname);


            Utility.UpdateLogotoDatatable(ref m_dtReport);
            var objForm = new frmPrintPreview(sTitleReport, crpt, true, true);

            try
            {
                m_dtReport.AcceptChanges();
                crpt.SetDataSource(m_dtReport);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "thuoc_bienban_thanhly";

                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(NgayIn));
                Utility.SetParameterValue(crpt, "sMoneyLetter", _moneyByLetter.sMoneyToLetter(tinhtong));
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                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)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(ex.ToString());
                }
            }
        }
Example #13
0
        void LoadTH()
        {
            try
            {
                if (chktuyen.Checked)
                {
                    m_dataTH =
                        new BAOCAO_BHYT().BHYT_19A_PHANTUYEN(dtpFromDate.Value.ToString("dd/MM/yyyy"),
                                                             dtpToDate.Value.ToString("dd/MM/yyyy"),
                                                             "BHYT", -1,
                                                             Utility.Int32Dbnull(txtDrugID.Text, -1), Utility.Int16Dbnull(txtdrugtype_id.Text, -1),
                                                             txtNhomBHYT.myCode,
                                                             Utility.Int32Dbnull(cboTuyen.SelectedValue, -1),
                                                             Utility.sDbnull(globalVariables.gv_strNoiDKKCBBD, "01"),
                                                             globalVariables.gv_strNoicapBHYT, Utility.sDbnull(txtKCBBDCode.Text, -1),
                                                             chkKhacMa.Checked ? "KHAC" : "BANG", -1);


                    THU_VIEN_CHUNG.CreateXML(m_dataTH, "BHYT19A.xml");
                    Utility.SetDataSourceForDataGridEx(grdListPhanTuyen, m_dataTH, true, true, "1=1", "");
                }
                else
                {
                    m_dataTH =
                        new BAOCAO_BHYT().BHYT_19A(dtpFromDate.Value.ToString("dd/MM/yyyy"),
                                                   dtpToDate.Value.ToString("dd/MM/yyyy"),
                                                   "BHYT", -1,
                                                   Utility.Int32Dbnull(txtDrugID.Text, -1), Utility.Int16Dbnull(txtdrugtype_id.Text, -1),
                                                   txtNhomBHYT.myCode,
                                                   Utility.Int32Dbnull(cboTuyen.SelectedValue, -1),
                                                   Utility.sDbnull(globalVariables.gv_strNoiDKKCBBD, "01"),
                                                   globalVariables.gv_strNoicapBHYT, Utility.sDbnull(txtKCBBDCode.Text, -1),
                                                   chkKhacMa.Checked ? "KHAC" : "BANG", -1);


                    THU_VIEN_CHUNG.CreateXML(m_dataTH, "BHYT19A.xml");
                    Utility.SetDataSourceForDataGridEx(grdList, m_dataTH, true, true, "1=1", "");
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
        }
Example #14
0
        void LoadCT()
        {
            try
            {
                m_dataCT =
                    new BAOCAO_BHYT().BHYT_05A_CT(dtpFromDate.Value.Date, dtpToDate.Value.Date,
                                                  "BHYT", -1,
                                                  Utility.Int32Dbnull(cboTuyen.SelectedValue, -1),
                                                  Utility.sDbnull(txtKCBBDCode.Text, -1), Utility.sDbnull(txtTPCode.Text, -1));


                ProcessData();
                if (!m_dataCT.Columns.Contains("IsDungTuyen"))
                {
                    m_dataCT.Columns.Add("IsDungTuyen", typeof(string));
                }
                THU_VIEN_CHUNG.CreateXML(m_dataCT, "BHYT05A_CT.xml");
                foreach (DataRow drv in m_dataCT.Rows)
                {
                    switch (drv["dung_tuyen"].ToString())
                    {
                    case "0":
                        drv["IsDungTuyen"] = "Trái tuyến";
                        break;

                    case "1":
                        drv["IsDungTuyen"] = "Đúng tuyến";
                        break;

                    default:
                        drv["IsDungTuyen"] = "Khác";
                        break;
                    }
                }
                //THU_VIEN_CHUNG.CreateXML(m_dataCT, @"Xml4Reports\BHYT05A_CT.xml");
                m_dataCT.AcceptChanges();
                Utility.SetDataSourceForDataGridEx(grdListCT, m_dataCT, true, true, "1=1", "");
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
        }
Example #15
0
        void LoadCT()
        {
            try
            {
                m_dataCT =
                    new BAOCAO_BHYT().BHYT_25A_CT(dtpFromDate.Value, dtpToDate.Value,
                                                  "BHYT", -1, Utility.Int32Dbnull(cboTuyen.SelectedIndex - 1, -1),
                                                  cboKieuBaoCao.SelectedIndex == 0?"25a":"25d",
                                                  globalVariables.gv_strNoiDKKCBBD, -1);


                UpdateDataAlterLoad();
                if (!m_dataCT.Columns.Contains("IsDungTuyen"))
                {
                    m_dataCT.Columns.Add("IsDungTuyen", typeof(string));
                }
                THU_VIEN_CHUNG.CreateXML(m_dataCT, "BHYT25A_CT.xml");
                foreach (DataRow drv in m_dataCT.Rows)
                {
                    switch (drv["dung_tuyen"].ToString())
                    {
                    case "0":
                        drv["IsDungTuyen"] = "Trái tuyến";
                        break;

                    case "1":
                        drv["IsDungTuyen"] = "Đúng tuyến";
                        break;

                    default:
                        drv["IsDungTuyen"] = "Khác";
                        break;
                    }
                }

                m_dataCT.AcceptChanges();
                Utility.SetDataSourceForDataGridEx(grdListCT, m_dataCT, true, true, "1=1", "");
            }
            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
        }
Example #16
0
        public static void InphieuXuatkho_2lien(int IDPhieuNhap, string sTitleReport, DateTime NgayIn)
        {
            try
            {
                DataTable dataTable = SPs.ThuocLaydulieuinphieuchuyenkho2lien(IDPhieuNhap).GetDataSet().Tables[0];

                if (dataTable.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                MoneyByLetter _moneyByLetter = new MoneyByLetter();
                string        tinhtong       = TinhTong(dataTable, "THANHTIEN_XUAT");
                THU_VIEN_CHUNG.CreateXML(dataTable, "thuoc_phieu_xuatkho_2lien.xml");
                string tieude = "", reportname = "", reportCode = "";
                reportCode = THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_INPHIEUXUATKHO_2LIEN", "0", false) == "1"
                                ? "thuoc_phieu_xuatkho_2lien"
                                : "thuoc_phieu_xuatkho_1lien";
                var crpt = Utility.GetReport(reportCode, ref tieude, ref reportname);
                if (crpt != null)
                {
                    frmPrintPreview objForm = new frmPrintPreview(sTitleReport, crpt, true, true);
                    Utility.UpdateLogotoDatatable(ref dataTable);
                    crpt.SetDataSource(dataTable);
                    objForm.mv_sReportFileName = Path.GetFileName(reportname);
                    objForm.mv_sReportCode     = reportCode;
                    Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                    Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                    Utility.SetParameterValue(crpt, "sTitleReport", sTitleReport);
                    Utility.SetParameterValue(crpt, "sMoneyLetter", _moneyByLetter.sMoneyToLetter(tinhtong));
                    Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTime(globalVariables.SysDate));
                    Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                    objForm.crptViewer.ReportSource = crpt;
                    objForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi khi in báo cáo InphieuXuatkho_2lien()-->\n" + ex.Message);
                return;
            }
        }
Example #17
0
 void LoadTH()
 {
     try
     {
         m_dataTH =
             new BAOCAO_BHYT().BHYT_05A_TH(dtpFromDate.Value, dtpToDate.Value,
                                           "BHYT",
                                           cboNhom.SelectedValue.ToString(), Utility.Int32Dbnull(cboTuyen.SelectedValue, -1),
                                           txtTPCode.Text,
                                           -1);
         THU_VIEN_CHUNG.CreateXML(m_dataTH, "BHYT05A_TH.xml");
         m_dataTH.AcceptChanges();
         //THU_VIEN_CHUNG.CreateXML(m_dataTH, @"Xml4Reports\BHYT05A_TH.xml");
         Utility.SetDataSourceForDataGridEx(grdListTH, m_dataTH, true, true, "1=1", "");
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }
Example #18
0
        public static void InphieuTraKholeVeKhochan(int IDPhieuNhap, string sTitleReport, DateTime NgayIn)
        {
            try
            {
                DataTable m_dtReport = SPs.ThuocLaythongtininphieutrakholevekhochan(IDPhieuNhap).GetDataSet().Tables[0];
                if (m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_phieutrakholevekhochan.xml");
                Utility.UpdateLogotoDatatable(ref m_dtReport);
                string tieude = "", reportname = "";
                var    crpt = Utility.GetReport("thuoc_phieutrakholevekhochan", ref tieude, ref reportname);

                var objForm = new frmPrintPreview(sTitleReport, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);

                m_dtReport.AcceptChanges();
                crpt.SetDataSource(m_dtReport);

                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "thuoc_phieutrakholevekhochan";
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(NgayIn));
                Utility.SetParameterValue(crpt, "sTitleReport", sTitleReport);
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "sMoneybyletter", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;

                objForm.ShowDialog();
                // Utility.DefaultNow(this);
            }
            catch (Exception ex)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(ex.ToString());
                }
            }
        }
Example #19
0
 private void InMauChuyenKhoa(string maLuotkham, long idBenhnhan)
 {
     try
     {
         DataTable _dtInphieu = _KCB_THAMKHAM.InMauPhieuChuyenKhoa(maLuotkham, idBenhnhan).Tables[0];
         THU_VIEN_CHUNG.CreateXML(_dtInphieu, "thamkham_phieukham_chuyenkhoa.xml");
         string reportcode = "";
         if (radkhamchuyenkhoa.Checked)
         {
             reportcode = "PHIEUKHAM_CHUYENKHOA";
         }
         else
         {
             reportcode = "PHIEUKHAM_BENHPHAM";
         }
         KcbInphieu.INMAU_CHUYENKHAM_CHUYENKHOA(_dtInphieu, "PHIẾU KHÁM CHUYÊN KHOA", reportcode, txtLydo.Text);
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:" + ex.Message);
     }
 }
Example #20
0
        public static void InphieuTranhacungcap(int IDPhieuNhap, string sTitleReport, DateTime NgayIn)
        {
            try
            {
                DataTable m_dtReport = SPs.ThuocLaydulieuinphieuchuyenkho2lien(IDPhieuNhap).GetDataSet().Tables[0];
                if (m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_phieutranhacungcap");
                string tieude = "", reportname = "";
                var    crpt = Utility.GetReport("thuoc_phieutranhacungcap", ref tieude, ref reportname);
                Utility.UpdateLogotoDatatable(ref m_dtReport);
                var objForm = new frmPrintPreview(sTitleReport, crpt, true, true);

                m_dtReport.AcceptChanges();
                crpt.SetDataSource(m_dtReport);
                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "thuoc_phieutranhacungcap";


                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(NgayIn));
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(ex.ToString());
                }
            }
        }
Example #21
0
        public static void InBanCamKetPhauThuat(DataTable mDtReport, string sTitleReport, DateTime ngayIn)
        {
            string         tieude = "", reportname = "";
            ReportDocument crpt = Utility.GetReport("noitru_giaycamketPT_A5", ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }
            THU_VIEN_CHUNG.CreateXML(mDtReport, "noitru_giaycamketPT_A5.xml");
            var moneyByLetter = new MoneyByLetter();
            var objForm       = new frmPrintPreview(sTitleReport, crpt, true, mDtReport.Rows.Count > 0);

            // string tinhtong = TinhTong(m_dtReport);
            Utility.UpdateLogotoDatatable(ref mDtReport);
            try
            {
                crpt.SetDataSource(mDtReport);


                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "noitru_giaycamketPT_A5";
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTimeWithThanhPho(ngayIn));
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception ex)
            {
                if (globalVariables.IsAdmin)
                {
                    Utility.ShowMsg(ex.ToString());
                }
            }
        }
Example #22
0
 /// <summary>
 /// hàm thực hiện in phiếu báo cáo
 /// thông tin
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdBaoCao_Click(object sender, EventArgs e)
 {
     try
     {
         int       trangthai       = Trangthai();
         int       kieungaytimkiem = chkKieungaytimkiem.Checked ? 1 : 0;
         DataTable m_dtReport      =
             BAOCAO_THUOC.ThuocBaocaoTinhhinhnhapkhothuoc(chkByDate.Checked ? dtFromDate.Value.ToString("dd/MM/yyyy") : "01/01/1900",
                                                          chkByDate.Checked ? dtToDate.Value.ToString("dd/MM/yyyy") : "01/01/1900", trangthai,
                                                          Utility.Int32Dbnull(cboKho.SelectedValue), Utility.Int32Dbnull(txtthuoc.MyID, -1), (byte)LoaiPhieu.PhieuThanhly, kieungaytimkiem, Utility.DoTrim(txtLydothanhly.Text), "-1", KIEU_THUOC_VT);
         THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_baocaochitiet_nhapkho.xml");
         Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, true, true, "1=1", "");
         if (m_dtReport.Rows.Count <= 0)
         {
             Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning);
             return;
         }
         string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
         thuoc_baocao.BaocaoThanhlythuoc(m_dtReport, KIEU_THUOC_VT == "THUOC"?"thuoc_baocao_thanhly":"vt_baocao_thanhly", baocaO_TIEUDE1.TIEUDE, dtNgayIn.Value, FromDateToDate);
     }
     catch (Exception)
     {
     }
 }
Example #23
0
 private void PrintReport(bool view)
 {
     try
     {
         prgBar.Visible = true;
         if (m_dataTH != null)
         {
             string reportcode;
             if (chktuyen.Checked)
             {
                 reportcode = "BHYT_21A_PHANTUYEN";
             }
             else
             {
                 reportcode = "BHYT_21A";
             }
             if (m_dataTH.Rows.Count <= 0 || m_dataTH.Columns.Count <= 0)
             {
                 return;
             }
             string         tieude = "", reportname = "";
             ReportDocument crpt = Utility.GetReport(reportcode, ref tieude, ref reportname);
             if (crpt == null)
             {
                 return;
             }
             var objForm = new frmPrintPreview(Utility.DoTrim(baocaO_TIEUDE1.TIEUDE), crpt, true, true);
             if (m_dataTH.Rows.Count <= 0)
             {
                 return;
             }
             Utility.UpdateLogotoDatatable(ref m_dataTH);
             THU_VIEN_CHUNG.CreateXML(m_dataTH, string.Format("{0}.xml", reportcode));
             crpt.SetDataSource(m_dataTH);
             objForm.mv_sReportFileName = Path.GetFileName(reportname);
             objForm.mv_sReportCode     = reportcode;
             Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
             Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
             Utility.SetParameterValue(crpt, "ReportCondition", GetReportCondition());
             Utility.SetParameterValue(crpt, "NTN", Utility.FormatDateTimeWithThanhPho(dtpNgayIn.Value));
             Utility.SetParameterValue(crpt, "sBangChu", new MoneyByLetter().sMoneyToLetter(SumOfTotal(m_dataTH)));
             Utility.SetParameterValue(crpt, "sTitleReport", baocaO_TIEUDE1.TIEUDE);
             objForm.crptViewer.ReportSource = crpt;
             if (view)
             {
                 objForm.ShowDialog();
             }
             else
             {
                 crpt.PrintOptions.PaperSize        = PaperSize.PaperA4;
                 crpt.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
                 crpt.PrintToPrinter(1, false, 1, 1);
             }
             prgBar.Visible = false;
         }
     }
     catch (Exception ex)
     {
         log.Error("Loi trong qua trinh in bao cao : (0)", ex);
         prgBar.Visible = false;
     }
 }
        /// <summary>
        /// hàm thực hiện in phiếu báo cáo
        /// thông tin
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdBaoCao_Click(object sender, EventArgs e)
        {
            try
            {
                string nhomthuoc = "-1";
                if (Utility.Int32Dbnull(txtKho.MyID, -1) < 0)
                {
                    Utility.ShowMsg("Bạn phải chọn Kho thuốc");
                    txtKho.Focus();
                    return;
                }
                nhomthuoc = txtLoaithuoc.MyID.ToString();
                DataTable m_dtReport = null;
                string    fromdate   = "01/01/1900";
                string    todate     = "01/01/1900";
                string    _value     = "1";
                if (optThang.Checked)
                {
                    if (cboThang.SelectedIndex < 0)
                    {
                        Utility.ShowMsg("Bạn phải chọn Tháng báo cáo");
                        cboThang.Focus();
                        return;
                    }
                    _value = cboThang.SelectedValue.ToString();
                    switch (_value)
                    {
                    case "2":
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 29).ToString("dd/MM/yyyy");
                        break;

                    case "4":
                    case "6":
                    case "9":
                    case "11":
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 30).ToString("dd/MM/yyyy");
                        break;

                    default:
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 31).ToString("dd/MM/yyyy");
                        break;
                    }
                }
                else if (optQuy.Checked)
                {
                    if (cboQuy.SelectedIndex < 0)
                    {
                        Utility.ShowMsg("Bạn phải chọn Quý báo cáo");
                        cboQuy.Focus();
                        return;
                    }
                    _value = cboQuy.SelectedValue.ToString();
                    switch (_value)
                    {
                    case "1":
                        fromdate = new DateTime(dtpNam.Value.Year, 1, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 3, 31).ToString("dd/MM/yyyy");
                        break;

                    case "2":
                        fromdate = new DateTime(dtpNam.Value.Year, 4, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 6, 30).ToString("dd/MM/yyyy");
                        break;

                    case "3":
                        fromdate = new DateTime(dtpNam.Value.Year, 7, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 9, 30).ToString("dd/MM/yyyy");
                        break;

                    case "4":
                        fromdate = new DateTime(dtpNam.Value.Year, 10, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 12, 31).ToString("dd/MM/yyyy");
                        break;

                    default:
                        fromdate = new DateTime(dtpNam.Value.Year, 1, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 12, 31).ToString("dd/MM/yyyy");
                        break;
                    }
                }
                else if (optNam.Checked)
                {
                    fromdate = new DateTime(dtpNam.Value.Year, 1, 1).ToString("dd/MM/yyyy");
                    todate   = new DateTime(dtpNam.Value.Year, 12, 31).ToString("dd/MM/yyyy");
                }
                else
                {
                    fromdate = dtFromDate.Value.ToString("dd/MM/yyyy");
                    todate   = dtToDate.Value.ToString("dd/MM/yyyy");
                }
                byte   kieubiendong = (byte)cboKieutonghop.SelectedIndex;
                string xmlFile      = "ThuocBaocaophatsinhTonghop.xml";
                if (cboKieubangke.SelectedIndex == 0)
                {
                    xmlFile    = "ThuocBaocaophatsinhChitiet.xml";
                    m_dtReport = BAOCAO_THUOC.ThuocBaocaophatsinhChitiet(fromdate, todate,
                                                                         Utility.Int32Dbnull(txtKho.MyID), Utility.Int32Dbnull(txtthuoc.MyID, -1), kieubiendong,
                                                                         nhomthuoc, 1, Utility.Int32Dbnull(txtKhoXuat.MyID, -1));
                }
                else
                {
                    xmlFile    = "ThuocBaocaophatsinhTonghop.xml";
                    m_dtReport = BAOCAO_THUOC.ThuocBaocaophatsinhTonghop(fromdate, todate,
                                                                         Utility.Int32Dbnull(txtKho.MyID), Utility.Int32Dbnull(txtthuoc.MyID, -1), kieubiendong,
                                                                         nhomthuoc, 1, Utility.Int32Dbnull(txtKhoXuat.MyID, -1));
                }
                THU_VIEN_CHUNG.CreateXML(m_dtReport, xmlFile);

                Utility.SetDataSourceForDataGridEx(cboKieutonghop.SelectedIndex == 0?grdTonghop: grdChitiet, m_dtReport, true, true, "1=1", "");
                if (m_dtReport == null || m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu báo cáo", "Thông báo");
                    return;
                }
                string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
                thuoc_baocao.ThuocBaocaophatsinh(m_dtReport, baocaO_TIEUDE1.MA_BAOCAO, baocaO_TIEUDE1.TIEUDE,
                                                 dtNgayIn.Value, FromDateToDate,
                                                 Utility.sDbnull(txtKho.Text));
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Example #25
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);
            }
        }
Example #26
0
        void cmdIn_Click(object sender, EventArgs e)
        {
            try
            {
                if (objLuotkham == null)
                {
                    Utility.ShowMsg("Bạn cần chọn bệnh nhân in phiếu tạm ứng");
                    return;
                }
                if (grdTamung.GetDataRows().Count() <= 0)
                {
                    Utility.ShowMsg("Bạn cần chọn phiếu tạm ứng muốn in");
                    return;
                }
                if (!Utility.isValidGrid(grdTamung))
                {
                    grdTamung.MoveFirst();
                }
                DataTable m_dtReport = noitru_TamungHoanung.NoitruInphieutamung(Utility.Int64Dbnull(Utility.GetValueFromGridColumn(grdTamung, NoitruTamung.Columns.Id), -1));
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "noitru_phieutamung.xml");
                if (m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }
                string tieude = "", reportname = "";
                var    crpt = Utility.GetReport("noitru_phieutamung", ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }

                MoneyByLetter _moneyByLetter = new MoneyByLetter();
                var           objForm        = new frmPrintPreview(tieude, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);
                Utility.UpdateLogotoDatatable(ref m_dtReport);

                crpt.SetDataSource(m_dtReport);


                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = "noitru_phieutamung";
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address);
                Utility.SetParameterValue(crpt, "TelePhone", globalVariables.Branch_Phone);
                Utility.SetParameterValue(crpt, "sMoneyLetter", _moneyByLetter.sMoneyToLetter(Utility.Int32Dbnull(m_dtReport.Compute("SUM(so_tien)", "1=1"), 0).ToString()));
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(DateTime.Now));
                Utility.SetParameterValue(crpt, "sTitleReport", tieude);
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                objForm.crptViewer.ReportSource = crpt;

                if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewPhieuTamung))
                {
                    objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0);
                    objForm.ShowDialog();
                }
                else
                {
                    objForm.addTrinhKy_OnFormLoad();
                    crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai;
                    crpt.PrintToPrinter(objForm.getPrintNumber, false, 0, 0);
                }
            }
            catch (Exception)
            {
            }
        }
Example #27
0
        private void cmdInPhieuXN_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(cboKhoThuoc.Text))
                {
                    var query = (from chk in cboKhoThuoc.CheckedValues.AsEnumerable()
                                 let x = Utility.sDbnull(chk)
                                         select x).ToArray();
                    if (query.Count() > 0)
                    {
                        chuoiIDKhoThuoc = string.Join(",", query);
                    }
                }
                //Lấy giá trị xác nhận hết hạn hay chưa
                Int16 ishethan;
                if (radTatCa.Checked)
                {
                    ishethan = -1;
                }
                else if (radChuaHetHan.Checked)
                {
                    ishethan = 0;
                }
                else if (radDaHetHan.Checked)
                {
                    ishethan = 1;
                }
                else
                {
                    ishethan = -1;
                }
                //Truyền dữ liệu vào datatable
                DataTable m_dtReport = BAOCAO_THUOC.ThuocBaocaoSoluongtonthuoctheokho(chuoiIDKhoThuoc, Utility.Int32Dbnull(txtDrugID.Text, -1), Utility.Int32Dbnull(txtLoaithuoc.MyID, -1), ishethan, KIEU_THUOC_VT);
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_baocaothuocton_theokho.xml");
                //Truyền dữ liệu vào datagrid-view
                Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, false, true, "1=1", "");
                if (m_dtReport.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;
                }
                //Add stt vào datatable
                Utility.AddColumToDataTable(ref m_dtReport, "STT", typeof(Int32));
                int idx = 1;
                foreach (DataRow drv in m_dtReport.Rows)
                {
                    drv["STT"] = idx;
                    idx++;
                }
                m_dtReport.AcceptChanges();
                //Add logo vào datatable
                Utility.UpdateLogotoDatatable(ref m_dtReport);



                //Lấy chuỗi condition truyền vào biến ?FromDateToDate trên crpt
                string Condition = string.Format("Thuộc kho :{0} - Thuốc: {1}", string.IsNullOrEmpty(cboKhoThuoc.Text) ? "Tất cả" : cboKhoThuoc.Text,
                                                 string.IsNullOrEmpty(txtthuoc.Text) ? "Tất cả" : txtthuoc.Text);

                //Lấy tên người tạo báo cáo và gọi crpt
                string StaffName = globalVariables.gv_strTenNhanvien;
                string tieude = "", reportname = "";
                string tenbaocao = chkInbienbankiemke.Checked?"vt_bienban_kiemkevt":"vt_baocaovtton_theokho";
                if (KIEU_THUOC_VT == "THUOC")
                {
                    tenbaocao = chkInbienbankiemke.Checked ? "thuoc_bienban_kiemkethuoc" : "thuoc_baocaothuocton_theokho";
                }
                var crpt = Utility.GetReport(tenbaocao, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }

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

                frmPrintPreview objForm = new frmPrintPreview(baocaO_TIEUDE1.TIEUDE, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);
                crpt.SetDataSource(m_dtReport);

                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = tenbaocao;
                //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + "".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
                Utility.SetParameterValue(crpt, "ReportCondition", Condition);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "ReportTitle", baocaO_TIEUDE1.TIEUDE);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "DayOfWarning", nmrSongay.Value);
                Utility.SetParameterValue(crpt, "ngay_in", dtNgayInPhieu.Value.ToString("dd/MM/yyyy"));
                Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
            }
        }
        private void cmdInPhieuXN_Click(object sender, EventArgs e)
        {
            _dtData =
                SPs.BaocaoThongkeSokhambenh(dtFromDate.Value, dtToDate.Value,
                                            Utility.Int16Dbnull(cboDoituongKCB.SelectedValue, -1),
                                            Utility.Int16Dbnull(txtNhanvientiepdon.txtMyID, -1),
                                            Utility.sDbnull(cboKhoa.SelectedValue, "KKB"), thamso, Utility.Int16Dbnull(cboTinhTrang.SelectedValue, -1)).GetDataSet().
                Tables[0];

            Utility.SetDataSourceForDataGridEx(grdList, _dtData, true, true, "1=1", "");
            THU_VIEN_CHUNG.CreateXML(_dtData, "baocao_thongke_sokhambenh.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_sokhambenh";

            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ả", txtNhanvientiepdon.MyCode == "-1" ? "Tất cả" : txtNhanvientiepdon.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);
                //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);
            }
        }
Example #29
0
        /// <summary>
        /// hàm thực hiện in phiếu báo cáo
        /// thông tin
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdBaoCao_Click(object sender, EventArgs e)
        {
            try
            {
                string nhomthuoc = "-1";

                nhomthuoc = txtLoaithuoc.MyID.ToString();
                string fromdate       = "01/01/2000";
                string todate         = "01/01/2000";
                string _value         = "1";
                string _tondau        = "Tồn đầu";
                string _toncuoi       = "Tồn cuối";
                string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
                if (optThang.Checked)
                {
                    if (cboThang.SelectedIndex < 0)
                    {
                        Utility.ShowMsg("Bạn phải chọn Tháng báo cáo");
                        cboThang.Focus();
                        return;
                    }
                    _value         = cboThang.SelectedValue.ToString();
                    _tondau        = "Tồn đầu tháng " + _value;
                    _toncuoi       = "Tồn cuối tháng " + _value;
                    FromDateToDate = "Tháng " + _value;
                    switch (_value)
                    {
                    case "2":
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 29).ToString("dd/MM/yyyy");
                        break;

                    case "4":
                    case "6":
                    case "9":
                    case "11":
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 30).ToString("dd/MM/yyyy");
                        break;

                    default:
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 31).ToString("dd/MM/yyyy");
                        break;
                    }
                }
                else if (optQuy.Checked)
                {
                    if (cboQuy.SelectedIndex < 0)
                    {
                        Utility.ShowMsg("Bạn phải chọn Quý báo cáo");
                        cboQuy.Focus();
                        return;
                    }
                    _value         = cboQuy.SelectedValue.ToString();
                    _tondau        = "Tồn đầu quý " + _value;
                    _toncuoi       = "Tồn cuối quý " + _value;
                    FromDateToDate = "Quý " + _value;
                    switch (_value)
                    {
                    case "1":
                        fromdate = new DateTime(dtpNam.Value.Year, 1, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 3, 31).ToString("dd/MM/yyyy");
                        break;

                    case "2":
                        fromdate = new DateTime(dtpNam.Value.Year, 4, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 6, 30).ToString("dd/MM/yyyy");
                        break;

                    case "3":
                        fromdate = new DateTime(dtpNam.Value.Year, 7, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 9, 30).ToString("dd/MM/yyyy");
                        break;

                    case "4":
                        fromdate = new DateTime(dtpNam.Value.Year, 10, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 12, 31).ToString("dd/MM/yyyy");
                        break;

                    default:
                        fromdate = new DateTime(dtpNam.Value.Year, 1, 1).ToString("dd/MM/yyyy");
                        todate   = new DateTime(dtpNam.Value.Year, 12, 31).ToString("dd/MM/yyyy");
                        break;
                    }
                }
                else if (optNam.Checked)
                {
                    FromDateToDate = "Năm " + dtpNam.Value.Year.ToString();
                    _tondau        = "Tồn " + dtpNam.Value.AddYears(-1).Year.ToString();
                    _toncuoi       = "Tồn " + dtpNam.Value.Year.ToString();
                    fromdate       = new DateTime(dtpNam.Value.Year, 1, 1).ToString("dd/MM/yyyy");
                    todate         = new DateTime(dtpNam.Value.Year, 12, 31).ToString("dd/MM/yyyy");
                }
                else
                {
                    _tondau  = "Tồn đầu " + dtFromDate.Value.ToString("dd/MM/yyyy");
                    _toncuoi = "Tồn cuối " + dtToDate.Value.ToString("dd/MM/yyyy");
                    fromdate = dtFromDate.Value.ToString("dd/MM/yyyy");
                    todate   = dtToDate.Value.ToString("dd/MM/yyyy");
                }
                DataTable m_dtReport = null;

                m_dtReport = BAOCAO_THUOC.ThuocBaocaonhapxuatthuoc(fromdate,
                                                                   todate,
                                                                   lstStockID, nhomthuoc, Utility.Int32Dbnull(txtthuoc.MyID, -1), chkBiendong.Checked ? 1 : 0);


                Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, true, true, "1=1", "");
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "baocao_nhapxuatthuoc.xml");
                if (m_dtReport.Rows.Count <= 0)
                {
                    Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning);
                    return;
                }


                thuoc_baocao.BaocaoNhapxuatThuoc(m_dtReport, cboReportType.SelectedValue.ToString(), KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE, _tondau, _toncuoi,
                                                 dtNgayIn.Value, FromDateToDate,
                                                 Utility.sDbnull(cboKho.Text), chkTheoNhomThuoc.Checked);
            }
            catch (Exception)
            {
            }
        }
Example #30
0
        /// <summary>
        /// hàm thực hiên viecj in báo cáo doanh thu tiền khám chữa bệnh viện phí
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdInPhieuXN_Click(object sender, EventArgs e)
        {
            DataTable m_dtReport =
                BAOCAO_THUOC.ThuocBaocaoTinhhinhBenhnhanlinhthuoc(
                    chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                    chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                    Utility.Int32Dbnull(cboStock.SelectedValue, -1), Utility.Int32Dbnull(cboDoiTuong.SelectedValue, "-1"));

            Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, false, true, "1=1", "");
            Janus.Windows.GridEX.GridEXColumn gridExColumn = grdList.RootTable.Columns["THANH_TIEN"];


            decimal tonghuy = Utility.DecimaltoDbnull(grdList.GetTotal(gridExColumn, Janus.Windows.GridEX.AggregateFunction.Sum));

            THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_baocao_danhsachBenhnhan_linhthuoc");
            if (m_dtReport.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.AddColumToDataTable(ref m_dtReport, "STT", typeof(Int32));
            int idx = 1;

            foreach (DataRow drv in m_dtReport.Rows)
            {
                drv["STT"] = idx;
                idx++;
            }
            m_dtReport.AcceptChanges();
            Utility.UpdateLogotoDatatable(ref m_dtReport);
            string Condition = string.Format("Từ ngày {0} đến {1}- Đối tượng {2} - Thuộc kho :{3}", dtFromDate.Text, dtToDate.Text,
                                             cboDoiTuong.SelectedIndex > 0
                                                 ? Utility.sDbnull(cboDoiTuong.Text)
                                                 : "Tất cả",
                                             cboStock.SelectedIndex > 0
                                                 ? Utility.sDbnull(cboStock.Text)
                                                 : "Tất cả");

            //  Utility.AddColumToDataTable(ref m_dtReport, "SO_PHIEU_BARCODE", typeof(byte[]));
            // byte[] arrBarCode = Utility.GenerateBarCode(barcode);
            string StaffName = globalVariables.gv_strTenNhanvien;

            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                StaffName = globalVariables.UserName;
            }
            try
            {
                string         tieude = "", reportname = "";
                string         reportCode = kieuthuoc_vt == "THUOC" ? "thuoc_baocao_danhsachBenhnhan_linhthuoc" : "vt_baocao_danhsachBenhnhan_linhvt";
                ReportDocument crpt       = Utility.GetReport(reportCode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }
                frmPrintPreview objForm = new frmPrintPreview(baocaO_TIEUDE1.TIEUDE, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);
                //try
                //{
                crpt.SetDataSource(m_dtReport);

                objForm.mv_sReportFileName = Path.GetFileName(reportname);
                objForm.mv_sReportCode     = reportCode;
                //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + "".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
                // Utility.SetParameterValue(crpt,"ParentBranchName", globalVariables.ParentBranch_Name);
                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", baocaO_TIEUDE1.TIEUDE);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "Deparment_Name", globalVariables.KhoaDuoc);
                Utility.SetParameterValue(crpt, "txtTrinhky",
                                          Utility.getTrinhky(objForm.mv_sReportFileName,
                                                             globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
            }
        }