Search in sources :

Example 1 with IrrecoverableInvoiceLine

use of com.axelor.apps.account.db.IrrecoverableInvoiceLine in project axelor-open-suite by axelor.

the class IrrecoverableService method createIrrecoverableReportLineList.

/**
 * Fonction permettant de créer une liste de ligne de reporting pour une ligne Facture
 *
 * @param iil Une ligne Facture
 * @param invoice Une facture
 * @param prorataRate Un taux de restant à payer d'une facture
 * @return
 */
public List<IrrecoverableReportLine> createIrrecoverableReportLineList(IrrecoverableInvoiceLine iil, Invoice invoice, BigDecimal prorataRate) {
    int seq = 1;
    List<IrrecoverableReportLine> irlList = new ArrayList<IrrecoverableReportLine>();
    for (InvoiceLine invoiceLine : invoice.getInvoiceLineList()) {
        irlList.add(this.createIrrecoverableReportLine(iil, invoiceLine.getName(), invoiceLine.getExTaxTotal().multiply(prorataRate).setScale(AppBaseService.DEFAULT_NB_DECIMAL_DIGITS, RoundingMode.HALF_UP), seq));
        seq++;
    }
    for (InvoiceLineTax invoiceLineTax : invoice.getInvoiceLineTaxList()) {
        irlList.add(this.createIrrecoverableReportLine(iil, invoiceLineTax.getTaxLine().getTax().getName(), invoiceLineTax.getTaxTotal().multiply(prorataRate).setScale(AppBaseService.DEFAULT_NB_DECIMAL_DIGITS, RoundingMode.HALF_UP), seq));
        seq++;
    }
    // Afin de ne pas modifier les valeurs des lignes de factures, on les recharges depuis la base
    invoiceRepo.refresh(invoice);
    return irlList;
}
Also used : InvoiceLine(com.axelor.apps.account.db.InvoiceLine) IrrecoverableInvoiceLine(com.axelor.apps.account.db.IrrecoverableInvoiceLine) ArrayList(java.util.ArrayList) IrrecoverableReportLine(com.axelor.apps.account.db.IrrecoverableReportLine) InvoiceLineTax(com.axelor.apps.account.db.InvoiceLineTax)

Example 2 with IrrecoverableInvoiceLine

use of com.axelor.apps.account.db.IrrecoverableInvoiceLine in project axelor-open-suite by axelor.

the class IrrecoverableService method createIrrecoverableInvoiceLine.

/**
 * Fonction permettant de créer une ligne Facture
 *
 * @param icl Une ligne Client
 * @param invoice Une facture
 * @param seq Un numéro de séquence
 * @return
 * @throws AxelorException
 */
public IrrecoverableInvoiceLine createIrrecoverableInvoiceLine(IrrecoverableCustomerLine icl, Invoice invoice, int seq) throws AxelorException {
    IrrecoverableInvoiceLine iil = new IrrecoverableInvoiceLine();
    iil.setInvoice(invoice);
    iil.setInvoiceLineSeq(seq);
    iil.setIrrecoverableCustomerLine(icl);
    BigDecimal prorataRate = this.getProrataRate(invoice, invoice.getRejectMoveLine() != null);
    iil.setIrrecoverableReportLineList(this.createIrrecoverableReportLineList(iil, invoice, prorataRate));
    log.debug("Ligne facture : {}", iil);
    return iil;
}
Also used : IrrecoverableInvoiceLine(com.axelor.apps.account.db.IrrecoverableInvoiceLine) BigDecimal(java.math.BigDecimal)

Example 3 with IrrecoverableInvoiceLine

use of com.axelor.apps.account.db.IrrecoverableInvoiceLine in project axelor-open-suite by axelor.

the class IrrecoverableService method createIrrecoverableInvoiceLineList.

/**
 * Fonction permettant de créer une liste de ligne Facture
 *
 * @param icl Une ligne Client
 * @param invoiceList Une liste de factures du tiers payeur
 * @return
 * @throws AxelorException
 */
public List<IrrecoverableInvoiceLine> createIrrecoverableInvoiceLineList(IrrecoverableCustomerLine icl, List<Invoice> invoiceList) throws AxelorException {
    int seq = 1;
    List<IrrecoverableInvoiceLine> iilList = new ArrayList<IrrecoverableInvoiceLine>();
    for (Invoice invoice : invoiceList) {
        iilList.add(this.createIrrecoverableInvoiceLine(icl, invoice, seq));
        seq++;
    }
    return iilList;
}
Also used : Invoice(com.axelor.apps.account.db.Invoice) ArrayList(java.util.ArrayList) IrrecoverableInvoiceLine(com.axelor.apps.account.db.IrrecoverableInvoiceLine)

Aggregations

IrrecoverableInvoiceLine (com.axelor.apps.account.db.IrrecoverableInvoiceLine)3 ArrayList (java.util.ArrayList)2 Invoice (com.axelor.apps.account.db.Invoice)1 InvoiceLine (com.axelor.apps.account.db.InvoiceLine)1 InvoiceLineTax (com.axelor.apps.account.db.InvoiceLineTax)1 IrrecoverableReportLine (com.axelor.apps.account.db.IrrecoverableReportLine)1 BigDecimal (java.math.BigDecimal)1