def __init__(self, name, age, retireAge, deadAge, incomePA, expensesPM, proportionSaved):
        self.name = name
        self.age = age
        self.retireAge = retireAge
        self.deadAge = deadAge
        
        # Education
        # Currently does not take user input and is hard coded in the Education Class initialisation...
        
       
        # Loans
        self.hasLoan = False
        self.loanDict = {}
        self.noLoans = 0
        self.loanPaymentSum = 0

        # Earnings
        

        # Income
        self.hasIncome = False
        self.incomePA = incomePA
        self.income = self.incomePA / 12
        self.hasIncome = True
        
        # Expenses
        self.expenses = expensesPM    # Expenses per month
        
        # Savings
        self.proportionSaved = proportionSaved

        
        # Inherit Loan init.. by inheriting this class, we can access it's attributes and methods...
        Income.__init__(self, self.income)  # pass attribute to class
        
        # Init Expenses
        Expenses.__init__(self, self.expenses)
        
        
        # Init Savings
        Savings.__init__(self, self.proportionSaved)
        
        # Init Tax
        Tax.__init__(self)
        
        # Init super
        Superannuation.__init__(self, 0.095)
        
        # Init asset value
        AssetValue.__init__(self, 0.06)
        
        # Init Education 
        Education.__init__(self)
        
        # Init Earnings
        Earnings.__init__(self, self.eduLevel, self.age, self.retireAge)
 def add_income(self, username):
     amount, category_name, date = self.gather_info(category_type='income')
     new_income = Income(amount, category_name, date)
     self.aggregated_object.incomes_list.append(new_income)
     if date not in self.aggregated_object.dates_list:
         self.aggregated_object.dates_list.append(date)
     self.aggregated_object.save_changes(username)
示例#3
0
 def __init__(self, project):
     self.items = []
     self.incomes = [Income("Base", 0)]
     self.expences = []
     self.assets = []
     self.project = project
     self.read_files()
示例#4
0
 def test_income(self):
     hashedpw = bcrypt.hashpw('test'.encode('ascii'), bcrypt.gensalt())
     user = User(1, 'UnitTest', '*****@*****.**', hashedpw)
     user.addIncome(Income('income', 5.00, "2020-04-01"))
     self.assertEqual(len(user.income), 1)
     self.assertAlmostEqual(user.getUserTotalIncome(), 5.00)
     user.removeIncome(0, False)
     self.assertEqual(len(user.income), 0)
     self.assertAlmostEqual(user.getUserTotalIncome(), 0)
示例#5
0
def initialize_income():
    income_dict = {
        "2019-01-01#鲫鱼": Income("2019-01-01", "鲫鱼", 18, 10.5),
        "2019-01-01#鲤鱼": Income("2019-01-01", "鲤鱼", 8, 6.2),
        "2019-01-01#鲢鱼": Income("2019-01-01", "鲢鱼", 7, 4.7),
        "2019-01-02#草鱼": Income("2019-01-02", "草鱼", 2, 7.2),
        "2019-01-02#鲫鱼": Income("2019-01-02", "鲫鱼", 3, 12),
        "2019-01-02#黑鱼": Income("2019-01-02", "黑鱼", 6, 15),
        "2019-01-03#乌鱼": Income("2019-01-03", "乌鱼", 1, 71),
        "2019-01-03#鲫鱼": Income("2019-01-03", "鲫鱼", 1, 9.8)
    }

    return income_dict
示例#6
0
def get_income(current_time):
    changes = {
        0: {
            Month(2, 2019): 4350,
            Month(5, 2020): 7900,
        },
    }

    return Income(month=current_time,
                  initial_incomes={
                      0: 4050,
                      1: 1700
                  },
                  changes=changes)
示例#7
0
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "Budget ver. 1.0", size=(1100, 650))
        self.Centre(wx.BOTH)
        panel = wx.Panel(self, -1)

        notebook = wx.Notebook(panel)
        notebook.AddPage(Expenses(notebook), "Expenses")
        notebook.AddPage(Income(notebook), "Income")
        notebook.AddPage(Transfer(notebook), "Transfer")
        notebook.AddPage(Accounts(notebook), "Accounts")
        notebook.AddPage(Analysis(notebook), "Analysis")
        notebook.AddPage(Manage(notebook), "Manage")

        sizer = wx.BoxSizer()
        sizer.Add(notebook, 1, wx.EXPAND)
        panel.SetSizer(sizer)
示例#8
0
def add_income():
    token = request.headers.get('Authorization')
    if token is None:
        return make_response(
            jsonify({
                'success': False,
                'error': 'No Auth Token'
            }), 400)
    else:
        db = Database()
        user_id = AuthSystem.validate_token(token)
        query = {'_id': user_id}
        user = db.findUser(query)
        if user:
            income = request.json
            user = User.from_dict(user)
            user.addIncome(
                Income(income['name'], income['amount'], income['date'],
                       income['isConsistent'], income['isSavings']))
            user_dict = user.as_dict()
            updates = {}
            if income['isSavings'] is not True:
                updates = {
                    'income': user_dict['income'],
                    'totalIncome': user_dict['totalIncome']
                }
            else:
                updates = {
                    'savings': user_dict['savings'],
                    'totalSavings': user_dict['totalSavings']
                }
            did_update = db.updateUser(query, updates)
            if did_update:
                return make_response(jsonify({'success': True}), 201)
            else:
                return make_response(
                    jsonify({
                        'success': False,
                        'error': 'Failed to update User!'
                    }), 304)
        else:
            return make_response(
                jsonify({
                    'success': False,
                    'error': 'User not found!'
                }), 404)
示例#9
0
文件: page.py 项目: UtpalDas6/MoneyU
            total += i.get_income()
        return total

    def get_total_expense(self):
        total = 0
        for e in self.expense:
            total += e.get_expense()
        return total

    def get_profit_loss(self):
        if self.get_total_income() > self.get_total_expense():
            return "Profit = Rs " + str(self.get_total_income() -
                                        self.get_total_expense())
        elif self.get_total_income() < self.get_total_expense():
            return "Loss = Rs " + str(self.get_total_expense() -
                                      self.get_total_income())
        else:
            return "No Profit No Loss"


if __name__ == "__main__":
    inclist = []
    explist = []
    i1 = Income('Box1', 1200)
    i2 = Income('Box2', 1400)
    e1 = Expense('Babloo', 200)
    inclist.append(i1)
    inclist.append(i2)
    explist.append(e1)
    p = Page('1-1-2020', inclist, explist)
    print(p.get_profit_loss())
示例#10
0
            username = sign_up_window.username
            password = sign_up_window.password
            connection = database.connect()
            database.add_user(connection, username, password)
        login_window = LogIn()
        if login_window.is_closed:
            is_true = False

    if login_window.create_homepage:
        homepage_window = HomePage(login_window.table_name)
        while not homepage_window.is_closed:
            if homepage_window.expense:
                expense_window = Expense(login_window.table_name)
                homepage_window = HomePage(login_window.table_name)
            if homepage_window.income:
                income_window = Income(login_window.table_name)
                homepage_window = HomePage(login_window.table_name)
            if homepage_window.transaction:
                transaction_window = Transaction(login_window.table_name)
                homepage_window = HomePage(login_window.table_name)
            if homepage_window.delete:
                delete_window = Delete(login_window.table_name)
                homepage_window = HomePage(login_window.table_name)
            if homepage_window.analysis:
                analysis_window = Analysis(login_window.table_name)
                homepage_window = HomePage(login_window.table_name)
            if homepage_window.suggestion:
                suggestion_window = Savings(login_window.table_name)
                homepage_window = HomePage(login_window.table_name)
        login_window = LogIn()
        if login_window.is_closed:
示例#11
0
 def setUp(self):
     self.income = Income(10, 'Food', '12-12-1234')
示例#12
0
 def test_eq(self):
     self.assertTrue(self.income == Income(10, 'Food', '12-12-1234'))
示例#13
0
def edit_income():
    token = request.headers.get('Authorization')
    if token is None:
        return make_response(
            jsonify({
                'success': False,
                'error': 'No Auth Token'
            }), 400)
    else:
        db = Database()
        user_id = AuthSystem.validate_token(token)
        query = {'_id': user_id}
        user = db.findUser(query)
        if user:
            income = request.json
            user = User.from_dict(user)
            if income['oldIsSavings'] != income['isSavings']:
                if income['oldIsSavings']:
                    for i in range(0, len(user.savings)):
                        if user.savings[i].getName() == income['oldName']:
                            user.removeIncome(i, income['oldIsSavings'])
                            break
                else:
                    for i in range(0, len(user.income)):
                        if user.income[i].getName() == income['oldName']:
                            user.removeIncome(i, income['oldIsSavings'])
                            break
                user.addIncome(
                    Income(income['name'], income['amount'], income['date'],
                           income['isConsistent'], income['isSavings']))
            else:
                if income['isSavings']:
                    for i in range(0, len(user.savings)):
                        if user.savings[i].getName() == income['oldName']:
                            user.savings[i].setName(income['name'])
                            user.savings[i].setAmount(income['amount'])
                            user.savings[i].setDate(income['date'])
                            user.savings[i].setIsConsistent(
                                income['isConsistent'])
                            user.updateTotalSavings(income['amount'] -
                                                    income['oldAmount'])
                            break
                else:
                    for i in range(0, len(user.income)):
                        if user.income[i].getName() == income['oldName']:
                            user.income[i].setName(income['name'])
                            user.income[i].setAmount(income['amount'])
                            user.income[i].setDate(income['date'])
                            user.income[i].setIsConsistent(
                                income['isConsistent'])
                            user.updateTotalIncome(income['amount'] -
                                                   income['oldAmount'])
                            break
            user_dict = user.as_dict()
            updates = {
                'income': user_dict['income'],
                'savings': user_dict['savings'],
                'totalIncome': user_dict['totalIncome'],
                'totalSavings': user_dict['totalSavings']
            }
            did_update = db.updateUser(query, updates)
            if did_update:
                return make_response(jsonify({'success': True}), 200)
            else:
                return make_response(
                    jsonify({
                        'success': False,
                        'error': 'Failed to update User!'
                    }), 304)
        else:
            return make_response(
                jsonify({
                    'success': False,
                    'error': 'User not found!'
                }), 404)
 def add_incomes(self, incomes, date):
     for income in incomes:
         new_income = Income(income['amount'], income['category'], date)
         self.incomes_list.append(new_income)
示例#15
0
 def registerIncome(self, id, title, amount):
     # crear un objeto Ingreso
     income = Income(id, title, amount)
     # agregarlo a la lista de ingresos
     self.incomeList.append(income)
     self.calculateBalance()
示例#16
0
 def add_income(self, source, amount):
     self.incomes.append(Income(source, amount))