use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.
the class AccountingReportController method setBankDetailsDomain.
public void setBankDetailsDomain(ActionRequest request, ActionResponse response) {
try {
AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
String domain = Beans.get(AccountingReportBankPaymentService.class).createDomainForBankDetails(accountingReport);
// if nothing was found for the domain, we set it at a default value.
if (domain.equals("")) {
response.setAttr("bankDetailsSet", "domain", "self.id IN (0)");
} else {
response.setAttr("bankDetailsSet", "domain", domain);
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.
the class AccountingReportController method searchMoveLine.
/**
* @param request
* @param response
*/
public void searchMoveLine(ActionRequest request, ActionResponse response) {
AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
AccountingReportService accountingReportService = Beans.get(AccountingReportService.class);
try {
accountingReport = Beans.get(AccountingReportRepository.class).find(accountingReport.getId());
String query = accountingReportService.getMoveLineList(accountingReport);
BigDecimal debitBalance = accountingReportService.getDebitBalance();
BigDecimal creditBalance = accountingReportService.getCreditBalance();
response.setValue("totalDebit", debitBalance);
response.setValue("totalCredit", creditBalance);
response.setValue("balance", debitBalance.subtract(creditBalance));
ActionViewBuilder actionViewBuilder = ActionView.define(I18n.get(IExceptionMessage.ACCOUNTING_REPORT_3));
actionViewBuilder.model(MoveLine.class.getName());
actionViewBuilder.add("grid", "move-line-grid");
actionViewBuilder.add("form", "move-line-form");
actionViewBuilder.param("search-filters", "move-line-filters");
actionViewBuilder.domain(query);
response.setView(actionViewBuilder.map());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.
the class AccountingReportManagementRepository method copy.
@Override
public AccountingReport copy(AccountingReport entity, boolean deep) {
AccountingReport copy = super.copy(entity, deep);
copy.setRef(null);
copy.setStatusSelect(this.STATUS_DRAFT);
copy.setPublicationDateTime(null);
copy.setTotalDebit(BigDecimal.ZERO);
copy.setTotalCredit(BigDecimal.ZERO);
copy.setBalance(BigDecimal.ZERO);
return copy;
}
use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.
the class MoveLineExportServiceImpl method createAccountingReport.
@Transactional(rollbackOn = { Exception.class })
public AccountingReport createAccountingReport(Company company, int exportTypeSelect, LocalDate startDate, LocalDate endDate) throws AxelorException {
AccountingReport accountingReport = new AccountingReport();
accountingReport.setCompany(company);
accountingReport.getReportType().setTypeSelect(exportTypeSelect);
accountingReport.setDateFrom(startDate);
accountingReport.setDateTo(endDate);
accountingReport.setStatusSelect(AccountingReportRepository.STATUS_DRAFT);
accountingReport.setDate(appAccountService.getTodayDateTime().toLocalDate());
accountingReport.setRef(accountingReportService.getSequence(accountingReport));
accountingReportService.buildQuery(accountingReport);
BigDecimal debitBalance = accountingReportService.getDebitBalance();
BigDecimal creditBalance = accountingReportService.getCreditBalance();
accountingReport.setTotalDebit(debitBalance);
accountingReport.setTotalCredit(creditBalance);
accountingReport.setBalance(debitBalance.subtract(creditBalance));
accountingReportRepo.save(accountingReport);
return accountingReport;
}
use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.
the class BatchMoveLineExport method process.
@Override
protected void process() {
if (!end) {
try {
Company company = batch.getAccountingBatch().getCompany();
LocalDate startDate = batch.getAccountingBatch().getStartDate();
LocalDate endDate = batch.getAccountingBatch().getEndDate();
int exportTypeSelect = batch.getAccountingBatch().getMoveLineExportTypeSelect();
AccountingReport accountingReport = moveLineExportService.createAccountingReport(company, exportTypeSelect, startDate, endDate);
moveLineExportService.exportMoveLine(accountingReport);
JPA.clear();
accountingReport = accountingReportRepository.find(accountingReport.getId());
moveLineDone = moveLineRepo.all().filter("self.move.accountingReport = ?1", accountingReport).count();
moveDone = moveRepo.all().filter("self.accountingReport = ?1", accountingReport).count();
debit = accountingReport.getTotalDebit();
credit = accountingReport.getTotalCredit();
balance = accountingReport.getBalance();
updateAccountingReport(accountingReport);
} catch (AxelorException e) {
TraceBackService.trace(new AxelorException(e, e.getCategory(), String.format("%s", e)), ExceptionOriginRepository.MOVE_LINE_EXPORT_ORIGIN, batch.getId());
incrementAnomaly();
} catch (Exception e) {
TraceBackService.trace(new Exception(String.format("%s", e), e), ExceptionOriginRepository.MOVE_LINE_EXPORT_ORIGIN, batch.getId());
incrementAnomaly();
log.error("Bug(Anomalie) généré(e) pour le batch {}", batch.getId());
}
}
}
Aggregations