Search in sources :

Example 1 with InvoiceLineComparator

use of com.axelor.apps.account.util.InvoiceLineComparator in project axelor-open-suite by axelor.

the class InvoicingProjectService method populate.

public List<InvoiceLine> populate(Invoice invoice, InvoicingProject folder) throws AxelorException {
    List<SaleOrderLine> saleOrderLineList = new ArrayList<SaleOrderLine>(folder.getSaleOrderLineSet());
    List<PurchaseOrderLine> purchaseOrderLineList = new ArrayList<PurchaseOrderLine>(folder.getPurchaseOrderLineSet());
    List<TimesheetLine> timesheetLineList = new ArrayList<TimesheetLine>(folder.getLogTimesSet());
    List<ExpenseLine> expenseLineList = new ArrayList<ExpenseLine>(folder.getExpenseLineSet());
    List<ProjectTask> projectTaskList = new ArrayList<ProjectTask>(folder.getProjectTaskSet());
    List<InvoiceLine> invoiceLineList = new ArrayList<InvoiceLine>();
    invoiceLineList.addAll(this.createSaleOrderInvoiceLines(invoice, saleOrderLineList, folder.getSaleOrderLineSetPrioritySelect()));
    invoiceLineList.addAll(this.createPurchaseOrderInvoiceLines(invoice, purchaseOrderLineList, folder.getPurchaseOrderLineSetPrioritySelect()));
    invoiceLineList.addAll(timesheetService.createInvoiceLines(invoice, timesheetLineList, folder.getLogTimesSetPrioritySelect()));
    invoiceLineList.addAll(expenseService.createInvoiceLines(invoice, expenseLineList, folder.getExpenseLineSetPrioritySelect()));
    invoiceLineList.addAll(projectTaskBusinessProjectService.createInvoiceLines(invoice, projectTaskList, folder.getProjectTaskSetPrioritySelect()));
    Collections.sort(invoiceLineList, new InvoiceLineComparator());
    for (InvoiceLine invoiceLine : invoiceLineList) {
        invoiceLine.setSequence(sequence);
        sequence++;
    }
    return invoiceLineList;
}
Also used : InvoiceLineComparator(com.axelor.apps.account.util.InvoiceLineComparator) TimesheetLine(com.axelor.apps.hr.db.TimesheetLine) InvoiceLine(com.axelor.apps.account.db.InvoiceLine) ArrayList(java.util.ArrayList) SaleOrderLine(com.axelor.apps.sale.db.SaleOrderLine) PurchaseOrderLine(com.axelor.apps.purchase.db.PurchaseOrderLine) ExpenseLine(com.axelor.apps.hr.db.ExpenseLine) ProjectTask(com.axelor.apps.project.db.ProjectTask)

Aggregations

InvoiceLine (com.axelor.apps.account.db.InvoiceLine)1 InvoiceLineComparator (com.axelor.apps.account.util.InvoiceLineComparator)1 ExpenseLine (com.axelor.apps.hr.db.ExpenseLine)1 TimesheetLine (com.axelor.apps.hr.db.TimesheetLine)1 ProjectTask (com.axelor.apps.project.db.ProjectTask)1 PurchaseOrderLine (com.axelor.apps.purchase.db.PurchaseOrderLine)1 SaleOrderLine (com.axelor.apps.sale.db.SaleOrderLine)1 ArrayList (java.util.ArrayList)1