Search in sources :

Example 6 with FixedAsset

use of com.axelor.apps.account.db.FixedAsset 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);
}
Also used : FixedAssetTestTool.createFixedAssetLine(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAssetLine) FixedAssetLine(com.axelor.apps.account.db.FixedAssetLine) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) FixedAsset(com.axelor.apps.account.db.FixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 7 with FixedAsset

use of com.axelor.apps.account.db.FixedAsset 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);
}
Also used : FixedAssetTestTool.createFixedAssetLine(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAssetLine) FixedAssetLine(com.axelor.apps.account.db.FixedAssetLine) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) FixedAsset(com.axelor.apps.account.db.FixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 8 with FixedAsset

use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.

the class TestFixedAssetService method testGenerateAndComputeLinesProrataLinearFixedAssetThirdLine.

@Test
public void testGenerateAndComputeLinesProrataLinearFixedAssetThirdLine() {
    FixedAsset fixedAsset = generateAndComputeLineProrataLinearFixedAsset();
    assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2022, 12, 31), new BigDecimal("100.00"), new BigDecimal("223.89"), new BigDecimal("276.11")), fixedAsset.getFixedAssetLineList().get(2));
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 9 with FixedAsset

use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.

the class TestFixedAssetService method testGenerateAndComputeLinesUsProrataLinearFixedAssetSeventhLine.

@Test
public void testGenerateAndComputeLinesUsProrataLinearFixedAssetSeventhLine() {
    FixedAsset fixedAsset = generateAndComputeLineUsProrataLinearFixedAsset();
    assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2026, 12, 31), new BigDecimal("14662.62"), new BigDecimal("95307.03"), new BigDecimal("7331.32")), fixedAsset.getFixedAssetLineList().get(6));
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 10 with FixedAsset

use of com.axelor.apps.account.db.FixedAsset in project axelor-open-suite by axelor.

the class TestFixedAssetService method testGenerateAndComputeLinesUsProrataLinearFixedAssetThirdLine.

@Test
public void testGenerateAndComputeLinesUsProrataLinearFixedAssetThirdLine() {
    FixedAsset fixedAsset = generateAndComputeLineUsProrataLinearFixedAsset();
    assertFixedAssetLineEquals(createFixedAssetLine(LocalDate.of(2022, 12, 31), new BigDecimal("14662.62"), new BigDecimal("36656.55"), new BigDecimal("65981.80")), fixedAsset.getFixedAssetLineList().get(2));
}
Also used : FixedAsset(com.axelor.apps.account.db.FixedAsset) FixedAssetTestTool.createFixedAsset(com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

FixedAsset (com.axelor.apps.account.db.FixedAsset)65 FixedAssetTestTool.createFixedAsset (com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAsset)52 BigDecimal (java.math.BigDecimal)52 Test (org.junit.Test)47 FixedAssetLine (com.axelor.apps.account.db.FixedAssetLine)12 FixedAssetTestTool.createFixedAssetLine (com.axelor.apps.account.service.fixedasset.FixedAssetTestTool.createFixedAssetLine)10 Transactional (com.google.inject.persist.Transactional)6 AxelorException (com.axelor.exception.AxelorException)5 ArrayList (java.util.ArrayList)5 LocalDate (java.time.LocalDate)4 MoveLine (com.axelor.apps.account.db.MoveLine)3 FixedAssetRepository (com.axelor.apps.account.db.repo.FixedAssetRepository)3 FixedAssetService (com.axelor.apps.account.service.fixedasset.FixedAssetService)3 Account (com.axelor.apps.account.db.Account)2 AccountConfig (com.axelor.apps.account.db.AccountConfig)2 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)2 Journal (com.axelor.apps.account.db.Journal)2 Move (com.axelor.apps.account.db.Move)2 Company (com.axelor.apps.base.db.Company)2 Partner (com.axelor.apps.base.db.Partner)2