use of com.axelor.apps.hr.db.Expense in project axelor-open-suite by axelor.
the class BankOrderServiceHRImpl method cancelPayment.
@Override
@Transactional(rollbackOn = { Exception.class })
public void cancelPayment(BankOrder bankOrder) throws AxelorException {
super.cancelPayment(bankOrder);
if (!Beans.get(AppService.class).isApp("employee")) {
return;
}
List<Expense> expenseList = Beans.get(ExpenseRepository.class).all().filter("self.bankOrder.id = ?", bankOrder.getId()).fetch();
for (Expense expense : expenseList) {
if (expense != null && expense.getPaymentStatusSelect() != InvoicePaymentRepository.STATUS_CANCELED) {
expenseService.cancelPayment(expense);
}
}
}
use of com.axelor.apps.hr.db.Expense in project axelor-open-suite by axelor.
the class PayrollPreparationService method computeExpenseAmount.
public BigDecimal computeExpenseAmount(PayrollPreparation payrollPreparation) {
BigDecimal expenseAmount = BigDecimal.ZERO;
List<Expense> expenseList = Beans.get(ExpenseRepository.class).all().filter("self.user.employee = ?1 " + "AND self.statusSelect = ?2 " + "AND (self.payrollPreparation IS NULL OR self.payrollPreparation.id = ?3) " + "AND self.companyCbSelect = ?4 " + "AND self.validationDate BETWEEN ?5 AND ?6", payrollPreparation.getEmployee(), ExpenseRepository.STATUS_VALIDATED, payrollPreparation.getId(), ExpenseRepository.COMPANY_CB_PAYMENT_NO, payrollPreparation.getPeriod().getFromDate(), payrollPreparation.getPeriod().getToDate()).fetch();
for (Expense expense : expenseList) {
expenseAmount = expenseAmount.add(expense.getInTaxTotal());
payrollPreparation.addExpenseListItem(expense);
}
return expenseAmount;
}
Aggregations