<%@ page import="ro.emid.common.utils.RequestUtils" %>
<%@ page import="ro.emid.common.types.Instalatie" %>
<%@ page import="ro.emid.lpod.db.InstalatieDB" %>
<%@ page import="ro.emid.common.types.LFInfo" %>
<%@ page import="ro.emid.common.db.LFInfoAccessDB" %>
<%@ page import="ro.emid.common.utils.InstalatieUtils" %>
<%@ page import="ro.emid.common.constants.GlobalAppConstants" %>
<%@ page import="ro.emid.common.constants.AppConstants" %>

<respmesg>

    <%
    try{

        final long idInstalatie = RequestUtils.getLong( request, "idInstalatie", -1);

        final Instalatie instalatie = InstalatieDB.getById( idInstalatie, true);


        LFInfo info = null;

        if( instalatie != null){

            info = LFInfoAccessDB.getLastEntryByCodSapLF( instalatie.getCod());

        }

%>


<% if( info != null){ %>
    {
        id : <%=instalatie.getId()%>,
        cod : "<%=instalatie.getCod()%>",
        putere : <%=AppConstants.format3(InstalatieUtils.calculPutere(info))%>,
        totalConsumatori : <%=info.getNumarConsumatoriIT() + info.getNumarConsumatoriMT() + info.getNumarConsumatoriJT()%>,
        consumatori_IT : <%=info.getNumarConsumatoriIT()%>,
        consumatori_MT : <%=info.getNumarConsumatoriMT()%>,
        consumatori_JT : <%=info.getNumarConsumatoriJT()%>,
        consumatori_casnici : <%=info.getNumarConsumatoriCasnici()%>,
        consumatori_mici : <%=info.getNumarConsumatoriMici()%>,
        consumatori_mari : <%=info.getNumarConsumatoriMari()%>
    }
<% } %>

<% } catch( Exception t){%>
    {error: "<%=t.getMessage()%>"}
<% } %>
</respmesg>
