use of com.axelor.apps.account.db.FixedAssetLine in project axelor-open-suite by axelor.
the class TestFixedAssetLineComputationService method testComputeLastFixedAssetLineWithProrata.
@Test
public void testComputeLastFixedAssetLineWithProrata() {
FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_LINEAR, LocalDate.of(2020, 10, 4), LocalDate.of(2020, 12, 31), 5, 12, createFixedAssetCategoryFromIsProrataTemporis(true), new BigDecimal("500.00"));
FixedAssetLine previousFixedAssetLine = createFixedAssetLine(LocalDate.of(2024, 12, 31), new BigDecimal("100.00"), new BigDecimal("423.89"), new BigDecimal("76.11"));
FixedAssetLine fixedAssetLine = fixedAssetLineComputationService.computePlannedFixedAssetLine(fixedAsset, previousFixedAssetLine);
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2025, 10, 3), new BigDecimal("76.11"), new BigDecimal("500.00"), new BigDecimal("0.00")), fixedAssetLine);
}
use of com.axelor.apps.account.db.FixedAssetLine in project axelor-open-suite by axelor.
the class TestFixedAssetLineComputationService method testComputeFirstDegressiveAssetLine.
@Test
public void testComputeFirstDegressiveAssetLine() {
FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_DEGRESSIVE, new BigDecimal("1.75"), LocalDate.of(2020, 3, 31), LocalDate.of(2020, 12, 31), 5, 12, createFixedAssetCategoryFromIsProrataTemporis(true, false), new BigDecimal("20000.00"));
FixedAssetLine fixedAssetLine = fixedAssetLineComputationService.computeInitialPlannedFixedAssetLine(fixedAsset);
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2020, 12, 31), new BigDecimal("5250.00"), new BigDecimal("5250.00"), new BigDecimal("14750.00")), fixedAssetLine);
}
use of com.axelor.apps.account.db.FixedAssetLine in project axelor-open-suite by axelor.
the class TestFixedAssetLineComputationService method testComputeLastFixedAssetLineWithUsProrata.
@Test
public void testComputeLastFixedAssetLineWithUsProrata() {
FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_LINEAR, LocalDate.of(2020, 7, 1), LocalDate.of(2020, 12, 31), 7, 12, createFixedAssetCategoryFromIsProrataTemporis(true, true), new BigDecimal("102638.35"));
FixedAssetLine previousFixedAssetLine = createFixedAssetLine(LocalDate.of(2026, 12, 31), new BigDecimal("14662.62"), new BigDecimal("95307.03"), new BigDecimal("7331.32"));
FixedAssetLine fixedAssetLine = fixedAssetLineComputationService.computePlannedFixedAssetLine(fixedAsset, previousFixedAssetLine);
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2027, 6, 30), new BigDecimal("7331.32"), new BigDecimal("102638.35"), new BigDecimal("0.00")), fixedAssetLine);
}
use of com.axelor.apps.account.db.FixedAssetLine in project axelor-open-suite by axelor.
the class TestFixedAssetLineComputationService method testComputeInitialPlannedFixedAssetLineWithProrata.
@Test
public void testComputeInitialPlannedFixedAssetLineWithProrata() {
FixedAsset fixedAsset = createFixedAsset(FixedAssetRepository.COMPUTATION_METHOD_LINEAR, LocalDate.of(2020, 10, 5), LocalDate.of(2020, 12, 31), 5, 12, createFixedAssetCategoryFromIsProrataTemporis(true), new BigDecimal("500.00"));
FixedAssetLine fixedAssetLine = fixedAssetLineComputationService.computeInitialPlannedFixedAssetLine(fixedAsset);
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2020, 12, 31), new BigDecimal("23.89"), new BigDecimal("23.89"), new BigDecimal("476.11")), fixedAssetLine);
}
use of com.axelor.apps.account.db.FixedAssetLine in project axelor-open-suite by axelor.
the class FixedAssetLineController method realize.
public void realize(ActionRequest request, ActionResponse response) {
FixedAssetLine fixedAssetLine = request.getContext().asType(FixedAssetLine.class);
fixedAssetLine = Beans.get(FixedAssetLineRepository.class).find(fixedAssetLine.getId());
try {
Beans.get(FixedAssetLineMoveService.class).realize(fixedAssetLine);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations