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;
}
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;
}
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;
}
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());
}
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;
}
Aggregations