Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py	(revision 16631)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py	(revision 16632)
@@ -270,8 +270,8 @@
         SF_PAYMENTS = ('schoolfee', 'schoolfee40', 'secondinstal', 'clearance')
         if cs > self.context.student.entry_session:
-            sf_paid = {cs-1: 0, cs: 0, cs+1: 0}
+            sf_paid = {cs-1: 0.0, cs: 0.0, cs+1: 0.0}
             sessions = (cs-1, cs, cs+1)
         else:
-            sf_paid = {cs: 0, cs+1: 0}
+            sf_paid = {cs: 0.0, cs+1: 0.0}
             sessions = (cs, cs+1)
         try:
@@ -283,12 +283,13 @@
         else:
             total_sf = getattr(certificate, 'school_fee_2', 0.0)
-        for ticket in self.context.student['payments'].values():
+        brought_fwd = 0.0
+        for ticket in self.context.values():
+            amt = ticket.net_amt
+            if not amt:
+                amt = ticket.amount_auth
             if ticket.p_category in SF_PAYMENTS and \
                 ticket.p_state == 'paid' and \
                 ticket.p_session in sessions:
-                sf_paid[ticket.p_session] += ticket.net_amt
-        brought_fwd = 0.0
-        for key in self.context.keys():
-            ticket = self.context[key]
+                sf_paid[ticket.p_session] += amt
             if ticket.p_state != 'paid' and\
                ticket.p_category == 'brought_fwd':
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser_templates/paymentsmanagepage.pt
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser_templates/paymentsmanagepage.pt	(revision 16631)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser_templates/paymentsmanagepage.pt	(revision 16632)
@@ -44,5 +44,8 @@
   </div>
   <br /><br />
-
+  <p>
+  <strong>Balance Brought Forward:</strong> <span tal:content ="python: view.schoolfee_payments_made[2]">BROUGHTFORWARD</span>
+  </p>
+  <br />
   <table class="table" style="width: 50%;">
     <thead>
@@ -59,12 +62,8 @@
         <td tal:content ="python: view.schoolfee_payments_made[1]">TOTAL</td>
         <td tal:content ="python: sfpm[1]">AMOUNT</td>
-        <td tal:content ="python: view.schoolfee_payments_made[1]-sfpm[1]">DUE</td>
+        <td tal:content ="python: view.schoolfee_payments_made[1]+view.schoolfee_payments_made[2]-sfpm[1]">DUE</td>
         
       </tr>
     </tbody>
   </table>
-  <p>
-  <strong>Balance Brought Forward:</strong> <span tal:content ="python: view.schoolfee_payments_made[2]">BROUGHTFORWARD</span>
-  </p>
-
 </form>
