Exemplo n.º 1
0
 private void ShowBudgetCellInPanel(BudgetDetailRow row, int columnIndex, DataGridViewCell gridCell)
 {
     if (columnIndex >= NonPeriodColumns)
     {
         BudgetDetailCell cell = row.Cells[columnIndex - NonPeriodColumns];
         mSelectedBudgetCell     = cell;
         mSelectedBudgetRow      = row;
         mSelectedBudgetColumn   = columnIndex;
         mSelectedBudgetGridCell = (BudgetGridCell)gridCell;
         StartShowCell(row, columnIndex, "Budget");
         lblDashboardAmount.Text = "Total of Above Detail: " + cell.CellAmount.ToString("F2");
         lblGeneratedAmount.Text = "Original Combined Limit of Above Budgets: " + cell.GeneratedAmount.ToString("F2");
         lblBudgetLimit.Text     = "Current Combined Limit of Above Budgets: " + cell.BudgetLimit.ToString("F2");
         lblBudgetApplied.Text   = "Amount Used From Above Budgets: " + cell.BudgetUsed.ToString("F2");
         SetBudgetDetailVisibility(true);
         List <IDetailItemBuilder> builders = new List <IDetailItemBuilder>();
         foreach (BudgetTrx budget in cell.Budgets)
         {
             builders.Add(new BudgetDetailItemBuilder(budget));
         }
         foreach (TrxSplit split in cell.Splits)
         {
             builders.Add(new SplitDetailItemBuilder(split));
         }
         builders.Sort(DetailItemComparer);
         foreach (var builder in builders)
         {
             lvwDetails.Items.Add(builder.Build());
         }
     }
     else
     {
         CheckCellDetailVisibility(false);
     }
 }
Exemplo n.º 2
0
        private void AddGridRow(BudgetDetailRow row, Color rowBackgroundColor)
        {
            DataGridViewRow gridRow = new DataGridViewRow();

            gridRow.Tag = row;
            AddTextCell(gridRow, row.Label, rowBackgroundColor);
            AddTextCell(gridRow, row.Sequence, rowBackgroundColor);
            AddDecimalCell(gridRow, row.RowTotal, rowBackgroundColor);
            for (int periodIndex = 0; periodIndex < mData.PeriodCount; periodIndex++)
            {
                AddBudgetCell(gridRow, row.Cells[periodIndex], rowBackgroundColor);
            }
            grdMain.Rows.Add(gridRow);
        }
Exemplo n.º 3
0
        private BudgetDetailRow GetBudgetDetailRow(BudgetTrx budgetTrx)
        {
            string rowKey = budgetTrx.BudgetKey + ":" + budgetTrx.RepeatKey;

            if (!BudgetDetailRows.TryGetValue(rowKey, out BudgetDetailRow row))
            {
                string sequence = "(none)";
                if (!string.IsNullOrEmpty(budgetTrx.RepeatKey))
                {
                    sequence = budgetTrx.Register.Account.Repeats.KeyToValue1(budgetTrx.RepeatKey);
                }
                row = new BudgetDetailRow(PeriodCount, budgetTrx.BudgetKey,
                                          Company.Budgets.KeyToValue1(budgetTrx.BudgetKey), sequence);
                BudgetDetailRows[rowKey] = row;
            }
            return(row);
        }
Exemplo n.º 4
0
        private void grdMain_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            mSelectedBudgetCell     = null;
            mSelectedBudgetRow      = null;
            mSelectedBudgetColumn   = 0;
            mSelectedBudgetGridCell = null;
            DataGridViewRow row = grdMain.Rows[e.RowIndex];

            if (row.Tag is SplitDetailRow)
            {
                ShowSplitCell(row.Tag as SplitDetailRow, e.ColumnIndex);
            }
            else if (row.Tag is BudgetDetailRow)
            {
                ShowBudgetCellInPanel(row.Tag as BudgetDetailRow, e.ColumnIndex, row.Cells[e.ColumnIndex]);
            }
            else
            {
                CheckCellDetailVisibility(false);
            }
        }
Exemplo n.º 5
0
        private void LoadTrx(BaseTrx trx)
        {
            int     period    = GetPeriod(trx.TrxDate);
            BankTrx normalTrx = trx as BankTrx;

            if (normalTrx != null)
            {
                if (Handler.IncludeNormalTrx(normalTrx))
                {
                    foreach (TrxSplit split in normalTrx.Splits)
                    {
                        if (Handler.IncludeSplit(split))
                        {
                            if (split.Budget == null)
                            {
                                SplitDetailRow row = GetSplitDetailRow(split);
                                row.Cells[period].Splits.Add(split);
                            }
                            else
                            {
                                BudgetDetailRow budgetRow = GetBudgetDetailRow(split.Budget);
                                budgetRow.Cells[period].Splits.Add(split);
                            }
                        }
                    }
                }
            }
            else
            {
                BudgetTrx budgetTrx = trx as BudgetTrx;
                if (budgetTrx != null)
                {
                    if (Handler.IncludeBudgetTrx(budgetTrx))
                    {
                        BudgetDetailRow row = GetBudgetDetailRow(budgetTrx);
                        row.Cells[period].Budgets.Add(budgetTrx);
                    }
                }
            }
        }