Search in sources :

Example 41 with ReportLine

use of eu.ggnet.dwoss.report.ee.entity.ReportLine in project dwoss by gg-net.

the class ReportUtilTest method warrantyForInvoiceUnit.

/**
 * Create an warranty reportline referenced to a invoice report line.
 * <p>
 * @param invoiceLine the referenced report line
 * @return an warranty reportline referenced to a invoice report line
 */
private ReportLine warrantyForInvoiceUnit(ReportLine invoiceLine) {
    if (invoiceLine == null || DocumentType.INVOICE != invoiceLine.getDocumentType())
        return null;
    ReportLine warranty = ReportLine.builder().mfgDate(invoiceLine.getMfgDate()).dossierId(invoiceLine.getDossierId()).dossierIdentifier("DW" + format.format(invoiceLine.getDossierId())).documentType(invoiceLine.getDocumentType()).refurbishId(invoiceLine.getRefurbishId()).positionType(PRODUCT_BATCH).partNo("XX.YYYYY.ZZZ").build();
    warranty.setContractor(invoiceLine.getContractor());
    warranty.setReportingDate(invoiceLine.getReportingDate());
    invoiceLine.setReference(SingleReferenceType.WARRANTY, warranty);
    return warranty;
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine)

Example 42 with ReportLine

use of eu.ggnet.dwoss.report.ee.entity.ReportLine in project dwoss by gg-net.

the class ReportLineHtmlTryout method tryout.

@Test
public void tryout() throws InterruptedException, InvocationTargetException, MalformedURLException {
    ReportLine rl = new ReportLine();
    rl.setActual(new Date());
    rl.setContractor(TradeName.EBAY);
    rl.setContractorPartNo("123.131");
    rl.setCustomerId(12322);
    rl.setDescription("AMD E Series E-450 (1.65 Ghz), Memory (in MB): 4096, AMD Radeon HD 6000 Series" + "6320, Festplatte(n): 320GB HDD, Optische(s) Laufwerk(e): DVD Super Multi, Display:" + "15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: grau, Ausstattung:" + "Webcam, WLAN b + g + n, Kartenleser, Videokonnektor(en) : HDMI, VGA, Windows 7" + "Home Premium 64");
    rl.setDocumentIdentifier("SR_00001");
    rl.setDocumentType(DocumentType.INVOICE);
    rl.setDossierIdentifier("DW00110");
    rl.setDossierId(110);
    rl.setInvoiceAddress("Max Mustermann, Musterstrasse 22, 20031 Hamburg");
    rl.setMfgDate(new Date());
    rl.setName("Acer Aspire 5250-4504G32Mnkk (NX.RJYED.004)");
    rl.setPartNo("LX.AAA12.312");
    rl.setPositionType(PositionType.UNIT);
    rl.setProductBrand(TradeName.ACER);
    rl.setProductGroup(ProductGroup.NOTEBOOK);
    rl.setProductName("Aspire 5250-4504G32Mnkk");
    rl.setRefurbishId("13213");
    rl.setReportingDate(new Date());
    rl.setSalesChannel(SalesChannel.RETAILER);
    rl.setSerial("AAAAABBBABABABADFSA23423");
    // Implicit start the platform.
    new JFXPanel();
    Platform.runLater(() -> {
        Stage stage = new Stage();
        stage.setTitle("HtmlViewer");
        WebView view = new WebView();
        view.getEngine().loadContent(Css.toHtml5WithStyle(rl.toHtml()));
        BorderPane p = new BorderPane(view);
        Scene scene = new Scene(p, Color.ALICEBLUE);
        stage.setScene(scene);
        stage.showAndWait();
        complete = true;
    });
    while (!complete) {
        Thread.sleep(500);
    }
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) BorderPane(javafx.scene.layout.BorderPane) ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) Stage(javafx.stage.Stage) WebView(javafx.scene.web.WebView) Scene(javafx.scene.Scene) Date(java.util.Date) Test(org.junit.Test)

Example 43 with ReportLine

use of eu.ggnet.dwoss.report.ee.entity.ReportLine in project dwoss by gg-net.

the class SelectExistingReportViewTryout method main.

public static void main(String[] args) {
    ReportAgent rastub = new ReportAgent() {

        private int counter = 0;

        // <editor-fold defaultstate="collapsed" desc="Unused Methods">
        @Override
        public List<SimpleReportLine> findSimple(SearchParameter search, int firstResult, int maxResults) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<ReportLine> find(SearchParameter search, int firstResult, int maxResults) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public long count(SearchParameter search) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ViewReportResult prepareReport(ReportParameter p, boolean loadUnreported) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<ReportLine> findReportLinesByDocumentType(DocumentType type, Date from, Date till) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Report store(Report report, Collection<Storeable> storeables) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ViewReportResult findReportResult(long reportId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<ReportLine> findAllReportLinesReverse(int firstResult, int maxResults) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Set<ReportLine> attachDanglingComplaints(TradeName type, Date till) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> long count(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public boolean updateReportLineComment(int optLock, long reportId, String comment) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        // </editor-fold>
        @Override
        public Reply<String> updateReportName(Report.OptimisticKey key, String name) {
            System.out.println("Report Name updated with " + name + " calles");
            counter++;
            if ((counter % 2) != 0) {
                System.out.println("Counter=" + counter + " simulating Error");
                return Reply.failure("Counter=" + counter + " simulating Error");
            } else {
                System.out.println("Counter=" + counter + " simulating Success");
                return Reply.success(name);
            }
        }
    };
    Dl.remote().add(ReportAgent.class, rastub);
    UiCore.startSwing(() -> new JLabel("Main Applikation"));
    final Date today = new Date();
    final Date enddate = new Date();
    final Date startdate = new Date();
    final Set<TradeName> trades = new HashSet<>();
    trades.add(TradeName.HP);
    trades.add(TradeName.ACER);
    // build some sample Reports
    List<Report> allReports = new ArrayList();
    for (int i = 0; i < 8; i++) {
        for (TradeName traden : trades) {
            startdate.setYear(62 + i);
            long sum = today.getTime() + startdate.getTime();
            Date sumDate = new Date(sum);
            String name = "Report: " + i + "-" + traden + "-" + sumDate.toString();
            Report e = new Report(name, traden, sumDate, enddate);
            allReports.add(e);
        }
    }
    Ui.exec(() -> {
        Ui.build().fx().show(() -> allReports, () -> new SelectExistingReportView());
    });
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) SimpleReportLine(eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine) ReportParameter(eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter) ReportAgent(eu.ggnet.dwoss.report.ee.ReportAgent) SearchParameter(eu.ggnet.dwoss.report.ee.ReportAgent.SearchParameter) SimpleReportLine(eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine) SelectExistingReportView(eu.ggnet.dwoss.report.ui.cap.support.SelectExistingReportView) TradeName(eu.ggnet.dwoss.rules.TradeName) Report(eu.ggnet.dwoss.report.ee.entity.Report) DocumentType(eu.ggnet.dwoss.rules.DocumentType) JLabel(javax.swing.JLabel) LockModeType(javax.persistence.LockModeType)

Example 44 with ReportLine

use of eu.ggnet.dwoss.report.ee.entity.ReportLine 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);
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) SCell(eu.ggnet.lucidcalc.SCell) LucidCalcWriter(eu.ggnet.lucidcalc.LucidCalcWriter) CCalcDocument(eu.ggnet.lucidcalc.CCalcDocument) CSheet(eu.ggnet.lucidcalc.CSheet) SBlock(eu.ggnet.lucidcalc.SBlock) STableColumn(eu.ggnet.lucidcalc.STableColumn) STable(eu.ggnet.lucidcalc.STable) TempCalcDocument(eu.ggnet.lucidcalc.TempCalcDocument) CFormat(eu.ggnet.lucidcalc.CFormat) CBorder(eu.ggnet.lucidcalc.CBorder)

Example 45 with ReportLine

use of eu.ggnet.dwoss.report.ee.entity.ReportLine in project dwoss by gg-net.

the class RedTapeCloserOpertaionItBean method checkReferences.

public void checkReferences(long dossierId) {
    List<ReportLine> allLines = reportEao.findAll();
    List<ReportLine> collect = allLines.stream().filter((eu.ggnet.dwoss.report.ee.entity.ReportLine line) -> {
        return line.getPositionType().equals(PositionType.PRODUCT_BATCH) && line.getDossierId() == dossierId;
    }).collect(Collectors.toList());
    Assert.assertEquals("Assert ten warranties to be present", 2, collect.size());
    for (ReportLine line : collect) {
        ReportLine reference = line.getReference(SingleReferenceType.WARRANTY);
        Assert.assertFalse("Line has no unit reference " + line, reference == null);
        Assert.assertEquals("Assert equal dossier id in reference", reference.getDossierId(), dossierId);
        Assert.assertFalse("Contractor has not been set", reference.getContractor() == null);
    }
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine)

Aggregations

ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)45 Test (org.junit.Test)18 Report (eu.ggnet.dwoss.report.ee.entity.Report)13 ReportParameter (eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter)5 ReportLineEao (eu.ggnet.dwoss.report.ee.eao.ReportLineEao)5 SimpleReportLine (eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine)5 ViewReportResult (eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult)4 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)3 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)3 ReportAgent (eu.ggnet.dwoss.report.ee.ReportAgent)3 SearchParameter (eu.ggnet.dwoss.report.ee.ReportAgent.SearchParameter)3 YearSplit (eu.ggnet.dwoss.report.ee.entity.Report.YearSplit)3 eu.ggnet.dwoss.rules (eu.ggnet.dwoss.rules)3 Date (java.util.Date)3 JLabel (javax.swing.JLabel)3 AutoLogger (eu.ggnet.dwoss.common.log.AutoLogger)2 RepaymentCustomers (eu.ggnet.dwoss.mandator.api.value.RepaymentCustomers)2 ResolveRepayment (eu.ggnet.dwoss.misc.ee.ResolveRepayment)2 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)2 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)2