<%@ page import="ro.emid.common.types.Factura" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>
<%@ page import="java.util.List" %>

<%
        /**
         * @see ro.emid.callcenter.i10n.action.ShowFacturiRestanteAction
         */
    List<Factura> facturi = (List<Factura>) request.getAttribute("facturi");
%>

<respmesg>
    <TABLE id="facturi" border=0 cellPadding=2 cellSpacing=1 width="99.8%" class="gSAPTHEAD" style="BACKGROUND-COLOR: white; margin-top: 3px; margin-left: 3px">
        <TR noSelect="true">
            <TH class="gsapthead" height=25 noWrap>&nbsp;Data Factura:&nbsp;</TH>
            <TH class="gsapthead" noWrap >&nbsp;Data Scadenta:&nbsp;</TH>
            <TH class="gsapthead" noWrap >&nbsp;Total Facturat:&nbsp;</TH>
            <TH class="gsapthead" noWrap >&nbsp;Total Achitat:&nbsp;</TH>
            <TH class="gsapthead" noWrap >&nbsp;Datorie Plata:&nbsp;</TH>
            <TH class="gsapthead" noWrap >&nbsp;Descriere Factura:&nbsp;</TH>
        </TR>
        <% double totalDatorie = 0;%>

        <% if (facturi != null && facturi.size() > 0) for (final Factura factura : facturi) {
            totalDatorie += factura.getTotalFacturat() - factura.getTotalAchitat();%>
            <tr>
                <td align="center"><%=AppConstants.format(factura.getDataFactura())%></td>
                <td align="center"><%=AppConstants.format(factura.getDataScadenta())%></td>
                <td align="right"><%=AppConstants.format2(factura.getTotalFacturat())%></td>
                <td align="right"><%=AppConstants.format2(factura.getTotalAchitat())%></td>
                <td align="right"><%=AppConstants.format2(factura.getDatorie())%></td>
                <td align="left"><%=AppConstants.format(factura.getDescriere())%></td>
            </tr>
        <%}else{%>
        <tr noSelect="true">
            <td >Nici-o factura neplatita</td>
        </tr>
        <%}%>

    </TABLE>
    <br>
    <div>
        Total datorie: <input type="text" class="gsapinputtext" style="font-size: 14px; text-align:right;" size="5"  readonly value="<%=AppConstants.format2(totalDatorie)%>">
    </div>
</respmesg>
