Index: main/waeup.sirp/trunk/src/waeup/sirp/payments/vocabularies.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/payments/vocabularies.py	(revision 6993)
+++ main/waeup.sirp/trunk/src/waeup/sirp/payments/vocabularies.py	(revision 6994)
@@ -11,4 +11,5 @@
     ('School Fee','schoolfee'),
     ('Clearance','clearance'),
+    ('Bed Allocation','bed_allocation'),
     ('Hostel Maintenance','hostel_maintenance'),
     ('Transfer','transfer'),
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/accommodation.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/accommodation.py	(revision 6993)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/accommodation.py	(revision 6994)
@@ -21,4 +21,5 @@
 from grok import index
 from zope.component.interfaces import IFactory
+from waeup.sirp.interfaces import academic_sessions_vocab
 from waeup.sirp.students.interfaces import (
     IStudentAccommodation, IStudentNavigation, IBedTicket)
@@ -64,4 +65,8 @@
         return self.__parent__.__parent__
 
+    def getSessionString(self):
+        return academic_sessions_vocab.getTerm(
+            self.booking_session).title
+
 BedTicket = attrs_to_fields(BedTicket)
 
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6993)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6994)
@@ -128,4 +128,13 @@
     title = u'Accommodation'
 
+class BedTicketBreadcrumb(Breadcrumb):
+    """A breadcrumb for bed tickets.
+    """
+    grok.context(IBedTicket)
+    @property
+
+    def title(self):
+        return 'Bed Ticket %s' % self.context.getSessionString()
+
 class StudyLevelBreadcrumb(Breadcrumb):
     """A breadcrumb for course lists.
@@ -898,15 +907,16 @@
         #order_id = "%s%s" % (student_id[1:],timestamp)
         payment.p_id = "p%s" % timestamp
-        (payment.amount_auth,
-            payment.p_item, payment.p_session,
-            payment.surcharge_1,
-            payment.surcharge_2,
-            payment.surcharge_3,
-            error)  = self.getPaymentDetails(
+        pay_details  = self.getPaymentDetails(
             data['p_category'],self.context.__parent__)
-        if error:
-            self.flash(error)
+        if pay_details['error']:
+            self.flash(pay_details['error'])
             self.redirect(self.url(self.context))
             return
+        payment.amount_auth = pay_details['amount']
+        payment.p_item = pay_details['p_item']
+        payment.p_session = pay_details['p_session']
+        payment.surcharge_1 = pay_details['surcharge_1']
+        payment.surcharge_2 = pay_details['surcharge_2']
+        payment.surcharge_3 = pay_details['surcharge_3']
         self.context[payment.p_id] = payment
         self.flash('Payment ticket created.')
@@ -966,4 +976,11 @@
                 return
             self.context.ac = pin
+        elif self.context.p_category == 'bed_allocation':
+            # Create HOS access code
+            pin, error = create_accesscode('HOS',0,student.student_id)
+            if error:
+                self.flash('Valid callback received. ' + error)
+                return
+            self.context.ac = pin
         self.flash('Valid callback received.')
         return
@@ -1072,7 +1089,6 @@
 
     def update(self, SUBMIT=None):
-        (booking_session, booking_fee, maint_fee, allowed_states,
-            error)  = self.getAccommodationDetails(self.context.__parent__)
-        if not self.context.getStudent().state in allowed_states:
+        acc_details  = self.getAccommodationDetails(self.context.__parent__)
+        if not self.context.getStudent().state in acc_details['allowed_states']:
             self.flash("Wrong state.")
             self.redirect(self.url(self.context))
@@ -1102,9 +1118,29 @@
         bedticket = createObject(u'waeup.BedTicket')
         bedticket.booking_code = pin
+        bedticket.booking_session = acc_details['booking_session']
         bedticket.bed = u'Test Bed'
-        self.context['test'] = bedticket
+        self.context[str(acc_details['booking_session'])] = bedticket
         self.flash('Bed ticket created.')
         self.redirect(self.url(self.context))
         return
+
+class BedTicketDisplayFormPage(WAeUPDisplayFormPage):
+    """ Page to display bed tickets
+    """
+    grok.context(IBedTicket)
+    grok.name('index')
+    grok.require('waeup.viewStudent')
+    form_fields = grok.AutoFields(IBedTicket)
+    form_fields[
+        'booking_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+    pnav = 4
+
+    @property
+    def label(self):
+        return 'Bed Ticket for Session %s' % self.context.getSessionString()
+
+    @property
+    def title(self):
+        return 'Bed Ticket %s' % self.context.getSessionString()
 
 class StudentHistoryPage(WAeUPPage):
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py	(revision 6993)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py	(revision 6994)
@@ -346,30 +346,7 @@
         )
 
-    booking_fee =schema.Int(
-        title = u'Booking Fee',
-        default = 0,
-        required = False,
-        readonly = False,
-        )
-
-    maint_date = schema.Datetime(
-        title = u'Maintenance Fee Payment Date',
-        required = False,
-        readonly = False,
-        )
-
-    maint_code = schema.TextLine(
-        title = u'Maintenance Fee Payment Code',
-        default = u'Certificate XYZ',
-        required = False,
-        readonly = False,
-        )
-
-    maint_fee = schema.Int(
-        title = u'Maintenance Fee',
-        default = 0,
-        required = False,
-        readonly = False,
-        )
+    def getSessionString():
+        """Returns the the title of academic_sessions_vocab term
+        """
 
 class IStudentPaymentsContainer(IPaymentsContainer):
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py	(revision 6993)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py	(revision 6994)
@@ -24,44 +24,38 @@
 # This function is for demonstration and testing only.
 def getPaymentDetails(category, student):
-    surcharge_1 = surcharge_2 = surcharge_3 = 0
-    p_item = u''
-    amount = 0
-    error = u''
-    p_session = student['studycourse'].current_session
-    session = str(p_session)
+    d = {}
+    d['p_item'] = u''
+    d['amount'] = 0
+    d['error'] = u''
+    d['p_session'] = student['studycourse'].current_session
+    session = str(d['p_session'])
     try:
         academic_session = getSite()['configuration'][session]
     except KeyError:
-        error = u'Session configuration object is not available.'
-        return (amount, p_item, p_session,
-            surcharge_1, surcharge_2, surcharge_3, error)
+        d['error'] = u'Session configuration object is not available.'
+        return d
+    d['surcharge_1'] = academic_session.surcharge_1
+    d['surcharge_2'] = academic_session.surcharge_2
+    d['surcharge_3'] = academic_session.surcharge_3
     if category == 'schoolfee':
-        amount = academic_session.fee_1
-        surcharge_1 = academic_session.surcharge_1
-        surcharge_2 = academic_session.surcharge_2
-        surcharge_3 = academic_session.surcharge_3
-        p_item = student['studycourse'].certificate.code
+        d['amount'] = academic_session.fee_1
+        d['p_item'] = student['studycourse'].certificate.code
     elif category == 'clearance':
-        p_item = student['studycourse'].certificate.code
-        amount = academic_session.fee_2
-    return (amount, p_item, p_session,
-        surcharge_1, surcharge_2, surcharge_3, error)
+        d['p_item'] = student['studycourse'].certificate.code
+        d['amount'] = academic_session.fee_2
+    elif category == 'bed_allocation':
+        #d['p_item'] = student['studycourse'].certificate.code
+        d['amount'] = academic_session.booking_fee
+    return d
 
 # To be specified in customization packages.
 # This function is for demonstration and testing only.
 def getAccommodationDetails(student):
-    bookin_fee = maint_fee = 0
-    error = u''
+    d = {}
+    d['bookin_fee'] = d['maint_fee'] = 0
+    d['error'] = u''
     site_confoguration = getSite()['configuration']
-    booking_session = site_confoguration.accommodation_session
-    allowed_states = site_confoguration.accommodation_states
-    session = str(booking_session)
-    try:
-        academic_session = getSite()['configuration'][session]
-    except KeyError:
-        error = u'Session configuration object is not available.'
-        return (booking_session, booking_fee, maint_fee, allowed_states,
-            error)
-    booking_fee = academic_session.booking_fee
-    maint_fee = academic_session.maint_fee
-    return booking_session, booking_fee, maint_fee, allowed_states, error
+    d['booking_session'] = site_confoguration.accommodation_session
+    d['allowed_states'] = site_confoguration.accommodation_states
+    session = str(d['booking_session'])
+    return d
