Exemple #1
0
        private static List <string> GetRowsToReverse(QueryXml query)
        {
            if (query.IsBalanceSheet())
            {
                return(FinancialStatements.PAndLRowsToReverseSign);
            }
            else if (query.IsProfitAndLoss())
            {
                return(FinancialStatements.BalanceSheetRowsToReverseSign);
            }

            return(FinancialStatements.CashFlowRowsReverseSign);
        }
Exemple #2
0
        public static void AdjustSigns(DataTable table, QueryXml query, string lookupColumn)
        {
            List <string> rowsToReverse = null;

            if (!table.Columns.Contains(lookupColumn))
            {
                return;
            }

            if (query.IsProfitAndLoss())
            {
                rowsToReverse = FinancialStatements.PAndLRowsToReverseSign;
            }
            else if (query.IsBalanceSheet())
            {
                rowsToReverse = FinancialStatements.BalanceSheetRowsToReverseSign;
            }
            else
            {
                rowsToReverse = FinancialStatements.CashFlowRowsReverseSign;
            }

            foreach (var rowLookup in rowsToReverse)
            {
                foreach (var row in table.AsEnumerable().Where(x => x[lookupColumn].ToString() == rowLookup))
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        // Don't reverse variance % columns as Custom mode does not adjust the value. (like Variance mode does)
                        if (!ColumnsToIgnoreForCalculations(query).Contains(column.ColumnName))
                        {
                            if (row[column.ColumnName] != DBNull.Value)
                            {
                                row[column.ColumnName] = (double)row[column.ColumnName] * -1;
                            }
                        }
                    }
                }
            }
        }