Class MBPartner

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparator<Object>, I_C_BPartner, I_Persistent, Evaluatee, ImmutablePOSupport

    public class MBPartner
    extends X_C_BPartner
    implements ImmutablePOSupport
    Business Partner Model
    Version:
    $Id: MBPartner.java,v 1.5 2006/09/23 19:38:07 comdivision Exp $
    Author:
    Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
  • BF [ 1568774 ] Walk-In BP: invalid created/updated values
  • BF [ 1817752 ] MBPartner.getLocations should return only active one, Armen Rizal, GOODWILL CONSULT
  • BF [ 2041226 ] BP Open Balance should count only Completed Invoice
  • BF [ 2498949 ] BP Get Not Invoiced Shipment Value return null
  • See Also:
    Serialized Form
    • Field Detail

      • m_contacts

        protected MUser[] m_contacts
        Users
      • m_primaryC_BPartner_Location_ID

        protected Integer m_primaryC_BPartner_Location_ID
        Prim Address
      • m_primaryAD_User_ID

        protected Integer m_primaryAD_User_ID
        Prim User
      • m_group

        protected MBPGroup m_group
        BP Group
    • Constructor Detail

      • MBPartner

        public MBPartner​(Properties ctx)
        Constructor for new BPartner from Template
        Parameters:
        ctx - context
      • MBPartner

        public MBPartner​(Properties ctx,
                         ResultSet rs,
                         String trxName)
        Default Constructor
        Parameters:
        ctx - context
        rs - ResultSet to load from
        trxName - transaction
      • MBPartner

        public MBPartner​(Properties ctx,
                         int C_BPartner_ID,
                         String trxName)
        Default Constructor
        Parameters:
        ctx - context
        C_BPartner_ID - partner or 0 or -1 (load from template)
        trxName - transaction
      • MBPartner

        public MBPartner​(X_I_BPartner impBP)
        Import Constructor
        Parameters:
        impBP - import
      • MBPartner

        public MBPartner​(MBPartner copy)
        Parameters:
        copy -
    • Method Detail

      • getTemplate

        public static MBPartner getTemplate​(Properties ctx,
                                            int AD_Client_ID)
        Get Empty Template Business Partner
        Parameters:
        ctx - context
        AD_Client_ID - client
        Returns:
        Template Business Partner or null
      • getBPartnerCashTrx

        public static MBPartner getBPartnerCashTrx​(Properties ctx,
                                                   int AD_Client_ID)
        Get Cash Trx Business Partner
        Parameters:
        ctx - context
        AD_Client_ID - client
        Returns:
        Cash Trx Business Partner or null
      • get

        public static MBPartner get​(Properties ctx,
                                    String Value)
        Get BPartner with Value
        Parameters:
        ctx - context
        Value - value
        Returns:
        BPartner or null
      • get

        public static MBPartner get​(Properties ctx,
                                    String Value,
                                    String trxName)
        Get BPartner with Value in a transaction
        Parameters:
        ctx - context
        Value - value
        trxName - transaction
        Returns:
        BPartner or null
      • getFirstWithTaxID

        public static MBPartner getFirstWithTaxID​(Properties ctx,
                                                  String taxID,
                                                  String trxName)
        Get BPartner with taxID in a transaction
        Parameters:
        ctx - context
        taxID - taxID
        trxName - transaction
        Returns:
        BPartner or null
      • get

        public static MBPartner get​(Properties ctx,
                                    int C_BPartner_ID)
        Get BPartner with Value
        Parameters:
        ctx - context
        C_BPartner_ID -
        Returns:
        BPartner or null
      • get

        public static MBPartner get​(Properties ctx,
                                    int C_BPartner_ID,
                                    String trxName)
        Get BPartner with Value in a transaction
        Parameters:
        ctx - context
        C_BPartner_ID -
        trxName - transaction
        Returns:
        BPartner or null
      • getNotInvoicedAmt

        public static BigDecimal getNotInvoicedAmt​(int C_BPartner_ID)
        Get Not Invoiced Shipment Value
        Parameters:
        C_BPartner_ID - partner
        Returns:
        value in accounting currency
      • initTemplate

        protected boolean initTemplate​(int AD_Client_ID)
        Load Default BPartner
        Parameters:
        AD_Client_ID - client
        Returns:
        true if loaded
      • getContacts

        public MUser[] getContacts​(boolean reload)
        Get All Contacts
        Parameters:
        reload - if true users will be requeried
        Returns:
        contacts
      • getContact

        public MUser getContact​(int AD_User_ID)
        Get specified or first Contact
        Parameters:
        AD_User_ID - optional user
        Returns:
        contact or null
      • getLocations

        public MBPartnerLocation[] getLocations​(boolean reload)
        Get All Locations (only active)
        Parameters:
        reload - if true locations will be requeried
        Returns:
        locations
      • getLocation

        public MBPartnerLocation getLocation​(int C_BPartner_Location_ID)
        Get explicit or first bill Location
        Parameters:
        C_BPartner_Location_ID - optional explicit location
        Returns:
        location or null
      • getBankAccounts

        public MBPBankAccount[] getBankAccounts​(boolean requery)
        Get Bank Accounts
        Parameters:
        requery - requery
        Returns:
        Bank Accounts
      • setClientOrg

        public void setClientOrg​(int AD_Client_ID,
                                 int AD_Org_ID)
        Set Client/Org
        Overrides:
        setClientOrg in class PO
        Parameters:
        AD_Client_ID - client
        AD_Org_ID - org
      • getAD_OrgBP_ID_Int

        public int getAD_OrgBP_ID_Int()
        Deprecated.
        Get Linked Organization. (is Button) The Business Partner is another Organization for explicit Inter-Org transactions
        Returns:
        AD_Org_ID if BP
      • getPrimaryC_BPartner_Location_ID

        public int getPrimaryC_BPartner_Location_ID()
        Get Primary C_BPartner_Location_ID
        Returns:
        C_BPartner_Location_ID
      • getPrimaryC_BPartner_Location

        public MBPartnerLocation getPrimaryC_BPartner_Location()
        Get Primary C_BPartner_Location
        Returns:
        C_BPartner_Location
      • getPrimaryAD_User_ID

        public int getPrimaryAD_User_ID()
        Get Primary AD_User_ID
        Returns:
        AD_User_ID
      • setPrimaryC_BPartner_Location_ID

        public void setPrimaryC_BPartner_Location_ID​(int C_BPartner_Location_ID)
        Set Primary C_BPartner_Location_ID
        Parameters:
        C_BPartner_Location_ID - id
      • setPrimaryAD_User_ID

        public void setPrimaryAD_User_ID​(int AD_User_ID)
        Set Primary AD_User_ID
        Parameters:
        AD_User_ID - id
      • setTotalOpenBalance

        public void setTotalOpenBalance()
        Calculate Total Open Balance and SO_CreditUsed. (includes drafted invoices)
      • setActualLifeTimeValue

        public void setActualLifeTimeValue()
        Set Actual Life Time Value from DB
      • setSOCreditStatus

        public void setSOCreditStatus()
        Set Credit Status
      • getSOCreditStatus

        public String getSOCreditStatus​(BigDecimal additionalAmt)
        Get SO CreditStatus with additional amount
        Parameters:
        additionalAmt - additional amount in Accounting Currency
        Returns:
        sinulated credit status
      • getCreditWatchRatio

        public BigDecimal getCreditWatchRatio()
        Get Credit Watch Ratio
        Returns:
        BP Group ratio or 0.9
      • isCreditStopHold

        public boolean isCreditStopHold()
        Credit Status is Stop or Hold.
        Returns:
        true if Stop/Hold
      • getBPGroup

        public MBPGroup getBPGroup()
        Get BP Group
        Returns:
        group
      • setBPGroup

        public void setBPGroup​(MBPGroup group)
        Get BP Group
        Parameters:
        group - group
      • beforeSave

        protected boolean beforeSave​(boolean newRecord)
        Before Save
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - new
        Returns:
        true
      • afterSave

        protected boolean afterSave​(boolean newRecord,
                                    boolean success)
        After Save
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - new
        success - success
        Returns:
        success
      • afterDelete

        protected boolean afterDelete​(boolean success)
        After Delete
        Overrides:
        afterDelete in class PO
        Parameters:
        success -
        Returns:
        deleted
      • postDelete

        protected boolean postDelete()
        Description copied from class: PO
        Executed after the Delete operation is committed in the database.
        Overrides:
        postDelete in class PO
        Returns:
        true if post delete is a success