Esempio n. 1
0
        void TransferMoneyToMonth(User Usr, DateTime From, DateTime To, float Value)
        {
            bool Short = From.Year == To.Year;

            AddTransaction(new Transaction(Usr, From, -Value), "Transfer to " + BudgetMonth.Fmt(To, Short));
            AddTransaction(new Transaction(Usr, To, Value), "Transfer from " + BudgetMonth.Fmt(From, Short));
        }
Esempio n. 2
0
 IEnumerable <Transaction> GetTransactionsForMonth(BudgetMonth Month)
 {
     foreach (var T in AllTransactions)
     {
         if (Month.InMonth(T.Date))
         {
             yield return(T);
         }
     }
 }
Esempio n. 3
0
        public void CalculateBudget(ListControl LC)
        {
            BudgetMonth Month = (BudgetMonth)LC.UserData;

            LC.Clear();
            LC.AddItem(Month.GetName(), ItemColor.Info);

            float Sum = 0;

            Transaction[] Transactions = Transaction.Sort(GetTransactionsForMonth(Month)).ToArray();

            foreach (var T in Transactions)
            {
                Sum += T.Value;
                ItemColor Clr = ItemColor.Green;

                if (T.Value > 0)
                {
                    if (T.Maestro == null)
                    {
                        Clr = ItemColor.Green;
                    }
                    else
                    {
                        Clr = ItemColor.Info;
                    }
                }
                else
                {
                    if (T.Maestro == null)
                    {
                        Clr = ItemColor.Red;
                    }
                    else if (T.Maestro != null)
                    {
                        Clr = ItemColor.Orange;
                    }
                }

                LC.AddItem(T.FormatValue(), Clr, T.ID.ToString(), OnTransactionRemove);
            }

            LC.AddItem(Transaction.FormatValue(Sum));

            LC.AddItem("Available Maestro<br/>999", ItemColor.Info);
            ///Transaction.FormatValue(999);
        }
Esempio n. 4
0
 public Transaction(User Usr, BudgetMonth Month, float Value) : this(Usr, Month.FirstDay, Value)
 {
 }