use of org.estatio.module.charge.dom.Charge in project estatio by estatio.
the class CodaMappingImport method handleRow.
@Override
public void handleRow(final CodaMappingImport previousRow) {
atPath = atPath == null && previousRow != null ? previousRow.atPath : atPath;
if (codaElementName == null) {
String.format("");
}
if ((documentType != null || incomingInvoiceType != null) && chargeName != null) {
IncomingInvoiceType incomingInvoiceTypeEnum = IncomingInvoiceType.valueOf(incomingInvoiceType);
DocumentType documentTypeEnum = incomingInvoiceTypeEnum == null ? DocumentType.valueOf(documentType) : DocumentType.INVOICE_IN;
CodaElementLevel codaElementLevelEnum = CodaElementLevel.valueOf(codaElementLevel);
CodaElement codaElement = codaElementRepository.findOrCreate(codaElementLevelEnum, codaElementCode, codaElementName);
Charge charge = chargeRepository.findOrCreate(atPath, chargeReference != null ? chargeReference : chargeNameToReference(chargeName), chargeName, "", Applicability.INCOMING);
final LocalDateInterval interval = period == null ? new LocalDateInterval() : PeriodUtil.yearFromPeriod(period);
final CodaTransactionType codaTransactionType = valueOfElseDefault(transactionType, CodaTransactionType.STAT);
codaMappingRepository.findOrCreate(atPath, documentTypeEnum, incomingInvoiceTypeEnum, codaTransactionType, charge, propertyFullyOwned(propertyOwnershipType), interval.startDate(), interval.endDate(), startDate, endDate, codaElement);
}
}
use of org.estatio.module.charge.dom.Charge in project estatio by estatio.
the class CapexChargeHierarchyXlsxFixture method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
Charge before = chargeRepository.findByReference("WORKS");
List<Charge> beforeAll = chargeRepository.listAll();
setExcelResource(Resources.getResource(getClass(), "CapexChargeHierarchy.xlsx"));
setMatcher(sheetName -> {
if (sheetName.startsWith("ChargeHierarchy")) {
return new WorksheetSpec(rowFactoryFor(IncomingChargeHandler.class, executionContext), sheetName, Mode.STRICT);
} else {
return null;
}
});
super.execute(executionContext);
Charge after = chargeRepository.findByReference("WORKS");
List<Charge> afterAll = chargeRepository.listAll();
}
use of org.estatio.module.charge.dom.Charge in project estatio by estatio.
the class InvoiceAttributesVM method getChargeDescriptions.
@Programmatic
public String getChargeDescriptions() {
final StringBuilder buf = new StringBuilder();
SortedSet<InvoiceItem> invoiceItems = invoice.getItems();
Set<String> descriptions = FluentIterable.from(invoiceItems).transform(x -> {
Charge charge = x.getCharge();
return charge != null ? charge.getDescription() : null;
}).filter(Objects::nonNull).toSortedSet(Ordering.natural());
final List<String> items = Lists.newArrayList(descriptions);
final int numItems = items.size();
for (int i = 0; i < numItems; i++) {
buf.append(items.get(i));
if (i == numItems - 2) {
buf.append(" e ");
} else if (i != numItems - 1) {
buf.append(", ");
}
}
return buf.toString();
}
use of org.estatio.module.charge.dom.Charge in project estatio by estatio.
the class LeaseTermImportAbstract method initLeaseItem.
protected LeaseItem initLeaseItem() {
// find or create leaseItem
final Lease lease = fetchLease(getLeaseReference());
final ApplicationTenancy leaseItemApplicationTenancy = ObjectUtils.firstNonNull(securityApplicationTenancyRepository.findByPath(getLeaseItemAtPath()), lease.getApplicationTenancy());
final Charge charge = fetchCharge(getItemChargeReference());
final LeaseItemType itemType = fetchLeaseItemType(getItemTypeName());
LeaseItem item = lease.findItem(itemType, getItemStartDate(), getItemSequence());
if (item == null) {
item = lease.newItem(itemType, LeaseAgreementRoleTypeEnum.LANDLORD, charge, InvoicingFrequency.valueOf(getItemInvoicingFrequency()), PaymentMethod.valueOf(getItemPaymentMethod()), getItemStartDate());
item.setSequence(getItemSequence());
}
item.setEpochDate(getItemEpochDate());
item.setNextDueDate(getItemNextDueDate());
final LeaseItemStatus leaseItemStatus = LeaseItemStatus.valueOfElse(getItemStatus(), LeaseItemStatus.ACTIVE);
item.setStatus(leaseItemStatus);
// Find source item and create source link
if (getSourceItemTypeName() != null) {
final LeaseItemType sourceItemType = LeaseItemType.valueOf(sourceItemTypeName);
LeaseItem sourceItem = item.getLease().findItem(sourceItemType, sourceItemStartDate, sourceItemSequence);
if (sourceItem != null) {
item.findOrCreateSourceItem(sourceItem);
}
}
return item;
}
use of org.estatio.module.charge.dom.Charge in project estatio by estatio.
the class LeaseItemImport method importItem.
@Programmatic
public LeaseItem importItem(boolean updateExisting) {
final Lease lease = fetchLease(leaseReference);
final Charge charge = fetchCharge(chargeReference);
final LeaseItemType itemType = fetchLeaseItemType(itemTypeName);
// for deposit items the start date defaults to the start date of the lease
LocalDate startDateOrDefault;
if (itemType == LeaseItemType.DEPOSIT) {
startDateOrDefault = ObjectUtils.firstNonNull(startDate, lease.getStartDate());
} else {
startDateOrDefault = startDate;
}
LeaseItem item = lease.findItem(itemType, startDateOrDefault, sequence);
if (item == null) {
item = lease.newItem(itemType, LeaseAgreementRoleTypeEnum.LANDLORD, charge, InvoicingFrequency.valueOf(invoicingFrequency), PaymentMethod.valueOf(paymentMethod), startDateOrDefault);
item.setSequence(sequence);
}
if (updateExisting) {
item.setApplicationTenancyPath(atPath);
item.setEpochDate(epochDate);
item.setNextDueDate(nextDueDate);
item.setStatus(LeaseItemStatus.valueOfElse(status, LeaseItemStatus.ACTIVE));
}
return item;
}
Aggregations