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:
    • Field Details

      • m_contacts

        protected MUser[] m_contacts
        Users
      • m_locations

        protected MBPartnerLocation[] m_locations
        Addressed
      • m_accounts

        protected MBPBankAccount[] m_accounts
        BP Bank Accounts
      • 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 Details

      • MBPartner

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

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

        public MBPartner(Properties ctx, String C_BPartner_UU, String trxName)
        UUID based Constructor
        Parameters:
        ctx - Context
        C_BPartner_UU - UUID key
        trxName - Transaction
      • MBPartner

        public MBPartner(Properties ctx, int C_BPartner_ID, String trxName)
        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)
        Copy constructor
        Parameters:
        copy -
      • MBPartner

        public MBPartner(Properties ctx, MBPartner copy)
        Copy constructor
        Parameters:
        ctx -
        copy -
      • MBPartner

        public MBPartner(Properties ctx, MBPartner copy, String trxName)
        Copy constructor
        Parameters:
        ctx -
        copy -
        trxName -
      • MBPartner

        public MBPartner(Properties ctx, int C_BPartner_ID, String trxName, String... virtualColumns)
        Parameters:
        ctx -
        C_BPartner_ID -
        trxName -
        virtualColumns -
    • Method Details

      • getTemplate

        public static MBPartner getTemplate(Properties ctx, int AD_Client_ID)
        Create new Business Partner from template (not save)
        Parameters:
        ctx - context
        AD_Client_ID - client
        Returns:
        new Business Partner created from template or null
      • getBPartnerCashTrx

        public static MBPartner getBPartnerCashTrx(Properties ctx, int AD_Client_ID)
        Get Cash Trx Business Partner (as template for new BP)
        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 id
        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 id 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)
        Initialize BPartner record from template
        Parameters:
        AD_Client_ID - client
        Returns:
        true if loaded
      • getContacts

        public MUser[] getContacts(boolean reload)
        Get All Contacts
        Parameters:
        reload - true to reload from DB
        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 - true to reload from DB
        Returns:
        locations
      • getLocation

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

        public MBPBankAccount[] getBankAccounts(boolean requery)
        Get Bank Accounts
        Parameters:
        requery - true to reload from DB
        Returns:
        Bank Accounts
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_C_BPartner
        Returns:
        info
      • 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

        @Deprecated(forRemoval=true, since="11") public int getAD_OrgBP_ID_Int()
        Deprecated, for removal: This API element is subject to removal in a future version.
        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 (First BillTo or First)
        Returns:
        C_BPartner_Location_ID
      • getPrimaryC_BPartner_Location

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

        public int getPrimaryAD_User_ID()
        Get Primary AD_User_ID
        Returns:
        AD_User_ID or -1
      • 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.
      • setActualLifeTimeValue

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

        public void setSOCreditStatus()
        Update Credit Status for sales transaction
      • getSOCreditStatus

        public String getSOCreditStatus(BigDecimal additionalAmt)
        Get SO CreditStatus with additional amount
        Parameters:
        additionalAmt - additional amount in Accounting Currency
        Returns:
        simulated 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)
        Set BP Group
        Parameters:
        group - group
      • getM_PriceList_ID

        public int getM_PriceList_ID()
        Get PriceList ID
        Specified by:
        getM_PriceList_ID in interface I_C_BPartner
        Overrides:
        getM_PriceList_ID in class X_C_BPartner
        Returns:
        BP M_PriceList_ID or BP Group M_PriceList_ID
      • getPO_PriceList_ID

        public int getPO_PriceList_ID()
        Get PO PriceList ID
        Specified by:
        getPO_PriceList_ID in interface I_C_BPartner
        Overrides:
        getPO_PriceList_ID in class X_C_BPartner
        Returns:
        BP PO price list id or BP Group PO price list id
      • getM_DiscountSchema_ID

        public int getM_DiscountSchema_ID()
        Get DiscountSchema id
        Specified by:
        getM_DiscountSchema_ID in interface I_C_BPartner
        Overrides:
        getM_DiscountSchema_ID in class X_C_BPartner
        Returns:
        Discount Schema id
      • getPO_DiscountSchema_ID

        public int getPO_DiscountSchema_ID()
        Get PO DiscountSchema id
        Specified by:
        getPO_DiscountSchema_ID in interface I_C_BPartner
        Overrides:
        getPO_DiscountSchema_ID in class X_C_BPartner
        Returns:
        po discount schema id
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Description copied from class: PO
        Called before Save for Pre-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - true if it is a new record
        Returns:
        true if record can be saved
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        Description copied from class: PO
        Called after Save for Post-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success
      • afterDelete

        protected boolean afterDelete(boolean success)
        Description copied from class: PO
        Execute after Delete operations.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterDelete in class PO
        Parameters:
        success - true if record deleted
        Returns:
        true if delete is a success
      • postDelete

        protected boolean postDelete()
        Description copied from class: PO
        Execute after the Delete operation have been committed to database.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        postDelete in class PO
        Returns:
        true if post delete is a success
      • markImmutable

        public MBPartner markImmutable()
        Description copied from interface: ImmutablePOSupport
        mark PO as immutable
        Specified by:
        markImmutable in interface ImmutablePOSupport
        Returns:
        PO