public frmBaoCaoNhapHang(string hanhDong, string path, Entities.ThongTinCongTy congty, Entities.XuatNhapTonTheoNhomHangHoa[] nhomHang, string theoKy, string ma, string maNhanVien, string tenBaoCao, string tenNhom)
 {
     InitializeComponent();
     try
     {
         if (this.hanhDong == null)
         {
             GUI.Report.rptXuatNhapHangTheoNhomHang nhom = new GUI.Report.rptXuatNhapHangTheoNhomHang();
             nhom.SetDataSource(nhomHang);
             rptView.ReportSource = nhom;
             nhom.SetParameterValue("TenCongTy", congty.TenCongTy);
             nhom.SetParameterValue("DiaChiCongTy", congty.DiaChi);
             nhom.SetParameterValue("DienThoai", congty.SoDienThoai);
             nhom.SetParameterValue("FaxCongTy", congty.Fax);
             nhom.SetParameterValue("Web", congty.Website);
             nhom.SetParameterValue("Email", congty.Email);
             nhom.SetParameterValue("TenBaoCao", tenBaoCao);
             nhom.SetParameterValue("Ky", theoKy);
             nhom.SetParameterValue("MaNhanVien", maNhanVien);
             nhom.SetParameterValue("MaNhom", ma);
             nhom.SetParameterValue("TenNhomHang", tenNhom);
             if (hanhDong == "Excel")
             {
                 new GUI.Report.ExportCrystalReport().Export(nhom, path, Report.ExportCrystalReport.TypeBC.Excel);
             }
             else if (hanhDong == "Word")
             {
                 new GUI.Report.ExportCrystalReport().Export(nhom, path, Report.ExportCrystalReport.TypeBC.WordForWindows);
             }
             else if (hanhDong == "PDF")
             {
                 new GUI.Report.ExportCrystalReport().Export(nhom, path, Report.ExportCrystalReport.TypeBC.PortableDocFormat);
             }
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
        /// <summary>
        /// show
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmBaoCaoNhapHang_Load(object sender, EventArgs e)
        {
            try
            {
                if (this.hanhDong != null)
                {
                    switch (this.hanhDong)
                    {
                    case "KhoHang":
                    {
                        GUI.Report.rptBaoCaoNhapHangTheoTungKho kho = new GUI.Report.rptBaoCaoNhapHangTheoTungKho();
                        kho.SetDataSource(data);
                        rptView.ReportSource = kho;
                        kho.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                        kho.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                        kho.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                        kho.SetParameterValue("FaxCongTy", this.congty.Fax);
                        kho.SetParameterValue("Web", this.congty.Website);
                        kho.SetParameterValue("Email", this.congty.Email);
                        kho.SetParameterValue("TenBaoCao", this.tenBaoCao);
                        kho.SetParameterValue("Ky", this.theoKy);
                        kho.SetParameterValue("MaNhanVien", this.maNhanVien);
                        kho.SetParameterValue("MaKho", this.ma);
                        rptView.Show();
                    } break;

                    case "MatHang":
                    {
                        GUI.Report.rptBaoCaoNhapHangTheoMatHang hang = new GUI.Report.rptBaoCaoNhapHangTheoMatHang();
                        hang.SetDataSource(mathang);
                        rptView.ReportSource = hang;
                        hang.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                        hang.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                        hang.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                        hang.SetParameterValue("FaxCongTy", this.congty.Fax);
                        hang.SetParameterValue("Web", this.congty.Website);
                        hang.SetParameterValue("Email", this.congty.Email);
                        hang.SetParameterValue("TenBaoCao", this.tenBaoCao);
                        hang.SetParameterValue("Ky", this.theoKy);
                        hang.SetParameterValue("MaNhanVien", this.maNhanVien);
                        hang.SetParameterValue("MaHangHoa", this.ma);
                        hang.SetParameterValue("TenHangHoa", this.tenHang);
                        rptView.Show();
                    } break;

                    case "NhomHang":
                    {
                        GUI.Report.rptBaoCaoNhaphangTheoNhomHang nhom = new GUI.Report.rptBaoCaoNhaphangTheoNhomHang();
                        nhom.SetDataSource(nhomhanghoa);
                        rptView.ReportSource = nhom;
                        nhom.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                        nhom.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                        nhom.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                        nhom.SetParameterValue("FaxCongTy", this.congty.Fax);
                        nhom.SetParameterValue("Web", this.congty.Website);
                        nhom.SetParameterValue("Email", this.congty.Email);
                        nhom.SetParameterValue("TenBaoCao", this.tenBaoCao);
                        nhom.SetParameterValue("Ky", this.theoKy);
                        nhom.SetParameterValue("MaNhanVien", this.maNhanVien);
                        nhom.SetParameterValue("MaNhomHang", this.ma);
                        nhom.SetParameterValue("TenNhomHangHoa", this.tenHang);
                        rptView.Show();
                    } break;

                    case "XuatNhapTonTheoNhomHang":
                    {
                        GUI.Report.rptXuatNhapHangTheoNhomHang nhom = new GUI.Report.rptXuatNhapHangTheoNhomHang();
                        nhom.SetDataSource(this.nhomHang);
                        rptView.ReportSource = nhom;
                        nhom.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                        nhom.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                        nhom.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                        nhom.SetParameterValue("FaxCongTy", this.congty.Fax);
                        nhom.SetParameterValue("Web", this.congty.Website);
                        nhom.SetParameterValue("Email", this.congty.Email);
                        nhom.SetParameterValue("TenBaoCao", this.tenBaoCao);
                        nhom.SetParameterValue("Ky", this.theoKy);
                        nhom.SetParameterValue("MaNhanVien", this.maNhanVien);
                        nhom.SetParameterValue("MaNhom", this.ma);
                        nhom.SetParameterValue("TenNhomHang", this.tenNhom);
                        rptView.Show();
                    } break;

                    default:
                    {
                        MessageBox.Show("Không có dữ liệu hiển thị");
                        this.Close();
                    } break;
                    }
                }
                else
                {
                }
            }
            catch (Exception ex)
            { string s = ex.Message; MessageBox.Show("Thất bại"); this.Close(); }
        }
 /// <summary>
 /// show
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmBaoCaoNhapHang_Load(object sender, EventArgs e)
 {
     try
     {
         if (this.hanhDong != null)
         {
             switch (this.hanhDong)
             {
                 case "KhoHang":
                     {
                         GUI.Report.rptBaoCaoNhapHangTheoTungKho kho = new GUI.Report.rptBaoCaoNhapHangTheoTungKho();
                         kho.SetDataSource(data);
                         rptView.ReportSource = kho;
                         kho.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                         kho.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                         kho.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                         kho.SetParameterValue("FaxCongTy", this.congty.Fax);
                         kho.SetParameterValue("Web", this.congty.Website);
                         kho.SetParameterValue("Email", this.congty.Email);
                         kho.SetParameterValue("TenBaoCao", this.tenBaoCao);
                         kho.SetParameterValue("Ky", this.theoKy);
                         kho.SetParameterValue("MaNhanVien", this.maNhanVien);
                         kho.SetParameterValue("MaKho", this.ma);
                         rptView.Show();
                     } break;
                 case "MatHang":
                     {
                         GUI.Report.rptBaoCaoNhapHangTheoMatHang hang = new GUI.Report.rptBaoCaoNhapHangTheoMatHang();
                         hang.SetDataSource(mathang);
                         rptView.ReportSource = hang;
                         hang.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                         hang.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                         hang.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                         hang.SetParameterValue("FaxCongTy", this.congty.Fax);
                         hang.SetParameterValue("Web", this.congty.Website);
                         hang.SetParameterValue("Email", this.congty.Email);
                         hang.SetParameterValue("TenBaoCao", this.tenBaoCao);
                         hang.SetParameterValue("Ky", this.theoKy);
                         hang.SetParameterValue("MaNhanVien", this.maNhanVien);
                         hang.SetParameterValue("MaHangHoa", this.ma);
                         hang.SetParameterValue("TenHangHoa", this.tenHang);
                         rptView.Show();
                     } break;
                 case "NhomHang":
                     {
                         GUI.Report.rptBaoCaoNhaphangTheoNhomHang nhom = new GUI.Report.rptBaoCaoNhaphangTheoNhomHang();
                         nhom.SetDataSource(nhomhanghoa);
                         rptView.ReportSource = nhom;
                         nhom.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                         nhom.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                         nhom.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                         nhom.SetParameterValue("FaxCongTy", this.congty.Fax);
                         nhom.SetParameterValue("Web", this.congty.Website);
                         nhom.SetParameterValue("Email", this.congty.Email);
                         nhom.SetParameterValue("TenBaoCao", this.tenBaoCao);
                         nhom.SetParameterValue("Ky", this.theoKy);
                         nhom.SetParameterValue("MaNhanVien", this.maNhanVien);
                         nhom.SetParameterValue("MaNhomHang", this.ma);
                         nhom.SetParameterValue("TenNhomHangHoa", this.tenHang);
                         rptView.Show();
                     } break;
                 case "XuatNhapTonTheoNhomHang":
                     {
                         GUI.Report.rptXuatNhapHangTheoNhomHang nhom = new GUI.Report.rptXuatNhapHangTheoNhomHang();
                         nhom.SetDataSource(this.nhomHang);
                         rptView.ReportSource = nhom;
                         nhom.SetParameterValue("TenCongTy", this.congty.TenCongTy);
                         nhom.SetParameterValue("DiaChiCongTy", this.congty.DiaChi);
                         nhom.SetParameterValue("DienThoai", this.congty.SoDienThoai);
                         nhom.SetParameterValue("FaxCongTy", this.congty.Fax);
                         nhom.SetParameterValue("Web", this.congty.Website);
                         nhom.SetParameterValue("Email", this.congty.Email);
                         nhom.SetParameterValue("TenBaoCao", this.tenBaoCao);
                         nhom.SetParameterValue("Ky", this.theoKy);
                         nhom.SetParameterValue("MaNhanVien", this.maNhanVien);
                         nhom.SetParameterValue("MaNhom", this.ma);
                         nhom.SetParameterValue("TenNhomHang", this.tenNhom);
                         rptView.Show();
                     } break;
                 default:
                     {
                         MessageBox.Show("Không có dữ liệu hiển thị");
                         this.Close();
                     } break;
             }
         }
         else
         { }
     }
     catch (Exception ex)
     { string s = ex.Message; MessageBox.Show("Thất bại"); this.Close(); }
 }
 public frmBaoCaoNhapHang(string hanhDong, string path, Entities.ThongTinCongTy congty, Entities.XuatNhapTonTheoNhomHangHoa[] nhomHang, string theoKy, string ma, string maNhanVien, string tenBaoCao, string tenNhom)
 {
     InitializeComponent();
     try
     {
         if (this.hanhDong == null)
         {
             GUI.Report.rptXuatNhapHangTheoNhomHang nhom = new GUI.Report.rptXuatNhapHangTheoNhomHang();
             nhom.SetDataSource(nhomHang);
             rptView.ReportSource = nhom;
             nhom.SetParameterValue("TenCongTy", congty.TenCongTy);
             nhom.SetParameterValue("DiaChiCongTy", congty.DiaChi);
             nhom.SetParameterValue("DienThoai", congty.SoDienThoai);
             nhom.SetParameterValue("FaxCongTy", congty.Fax);
             nhom.SetParameterValue("Web", congty.Website);
             nhom.SetParameterValue("Email", congty.Email);
             nhom.SetParameterValue("TenBaoCao", tenBaoCao);
             nhom.SetParameterValue("Ky", theoKy);
             nhom.SetParameterValue("MaNhanVien", maNhanVien);
             nhom.SetParameterValue("MaNhom", ma);
             nhom.SetParameterValue("TenNhomHang", tenNhom);
             if (hanhDong == "Excel")
             {
                 new GUI.Report.ExportCrystalReport().Export(nhom, path, Report.ExportCrystalReport.TypeBC.Excel);
             }
             else if (hanhDong == "Word")
             {
                 new GUI.Report.ExportCrystalReport().Export(nhom, path, Report.ExportCrystalReport.TypeBC.WordForWindows);
             }
             else if (hanhDong == "PDF")
             {
                 new GUI.Report.ExportCrystalReport().Export(nhom, path, Report.ExportCrystalReport.TypeBC.PortableDocFormat);
             }
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }