Search in sources :

Example 1 with PaymentLineForExcelExportV1

use of org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1 in project estatio by estatio.

the class PaymentBatchManager method downloadExcelExportForCompletedBatches.

@Action(semantics = SemanticsOf.SAFE, commandPersistence = CommandPersistence.NOT_PERSISTED, publishing = Publishing.DISABLED)
public Blob downloadExcelExportForCompletedBatches(@Nullable final String documentName, final LocalDate startExecutionDate, final LocalDate endExecutionDate) {
    List<PaymentLineForExcelExportV1> lineVms = new ArrayList<>();
    List<PaymentBatch> batchesToExport = getCompletedBatches().stream().filter(x -> x.getRequestedExecutionDate().toLocalDate().isAfter(startExecutionDate.minusDays(1)) && x.getRequestedExecutionDate().toLocalDate().isBefore(endExecutionDate.plusDays(1))).collect(Collectors.toList());
    for (PaymentBatch batch : batchesToExport) {
        lineVms.addAll(batch.paymentLinesForExcelExport());
    }
    String name = documentName != null ? documentName.concat(".xlsx") : "export.xlsx";
    return excelService.toExcel(lineVms, PaymentLineForExcelExportV1.class, "export", name);
}
Also used : Clob(org.apache.isis.applib.value.Clob) Nature(org.apache.isis.applib.annotation.Nature) PaymentBatch_complete(org.estatio.module.capex.dom.payment.approval.triggers.PaymentBatch_complete) Setter(lombok.Setter) Getter(lombok.Getter) WrapperFactory(org.apache.isis.applib.services.wrapper.WrapperFactory) BankAccountRepository(org.estatio.module.financial.dom.BankAccountRepository) PaymentMethod(org.estatio.module.invoice.dom.PaymentMethod) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) BigDecimal(java.math.BigDecimal) CreditTransfer(org.estatio.module.capex.dom.payment.CreditTransfer) Lists(com.google.common.collect.Lists) AccessLevel(lombok.AccessLevel) BankAccount(org.estatio.module.financial.dom.BankAccount) FactoryService(org.apache.isis.applib.services.factory.FactoryService) Nullable(javax.annotation.Nullable) Blob(org.apache.isis.applib.value.Blob) IncomingInvoice(org.estatio.module.capex.dom.invoice.IncomingInvoice) Action(org.apache.isis.applib.annotation.Action) PaymentBatchRepository(org.estatio.module.capex.dom.payment.PaymentBatchRepository) IsisJdoSupport(org.apache.isis.applib.services.jdosupport.IsisJdoSupport) IncomingInvoiceRepository(org.estatio.module.capex.dom.invoice.IncomingInvoiceRepository) DebtorBankAccountService(org.estatio.module.capex.app.DebtorBankAccountService) ServiceRegistry2(org.apache.isis.applib.services.registry.ServiceRegistry2) Collection(java.util.Collection) DateTime(org.joda.time.DateTime) PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) IncomingInvoiceApprovalState(org.estatio.module.capex.dom.invoice.approval.IncomingInvoiceApprovalState) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) LocalDate(org.joda.time.LocalDate) SemanticsOf(org.apache.isis.applib.annotation.SemanticsOf) PaymentLine(org.estatio.module.capex.dom.payment.PaymentLine) List(java.util.List) DomainObject(org.apache.isis.applib.annotation.DomainObject) CommandPersistence(org.apache.isis.applib.annotation.CommandPersistence) TransactionService(org.apache.isis.applib.services.xactn.TransactionService) ParameterLayout(org.apache.isis.applib.annotation.ParameterLayout) PaymentLineForExcelExportV1(org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1) InvoicePageRange(org.estatio.module.capex.dom.util.InvoicePageRange) Collections(java.util.Collections) Publishing(org.apache.isis.applib.annotation.Publishing) ExcelService(org.isisaddons.module.excel.dom.ExcelService) ArrayList(java.util.ArrayList) PaymentLineForExcelExportV1(org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1) PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) Action(org.apache.isis.applib.annotation.Action)

Example 2 with PaymentLineForExcelExportV1

use of org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1 in project estatio by estatio.

the class PaymentBatchManager method downloadExcelExportForNewBatches.

@Action(semantics = SemanticsOf.SAFE, commandPersistence = CommandPersistence.NOT_PERSISTED, publishing = Publishing.DISABLED)
public Blob downloadExcelExportForNewBatches(@Nullable final String documentName, @Nullable final List<PaymentBatch> newPaymentBatches) {
    List<PaymentLineForExcelExportV1> lineVms = new ArrayList<>();
    for (PaymentBatch batch : newPaymentBatches) {
        lineVms.addAll(batch.paymentLinesForExcelExport());
    }
    String name = documentName != null ? documentName.concat(".xlsx") : "export.xlsx";
    return excelService.toExcel(lineVms, PaymentLineForExcelExportV1.class, "export", name);
}
Also used : ArrayList(java.util.ArrayList) PaymentLineForExcelExportV1(org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1) PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) Action(org.apache.isis.applib.annotation.Action)

Aggregations

ArrayList (java.util.ArrayList)2 Action (org.apache.isis.applib.annotation.Action)2 PaymentLineForExcelExportV1 (org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1)2 PaymentBatch (org.estatio.module.capex.dom.payment.PaymentBatch)2 Lists (com.google.common.collect.Lists)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Nullable (javax.annotation.Nullable)1 Inject (javax.inject.Inject)1 AccessLevel (lombok.AccessLevel)1 Getter (lombok.Getter)1 Setter (lombok.Setter)1 CommandPersistence (org.apache.isis.applib.annotation.CommandPersistence)1 DomainObject (org.apache.isis.applib.annotation.DomainObject)1 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)1 Nature (org.apache.isis.applib.annotation.Nature)1