Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6860)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6869)
@@ -17,5 +17,6 @@
 """
 import grok
-
+from time import time
+from datetime import date, datetime
 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
 from zope.component import createObject
@@ -30,5 +31,6 @@
 from waeup.sirp.interfaces import IWAeUPObject, IUserAccount
 from waeup.sirp.widgets.datewidget import (
-    FriendlyDateWidget, FriendlyDateDisplayWidget)
+    FriendlyDateWidget, FriendlyDateDisplayWidget,
+    FriendlyDatetimeDisplayWidget)
 from waeup.sirp.students.interfaces import (
     IStudentsContainer, IStudent, IStudentClearance, IStudentPasswordSetting,
@@ -42,4 +44,5 @@
 from waeup.sirp.students.vocabularies import StudyLevelSource
 from waeup.sirp.browser.resources import toggleall
+from waeup.sirp.payments.interfaces import IOnlinePayment
 
 # Save function used for save methods in manager pages
@@ -757,11 +760,129 @@
     grok.require('waeup.viewStudent')
     form_fields = grok.AutoFields(IStudentPaymentsContainer)
-    #grok.template('paymentspage')
+    grok.template('paymentspage')
     title = 'Payments'
     pnav = 4
 
+    def formatDatetime(self,datetimeobj):
+        if isinstance(datetimeobj, datetime):
+            return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
+        else:
+            return None
+
     @property
     def label(self):
         return '%s: Payments' % self.context.__parent__.fullname
+
+    def update(self):
+        super(PaymentsDisplayFormPage, self).update()
+        datatable.need()
+        return
+
+class PaymentsManageFormPage(WAeUPEditFormPage):
+    """ Page to manage the student payments
+    """
+    grok.context(IStudentPaymentsContainer)
+    grok.name('manage')
+    grok.require('waeup.manageStudents')
+    form_fields = grok.AutoFields(IStudentPaymentsContainer)
+    grok.template('paymentsmanagepage')
+    title = 'Payments'
+    pnav = 4
+
+    def formatDatetime(self,datetimeobj):
+        if isinstance(datetimeobj, datetime):
+            return datetimeobj.strftime("%Y-%m-%d %H:%M:%S")
+        else:
+            return None
+
+    @property
+    def label(self):
+        return '%s: Payments' % self.context.__parent__.fullname
+
+    def update(self):
+        super(PaymentsManageFormPage, self).update()
+        datatable.need()
+        return
+
+    @grok.action('Remove selected tickets')
+    def delPaymentTicket(self, **data):
+        form = self.request.form
+        if form.has_key('val_id'):
+            child_id = form['val_id']
+        else:
+            self.flash('No payment selected.')
+            self.redirect(self.url(self.context, '@@manage'))
+            return
+        if not isinstance(child_id, list):
+            child_id = [child_id]
+        deleted = []
+        for id in child_id:
+            try:
+                del self.context[id]
+                deleted.append(id)
+            except:
+                self.flash('Could not delete %s: %s: %s' % (
+                        id, sys.exc_info()[0], sys.exc_info()[1]))
+        if len(deleted):
+            self.flash('Successfully removed: %s' % ', '.join(deleted))
+        self.redirect(self.url(self.context, u'@@manage'))
+        return
+
+    @grok.action('Add online payment ticket')
+    def addPaymentTicket(self, **data):
+        self.redirect(self.url(self.context, '@@addop'))
+
+class OnlinePaymentManageActionButton(ManageActionButton):
+    grok.order(1)
+    grok.context(IStudentPaymentsContainer)
+    grok.view(PaymentsDisplayFormPage)
+    grok.require('waeup.manageStudents')
+    text = 'Manage payments'
+    target = 'manage'
+
+class OnlinePaymentAddFormPage(WAeUPAddFormPage):
+    """ Page to add an online payment ticket
+    """
+    grok.context(IStudentPaymentsContainer)
+    grok.name('addop')
+    grok.require('waeup.handleStudent')
+    form_fields = grok.AutoFields(IOnlinePayment).select(
+        'p_category')
+    #grok.template('addpaymentpage')
+    label = 'Add online payment'
+    title = 'Payments'
+    pnav = 4
+
+    @grok.action('Create ticket')
+    def createTicket(self, **data):
+        payment = createObject(u'waeup.OnlinePayment')
+        self.applyData(payment, **data)
+        timestamp = "%d" % int(time()*1000)
+        #order_id = "%s%s" % (student_id[1:],timestamp)
+        payment.p_id = "p%s" % timestamp
+        self.context[payment.p_id] = payment
+        self.flash('Payment ticket created.')
+        self.redirect(self.url(self.context, u'@@manage'))
+        return
+
+class OnlinePaymentDisplayFormPage(WAeUPDisplayFormPage):
+    """ Page to view an online payment ticket
+    """
+    grok.context(IOnlinePayment)
+    grok.name('index')
+    grok.require('waeup.viewStudent')
+    form_fields = grok.AutoFields(IOnlinePayment)
+    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+    pnav = 4
+
+    @property
+    def title(self):
+        return 'Online Payment Ticket %s' % self.context.p_id
+
+    @property
+    def label(self):
+        return '%s: Online Payment Ticket %s' % (
+            self.context.__parent__.__parent__.fullname,self.context.p_id)
 
 class AccommodationDisplayFormPage(WAeUPDisplayFormPage):
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentsmanagepage.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentsmanagepage.pt	(revision 6869)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentsmanagepage.pt	(revision 6869)
@@ -0,0 +1,56 @@
+<h2 i18n:translate=""
+tal:condition="view/label"
+tal:content="view/label">Label</h2>
+
+<div class="form-status"
+    tal:define="status view/status"
+    tal:condition="status">
+    Form Status:
+    <span i18n:translate="" tal:content="view/status">
+      Form status summary
+    </span>
+</div>
+
+<form action="." tal:attributes="action request/URL" method="POST"
+      class="edit-form" enctype="multipart/form-data"> 
+
+  <table class="display dataTableManage">
+    <thead>
+    <tr>
+      <th>&nbsp;</th>
+      <th>Payment Id</th>
+      <th>Creation Date</th>
+      <th>Payment Date</th>
+      <th>Category</th>
+      <th>Item</th>
+      <th>State</th>
+    </tr>
+    </thead>
+    <tbody>
+      <tr tal:repeat="cl context/values">
+         <td>
+          <input type="checkbox"
+    		 name="val_id"
+    		 tal:attributes="value cl/__name__" />
+        </td>
+        <td> <a tal:attributes="href cl/__name__">
+        <span tal:content="cl/p_id">PID</span></a></td>
+        <td tal:content="python: view.formatDatetime(cl.creation_date)">CREATION DATE</td>
+        <td tal:content="python: view.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
+      <td tal:content ="cl/category">CATEGORY</td>
+      <td tal:content ="cl/p_item">ITEM</td>
+      <td tal:content ="cl/state">STATE</td>
+      </tr>
+    </tbody>
+  </table>
+
+  <div class="actionButtons" tal:condition="view/availableActions">
+    <span tal:repeat="action view/actions"
+          tal:omit-tag="">
+      <input tal:replace="structure action/render"/>
+    </span>
+  </div>
+</form>
+
+
+
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentspage.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentspage.pt	(revision 6869)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/paymentspage.pt	(revision 6869)
@@ -0,0 +1,28 @@
+<h2 tal:content="view/label">TITLE</h2>
+
+<table class="zebra">
+<thead>
+</thead>
+<table class="display dataTable">
+  <thead>
+    <tr>
+      <th>Payment Id</th>
+      <th>Creation Date</th>
+      <th>Payment Date</th>
+      <th>Category</th>
+      <th>Item</th>
+      <th>State</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr tal:repeat="value context/values">
+      <td> <a tal:attributes="href value/__name__">
+      <span tal:content="value/p_id">PID</span></a></td>
+      <td tal:content="python: view.formatDatetime(value.creation_date)">CREATION DATE</td>
+      <td tal:content="python: view.formatDatetime(value.payment_date)">PAYMENT DATE</td>
+      <td tal:content ="value/category">CATEGORY</td>
+      <td tal:content ="value/p_item">ITEM</td>
+      <td tal:content ="value/state">STATE</td>
+    </tr>
+  </tbody>
+</table>
