private ConsolidatedStatementOfComprehensiveIncome GetComprehensiveIncome(IWebElement table) { var comprehensiveIncome = new ConsolidatedStatementOfComprehensiveIncome(); var forSaleInvestments = new AvailableForSaleInvestments(); var cashFlowHedges = new CashFlowHedges(); var tableRows = table.FindElements(By.TagName("tr")); bool cashFlowHedgeUnrealizedGain = false; bool cashFlowHedgeLess = false; foreach (var tr in tableRows) { var tableCellCount = tr.FindElements(By.TagName("td")).Count(); var tcs = tr.FindElements(By.TagName("td")); if (tr.Text.Contains("Net income")) { comprehensiveIncome.NetIncome = GetDoubleFromString(tcs[tableCellCount - 2].Text); } else if (tr.Text.Contains("Change in foreign currency translation adjustment")) { comprehensiveIncome.ChangeInForeignCurrencyTranslationAdjustment = GetDoubleFromString(tcs[tableCellCount - 2].Text); } else if (tr.Text.Contains("Change in net unrealized gains (losses)")) { if (!cashFlowHedgeUnrealizedGain) { forSaleInvestments.ChangeInNetUnrealizedGains = GetDoubleFromString(tcs[tableCellCount - 2].Text); cashFlowHedgeUnrealizedGain = true; } else { cashFlowHedges.ChangeInNetUnrealizedGains = GetDoubleFromString(tcs[tableCellCount - 2].Text); } } else if (tr.Text.Contains("Less: reclassification adjustment for net (gains) losses included in net income")) { if (!cashFlowHedgeLess) { forSaleInvestments.ReclassificationAdjustmentForNetGains = GetDoubleFromString(tcs[tableCellCount - 2].Text); cashFlowHedgeLess = true; } else { cashFlowHedges.ReclassificationAdjustmentForNetGains = GetDoubleFromString(tcs[tableCellCount - 2].Text); } } else if (tr.Text.Contains("Other comprehensive income (loss)")) { comprehensiveIncome.OtherCompehensiveIncome = GetDoubleFromString(tcs[tableCellCount - 2].Text); } } comprehensiveIncome.AvailableForSaleInvestments = forSaleInvestments; comprehensiveIncome.CashFlowHedges = cashFlowHedges; return(comprehensiveIncome); }
public ConsolidatedStatementOfComprehensiveIncome() { AvailableForSaleInvestments = new AvailableForSaleInvestments(); CashFlowHedges = new CashFlowHedges(); }
public ConsolidatedStatementOfComprehensiveIncome(AvailableForSaleInvestments availableForSaleInvestments, CashFlowHedges cashFlowHedges) { AvailableForSaleInvestments = availableForSaleInvestments; CashFlowHedges = cashFlowHedges; }