use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class IncomingInvoice_LinkedOrderItems method linkedOrderItems.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ASSOCIATION)
public List<LinkedOrderItemViewModel> linkedOrderItems() {
List<LinkedOrderItemViewModel> result = new ArrayList<>();
for (OrderItemInvoiceItemLink link : orderItemInvoiceItemLinkRepository.findByInvoice(incomingInvoice)) {
OrderItem item = link.getOrderItem();
BigDecimal netAmount = item.getNetAmount();
BigDecimal netAmountInvoiced = orderItemInvoiceItemLinkRepository.calculateNetAmountLinkedToOrderItem(item);
result.add(new LinkedOrderItemViewModel(item, netAmount, netAmountInvoiced));
}
return result;
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class PaymentBatchManager method addInvoiceToPayByBankAccount.
@Action(semantics = SemanticsOf.IDEMPOTENT, publishing = Publishing.DISABLED)
public PaymentBatchManager addInvoiceToPayByBankAccount(final IncomingInvoice incomingInvoice, final BankAccount debtorBankAccount) {
PaymentBatch paymentBatch = paymentBatchRepository.findOrCreateNewByDebtorBankAccount(debtorBankAccount);
paymentBatch.addLineIfRequired(incomingInvoice);
return new PaymentBatchManager();
}
use of org.apache.isis.applib.annotation.Action 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);
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class Task_categoriseDocumentAsOrder method act.
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(contributed = Contributed.AS_ACTION, cssClassFa = "folder-open-o")
public Object act(@Nullable final Property property, @Nullable final String comment, final boolean goToNext) {
final Object nextTaskIfAny = nextTaskOrWarnIfRequired(goToNext);
Object mixinResult = mixin().act(property, comment);
if (mixinResult instanceof IncomingDocViewModel) {
IncomingDocViewModel viewModel = (IncomingDocViewModel) mixinResult;
// to support 'goToNext' when finished with the view model
viewModel.setOriginatingTask(task);
}
return coalesce(nextTaskIfAny, mixinResult);
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class Task_categoriseDocumentAsPropertyInvoice method act.
@Action(domainEvent = Task_categoriseDocumentAsOrder.ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(contributed = Contributed.AS_ACTION, cssClassFa = "folder-open-o")
public Object act(final Property property, @Nullable final String comment, final boolean goToNext) {
final Object nextTaskIfAny = nextTaskOrWarnIfRequired(goToNext);
Object mixinResult = mixin().act(property, comment);
if (mixinResult instanceof IncomingDocViewModel) {
IncomingDocViewModel viewModel = (IncomingDocViewModel) mixinResult;
// to support 'goToNext' when finished with the view model
viewModel.setOriginatingTask(task);
}
return coalesce(nextTaskIfAny, mixinResult);
}
Aggregations