public MonthlyReport()
        {
            InitializeComponent();
            SizeChanged += MonthlyReport_SizeChanged;

            ExpensesDatabaseController expenses = new ExpensesDatabaseController();
            IncomeDabataseController   income   = new IncomeDabataseController();
            var          balance = income.Total(DateTime.Now.Month, DateTime.Now.Year) - expenses.Total(DateTime.Now.Month, DateTime.Now.Year);
            List <Entry> entries = new List <Entry>
            {
                new Entry(Convert.ToSingle(expenses.Total(DateTime.Now.Month, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#dc151c"),
                    Label      = "Expenses",
                    ValueLabel = expenses.Total(DateTime.Now.Month, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(DateTime.Now.Month, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#228B22"),
                    Label      = "Income",
                    ValueLabel = income.Total(DateTime.Now.Month, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(balance))
                {
                    Color      = SKColor.Parse("#7f93ff"),
                    Label      = "Balance",
                    ValueLabel = balance.ToString()
                }
            };

            MonthlyChart.Chart = new DonutChart {
                Entries = entries
            };
        }
        public ExpensesList()
        {
            InitializeComponent();


            ExpenseDatabase = new ExpensesDatabaseController();
            if (ExpenseDatabase.GetExpenses() != null)
            {
                _expenses = new ObservableCollection <Expense>(ExpenseDatabase.GetExpenses());
            }



            _ExpensesList.ItemsSource = _expenses;


            // GetExpenses();//display Expenses
        }
Ejemplo n.º 3
0
        public Home()
        {
            InitializeComponent();
            IncomeDatabase   = new IncomeDabataseController();
            ExpensesDatabase = new ExpensesDatabaseController();
            GetEverything();
            today = DateTime.Today;

            string _month = "";

            //workaround
            if (today.Date.Month == 1)
            {
                _month = "January";
            }
            else if (today.Date.Month == 2)
            {
                _month = "February";
            }
            else if (today.Date.Month == 3)
            {
                _month = "March";
            }
            else if (today.Date.Month == 4)
            {
                _month = "April";
            }
            else if (today.Date.Month == 5)
            {
                _month = "May";
            }
            else if (today.Date.Month == 6)
            {
                _month = "June";
            }
            else if (today.Date.Month == 7)
            {
                _month = "July";
            }
            else if (today.Date.Month == 8)
            {
                _month = "August";
            }
            else if (today.Date.Month == 9)
            {
                _month = "September";
            }
            else if (today.Date.Month == 10)
            {
                _month = "October";
            }
            else if (today.Date.Month == 11)
            {
                _month = "November";
            }
            else if (today.Date.Month == 12)
            {
                _month = "December";
            }
            month.Text = _month + " " + today.Date.Year.ToString();
            Device.StartTimer(TimeSpan.FromSeconds(5), () =>
            {
                GetEverything();//totals recalculated every 5 seconds just to give an impression of real time calculations
                //the ideal is to have processing done after any change in the calculated figures...I'm too tired for that!

                return(true); // True = Repeat again, False = Stop the timer
            });
        }
Ejemplo n.º 4
0
        public All_Reports()
        {
            InitializeComponent();
            ExpensesDatabaseController expenses = new ExpensesDatabaseController();
            IncomeDabataseController   income   = new IncomeDabataseController();
            List <Entry> entries = new List <Entry>
            {
                new Entry(Convert.ToSingle(expenses.Total(1, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "January",
                    ValueLabel = expenses.Total(1, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(1, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(1, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(expenses.Total(2, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "February",
                    ValueLabel = expenses.Total(2, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(2, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(2, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(expenses.Total(3, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "March",
                    ValueLabel = expenses.Total(3, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(3, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(3, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(expenses.Total(4, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "April",
                    ValueLabel = expenses.Total(4, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(4, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(4, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(expenses.Total(5, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "May",
                    ValueLabel = expenses.Total(5, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(5, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(5, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(expenses.Total(6, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "June",
                    ValueLabel = expenses.Total(6, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(6, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(6, DateTime.Now.Year).ToString()
                },

                new Entry(Convert.ToSingle(expenses.Total(7, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "July",
                    ValueLabel = expenses.Total(7, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(7, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(7, DateTime.Now.Year).ToString()
                },

                new Entry(Convert.ToSingle(expenses.Total(8, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "August",
                    ValueLabel = expenses.Total(8, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(8, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(8, DateTime.Now.Year).ToString()
                },

                new Entry(Convert.ToSingle(expenses.Total(9, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "September",
                    ValueLabel = expenses.Total(9, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(9, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(9, DateTime.Now.Year).ToString()
                },

                new Entry(Convert.ToSingle(expenses.Total(10, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "October",
                    ValueLabel = expenses.Total(10, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(10, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(10, DateTime.Now.Year).ToString()
                },

                new Entry(Convert.ToSingle(expenses.Total(11, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "November",
                    ValueLabel = expenses.Total(11, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(11, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(11, DateTime.Now.Year).ToString()
                },


                new Entry(Convert.ToSingle(expenses.Total(12, DateTime.Now.Year)))
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = "Decemeber",
                    ValueLabel = expenses.Total(12, DateTime.Now.Year).ToString()
                },
                new Entry(Convert.ToSingle(income.Total(12, DateTime.Now.Year)))
                {
                    Color = SKColor.Parse("#008000"),

                    ValueLabel = income.Total(12, DateTime.Now.Year).ToString()
                }
            };

            //list income
            //List<Entry> entriesIncome = new List<Entry>
            //{
            //     new Entry(Convert.ToSingle(income.Total(1,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#228B22"),
            //        Label ="January",
            //        ValueLabel =income.Total(1,DateTime.Now.Year).ToString()
            //    },
            //    new Entry(Convert.ToSingle(income.Total(2,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#530023"),
            //        Label ="February",
            //        ValueLabel =income.Total(2,DateTime.Now.Year).ToString()
            //    },
            //      new Entry(Convert.ToSingle(income.Total(3,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#f15277"),
            //        Label ="March",
            //        ValueLabel =income.Total(3,DateTime.Now.Year).ToString()
            //    },
            //    new Entry(Convert.ToSingle(income.Total(4,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#551a8b"),
            //        Label ="April",
            //        ValueLabel =income.Total(4,DateTime.Now.Year).ToString()
            //    },
            //      new Entry(Convert.ToSingle(income.Total(5,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#7face8"),
            //        Label ="May",
            //        ValueLabel =income.Total(5,DateTime.Now.Year).ToString()
            //    },
            //    new Entry(Convert.ToSingle(income.Total(6,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#ab82ff"),
            //        Label ="June",
            //        ValueLabel =income.Total(6,DateTime.Now.Year).ToString()
            //    },
            //      new Entry(Convert.ToSingle(income.Total(7,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#00cc66"),
            //        Label ="July",
            //        ValueLabel =income.Total(7,DateTime.Now.Year).ToString()
            //    },
            //    new Entry(Convert.ToSingle(income.Total(8,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#d01679"),
            //        Label ="August",
            //        ValueLabel =income.Total(8,DateTime.Now.Year).ToString()
            //    },
            //      new Entry(Convert.ToSingle(income.Total(9,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#6464b6"),
            //        Label ="September",
            //        ValueLabel =income.Total(9,DateTime.Now.Year).ToString()
            //    },
            //    new Entry(Convert.ToSingle(income.Total(10,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#d4e3ff"),
            //        Label ="October",
            //        ValueLabel =income.Total(10,DateTime.Now.Year).ToString()
            //    },
            //      new Entry(Convert.ToSingle(income.Total(11,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#f22232"),
            //        Label ="November",
            //        ValueLabel =income.Total(11,DateTime.Now.Year).ToString()
            //    },
            //    new Entry(Convert.ToSingle(income.Total(12,DateTime.Now.Year)))
            //     {
            //        Color = SKColor.Parse("#241707"),
            //        Label ="Decemeber",
            //        ValueLabel =income.Total(12,DateTime.Now.Year).ToString()
            //    },
            //};


            Chart1.Chart = new BarChart {
                Entries = entries
            };                                                //from the xaml end
        }