private void ucHoatDongHoiThaoTapHuan_Load(object sender, EventArgs e) { registerButtonArray(btnControl); deSearchTuNgay.Ex_FormatCustomDateEdit(); deSearchDenNgay.Ex_FormatCustomDateEdit(); deTuNgay.Ex_FormatCustomDateEdit(); deDenNgay.Ex_FormatCustomDateEdit(); seThuLaoGV.Ex_FormatCustomSpinEdit(); seThuLaoHoTro.Ex_FormatCustomSpinEdit(); seSoLuongNguoiThamGia.Ex_FormatCustomSpinEdit(); seSoTienMoiNguoi.Ex_FormatCustomSpinEdit(); seTongTien.Ex_FormatCustomSpinEdit(); var current = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); var nextMonth = current.AddMonths(1); deSearchTuNgay.DateTime = current; deSearchDenNgay.DateTime = nextMonth.AddDays(-1); lueLoaiTapHuan.Properties.DataSource = FuncCategory.loadDMTapHuan(); lueLoaiTapHuan.EditValue = _id_loai; _changeLayout((CategoryTapHuan)_id_loai); FormStatus = EnumFormStatus.VIEW; }
private void _loadData() { WaitDialogForm _wait = new WaitDialogForm("Đang tải dữ liệu ...", "Vui lòng đợi giây lát"); context = new QL_HOIVIEN_KTEntities(); context.QL_HOATDONG_TAPHUAN.Load(); var listDMHoiThao = FuncCategory.loadDMTapHuan(); var data = (from p in context.QL_HOATDONG_TAPHUAN where deTuNgay.DateTime.Date <= p.TH_THOIGIAN_BATDAU && p.TH_THOIGIAN_BATDAU <= deDenNgay.DateTime.Date select p).ToList(); List <clsTongKetHoatDong> lists = new List <clsTongKetHoatDong>(); foreach (QL_HOATDONG_TAPHUAN row in data) { clsTongKetHoatDong item = new clsTongKetHoatDong(); item.HD_ID = row.TH_ID; item.HD_TEN = row.TH_TEN; item.HD_THOIGIAN_BATDAU = row.TH_THOIGIAN_BATDAU; item.HD_THOIGIAN_KETTHUC = row.TH_THOIGIAN_KETTHUC; //item.HD_DIADIEM = row.TH_DIADIEM; //item.HD_TONGTIEN = row.TH_TONGTIEN??0; //item.HD_SONGUOI_THAMGIA = row.TH_SOLUONG??0; item.HD_THOIGIAN = FunctionHelper.formatFromDateToDate(row.TH_THOIGIAN_BATDAU, row.TH_THOIGIAN_KETTHUC); var dm = listDMHoiThao.Where(p => p.ID == row.TH_LOAI_ID).First(); if (dm != null) { item.HD_LOAI_STT = dm.STT; item.HD_LOAI = dm.NAME; } item.HD_NOIDUNG = row.TH_NOIDUNG; lists.Add(item); } rptBCTongKetHoatDong_NangCaoNangLucVaVanDongChinhSach rpt = new rptBCTongKetHoatDong_NangCaoNangLucVaVanDongChinhSach(); string tableName = "TongKetHoatDong"; DataTable dataPrint = FunctionHelper.ConvertToDataTable(lists); dataPrint.TableName = tableName; rpt.pLeftHeader.Value = clsParameter.pHospital; rpt.pParentLeftHeader.Value = clsParameter.pParentHospital; rpt.pTuNgayDenNgay.Value = FunctionHelper.formatFromDateToDate(deTuNgay.DateTime, deDenNgay.DateTime); //rpt.pTitleFooter.Value = ReportHelper.getTitleFooter(LoaiBaoCao.BM10); //rpt.pValueFooter.Value = ReportHelper.getValueFooter(LoaiBaoCao.BM10); rpt.DataSource = dataPrint; rpt.DataMember = tableName; printControl.PrintingSystem = rpt.PrintingSystem; rpt.CreateDocument(true); rptGlobal = rpt; _wait.Close(); }
private void btnControl_btnEventView_Click(object sender, EventArgs e) { List <clsBCHoatDongTheoDieuKien> listData = new List <clsBCHoatDongTheoDieuKien>(); if (deTuNgay.EditValue == null || deDenNgay.EditValue == null) { clsMessage.MessageWarning("Vui lòng nhập điều kiện tìm kiếm"); return; } else if (deTuNgay.DateTime.Date > deDenNgay.DateTime.Date) { clsMessage.MessageWarning("Thời gian tìm kiếm không phù hợp"); return; } WaitDialogForm _wait = new WaitDialogForm("Đang tải dữ liệu ...", "Vui lòng đợi giây lát"); QL_HOIVIEN_KTEntities context = new QL_HOIVIEN_KTEntities(); List <QL_HOIVIEN> listHoiVien = context.QL_HOIVIEN.ToList(); string hoiVienId = lueSearchHoiVien.EditValue + string.Empty; //Tập huấn var listDayNgheData = (from p in context.QL_HOATDONG_TAPHUAN let diadiem = p.QL_HOATDONG_TAPHUAN_DIADIEM.FirstOrDefault() where deTuNgay.DateTime.Date <= p.TH_THOIGIAN_BATDAU && p.TH_THOIGIAN_BATDAU <= deDenNgay.DateTime.Date && p.TH_DOITUONG_HV_ID.Contains(hoiVienId) select new clsBCHoatDongTheoDieuKien { HD_LOAI_ID = p.TH_LOAI_ID, HD_THOIGIAN_BATDAU = p.TH_THOIGIAN_BATDAU, HD_THOIGIAN_KETTHUC = p.TH_THOIGIAN_KETTHUC, HD_TEN = p.TH_TEN, HD_DIADIEM = diadiem.TH_DD_TEN, HD_DONVI_PHUTRACH = p.TH_DONVI_PHUTRACH, HD_DONVI_TAITRO = p.NTT_TEN, } ).ToList(); listData.AddRange(listDayNgheData); listData = listData.OrderBy(p => p.HD_LOAI).OrderBy(p => p.HD_THOIGIAN_BATDAU).ToList(); List <dynamicObject> listDm = FuncCategory.loadDMTapHuan(); foreach (var item in listData) { var rowCategory = listDm.Where(p => p.ID == item.HD_LOAI_ID).FirstOrDefault(); item.HD_LOAI = rowCategory != null ? rowCategory.NAME : ""; item.HD_NGAY = item.HD_THOIGIAN_BATDAU.Value.Date.ToString("dd/MM/yyyy") + " - " + item.HD_THOIGIAN_KETTHUC.Value.Date.ToString("dd/MM/yyyy"); } gcGrid.DataSource = listData; _wait.Close(); }