use of com.axelor.apps.account.db.PaymentSchedule in project axelor-open-suite by axelor.
the class PaymentScheduleController method cancel.
// Cancel button
public void cancel(ActionRequest request, ActionResponse response) {
PaymentSchedule paymentSchedule = request.getContext().asType(PaymentSchedule.class);
paymentSchedule = Beans.get(PaymentScheduleRepository.class).find(paymentSchedule.getId());
try {
Beans.get(PaymentScheduleService.class).toCancelPaymentSchedule(paymentSchedule);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.account.db.PaymentSchedule in project axelor-open-suite by axelor.
the class BatchBankPaymentServiceImpl method createBankOrders.
@Transactional(rollbackOn = { Exception.class })
protected void createBankOrders(Batch batch, Collection<PaymentScheduleLine> paymentScheduleLines) throws AxelorException, JAXBException, IOException, DatatypeConfigurationException {
for (PaymentScheduleLine paymentScheduleLine : paymentScheduleLines) {
PaymentSchedule paymentSchedule = paymentScheduleLine.getPaymentSchedule();
MoveLine creditMoveLine = paymentScheduleLine.getAdvanceMoveLine();
for (Invoice invoice : paymentSchedule.getInvoiceSet()) {
MoveLine debitMoveLine = moveService.getMoveLineService().getDebitCustomerMoveLine(invoice);
Reconcile reconcile = reconcileRepo.findByMoveLines(debitMoveLine, creditMoveLine);
if (reconcile == null) {
continue;
}
createBankOrders(batch, reconcile);
}
}
}
use of com.axelor.apps.account.db.PaymentSchedule in project axelor-open-suite by axelor.
the class PaymentScheduleLineBankPaymentServiceImpl method reject.
@Override
@Transactional(rollbackOn = { Exception.class })
public void reject(PaymentScheduleLine paymentScheduleLine, InterbankCodeLine rejectionReason, boolean represent) throws AxelorException {
Preconditions.checkNotNull(paymentScheduleLine, I18n.get("Payment schedule line cannot be null."));
PaymentSchedule paymentSchedule = paymentScheduleLine.getPaymentSchedule();
Preconditions.checkNotNull(paymentSchedule, I18n.get("Parent payment schedule cannot be null."));
if (paymentScheduleLine.getStatusSelect() != PaymentScheduleLineRepository.STATUS_VALIDATED) {
throw new AxelorException(paymentScheduleLine, TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get("Only validated payment schedule lines can be rejected."));
}
Move rejectionMove = createRejectionMove(paymentScheduleLine);
if (paymentSchedule.getTypeSelect() == PaymentScheduleRepository.TYPE_TERMS) {
cancelInvoicePayments(paymentScheduleLine);
}
if (represent) {
representPaymentScheduleLine(paymentScheduleLine);
}
if (rejectionReason == null) {
rejectionReason = getDefaultRejectionReason();
}
MoveLine rejectionMoveLine = moveService.findMoveLineByAccount(rejectionMove, paymentScheduleLine.getAdvanceMoveLine().getAccount());
paymentScheduleLine.setInterbankCodeLine(rejectionReason);
paymentScheduleLine.setRejectMoveLine(rejectionMoveLine);
paymentScheduleLine.setRejectDate(rejectionMove.getDate());
paymentScheduleLine.setAmountRejected(paymentScheduleLine.getRejectMoveLine().getDebit());
paymentScheduleLine.setRejectedOk(true);
paymentScheduleLine.setStatusSelect(PaymentScheduleLineRepository.STATUS_CLOSED);
}
use of com.axelor.apps.account.db.PaymentSchedule in project axelor-open-suite by axelor.
the class PaymentScheduleController method fillCompanyBankDetails.
/**
* Called on partner, company or payment mode change. Fill the bank details with a default value.
*
* @param request
* @param response
* @throws AxelorException
*/
public void fillCompanyBankDetails(ActionRequest request, ActionResponse response) throws AxelorException {
PaymentSchedule paymentSchedule = request.getContext().asType(PaymentSchedule.class);
PaymentMode paymentMode = paymentSchedule.getPaymentMode();
Company company = paymentSchedule.getCompany();
Partner partner = paymentSchedule.getPartner();
if (company == null) {
return;
}
if (partner != null) {
partner = Beans.get(PartnerRepository.class).find(partner.getId());
}
BankDetails defaultBankDetails = Beans.get(BankDetailsService.class).getDefaultCompanyBankDetails(company, paymentMode, partner, null);
response.setValue("companyBankDetails", defaultBankDetails);
}
use of com.axelor.apps.account.db.PaymentSchedule in project axelor-open-suite by axelor.
the class PaymentScheduleController method notPassInIrrecoverable.
public void notPassInIrrecoverable(ActionRequest request, ActionResponse response) {
PaymentSchedule paymentSchedule = request.getContext().asType(PaymentSchedule.class);
paymentSchedule = Beans.get(PaymentScheduleRepository.class).find(paymentSchedule.getId());
try {
Beans.get(IrrecoverableService.class).notPassInIrrecoverable(paymentSchedule);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations