use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class IrrecoverableService method notPassInIrrecoverable.
/**
* Procédure permettant d'annuler le passage en irrécouvrable d'une échéancier de lissage de
* paiement La procédure annulera aussi le passage en irrécouvrable des lignes d'écriture de rejet
* d'échéance en irrécouvrable, ainsi que des factures pas complètement payée selectionnées sur
* l'échéancier
*
* @param paymentSchedule Un échéancier de paiement
* @throws AxelorException
*/
@Transactional(rollbackOn = { Exception.class })
public void notPassInIrrecoverable(PaymentSchedule paymentSchedule) throws AxelorException {
paymentSchedule.setIrrecoverableStatusSelect(PaymentScheduleRepository.IRRECOVERABLE_STATUS_NOT_IRRECOUVRABLE);
List<MoveLine> paymentScheduleLineRejectMoveLineList = new ArrayList<MoveLine>();
for (PaymentScheduleLine paymentScheduleLine : paymentSchedule.getPaymentScheduleLineList()) {
if (paymentScheduleLine.getRejectMoveLine() != null && paymentScheduleLine.getRejectMoveLine().getAmountRemaining().compareTo(BigDecimal.ZERO) > 0) {
paymentScheduleLineRejectMoveLineList.add(paymentScheduleLine.getRejectMoveLine());
}
}
for (MoveLine moveLine : paymentScheduleLineRejectMoveLineList) {
this.notPassInIrrecoverable(moveLine, false);
}
for (Invoice invoice : paymentSchedule.getInvoiceSet()) {
this.notPassInIrrecoverable(invoice);
}
paymentScheduleRepo.save(paymentSchedule);
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class ReconcileServiceImpl method udpatePaymentTax.
protected void udpatePaymentTax(Reconcile reconcile) throws AxelorException {
Move debitMove = reconcile.getDebitMoveLine().getMove();
Move creditMove = reconcile.getCreditMoveLine().getMove();
Invoice debitInvoice = debitMove.getInvoice();
Invoice creditInvoice = creditMove.getInvoice();
if (debitInvoice != null && creditInvoice == null) {
moveLineService.generateTaxPaymentMoveLineList(reconcile.getCreditMoveLine(), debitInvoice, reconcile);
}
if (creditInvoice != null && debitInvoice == null) {
moveLineService.generateTaxPaymentMoveLineList(reconcile.getDebitMoveLine(), creditInvoice, reconcile);
}
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class ReconcileServiceImpl method reverseTaxPaymentMoveLines.
protected void reverseTaxPaymentMoveLines(Reconcile reconcile) throws AxelorException {
Move debitMove = reconcile.getDebitMoveLine().getMove();
Move creditMove = reconcile.getCreditMoveLine().getMove();
Invoice debitInvoice = debitMove.getInvoice();
Invoice creditInvoice = creditMove.getInvoice();
if (debitInvoice == null) {
moveLineService.reverseTaxPaymentMoveLines(reconcile.getDebitMoveLine(), reconcile);
}
if (creditInvoice == null) {
moveLineService.reverseTaxPaymentMoveLines(reconcile.getCreditMoveLine(), reconcile);
}
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class ReconcileServiceImpl method updateInvoicePayments.
public void updateInvoicePayments(Reconcile reconcile) throws AxelorException {
MoveLine debitMoveLine = reconcile.getDebitMoveLine();
MoveLine creditMoveLine = reconcile.getCreditMoveLine();
Move debitMove = debitMoveLine.getMove();
Move creditMove = creditMoveLine.getMove();
Invoice debitInvoice = debitMove.getInvoice();
Invoice creditInvoice = creditMove.getInvoice();
BigDecimal amount = reconcile.getAmount();
if (debitInvoice != null && debitMoveLine.getAccount().getUseForPartnerBalance() && creditMoveLine.getAccount().getUseForPartnerBalance()) {
InvoicePayment debitInvoicePayment = invoicePaymentCreateService.createInvoicePayment(debitInvoice, amount, creditMove);
debitInvoicePayment.setReconcile(reconcile);
}
if (creditInvoice != null && debitMoveLine.getAccount().getUseForPartnerBalance() && creditMoveLine.getAccount().getUseForPartnerBalance()) {
InvoicePayment creditInvoicePayment = invoicePaymentCreateService.createInvoicePayment(creditInvoice, amount, debitMove);
creditInvoicePayment.setReconcile(reconcile);
}
}
use of com.axelor.apps.account.db.Invoice in project axelor-open-suite by axelor.
the class BudgetService method getDate.
/**
* @param budgetDistribution
* @return returns an {@code Optional} because in some cases the child implementations can return
* a null value.
*/
protected Optional<LocalDate> getDate(BudgetDistribution budgetDistribution) {
Invoice invoice = budgetDistribution.getInvoiceLine().getInvoice();
LocalDate invoiceDate = invoice.getInvoiceDate();
if (invoiceDate != null) {
return Optional.of(invoiceDate);
}
return Optional.of(invoice.getValidatedDate());
}
Aggregations