Пример #1
0
  public static MOrder createOrder(
      Properties ctx,
      int bPartnerId,
      boolean isSotrx,
      int priceListId,
      String orderType,
      int warehouseId,
      String paymentRule,
      String trxName)
      throws OperationException {
    int terminalId = POSTerminalManager.getTerminalId(ctx);
    if (terminalId == 0) {
      throw new OperationException("NO POS Terminal!!!");
    }

    MOrder order = new MOrder(ctx, 0, trxName);
    MBPartner bPartner = new MBPartner(ctx, bPartnerId, trxName);

    if (bPartner.getPrimaryC_BPartner_Location_ID() == 0)
      throw new BPartnerNoLocationException("Business partner has no location");
    order.setAD_Org_ID(Env.getAD_Org_ID(ctx));
    // order.setC_POS_ID(terminalId);  TODO - Trifon; order.setU_POSTerminal_ID(terminalId);
    order.setBPartner(bPartner);
    order.setC_BPartner_ID(bPartner.get_ID());
    order.setC_BPartner_Location_ID(bPartner.getPrimaryC_BPartner_Location_ID());
    order.setIsSOTrx(isSotrx);

    order.setM_PriceList_ID(priceListId);

    MPriceList priceList = new MPriceList(ctx, priceListId, null);
    order.setC_Currency_ID(priceList.getC_Currency_ID());
    order.setDocAction(DocumentEngine.ACTION_Complete);
    order.setSalesRep_ID(Env.getAD_User_ID(ctx));

    if (orderType.equalsIgnoreCase(UDIOrderTypes.CREDIT_ORDER_NO_SHIPMENT.getOrderType())) {
      /**
       * because for credit orders, compiere generates shipment automatically, so we want a credit
       * order with standard doc type
       */
      order.setC_DocTypeTarget_ID(
          getDocTypeFromOrderType(ctx, UDIOrderTypes.POS_ORDER.getOrderType(), isSotrx));
      order.setOrderType(UDIOrderTypes.CREDIT_ORDER.getOrderType());
    } else {
      order.setC_DocTypeTarget_ID(getDocTypeFromOrderType(ctx, orderType, isSotrx));
      order.setOrderType(orderType);
    }

    order.setM_Warehouse_ID(warehouseId);
    order.setIsDiscountPrinted(true);
    if (paymentRule != null) order.setPaymentRule(paymentRule);

    order.setDateOrdered(new Timestamp(System.currentTimeMillis()));
    order.setInvoiceRule(MOrder.INVOICERULE_Immediate);

    PoManager.save(order);

    return order;
  }
Пример #2
0
 /**
  * Get M_PriceList_Version_ID. Set Currency
  *
  * @return plv
  */
 public int getM_PriceList_Version_ID() {
   if (m_M_PriceList_Version_ID == 0) {
     int M_PriceList_ID = p_pos.getM_PriceList_ID();
     if (m_bpartner != null && m_bpartner.getM_PriceList_ID() != 0)
       M_PriceList_ID = m_bpartner.getM_PriceList_ID();
     //
     MPriceList pl = MPriceList.get(p_ctx, M_PriceList_ID, null);
     setCurrency(Services.get(ICurrencyDAO.class).getISO_Code(p_ctx, pl.getC_Currency_ID()));
     f_name.setToolTipText(pl.getName());
     //
     MPriceListVersion plv = pl.getPriceListVersion(p_posPanel.getToday());
     if (plv != null && plv.getM_PriceList_Version_ID() != 0)
       m_M_PriceList_Version_ID = plv.getM_PriceList_Version_ID();
   }
   return m_M_PriceList_Version_ID;
 } //	getM_PriceList_Version_ID
Пример #3
0
 /** Fill Combos (Location, User) */
 private void fillCombos() {
   Vector<KeyNamePair> locationVector = new Vector<KeyNamePair>();
   if (m_bpartner != null) {
     MBPartnerLocation[] locations = m_bpartner.getLocations(false);
     for (int i = 0; i < locations.length; i++)
       locationVector.add(
           new KeyNamePair(locations[i].getC_BPartner_Location_ID(), locations[i].getName()));
   }
   DefaultComboBoxModel locationModel = new DefaultComboBoxModel(locationVector);
   f_location.setModel(locationModel);
   //
   Vector<KeyNamePair> userVector = new Vector<KeyNamePair>();
   if (m_bpartner != null) {
     MUser[] users = m_bpartner.getContacts(false);
     for (int i = 0; i < users.length; i++)
       userVector.add(new KeyNamePair(users[i].getAD_User_ID(), users[i].getName()));
   }
   DefaultComboBoxModel userModel = new DefaultComboBoxModel(userVector);
   f_user.setModel(userModel);
 } //	fillCombos
Пример #4
0
  /**
   * ************************************************************************ Set BPartner
   *
   * @param C_BPartner_ID id
   */
  public void setC_BPartner_ID(int C_BPartner_ID) {
    log.debug("PosSubCustomer.setC_BPartner_ID=" + C_BPartner_ID);
    if (C_BPartner_ID == 0) m_bpartner = null;
    else {
      m_bpartner = new MBPartner(p_ctx, C_BPartner_ID, null);
      if (m_bpartner.get_ID() == 0) m_bpartner = null;
    }

    //	Set Info
    if (m_bpartner != null) {
      f_name.setText(m_bpartner.getName());
    } else {
      f_name.setText(null);
    }
    //	Sets Currency
    m_M_PriceList_Version_ID = 0;
    getM_PriceList_Version_ID();
    // fillCombos();
    if (p_posPanel.m_order != null && m_bpartner != null)
      p_posPanel.m_order.setBPartner(
          m_bpartner); // added by ConSerTi to update the client in the request
  } //	setC_BPartner_ID
Пример #5
0
  /** Find/Set BPartner */
  private void findBPartner() {

    String query = f_name.getText();

    if (query == null || query.length() == 0) return;

    // unchanged
    if (m_bpartner != null && m_bpartner.getName().equals(query)) return;

    query = query.toUpperCase();
    //	Test Number
    boolean allNumber = true;
    boolean noNumber = true;
    char[] qq = query.toCharArray();
    for (int i = 0; i < qq.length; i++) {
      if (Character.isDigit(qq[i])) {
        noNumber = false;
        break;
      }
    }
    try {
      Integer.parseInt(query);
    } catch (Exception e) {
      allNumber = false;
    }
    String Value = query;
    String Name = (allNumber ? null : query);
    String EMail = (query.indexOf('@') != -1 ? query : null);
    String Phone = (noNumber ? null : query);
    String City = null;
    //
    // TODO: contact have been remove from rv_bpartner
    MBPartnerInfo[] results =
        MBPartnerInfo.find(p_ctx, Value, Name, /*Contact, */ null, EMail, Phone, City);

    //	Set Result
    if (results.length == 0) {
      setC_BPartner_ID(0);
    } else if (results.length == 1) {
      setC_BPartner_ID(results[0].getC_BPartner_ID());
      f_name.setText(results[0].getName());
    } else //	more than one
    {
      QueryBPartner qt = new QueryBPartner(p_posPanel);
      qt.setResults(results);
      qt.setVisible(true);
    }
  } //	findBPartner
Пример #6
0
  public Vector<Vector<Object>> getParentData(MBPartner bpartner) {
    Vector<Vector<Object>> data = new Vector<Vector<Object>>();
    Vector<Object> line = new Vector<Object>();

    List<MBPartner> students =
        new Query(
                ctx,
                MBPartner.Table_Name,
                "C_BPartner_ID <> ? AND C_BPartner_ID IN (Select C_BPartner_ID from AD_User where BPartner_Parent_ID=?)",
                null) // missing contact clauses
            .setParameters(bpartner.get_ID(), bpartner.get_ID())
            .list();

    for (MBPartner student : students) {

      studentList.put(student.getValue(), student);
      findPaymentSchedule(student);

      line.add(student.getValue());
      line.add(student.getName());
      line.add("0000"); // replace by SecureCode
      line.add("0000"); // replace by Enrollment
      line.add("0000"); // replace by Transport Code

      String whereClause =
          "AD_User_ID IN (Select AD_User_ID from AD_User where BPartner_Parent_ID=? AND C_BPartner_ID=? AND ISPAYMENTRESPONSIBLE=? )";
      MUser contact =
          new Query(ctx, MUser.Table_Name, whereClause, null)
              .setParameters(bpartner.get_ID(), student.get_ID(), true)
              .first();

      line.add(contact != null ? true : false);

      data.add(line);
      line = new Vector<Object>();
    }

    return data;
  }
Пример #7
0
  /**
   * Process. Create purchase order(s) for the resonse(s) and lines marked as Selected Winner using
   * the selected Purchase Quantity (in RfQ Line Quantity) . If a Response is marked as Selected
   * Winner, all lines are created (and Selected Winner of other responses ignored). If there is no
   * response marked as Selected Winner, the lines are used.
   *
   * @return message
   */
  protected String doIt() throws Exception {
    MRfQ rfq = new MRfQ(getCtx(), p_C_RfQ_ID, get_TrxName());
    if (rfq.get_ID() == 0) throw new IllegalArgumentException("No RfQ found");
    log.info(rfq.toString());

    //	Complete
    MRfQResponse[] responses = rfq.getResponses(true, true);
    log.config("#Responses=" + responses.length);
    if (responses.length == 0)
      throw new IllegalArgumentException("No completed RfQ Responses found");

    //	Winner for entire RfQ
    for (int i = 0; i < responses.length; i++) {
      MRfQResponse response = responses[i];
      if (!response.isSelectedWinner()) continue;
      //
      MBPartner bp = new MBPartner(getCtx(), response.getC_BPartner_ID(), get_TrxName());
      log.config("Winner=" + bp);
      MOrder order = new MOrder(getCtx(), 0, get_TrxName());
      order.setIsSOTrx(false);
      if (p_C_DocType_ID != 0) order.setC_DocTypeTarget_ID(p_C_DocType_ID);
      else order.setC_DocTypeTarget_ID();
      order.setBPartner(bp);
      order.setC_BPartner_Location_ID(response.getC_BPartner_Location_ID());
      order.setSalesRep_ID(rfq.getSalesRep_ID());
      if (response.getDateWorkComplete() != null)
        order.setDatePromised(response.getDateWorkComplete());
      else if (rfq.getDateWorkComplete() != null) order.setDatePromised(rfq.getDateWorkComplete());
      order.saveEx();
      //
      MRfQResponseLine[] lines = response.getLines(false);
      for (int j = 0; j < lines.length; j++) {
        //	Respones Line
        MRfQResponseLine line = lines[j];
        if (!line.isActive()) continue;
        MRfQResponseLineQty[] qtys = line.getQtys(false);
        //	Response Line Qty
        for (int k = 0; k < qtys.length; k++) {
          MRfQResponseLineQty qty = qtys[k];
          //	Create PO Lline for all Purchase Line Qtys
          if (qty.getRfQLineQty().isActive() && qty.getRfQLineQty().isPurchaseQty()) {
            MOrderLine ol = new MOrderLine(order);
            ol.setM_Product_ID(
                line.getRfQLine().getM_Product_ID(), qty.getRfQLineQty().getC_UOM_ID());
            ol.setDescription(line.getDescription());
            ol.setQty(qty.getRfQLineQty().getQty());
            BigDecimal price = qty.getNetAmt();
            ol.setPrice();
            ol.setPrice(price);
            ol.saveEx();
          }
        }
      }
      response.setC_Order_ID(order.getC_Order_ID());
      response.saveEx();
      return order.getDocumentNo();
    }

    //	Selected Winner on Line Level
    int noOrders = 0;
    for (int i = 0; i < responses.length; i++) {
      MRfQResponse response = responses[i];
      MBPartner bp = null;
      MOrder order = null;
      //	For all Response Lines
      MRfQResponseLine[] lines = response.getLines(false);
      for (int j = 0; j < lines.length; j++) {
        MRfQResponseLine line = lines[j];
        if (!line.isActive() || !line.isSelectedWinner()) continue;
        //	New/different BP
        if (bp == null || bp.getC_BPartner_ID() != response.getC_BPartner_ID()) {
          bp = new MBPartner(getCtx(), response.getC_BPartner_ID(), get_TrxName());
          order = null;
        }
        log.config("Line=" + line + ", Winner=" + bp);
        //	New Order
        if (order == null) {
          order = new MOrder(getCtx(), 0, get_TrxName());
          order.setIsSOTrx(false);
          order.setC_DocTypeTarget_ID();
          order.setBPartner(bp);
          order.setC_BPartner_Location_ID(response.getC_BPartner_Location_ID());
          order.setSalesRep_ID(rfq.getSalesRep_ID());
          order.saveEx();
          noOrders++;
          addLog(0, null, null, order.getDocumentNo());
        }
        //	For all Qtys
        MRfQResponseLineQty[] qtys = line.getQtys(false);
        for (int k = 0; k < qtys.length; k++) {
          MRfQResponseLineQty qty = qtys[k];
          if (qty.getRfQLineQty().isActive() && qty.getRfQLineQty().isPurchaseQty()) {
            MOrderLine ol = new MOrderLine(order);
            ol.setM_Product_ID(
                line.getRfQLine().getM_Product_ID(), qty.getRfQLineQty().getC_UOM_ID());
            ol.setDescription(line.getDescription());
            ol.setQty(qty.getRfQLineQty().getQty());
            BigDecimal price = qty.getNetAmt();
            ol.setPrice();
            ol.setPrice(price);
            ol.saveEx();
          }
        } //	for all Qtys
      } //	for all Response Lines
      if (order != null) {
        response.setC_Order_ID(order.getC_Order_ID());
        response.saveEx();
      }
    }

    return "#" + noOrders;
  } //	doIt
Пример #8
0
  public boolean completePayments(int docType_ID, String documentNo, Timestamp trxDate) {
    boolean success = false;

    message_error = "No se pudo completar los pagos";

    try {

      success = validatePayments();

      // create header

      caPayment = new X_CA_Payment(ctx, 0, null);
      caPayment.setC_BPartner_ID(m_bpartner.get_ID());
      caPayment.setDocumentNo(documentNo);
      caPayment.setC_DocType_ID(docType_ID);
      caPayment.setDateTrx(trxDate);
      caPayment.saveEx();

      // save lines

      // buscar tabla de prioridades
      // List<X_CA_PaymentPreference> priorities = new Query(ctx, X_CA_PaymentPreference.Table_Name,
      // "", null)
      // .setOnlyActiveRecords(true).setOrderBy("SeqNo").list();

      for (int tableRow = 0; tableRow <= paymentTable.getRowCount() - 1; tableRow++) {

        String type = getComboValue(tableRow, 0);

        if (!"AN".equals(type) && !"ME".equals(type))
          throw new AdempiereException("Indicar tipo de pago (Anual/Mensual)");

        String paymentType = getComboValue(tableRow, 1);
        String card = getComboValue(tableRow, 2);
        java.lang.Number quote = (java.lang.Number) paymentTable.getValueAt(tableRow, 3);
        Boolean hasinteres = (Boolean) paymentTable.getValueAt(tableRow, 4);
        String account = getComboValue(tableRow, 5);
        String reference = (String) paymentTable.getValueAt(tableRow, 6);
        java.lang.Number amount = (java.lang.Number) paymentTable.getValueAt(tableRow, 7);

        for (int studentRow = 0; studentRow <= studentTable.getRowCount() - 1; studentRow++) {

          String value = (String) studentTable.getValueAt(studentRow, INDEX_VALUE);
          I_C_BPartner student = studentList.get(value);
          Boolean doPay = (Boolean) studentTable.getValueAt(studentRow, 5);

          if (doPay) {
            MTimeExpenseLine currentSchedule = null;

            for (MTimeExpenseLine schedule : paymentSchedules) {
              if (schedule.getC_BPartner_ID() == student.getC_BPartner_ID()) {
                currentSchedule = schedule;
              }
            }

            if (currentSchedule == null) throw new AdempiereException("No existe programa de Pago");

            // generar nuevo pago
            MPayment payment = new MPayment(ctx, 0, null);

            payment.set_ValueOfColumn("CA_Payment_ID", caPayment.get_ID());
            payment.setC_DocType_ID(1000008); // pago, que siempre no, que es cobro
            payment.setC_BankAccount_ID(Integer.parseInt(account));

            payment.set_ValueOfColumn("SalesRep_ID", Env.getContextAsInt(ctx, "#AD_User_ID"));

            payment.setTenderType(paymentType);

            if ("K".equals(paymentType)
                || "Q".equals(paymentType)) // cheque nacional - internacional
            {
              payment.setCheckNo(reference);
            } else if ("A".equals(paymentType)) // Depósito directo
            {
              payment.setAccountNo(reference);
            } else if ("C".equals(paymentType)) // Tarjeta de Crédito
            {
              payment.setCreditCardType(card);
              payment.setCreditCardNumber(reference);
              payment.set_ValueOfColumn("NumberOfShares", new BigDecimal(String.valueOf(quote)));
              payment.set_ValueOfColumn("HasInterests", hasinteres);
            }

            payment.setC_BPartner_ID(student.getC_BPartner_ID());

            payment.setPayAmt(new BigDecimal(String.valueOf(getAmount(currentSchedule, type))));
            payment.setC_Order_ID(currentSchedule.get_ID());
            payment.setC_Currency_ID(100); // USD

            if (payment.getPayAmt().compareTo(new BigDecimal("0")) > 0) {
              payment.saveEx();
              payment.processIt(DocAction.ACTION_Complete);
            }
          }
        }
      }

      success = true;
    } catch (Exception e) {
      success = false;
      e.printStackTrace();
      message_error = e.getMessage();
    }

    return success;
  }
Пример #9
0
 /**
  * Get BPartner
  *
  * @return C_BPartner_ID
  */
 public int getC_BPartner_ID() {
   if (m_bpartner != null) return m_bpartner.getC_BPartner_ID();
   return 0;
 } //	getC_BPartner_ID
Пример #10
0
  /**
   * Perform process.
   *
   * @return Message (clear text)
   * @throws Exception if not successful
   */
  protected String doIt() throws java.lang.Exception {
    StringBuffer sql =
        new StringBuffer(
            "SELECT * "
                + "FROM S_TimeExpense e "
                + "WHERE e.Processed='Y'"
                + " AND e.AD_Client_ID=?"); //	#1
    if (m_C_BPartner_ID != 0) sql.append(" AND e.C_BPartner_ID=?"); // 	#2
    if (m_DateFrom != null) sql.append(" AND e.DateReport >= ?"); // 	#3
    if (m_DateTo != null) sql.append(" AND e.DateReport <= ?"); // 	#4
    sql.append(
        " AND EXISTS (SELECT * FROM S_TimeExpenseLine el "
            + "WHERE e.S_TimeExpense_ID=el.S_TimeExpense_ID"
            + " AND el.C_InvoiceLine_ID IS NULL"
            + " AND el.ConvertedAmt<>0) "
            + "ORDER BY e.C_BPartner_ID, e.S_TimeExpense_ID");
    //
    int old_BPartner_ID = -1;
    MInvoice invoice = null;
    //
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
      int par = 1;
      pstmt.setInt(par++, getAD_Client_ID());
      if (m_C_BPartner_ID != 0) pstmt.setInt(par++, m_C_BPartner_ID);
      if (m_DateFrom != null) pstmt.setTimestamp(par++, m_DateFrom);
      if (m_DateTo != null) pstmt.setTimestamp(par++, m_DateTo);
      rs = pstmt.executeQuery();
      while (rs.next()) // 	********* Expense Line Loop
      {
        MTimeExpense te = new MTimeExpense(getCtx(), rs, get_TrxName());

        //	New BPartner - New Order
        if (te.getC_BPartner_ID() != old_BPartner_ID) {
          completeInvoice(invoice);
          MBPartner bp = new MBPartner(getCtx(), te.getC_BPartner_ID(), get_TrxName());
          //
          log.info("New Invoice for " + bp);
          invoice = new MInvoice(getCtx(), 0, null);
          invoice.setClientOrg(te.getAD_Client_ID(), te.getAD_Org_ID());
          invoice.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APInvoice); // 	API
          invoice.setDocumentNo(te.getDocumentNo());
          //
          invoice.setBPartner(bp);
          if (invoice.getC_BPartner_Location_ID() == 0) {
            log.log(Level.SEVERE, "No BP Location: " + bp);
            addLog(
                0,
                te.getDateReport(),
                null,
                "No Location: " + te.getDocumentNo() + " " + bp.getName());
            invoice = null;
            break;
          }
          invoice.setM_PriceList_ID(te.getM_PriceList_ID());
          invoice.setSalesRep_ID(te.getDoc_User_ID());
          String descr =
              Msg.translate(getCtx(), "S_TimeExpense_ID")
                  + ": "
                  + te.getDocumentNo()
                  + " "
                  + DisplayType.getDateFormat(DisplayType.Date).format(te.getDateReport());
          invoice.setDescription(descr);
          if (!invoice.save()) new IllegalStateException("Cannot save Invoice");
          old_BPartner_ID = bp.getC_BPartner_ID();
        }
        MTimeExpenseLine[] tel = te.getLines(false);
        for (int i = 0; i < tel.length; i++) {
          MTimeExpenseLine line = tel[i];

          //	Already Invoiced or nothing to be reimbursed
          if (line.getC_InvoiceLine_ID() != 0
              || Env.ZERO.compareTo(line.getQtyReimbursed()) == 0
              || Env.ZERO.compareTo(line.getPriceReimbursed()) == 0) continue;

          //	Update Header info
          if (line.getC_Activity_ID() != 0 && line.getC_Activity_ID() != invoice.getC_Activity_ID())
            invoice.setC_Activity_ID(line.getC_Activity_ID());
          if (line.getC_Campaign_ID() != 0 && line.getC_Campaign_ID() != invoice.getC_Campaign_ID())
            invoice.setC_Campaign_ID(line.getC_Campaign_ID());
          if (line.getC_Project_ID() != 0 && line.getC_Project_ID() != invoice.getC_Project_ID())
            invoice.setC_Project_ID(line.getC_Project_ID());
          if (!invoice.save()) new IllegalStateException("Cannot save Invoice");

          //	Create OrderLine
          MInvoiceLine il = new MInvoiceLine(invoice);
          //
          if (line.getM_Product_ID() != 0) il.setM_Product_ID(line.getM_Product_ID(), true);
          il.setQty(line.getQtyReimbursed()); // 	Entered/Invoiced
          il.setDescription(line.getDescription());
          //
          il.setC_Project_ID(line.getC_Project_ID());
          il.setC_ProjectPhase_ID(line.getC_ProjectPhase_ID());
          il.setC_ProjectTask_ID(line.getC_ProjectTask_ID());
          il.setC_Activity_ID(line.getC_Activity_ID());
          il.setC_Campaign_ID(line.getC_Campaign_ID());
          //
          //	il.setPrice();	//	not really a list/limit price for reimbursements
          il.setPrice(line.getPriceReimbursed()); //
          il.setTax();
          if (!il.save()) new IllegalStateException("Cannot save Invoice Line");
          //	Update TEL
          line.setC_InvoiceLine_ID(il.getC_InvoiceLine_ID());
          line.saveEx();
        } //	for all expense lines
      } //	********* Expense Line Loop
    } catch (Exception e) {
      log.log(Level.SEVERE, sql.toString(), e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }
    completeInvoice(invoice);
    return "@Created@=" + m_noInvoices;
  } //	doIt
Пример #11
0
  public static CreditCheckBean checkBPartnerCreditLimit(
      Properties ctx, int bPartnerId, int orderId, String trxName) {
    MBPartner bp = new MBPartner(ctx, bPartnerId, trxName);
    String m_processMsg = null;

    MOrder order = new MOrder(ctx, orderId, trxName);
    CreditCheckBean bean = new CreditCheckBean();

    boolean valid = true;

    if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus())) {
      valid = false;

      m_processMsg =
          "BPartnerCreditStop - TotalOpenBalance= "
              + bp.getTotalOpenBalance()
              + ", CreditLimit= "
              + bp.getSO_CreditLimit();
    }
    if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus())) {
      valid = false;

      m_processMsg =
          "BPartnerCreditHold - TotalOpenBalance= "
              + bp.getTotalOpenBalance()
              + ", CreditLimit= "
              + bp.getSO_CreditLimit();
    }

    BigDecimal grandTotal =
        MConversionRate.convertBase(
            ctx,
            order.getGrandTotal(),
            order.getC_Currency_ID(),
            order.getDateOrdered(),
            order.getC_ConversionType_ID(),
            Env.getAD_Client_ID(ctx),
            Env.getAD_Org_ID(ctx));

    if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(grandTotal))) {
      valid = false;

      m_processMsg =
          "BPartnerOverCreditHold - TotalOpenBalance= "
              + bp.getTotalOpenBalance()
              + ", GrandTotal = "
              + order.getGrandTotal()
              + ", CreditLimit= "
              + bp.getSO_CreditLimit();
    }

    if (MBPartner.SOCREDITSTATUS_NoCreditCheck.equals(bp.getSOCreditStatus())) {
      valid = true;

      m_processMsg =
          "BPartnerCreditHold - TotalOpenBalance= "
              + bp.getTotalOpenBalance()
              + ", CreditLimit= "
              + bp.getSO_CreditLimit();
    }

    if (MBPartner.SOCREDITSTATUS_NoCreditCheck.equals(
        bp.getSOCreditStatus(order.getGrandTotal()))) {
      valid = true;

      m_processMsg =
          "BPartnerOverCreditHold - TotalOpenBalance= "
              + bp.getTotalOpenBalance()
              + ", GrandTotal = "
              + order.getGrandTotal()
              + ", CreditLimit= "
              + bp.getSO_CreditLimit();
    }
    bean.setValid(valid);
    bean.setMsg(m_processMsg);
    return bean;
  }