public override bool Equals(object obj) { if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { TaxesDto x = (TaxesDto)obj; return(IdTaxes == x.IdTaxes); } }
/// <summary> /// Gets the statements. /// </summary> /// <param name="sessionID">The session identifier.</param> /// <param name="startDate">The start date.</param> /// <param name="endDate">The end date.</param> /// <param name="interestRate">The interest rate.</param> /// <returns></returns> public async Task <TaxesDto> GetTaxesAsync(string sessionID, DateTime startDate, DateTime endDate, double interestRate) { TaxesDto taxes = new TaxesDto() { StartDate = startDate, EndDate = endDate, }; List <PBStatementItemDto> statements = await this.privat24BusinessService.GetStatementsAsync(sessionID, startDate, endDate); var inputStatements = statements .Where(d => d.Info.ShortType == "C") .Where(d => d.Amount.Amount >= 0 && d.Credit.Account.Number.StartsWith("2600") || d.Amount.Amount < 0 && d.Debet.Account.Number.StartsWith("2600")) .OrderBy(d => d.Info.PostDate) .ToList(); foreach (var inputStatement in inputStatements) { inputStatement.IsTaxed = !inputStatement.Purpose.StartsWith("Гривнi вiд вiльного продажу"); if (inputStatement.Amount.CCY.Equals("UAH")) { inputStatement.Course = 1; } else { ExchangeRateDto excangeRate = await this.privat24Service .GetExchangeRate(inputStatement.Amount.CCY, inputStatement.Info.PostDate); if (excangeRate != null) { inputStatement.Course = excangeRate.PurchaseRateNB; } } inputStatement.AmountInUAH = inputStatement.Course * inputStatement.Amount.Amount; if (inputStatement.IsTaxed) { taxes.FullAmount += inputStatement.AmountInUAH; } } taxes.TaxesAmount = (interestRate / 100) * taxes.FullAmount; taxes.InterestRate = interestRate; taxes.Statements = inputStatements; return(taxes); }