Neco.Backend/Controllers/EzTaxController.cs
/// <summary>Generates a Report based on a user and the context configured for this controller</summary>
/// <param name="U"></param>
/// <returns></returns>
Generates a Report based on a user and the context configured for this controller
Generates a Report based on a user and the context configured for this controller
private async Task<TaxReport> CommonReportGenerator(User U) {
            ICollection<IncomeItem> Is = await NecoDB.IncomeItem
                .Include(m => m.User)
                .Include(m => m.FederalJurisdiction).ThenInclude(m => m.Account)
                .Include(m => m.FederalJurisdiction).ThenInclude(m => m.Brackets)
                .Include(m => m.LocalJurisdiction).ThenInclude(m => m.Account)
                .Include(m => m.LocalJurisdiction).ThenInclude(m => m.Brackets)
                .Include(m => m.Apartments)
                .Include(m => m.Hotels)
                .Include(m => m.Businesses)
                .Where(i => i.User.ID == U.ID)
                .ToListAsync();
            ICollection<Transaction> Ts;
            if (DateTime.Now.Day > 15) {
                Ts = await NecoDB.Transaction
                    .Include(T => T.FromAccount).ThenInclude(A => A.Owner).ThenInclude(U => U.Type)
                    .Include(T => T.ToAccount).ThenInclude(A => A.Owner).ThenInclude(U => U.Type)
                    .Where(T => T.Time > DayOfThisMonth(15) && T.State==TransactionState.COMPLETED
                                && T.FromAccount.ID != "999999999")
                    .ToListAsync();
            } else {
                Ts = await NecoDB.Transaction
                    .Include(T => T.FromAccount).ThenInclude(A => A.Owner).ThenInclude(U => U.Type)
                    .Include(T => T.ToAccount).ThenInclude(A => A.Owner).ThenInclude(U => U.Type)
                    .Where(T => T.Time > DayOfLastMonth(15) && T.Time < DayOfThisMonth(15) 
                                && T.State == TransactionState.COMPLETED && T.FromAccount.ID != "999999999")
                    .ToListAsync();
            }
            TaxJurisdiction J = (await NecoDB.IncomeItem.Include(I => I.FederalJurisdiction).ThenInclude(J => J.Brackets).FirstAsync()).FederalJurisdiction;
            return TaxReport.GenerateTaxReport(U, Is, Ts, J);
        }
private async Task < TaxReport > CommonReportGenerator ( User U ) { ICollection < IncomeItem > Is = await NecoDB . IncomeItem . Include ( m => m . User ) . Include ( m => m . FederalJurisdiction ) . ThenInclude ( m => m . Account ) . Include ( m => m . FederalJurisdiction ) . ThenInclude ( m => m . Brackets ) . Include ( m => m . LocalJurisdiction ) . ThenInclude ( m => m . Account ) . Include ( m => m . LocalJurisdiction ) . ThenInclude ( m => m . Brackets ) . Include ( m => m . Apartments ) . Include ( m => m . Hotels ) . Include ( m => m . Businesses ) . Where ( i => i . User . ID == U . ID ) . ToListAsync ( ) ; ICollection < Transaction > Ts ; if ( DateTime . Now . Day > 15 ) { Ts = await NecoDB . Transaction . Include ( T => T . FromAccount ) . ThenInclude ( A => A . Owner ) . ThenInclude ( U => U . Type ) . Include ( T => T . ToAccount ) . ThenInclude ( A => A . Owner ) . ThenInclude ( U => U . Type ) . Where ( T => T . Time > DayOfThisMonth ( 15 ) && T . State == TransactionState . COMPLETED && T . FromAccount . ID != " " ) . ToListAsync ( ) ; } else { Ts = await NecoDB . Transaction . Include ( T => T . FromAccount ) . ThenInclude ( A => A . Owner ) . ThenInclude ( U => U . Type ) . Include ( T => T . ToAccount ) . ThenInclude ( A => A . Owner ) . ThenInclude ( U => U . Type ) . Where ( T => T . Time > DayOfLastMonth ( 15 ) && T . Time < DayOfThisMonth ( 15 ) && T . State == TransactionState . COMPLETED && T . FromAccount . ID != " " ) . ToListAsync ( ) ; } TaxJurisdiction J = ( await NecoDB . IncomeItem . Include ( I => I . FederalJurisdiction ) . ThenInclude ( J => J . Brackets ) . FirstAsync ( ) ) . FederalJurisdiction ; return TaxReport . GenerateTaxReport ( U , Is , Ts , J ) ; }
Generates a Report based on a user and the context configured for this controller
Generates a Report based on a user and the context configured for this controller
//Get Transactions since this month's 15th. //Get Transactions from the last 15th to this 15th //Right now we have no real way to save a User's federal jurisdiction. //So we're going to assume there's only one federal jurisdiction and every income item has the same one //We can fix this later :shrug:
None
U
User
None