use of eu.ggnet.dwoss.report.ee.entity.ReportLine 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.ReportLine 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.ReportLine 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));
}
use of eu.ggnet.dwoss.report.ee.entity.ReportLine in project dwoss by gg-net.
the class ReportTest method testRepaymentOneReport.
@Test
public void testRepaymentOneReport() {
Report report = new Report("TestReport", 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();
report.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);
report.add(line2);
assertTrue("Only Unit Annex - Annulation Invoice in same Report, so line1 should be invoiced\n" + report.toMultiLine(false), report.filterInvoiced().contains(line1));
assertTrue("Only Unit Annex - Annulation Invoice in same Report, so line2 should be invoiced" + report.toMultiLine(false), report.filterInvoiced().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);
report.add(line3);
assertTrue("Case Full Repayment in one Report, all are info\n" + report.toMultiLine(false), report.filterInvoiced().isEmpty());
assertTrue("Case Full Repayment in one Report, all are info\n" + report.toMultiLine(false), report.filterRepayed().isEmpty());
assertTrue("Case Full Repayment in one Report, all are info\n" + report.toMultiLine(false), report.filterInfos().contains(line1));
assertTrue("Case Full Repayment in one Report, all are info\n" + report.toMultiLine(false), report.filterInfos().contains(line2));
assertTrue("Case Full Repayment in one Report, all are info\n" + report.toMultiLine(false), report.filterInfos().contains(line3));
}
use of eu.ggnet.dwoss.report.ee.entity.ReportLine in project dwoss by gg-net.
the class ReportUtilTest method testFilterRepayed.
@Test
public void testFilterRepayed() {
List<ReportLine> lines = new ArrayList<>();
// One invoice unit line in the report with a referenced annulation invoice line
ReportLine invoice1 = makeUnitReportLine(now, 0, INVOICE);
lines.add(invoice1);
lines.add(annulationForInvoice(invoice1, false));
// One invoice unit not in the report with a referenced annulation invoice line
ReportLine invoice2 = makeUnitReportLine(now, invoice1.getDossierId(), INVOICE);
lines.add(annulationForInvoice(invoice2, false));
// One invoice unit in the report with a referenced partial annulation invoice line
ReportLine invoice3 = makeUnitReportLine(now, invoice2.getDossierId(), INVOICE);
lines.add(invoice3);
lines.add(annulationForInvoice(invoice3, true));
// One invoice unit_annex not in the report with a referenced partial annulation invoice line
ReportLine invoice4 = makeUnitReportLine(now, invoice3.getDossierId(), INVOICE);
lines.add(annulationForInvoice(invoice4, true));
Set filtered = ReportUtil.filterRepayed(lines);
assertTrue("Expect DW0002 and DW0004 to be present but was: " + out(filtered), filtered.containsAll(Arrays.asList(invoice2.getSingleReference(ANNULATION_INVOICE), invoice4.getSingleReference(ANNULATION_INVOICE))));
}
Aggregations