コード例 #1
0
        private void OnReportCellMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            Paragraph p = (Paragraph)sender;

            mouseDownCell = (CashFlowCell)p.Tag;
            downPos       = e.GetPosition(this.view);
        }
コード例 #2
0
        public CashFlowCell GetCell(String key)
        {
            CashFlowCell cell = null;

            if (!columns.TryGetValue(key, out cell))
            {
                cell = new CashFlowCell();
            }
            return(cell);
        }
コード例 #3
0
        private void GenerateGroup(IReportWriter writer, Dictionary <Category, CashFlowColumns> columns, CashFlowColumns columnTotals, string groupName, Func <Category, bool> inGroup)
        {
            List <Category> rootCategories = new List <Category>(columns.Keys);

            rootCategories.Sort(new Comparison <Category>((a, b) =>
            {
                return(string.Compare(GetCategoryCaption(a), GetCategoryCaption(b)));
            }));

            // start the group
            writer.StartExpandableRowGroup();

            CashFlowColumns groupTotals = new CashFlowColumns();

            // compute group totals;
            foreach (Category c in rootCategories)
            {
                if (inGroup(c))
                {
                    foreach (string columnName in this.columns)
                    {
                        CashFlowColumns cc     = columns[c];
                        decimal         amount = cc.GetValue(columnName);
                        columnTotals.AddValue(columnName, null, amount);
                        groupTotals.AddValue(columnName, null, amount);
                    }
                }
            }

            WriteRow(writer, true, false, groupName, FormatValues(groupTotals.GetOrderedValues(this.columns)).ToArray());

            // now add the detail rows of the group
            foreach (Category c in rootCategories)
            {
                if (inGroup(c))
                {
                    List <CashFlowCell> cells = new List <CashFlowCell>();
                    CashFlowColumns     cc    = columns[c];

                    foreach (string columnName in this.columns)
                    {
                        CashFlowCell cell = cc.GetCell(columnName);
                        cells.Add(cell);
                    }

                    WriteRow(writer, false, false, GetCategoryCaption(c), cells);
                }
            }

            writer.EndExpandableRowGroup();
        }
コード例 #4
0
        public void AddValue(string key, Transaction data, decimal amount)
        {
            CashFlowCell cell;

            columns.TryGetValue(key, out cell);
            if (cell == null)
            {
                cell         = new CashFlowCell();
                cell.Data    = new List <Transaction>();
                columns[key] = cell;
            }
            cell.Value += amount;
            if (data != null)
            {
                cell.Data.Add(data);
            }
        }
コード例 #5
0
        private void GenerateCsvGroup(StreamWriter writer, Dictionary <Category, CashFlowColumns> byCategory, string groupTitle, Func <Category, bool> inGroup, Func <decimal, decimal> scaleFunc)
        {
            writer.Write(groupTitle);
            foreach (string columnName in this.columns)
            {
                writer.Write(",");
                writer.Write(columnName);
            }
            writer.WriteLine();

            List <Category> rootCategories = new List <Category>(byCategory.Keys);

            rootCategories.Sort(new Comparison <Category>((a, b) =>
            {
                return(string.Compare(GetCategoryCaption(a), GetCategoryCaption(b)));
            }));

            // now add the detail rows of the group
            foreach (Category c in rootCategories)
            {
                if (inGroup(c))
                {
                    List <CashFlowCell> cells = new List <CashFlowCell>();
                    CashFlowColumns     cc    = byCategory[c];

                    foreach (string columnName in this.columns)
                    {
                        CashFlowCell cell = cc.GetCell(columnName);
                        cells.Add(cell);
                    }

                    writer.Write(GetCategoryCaption(c));

                    foreach (CashFlowCell cell in cells)
                    {
                        writer.Write(",");
                        writer.Write(scaleFunc(cell.Value));
                    }
                    writer.WriteLine();
                }
            }
            writer.WriteLine();
        }