# initial data to be import/entry current year statement (opening/closing balance)
db.define_table('Master_Account_Balance_Current_Year',
    Field('financial_year','date'), 
    Field('account_code','string',length=20), # unique
    Field('account_name','string',length=250),
    Field('total_opening_balance','decimal(20,2)',default=0), 
    Field('total_closing_balance','decimal(20,2)',default=0),
    Field('opening_balance_1','decimal(20,2)',default=0),
    Field('opening_balance_2','decimal(20,2)',default=0),
    Field('opening_balance_3','decimal(20,2)',default=0),
    Field('opening_balance_4','decimal(20,2)',default=0),
    Field('opening_balance_5','decimal(20,2)',default=0),
    Field('opening_balance_6','decimal(20,2)',default=0),
    Field('opening_balance_7','decimal(20,2)',default=0),
    Field('opening_balance_99','decimal(20,2)',default=0),
    Field('closing_balance_1','decimal(20,2)',default=0),
    Field('closing_balance_2','decimal(20,2)',default=0),
    Field('closing_balance_3','decimal(20,2)',default=0),
    Field('closing_balance_4','decimal(20,2)',default=0),
    Field('closing_balance_5','decimal(20,2)',default=0),
    Field('closing_balance_6','decimal(20,2)',default=0),
    Field('closing_balance_7','decimal(20,2)',default=0),
    Field('closing_balance_99','decimal(20,2)',default=0),
    Field('created_on', 'datetime', default=request.now, writable = False, readable = False),
    Field('created_by', db.auth_user, ondelete = 'NO ACTION', default=auth.user_id, writable = False, readable = False),
    Field('updated_on', 'datetime', update=request.now, writable = False, readable = False),
    Field('updated_by', db.auth_user, ondelete = 'NO ACTION', update=auth.user_id, writable = False, readable = False))

# initial data to be import and update at the end of the year
db.define_table('Master_Account_Balance',
    Field('financial_year','date'),
    Field('account_code','string',length=20),     
    Field('account_name','string',length=250),     
    Field('total_opening_balance','decimal(20,2)',default=0), 
    Field('total_closing_balance','decimal(20,2)',default=0),
    Field('opening_balance_1','decimal(20,2)',default=0),
    Field('opening_balance_2','decimal(20,2)',default=0),
    Field('opening_balance_3','decimal(20,2)',default=0),
    Field('opening_balance_4','decimal(20,2)',default=0),
    Field('opening_balance_5','decimal(20,2)',default=0),
    Field('opening_balance_6','decimal(20,2)',default=0),
    Field('opening_balance_7','decimal(20,2)',default=0),
    Field('opening_balance_99','decimal(20,2)',default=0),
    Field('closing_balance_1','decimal(20,2)',default=0),
    Field('closing_balance_2','decimal(20,2)',default=0),
    Field('closing_balance_3','decimal(20,2)',default=0),
    Field('closing_balance_4','decimal(20,2)',default=0),
    Field('closing_balance_5','decimal(20,2)',default=0),
    Field('closing_balance_6','decimal(20,2)',default=0),
    Field('closing_balance_7','decimal(20,2)',default=0),
    Field('closing_balance_99','decimal(20,2)',default=0),
    Field('created_on', 'datetime', default=request.now, writable = False, readable = False),
    Field('created_by', db.auth_user, ondelete = 'NO ACTION', default=auth.user_id, writable = False, readable = False),
    Field('updated_on', 'datetime', update=request.now, writable = False, readable = False),
    Field('updated_by', db.auth_user, ondelete = 'NO ACTION', update=auth.user_id, writable = False, readable = False))

