use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.
the class TestFixedAssetService method testGenerateAndComputeLinesUsProrataLinearFixedAssetLastLine.
@Test
public void testGenerateAndComputeLinesUsProrataLinearFixedAssetLastLine() {
FixedAsset fixedAsset = generateAndComputeLineUsProrataLinearFixedAsset();
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2027, 6, 30), new BigDecimal("7331.32"), new BigDecimal("102638.35"), new BigDecimal("0.00")), fixedAsset.getFixedAssetLineList().get(7));
}
use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.
the class TestFixedAssetService method testGenerateAndComputeLinesUsProrataLinearFixedAssetFourthLine.
@Test
public void testGenerateAndComputeLinesUsProrataLinearFixedAssetFourthLine() {
FixedAsset fixedAsset = generateAndComputeLineUsProrataLinearFixedAsset();
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2023, 12, 31), new BigDecimal("14662.62"), new BigDecimal("51319.17"), new BigDecimal("51319.18")), fixedAsset.getFixedAssetLineList().get(3));
}
use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.
the class TestFixedAssetService method testGenerateAndComputeLinesProrataDegressiveFixedAssetFirstLine.
@Test
public void testGenerateAndComputeLinesProrataDegressiveFixedAssetFirstLine() {
FixedAsset fixedAsset = generateAndComputeLinesProrataDegressiveFixedAsset();
assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2021, 12, 31), new BigDecimal("16495.45"), new BigDecimal("16495.45"), new BigDecimal("86142.90")), fixedAsset.getFixedAssetLineList().get(0));
}
use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.
the class FixedAssetController method validate.
public void validate(ActionRequest request, ActionResponse response) {
FixedAsset fixedAsset = Beans.get(FixedAssetRepository.class).find(request.getContext().asType(FixedAsset.class).getId());
if (fixedAsset.getStatusSelect() == FixedAssetRepository.STATUS_DRAFT) {
try {
Beans.get(FixedAssetService.class).validate(fixedAsset);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
response.setReload(true);
}
use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.
the class FixedAssetController method disposal.
public void disposal(ActionRequest request, ActionResponse response) throws AxelorException {
Context context = request.getContext();
if (context.get("disposalDate") == null || context.get("disposalAmount") == null) {
return;
}
LocalDate disposalDate = (LocalDate) context.get("disposalDate");
BigDecimal disposalAmount = new BigDecimal(context.get("disposalAmount").toString());
Long fixedAssetId = Long.valueOf(context.get("_id").toString());
FixedAsset fixedAsset = Beans.get(FixedAssetRepository.class).find(fixedAssetId);
Beans.get(FixedAssetService.class).disposal(disposalDate, disposalAmount, fixedAsset);
response.setCanClose(true);
}
Aggregations