Search in sources :

Example 1 with Settlement

use of eu.ggnet.dwoss.redtape.ee.entity.Document.Settlement in project dwoss by gg-net.

the class DossierFormater method toHtmlHistory.

/**
 * Generates a Html formated String representing the history of a Dossier.
 * <p/>
 * @param dos The Dossier
 * @return a Html formated String representing the history of a Dossier.
 */
public static String toHtmlHistory(Dossier dos) {
    Comparator.comparing((Document d) -> d.getHistory().getRelease());
    Collection<Document> docs = new TreeSet<>((Document o1, Document o2) -> o1.getHistory().getRelease().compareTo(o2.getHistory().getRelease()));
    docs.addAll(dos.getDocuments());
    String res = "<h2>Verlauf von " + dos.getIdentifier() + ":</h2><br />";
    for (Document doc : docs) {
        String cons = "";
        String settlements = "";
        for (Iterator<Condition> it = doc.getConditions().iterator(); it.hasNext(); ) {
            Condition con = it.next();
            cons += con.getName();
            if (it.hasNext())
                cons += ",";
        }
        for (Iterator<Settlement> it = doc.getSettlements().iterator(); it.hasNext(); ) {
            Settlement set = it.next();
            settlements += set.getName();
            if (it.hasNext())
                settlements += ",";
        }
        res += "<p>";
        res += "<b>" + doc.getType().getName() + (doc.getIdentifier() != null ? ": " + doc.getIdentifier() : "") + " | " + (doc.isClosed() ? "geschlossen" : "offen") + (doc.getInvoiceAddress() == null ? "" : " | Adress Ids: (RE: " + doc.getShippingAddress().getId() + " | LI: " + doc.getShippingAddress().getId()) + ")</b><br />";
        res += (cons.isEmpty() ? "" : "Zustände: " + cons + " | ") + (doc.getDirective() == null ? "" : "Direktive: " + doc.getDirective().getName()) + "<br />";
        res += "Erstellt am: " + SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT, Locale.GERMANY).format(doc.getHistory().getRelease()) + " von " + doc.getHistory().getArranger() + "<br />";
        res += "Anmerkung: " + doc.getHistory().getComment() + "<br />";
        res += doc.getPositions().size() != 0 ? "Positionen: " + doc.getPositions().size() + " | Nettosumme: " + NumberFormat.getCurrencyInstance().format(doc.getPrice()) + " | Bruttosumme: " + NumberFormat.getCurrencyInstance().format(doc.toAfterTaxPrice()) + (settlements.isEmpty() ? "" : " | Gezahlt via " + settlements) + "<br />" : "";
        res += "</p>";
    }
    return res;
}
Also used : Condition(eu.ggnet.dwoss.redtape.ee.entity.Document.Condition) Settlement(eu.ggnet.dwoss.redtape.ee.entity.Document.Settlement) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Aggregations

Document (eu.ggnet.dwoss.redtape.ee.entity.Document)1 Condition (eu.ggnet.dwoss.redtape.ee.entity.Document.Condition)1 Settlement (eu.ggnet.dwoss.redtape.ee.entity.Document.Settlement)1