use of org.apache.isis.applib.annotation.MemberOrder in project estatio by estatio.
the class IncomingInvoice_switchView method act.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ACTION, // not sure why this isn't being picked up from isis-non-changing.properties
cssClassFa = "fa-exchange")
@MemberOrder(sequence = "1")
public IncomingDocAsInvoiceViewModel act() {
Optional<Document> documentIfAny = lookupAttachedPdfService.lookupIncomingInvoicePdfFrom(incomingInvoice);
// guaranteed to return, hidden if none
Document document = documentIfAny.get();
final IncomingDocAsInvoiceViewModel viewModel = new IncomingDocAsInvoiceViewModel(incomingInvoice, document);
serviceRegistry2.injectServicesInto(viewModel);
viewModel.init();
return viewModel;
}
use of org.apache.isis.applib.annotation.MemberOrder in project estatio by estatio.
the class IncomingDocAsOrderViewModel method save.
@Action(semantics = SemanticsOf.IDEMPOTENT)
@MemberOrder(sequence = "1")
public Order save() {
Order order = getDomainObject();
order.setOrderNumber(getOrderNumber());
order.setSellerOrderReference(getSellerOrderReference());
order.setEntryDate(clockService.now());
order.setOrderDate(getOrderDate());
order.setSeller(getSeller());
order.setBuyer(getBuyer());
Optional<OrderItem> firstItemIfAny = getFirstItemIfAny();
if (firstItemIfAny.isPresent()) {
OrderItem orderItem = firstItemIfAny.get();
orderItem.setCharge(getCharge());
orderItem.setDescription(getDescription());
orderItem.setNetAmount(getNetAmount());
orderItem.setVatAmount(getVatAmount());
orderItem.setGrossAmount(getGrossAmount());
orderItem.setTax(getTax());
orderItem.setStartDate(getStartDateFromPeriod());
orderItem.setEndDate(getEndDateFromPeriod());
orderItem.setProperty(getProperty());
orderItem.setProject(getProject());
orderItem.setBudgetItem(getBudgetItem());
} else {
order.addItem(getCharge(), getDescription(), getNetAmount(), getVatAmount(), getGrossAmount(), getTax(), getPeriod(), getProperty(), getProject(), getBudgetItem());
}
return order;
}
use of org.apache.isis.applib.annotation.MemberOrder in project estatio by estatio.
the class IncomingDocAsInvoiceViewModel method save.
@Action(semantics = SemanticsOf.IDEMPOTENT)
@MemberOrder(sequence = "1")
public IncomingInvoice save() {
IncomingInvoice incomingInvoice = getDomainObject();
IncomingInvoiceType previousType = incomingInvoice.getType();
incomingInvoice.setType(getIncomingInvoiceType());
incomingInvoice.setInvoiceNumber(getInvoiceNumber());
incomingInvoice.setBuyer(getBuyer());
incomingInvoice.setSeller(getSeller());
incomingInvoice.setInvoiceDate(getInvoiceDate());
incomingInvoice.setDueDate(getDueDate());
incomingInvoice.setPaymentMethod(getPaymentMethod());
incomingInvoice.setCurrency(getCurrency());
incomingInvoice.setDateReceived(getDateReceived());
incomingInvoice.setBankAccount(getBankAccount());
incomingInvoice.setNetAmount(getNetAmount());
incomingInvoice.setGrossAmount(getGrossAmount());
// if changed the type, then we need to re-evaluate the state machine
if (previousType != getIncomingInvoiceType()) {
stateTransitionService.trigger(incomingInvoice, IncomingInvoiceApprovalStateTransition.class, null, null, null);
}
// upsert invoice item
// this will also update the parent header's property with that from the first item
Optional<IncomingInvoiceItem> firstItemIfAny = getFirstItemIfAny();
IncomingInvoiceItem firstItem;
if (firstItemIfAny.isPresent()) {
IncomingInvoiceItem item = firstItemIfAny.get();
item.setIncomingInvoiceType(getIncomingInvoiceType());
item.setCharge(getCharge());
item.setDescription(getDescription());
item.setNetAmount(getNetAmount());
item.setVatAmount(getVatAmount());
item.setGrossAmount(getGrossAmount());
item.setTax(getTax());
item.setStartDate(getStartDateFromPeriod());
item.setEndDate(getEndDateFromPeriod());
item.setFixedAsset(getProperty());
item.setProject(getProject());
item.setBudgetItem(getBudgetItem());
firstItem = item;
} else {
firstItem = incomingInvoiceItemRepository.create(incomingInvoice.nextItemSequence(), incomingInvoice, incomingInvoiceType, getCharge(), getDescription(), getNetAmount(), getVatAmount(), getGrossAmount(), getTax(), getDueDate(), getStartDateFromPeriod(), getEndDateFromPeriod(), getProperty(), getProject(), getBudgetItem());
}
// 'switch view' will not be available subsequently because the Invoice/Item is "too complex")
if (getOrderItem() != null) {
Order order = getOrderItem().getOrdr();
Charge chargeFromWrapper = getOrderItem().getCharge();
OrderItem orderItemToLink = orderItemRepository.findByOrderAndCharge(order, chargeFromWrapper);
orderItemInvoiceItemLinkRepository.findOrCreateLink(orderItemToLink, firstItem, firstItem.getNetAmount());
} else {
// remove all (or the one and only) link.
final Optional<OrderItemInvoiceItemLink> links = orderItemInvoiceItemLinkRepository.findByInvoiceItem(firstItem);
links.ifPresent(link -> {
link.remove();
});
}
return incomingInvoice;
}
use of org.apache.isis.applib.annotation.MemberOrder in project estatio by estatio.
the class Lease_DownloadBudgetCalculationsForLease method downloadBudgetCalculationsForLease.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
@MemberOrder(name = "budgetCalculationRuns", sequence = "1")
public Blob downloadBudgetCalculationsForLease(Budget budget, BudgetCalculationType type) {
final String fileName = lease.getReference() + " - budget details" + ".xlsx";
WorksheetSpec spec = new WorksheetSpec(DetailedCalculationResultViewmodel.class, "values for lease");
WorksheetContent worksheetContent = new WorksheetContent(budgetAssignmentService.getDetailedCalculationResults(lease, budget, type), spec);
return excelService.toExcelPivot(worksheetContent, fileName);
}
use of org.apache.isis.applib.annotation.MemberOrder in project estatio by estatio.
the class OrderInvoiceImportMenu method importOrdersAndInvoices.
@Action(semantics = SemanticsOf.SAFE)
@MemberOrder(sequence = "1")
public OrderInvoiceSheet importOrdersAndInvoices(final String sheetName, final Blob spreadSheet) {
final List<OrderInvoiceLine> lines = orderInvoiceImportService.createLines(sheetName, spreadSheet);
final OrderInvoiceSheet sheet = factoryService.instantiate(OrderInvoiceSheet.class);
sheet.setLines(lines);
return sheet;
}
Aggregations