Index: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/browser.py
===================================================================
--- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/browser.py	(revision 15184)
+++ main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/browser.py	(revision 15185)
@@ -206,2 +206,49 @@
             self.context.student, omit_fields=self.omit_fields,
             pre_text=pre_text, post_text='')
+
+class MedicalLaboratoryRequestForm(UtilityView, grok.View):
+    """Deliver a PDF notification slip.
+    """
+    grok.context(ICustomStudent)
+    grok.name('medical_laboratory_form.pdf')
+    grok.require('waeup.viewStudent')
+    prefix = 'form'
+
+    form_fields = grok.AutoFields(ICustomStudent).select(
+        'student_id', 'matric_number', 'sex', 'email', 'phone', 'perm_address')
+    omit_fields = ('current_mode')
+
+    label = u'Student\'s Medical Laboratory Request Form'
+    title = u'Student\'s Medical Laboratory Request Form'
+
+    post_text = """
+
+Laboratory request: Student's Medical Test
+
+Lab Results/Status:
+
+Medical Laboratory Scientist's Sign.:
+
+
+
+Notice to all newly admitted students:
+
+1. Carry out your mandatory medical laboratory tests at:
+(a) the Edo State Polyechnic Health Centre
+2. Evidence of medical screening payment and the downloaded student's laboratory test request form are required for the medical tests to be conducted for students.
+3. Collect your lab tests results and upload during clearance process online.
+4. Students' admission records and clearance are incomplete without medical test result.
+5. Results of medical tests from elsewhere are not accepted.
+6. Medical tests are conducted only within admission period, and will end in matriculation week. Unnecessary delays will not be allowed.
+7. This information applies to both full- time and part-time.
+"""
+
+    def render(self):
+        if not self.context.medical_fee_paid:
+            self.flash('Not allowed.', type="danger")
+            self.redirect(self.url(self.context))
+            return
+        students_utils = getUtility(IStudentsUtils)
+        return students_utils.renderPDFAdmissionLetter(self,
+            self.context.student, omit_fields=self.omit_fields,
+            pre_text='', post_text=self.post_text)
Index: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/student.py
===================================================================
--- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/student.py	(revision 15184)
+++ main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/student.py	(revision 15185)
@@ -43,4 +43,13 @@
         return False
 
+    @property
+    def medical_fee_paid(self):
+        for key in self['payments'].keys():
+            ticket = self['payments'][key]
+            if ticket.p_state == 'paid' and \
+                ticket.p_session == self.current_session and \
+                ticket.p_category == 'medical':
+                return True
+        return False
 
 # Set all attributes of Student required in IStudent as field
Index: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py
===================================================================
--- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py	(revision 15184)
+++ main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py	(revision 15185)
@@ -21,4 +21,5 @@
 from StringIO import StringIO
 from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo
+from mechanize import LinkNotFoundError
 from zope.securitypolicy.interfaces import IPrincipalRoleManager
 from zope.component.hooks import setSite, clearSite
@@ -34,4 +35,5 @@
     IExtFileStore, IFileStoreNameChooser)
 from waeup.kofa.students.interfaces import IStudentsUtils
+from waeup.kofa.browser.tests.test_pdf import samples_dir
 from kofacustom.edopoly.testing import FunctionalLayer
 
@@ -44,2 +46,36 @@
     def test_dummytest(self):
         return
+
+class StudentUITests(StudentsFullSetup):
+    """Tests for customized student class views and pages
+    """
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(StudentUITests, self).setUp()
+
+
+    def test_medical_laboratory_form(self):
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        self.assertRaises(
+            LinkNotFoundError,
+            self.browser.getLink, 'Download medical laboratory request form')
+        # Add medical fee payment ticket
+        self.app['configuration']['2004'].medical = 180.0
+        payment = createObject('waeup.StudentOnlinePayment')
+        payment.p_category = u'medical'
+        payment.p_session = self.student.current_session
+        payment.p_id = u'anyid'
+        payment.p_state = u'paid'
+        self.student['payments']['anykey'] = payment
+        self.browser.open(self.student_path)
+        self.browser.getLink("Download medical laboratory request form").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        path = os.path.join(samples_dir(), 'medical_laboratory_form.pdf')
+        open(path, 'wb').write(self.browser.contents)
+        print "Sample PDF medical_laboratory_form.pdf written to %s" % path
Index: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/viewlets.py
===================================================================
--- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/viewlets.py	(revision 15184)
+++ main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/viewlets.py	(revision 15185)
@@ -69,2 +69,17 @@
             return ''
         return self.view.url(self.view.context, self.target)
+
+class MedicalLaboratoryRequestFormActionButton(ManageActionButton):
+    grok.order(11)
+    grok.context(IStudent)
+    grok.view(StudentBaseDisplayFormPage)
+    grok.require('waeup.viewStudent')
+    icon = 'actionicon_pdf.png'
+    text = _('Download medical laboratory request form')
+    target = 'medical_laboratory_form.pdf'
+
+    @property
+    def target_url(self):
+        if not self.context.medical_fee_paid:
+            return ''
+        return self.view.url(self.view.context, self.target)
