## Script (Python) "getSchoolFee"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None
##title=
##
# $Id: getSchoolFee.py 2534 2007-11-05 06:37:12Z henrik $
"""
return SchoolFee
"""

GRP1 = ('BIO','MAT','ISC','PHE','CHM','YOR','ARB','ENG','FRE','HAU','IGB')
GRP2 = ('MUS','THA')
GRP3 = ('ECO','GEO','SOS','ISS','CRS','PES')
#GRP4 = ('CSC','AGE','BED','FAA','HEC')

ARTS = ('CRS','ISS','MUS','SOS','THA','PES','ECO','GEO')

# SCS = ('BIO','HEC','MAT','ARB','ISC','IGB','YOR','HAU','ENG ','FRE','PHY ','CSC','PHE','AGE','FAA','BED','HEC')

d = {}

if not brain.mode.endswith('_sw'):
    # PRENCE
    if str(brain.level) == '000' and brain.review_state == 'cleared_and_validated':
        if brain.department in GRP1:
            d['all'] = 15370
        elif brain.department in GRP2:
            d['all'] = 15370
        elif brain.department in GRP3:
            d['all'] = 14770
        else:
            d['all'] = 15370
    # new addition for prence to nce-i students whose fees are different from other nce-i students
    elif str(brain.level) == '100' and brain.review_state == 'cleared_and_validated' and brain.entry_mode == 'prence':
        if brain.department in GRP1:
            d['all'] = 10120
        elif brain.department in GRP2:
            d['all'] = 10020
        elif brain.department in GRP3:
            d['all'] = 9520
        else:
            d['all'] = 10520
    # NCE I (fresh)
    elif str(brain.level) == '100' and brain.review_state == 'cleared_and_validated':
        if brain.department in GRP1:
            d['all'] = 11620
        elif brain.department in GRP2:
            d['all'] = 11520
        elif brain.department in GRP3:
            d['all'] = 11020
        else:
            d['all'] = 12120
    # NCE I repeaters
    elif str(brain.level) in ('100','110') and brain.review_state == 'returning' and brain.verdict == 'C':
        if brain.department in GRP1:
            d['all'] = 10120
        elif brain.department in GRP2:
            d['all'] = 10020
        elif brain.department in GRP3:
            d['all'] = 9520
        else:
            d['all'] = 10520
    # NCE II
    elif str(brain.level) in ('100','110','120') and brain.review_state == 'returning':
        if brain.department in GRP1:
            d['all'] = 6750
        elif brain.department in GRP2:
            d['all'] = 6650
        elif brain.department in GRP3:
            d['all'] = 6150
        else:
            d['all'] = 7250
    # NCE II repeaters
    elif str(brain.level) in ('200','210') and brain.verdict == 'C':
        if brain.department in GRP1:
            d['all'] = 6750
        elif brain.department in GRP2:
            d['all'] = 6650
        elif brain.department in GRP3:
            d['all'] = 6150
        else:
            d['all'] = 7250
    # NCE III
    elif str(brain.level) in ('200','210','220'):
        if brain.department in GRP1:
            d['all'] = 8000
        elif brain.department in GRP2:
            d['all'] = 7400
        elif brain.department in GRP3:
            d['all'] = 7400
        else:
            d['all'] = 8000
    # NCE III repeaters and spillover
    elif str(brain.level) in ('300','310') and brain.verdict in ('B','C'):
        if brain.department in GRP1:
            d['all'] = 6750
        elif brain.department in GRP2:
            d['all'] = 6150
        elif brain.department in GRP3:
            d['all'] = 6150
        else:
            d['all'] = 6750           
          
    else:
        d['all'] = 0
else:
    # all repeaters
    if brain.verdict == 'C':
        d['all'] = 9000
    # NCE I
    elif str(brain.level) == '100' and brain.review_state == 'cleared_and_validated':
        d['all'] = 11000
    # NCE II        
    elif str(brain.level) in ('100','110','120') and brain.review_state == 'returning':
        d['all'] = 10000
    # NCE III        
    elif str(brain.level) in ('200','210','220'):
        d['all'] = 9500
    # NCE IV
    elif str(brain.level) in ('300','310','320'):
        d['all'] = 9500
    # NCE IV spillover
    elif str(brain.level) in ('400','410','420') and brain.verdict == 'B':
        d['all'] = 9000        
    else:
        d['all'] = 0


next_info = context.getNextInfo(brain)
next_session_str = next_info['next_session_str']
d['next_session_id'] = next_info['next_session_id']
d['description'] = "School Fee for Session %s" % next_session_str

return d
