use of eu.ggnet.lucidcalc.CFormat in project dwoss by gg-net.
the class AuditReporterOperation method onRollIn.
/**
* Returns an audit report of units which are input between the dates.
* <p/>
* @return an audit report of units which are input between the dates.
*/
@Override
public FileJacket onRollIn() {
SubMonitor m = monitorFactory.newSubMonitor("AuditReport", 100);
m.message("loading UniqueUnits");
m.start();
List<StockTransaction> rollInTransactions = new StockTransactionEao(stocks.getEntityManager()).findByTypeAndStatus(StockTransactionType.ROLL_IN, StockTransactionStatusType.PREPARED);
List<Integer> uuIds = toUniqueUnitIds(rollInTransactions);
List<UniqueUnit> uniqueUnits = new UniqueUnitEao(uus.getEntityManager()).findByIds(uuIds);
m.worked(5, "preparing Document");
List<Object[]> rows = new ArrayList<>();
for (UniqueUnit uu : uniqueUnits) {
rows.add(new Object[] { uu.getRefurbishId(), uu.getProduct().getGroup().getNote(), uu.getProduct().getPartNo(), uu.getSerial(), ProductFormater.toName(uu.getProduct()), uu.getContractor(), UniqueUnitFormater.toSingleLineAccessories(uu), UniqueUnitFormater.toSingleLineComment(uu), UniqueUnitFormater.toSingleLineInternalComment(uu), uu.getCondition().getNote(), uu.getShipmentLabel(), uu.getProduct().getDescription(), "" });
}
CSheet sheet = new CSheet("Audit");
STable table = new STable();
table.setHeadlineFormat(new CFormat(BOLD_ITALIC, BLACK, WHITE, CENTER, new CBorder(BLACK)));
table.add(new STableColumn("SopoNr", 7)).add(new STableColumn("Warengruppe", 13)).add(new STableColumn("ArtikelNr", 15)).add(new STableColumn("Seriennummer", 27));
table.add(new STableColumn("Name", 30)).add(new STableColumn("Lieferant", 12)).add(new STableColumn("Zubehör", 50)).add(new STableColumn("Bemerkung", 50));
table.add(new STableColumn("Interne Bemerkung", 30)).add(new STableColumn("Zustand", 12)).add(new STableColumn("Shipment", 12)).add(new STableColumn("Beschreibung", 50));
table.setModel(new STableModelList(rows));
sheet.addBelow(table);
CCalcDocument document = new TempCalcDocument();
document.add(sheet);
FileJacket fj = new FileJacket("Audit", ".xls", LucidCalc.createWriter(LucidCalc.Backend.XLS).write(document));
m.finish();
return fj;
}
use of eu.ggnet.lucidcalc.CFormat in project dwoss by gg-net.
the class AuditReporterOperation method byRange.
/**
* Returns an audit report of units which are on a roll in transaction, but not yet rolled in.
* <p/>
* @return an audit report of units which are on a roll in transaction, but not yet rolled in.
*/
@Override
public FileJacket byRange(Date start, Date end) {
SubMonitor m = monitorFactory.newSubMonitor("AuditReport", 100);
m.message("loading UniqueUnits");
m.start();
List<UniqueUnit> uniqueUnits = new UniqueUnitEao(uus.getEntityManager()).findBetweenInputDates(start, end);
m.worked(5, "preparing Document");
List<Object[]> rows = new ArrayList<>();
for (UniqueUnit uu : uniqueUnits) {
rows.add(new Object[] { uu.getRefurbishId(), uu.getProduct().getGroup().getNote(), uu.getProduct().getPartNo(), uu.getSerial(), ProductFormater.toName(uu.getProduct()), uu.getContractor(), UniqueUnitFormater.toSingleLineAccessories(uu), UniqueUnitFormater.toSingleLineComment(uu), UniqueUnitFormater.toSingleLineInternalComment(uu), uu.getCondition().getNote(), uu.getShipmentLabel(), uu.getProduct().getDescription(), "" });
}
CSheet sheet = new CSheet("Audit");
STable table = new STable();
table.setHeadlineFormat(new CFormat(BOLD_ITALIC, BLACK, WHITE, CENTER, new CBorder(BLACK)));
table.add(new STableColumn("SopoNr", 7)).add(new STableColumn("Warengruppe", 13)).add(new STableColumn("ArtikelNr", 15)).add(new STableColumn("Seriennummer", 27));
table.add(new STableColumn("Name", 30)).add(new STableColumn("Lieferant", 12)).add(new STableColumn("Zubehör", 50)).add(new STableColumn("Bemerkung", 50));
table.add(new STableColumn("Interne Bemerkung", 30)).add(new STableColumn("Zustand", 12)).add(new STableColumn("Shipment", 12)).add(new STableColumn("Beschreibung", 50));
table.setModel(new STableModelList(rows));
sheet.addBelow(table);
CCalcDocument document = new TempCalcDocument();
document.add(sheet);
FileJacket fj = new FileJacket("Audit", ".xls", LucidCalc.createWriter(LucidCalc.Backend.XLS).write(document));
m.finish();
return fj;
}
use of eu.ggnet.lucidcalc.CFormat in project dwoss by gg-net.
the class ReturnsExporter method returnsToXls.
public static File returnsToXls(List<ReportLine> lines) {
List<Object[]> linesData = new ArrayList<>();
for (ReportLine reportLine : lines) {
Object[] data = new Object[] { reportLine.getDossierIdentifier(), reportLine.getActual(), reportLine.getRefurbishId(), reportLine.getPartNo(), reportLine.getName(), reportLine.getSerial(), reportLine.getMfgDate(), reportLine.getReportingDate() };
linesData.add(data);
}
STable newTable = new STable();
newTable.setTableFormat(new CFormat("Verdana", 10, new CBorder(Color.BLACK, CBorder.LineStyle.THIN)));
newTable.setHeadlineFormat(new CFormat(CFormat.FontStyle.BOLD, Color.BLACK, Color.YELLOW, CFormat.HorizontalAlignment.CENTER, CFormat.VerticalAlignment.MIDDLE));
newTable.add(new STableColumn("Auftrag", 15));
newTable.add(new STableColumn("Datum", 10, new CFormat(CFormat.Representation.SHORT_DATE)));
newTable.add(new STableColumn("SopoNr", 10));
newTable.add(new STableColumn("ArtikelNr", 15));
newTable.add(new STableColumn("Bezeichnung", 40));
newTable.add(new STableColumn("Seriennummer", 35));
newTable.add(new STableColumn("MFGDate", 10, new CFormat(CFormat.Representation.SHORT_DATE)));
newTable.add(new STableColumn("reported Am", 10, new CFormat(CFormat.Representation.SHORT_DATE)));
newTable.setModel(new STableModelList<>(linesData));
STable table = new STable(newTable);
table.setModel(new STableModelList<>(linesData));
ReturnsExporter.SResult summary = createReturnsSummary(table, lines.size());
SBlock block = new SBlock();
block.setFormat(new CFormat(Color.BLACK, Color.LIGHT_GRAY, CFormat.HorizontalAlignment.LEFT));
block.add(new SCell("Rückläufer"), "");
CSheet sheet = new CSheet("Rückläufer Report");
sheet.setShowGridLines(false);
sheet.addBelow(block);
sheet.addBelow(newTable);
sheet.addBelow(4, 1, summary.block);
CCalcDocument doc = new TempCalcDocument("Rückläufer");
doc.add(sheet);
LucidCalcWriter writer = LucidCalc.createWriter(LucidCalc.Backend.XLS);
return writer.write(doc);
}
use of eu.ggnet.lucidcalc.CFormat in project dwoss by gg-net.
the class ReturnsExporter method createReturnsSummary.
/**
* Create the Summary Block at the End.
* <p/>
* @param table The Stable where all the data exist.
* @param startingDate the startnig date of the Report.
* @param endingDate the ending date of the Report.
* @return a SResult Block with the Summary.
*/
static ReturnsExporter.SResult createReturnsSummary(STable table, int amount) {
ReturnsExporter.SResult r = new ReturnsExporter.SResult();
r.block = new SBlock();
r.block.setFormat(new CFormat(CFormat.FontStyle.BOLD, Color.BLACK, Color.YELLOW, CFormat.HorizontalAlignment.RIGHT, new CBorder(Color.BLACK)));
r.sum1 = new SCell(new SFormula("SUMME(", amount, "*", 10, ")"), EURO);
r.sum2 = new SCell(amount);
r.block.add(r.sum1, r.sum2);
return r;
}
Aggregations