use of com.axelor.apps.account.db.TaxPaymentMoveLine in project axelor-open-suite by axelor.
the class TaxPaymentMoveLineServiceImpl method getReverseTaxPaymentMoveLine.
@Override
public TaxPaymentMoveLine getReverseTaxPaymentMoveLine(TaxPaymentMoveLine taxPaymentMoveLine) throws AxelorException {
TaxPaymentMoveLine reversetaxPaymentMoveLine = new TaxPaymentMoveLine(taxPaymentMoveLine.getMoveLine(), taxPaymentMoveLine.getOriginTaxLine(), taxPaymentMoveLine.getReconcile(), taxPaymentMoveLine.getTaxRate(), taxPaymentMoveLine.getDetailPaymentAmount().negate(), Beans.get(AppBaseService.class).getTodayDate(taxPaymentMoveLine.getReconcile().getCompany()));
reversetaxPaymentMoveLine = this.computeTaxAmount(reversetaxPaymentMoveLine);
reversetaxPaymentMoveLine.setIsAlreadyReverse(true);
taxPaymentMoveLine.setIsAlreadyReverse(true);
return reversetaxPaymentMoveLine;
}
use of com.axelor.apps.account.db.TaxPaymentMoveLine in project axelor-open-suite by axelor.
the class MoveLineServiceImpl method reverseTaxPaymentMoveLines.
@Override
@Transactional(rollbackOn = { Exception.class })
public MoveLine reverseTaxPaymentMoveLines(MoveLine customerMoveLine, Reconcile reconcile) throws AxelorException {
List<TaxPaymentMoveLine> reverseTaxPaymentMoveLines = new ArrayList<TaxPaymentMoveLine>();
for (TaxPaymentMoveLine taxPaymentMoveLine : customerMoveLine.getTaxPaymentMoveLineList()) {
if (!taxPaymentMoveLine.getIsAlreadyReverse() && taxPaymentMoveLine.getReconcile().equals(reconcile)) {
TaxPaymentMoveLine reverseTaxPaymentMoveLine = taxPaymentMoveLineService.getReverseTaxPaymentMoveLine(taxPaymentMoveLine);
reverseTaxPaymentMoveLines.add(reverseTaxPaymentMoveLine);
}
}
for (TaxPaymentMoveLine reverseTaxPaymentMoveLine : reverseTaxPaymentMoveLines) {
customerMoveLine.addTaxPaymentMoveLineListItem(reverseTaxPaymentMoveLine);
}
this.computeTaxAmount(customerMoveLine);
return Beans.get(MoveLineRepository.class).save(customerMoveLine);
}
use of com.axelor.apps.account.db.TaxPaymentMoveLine in project axelor-open-suite by axelor.
the class MoveLineServiceImpl method generateTaxPaymentMoveLineList.
@Override
@Transactional(rollbackOn = { Exception.class })
public MoveLine generateTaxPaymentMoveLineList(MoveLine customerMoveLine, Invoice invoice, Reconcile reconcile) throws AxelorException {
BigDecimal paymentAmount = reconcile.getAmount();
BigDecimal invoiceTotalAmount = invoice.getCompanyInTaxTotal();
for (InvoiceLineTax invoiceLineTax : invoice.getInvoiceLineTaxList()) {
TaxLine taxLine = invoiceLineTax.getTaxLine();
BigDecimal vatRate = taxLine.getValue();
BigDecimal baseAmount = invoiceLineTax.getCompanyExTaxBase();
BigDecimal detailPaymentAmount = baseAmount.multiply(paymentAmount).divide(invoiceTotalAmount, 6, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
TaxPaymentMoveLine taxPaymentMoveLine = new TaxPaymentMoveLine(customerMoveLine, taxLine, reconcile, vatRate, detailPaymentAmount, Beans.get(AppBaseService.class).getTodayDate(reconcile.getCompany()));
taxPaymentMoveLine = taxPaymentMoveLineService.computeTaxAmount(taxPaymentMoveLine);
customerMoveLine.addTaxPaymentMoveLineListItem(taxPaymentMoveLine);
}
this.computeTaxAmount(customerMoveLine);
return Beans.get(MoveLineRepository.class).save(customerMoveLine);
}
Aggregations