예제 #1
0
        public void ShowTotal()
        {
            labelTable.Text = "Total";
            DateTime?dt = GetPreviousDate();
            Dictionary <string, double?> lastTotal = new Dictionary <string, double?> {
            };

            if (dt.HasValue)
            {
                AccountingData lastData = _DataHistory.GetData(dt.Value);
                lastTotal[dataGridViewAccounting._LastTotalMemoryMainKey] = lastData.GetQuote(lastData.Ccy, _DataHistory.TotalCcy) * lastData.TotalValue;
                foreach (var cat in lastData.Categories)
                {
                    lastTotal[cat.CategoryName] = cat.GetTotalAmount(_DataHistory.TotalCcy, lastData.FXMarket);
                }
            }
            dataGridViewAccounting.ShowTotal(Data, lastTotal);
        }
예제 #2
0
        public void ShowElement(NodeAddress na)
        {
            labelTable.Text = na.GetLabelText();
            DateTime?                    dt        = GetPreviousDate();
            IAccountingElement           element   = Data.GetElement(na);
            Dictionary <string, double?> lastTotal = new Dictionary <string, double?> {
            };

            if (dt.HasValue)
            {
                AccountingData lastData = _DataHistory.GetData(dt.Value);
                lastTotal[dataGridViewAccounting._LastTotalMemoryMainKey] = lastData.GetQuote(lastData.Ccy, _DataHistory.TotalCcy) * lastData.GetValue(na);
                foreach (var subitem in lastData.GetElement(na).GetItemList())
                {
                    lastTotal[subitem.GetName()] = subitem.GetTotalAmount(_DataHistory.TotalCcy, lastData.FXMarket);
                }
            }
            dataGridViewAccounting.ShowElement(Data.GetElement(na), Data.Map.GetElement(na), lastTotal);;
            _AddressofElementShowed = na;
        }
예제 #3
0
        public void Update(AccountingData ad)
        {
            _Weights = new Dictionary <string, double> {
            };
            SummaryReport sr = ad.GetSummary();

            Rows.Clear();
            ColumnCount           = 4;
            Columns[0].HeaderText = "Ccy/Asset";
            Columns[1].HeaderText = "Total";
            Columns[2].HeaderText = "Total Converted";
            Columns[3].HeaderText = "Weight";

            for (int j = 0; j < ColumnCount; j++)
            {
                Columns[j].Width    = 75;
                Columns[j].SortMode = DataGridViewColumnSortMode.Programmatic;
            }
            foreach (var item in ad.CciesAndAssets)
            {
                double amount = sr.Get(item);
                if (amount != 0)
                {
                    double convAmount = ad.GetQuote(item, ad.Ccy) * amount;
                    double weight     = convAmount / ad.TotalValue;
                    _Weights[item.ToString()] = weight;

                    object[] values = { item.ToString(),
                                        ad.GetAmountToString(item,  amount),
                                        ad.GetAmountToString(ad.Ccy,convAmount),
                                        $"{Math.Round(weight * 100, 2)} %" };
                    Rows.Add(values);
                }
            }
            ClearSelection();
        }