Search in sources :

Example 6 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class DocumentTypeAndTemplatesFSForInvoicesUsingSsrs_Test method setUp.

@Before
public void setUp() throws Exception {
    stubDocumentType = DocumentTypeData.PRELIM_LETTER.create();
    stubInvoice = new InvoiceForLease();
    stubInvoice.setDueDate(new LocalDate(2016, 11, 1));
    stubBuyer = new Organisation();
    stubBuyer.setName("Buyer-1");
    stubInvoice.setBuyer(stubBuyer);
    stubInvoice.setLease(mockLease);
    stubProperty = new Property();
    stubProperty.setReference("XXX");
    stubUnit = new Unit();
    stubUnit.setName("XXX-123");
    stubBrand = new Brand();
    stubBrand.setName("Brandino");
    // expect
    context.checking(new Expectations() {

        {
            allowing(mockPaperclipRepository).paperclipAttaches(mockDocument, InvoiceForLease.class);
            will(returnValue(stubInvoice));
            allowing(mockLease).getProperty();
            will(returnValue(stubProperty));
            allowing(mockLease).getReference();
            will(returnValue("XXX-ABC-789"));
            allowing(mockDocument).getType();
            will(returnValue(stubDocumentType));
        }
    });
    // expecting
    context.checking(new Expectations() {

        {
            allowing(mockConfigurationService).getProperty("isis.deploymentType");
            will(returnValue("prototyping"));
        }
    });
    rendererModelFactory = new FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover();
    inject(rendererModelFactory, "paperclipRepository", mockPaperclipRepository);
}
Also used : Brand(org.estatio.module.lease.dom.occupancy.tags.Brand) Expectations(org.jmock.Expectations) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) Organisation(org.estatio.module.party.dom.Organisation) Unit(org.estatio.module.asset.dom.Unit) LocalDate(org.joda.time.LocalDate) Property(org.estatio.module.asset.dom.Property) FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover(org.estatio.module.lease.spiimpl.document.binders.FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover) Before(org.junit.Before)

Example 7 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class IncomingInvoice method getPropertySummary.

@Programmatic
public String getPropertySummary() {
    List<Property> distinctProperties = new ArrayList<>();
    for (InvoiceItem item : getItems()) {
        IncomingInvoiceItem iitem = (IncomingInvoiceItem) item;
        if (iitem.getFixedAsset() != null && !distinctProperties.contains(iitem.getFixedAsset())) {
            distinctProperties.add((Property) iitem.getFixedAsset());
        }
    }
    StringBuffer summary = new StringBuffer();
    for (Property property : distinctProperties) {
        if (summary.length() > 0) {
            summary.append(" | ");
        }
        summary.append(property.getName());
    }
    return summary.toString();
}
Also used : InvoiceItem(org.estatio.module.invoice.dom.InvoiceItem) ArrayList(java.util.ArrayList) Property(org.estatio.module.asset.dom.Property) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 8 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class CreateInvoiceNumerators method execute.

@Override
protected void execute(ExecutionContext ec) {
    final List<FixedAssetRoleTypeEnum> roleTypes = Arrays.asList(FixedAssetRoleTypeEnum.PROPERTY_OWNER, FixedAssetRoleTypeEnum.TENANTS_ASSOCIATION);
    for (final Property property : propertyRepository.allProperties()) {
        for (final FixedAssetRole fixedAssetRole : fixedAssetRoleRepository.findAllForProperty(property)) {
            if (roleTypes.contains(fixedAssetRole.getType())) {
                ApplicationTenancy applicationTenancy = estatioApplicationTenancyRepository.findOrCreateTenancyFor(property, fixedAssetRole.getParty());
                final Numerator numerator = estatioNumeratorRepository.createInvoiceNumberNumerator(property, PropertyOwnerBuilder.numeratorReferenceFor(property), bi(0), applicationTenancy);
                ec.addResult(this, property.getReference(), numerator);
            }
        }
    }
}
Also used : Numerator(org.estatio.module.numerator.dom.Numerator) FixedAssetRole(org.estatio.module.asset.dom.role.FixedAssetRole) FixedAssetRoleTypeEnum(org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum) Property(org.estatio.module.asset.dom.Property) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 9 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class InvoiceNumeratorImport method importData.

@Override
public List<Object> importData(Object previousRow) {
    // find or create app tenancy (because of use wildcards)
    ApplicationTenancy applicationTenancy = securityApplicationTenancyRepository.newTenancy(atPath, atPath, securityApplicationTenancyRepository.findByPath(atPath.split("/%/")[0]));
    Property property = propertyRepository.findPropertyByReference(propertyReference);
    Numerator numerator;
    if (atPath.contains("/%/")) {
        numerator = numeratorRepository.findScopedNumeratorIncludeWildCardMatching(Constants.NumeratorName.INVOICE_NUMBER, property, applicationTenancy);
    } else {
        numerator = numeratorRepository.findNumerator(Constants.NumeratorName.INVOICE_NUMBER, property, applicationTenancy);
    }
    if (numerator == null) {
        numerator = numeratorRepository.createScopedNumerator(Constants.NumeratorName.INVOICE_NUMBER, property, formatStr, lastIncrement, applicationTenancy);
    }
    return Lists.newArrayList(numerator);
}
Also used : Numerator(org.estatio.module.numerator.dom.Numerator) Property(org.estatio.module.asset.dom.Property) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 10 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class BudgetImportExport method removeExistingBudgetItemsIfNotLinked.

private void removeExistingBudgetItemsIfNotLinked() {
    Property property = propertyRepository.findPropertyByReference(getPropertyReference());
    Budget budget = budgetRepository.findOrCreateBudget(property, getBudgetStartDate(), getBudgetEndDate());
    for (BudgetItem item : budget.getItems()) {
        if (orderItemRepository.findByBudgetItem(item).size() == 0 && incomingInvoiceItemRepository.findByBudgetItem(item).size() == 0) {
            for (PartitionItem pItem : item.getPartitionItems()) {
                pItem.remove();
            }
            repositoryService.removeAndFlush(item);
        }
    }
}
Also used : BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) Budget(org.estatio.module.budget.dom.budget.Budget) Property(org.estatio.module.asset.dom.Property) PartitionItem(org.estatio.module.budget.dom.partioning.PartitionItem)

Aggregations

Property (org.estatio.module.asset.dom.Property)47 LocalDate (org.joda.time.LocalDate)19 Test (org.junit.Test)19 Party (org.estatio.module.party.dom.Party)12 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)11 Programmatic (org.apache.isis.applib.annotation.Programmatic)10 Budget (org.estatio.module.budget.dom.budget.Budget)8 InvoiceForLease (org.estatio.module.lease.dom.invoicing.InvoiceForLease)8 BigDecimal (java.math.BigDecimal)7 List (java.util.List)6 Charge (org.estatio.module.charge.dom.Charge)6 Lease (org.estatio.module.lease.dom.Lease)6 InvoiceItemForLease (org.estatio.module.lease.dom.invoicing.InvoiceItemForLease)6 Expectations (org.jmock.Expectations)6 Before (org.junit.Before)6 Unit (org.estatio.module.asset.dom.Unit)5 Project (org.estatio.module.capex.dom.project.Project)5 Organisation (org.estatio.module.party.dom.Organisation)5 BudgetItemValue (org.estatio.module.budget.dom.budgetitem.BudgetItemValue)4 BankAccount (org.estatio.module.financial.dom.BankAccount)4