public DateTime?LastExchange() { var date = _appContextService.CurrentFinancialYear; var year = (_uow.AccDocumentHeaders.Select(x => new { x.DocumentDate, x.TypeDocumentId }) .Where(x => x.TypeDocumentId == 6 && _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == date.ToString())); if (year != null && year.Any()) { return(year.Max(x => x.DocumentDate)); } else { return(null); } }
/// <summary> /// باید فانکشن صدا زده شود. /// </summary> /// <param name="date"></param> /// <returns></returns> public async Task <List <AccDocumentItem> > GetAccDocumentItemsAsync(int date) { PersianCalendar persianCalendar = new PersianCalendar(); //نمایش آیتم های سند حسابداری که معین آن ها انتظامی یا انتظامی هستند. var xxx = (await _uow.AccDocumentItems.Where(x => (x.SL.TL.GL.AccountGLEnum == AccountGLEnum.BalanceSheet || x.SL.TL.GL.AccountGLEnum == AccountGLEnum.Disciplinary) && (_uow.ShamsiToMiladi(x.AccDocumentHeader.DocumentDate, "Saal") == date.ToString())).ToListAsync().ConfigureAwait(false)); //var xxx = (await _uow.AccDocumentItems.Where(x => x.SL.TL.GL.AccountGLEnum == AccountGLEnum.BalanceSheet // || x.SL.TL.GL.AccountGLEnum == AccountGLEnum.Disciplinary).ToListAsync().ConfigureAwait(false)) //.Where(y=> persianCalendar.GetYear(y.AccDocumentHeader.DocumentDate) == date).ToList(); return(xxx); // return (await _uow.AccDocumentItems.Where(x => x.AccDocumentHeader.TypeDocumentId == 1).ToListAsync().ConfigureAwait(false)); }
public DateTime?GetEndExchangeDoc(int date) { var year = (_uow.AccDocumentHeaders.Select(x => new { x.DocumentDate, x.TypeDocumentId }) .Where(x => x.TypeDocumentId == 6 && _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == date.ToString())); if (year != null && year.Any()) { return(year.Max(x => x.DocumentDate)); } //var year = _uow.AccDocumentItems.Select(x => new { x.AccDocumentHeader.DocumentDate, x.CurrencyId }).Where(x => x.CurrencyId !=0 && _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == date.ToString()); //if (year!=null) //{ //var m= year.Max(x => x.DocumentDate); //return m; //} else { return(null); } }
public void LoadRefresh() { _uow = new SainaDbContext(); var ids = new List <int> { 1, 3, 4, 5, 6 }; TypeDocuments = _uow.TypeDocuments.Where(x => !ids.Contains(x.TypeDocumentId)).ToList(); SLs = _uow.SLs.Where(x => x.Status == true).ToList(); DLs = _uow.DLs.ToList(); SLStandardDescriptions = _uow.SLStandardDescriptions.ToList(); Currencies = _uow.Currencies.ToList(); AccDocumentHeaders = new QueryableCollectionView(_uow.AccDocumentHeaders.Include(x => x.AccDocumentItems.Select(s => s.SL)).Where(x => _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == _appContextService.CurrentFinancialYear.ToString() ).ToList()); AccDocumentHeaders.CollectionChanged += AccDocumentHeaders_CollectionChanged; _uow.SaveChanges(); }
public void Loaded() { _uow = new SainaDbContext(); var ids = new List <int> { 1, 3, 4, 5, 6 }; TypeDocuments = _uow.TypeDocuments.Where(x => !ids.Contains(x.TypeDocumentId)).ToList(); SLs = _uow.SLs.Where(x => x.Status == true).ToList(); DLs = _uow.DLs.ToList(); SLStandardDescriptions = _uow.SLStandardDescriptions.ToList(); Currencies = _uow.Currencies.ToList(); AccDocumentHeaders = new QueryableCollectionView(_uow.AccDocumentHeaders.Include(x => x.AccDocumentItems.Select(s => s.SL)).Where(x => _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == _appContextService.CurrentFinancialYear.ToString() && (HeaderId == 0 || x.AccDocumentHeaderId == HeaderId) && (TypeEnum == 0 || x.TypeDocumentId == TypeEnum)).OrderBy(x => x.DocumentNumber).ToList()); _appContextService.PropertyChanged += (sender, eventArgs) => { try { if (eventArgs.PropertyName == "CurrentFinancialYear") { var dateDocument = _appContextService.CurrentFinancialYear; ids = new List <int> { 1, 3, 4, 5, 6 }; TypeDocuments = _uow.TypeDocuments.Where(x => !ids.Contains(x.TypeDocumentId)).ToList(); SLs = _uow.SLs.Where(x => x.Status == true).ToList(); DLs = _uow.DLs.ToList(); SLStandardDescriptions = _uow.SLStandardDescriptions.ToList(); Currencies = _uow.Currencies.ToList(); // AccDocumentHeaders = new QueryableCollectionView(_uow.AccDocumentHeaders.Include(x => x.AccDocumentItems).Where(x => _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == _appContextService.CurrentFinancialYear.ToString()).ToList()); AccDocumentHeaders = new QueryableCollectionView(_uow.AccDocumentHeaders.Include(x => x.AccDocumentItems.Select(s => s.SL)).Where(x => _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == _appContextService.CurrentFinancialYear.ToString() && (HeaderId == 0 || x.AccDocumentHeaderId == HeaderId) && (TypeEnum == 0 || x.TypeDocumentId == TypeEnum)).OrderBy(x => x.DocumentNumber).ToList()); } } catch (Exception) { } }; AccDocumentHeaders.CollectionChanged += AccDocumentHeaders_CollectionChanged; _uow.SaveChanges(); }
public async Task <List <AccDocumentItem> > GetAccDocumentItemDateAsync(int date) { var result = (await _uow.AccDocumentItems.Where(x => _uow.ShamsiToMiladi(x.AccDocumentHeader.DocumentDate, "Saal") == date.ToString()).AsNoTracking().ToListAsync().ConfigureAwait(false)); return(result); }
public async Task <List <AccDocumentHeader> > GetAccSystemDocumentHeadersAsync(int date, int typeDocumentId) { return(await _uow.AccDocumentHeaders.Where(x => x.TypeDocumentId == typeDocumentId && _uow.ShamsiToMiladi(x.DocumentDate, "Saal") == date.ToString()).AsNoTracking().ToListAsync().ConfigureAwait(false)); }