use of eu.ggnet.dwoss.report.ee.entity.Report in project dwoss by gg-net.
the class ReportAgentBean method updateReportName.
/**
* See {@link ReportAgent#updateReportName(eu.ggnet.dwoss.report.entity.Report.OptimisticKey, java.lang.String) }.
*/
@Override
public Reply<String> updateReportName(Report.OptimisticKey key, String name) {
// TODO: Build a better result with error messages.
if (key == null)
return Reply.failure("Key is null");
if (name == null)
return Reply.failure("Name is null");
Report find = reportEm.find(Report.class, key.getId());
if (find == null)
return Reply.failure("No Report found with id " + key.getId());
if (find.getOptLock() != key.getOptLock())
return Reply.failure("OptLock missmatsch. Bitte Fenster schließen und neu öffnen");
find.setName(name);
return Reply.success(name);
}
use of eu.ggnet.dwoss.report.ee.entity.Report in project dwoss by gg-net.
the class ReportTest method testSplitterResult.
@Test
public void testSplitterResult() {
Report report = new Report("TestReport", ALSO, _2011_10_01, _2011_10_07);
ReportLine unitAfter = ReportLine.builder().documentType(DocumentType.INVOICE).documentId(1).dossierId(1).customerId(1).positionType(PositionType.UNIT).name("Unit-123").refurbishId("123").amount(1).price(100).tax(0.19).mfgDate(_2009_01_01).build();
ReportLine unitBefore = ReportLine.builder().documentType(DocumentType.INVOICE).documentId(1).dossierId(1).customerId(1).positionType(PositionType.UNIT).name("Unit-123").refurbishId("124").amount(1).price(100).tax(0.19).mfgDate(_2011_09_01).build();
report.add(unitBefore);
report.add(unitAfter);
Report.YearSplit result = report.filterInvoicedSplit();
assertThat(result.getAfter()).describedAs("Report.after : Split at " + result.getSplitter()).isNotEmpty().hasSize(1);
assertFalse("Before should not be empty, splitting at " + result.getSplitter(), result.getBefore().isEmpty());
assertEquals("Before should be exactly one, splitting at " + result.getSplitter(), 1, result.getBefore().size());
assertEquals(unitAfter, result.getAfter().first());
assertEquals(unitBefore, result.getBefore().first());
}
use of eu.ggnet.dwoss.report.ee.entity.Report in project dwoss by gg-net.
the class ReportTest method testFilterInvoice.
@Test
public void testFilterInvoice() {
Report report = new Report("TestReport", ALSO, new Date(Calendar.getInstance().getTimeInMillis() - 100000), new Date());
ReportLine line1 = new ReportLine("PersName1", "This is a TestDescription1", 137, "DW0037", 3, "RE0008", PositionType.UNIT, DocumentType.INVOICE, 2, 1, 0.19, 100, 37, "This is the Invoice Address", "123", 2, "SERIALNUMBER", new Date(), 3, "PArtNo", "test@gg-net.de");
report.add(line1);
assertTrue(report.filterInvoiced().contains(line1));
assertTrue(report.filterRepayed().isEmpty());
assertTrue(report.filterInfos().isEmpty());
ReportLine line2 = new ReportLine("PersName1", "This is a TestDescription1", 137, "DW0037", 3, "RE0008", PositionType.UNIT, DocumentType.COMPLAINT, 2, 1, 0.19, 0, 37, "This is the Invoice Address", "123", 2, "SERIALNUMBER", new Date(), 3, "PArtNo", "test@gg-net.de");
line2.setWorkflowStatus(ReportLine.WorkflowStatus.UNDER_PROGRESS);
line1.add(line2);
report.add(line2);
ReportLine line3 = new ReportLine("PersName1", "This is a TestDescription1", 137, "DW0037", 3, "RE0008", PositionType.UNIT, DocumentType.COMPLAINT, 2, 1, 0.19, 0, 37, "This is the Invoice Address", "123", 2, "SERIALNUMBER", new Date(), 3, "PArtNo", "test@gg-net.de");
line3.setWorkflowStatus(ReportLine.WorkflowStatus.DISCHARGED);
line1.add(line3);
line2.add(line3);
report.add(line3);
assertTrue("Complaint was discharged, so line1 should be visible in invoiced.", report.filterInvoiced().contains(line1));
assertTrue(report.filterRepayed().isEmpty());
assertTrue("Complaints are only infos, so line2 should be visible in infos.", report.filterInfos().contains(line2));
assertTrue("Complaints are only infos, so line3 should be visible in infos.", report.filterInfos().contains(line3));
}
use of eu.ggnet.dwoss.report.ee.entity.Report in project dwoss by gg-net.
the class ReportTest method testRepaymentTwoReport.
@Test
public void testRepaymentTwoReport() {
Report report1 = new Report("TestReport 1", ALSO, NOW, NOW);
Report report2 = new Report("TestReport 2", ALSO, NOW, NOW);
ReportLine line1 = ReportLine.builder().documentType(DocumentType.INVOICE).documentId(1).dossierId(1).customerId(1).positionType(PositionType.UNIT).name("Unit-123").refurbishId("123").amount(1).price(100).tax(0.19).build();
report1.add(line1);
// Creditmemo unitAnnex.
ReportLine line2 = ReportLine.builder().documentType(DocumentType.ANNULATION_INVOICE).documentId(2).dossierId(1).customerId(1).positionType(PositionType.UNIT_ANNEX).name("Unit-123").refurbishId("123").amount(1).price(-10).tax(0.19).build();
line1.add(line2);
report2.add(line2);
assertTrue("Only Unit Annex Repayment, Different Reports, so no invoices in report2\n" + report2.toMultiLine(false), report2.filterInvoiced().isEmpty());
assertTrue("Only Unit Annex Repayment, Different Reports, so line1 should be repayment\n" + report2.toMultiLine(false), report2.filterRepayed().contains(line2));
// Now add A Unit.
ReportLine line3 = ReportLine.builder().documentType(DocumentType.ANNULATION_INVOICE).documentId(3).dossierId(1).customerId(1).positionType(PositionType.UNIT).name("Unit-123").refurbishId("123").amount(1).price(-90).tax(0.19).build();
line1.add(line3);
line2.add(line3);
report2.add(line3);
assertTrue("Case Full Repayment in two Reports, so no invoices in report2\n" + report2.toMultiLine(false), report2.filterInvoiced().isEmpty());
assertTrue("Case Full Repayment in two Reports, so unit annex is only info\n" + report2.toMultiLine(false), report2.filterInfos().contains(line2));
assertTrue("Case Full Repayment in two Reports, so unit is repayment\n" + report2.toMultiLine(false), report2.filterRepayed().contains(line3));
}
use of eu.ggnet.dwoss.report.ee.entity.Report in project dwoss by gg-net.
the class ReportTest method testRepaymentTwoReports.
// TODO: Report 1 :Invoice + Partiall Repayment, Report 2: Full Repayment
@Test
public void testRepaymentTwoReports() {
Report report1 = new Report("TestReport 1", ALSO, NOW, NOW);
Report report2 = new Report("TestReport 2", ALSO, NOW, NOW);
ReportLine line1 = ReportLine.builder().documentType(DocumentType.INVOICE).documentId(1).dossierId(1).customerId(1).positionType(PositionType.UNIT).name("Unit-123").refurbishId("123").amount(1).price(100).tax(0.19).build();
report1.add(line1);
// Creditmemo unitAnnex.
ReportLine line2 = ReportLine.builder().documentType(DocumentType.ANNULATION_INVOICE).documentId(2).dossierId(1).customerId(1).positionType(PositionType.UNIT_ANNEX).name("Unit-123").refurbishId("123").amount(1).price(-10).tax(0.19).build();
line1.add(line2);
report1.add(line2);
// Now add A Unit.
ReportLine line3 = ReportLine.builder().documentType(DocumentType.ANNULATION_INVOICE).documentId(3).dossierId(1).customerId(1).positionType(PositionType.UNIT).name("Unit-123").refurbishId("123").amount(1).price(-90).tax(0.19).build();
line1.add(line3);
line2.add(line3);
report2.add(line3);
assertTrue("Report1 should only contain line1 of invoice and line2 of partial repayment\n" + report1.toMultiLine(false) + report2.toMultiLine(false), report1.filterInvoiced().size() == 2 && report1.filterInvoiced().containsAll(Arrays.asList(line1, line2)) && report1.filterInfos().isEmpty() && report1.filterRepayed().isEmpty());
assertTrue("Report2 should only contaion line3 of full repayment\n" + report1.toMultiLine(false) + report2.toMultiLine(false), report2.filterInvoiced().isEmpty() && report2.filterInfos().isEmpty() && report2.filterRepayed().size() == 1 && report2.filterRepayed().contains(line3));
}
Aggregations