Guest User

Untitled

a guest
Aug 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. Printing page numbers using Pisa
  2. if request.POST.has_key('print_report_submit'):
  3. context['show_report'] = True
  4. context['mb_logo'] = os.path.join(os.path.dirname(__file__), "../../../media/images/mb_logo.jpg")
  5. html = render_to_string('reports/fam_maturity_print.html', RequestContext(request,context))
  6. result = StringIO.StringIO()
  7. pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result)
  8. response = HttpResponse(result.getvalue(), mimetype='application/pdf')
  9. response['Content-Disposition'] = 'attachment; filename=family_maturity-statement.pdf'
  10. return response
  11.  
  12. {% if show_report %}
  13.  
  14. <table width="100%">
  15.  
  16. <tr>
  17. <td colspan="2" align="center" width="400px">
  18. <h1 class="title">Family Maturities by Year</h1>
  19. <br/><br/>
  20. </td>
  21. </tr>
  22. <tr>
  23. <td width="500px">
  24. <img src="{{ mb_logo }}"/>
  25. <td> <p>
  26. <img style="max-height: 60px; max-width:60px;" src="{{ check_image }}"/>
  27. </p>
  28. </tr>
  29. </table>
  30. <br/>
  31. <br/>
  32.  
  33.  
  34.  
  35. <hr class="report_hr1"/>
  36. <h2 class="state_head" style="font-size: 16px;">Statement Information As of {{ statement_date|date:"F d, Y" }}</h2>
  37. <hr class="report_hr1"/>
  38.  
  39. <table>
  40.  
  41. {% for plan_dict in plan_list %}
  42. <hr class="report_hr2"/>
  43. <table>
  44. <tr>
  45. <td><strong>Plan Holder: </strong></td><td>{{ plan_dict.plan.get_primary_owner.member.client}}</td>
  46. <td><strong>Joint Owner(s): </strong></td>
  47. <td>
  48. {% for member in plan_dict.plan.planmember_set.all %}
  49. {% ifnotequal member.ownership_type.code "primary" %}
  50. {{ member }}
  51. {% endifnotequal %}
  52. {% endfor %}
  53. </td>
  54. </tr>
  55. <tr>
  56. <td><strong>Plan ID: </strong></td><td>{{ plan_dict.plan.id }}</td>
  57. </tr>
  58. <tr>
  59. <td><strong>Plan type: </strong></td><td>{{ plan_dict.plan.plan_type }}</td>
  60. </tr>
  61. </table>
  62. <hr class="report_hr2"/>
  63. {# This is the table for the current year's maturities #}
  64. {% if plan_dict.investment %}
  65. <table>
  66. <td colspan="2"><h3>{{ cur_year }}</h3></td>
  67. <tr>
  68. <th>Financial Institution</th>
  69. <th>Type</th>
  70. <th>Principal</th>
  71. <th>Maturity</th>
  72. </tr>
  73. {% for i in plan_dict.investment %}
  74. <tr>
  75. <td>{{ i.financial_institution.abbr }}</td>
  76. <td>{{ i.product.code }}</td>
  77. <td>${{ i.amount|intcomma }}</td>
  78. <td>${{ i.maturity_amount|intcomma }}</td>
  79. </tr>
  80. {% endfor %}
  81. <tr>
  82. <td><strong>Total for {{ cur_year }}</strong></td>
  83. <td></td>
  84. <td><strong>${{ plan_dict.total|intcomma }}</strong></td>
  85. <td><strong>${{ plan_dict.total_m|intcomma }}</strong></td>
  86. </tr>
  87. </table>
  88. {% endif %}
  89. <div id="holding_table" align="center">
  90. <h3>Holding Totals with Each Company</h3>
  91. <table>
  92. <tr>
  93. <td style="font-weight: bold;">Financial Institution</td>
  94. <td style="font-weight: bold;">Total</td>
  95. </tr>
  96. {% for l in plan_dict.total_list %}
  97. {% if l.maturity_amount__sum != None %}
  98. <tr>
  99. <td>{{ l.financial_institution__abbr }}</td>
  100. <td>${{ l.maturity_amount__sum|intcomma }}</td>
  101. </tr>
  102. {% endif %}
  103. {% endfor %}
  104. <tr>
  105. <td style="font-weight: bold;">Total Non-Fund Holdings for this plan</td>
  106. <td style="font-weight: bold;">${{ plan_dict.grand|intcomma }}</td>
  107. </tr>
  108. </table>
  109. <span class="disclaimer_span">This report has been prepared from data believed to be reliable but no
  110. representation is made as to accuracy or completeness.</span>
  111. </div>
  112. <br/>
  113. <br/>
  114.  
  115. {% endfor %}
  116. </table>
  117. {% endif %}
  118.  
  119. <div>
  120. <pdf:pagenumber />
  121. </div>
Add Comment
Please, Sign In to add comment