private void tbnExportBCThuChi_TongHopTheoNgay_Click()
        {
            try
            {
                string tungay  = date_TuNgay.Text;
                string denngay = date_DenNgay.Text;

                List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();
                reportExcelDTO        reportitem   = new reportExcelDTO();
                reportitem.name  = Base.bienTrongBaoCao.THOIGIANBAOCAO;
                reportitem.value = "( Từ " + tungay + " - " + denngay + " )";
                thongTinThem.Add(reportitem);

                reportExcelDTO item_loai = new reportExcelDTO()
                {
                    name  = "LOAICHUNGTU",
                    value = cboLoaiChungTu_TK.Text,
                };
                thongTinThem.Add(item_loai);

                string    fileTemplatePath = "BC_QuanLyThuChi_TongHop.xlsx";
                DataTable _dataBC          = O2S_Common.DataTables.Convert.ListToDataTable(this.lstHoaDonThuChi);
                Utilities.Excel.ExcelExport.ExportExcelTemplate("", fileTemplatePath, thongTinThem, _dataBC);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
        private void btnInAn_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));

                string tungay  = DateTime.ParseExact(date_TuNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy");
                string denngay = DateTime.ParseExact(date_DenNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy");

                string tungaydenngay = "( Từ " + tungay + " - " + denngay + " )";

                List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();
                reportExcelDTO        reportitem   = new reportExcelDTO();
                reportitem.name  = Base.bienTrongBaoCao.THOIGIANBAOCAO;
                reportitem.value = tungaydenngay;
                thongTinThem.Add(reportitem);

                string    fileTemplatePath = "FUN_QuanLyHocVien_ChinhThuc.xlsx";
                DataTable _databaocao      = O2S_Common.DataTables.Convert.ListToDataTable(this.lstHocVien);
                Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, _databaocao);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            SplashScreenManager.CloseForm();
        }
Beispiel #3
0
        private void btnXuatExcel_Click(object sender, EventArgs e)
        {
            try
            {
                string tungay  = DateTime.ParseExact(date_TuNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy");
                string denngay = DateTime.ParseExact(date_DenNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy");

                string tungaydenngay = "( Từ " + tungay + " - " + denngay + " )";

                List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();
                reportExcelDTO        reportitem   = new reportExcelDTO();
                reportitem.name  = Base.bienTrongBaoCao.THOIGIANBAOCAO;
                reportitem.value = tungaydenngay;
                thongTinThem.Add(reportitem);

                string    fileTemplatePath = "BC02_HocVienGhiDanh.xlsx";
                DataTable _databaocao      = O2S_Common.DataTables.Convert.ListToDataTable(this._lstPhieuGhiDanh);

                Utilities.Excel.ExcelExport.ExportExcelTemplate("", fileTemplatePath, thongTinThem, _databaocao);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
        private void btnInAn_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));

                string tungay  = DateTime.ParseExact(date_TuNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy");
                string denngay = DateTime.ParseExact(date_DenNgay.Text, "HH:mm:ss dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("HH:mm dd/MM/yyyy");

                string tungaydenngay = "( Từ " + tungay + " - " + denngay + " )";

                List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();
                reportExcelDTO        reportitem   = new reportExcelDTO();
                reportitem.name  = Base.bienTrongBaoCao.THOIGIANBAOCAO;
                reportitem.value = tungaydenngay;
                thongTinThem.Add(reportitem);

                //khoa hoc, lop hoc
                int     _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString());
                KHOAHOC _khoahoc   = KhoaHocLogic.SelectSingle(_KhoaHocId);
                int     _lophocId  = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString());
                LOPHOC  _lophoc    = LopHocLogic.SelectSingle(_lophocId);

                reportExcelDTO _item_makhoahoc = new reportExcelDTO()
                {
                    name  = Base.bienTrongBaoCao.MAKHOAHOC,
                    value = _khoahoc.MaKhoaHoc,
                };
                thongTinThem.Add(_item_makhoahoc);
                reportExcelDTO _item_tenkhoahoc = new reportExcelDTO()
                {
                    name  = Base.bienTrongBaoCao.TENKHOAHOC,
                    value = _khoahoc.TenKhoaHoc,
                };
                thongTinThem.Add(_item_tenkhoahoc);
                //
                reportExcelDTO _item_malophoc = new reportExcelDTO()
                {
                    name  = Base.bienTrongBaoCao.MALOPHOC,
                    value = _lophoc.MaLopHoc,
                };
                thongTinThem.Add(_item_malophoc);
                reportExcelDTO _item_tenlophoc = new reportExcelDTO()
                {
                    name  = Base.bienTrongBaoCao.TENLOPHOC,
                    value = _lophoc.TenLopHoc,
                };
                thongTinThem.Add(_item_tenlophoc);

                string    fileTemplatePath = "BC03_ThongKeTheoDoiDiem.xlsx";
                DataTable _databaocao      = O2S_Common.DataTables.Convert.ListToDataTable(this.lstBangDiem);
                Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, _databaocao);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            SplashScreenManager.CloseForm();
        }
        private void btnInAn_DSLop_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));
                if (cboLopHoc.SelectedValue != null)
                {
                    List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();

                    //khoa hoc, lop hoc
                    int     _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString());
                    KHOAHOC _khoahoc   = KhoaHocLogic.SelectSingle(_KhoaHocId);
                    int     _lophocId  = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString());
                    LOPHOC  _lophoc    = LopHocLogic.SelectSingle(_lophocId);

                    reportExcelDTO _item_makhoahoc = new reportExcelDTO()
                    {
                        name  = Base.bienTrongBaoCao.MAKHOAHOC,
                        value = _khoahoc.MaKhoaHoc,
                    };
                    thongTinThem.Add(_item_makhoahoc);
                    reportExcelDTO _item_tenkhoahoc = new reportExcelDTO()
                    {
                        name  = Base.bienTrongBaoCao.TENKHOAHOC,
                        value = _khoahoc.TenKhoaHoc,
                    };
                    thongTinThem.Add(_item_tenkhoahoc);
                    //
                    reportExcelDTO _item_malophoc = new reportExcelDTO()
                    {
                        name  = Base.bienTrongBaoCao.MALOPHOC,
                        value = _lophoc.MaLopHoc,
                    };
                    thongTinThem.Add(_item_malophoc);
                    reportExcelDTO _item_tenlophoc = new reportExcelDTO()
                    {
                        name  = Base.bienTrongBaoCao.TENLOPHOC,
                        value = _lophoc.TenLopHoc,
                    };
                    thongTinThem.Add(_item_tenlophoc);

                    List <XepLopDTO> _lstXepLop = BangDiemLogic.SelectDSHV_Lop(_lophocId);

                    string    fileTemplatePath = "FUN_XepLop_DanhSachLopHoc.xlsx";
                    DataTable _databaocao      = O2S_Common.DataTables.Convert.ListToDataTable(_lstXepLop);
                    Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, _databaocao);
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            SplashScreenManager.CloseForm();
        }
        private void tbnPrintBCThuChi_TongHopTheoNgay_Click()
        {
            SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));
            try
            {
                try
                {
                    string tungay  = date_TuNgay.Text;
                    string denngay = date_DenNgay.Text;

                    List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();
                    reportExcelDTO        reportitem   = new reportExcelDTO();
                    reportitem.name  = Base.bienTrongBaoCao.THOIGIANBAOCAO;
                    reportitem.value = "( Từ " + tungay + " - " + denngay + " )";
                    thongTinThem.Add(reportitem);

                    reportExcelDTO item_loai = new reportExcelDTO()
                    {
                        name  = "LOAICHUNGTU",
                        value = cboLoaiChungTu_TK.Text,
                    };
                    thongTinThem.Add(item_loai);

                    string    fileTemplatePath = "BC_QuanLyThuChi_TongHop.xlsx";
                    DataTable _dataBC          = O2S_Common.DataTables.Convert.ListToDataTable(this.lstHoaDonThuChi);
                    Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, _dataBC);
                }
                catch (Exception ex)
                {
                    O2S_Common.Logging.LogSystem.Warn(ex);
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
            SplashScreenManager.CloseForm();
        }
        private void InBienLaiThuTien(PHIEUTHU _phieuthu)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));

                PHIEUGHIDANH _phieughidanh = PhieuGhiDanhLogic.SelectSingle(_phieuthu.PhieuGhiDanhId ?? 0);


                var rowHandle = gridViewDSHocVien.FocusedRowHandle;
                List <reportExcelDTO> thongTinThem = new List <reportExcelDTO>();

                reportExcelDTO item_MAPHIEUTHU = new reportExcelDTO();
                item_MAPHIEUTHU.name  = "MAPHIEUTHU";
                item_MAPHIEUTHU.value = _phieuthu.MaPhieuThu;
                thongTinThem.Add(item_MAPHIEUTHU);

                reportExcelDTO item_MAHOCVIEN = new reportExcelDTO();
                item_MAHOCVIEN.name  = "MAHOCVIEN";
                item_MAHOCVIEN.value = lblMaHocVien.Text;
                thongTinThem.Add(item_MAHOCVIEN);

                reportExcelDTO item_TENHOCVIEN = new reportExcelDTO();
                item_TENHOCVIEN.name  = "TENHOCVIEN";
                item_TENHOCVIEN.value = lblTenHocVien.Text;
                thongTinThem.Add(item_TENHOCVIEN);

                reportExcelDTO item_DIACHI = new reportExcelDTO();
                item_DIACHI.name  = "DIACHI";
                item_DIACHI.value = gridViewDSHocVien.GetRowCellValue(rowHandle, "DiaChi").ToString();
                thongTinThem.Add(item_DIACHI);

                reportExcelDTO item_KHOAHOC = new reportExcelDTO();
                item_KHOAHOC.name  = "KHOAHOC";
                item_KHOAHOC.value = gridViewDSHocVien.GetRowCellValue(rowHandle, "TenKhoaHoc").ToString();
                thongTinThem.Add(item_KHOAHOC);

                DateTime       _namsinh     = O2S_Common.TypeConvert.Parse.ToDateTime(gridViewDSHocVien.GetRowCellValue(rowHandle, "NgaySinh").ToString());
                reportExcelDTO item_NAMSINH = new reportExcelDTO();
                item_NAMSINH.name  = "NAMSINH";
                item_NAMSINH.value = _namsinh.ToString("dd/MM/yyyy");
                thongTinThem.Add(item_NAMSINH);

                reportExcelDTO item_LOPHOC = new reportExcelDTO();
                item_LOPHOC.name  = "LOPHOC";
                item_LOPHOC.value = gridViewDSHocVien.GetRowCellValue(rowHandle, "TenLopHoc").ToString();
                thongTinThem.Add(item_LOPHOC);
                //
                reportExcelDTO item_TONGTIEN = new reportExcelDTO()
                {
                    name  = "TONGTIEN",
                    value = O2S_Common.Number.Convert.NumberToString(_phieughidanh.TongTien ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_TONGTIEN);

                reportExcelDTO item_MIENGIAM_TIEN = new reportExcelDTO()
                {
                    name  = "MIENGIAM_TIEN",
                    value = O2S_Common.Number.Convert.NumberToString(_phieughidanh.MienGiam_Tien ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_MIENGIAM_TIEN);

                reportExcelDTO item_CONNO = new reportExcelDTO()
                {
                    name  = "CONNO",
                    value = O2S_Common.Number.Convert.NumberToString(_phieughidanh.ConNo ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_CONNO);

                reportExcelDTO item_SOTIEN = new reportExcelDTO()
                {
                    name  = "SOTIEN",
                    value = O2S_Common.Number.Convert.NumberToString(_phieuthu.SoTien ?? 0, 0) + " đ",
                };
                thongTinThem.Add(item_SOTIEN);

                reportExcelDTO item_sotienchu = new reportExcelDTO();
                item_sotienchu.name  = "SOTIENBANGCHU";
                item_sotienchu.value = O2S_Common.Strings.Convert.CurrencyToVneseString(O2S_Common.Number.Convert.NumberToNumberRoundAuto(_phieuthu.SoTien ?? 0, 0).ToString());
                thongTinThem.Add(item_sotienchu);

                //
                DataTable dataExport = new DataTable();
                dataExport.Columns.Add("STT", typeof(string));
                dataExport.Columns.Add("KHOANTHU", typeof(string));
                dataExport.Columns.Add("SOTIEN", typeof(string));
                dataExport.Columns.Add("GHICHU", typeof(string));
                HocPhiHocVienFilter _filter = new HocPhiHocVienFilter()
                {
                    PhieuThuId = _phieuthu.PhieuThuId,
                    HocVienId  = this.HocVienId_Select,
                };
                List <HocPhiHocVien_PlusDTO> _lsthocPhiHV = HocPhiHocVienLogic.Select(_filter);
                if (_lsthocPhiHV != null && _lsthocPhiHV.Count > 0)
                {
                    _lsthocPhiHV.OrderBy(o => o.Stt).ToList();
                    for (int i = 0; i < _lsthocPhiHV.Count; i++)
                    {
                        DataRow newRow_khac = dataExport.NewRow();
                        newRow_khac["STT"]      = _lsthocPhiHV[i].Stt;
                        newRow_khac["KHOANTHU"] = _lsthocPhiHV[i].TenDichVu == null ? "" : _lsthocPhiHV[i].TenDichVu;
                        newRow_khac["SOTIEN"]   = O2S_Common.Number.Convert.NumberToString(O2S_Common.TypeConvert.Parse.ToDecimal(_lsthocPhiHV[i].SoTien.ToString()), 0);
                        newRow_khac["GHICHU"]   = _lsthocPhiHV[i].GhiChu == null ? "" : _lsthocPhiHV[i].GhiChu;
                        dataExport.Rows.Add(newRow_khac);
                    }
                }

                string fileTemplatePath = LuaChonTemplateInBienLai(_lsthocPhiHV);

                Utilities.Prints.PrintPreview.ShowPrintPreview_UsingExcelTemplate(fileTemplatePath, thongTinThem, dataExport);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            SplashScreenManager.CloseForm();
        }