Skip to content

Commit

Permalink
Empezando cambios en préstamos. MOSTRAR TOTALES
Browse files Browse the repository at this point in the history
  • Loading branch information
rraduc00 committed Oct 5, 2017
1 parent 66cc372 commit 35e8b7d
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public List<List<String>> calcularTabla() {
double[] amortizacion = new double[numFilas];
double[] interes = new double[numFilas];
double[] capitalPendiente = new double[numFilas];
double totalAnualidad = 0;
double totalInteres = 0;
double totalAmortizacion = 0;

interes[0] = capInicial * tipoInteres / tipoPeriodo;

Expand Down Expand Up @@ -74,9 +77,20 @@ public List<List<String>> calcularTabla() {
itemTabla.add(Double.toString(redondear(amortizacion[i])));
itemTabla.add(Double.toString(redondear(capitalPendiente[i])));

totalAnualidad += anualidad[i];
totalInteres += interes[i];
totalAmortizacion += amortizacion[i];

tabla.add(itemTabla);
}

itemTabla = new ArrayList<>();
itemTabla.add(Double.toString(redondear(totalAnualidad)));
itemTabla.add(Double.toString(redondear(totalInteres)));
itemTabla.add(Double.toString(redondear(totalAmortizacion)));

tabla.add(itemTabla);

return tabla;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ public ModelAndView processAdd(@ModelAttribute("prestamoMetodoAleman") @Valid

List<List<String>> tabla = myAleman.calcularTabla();

/* El último elemento es el de los totales, los sumatorios, así que lo
* insertaré en otra tabla y lo elimino de la original*/
List<String> totales = tabla.get(tabla.size()-1);
tabla.remove(tabla.size()-1);

/* Añado un elemento vacío al principio para que la colocación de las
* columnas corresponda con la orginal donde se cuentan los periodos */
totales.add(0, "");


model.addObject("tabla", tabla);
model.addObject("tablaTotales", totales);

response.addCookie(new Cookie("resultados", "1"));

Expand Down
2 changes: 1 addition & 1 deletion ulebankoffice/src/main/resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,4 @@ label.queryAuthor=Author
label.creationDate = Creation date
label.clean= Clean

label.nominalinteresttype= Nominal interest rate.
label.nominalinteresttype= Annual nominal interest rate.
2 changes: 1 addition & 1 deletion ulebankoffice/src/main/resources/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -567,4 +567,4 @@ label.queryAuthor=Autor
label.creationDate = Fecha de creación
label.clean= Limpiar

label.nominalinteresttype= Tipo de interés nominal.
label.nominalinteresttype= Tipo de interés nominal anual.
16 changes: 16 additions & 0 deletions ulebankoffice/src/main/webapp/WEB-INF/views/germanloan.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,22 @@
</c:forEach>
</tbody>
</table>
<table class="table">
<thead>
<tr>
<th></th>
<th>TOTAL <spring:message code="label.annuality" /></th>
<th>TOTAL <spring:message code="label.interest" /></th>
<th>TOTAL <spring:message code="label.amortization" /></th>
<th></th>
</tr>
</thead>
<tbody>
<c:forEach var="fila" items="${tablaTotales}">
<td><c:out value="${fila}" /></td>
</c:forEach>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Expand Down
Binary file modified ulebankoffice/src/main/webapp/favicon.ico
Binary file not shown.
Binary file added ulebankoffice/src/main/webapp/faviconOLD.ico
Binary file not shown.

0 comments on commit 35e8b7d

Please sign in to comment.