public QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable LoadPhieuThuByDateRangeWithGroupPhanLoaiThu(DateTime?fromDate, DateTime?toDate, List <int> phanLoaiThuIds) { PhieuThuTableAdapter phieuThuTableAdapter = (PhieuThuTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterPhieuThu); QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable table = phieuThuTableAdapter.GetDataByDateRangeWithGroupPhanLoaiThu(fromDate, toDate, StringUtil.JoinWithCommas(phanLoaiThuIds)); foreach (PhieuThuRow phieuThuRow in table) { phieuThuRow.PhanLoaiThu = StaticDataUtil.GetPhanLoaiThuById(phieuThuRow.PhanLoaiThuId); } return(table); }
public QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable LoadPhieuThu(HocSinhDataTable hocSinhTable) { PhieuThuTableAdapter phieuThuTableAdapter = (PhieuThuTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterPhieuThu); PhieuThuDataTable table = phieuThuTableAdapter.GetData(); foreach (PhieuThuRow row in table) { if (!row.IsHocSinhIdNull()) { row.HocSinh = StaticDataUtil.GetHocSinhFullNameByHocSinhId(hocSinhTable, row.HocSinhId); } if (!row.IsPhanLoaiThuIdNull()) { row.PhanLoaiThu = StaticDataUtil.GetPhanLoaiThuById(row.PhanLoaiThuId); } } return(table); }
private void addPhieuThuToReport(SortedList soQuyTienMatMap, DateTime fromDate, DateTime toDate, List <int> phanLoaiThuIds) { PhieuThuTableAdapter phieuThuTableAdapter = (PhieuThuTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterPhieuThu); QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable phieuThuDataTable = phieuThuTableAdapter.GetDataForSoQuyTienMat(fromDate, toDate, StringUtil.JoinWithCommas(phanLoaiThuIds)); Dictionary <string, SoQuyTienMatItem> groupDateToSoQuyTienMatItemsMap = new Dictionary <string, SoQuyTienMatItem>(); foreach (QLMamNon.Dao.QLMamNonDs.PhieuThuRow phieuThuRow in phieuThuDataTable) { phieuThuRow.PhanLoaiThu = phieuThuRow.IsPhanLoaiThuIdNull() ? "Thu tiền học phí" : StaticDataUtil.GetPhanLoaiThuById(phieuThuRow.PhanLoaiThuId); int groupDate = getGroupDate(fromDate, phieuThuRow); DateTime dateOfGroup = fromDate.AddDays((groupDate + 1) * NumberOfDateToGroupPhieuThu - 1); if (dateOfGroup > toDate) { dateOfGroup = toDate; } string key = StringUtil.Join(new int[] { groupDate, phieuThuRow.PhanLoaiThuId }, "~"); if (!groupDateToSoQuyTienMatItemsMap.ContainsKey(key)) { groupDateToSoQuyTienMatItemsMap.Add(key, new SoQuyTienMatItem() { DienGiai = phieuThuRow.PhanLoaiThu, NgayChungTu = dateOfGroup, SoTienThu = 0 }); } } foreach (QLMamNon.Dao.QLMamNonDs.PhieuThuRow phieuThuRow in phieuThuDataTable) { int groupDate = getGroupDate(fromDate, phieuThuRow); string key = StringUtil.Join(new int[] { groupDate, phieuThuRow.PhanLoaiThuId }, "~"); SoQuyTienMatItem soQuyTienMatItemThu = groupDateToSoQuyTienMatItemsMap[key]; soQuyTienMatItemThu.SoTienThu += phieuThuRow.SoTien; } int addedCount = 0; foreach (SoQuyTienMatItem soQuyTienMatItemThu in groupDateToSoQuyTienMatItemsMap.Values) { soQuyTienMatMap.Add(soQuyTienMatItemThu.NgayChungTu.AddMilliseconds(addedCount++), soQuyTienMatItemThu); } }