<%@page import="mainapp.Factory"%>
<%@page import="mainapp.FactoryInfoHelper"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="mainapp.Production"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    ArrayList<Factory> factories= Factory.getAllFactories();
%>
<h3 style="text-decoration:underline; text-align: center;margin-bottom: 5px">Συνολικές Αναφορές ανά Εργοστάσιο</h3>
<table class="info-table">
    <tr>
        <th>Εργοστάσιο</th><th>Όγκος(ελιές kg)</th><th>Λάδι(kg)</th>
        <th>Μέση Οξύτητα</th><th>Σύνολο εισπράξεων(&euro;)</th><th></th>
    </tr>
<%
    ArrayList res = Production.getProductionsInfoByFactory();
    Iterator i2;
    i2 = res.iterator();
    while (i2.hasNext()) {
        FactoryInfoHelper info = (FactoryInfoHelper) i2.next();
        Factory f2 = new Factory(info.getFactoryID());
        out.print("<tr><td>"+f2.getName()+"</td><td>"+info.getTotalOlivesWeight()
                +"</td><td>"+info.getTotalOilWeight()+"</td><td>"+info.getAverageAcidity()
                +"</td><td>"+info.getIncome()+"</td>"
                +"<td style='text-align: center'><a style='color: #225588' href='?action=factory_reports_per_user&factory_id="+f2.getID()+"'>Αναλυτικά <i class='fa fa-sort-amount-asc'></i></a></td>"
                +"</tr>");
    }
%>
</table>