Search in sources :

Example 56 with Document

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

the class DossierFormater method toHtmlSimpleWithDocument.

public static String toHtmlSimpleWithDocument(Dossier dos) {
    String res = "";
    res += "<br />Kundennummer: " + dos.getCustomerId() + " " + toHtmlSimple(dos);
    // res += "<br />Dossier.id=" + dos.getId();
    res += "<br /><b>" + (dos.isClosed() ? "<font color=\"#666600\">Vorgang abgeschlossen" : "<font color=\"#009900\">Vorgang offen") + "</font></b><br /><br />";
    res += "<b>Dokumente:</b><br />";
    if (!dos.getActiveDocuments().isEmpty()) {
        res += "<ul type=\"disc\">";
        for (Document document : dos.getActiveDocuments()) {
            res += "<li>" + DocumentFormater.toHtmlSimple(document) + "</li>";
        }
        res += "</ul>";
    } else {
        res += "<font color=\"#666600\">Keine Dokumente enthalten</font>";
    }
    return res;
}
Also used : Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 57 with Document

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

the class DossierFormater method toHtmlSimple.

public static String toHtmlSimple(Dossier dos) {
    StringBuilder sb = new StringBuilder();
    for (Iterator<Document> it = dos.getActiveDocuments().iterator(); it.hasNext(); ) {
        Document document = it.next();
        if (document.getType() == DocumentType.ORDER)
            sb.append(dos.isDispatch() ? "Versandauftrag" : "Abholauftrag");
        else
            sb.append(document.getType().getName());
        if (it.hasNext())
            sb.append(", ");
    }
    String res = "";
    res += "Vorgang: " + dos.getIdentifier() + " | <i>" + sb.toString() + "</i><br />";
    res += "Zahlungsmodalität: " + dos.getPaymentMethod().getNote() + " | Anweisung: " + dos.getCrucialDirective().getName();
    return res;
}
Also used : Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 58 with Document

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

the class UniversalSearcherOperation method searchDocuments.

/**
 * Search for Documents where the search matches the identifier.
 * This method will search for any partial matches from the beginning of a identifier if a wildcard is used.
 * <p/>
 * @param identifier the identifier to search for
 * @param type
 * @return a List of Tuple2 containing document.id and string representation
 */
// Used in Misc. Unversal Search
@Override
public List<Tuple2<Long, String>> searchDocuments(String identifier, DocumentType type) {
    List<Tuple2<Long, String>> result = new ArrayList<>();
    List<Document> documents = new DocumentEao(redTapeEm).findByIdentifierAndType(identifier, type);
    for (Document document : documents) {
        String s = DocumentFormater.toHtmlSimple(document);
        Tuple2<Long, String> tuple = new Tuple2<>(document.getId(), s);
        result.add(tuple);
    }
    return result;
}
Also used : DocumentEao(eu.ggnet.dwoss.redtape.ee.eao.DocumentEao) Tuple2(eu.ggnet.dwoss.util.Tuple2) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 59 with Document

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

the class ReceiptUnitOperationIT method asserts.

private void asserts(UniqueUnit receiptUnit, StockTransaction stockTransaction, ReceiptOperation receiptOperation, TradeName contractor) {
    String head = "(" + contractor + "," + receiptOperation + "):";
    // Verify the UniqueUnit
    UniqueUnit uniqueUnit = uniqueUnitAgent.findUnitByIdentifierEager(Identifier.REFURBISHED_ID, receiptUnit.getIdentifier(Identifier.REFURBISHED_ID));
    assertNotNull(head + "Receipt Unit should exist", uniqueUnit);
    assertEquals(head + "Serial not equal", receiptUnit.getIdentifier(Identifier.SERIAL), uniqueUnit.getIdentifier(Identifier.SERIAL));
    // Verify the StockUnit
    StockUnit stockUnit = stockAgent.findStockUnitByUniqueUnitIdEager(uniqueUnit.getId());
    assertNotNull(head + "StockUnit should exist", stockUnit);
    assertEquals(head + "RefurbishId of UniqueUnit and StockUnit must be equal", receiptUnit.getIdentifier(Identifier.REFURBISHED_ID), stockUnit.getRefurbishId());
    assertEquals(head + "StockTransaction must be the same", stockTransaction.getId(), stockUnit.getTransaction().getId());
    if (!ReceiptOperation.valuesBackedByCustomer().contains(receiptOperation)) {
        // If unspecial Operation, no more verification needed.
        assertNull(head + "StockUnit.logicTransaction for " + receiptOperation, stockUnit.getLogicTransaction());
        return;
    }
    // Verify RedTape
    LogicTransaction logicTransaction = stockUnit.getLogicTransaction();
    assertNotNull(head + "StockUnit.logicTransaction for " + receiptOperation, logicTransaction);
    Dossier dossier = redTapeAgent.findByIdEager(Dossier.class, stockUnit.getLogicTransaction().getDossierId());
    assertNotNull(head + "Dossier for LogicTransaction must exist", dossier);
    assertEquals(head + "Dossier.customerId for " + contractor + " with " + receiptOperation, receiptCustomers.getCustomerId(contractor, receiptOperation), dossier.getCustomerId());
    assertEquals(head + "Dossier.activeDocuments", 1, dossier.getActiveDocuments().size());
    Document document = dossier.getActiveDocuments().get(0);
    assertEquals(head + "Document.type", DocumentType.BLOCK, document.getType());
    assertEquals(head + "LogicTransaction.stockUnits and Document.positions.uniqueUnitIds", toUniqueUnitIds(logicTransaction), document.getPositionsUniqueUnitIds());
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) LogicTransaction(eu.ggnet.dwoss.stock.ee.entity.LogicTransaction) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit)

Example 60 with Document

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

the class DebitorsReporterOperation method toXls.

/**
 * Creates the Report
 *
 * @param monitor
 * @return a ByteArray represeting the content of an xls file.
 */
@Override
public FileJacket toXls(Date start, Date end) {
    SubMonitor m = monitorFactory.newSubMonitor("DebitorenReport", 25);
    m.message("loading Dossiers");
    DocumentEao documentEao = new DocumentEao(redTapeEm);
    List<Document> documents = new ArrayList<>();
    documents.addAll(documentEao.findDocumentsBetweenDates(start, end, DocumentType.INVOICE));
    m.worked(10, "preparing Data");
    List<Object[]> rows = new ArrayList<>();
    for (Document document : documents) {
        UiCustomer c = customerService.asUiCustomer(document.getDossier().getCustomerId());
        rows.add(new Object[] { c.getId(), document.getDossier().getIdentifier(), c.getCompany(), c.toNameLine(), document.getDossier().getCrucialDirective().getName(), document.getDossier().getComment(), document.getActual(), document.getIdentifier(), document.getPrice(), document.toAfterTaxPrice(), document.getDossier().getPaymentMethod().getNote() });
    }
    m.worked(10, "building Report");
    STable table = new STable();
    table.setTableFormat(new CFormat(BLACK, WHITE, new CBorder(BLACK)));
    table.setHeadlineFormat(new CFormat(BOLD_ITALIC, WHITE, BLUE, CENTER, new CBorder(BLACK)));
    table.add(new STableColumn("Kid", 8, new CFormat(RIGHT))).add(new STableColumn("AiD", 10, new CFormat(RIGHT))).add(new STableColumn("Firma", 20));
    table.add(new STableColumn("Nachname", 20)).add(new STableColumn("Letzer Status", 20));
    table.add(new STableColumn("Bemerkung", 10)).add(new STableColumn("Datum", 10, new CFormat(RIGHT, SHORT_DATE)));
    table.add(new STableColumn("RE_Nr", 10, new CFormat(RIGHT))).add(new STableColumn("Netto", 15, new CFormat(RIGHT, CURRENCY_EURO))).add(new STableColumn("Brutto", 10, new CFormat(RIGHT, CURRENCY_EURO)));
    table.add(new STableColumn("ZahlungsModalität", 10, new CFormat(RIGHT)));
    table.setModel(new STableModelList(rows));
    CCalcDocument cdoc = new TempCalcDocument("Debitoren_");
    cdoc.add(new CSheet("DebitorenReport", table));
    File file = LucidCalc.createWriter(LucidCalc.Backend.XLS).write(cdoc);
    FileJacket result = new FileJacket("Debitoren", ".xls", file);
    m.finish();
    return result;
}
Also used : DocumentEao(eu.ggnet.dwoss.redtape.ee.eao.DocumentEao) SubMonitor(eu.ggnet.dwoss.progress.SubMonitor) CCalcDocument(eu.ggnet.lucidcalc.CCalcDocument) CSheet(eu.ggnet.lucidcalc.CSheet) TempCalcDocument(eu.ggnet.lucidcalc.TempCalcDocument) CCalcDocument(eu.ggnet.lucidcalc.CCalcDocument) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) FileJacket(eu.ggnet.dwoss.util.FileJacket) STableColumn(eu.ggnet.lucidcalc.STableColumn) STable(eu.ggnet.lucidcalc.STable) STableModelList(eu.ggnet.lucidcalc.STableModelList) TempCalcDocument(eu.ggnet.lucidcalc.TempCalcDocument) CFormat(eu.ggnet.lucidcalc.CFormat) UiCustomer(eu.ggnet.dwoss.customer.opi.UiCustomer) CBorder(eu.ggnet.lucidcalc.CBorder) File(java.io.File)

Aggregations

Document (eu.ggnet.dwoss.redtape.ee.entity.Document)69 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)30 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)22 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)14 DocumentEao (eu.ggnet.dwoss.redtape.ee.eao.DocumentEao)14 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)13 Test (org.junit.Test)13 LogicTransaction (eu.ggnet.dwoss.stock.ee.entity.LogicTransaction)9 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)8 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)8 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)8 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)7 Address (eu.ggnet.dwoss.redtape.ee.entity.Address)6 UniqueUnitEao (eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)6 FileJacket (eu.ggnet.dwoss.util.FileJacket)6 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)5 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)4 File (java.io.File)4 AddressEmo (eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)3 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)3