$(document).ready(function() {
//===========PASTE SAVE FILE HERE===========\\
var file = {
'overview': {
'accumulatedDD': {
'Accumulated Roll Over': 4497,
'Accumulated Buffer': 200,
'Accumulated Car Insurence': 330,
'Accumulated Car MOT': 420,
'Accumulated Car Park': 780,
'Accumulated Car Tax': 120,
'Accumulated Contents Insurence': 144,
'Accumulated Gym': 250,
'Accumulated Line Rental': 184,
'Accumulated TV License': 156,
'Accumulated empty 1':0,
'Accumulated empty 2':0,
'Accumulated empty 3':0,
'Accumulated empty 4':0,
'Accumulated empty 5':0,
'Accumulated empty 6':0,
'Accumulated empty 7':0,
'Accumulated empty 8':0,
'Accumulated empty 9':0,
'Accumulated empty 10':0,
'Accumulated empty 11':0
},
'accumulatedDDTarget': {
'Accumulated Roll Over': 0,
'Accumulated Buffer': 200,
'Accumulated Car Insurence': 400,
'Accumulated Car MOT': 400,
'Accumulated Car Park': 800,
'Accumulated Car Tax': 150,
'Accumulated Contents Insurence': 150,
'Accumulated Gym': 250,
'Accumulated Line Rental': 200,
'Accumulated TV License': 156,
'Accumulated empty 1':200,
'Accumulated empty 2':200,
'Accumulated empty 3':200,
'Accumulated empty 4':200,
'Accumulated empty 5':200,
'Accumulated empty 6':200,
'Accumulated empty 7':200,
'Accumulated empty 8':200,
'Accumulated empty 9':200,
'Accumulated empty 10':200,
'Accumulated empty 11':200
},
'budgetedMonthlyAccumulation': {
'Accumulated Car Insurence': 65,
'Accumulated Car MOT': 17,
'Accumulated Car Park': 60,
'Accumulated Car Tax': 12,
'Accumulated Contents Insurence': 12,
'Accumulated Gym': 25,
'Accumulated Line Rental': 17,
'Accumulated TV License': 12
},
'budgetedDD': {
'Bank Charges': 10,
'Charity': 45,
'Contact Lenses': 26,
'Council Tax': 102,
'Electricity': 30,
'Gas': 30,
'Internal Transfer': 0,
'Internet': 33,
'Kat Phone': 38,
'Other': 0,
'Rent': 120,
'Rob Phone': 25,
'Water': 35,
'Wrong Account (Awaiting Transfer)': 0
},
'budgetedSpending': {
'Food/Toiletries': 375,
'House Stuff': 15,
'Internal Transfer': 0,
'Meals/Drinks Out': 50,
'Other One Off Costs': 75,
'Petrol': 30,
'Presents for Others': 15,
'Small Clothes Items': 25,
'Stationery/Text Books': 25,
'Travel Costs': 40,
'Treats(Massages/Days Out)': 50,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
},
'budgetedSaving': {
'Appointments': 30,
'Presents': 36,
'Clothes': 16
},
'midTermSaving': {
'Not Yet Assigned': 0,
'Appointments': 0,
'Bath': 250,
'Car Replace': 900,
'Clothes': 50,
'Cruise 2016': 2000,
'Emergency': 250,
'Laser Eye': 400,
'Presents': 190,
"Robs New Mac": 193.43,
'Rob to Drive': 500,
'Empty 1':0,
'Empty 2':0,
'Empty 3':0,
'Empty 4':0,
'Empty 5':0,
'Empty 6':0,
'Empty 7':0,
'Empty 8':0,
'Empty 9':0,
'Empty 10':0
},
'midTermSavingTarget': {
'Not Yet Assigned': 0,
'Appointments': 200,
'Bath': 250,
'Car Replace': 1500,
'Clothes': 150,
'Cruise 2016': 2000,
'Emergency': 1000,
'Laser Eye': 2000,
'Presents': 200,
"Robs New Mac": 1000,
'Rob to Drive': 1000,
'Empty 1':200,
'Empty 2':200,
'Empty 3':200,
'Empty 4':200,
'Empty 5':200,
'Empty 6':200,
'Empty 7':200,
'Empty 8':200,
'Empty 9':200,
'Empty 10':200
},
'longTermSaving': 10150.09,
'alerts':{
'august':['01/08/15 - Contents Insurence','10/08/15 - Car Park Expires','31/08/15 - MOT Expires'],
'september':[],
'october':['Gym Renewal','31/10/15 - Car Tax Due'],
'november':[],
'december':[],
'january':[],
'february':[],
'march':['Car insurence Due?'],
'april':[],
'may':[],
'june':[],
'july':['TV licence?']
}
},
'august': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'september': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 400,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'october': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'november': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'december': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'january': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'february': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'march': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'april': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'may': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'june': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
},
'july': {
'DD': {
'updated': 'no',
'predictedIn': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 1300,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'in': {
"Bank Interest": 0,
"Gift": 0,
"Internal Transfer": 0,
"Kats Bursary": 0,
"Kats Grant": 0,
"Kats Wages": 0,
"Robs Bursary": 0,
"Robs Grant": 0,
"Robs Wages": 0,
"Other": 0
},
'out': {
'Accumulated Car Insurence': 0,
'Accumulated Car MOT': 0,
'Accumulated Car Park': 0,
'Accumulated Car Tax': 0,
'Accumulated Contents Insurence': 0,
'Accumulated Gym': 0,
'Accumulated Line Rental': 0,
'Accumulated Roll Over': 0,
'Accumulated TV License': 0,
'Bank Charges': 0,
'Charity': 0,
'Contact Lenses': 0,
'Council Tax': 0,
'Electricity': 0,
'Gas': 0,
'Internal Transfer': 0,
'Other': 0,
'Internet': 0,
'Kat Phone': 0,
'Rent': 0,
'Rob Phone': 0,
'Water': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'spending': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Food/Toiletries': 0,
'House Stuff': 0,
'Internal Transfer': 0,
'Meals/Drinks Out': 0,
'Other One Off Costs': 0,
'Petrol': 0,
'Presents for Others': 0,
'Small Clothes Items': 0,
'Stationery/Text Books': 0,
'Travel Costs': 0,
'Treats(Massages/Days Out)': 0,
'Unknown ATM': 0,
'Wrong Account (Awaiting Transfer)': 0
}
},
'midTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0,
"Other": 0
},
'out': {
'Appointments': 0,
'Bath': 0,
'Car Replace': 0,
'Clothes': 0,
'Cruise 2016': 0,
'Emergency': 0,
'Laser Eye': 0,
'Presents': 0,
'Not Yet Assigned': 0,
'Rob to Drive': 0,
"Robs New Mac": 0
}
},
'longTermSaving': {
'updated': 'no',
'in': {
"Bank Interest": 0,
"Internal Transfer": 0
},
'out': {
"Save to buy Spend": 0,
}
}
}
}
//===========SAVE FILE ENDS HERE======\\
//Front page graph shows the amount of money in the account each month. if the amount exceeds the threshold, the excess is put into a roll over fund. Only if the income (including predicted incomes) surpasses the amount needed for the whole year will the bars exceed the threshold.
//++++SET INITIAL VARIABLES++++\\
$('#backButton').hide();
$('#markers').hide();
$('#labels').hide();
$('#xaxis').hide();
$('#info').hide();
$('#wizard').hide();
var currentMonth = 'none';
var currentAccount = 'none';
//===Calculate the amount of money budgeted each month for the DD account===\\
var monthlyDD = 0;
for (i = 0; i < Object.keys(file['overview']['budgetedMonthlyAccumulation']).length; i++) {
monthlyDD += file['overview']['budgetedMonthlyAccumulation'][Object.keys(file['overview']['budgetedMonthlyAccumulation'])[i]];
}
for (i = 0; i < Object.keys(file['overview']['budgetedDD']).length; i++) {
monthlyDD += file['overview']['budgetedDD'][Object.keys(file['overview']['budgetedDD'])[i]];
}
//===Calculate the amount of money budgeted each month for the Spending account===\\
var monthlySpend = 0;
for (i = 0; i < Object.keys(file['overview']['budgetedSpending']).length; i++) {
monthlySpend += file['overview']['budgetedSpending'][Object.keys(file['overview']['budgetedSpending'])[i]];
}
//===Calculate the amount of money budgeted each month for the Saving account===\\
var monthlySave = 0;
for (i = 0; i < Object.keys(file['overview']['budgetedSaving']).length; i++) {
monthlySave += file['overview']['budgetedSaving'][Object.keys(file['overview']['budgetedSaving'])[i]];
}
var threshold = monthlySpend + monthlySave + monthlyDD;
var intervalList = [500, 1000, 2000, 5000];
var interval = 0;
var scale = 0;
var location = "loginPage"
//====predicted income totals====\\
var predictedIncome = {
'august': 0,
'september': 0,
'october': 0,
'november': 0,
'december': 0,
'january': 0,
'february': 0,
'march': 0,
'april': 0,
'may': 0,
'june': 0,
'july': 0
};
for (i = 0; i < Object.keys(predictedIncome).length; i++) {
for (j = 0; j < Object.keys(file[Object.keys(predictedIncome)[i]]['DD']['predictedIn']).length; j++) {
predictedIncome[Object.keys(predictedIncome)[i]] += file[Object.keys(predictedIncome)[i]]['DD']['predictedIn'][Object.keys(file[Object.keys(predictedIncome)[i]]['DD']['predictedIn'])[j]];
}
}
//====allocate a pseudo Roll Over for Predictions====\\
var numberOfMonthsToPredict = 0;
for (i = 0; i < Object.keys(predictedIncome).length; i++) {
if (file[Object.keys(predictedIncome)[i]]['DD']['updated'] == 'no') {
numberOfMonthsToPredict++;
}
}
var tempRollOver = file['overview']['accumulatedDD']['Accumulated Roll Over'];
for (i = (12 - numberOfMonthsToPredict); i < Object.keys(predictedIncome).length; i++) {
while ((predictedIncome[Object.keys(predictedIncome)[i]] < threshold) && (tempRollOver > 0)) {
predictedIncome[Object.keys(predictedIncome)[i]]++
tempRollOver--
}
}
//====if there is any of the roll over left - split it between the months====\\
if (tempRollOver > 0) {
for (i = (12 - numberOfMonthsToPredict); i < Object.keys(predictedIncome).length; i++) {
predictedIncome[Object.keys(predictedIncome)[i]] += parseInt(tempRollOver / numberOfMonthsToPredict)
}
}
//====actual income totals====\\
var actualIncome = {
'august': 0,
'september': 0,
'october': 0,
'november': 0,
'december': 0,
'january': 0,
'february': 0,
'march': 0,
'april': 0,
'may': 0,
'june': 0,
'july': 0
};
for (i = 0; i < Object.keys(actualIncome).length; i++) {
for (j = 0; j < Object.keys(file[Object.keys(actualIncome)[i]]['DD']['in']).length; j++) {
actualIncome[Object.keys(actualIncome)[i]] += file[Object.keys(actualIncome)[i]]['DD']['in'][Object.keys(file[Object.keys(actualIncome)[i]]['DD']['in'])[j]];
}
}
//go through each data in predicted income and actual income, find the biggest and set it as the scale.
for (i = 0; i < Object.keys(predictedIncome).length; i++) {
if (parseInt(predictedIncome[Object.keys(predictedIncome)[i]]) >= scale) {
scale = parseInt(predictedIncome[Object.keys(predictedIncome)[i]])
}
}
for (i = 0; i < Object.keys(actualIncome).length; i++) {
if (parseInt(actualIncome[Object.keys(actualIncome)[i]]) >= scale) {
scale = parseInt(actualIncome[Object.keys(actualIncome)[i]])
}
}
if (scale <= 1500) {
scale = 1500;
interval = 0;
} else if (scale <= 2000) {
scale = 2000;
interval = 0;
} else if (scale <= 2500) {
scale = 2500;
interval = 0;
} else if (scale <= 3000) {
scale = 3000;
interval = 0;
} else if (scale <= 3500) {
scale = 3500;
interval = 0;
} else if (scale <= 4000) {
scale = 4000;
interval = 0;
} else if (scale <= 5000) {
scale = 5000;
interval = 1;
} else if (scale <= 6000) {
scale = 6000;
interval = 1;
} else if (scale <= 7000) {
scale = 7000;
interval = 1;
} else if (scale <= 8000) {
scale = 8000;
interval = 2;
} else if (scale <= 10000) {
scale = 10000;
interval = 2;
} else {
scale = 100000;
interval = 3;
};
//+++++END SET INITIAL VARIABLES++++\\
//+++++SET INITIAL FUNCTIONS++++\\
var setMarkers = function(mod) {
$('#markers').html("")
for (i = 0; i < scale + 1; i++) {
if (i == threshold) {
$('#markers').append("
£" + i + "
")
$("#threshold").css({
'bottom': (((i / scale) * 60) + 24.5) + 'vh',
'width': '88vw',
'color': '#F47599',
'background-color': '#F47599',
'z-index': '2'
});
};
//this stops it printing 1500 over a threshold of 1480
if (((i <= threshold) && (i >= threshold - 100)) || ((i >= threshold) && (i <= threshold + 100))) {} else if (i % mod == 0) {
$('#markers').append("£" + i + "
")
$("#" + i).css('bottom', (((i / scale) * 60) + 24.5) + 'vh');
}
}
};
//
var animateBars = function() {
for (i = 0; i < 12; i++) {
//If the direct debit account has not yet been updated for that month.
if (file[Object.keys(file)[i + 1]]['DD']['updated'] == 'no') {
$("#bar" + i).css('opacity', '0.3')
if (predictedIncome[Object.keys(predictedIncome)[i]] < threshold) {
$("#bar" + i).css('background-color', '#F03c2b')
}
if (predictedIncome[Object.keys(predictedIncome)[i]] == threshold) {
$("#bar" + i).css('background-color', '#F39c4b')
}
if (predictedIncome[Object.keys(predictedIncome)[i]] > threshold) {
$("#bar" + i).css('background-color', '#61E1B4')
}
$("#bar" + i).animate({
'height': ((predictedIncome[Object.keys(predictedIncome)[i]] / scale) * 60) + "vh"
}, 1000)
} else {
$("#bar" + i).css('opacity', '1')
if (actualIncome[Object.keys(actualIncome)[i]] < threshold) {
$("#bar" + i).css('background-color', '#F03c2b')
}
if (actualIncome[Object.keys(actualIncome)[i]] == threshold) {
$("#bar" + i).css('background-color', '#F39c4b')
}
if (actualIncome[Object.keys(actualIncome)[i]] > threshold) {
$("#bar" + i).css('background-color', '#61E1B4')
}
$("#bar" + i).animate({
'height': ((actualIncome[Object.keys(actualIncome)[i]] / scale) * 60) + "vh"
}, 1000)
}
}
};
var resetOverview = function() {
currentMonth = 'none';
currentAccount = 'none';
//===Calculate the amount of money budgeted each month for the DD account===\\
monthlyDD = 0;
for (i = 0; i < Object.keys(file['overview']['budgetedMonthlyAccumulation']).length; i++) {
monthlyDD += file['overview']['budgetedMonthlyAccumulation'][Object.keys(file['overview']['budgetedMonthlyAccumulation'])[i]];
}
for (i = 0; i < Object.keys(file['overview']['budgetedDD']).length; i++) {
monthlyDD += file['overview']['budgetedDD'][Object.keys(file['overview']['budgetedDD'])[i]];
}
//===Calculate the amount of money budgeted each month for the Spending account===\\
monthlySpend = 0;
for (i = 0; i < Object.keys(file['overview']['budgetedSpending']).length; i++) {
monthlySpend += file['overview']['budgetedSpending'][Object.keys(file['overview']['budgetedSpending'])[i]];
}
//===Calculate the amount of money budgeted each month for the Saving account===\\
monthlySave = 0;
for (i = 0; i < Object.keys(file['overview']['budgetedSaving']).length; i++) {
monthlySave += file['overview']['budgetedSaving'][Object.keys(file['overview']['budgetedSaving'])[i]];
}
threshold = monthlySpend + monthlySave + monthlyDD;
intervalList = [500, 1000, 2000, 5000];
interval = 0;
scale = 0;
//====predicted income totals====\\
predictedIncome = {
'august': 0,
'september': 0,
'october': 0,
'november': 0,
'december': 0,
'january': 0,
'february': 0,
'march': 0,
'april': 0,
'may': 0,
'june': 0,
'july': 0
};
for (i = 0; i < Object.keys(predictedIncome).length; i++) {
for (j = 0; j < Object.keys(file[Object.keys(predictedIncome)[i]]['DD']['predictedIn']).length; j++) {
predictedIncome[Object.keys(predictedIncome)[i]] += file[Object.keys(predictedIncome)[i]]['DD']['predictedIn'][Object.keys(file[Object.keys(predictedIncome)[i]]['DD']['predictedIn'])[j]];
}
}
//====allocate a pseudo Roll Over for Predictions====\\
numberOfMonthsToPredict = 0;
for (i = 0; i < Object.keys(predictedIncome).length; i++) {
if (file[Object.keys(predictedIncome)[i]]['DD']['updated'] == 'no') {
numberOfMonthsToPredict++;
}
}
tempRollOver = file['overview']['accumulatedDD']['Accumulated Roll Over'];
for (i = (12 - numberOfMonthsToPredict); i < Object.keys(predictedIncome).length; i++) {
while ((predictedIncome[Object.keys(predictedIncome)[i]] < threshold) && (tempRollOver > 0)) {
predictedIncome[Object.keys(predictedIncome)[i]]++
tempRollOver--
}
}
//====if there is any of the roll over left - split it between the months====\\
if (tempRollOver > 0) {
for (i = (12 - numberOfMonthsToPredict); i < Object.keys(predictedIncome).length; i++) {
predictedIncome[Object.keys(predictedIncome)[i]] += parseInt(tempRollOver / numberOfMonthsToPredict)
}
}
//====actual income totals====\\
actualIncome = {
'august': 0,
'september': 0,
'october': 0,
'november': 0,
'december': 0,
'january': 0,
'february': 0,
'march': 0,
'april': 0,
'may': 0,
'june': 0,
'july': 0
};
for (i = 0; i < Object.keys(actualIncome).length; i++) {
for (j = 0; j < Object.keys(file[Object.keys(actualIncome)[i]]['DD']['in']).length; j++) {
actualIncome[Object.keys(actualIncome)[i]] += file[Object.keys(actualIncome)[i]]['DD']['in'][Object.keys(file[Object.keys(actualIncome)[i]]['DD']['in'])[j]];
}
}
//go through each data in predicted income and actual income, find the biggest and set it as the scale.
for (i = 0; i < Object.keys(predictedIncome).length; i++) {
if (parseInt(predictedIncome[Object.keys(predictedIncome)[i]]) >= scale) {
scale = parseInt(predictedIncome[Object.keys(predictedIncome)[i]])
}
}
for (i = 0; i < Object.keys(actualIncome).length; i++) {
if (parseInt(actualIncome[Object.keys(actualIncome)[i]]) >= scale) {
scale = parseInt(actualIncome[Object.keys(actualIncome)[i]])
}
}
if (scale <= 1500) {
scale = 1500;
interval = 0;
} else if (scale <= 2000) {
scale = 2000;
interval = 0;
} else if (scale <= 2500) {
scale = 2500;
interval = 0;
} else if (scale <= 3000) {
scale = 3000;
interval = 0;
} else if (scale <= 3500) {
scale = 3500;
interval = 0;
} else if (scale <= 4000) {
scale = 4000;
interval = 0;
} else if (scale <= 5000) {
scale = 5000;
interval = 1;
} else if (scale <= 6000) {
scale = 6000;
interval = 1;
} else if (scale <= 7000) {
scale = 7000;
interval = 1;
} else if (scale <= 8000) {
scale = 8000;
interval = 2;
} else if (scale <= 10000) {
scale = 10000;
interval = 2;
} else {
scale = 100000;
interval = 3;
};
setMarkers(intervalList[interval])
location = "frontPage";
$('#topBanner').css('color', '#Fef9f0')
$('.bannerButton').css('color', '#Fef9f0')
$('#graph').animate({
'left': '0vw'
}, 200)
$('.bar').animate({
'height': '60vh'
}, 1000)
for (i = 0; i < 12; i++) {
$('#bar' + i).animate({
'height': (((i + 1) / 12) * 60) + 'vh'
}, 1000)
}
$("#barBreakDown").animate({
'height': '2.5vh'
}, 1000)
$('.bar').animate({
'height': '1vh'
}, 1000)
setTimeout(function() {
animateBars()
$("#barBreakDown").css({
'background': '-webkit-linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'background': ' -o-linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'background': '-moz-linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'background': 'linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'box-shadow': 'inset 0.5vw 0.5vh 1.5vh 0vh #383132'
})
$("#animationBar").fadeOut();
$("#barBreakDown").animate({
'height':"0vh",
'left': '10vw',
'width': '3vw'
}, 1000)
$('.banner').css({
'background-color': '#43b6e7'
})
$('#markers').fadeIn('slow');
$('#xaxis').fadeIn('slow');
$('#labels').fadeIn('slow');
}, 3000);
$('#threshold').mouseover(function(){
$("#barBreakDown").animate({
'height':((threshold/scale)*60)+"vh",'width':"88vw"},200)
$("#barBreakDown").css('opacity','0.5')
$("#barBreakDown").html("Monthly Savings:£"+monthlySave+" Monthly Spend:£"+monthlySpend+" Monthly DD:£"+monthlyDD)
});
$('#threshold').mouseout(function(){
$("#barBreakDown").animate({
'height':"0vh",'width':"6vw"},200)
$("#barBreakDown").css('opacity','1')
$("#barBreakDown").html('')
});
};
var animatePies = function() {
setTimeout(function() {
for (i = 0; i < 11; i++) {
$("#A" + (i + 1) + "clip").css("transform", "rotate(" + (i + 1) * 30 + "deg)")
$("#B" + (i + 1) + "clip").css("transform", "rotate(" + (i + 1) * 30 + "deg)")
$("#C" + (i + 1) + "clip").css("transform", "rotate(" + (i + 1) * 30 + "deg)")
$("#D" + (i + 1) + "clip").css("transform", "rotate(" + (i + 1) * 30 + "deg)")
$("#A" + (i + 1) + "slice").css("transform", "rotate(30deg)")
$("#B" + (i + 1) + "slice").css("transform", "rotate(30deg)")
$("#C" + (i + 1) + "slice").css("transform", "rotate(30deg)")
$("#D" + (i + 1) + "slice").css("transform", "rotate(30deg)")
}
}, 800)
};
var prepPieData = function(chart, account) {
//spending account
var PieTotal = 0;
var PieValues = [];
var PieLabels = [];
var biggestSlice = [0, 'label', 'index'];
for (i = 0; i < Object.keys(file[currentMonth][account]['out']).length; i++) {
//if there are more than 12 items, group all final items together.
if (PieValues.length >= 12) {
PieValues[11] += file[currentMonth][account]['out'][Object.keys(file[currentMonth][account]['out'])[i]];
PieTotal += file[currentMonth][account]['out'][Object.keys(file[currentMonth][account]['out'])[i]];
PieLabels[11] = "Other";
} else {
PieValues.push(file[currentMonth][account]['out'][Object.keys(file[currentMonth][account]['out'])[i]]);
PieTotal += file[currentMonth][account]['out'][Object.keys(file[currentMonth][account]['out'])[i]]
PieLabels.push(Object.keys(file[currentMonth][account]['out'])[i]);
}
}
var numberOfValues = PieValues.length;
//find the biggest value
for (i = 0; i < numberOfValues; i++) {
if (PieValues[i] > biggestSlice[0]) {
biggestSlice[0] = PieValues[i];
biggestSlice[1] = PieLabels[i];
biggestSlice[2] = i;
}
};
//remove the biggest value from the pie arrays
PieValues.splice(biggestSlice[2], 1);
PieLabels.splice(biggestSlice[2], 1);
//prepend the biggest value to the pie arrays
PieValues.unshift(biggestSlice[0]);
PieLabels.unshift(biggestSlice[1]);
var runningTotal = 0;
for (i = 0; i < numberOfValues; i++) {
$("#" + chart + i + "slice").attr('value', "£" + PieValues[i])
$("#" + chart + i + "slice").attr('data', PieLabels[i])
PieValues[i] = (PieValues[i] / PieTotal) * 360;
runningTotal += PieValues[i];
$("#" + chart + (i + 1) + "clip").css("transform", "rotate(" + runningTotal + "deg)")
if (i != 0) {
$("#" + chart + (i) + "slice").css("transform", "rotate(" + PieValues[i] + "deg)")
}
}
//if there are less than 12 items, delete unnecesary ones
for (i = Object.keys(file[currentMonth][account]['out']).length; i < 12; i++) {
$("#" + chart + (i) + "slice").css("transform", "rotate(0deg)")
$('.slice0, .slice1, .slice2, .slice3, .slice4, .slice5, .slice6, .slice7, .slice8, .slice9, .slice10, .slice11').hover(function() {
var a = $(window).width();
var b = $(window).height();
var x = (event.pageX / a) * 100;
var y = (event.pageY / b) * 100;
if (x > 90) {
x -= 30;
} else if (x > 70) {
x -= 15;
}
$("#info").css({
top: (y + 5) + "vh",
left: x + 'vw'
});
$('#info').show();
$('#info').html($(this).attr('data') + ": " + $(this).attr('value'))
});
$('.slice0, .slice1, .slice2, .slice3, .slice4, .slice5, .slice6, .slice7, .slice8, .slice9, .slice10, .slice11').mouseout(function() {
$('#info').html('')
$('#info').hide();
});
//click on a pie chart to see details
$('.slice0, .slice1, .slice2, .slice3, .slice4, .slice5, .slice6, .slice7, .slice8, .slice9, .slice10, .slice11').click(function() {
switch ($(this).attr('id').substr(0, 1)) {
case 'A':
currentAccount = 'DD'
var tableArray = [];
for(i=0;iNumber(tableArray[(i*3)+2])){
tableColor += "green'"
}
else{
tableColor += "orange'"
}
table += ""
table += ""+tableArray[(i*3)]+" "
table += "£"+tableArray[(i*3)+1]+" "
table += "£"+tableArray[(i*3)+2]+" "
table += " "
}
table += ""
$("#accountDetailsPage").append("OUT: "+table);
tableArray = [];
for(i=0;i"
table += ""+tableArray[(i*2)]+" "
table += "£"+tableArray[(i*2)+1]+" "
table += ""
}
table += ""
$("#accountDetailsPage").append(" IN: "+table);
break;
case 'B':
currentAccount = 'spending'
var tableArray = [];
for(i=0;iNumber(tableArray[(i*3)+2])){
tableColor += "green'"
}
else{
tableColor += "orange'"
}
table += ""
table += ""+tableArray[(i*3)]+" "
table += "£"+tableArray[(i*3)+1]+" "
table += "£"+tableArray[(i*3)+2]+" "
table += " "
}
table += ""
$("#accountDetailsPage").append("OUT: "+table);
break;
case 'C':
currentAccount = 'midTermSaving'
var tableArray = [];
for(i=0;i"
table += ""+tableArray[(i*2)]+" "
table += "£"+tableArray[(i*2)+1]+" "
table += ""
}
table += ""
$("#accountDetailsPage").append("OUT: "+table);
break;
}
location = "accountDetailsPage";
$('#topBanner').html(currentAccount + ': ' + currentMonth);
$('#accountDetailsPage').css('top', '11vh');
});
}
};
//+++++END SET INITIAL FUNCTIONS++++\\
setMarkers(intervalList[interval])
$('#loginPage').animate({
'top': '15vh'
}, 400);
$('#loginPage').animate({
'top': '7vh'
}, 200);
$('#loginPage').animate({
'top': '10vh'
}, 300);
//EDITPOINT -
// $('#login').focus();
$('#login').keydown(function(key) {
if ((key.which == 13) && ($('#login').val() == '56home24')) {
location = "frontPage";
$('#loginPage').animate({
'top': '100vh'
}, 500);
$('#back').css('background-color', "#43b6e7")
$('#topBanner').css({
'top': '0vh'
})
$('#bottomBanner').css({
'top': '90vh'
})
$('#sun').animate({
'top': '20vh',
'left': '60vh'
}, 1000);
setTimeout(function() {
$('#topBanner').css('color', '#Fef9f0')
$('.bannerButton').css('color', '#Fef9f0')
$('#graph').animate({
'left': '0vw'
}, 200)
$('.bar').animate({
'height': '60vh'
}, 1000)
for (i = 0; i < 12; i++) {
$('#bar' + i).animate({
'height': (((i + 1) / 12) * 60) + 'vh'
}, 1000)
}
$("#barBreakDown").animate({
'height': '2.5vh'
}, 1000)
$('.bar').animate({
'height': '1vh'
}, 1000)
setTimeout(function() {
animateBars()
$("#barBreakDown").css({
'background': '-webkit-linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'background': ' -o-linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'background': '-moz-linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'background': 'linear-gradient(#F47599 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySave / threshold) * 100) + '%,#43b6e7 ' + parseInt((monthlySpend / threshold) * 100) + '%,#FFCF4B ' + parseInt((monthlyDD / threshold) * 100) + '%)',
'box-shadow': 'inset 0.5vw 0.5vh 1.5vh 0vh #383132'
})
$("#animationBar").fadeOut();
$("#barBreakDown").animate({
'height':"0vh",
'left': '10vw',
'width': '3vw'
}, 1000)
$('.banner').css({
'background-color': '#43b6e7'
})
$('#markers').fadeIn('slow');
$('#xaxis').fadeIn('slow');
$('#labels').fadeIn('slow');
}, 3000);
}, 3000);
} else if (key.which == 13) {
$('#loginPage').animate({
'left': '5vh'
}, 100);
$('#loginPage').animate({
'left': '15vh'
}, 100);
$('#loginPage').animate({
'left': '10vh'
}, 100);
}
})
$('#threshold').mouseover(function(){
$("#barBreakDown").animate({
'height':((threshold/scale)*60)+"vh",'width':"88vw"},200)
$("#barBreakDown").css('opacity','0.5')
$("#barBreakDown").html("Monthly Savings:£"+monthlySave+" Monthly Spend:£"+monthlySpend+" Monthly DD:£"+monthlyDD)
});
$('#threshold').mouseout(function(){
$("#barBreakDown").animate({
'height':"0vh",'width':"6vw"},200)
$("#barBreakDown").css('opacity','1')
$("#barBreakDown").html('')
});
$('.bannerButton').click(function() {
switch($(this).text()){
//button chosen is exports
case "export":
//=======Start exporting the file====\\
//===== overviewFile =====\\
var overviewFile = "'overview': {"
//===== accumulatedDD ====\\
var accumulatedDDFile = "'accumulatedDD': {";
for(i=0;i"+fileFile+"")
//content of wizard bar
//
$('#bar').text("Export");
//wizard colour//
$('#wizard').css("background-color", "rgba(56,49,50,0.8)")
$('#wizard').show();
function selectText(element) {
var doc = document
, text = doc.getElementById(element)
, range, selection
;
if (doc.body.createTextRange) { //ms
range = doc.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) { //all others
selection = window.getSelection();
range = doc.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
//
selectText('xmp')
//blur background
$('#frontPage').css({
"-webkit-filter": "blur(1vh)",
"-moz-filter": "blur(1vh)",
"-o-filter": "blur(1vh)",
"-ms-filter": "blur(1vh)",
"filter": "blur(1vh)"
});
//if back button pressed
$('.backButton').click(function() {
$('#wizardContents').html('');
$('#wizard').hide();
$('#frontPage').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
});
break;
case "alerts":
$('#wizardContents').html("Enter an alert and then select a month.
")
//fill wizard list
for(i=1;i"+Object.keys(file)[i]+"");
}
//content of wizard bar
$('#bar').text("Add An Alert");
//wizard colour
$('#wizard').css("background-color", "rgba(56,49,50,0.8)")
$('#wizard').show();
//blur background
$('#frontPage').css({
"-webkit-filter": "blur(1vh)",
"-moz-filter": "blur(1vh)",
"-o-filter": "blur(1vh)",
"-ms-filter": "blur(1vh)",
"filter": "blur(1vh)"
});
//
//focus on input
setTimeout(function() {
$("#input1").focus();
}, 0)
//if back button pressed
$('.backButton').click(function() {
$('#wizardContents').html('');
$('#wizard').hide();
$('#frontPage').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
});
$('.altButton').click(function() {
if($('#input1').val()!=""){
var newAlert = $('#input1').val();
var alertMonth = $(this).text();
//save the alert
file['overview']['alerts'][alertMonth].push(newAlert)
//close the wizard
$('#wizardContents').html('');
$('#wizard').hide();
$('#frontPage').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
}
});
break;
//button chosen is accounts
case "accounts":
location = "monthOverviewPage";
currentMonth = "overview";
//bring in the tiles
$('#directDebitOverview').html("Direct Debitview
")
$('#spendingOverview').html("Spendingview
")
$('#midTermSavingsOverview').html("Mid Term Savingsview
")
$('#longTermSavingsOverview').html("Save To Buyview
")
$('#topBanner').html(currentMonth);
$('#monthOverviewPage').css('top', '11vh');
setTimeout(function() {
$('#backButton').show();
$('#directDebitOverview').animate({
'top': '16vh'
}, 400);
$('#spendingOverview').animate({
'right': '8vw'
}, 400);
$('#longTermSavingsOverview').animate({
'top': '57vh'
}, 400);
$('#midTermSavingsOverview').animate({
'left': '8vw'
}, 400);
$('#directDebitOverview').animate({
'top': '12vh'
}, 200);
$('#spendingOverview').animate({
'right': '4vw'
}, 200);
$('#longTermSavingsOverview').animate({
'top': '61vh'
}, 200);
$('#midTermSavingsOverview').animate({
'left': '4vw'
}, 200);
$('#directDebitOverview').animate({
'top': '14vh'
}, 300);
$('#spendingOverview').animate({
'right': '6vw'
}, 300);
$('#longTermSavingsOverview').animate({
'top': '59vh'
}, 300);
$('#midTermSavingsOverview').animate({
'left': '6vw'
}, 300);
}, 500)
//account selected
$('.viewButton').click(function() {
location = "updatePage";
currentAccount = $(this).attr('data');
$('#topBanner').html(currentAccount + ': ' + currentMonth);
$('#updatePage').css('top', '11vh');
//which account was selected?
switch(currentAccount){
case "DD":
var accountTotal = 0;
for(i=0;iAccount Total:£"+accountTotal+" Roll Over:£"+file['overview']['accumulatedDD']['Accumulated Roll Over']+"
")
//set up the page with correct amounts of liquid
for(i=1;i
"+Object.keys(file['overview']['accumulatedDD'])[i].substring(12,Object.keys(file['overview']['accumulatedDD'])[i].length)+" Target:£"+file['overview']['accumulatedDDTarget'][Object.keys(file['overview']['accumulatedDDTarget'])[i]]+" Current:£"+file['overview']['accumulatedDD'][Object.keys(file['overview']['accumulatedDD'])[i]]+"
");
if(((Number($('#current'+i).text())/Number($('#target'+i).text()))*100) >= 100){
$('#water'+i).css('height','105%')
}
else{
Number($('#current'+i).text())
$('#water'+i).css('height',((Number($('#current'+i).text())/Number($('#target'+i).text()))*100)+5+'%')
}
}
var tableArray = [];
for(i=0;i"
table += ""+tableArray[(i*2)]+" "
table += "£"+tableArray[(i*2)+1]+" "
table += ""
}
table += ""
$('#bottleContainer').append(" Amount Budgeted Per Month: "+table)
//Double click on an editable field.
$('.edit').dblclick(function(){
var editContents = $(this).text();
var editIndex = $(this).attr('value');
var editType = $(this).attr('id').substring(0,3);
switch(editType){
case "tit":
editType = "title"
break;
case "tar":
editType = "target";
break;
case "cur":
editType = "current";
break;
case "bud":
editType = "budget";
break;
}
$('#wizardContents').html("go
")
//content of wizard bar
$('#bar').text("edit: "+editType);
//wizard colour
$('#wizard').css("background-color", "rgba(56,49,50,0.4)")
$('#wizard').show();
//blur background
$('#bottleContainer').css({
"-webkit-filter": "blur(1vh)",
"-moz-filter": "blur(1vh)",
"-o-filter": "blur(1vh)",
"-ms-filter": "blur(1vh)",
"filter": "blur(1vh)"
});
//focus on input
setTimeout(function() {
$("#input1").focus();
}, 0)
//if back button pressed
$('.backButton').click(function() {
$('#wizardContents').html('');
$('#wizard').hide();
$('#bottleContainer').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
});
//pressing enter has the same effect as go button
$('.input').keydown(function(key) {
if (key.which == 13) {
$("#editGoButton").trigger('click')
}});
$('#editGoButton').click(function() {
if($('#input1').val()!=""){
var newContent = $('#input1').val();
switch(editType){
case "title":
//first amend the title for overview section of file
newContent = "Accumulated "+newContent;
editContents = "Accumulated "+editContents;
file['overview']['accumulatedDD'][newContent] = file['overview']['accumulatedDD'][editContents];
delete file['overview']['accumulatedDD'][editContents];
file['overview']['accumulatedDDTarget'][newContent] = file['overview']['accumulatedDDTarget'][editContents];
delete file['overview']['accumulatedDDTarget'][editContents];
file['overview']['budgetedMonthlyAccumulation'][newContent] = file['overview']['budgetedMonthlyAccumulation'][editContents];
delete file['overview']['budgetedMonthlyAccumulation'][editContents];
//then amend each month that has not yet been updated
for(i=1;i= 100){
$('#water'+editIndex).css('height','105%')
}
else{
Number($('#current'+editIndex).text())
$('#water'+editIndex).css('height',((Number($('#current'+editIndex).text())/Number($('#target'+editIndex).text()))*100)+5+'%')
}
break;
case "current":
var tempTitle = "Accumulated "+$('#title'+editIndex).text()
//first amend the current amount in overview section of file
file['overview']['accumulatedDD'][tempTitle] = Number(newContent);
//Change the amount in Roll Over
file['overview']['accumulatedDD']['Accumulated Roll Over'] += (editContents - newContent)
//then amend the amount on the bottle
$('#current'+editIndex).text(newContent);
$('#currentFigures').html("Account Total:£"+accountTotal+" Roll Over:£"+file['overview']['accumulatedDD']['Accumulated Roll Over'])
//finally update the water level
if(((Number($('#current'+editIndex).text())/Number($('#target'+editIndex).text()))*100) >= 100){
$('#water'+editIndex).css('height','105%')
}
else{
Number($('#current'+editIndex).text())
$('#water'+editIndex).css('height',((Number($('#current'+editIndex).text())/Number($('#target'+editIndex).text()))*100)+5+'%')
}
//Finally reset the thresholds.
$('#backButton').trigger('click');
$('#backButton').trigger('click');
resetOverview()
break;
case "budget":
//first amend the budget for overview section of file
if($('#name'+(editIndex-1)).text().substring(0,11)=='Accumulated'){
file['overview']['budgetedMonthlyAccumulation'][$('#name'+(editIndex-1)).text()] = Number(newContent);
}
else{
file['overview']['budgetedDD'][$('#name'+(editIndex-1)).text()] = Number(newContent);
}
//
//then amend the budget in the table
$('#budget'+editIndex).text(newContent);
//Finally reset the thresholds.
$('#backButton').trigger('click');
$('#backButton').trigger('click');
resetOverview()
break;
}
$('#wizardContents').html('');
$('#wizard').hide();
$('#bottleContainer').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
}
});
});
break;
case "spending":
var tableArray = [];
for(i=0;i"
table += ""+tableArray[(i*2)]+" "
table += "£"+tableArray[(i*2)+1]+" "
table += ""
}
table += ""
$('#updatePage').html(table)
//Double click on an editable field.
$('.edit').dblclick(function(){
var editContents = $(this).text();
var editIndex = $(this).attr('value');
var editType = $(this).attr('id').substring(0,3);
switch(editType){
case "nam":
editType = "name"
break;
case "bud":
editType = "budget";
break;
}
$('#wizardContents').html("go
")
//content of wizard bar
$('#bar').text("edit: "+editType);
//wizard colour
$('#wizard').css("background-color", "rgba(56,49,50,0.4)")
$('#wizard').show();
//blur background
$('#bottleContainer').css({
"-webkit-filter": "blur(1vh)",
"-moz-filter": "blur(1vh)",
"-o-filter": "blur(1vh)",
"-ms-filter": "blur(1vh)",
"filter": "blur(1vh)"
});
//focus on input
setTimeout(function() {
$("#input1").focus();
}, 0)
//if back button pressed
$('.backButton').click(function() {
$('#wizardContents').html('');
$('#wizard').hide();
$('#bottleContainer').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
});
//pressing enter has the same effect as go button
$('.input').keydown(function(key) {
if (key.which == 13) {
$("#editGoButton").trigger('click')
}});
$('#editGoButton').click(function() {
if($('#input1').val()!=""){
var newContent = $('#input1').val();
switch(editType){
case "name":
//first amend the title for overview section of file
file['overview']['budgetedSpending'][newContent] = file['overview']['budgetedSpending'][editContents];
delete file['overview']['budgetedSpending'][editContents];
//then amend each month that has not yet been updated
for(i=1;iAccount Total:£"+accountTotal+" Not Yet Assigned:£"+file['overview']['midTermSaving']['Not Yet Assigned']+"
")
//set up the page with correct amounts of liquid
for(i=1;i
"+Object.keys(file['overview']['midTermSaving'])[i]+" Target:£"+file['overview']['midTermSavingTarget'][Object.keys(file['overview']['midTermSavingTarget'])[i]]+" Current:£"+file['overview']['midTermSaving'][Object.keys(file['overview']['midTermSaving'])[i]]+"
");
if(((Number($('#current'+i).text())/Number($('#target'+i).text()))*100) >= 100){
$('#water'+i).css('height','105%')
}
else{
Number($('#current'+i).text())
$('#water'+i).css('height',((Number($('#current'+i).text())/Number($('#target'+i).text()))*100)+5+'%')
}
}
//Double click on an editable field.
$('.edit').dblclick(function(){
var editContents = $(this).text();
var editIndex = $(this).attr('value');
var editType = $(this).attr('id').substring(0,3);
switch(editType){
case "tit":
editType = "title"
break;
case "tar":
editType = "target";
break;
case "cur":
editType = "current";
break;
}
$('#wizardContents').html("go
")
//content of wizard bar
$('#bar').text("edit: "+editType);
//wizard colour
$('#wizard').css("background-color", "rgba(56,49,50,0.4)")
$('#wizard').show();
//blur background
$('#bottleContainer').css({
"-webkit-filter": "blur(1vh)",
"-moz-filter": "blur(1vh)",
"-o-filter": "blur(1vh)",
"-ms-filter": "blur(1vh)",
"filter": "blur(1vh)"
});
//focus on input
setTimeout(function() {
$("#input1").focus();
}, 0)
//if back button pressed
$('.backButton').click(function() {
$('#wizardContents').html('');
$('#wizard').hide();
$('#bottleContainer').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
});
//pressing enter has the same effect as go button
$('.input').keydown(function(key) {
if (key.which == 13) {
$("#editGoButton").trigger('click')
}});
$('#editGoButton').click(function() {
if($('#input1').val()!=""){
var newContent = $('#input1').val();
switch(editType){
case "title":
//first amend the title for overview section of file
file['overview']['midTermSaving'][newContent] = file['overview']['midTermSaving'][editContents];
delete file['overview']['midTermSaving'][editContents];
file['overview']['midTermSavingTarget'][newContent] = file['overview']['midTermSavingTarget'][editContents];
delete file['overview']['midTermSavingTarget'][editContents];
//then amend each month that has not yet been updated
for(i=1;i= 100){
$('#water'+editIndex).css('height','105%')
}
else{
Number($('#current'+editIndex).text())
$('#water'+editIndex).css('height',((Number($('#current'+editIndex).text())/Number($('#target'+editIndex).text()))*100)+5+'%')
}
break;
case "current":
//first amend the current amount in overview section of file
file['overview']['midTermSaving'][$('#title'+editIndex).text()] = Number(newContent);
//Change the amount in NOT YET ASSIGNED
file['overview']['midTermSaving']['Not Yet Assigned'] += (editContents - newContent)
//then amend the amount on the bottle
$('#current'+editIndex).text(newContent);
$('#currentFigures').html("Account Total:£"+accountTotal+" Not Yet Assigned:£"+file['overview']['midTermSaving']['Not Yet Assigned'])
//finally update the water level
if(((Number($('#current'+editIndex).text())/Number($('#target'+editIndex).text()))*100) >= 100){
$('#water'+editIndex).css('height','105%')
}
else{
Number($('#current'+editIndex).text())
$('#water'+editIndex).css('height',((Number($('#current'+editIndex).text())/Number($('#target'+editIndex).text()))*100)+5+'%')
}
break;
}
$('#wizardContents').html('');
$('#wizard').hide();
$('#bottleContainer').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
}
});
});
break;
case "longTermSaving":
var savingsArray = [];
for(i=1;iMonth Amount In august £"+savingsArray[0]+" september £"+savingsArray[1]+" october £"+savingsArray[2]+" november £"+savingsArray[3]+" december £"+savingsArray[4]+" january £"+savingsArray[5]+" february £"+savingsArray[6]+" march £"+savingsArray[7]+" april £"+savingsArray[8]+" may £"+savingsArray[9]+" june £"+savingsArray[10]+" july £"+savingsArray[11]+"
")
break;
}
});
}
});
$('.bar').click(function() {
location = "monthOverviewPage";
currentMonth = $(this).attr('data');
//Check if the account has been updated for that month
if (file[currentMonth]['DD']['updated'] == 'no') {
$('#directDebitOverview').html("Direct Debitupdate
")
} else {
$('#directDebitOverview').html("Direct Debit ")
};
if (file[currentMonth]['spending']['updated'] == 'no') {
$('#spendingOverview').html("Spendingupdate
")
} else {
$('#spendingOverview').html("Spending ")
};
if (file[currentMonth]['midTermSaving']['updated'] == 'no') {
$('#midTermSavingsOverview').html("Mid Term Savingsupdate
")
} else {
$('#midTermSavingsOverview').html("Mid Term Savings ")
};
if (file[currentMonth]['longTermSaving']['updated'] == 'no') {
$('#longTermSavingsOverview').html("Save To Buyupdate
")
} else {
$('#longTermSavingsOverview').html("Save To Buy £"+file['overview']['longTermSaving'])
};
animatePies()
setTimeout(function() {
prepPieData('A', 'DD')
prepPieData('B', 'spending')
prepPieData('C', 'midTermSaving')
}, 1000)
$('#topBanner').html(currentMonth);
$('#monthOverviewPage').css('top', '11vh');
setTimeout(function() {
$('#backButton').show();
$('#directDebitOverview').animate({
'top': '16vh'
}, 400);
$('#spendingOverview').animate({
'right': '8vw'
}, 400);
$('#longTermSavingsOverview').animate({
'top': '57vh'
}, 400);
$('#midTermSavingsOverview').animate({
'left': '8vw'
}, 400);
$('#directDebitOverview').animate({
'top': '12vh'
}, 200);
$('#spendingOverview').animate({
'right': '4vw'
}, 200);
$('#longTermSavingsOverview').animate({
'top': '61vh'
}, 200);
$('#midTermSavingsOverview').animate({
'left': '4vw'
}, 200);
$('#directDebitOverview').animate({
'top': '14vh'
}, 300);
$('#spendingOverview').animate({
'right': '6vw'
}, 300);
$('#longTermSavingsOverview').animate({
'top': '59vh'
}, 300);
$('#midTermSavingsOverview').animate({
'left': '6vw'
}, 300);
if(file['overview']['alerts'][currentMonth].length>0){
$('#wizardContents').html("
")
//fill wizard list
for(i=0;i"+file['overview']['alerts'][currentMonth][i]+"
");
}
//content of wizard bar
$('#bar').text(currentMonth+": Alerts");
//wizard colour
$('#wizard').css("background-color", "rgba(56,49,50,0.8)")
$('#wizard').show();
//blur background
$('#monthOverviewPage').css({
"-webkit-filter": "blur(1vh)",
"-moz-filter": "blur(1vh)",
"-o-filter": "blur(1vh)",
"-ms-filter": "blur(1vh)",
"filter": "blur(1vh)"
});
//
//if back button pressed
$('.backButton').click(function() {
$('#wizardContents').html('');
$('#wizard').hide();
$('#monthOverviewPage').css({
"-webkit-filter": "blur(0vh)",
"-moz-filter": "blur(0vh)",
"-o-filter": "blur(0vh)",
"-ms-filter": "blur(0vh)",
"filter": "blur(0vh)"
})
});
}
}, 500)
$('.updateButton').click(function() {
location = "updatePage";
currentAccount = $(this).attr('data');
$('#topBanner').html(currentAccount + ': ' + currentMonth);
$('#updatePage').css('top', '11vh');
$('#updatePage').html(" Step 1. Download 'CSV' file for " + currentMonth + " Step 2. Open in excel and paste table into 'Bank Statement Converter.xlsx' Step 3. Paste output code below ");
});
});
$(document).on('keydown', '#update', function(key) {
if ((key.which == 13) && ($('#update').val() != '')) {
var updateArray = eval($('#update').val());
var amountOfTransactions = (updateArray.length / 4)
var updatePosition = 0;
var updatePage = function() {
$('#updatePage').html("")
var numberOfTypes = Object.keys(file[currentMonth][currentAccount][updateArray[updatePosition]]).length;
for (i = 0; i < Object.keys(file[currentMonth][currentAccount][updateArray[updatePosition]]).length; i++) {
$('#button' + i).html(Object.keys(file[currentMonth][currentAccount][updateArray[updatePosition]])[i])
//match the buttons in color group by letter
switch (Object.keys(file[currentMonth][currentAccount][updateArray[updatePosition]])[i].substring(0, 1)) {
case "A":
case "F":
case "K":
case "P":
case "U":
case "Z":
$('#button' + i).css('background-color', '#FFCF4B')
break;
case "B":
case "G":
case "L":
case "Q":
case "V":
$('#button' + i).css('background-color', '#61E1B4')
break;
case "C":
case "H":
case "M":
case "R":
case "W":
$('#button' + i).css('background-color', '#43b6e7')
break;
case "D":
case "I":
case "N":
case "S":
case "X":
$('#button' + i).css('background-color', '#F47599')
break;
case "E":
case "J":
case "O":
case "T":
case "Y":
$('#button' + i).css('background-color', '#854D8C')
break;
}
}
//if more need to be displayed on a seperate page
if ((numberOfTypes > 24)) {
$('#button23').html('more')
}
$('#updatePage').append("" + updateArray[(updatePosition + 1)] + ":" + updateArray[(updatePosition + 2)] + ":£" + updateArray[(updatePosition + 3)] + "
")
$('#progressBar').animate({
'width': ((((updatePosition - 1) / 4) / amountOfTransactions) * 100) + 3 + 'vw'
}, 0)
$('#progressBar').animate({
'width': (((updatePosition / 4) / amountOfTransactions) * 100) + 3 + 'vw'
}, 300)
$('.button').click(function() {
if ($(this).text() != "") {
var selection = $(this).text();
switch (selection) {
case 'more':
//clear all buttons
for (i = 0; i < 24; i++) {
$('#button' + i).html('')
}
for (i = 0; i < Object.keys(file[currentMonth][currentAccount][updateArray[updatePosition]]).length; i++) {
$('#button' + i).html(Object.keys(file[currentMonth][currentAccount][updateArray[updatePosition]])[i + 23])
}
break;
default:
file[currentMonth][currentAccount][updateArray[updatePosition]][selection] += updateArray[updatePosition + 3];
if (updatePosition == (amountOfTransactions * 4) - 4) {
$('#progressBar').animate({
'width': '100vw'
}, 300)
//clearbuttons
for (i = 0; i < 24; i++) {
$('#button' + i).html('')
}
$('#currentTransaction').html("Complete
")
//when you complete an update
$('.completeButton').click(function() {
file[currentMonth][currentAccount]['updated'] = 'yes';
switch (currentAccount) {
case "DD":
//calculate how much has gone into the account
var monthlyIncome = 0;
for (i = 0; i < Object.keys(file[currentMonth]['DD']['in']).length; i++) {
monthlyIncome += file[currentMonth]['DD']['in'][Object.keys(file[currentMonth]['DD']['in'])[i]];
}
// set up outgoings for the month as the amount going into the accumulated DD then add on outgoings made during the month
var monthlyDDOutgoings = 0;
for(i=0;i