Search in sources :

Example 11 with ReportLine

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

the class ReportUtilTest method annulationForInvoice.

/**
 * Create an annulation invoice reportline referenced to a invoice report line.
 * <p>
 * @param invoiceLine      the referenced report line
 * @param partialRepayment does the annulation represent a partial repayment (UNIT/UNIT_ANNEX)
 * @return an annulation invoice reportline referenced to a invoice report line
 */
private ReportLine annulationForInvoice(ReportLine invoiceLine, boolean partialRepayment) {
    if (invoiceLine == null || DocumentType.INVOICE != invoiceLine.getDocumentType())
        return null;
    ReportLine annulationLine = ReportLine.builder().mfgDate(invoiceLine.getMfgDate()).dossierId(invoiceLine.getDossierId()).dossierIdentifier("DW" + format.format(invoiceLine.getDossierId())).documentType(ANNULATION_INVOICE).positionType(partialRepayment ? UNIT_ANNEX : invoiceLine.getPositionType()).build();
    invoiceLine.add(annulationLine);
    return annulationLine;
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine)

Example 12 with ReportLine

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

the class ReportUtilTest method makeUnitReportLine.

/**
 * Generates a invoice report line for a unit.
 * <p>
 * @param mfgDate       the manufavcturing date from the unit
 * @param lastDossierId the last used dossier id
 * @param dType         the document type of the reportline
 * @return a invoice report line for a unit.
 */
private ReportLine makeUnitReportLine(Date mfgDate, long lastDossierId, DocumentType dType) {
    ReportLine build = ReportLine.builder().mfgDate(mfgDate).dossierId(lastDossierId + 1).dossierIdentifier("DW" + format.format(lastDossierId + 1)).documentType(dType).positionType(UNIT).build();
    build.setReportingDate(now);
    build.setContractor(HP);
    return build;
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine)

Example 13 with ReportLine

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

the class ReportUtil method filterActiveInfo.

/**
 * Returns a set containing only non reportable lines that are not of the RETURNS type.
 * It's not allowed to have a null value in the collection.
 * <p>
 * @param allLines
 * @param reportAble
 * @return
 */
public static NavigableSet<ReportLine> filterActiveInfo(Collection<ReportLine> allLines, Collection<ReportLine> reportAble) {
    TreeSet<ReportLine> treeSet = new TreeSet<>(allLines);
    treeSet.removeAll(reportAble);
    for (Iterator<ReportLine> it = treeSet.iterator(); it.hasNext(); ) {
        ReportLine reportLine = it.next();
        if (reportLine.getDocumentType() == DocumentType.RETURNS)
            it.remove();
    }
    return treeSet;
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine)

Example 14 with ReportLine

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

the class ReportUtil method filterInvoicedSplit.

/**
 * Returns all Lines of the Report for Category Invoiced, split by mfgDate - startOfReport &lt; 1 year and the rest.
 * This consists of:
 * <ul>
 * <li>Position of Type Invoice, with no References</li>
 * <li>Position of Type UNIT_ANNEX in DocumentType CREDIT_MEMO/ANNULATIION_INVOICE and a Referencing Invoice in the same report.</li>
 * </ul>
 * <p>
 * It's not allowed to have a null value in the collection.
 * <p>
 * @param lines
 * @param startingDate
 * @return all Lines of the Report for Category Invoiced.
 */
public static YearSplit filterInvoicedSplit(Collection<ReportLine> lines, Date startingDate) {
    NavigableSet<ReportLine> pastSplit = new TreeSet<>();
    NavigableSet<ReportLine> preSplit = new TreeSet<>();
    Date splitter = DateUtils.addYears(startingDate, -1);
    for (ReportLine line : filterInvoiced(lines)) {
        if (splitter.before(line.getMfgDate())) {
            preSplit.add(line);
        } else {
            pastSplit.add(line);
        }
    }
    return new YearSplit(startingDate, preSplit, pastSplit);
}
Also used : YearSplit(eu.ggnet.dwoss.report.ee.entity.Report.YearSplit) ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine)

Example 15 with ReportLine

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

the class ReportLineGenerator method makeReportLine.

public ReportLine makeReportLine() {
    ReportLine reportLine = new ReportLine();
    Date pastFiveYears = DateUtils.setYears(new Date(), 2009);
    reportLine.setActual(new Date());
    reportLine.setName("ReportLine-" + getRandomInt());
    reportLine.setDescription("desription-" + getRandomInt());
    reportLine.setDossierId(getRandomLong());
    reportLine.setDocumentIdentifier("dossierIdentifier-" + getRandomInt());
    reportLine.setDocumentId(getRandomLong());
    reportLine.setDocumentIdentifier("documentIdentifier-" + getRandomInt());
    reportLine.setPositionType(PositionType.values()[R.nextInt(PositionType.values().length)]);
    reportLine.setDocumentType(DocumentType.values()[R.nextInt(DocumentType.values().length)]);
    reportLine.setCustomerId(getRandomLong());
    reportLine.setAmount(getRandomLong());
    double tax = GlobalConfig.DEFAULT_TAX.getTax();
    double price = Math.abs(R.nextDouble() * R.nextInt(1500));
    reportLine.setManufacturerCostPrice(price + 15);
    reportLine.setPrice(price);
    reportLine.setTax(tax);
    reportLine.setBookingAccount(getRandomInt());
    GeneratedAddress makeAddress = new NameGenerator().makeAddress();
    Name makeName = new NameGenerator().makeName();
    String invoiceAdress = makeName.getFirst() + " " + makeName.getLast() + ", " + makeAddress.getStreet() + " " + makeAddress.getNumber() + ", " + makeAddress.getPostalCode() + " " + makeAddress.getTown();
    reportLine.setInvoiceAddress(invoiceAdress);
    reportLine.setRefurbishId("" + R.nextInt(100000));
    reportLine.setUniqueUnitId(getRandomLong());
    reportLine.setSerial("serial" + getRandomInt());
    reportLine.setProductId(getRandomLong());
    reportLine.setPartNo("partNo" + getRandomInt());
    List<TradeName> names = new ArrayList<>();
    names.addAll(Arrays.asList(TradeName.ACER, TradeName.APPLE, TradeName.DELL, TradeName.HP));
    reportLine.setContractor(names.get(R.nextInt(names.size())));
    reportLine.setProductBrand(names.get(R.nextInt(names.size())));
    reportLine.setMfgDate(DateUtils.addDays(pastFiveYears, R.nextInt(2000)));
    reportLine.setReportingDate(DateUtils.addDays(reportLine.getMfgDate(), R.nextInt(400)));
    return reportLine;
}
Also used : 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