예제 #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);
     }
 }
 private void cmdBaoCao_Click(object sender, EventArgs e)
 {
     try
     {
         string manhacungcap = Utility.DoTrim(txtNhacungcap.myCode);
         if (manhacungcap == "")
         {
             manhacungcap = "ALL";
         }
         DataTable m_dtReport =
             BAOCAO_THUOC.ThuocBaocaoThuoctheonhacungcap(chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"),
                                                         chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate,
                                                         Utility.Int32Dbnull(cboKho.SelectedValue), manhacungcap, KIEU_THUOC_VT, Utility.Bool2byte(chkPhieuvay.Checked));
         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);
         VNS.HIS.UI.Baocao.thuoc_baocao.baocao_nhapthuoctheo_nhacungcap(m_dtReport, KIEU_THUOC_VT == "THUOC"?"thuoc_baocao_nhapkho_theonhacungcap":"vt_baocao_nhapkho_theonhacungcap", baocaO_TIEUDE1.TIEUDE, dtNgayIn.Value, FromDateToDate);
     }
     catch (Exception)
     {
     }
 }
예제 #3
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();


                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)
            {
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
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)
     {
     }
 }
        /// <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.ThuocBaocaoTinhhinhPhatthuocbenhnhan(
                    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"), chkThongketheongaychot.Checked ? 1 : 0,
                    kieuthuoc_vt);

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

            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_chitiet_thuoccapphat_benhnhan"
                                        : "vt_baocao_chitiet_vtcapphat_benhnhan";
                ReportDocument crpt = Utility.GetReport(reportCode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }
                var objForm = new frmPrintPreview(baocaO_TIEUDE1.txtTieuDe.Text, 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", 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();
                //Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_INGIAYXINNOP_TIENTHUOC", "0", false), 0m)
                if (THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_INGIAYXINNOP_TIENTHUOC", "0", false) == "1")
                {
                    string tieude2 = "", reportname2 = "";
                    string reportCode2 = kieuthuoc_vt == "THUOC"
                                             ? "thuoc_baocao_giayxinnop_tienthuoc"
                                             : "vt_baocao_chitiet_vtcapphat_benhnhan";
                    ReportDocument crpt2 = Utility.GetReport(reportCode2, ref tieude2, ref reportname2);
                    if (crpt2 == null)
                    {
                        return;
                    }
                    var objForm2 = new frmPrintPreview(baocaO_TIEUDE1.txtTieuDe.Text, crpt2, true,
                                                       m_dtReport.Rows.Count <= 0 ? false : true);
                    //try
                    //{
                    crpt2.SetDataSource(m_dtReport);

                    objForm2.mv_sReportFileName = Path.GetFileName(reportname2);
                    objForm2.mv_sReportCode     = reportCode2;
                    //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(crpt2, "StaffName", StaffName);
                    Utility.SetParameterValue(crpt2, "BranchName", globalVariables.Branch_Name);
                    Utility.SetParameterValue(crpt2, "Address", globalVariables.Branch_Address);
                    Utility.SetParameterValue(crpt2, "Phone", globalVariables.Branch_Phone);
                    Utility.SetParameterValue(crpt2, "FromDateToDate", Condition);
                    Utility.SetParameterValue(crpt2, "sTitleReport", tieude2);
                    Utility.SetParameterValue(crpt2, "sCurrentDate",
                                              Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                    Utility.SetParameterValue(crpt2, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                    Utility.SetParameterValue(crpt2, "Deparment_Name", globalVariables.KhoaDuoc);
                    Utility.SetParameterValue(crpt2, "txtTrinhky",
                                              Utility.getTrinhky(objForm2.mv_sReportFileName,
                                                                 globalVariables.SysDate));
                    objForm2.crptViewer.ReportSource = crpt2;
                    objForm2.ShowDialog();
                }
            }
            catch (Exception exception)
            {
                Utility.ShowMsg("Lỗi:" + exception.Message);
            }
        }
        /// <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);
            }
        }
예제 #8
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)
            {
            }
        }
예제 #9
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)
            {
            }
        }
        /// <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)
        {
            _mabschidinh = "-1";
            _idThuoc     = -1;
            // Lấy Id Bác sỹ
            if (!string.IsNullOrEmpty(cboBacSyChiDinh.Text))
            {
                var query = (from chk in cboBacSyChiDinh.CheckedValues.AsEnumerable()
                             let x = Utility.sDbnull(chk)
                                     select x).ToArray();
                if (query.Count() > 0)
                {
                    _mabschidinh = string.Join(",", query);
                }
            }

            //Truyền dữ liệu vào datatable
            DataTable m_dtReport = BAOCAO_THUOC.ThuocBaocaoTinhhinhkedonthuocTheobacsy(Utility.Int32Dbnull(cboStock.SelectedValue, -1), Utility.Int32Dbnull(cboDoiTuong.SelectedValue, -1),
                                                                                       _mabschidinh, _idThuoc, chkByDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"), chkByDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.Int16Dbnull(cboTrangthai.SelectedValue, -1));

            if (m_dtReport == null)
            {
                return;
            }
            THU_VIEN_CHUNG.CreateXML(m_dtReport, "thuoc_baocaokedon_theobacsy.xml");
            //Kiểm tra dữ liệu
            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;
            }
            //Truyền tổng tiền vào text và chuyển qua tiền bằng chữ
            Janus.Windows.GridEX.GridEXColumn gridExColumnTong = grdList.RootTable.Columns["thanh_tien"];
            decimal tong =
                Utility.DecimaltoDbnull(grdList.GetTotal(gridExColumnTong, Janus.Windows.GridEX.AggregateFunction.Sum));


            m_dtReport.AcceptChanges();
            Utility.UpdateLogotoDatatable(ref m_dtReport);
            //Truyền dữ liệu vào datagrid-view
            Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, false, true, "1=1", "");
            //Lấy chuỗi condition truyền vào biến ?FromDateToDate trên crpt
            string Condition = string.Format("Từ ngày {0} đến {1}- Đối tượng {2} - Thuộc kho :{3} - Bác sỹ: {4}", dtFromDate.Text, dtToDate.Text,
                                             cboDoiTuong.SelectedIndex > 0
                                                 ? Utility.sDbnull(cboDoiTuong.SelectedValue)
                                                 : "Tất cả",
                                             cboStock.SelectedIndex > 0
                                                 ? Utility.sDbnull(cboStock.SelectedValue)
                                                 : "Tất cả",
                                             string.IsNullOrEmpty(cboBacSyChiDinh.Text) ? "Tất cả" : cboBacSyChiDinh.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 = "";
            var    crpt = Utility.GetReport("thuoc_baocaokedon_theobacsy", ref tieude, ref reportname);

            if (crpt == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(globalVariables.gv_strTenNhanvien))
            {
                StaffName = globalVariables.UserName;
            }
            try
            {
                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     = "thuoc_baocaokedon_theobacsy";
                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, "TienBangChu", _moneyByLetter.sMoneyToLetter(tong.ToString()));
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                Utility.SetParameterValue(crpt, "Department_Name", globalVariables.KhoaDuoc);
                Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate));
                objForm.crptViewer.ReportSource = crpt;
                objForm.ShowDialog();
            }
            catch (Exception exception)
            {
            }
        }
예제 #11
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");
                }


                m_dtReport = BAOCAO_THUOC.VacxinBaocaoPhanungnangSautiemchung(fromdate, todate, Utility.DoTrim(txtTenBN.Text), Utility.ByteDbnull(txtGioitinh.myCode, 3), nhomthuoc, Utility.Int32Dbnull(txtthuoc.MyID, -1));


                string _sort = "stt_hthi_loaithuoc,tenthuoc_bietduoc";
                Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, true, true, "1=1", _sort);
                UpdateGroup();
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "vacxin_baocao_phanungnang_sautiemchung.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.BaocaoPhanungnangSautiemchung(m_dtReport, dtNgayIn.Value, FromDateToDate, chkTheoNhomThuoc.Checked);
            }
            catch (Exception)
            {
            }
        }
예제 #12
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";
                if (cboKho.SelectedIndex < 0)
                {
                    Utility.ShowMsg("Bạn phải chọn Kho thuốc để xem thẻ thuốc");
                    cboKho.Focus();
                    return;
                }
                if (txtthuoc.MyCode == "-1")
                {
                    Utility.ShowMsg("Bạn phải chọn thuốc để xem thẻ thuốc");
                    txtthuoc.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");
                }
                m_dtReport =
                    BAOCAO_THUOC.ThuocThethuocChitiet(fromdate, todate,
                                                      Utility.Int32Dbnull(cboKho.SelectedValue), Utility.Int32Dbnull(txtthuoc.MyID, -1),
                                                      nhomthuoc, chkBiendong.Checked ? 1 : 0);
                if (_item != null && Utility.Byte2Bool(_item.LaTuthuoc))
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport, "Thuoc_sochitietvatlieu.xml");
                }

                Utility.SetDataSourceForDataGridEx(grdListChitiet, 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", MessageBoxIcon.Warning);
                    return;
                }
                string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);


                ProcessDataChitiet(ref m_dtReport);
                thuoc_baocao.ThethuocChitiet(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                             dtNgayIn.Value, FromDateToDate,
                                             Utility.sDbnull(cboKho.Text));
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
예제 #13
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 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();
                    FromDateToDate = "Tháng " + _value;
                    switch (_value)
                    {
                    case "2":
                        fromdate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 1).ToString("dd/MM/yyyy");
                        try
                        {
                            todate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 29).ToString("dd/MM/yyyy");
                        }
                        catch (Exception ex)
                        {
                            todate = new DateTime(dtpNam.Value.Year, Utility.Int32Dbnull(_value, 2), 28).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();
                    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();
                    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");
                }
                DataTable m_dtReport = null;

                m_dtReport = BAOCAO_THUOC.ThuocBaocaohuychot(fromdate,
                                                             todate,
                                                             Utility.Int32Dbnull(cboKho.SelectedValue), nhomthuoc, Utility.Int32Dbnull(txtthuoc.MyID, -1), Utility.Bool2byte(optHuychot.Checked));


                Utility.SetDataSourceForDataGridEx(grdList, m_dtReport, true, true, "1=1", "");
                THU_VIEN_CHUNG.CreateXML(m_dtReport, "baocao_xuatnhapton_theoquy.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.Baocaohuychot(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE, FromDateToDate, chkTheoNhomThuoc.Checked);
            }
            catch (Exception)
            {
            }
        }
예제 #14
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";
                if (cboKho.SelectedIndex < 0)
                {
                    Utility.ShowMsg("Bạn phải chọn Kho thuốc để xem thẻ thuốc");
                    cboKho.Focus();
                    return;
                }
                if (txtthuoc.MyCode == "-1")
                {
                    Utility.ShowMsg("Bạn phải chọn thuốc để xem thẻ thuốc");
                    txtthuoc.Focus();
                    return;
                }
                nhomthuoc = txtLoaithuoc.MyID.ToString();
                DataTable m_dtReport = null;
                if (chkSimple.Checked)
                {
                    m_dtReport =
                        BAOCAO_THUOC.ThuocThethuoc(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);
                }
                else
                {
                    if (chkThekhochitiet.Checked)
                    {
                        if (_item != null && Utility.Byte2Bool(_item.LaTuthuoc))
                        {
                            m_dtReport =
                                BAOCAO_THUOC.ThuocThethuocTutrucChitiet(
                                    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);
                        }
                        else
                        {
                            m_dtReport =
                                BAOCAO_THUOC.ThuocThethuocChitiet(
                                    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);
                        }
                    }
                    else
                    {
                        if (_item != null && Utility.Byte2Bool(_item.LaTuthuoc))
                        {
                            m_dtReport =
                                BAOCAO_THUOC.ThuocThethuocTutruc(
                                    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);
                        }
                        else

                        {
                            if (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked))
                            {
                                m_dtReport =
                                    BAOCAO_THUOC.ThuocThethuocKhochan(
                                        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);
                            }
                            else
                            {
                                m_dtReport =
                                    BAOCAO_THUOC.ThuocThethuocKhole(
                                        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);
                            }
                        }
                    }
                }
                if (_item != null && Utility.Byte2Bool(_item.LaTuthuoc))
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport,
                                             chkThekhochitiet.Checked
                                                 ? "ThuocThethuocTutrucChitiet.xml"
                                                 : "ThuocThethuocTutruc.xml");
                }
                else
                {
                    THU_VIEN_CHUNG.CreateXML(m_dtReport,
                                             chkThekhochitiet.Checked
                                                 ? "thethuoc_chitiet.xml"
                                                 : (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked)
                                                        ? "Thethuoc_khochan.xml"
                                                        : "Thethuoc_khole.xml"));
                }
                Utility.SetDataSourceForDataGridEx(
                    chkSimple.Checked
                        ? grdThethuoc
                        : (
                        chkThekhochitiet.Checked
                                  ? grdListChitiet
                                  : (
                            _item != null && Utility.Byte2Bool(_item.LaTuthuoc)
                                            ? grdThethuoctutruc
                                            : (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked)
                                                   ? grdListKhoChan
                                                   : grdListKhole)
                            )
                        )
                    , 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", MessageBoxIcon.Warning);
                    return;
                }
                string FromDateToDate = Utility.FromToDateTime(dtFromDate.Text, dtToDate.Text);
                if (chkSimple.Checked)
                {
                    ProcessDataThethuoc(ref m_dtReport);
                    thuoc_baocao.Thethuoc(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                          dtNgayIn.Value, FromDateToDate,
                                          Utility.sDbnull(cboKho.Text));
                }
                else
                {
                    if (chkThekhochitiet.Checked)
                    {
                        ProcessDataChitiet(ref m_dtReport);
                        thuoc_baocao.ThethuocChitiet(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                     dtNgayIn.Value, FromDateToDate,
                                                     Utility.sDbnull(cboKho.Text));
                    }
                    else
                    {
                        if (_item != null && Utility.Byte2Bool(_item.LaTuthuoc))
                        {
                            ProcessDataTutruc(ref m_dtReport);
                            thuoc_baocao.Thethuoctutruc(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                        dtNgayIn.Value, FromDateToDate,
                                                        Utility.sDbnull(cboKho.Text));
                        }
                        else
                        {
                            if (_item.KieuKho == "CHAN" || (chkChanle.Enabled && chkChanle.Checked))
                            {
                                ProcessDataKhochan(ref m_dtReport);
                                thuoc_baocao.Thethuockhochan(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                             dtNgayIn.Value, FromDateToDate,
                                                             Utility.sDbnull(cboKho.Text));
                            }
                            else
                            {
                                ProcessDataKhole(ref m_dtReport);
                                thuoc_baocao.ThethuocKhole(m_dtReport, KIEU_THUOC_VT, baocaO_TIEUDE1.TIEUDE,
                                                           dtNgayIn.Value, FromDateToDate,
                                                           Utility.sDbnull(cboKho.Text));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
예제 #15
0
        private void cmdInTonKho_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable m_dtReport = BAOCAO_THUOC.ThuocBaocaoInTonKhoThuoc(Utility.Int32Dbnull(txtkho.MyID),
                                                                             Utility.Int32Dbnull(-1), Utility.Int32Dbnull(-1), -1, 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}", string.IsNullOrEmpty(txtkho.MyText));

                //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 _reportCode = "thuoc_baocao_intonkhothuoc";
                var    crpt        = Utility.GetReport(_reportCode, ref tieude, ref reportname);
                if (crpt == null)
                {
                    return;
                }

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

                frmPrintPreview objForm = new frmPrintPreview("BÁO CÁO THUỐC TỒN KHO", crpt, true, m_dtReport.Rows.Count <= 0 ? false : true);
                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, "ReportCondition", Condition);
                Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name);
                Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name);
                Utility.SetParameterValue(crpt, "ReportTitle", tieude);
                Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(dtNgayInPhieu.Value));
                Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition());
                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)
            {
                Utility.ShowMsg("Lỗi:" + exception.Message
                                );
            }
        }