Search in sources :

Example 1 with AnalyticJournal

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

the class AnalyticMoveLineServiceImpl method createAnalyticMoveLine.

public AnalyticMoveLine createAnalyticMoveLine(AnalyticDistributionLine analyticDistributionLine, BigDecimal total, int typeSelect, LocalDate date) {
    AnalyticMoveLine analyticMoveLine = new AnalyticMoveLine();
    analyticMoveLine.setOriginalPieceAmount(total);
    analyticMoveLine.setAnalyticAccount(analyticDistributionLine.getAnalyticAccount());
    analyticMoveLine.setAnalyticAxis(analyticDistributionLine.getAnalyticAxis());
    analyticMoveLine.setAnalyticJournal(analyticDistributionLine.getAnalyticJournal());
    AnalyticJournal analyticJournal = analyticDistributionLine.getAnalyticJournal();
    Company company = analyticJournal == null ? null : analyticJournal.getCompany();
    if (company != null) {
        analyticMoveLine.setCurrency(company.getCurrency());
    }
    analyticMoveLine.setDate(date);
    analyticMoveLine.setPercentage(analyticDistributionLine.getPercentage());
    analyticMoveLine.setAmount(computeAmount(analyticMoveLine));
    analyticMoveLine.setTypeSelect(typeSelect);
    return analyticMoveLine;
}
Also used : Company(com.axelor.apps.base.db.Company) AnalyticJournal(com.axelor.apps.account.db.AnalyticJournal) AnalyticMoveLine(com.axelor.apps.account.db.AnalyticMoveLine)

Aggregations

AnalyticJournal (com.axelor.apps.account.db.AnalyticJournal)1 AnalyticMoveLine (com.axelor.apps.account.db.AnalyticMoveLine)1 Company (com.axelor.apps.base.db.Company)1