/**
   * Descripción de Método
   *
   * @param C_Invoice_ID
   */
  private void loadInvoice(int C_Invoice_ID) {
    log.config("C_Invoice_ID=" + C_Invoice_ID);
    if (C_Invoice_ID > 0) {
      m_invoice = new MInvoice(Env.getCtx(), C_Invoice_ID, null); // save
      // Se carga la EC de la factura.
      if (bPartnerField != null) {
        bPartnerField.setValue(m_invoice.getC_BPartner_ID());
      }
    }
    p_order = null;

    List<InvoiceLine> data = new ArrayList<InvoiceLine>();

    StringBuffer sql = new StringBuffer();
    sql.append("SELECT ") // Entered UOM
        .append("l.C_InvoiceLine_ID, ")
        .append("l.Line, ")
        .append("l.Description, ")
        .append("l.M_Product_ID, ")
        .append("p.Name AS ProductName, ")
        .append("l.C_UOM_ID, ")
        .append("QtyInvoiced, ")
        .append("l.QtyInvoiced-SUM(NVL(mi.Qty,0)) AS RemainingQty, ")
        .append("l.QtyEntered/l.QtyInvoiced AS Multiplier, ")
        .append("COALESCE(l.C_OrderLine_ID,0) AS C_OrderLine_ID ")
        .append("FROM C_UOM uom, C_InvoiceLine l, M_Product p, M_MatchInv mi ")
        .append("WHERE l.C_UOM_ID=uom.C_UOM_ID ")
        .append("AND l.M_Product_ID=p.M_Product_ID ")
        .append("AND l.C_InvoiceLine_ID=mi.C_InvoiceLine_ID(+) ")
        .append("AND l.C_Invoice_ID=? ")
        .append(
            "GROUP BY l.QtyInvoiced, l.QtyEntered/l.QtyInvoiced, l.C_UOM_ID, l.M_Product_ID, p.Name, l.C_InvoiceLine_ID, l.Line, l.C_OrderLine_ID, l.Description ")
        .append("ORDER BY l.Line ");

    PreparedStatement pstmt = null;
    ResultSet rs = null;

    try {
      pstmt = DB.prepareStatement(sql.toString());
      pstmt.setInt(1, C_Invoice_ID);
      rs = pstmt.executeQuery();

      while (rs.next()) {
        InvoiceLine invoiceLine = new InvoiceLine();

        // Por defecto no está seleccionada para ser procesada
        invoiceLine.selected = false;

        // ID de la línea de factura
        invoiceLine.invoiceLineID = rs.getInt("C_InvoiceLine_ID");

        // Nro de línea
        invoiceLine.lineNo = rs.getInt("Line");

        // Descripción
        invoiceLine.description = rs.getString("Description");

        // Cantidades
        BigDecimal multiplier = rs.getBigDecimal("Multiplier");
        BigDecimal qtyInvoiced = rs.getBigDecimal("QtyInvoiced").multiply(multiplier);
        BigDecimal remainingQty = rs.getBigDecimal("RemainingQty").multiply(multiplier);
        invoiceLine.lineQty = qtyInvoiced;
        invoiceLine.remainingQty = remainingQty;

        // Artículo
        invoiceLine.productID = rs.getInt("M_Product_ID");
        invoiceLine.productName = rs.getString("ProductName");

        // Unidad de Medida
        invoiceLine.uomID = rs.getInt("C_UOM_ID");
        invoiceLine.uomName = getUOMName(invoiceLine.uomID);

        // Línea de pedido (puede ser 0)
        invoiceLine.orderLineID = rs.getInt("C_OrderLine_ID");

        // Agrega la línea a la lista solo si tiene cantidad pendiente
        if (invoiceLine.remainingQty.compareTo(BigDecimal.ZERO) > 0) {
          data.add(invoiceLine);
        }
      }

    } catch (SQLException e) {
      log.log(Level.SEVERE, sql.toString(), e);
    } finally {
      try {
        if (rs != null) rs.close();
        if (pstmt != null) pstmt.close();
      } catch (Exception e) {
      }
    }

    loadTable(data);
  } // loadInvoice