Example #1
0
        private void f_Xem()
        {
            string acurdir = System.Environment.CurrentDirectory;

            tmn_Export.Enabled = false;
            tmn_Xem.Enabled    = false;
            try
            {
                DataSet ads = f_Get_Data();
                if (ads.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show(lan.Change_language_MessageText("Không có số liệu!"), LibVP.AccessData.Msg);
                    return;
                }
                if (ads != null)
                {
                    string areport = "", asyt = "", abv = "", angayin = "", anguoiin = "", aghichu = "";
                    areport = "v_2007_bkhoantra.rpt";
                    if (rdBC_02.Checked)
                    {
                        areport = "v_2007_bkhoantra_trongngay.rpt";
                    }
                    else
                    if (rdBC_03.Checked)
                    {
                        areport = "v_2007_bkhoantra_khacngay.rpt";
                    }
                    if (rdBC_01.Checked && chkBHYTTraBnTra.Checked)
                    {
                        areport = "v_2007_bkhoantra_bhyt.rpt";
                        if (System.IO.File.Exists("..//..//..//report//" + areport) == false)
                        {
                            areport = "v_2007_bkhoantra.rpt";
                        }
                    }
                    asyt     = m_v.Syte;
                    abv      = m_v.Tenbv;
                    angayin  = lan.Change_language_MessageText("Ngày") + " " + txtNgayin.Value.Day.ToString().PadLeft(2, '0') + " " + lan.Change_language_MessageText("tháng") + " " + txtNgayin.Value.Month.ToString().PadLeft(2, '0') + " " + lan.Change_language_MessageText("năm") + " " + txtNgayin.Value.Year.ToString();
                    anguoiin = txtNguoilapphieu.Text.Trim();
                    if (rdThang.Checked)
                    {
                        aghichu = lan.Change_language_MessageText("Tháng:") + " " + txtThang.Value.ToString().PadLeft(2, '0') + " " + lan.Change_language_MessageText("Năm:") + " " + txtNam.Value.ToString();
                    }
                    else
                    {
                        aghichu = lan.Change_language_MessageText("Từ ngày:") + " " + txtTN.Text.Substring(0, 10) + " " + lan.Change_language_MessageText("Đến ngày:") + " " + txtDN.Text.Substring(0, 10);
                    }

                    if (!System.IO.Directory.Exists("..\\..\\Report_vp\\"))
                    {
                        System.IO.Directory.CreateDirectory("..\\Report_vp\\");
                    }
                    if (System.IO.Directory.Exists("..//..//datareport") == false)
                    {
                        System.IO.Directory.CreateDirectory("..//..//datareport");
                    }
                    ads.WriteXml("..//..//datareport//v_2007_bkhoantra.xml", XmlWriteMode.WriteSchema);
                    //
                    frmReport fa = new frmReport(m_v, ads.Tables[0], areport, asyt.ToUpper(), abv.ToUpper(), angayin, anguoiin, aghichu, txtNguoilapphieu.Text.Trim(), txtThuquy.Text.Trim(), txtKetoanvp.Text.Trim(), txtPhongtckt.Text.Trim(), "Bảng kê hoá đơn hoàn trả.", 1, chkXem.Checked?true:false);
                    fa.KetxuatExcel = bKetxuatExcel;
                    fa.ShowDialog();
                }
            }
            catch
            {
            }
            finally
            {
                System.Environment.CurrentDirectory = acurdir;
                tmn_Export.Enabled = true;
                tmn_Xem.Enabled    = true;
            }
        }
Example #2
0
        private void f_Xem()
        {
            string areport = "";
            string acurdir = System.Environment.CurrentDirectory;

            tmn_Export.Enabled = false;
            tmn_Xem.Enabled    = false;
            try
            {
                DataSet ads = f_Get_Data();
                if (ads != null)
                {
                    string asyt = "", abv = "", angayin = "", anguoiin = "", aghichu = "";
                    areport = "v_2007_bkthutamung.rpt";
                    if (rdBC_03.Checked)
                    {
                        areport = "v_2007_bkthutamung_conghoan.rpt";
                    }

                    if (cbMaubaocao.SelectedIndex > 0)
                    {
                        string areportt = areport.Replace(".rpt", "_" + cbMaubaocao.SelectedValue.ToString().Trim() + ".rpt");
                        if (System.IO.File.Exists("..\\..\\Report_vp\\" + areportt))
                        {
                            areport = areportt;
                        }
                    }

                    asyt     = m_v.Syte;
                    abv      = m_v.Tenbv;
                    angayin  = lan.Change_language_MessageText("Ngày") + " " + txtNgayin.Value.Day.ToString().PadLeft(2, '0') + " " + lan.Change_language_MessageText("tháng") + " " + txtNgayin.Value.Month.ToString().PadLeft(2, '0') + " " + lan.Change_language_MessageText("năm") + " " + txtNgayin.Value.Year.ToString();
                    anguoiin = txtNguoilapphieu.Text.Trim();
                    if (rdThang.Checked)
                    {
                        aghichu = lan.Change_language_MessageText("Tháng:") + " " + txtThang.Value.ToString().PadLeft(2, '0') + " " + lan.Change_language_MessageText("Năm:") + " " + txtNam.Value.ToString();
                    }
                    else
                    {
                        if (chkGio.Checked)
                        {
                            aghichu = lan.Change_language_MessageText("Từ ngày:") + " " + txtTN.Text.Substring(0, 16) + " " + lan.Change_language_MessageText("Đến ngày:") + " " + txtDN.Text.Substring(0, 16);
                        }
                        else
                        {
                            aghichu = lan.Change_language_MessageText("Từ ngày:") + " " + txtTN.Text.Substring(0, 10) + " " + lan.Change_language_MessageText("Đến ngày:") + " " + txtDN.Text.Substring(0, 10);
                        }
                    }

                    if (!System.IO.Directory.Exists("..//..//Datareport//"))
                    {
                        System.IO.Directory.CreateDirectory("..//..//Datareport//");
                    }
                    ads.WriteXml("..//..//Datareport//v_BKtamung.xml", XmlWriteMode.WriteSchema);

                    if (!System.IO.Directory.Exists("..\\..\\Report_vp\\"))
                    {
                        System.IO.Directory.CreateDirectory("..\\Report_vp\\");
                    }
                    if (ads.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show(lan.Change_language_MessageText("Không có số liệu!"), LibVP.AccessData.Msg);
                        return;
                    }


                    if ((chkInrieng.Checked == false && chkInchung.Checked == false) || chkInrieng.Checked)
                    {
                        frmReport fa = new frmReport(m_v, ads.Tables[0], areport, asyt.ToUpper(), abv.ToUpper(), angayin, anguoiin, aghichu, txtNguoilapphieu.Text.Trim(), txtThuquy.Text.Trim(), txtKetoanvp.Text.Trim(), txtPhongtckt.Text.Trim(), "Báo cáo thu viện phí trực tiếp", 1, chkXemkhiin.Checked?true:false);
                        fa.KetxuatExcel = bKetxuatExcel;
                        fa.ShowDialog();
                    }
                    if (chkInchung.Checked)
                    {
                        areport = areport.Replace(".rpt", "_inchung.rpt");
                        frmReport fa = new frmReport(m_v, ads.Tables[0], areport, asyt.ToUpper(), abv.ToUpper(), angayin, anguoiin, aghichu, txtNguoilapphieu.Text.Trim(), txtThuquy.Text.Trim(), txtKetoanvp.Text.Trim(), txtPhongtckt.Text.Trim(), "Báo cáo thu viện phí trực tiếp", 1, chkXemkhiin.Checked?true:false);
                        fa.KetxuatExcel = bKetxuatExcel;
                        fa.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(areport + "\n" + ex.ToString());
            }
            finally
            {
                System.Environment.CurrentDirectory = acurdir;
                tmn_Export.Enabled = true;
                tmn_Xem.Enabled    = true;
            }
        }