jkbngl / FFD

FFD - Finance for dummies | Allow normal people to control their expenses and optimize their spending with a simple APP
GNU General Public License v3.0
1 stars 0 forks source link

Create the default chart of account onUserCreation #77

Closed jkbngl closed 4 years ago

jkbngl commented 4 years ago
CAR 1 GAS 2    
    INSURANCE 2    
    TAX 2    
    TIRES 2    
    OTHER 2    
    REPAIRS 2 MOTOR 3
        BREAKS 3
        WINDOWS 3
        OTHER 3
CLOTHES 1 SHOES 2    
    SHIRTS 2    
    TROUSERS 2    
    HOODIES 2    
    CAPS 2    
    OTHER 2    
EATING OUT 1 PIZZA 2    
    BURGER 2    
    HEALTHY 2    
    OTHER 2    
GROCERIES 1 FOR FAM 2    
    FOR ME 2    
    OTHER 2    
PHONE 1 CONTRACT 2    
    NEW PHONE 2    
    ACCESSORIES 2    
    OTHER 2    
PRESENTS 1 FOR MAM 2    
    FOR DAD 2    
    FOR GF 2    
    FOR FRIENDS 2    
    OTHER 2    
TRAVEL 1 HOTEL 2    
    FLIGHTS 2    
    EXCURSIONS 2    
    OTHER 2    
PUBLIC TRANSPORTATIN 1 TRAIN 2    
    BUS 2    
    CABLE CAR 2    
    CAR 2    
    SUBURBAN 2    
    OTHER 2    
jkbngl commented 4 years ago
INSERT INTO   ffd.account_dim (name, comment, level_type, parent_accountu, user_fk) VALUES   ('CAR', 'all car related costs', 1, null, {userId});
--
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('GAS', 'all gas costs   for the car', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('INSURANCE', 'all   insurcance costs for the car', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('TAX', 'all tac costs   for the car', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('TIRES', 'all costs   for tires for the car', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'other car   related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('REPAIRS', 'all car   related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('MOTOR', 'all motor   repairs costs for the car', 3, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('BREAKS', 'all breaks   repairs costs for the car', 3, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('WINDOWS','all windows   repairs costs for the car', 3, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER','all other   repairs costs for the car', 3, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('CLOTHES', 'all   clothes related costs', 1, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('SHOES', 'all costs   for shoes', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('SHIRTS', 'all costs   for shoes', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('TROUSERS', 'all costs   for trousers', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('HOODIES', 'all costs   for hoodies', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('CAPS', 'all costs for   caps', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all other   clothes related costs', 2, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('EATING OUT', 'all   costs related to eating out', 1, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('PIZZA', 'all costs   for eating out when eating pizza', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('BURGER', 'all costs   for eating out when eating burger', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('HEALTHY', 'all costs   for eating out when eating healthy', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all costs   for eating out when eating other stuff', 2, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('GROCERIES', 'all   costs related to groceries', 1, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FOR FAM', 'all costs   for groceries for the family', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FOR ME', 'all costs   for groceries for myself', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all other   groceries related costs', 2, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('PHONE', 'all phone   related costs', 1, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('CONTRACT', 'all phone   costs for contracts', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('NEW PHONE', 'all   costs for new phones', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('ACCESSOIRES', 'all   costs for accessoires of the phone, like covers', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all other   phone related costs', 2, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('PRESENTS', 'all costs   for presents', 1, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FOR MAM', 'all costs   for presents for mam', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FOR DAD', 'all costs   for presents for dad', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FOR GF', 'all costs   for presents for gf', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FOR FRIENDS', 'all   costs for presents for friends', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all presents   for other people', 2, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('TRAVEL', 'all travel   related costs', 1, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('HOTEL', 'all hotel   related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('FLIGHTS', 'all flight   related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('EXCURSIONS', 'all   excursions related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all other   related costs for travels', 2, null, {userId});
 
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('PUBLIC   TRANSPORTATION', 'all public transportations related costs', 1, null,   {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('TRAIN', 'all train   related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('BUS', 'all bus   related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('CABLE CAR', 'all   cable car related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('CAR', 'cost for e.g.   carsharing', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('SUBURBAN', 'all   suburban related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all other   public transportations related costs', 2, null, {userId});
INSERT INTO ffd.account_dim (name,   comment, level_type, parent_accountu, user_fk) VALUES ('OTHER', 'all other   costs', 1, null, {userId});
jkbngl commented 4 years ago

Final Version:

# CAR
cursor.execute(f"INSERT INTO   ffd.account_dim (name, comment, level_type, parent_account, user_fk) VALUES   ('CAR', 'all car related costs', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('GAS', 'all gas costs for the car', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('INSURANCE', 'all insurcance costs for the car', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('TAX', 'all tac costs for the car', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('TIRES', 'all costs for tires for the car', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'other car related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('REPAIRS', 'all car related repair costs', 2, {parent_account_id}, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('MOTOR', 'all motor repairs costs for the car', 3, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('BREAKS', 'all breaks repairs costs for the car', 3, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('WINDOWS','all windows repairs costs for the car', 3, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER','all other repairs costs for the car', 3, {parent_account_id}, {userId}) RETURNING id;")
# CLOTHES
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('CLOTHES', 'all clothes related costs', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('SHOES', 'all costs for shoes', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('SHIRTS', 'all costs for shoes', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('TROUSERS', 'all costs for trousers', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('HOODIES', 'all costs for hoodies', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('CAPS', 'all costs for caps', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all other clothes related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
# CLOTHES
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('EATING OUT', 'all costs related to eating out', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('PIZZA', 'all costs for eating out when eating pizza', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('BURGER', 'all costs for eating out when eating burger', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('HEALTHY', 'all costs for eating out when eating healthy', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all costs for eating out when eating other stuff', 2, {parent_account_id}, {userId}) RETURNING id;")
# GROCERIES
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('GROCERIES', 'all costs related to groceries', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FOR FAM', 'all costs for groceries for the family', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FOR ME', 'all costs for groceries for myself', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all other groceries related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
# PHONE
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('PHONE', 'all phone related costs', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('CONTRACT', 'all phone costs for contracts', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('NEW PHONE', 'all costs for new phones', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('ACCESSOIRES', 'all costs for accessoires of the phone, like covers', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all other phone related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
# PRESENTS
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('PRESENTS', 'all costs for presents', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FOR MAM', 'all costs for presents for mam', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FOR DAD', 'all costs for presents for dad', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FOR GF', 'all costs for presents for gf', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FOR FRIENDS', 'all costs for presents for friends', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all presents for other people', 2, {parent_account_id}, {userId}) RETURNING id;")
# TRAVEL
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('TRAVEL', 'all travel related costs', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('HOTEL', 'all hotel related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('FLIGHTS', 'all flight related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('EXCURSIONS', 'all excursions related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all other related costs for travels', 2, {parent_account_id}, {userId}) RETURNING id;")
# PUBLIC TRANSPORTATION
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('PUBLIC TRANSPORTATION', 'all public transportations related costs', 1, null, {userId}) RETURNING id;")
parent_account_id = cursor.fetchone()[0]
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('TRAIN', 'all train related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('BUS', 'all bus related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('CABLE CAR', 'all cable car related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('CAR', 'cost for e.g. carsharing', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('SUBURBAN', 'all suburban related costs', 2, {parent_account_id}, {userId}) RETURNING id;")
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all other public transportations related costs', 2, {parent_account_id}, {userId}) RETURNING id;")

# OTHER
cursor.execute(f"INSERT INTO ffd.account_dim (name,   comment, level_type, parent_account, user_fk) VALUES ('OTHER', 'all other   costs', 1, null, {userId}) RETURNING id;")