use of org.estatio.module.capex.app.credittransfer.CreditTransferExportLine in project estatio by estatio.
the class PaymentBatch method downloadReviewSummary.
@Action(semantics = SemanticsOf.SAFE)
public Blob downloadReviewSummary(@Nullable final String documentName) {
List<CreditTransferExportLine> exportLines = new ArrayList<>();
int lineNumber = 1;
for (CreditTransfer transfer : getTransfers()) {
boolean newTransfer = true;
for (PaymentLine paymentLine : transfer.getLines()) {
String firstUse = creditTransferExportService.isFirstUseBankAccount(transfer) ? "YES" : "no";
exportLines.add(new CreditTransferExportLine(lineNumber, lineNumber == 1 ? getDebtorBankAccount().getIban() : null, lineNumber == 1 ? getCreatedOn().toString("dd-MMM-yyyy HH:mm") : null, newTransfer ? transfer.getEndToEndId() : null, newTransfer ? transfer.getSellerBankAccount().getIban() : null, newTransfer ? firstUse : null, newTransfer ? transfer.getSeller().getName() : null, newTransfer ? transfer.getSeller().getReference() : null, newTransfer ? transfer.getAmount().setScale(2, RoundingMode.HALF_UP) : null, newTransfer ? transfer.getCurrency().getName() : null, paymentLine.getInvoice().getInvoiceNumber(), paymentLine.getInvoice().getInvoiceDate(), paymentLine.getInvoice().getGrossAmount().setScale(2, RoundingMode.HALF_UP), creditTransferExportService.getApprovalStateTransitionSummary(paymentLine.getInvoice()), paymentLine.getInvoice().getDescriptionSummary(), creditTransferExportService.getInvoiceDocumentName(paymentLine.getInvoice()), paymentLine.getInvoice().getType() == IncomingInvoiceType.CAPEX ? paymentLine.getInvoice().getType().name() + " (" + paymentLine.getInvoice().getProjectSummary() + ")" : paymentLine.getInvoice().getType().name(), paymentLine.getInvoice().getPropertySummary()));
newTransfer = false;
lineNumber++;
}
}
String name = documentName != null ? documentName.concat(".xlsx") : fileNameWithSuffix("xlsx");
return excelService.toExcel(exportLines, CreditTransferExportLine.class, getRequestedExecutionDate() != null ? getRequestedExecutionDate().toString("yyyyMMdd-HHmm") : "DRAFT", name);
}
Aggregations