Adempiere 3.5.2a

org.compiere.model
Class MBPartner

java.lang.Object
  extended by org.compiere.model.PO
      extended by org.compiere.model.X_C_BPartner
          extended by org.compiere.model.MBPartner
All Implemented Interfaces:
Serializable, Comparator, I_C_BPartner, I_Persistent, Evaluatee

public class MBPartner
extends X_C_BPartner

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
  • See Also:
    Serialized Form

    Field Summary
     
    Fields inherited from class org.compiere.model.X_C_BPartner
    AD_LANGUAGE_AD_Reference_ID, DELIVERYRULE_AD_Reference_ID, DELIVERYRULE_AfterReceipt, DELIVERYRULE_Availability, DELIVERYRULE_CompleteLine, DELIVERYRULE_CompleteOrder, DELIVERYRULE_Force, DELIVERYRULE_Manual, DELIVERYVIARULE_AD_Reference_ID, DELIVERYVIARULE_Delivery, DELIVERYVIARULE_Pickup, DELIVERYVIARULE_Shipper, FREIGHTCOSTRULE_AD_Reference_ID, FREIGHTCOSTRULE_Calculated, FREIGHTCOSTRULE_FixPrice, FREIGHTCOSTRULE_FreightIncluded, FREIGHTCOSTRULE_Line, INVOICE_PRINTFORMAT_ID_AD_Reference_ID, INVOICERULE_AD_Reference_ID, INVOICERULE_AfterDelivery, INVOICERULE_AfterOrderDelivered, INVOICERULE_CustomerScheduleAfterDelivery, INVOICERULE_Immediate, M_DISCOUNTSCHEMA_ID_AD_Reference_ID, PAYMENTRULE_AD_Reference_ID, PAYMENTRULE_Cash, PAYMENTRULE_Check, PAYMENTRULE_CreditCard, PAYMENTRULE_DirectDebit, PAYMENTRULE_DirectDeposit, PAYMENTRULE_OnCredit, PAYMENTRULEPO_AD_Reference_ID, PAYMENTRULEPO_Cash, PAYMENTRULEPO_Check, PAYMENTRULEPO_CreditCard, PAYMENTRULEPO_DirectDebit, PAYMENTRULEPO_DirectDeposit, PAYMENTRULEPO_OnCredit, PO_DISCOUNTSCHEMA_ID_AD_Reference_ID, PO_PAYMENTTERM_ID_AD_Reference_ID, PO_PRICELIST_ID_AD_Reference_ID, SALESREP_ID_AD_Reference_ID, SOCREDITSTATUS_AD_Reference_ID, SOCREDITSTATUS_CreditHold, SOCREDITSTATUS_CreditOK, SOCREDITSTATUS_CreditStop, SOCREDITSTATUS_CreditWatch, SOCREDITSTATUS_NoCreditCheck
     
    Fields inherited from class org.compiere.model.PO
    ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
     
    Fields inherited from interface org.compiere.model.I_C_BPartner
    accessLevel, COLUMNNAME_AcqusitionCost, COLUMNNAME_ActualLifeTimeValue, COLUMNNAME_AD_Language, COLUMNNAME_AD_OrgBP_ID, COLUMNNAME_BPartner_Parent_ID, COLUMNNAME_C_BP_Group_ID, COLUMNNAME_C_BPartner_ID, COLUMNNAME_C_Dunning_ID, COLUMNNAME_C_Greeting_ID, COLUMNNAME_C_InvoiceSchedule_ID, COLUMNNAME_C_PaymentTerm_ID, COLUMNNAME_C_TaxGroup_ID, COLUMNNAME_DeliveryRule, COLUMNNAME_DeliveryViaRule, COLUMNNAME_Description, COLUMNNAME_DocumentCopies, COLUMNNAME_DunningGrace, COLUMNNAME_DUNS, COLUMNNAME_FirstSale, COLUMNNAME_FlatDiscount, COLUMNNAME_FreightCostRule, COLUMNNAME_Invoice_PrintFormat_ID, COLUMNNAME_InvoiceRule, COLUMNNAME_IsCustomer, COLUMNNAME_IsDiscountPrinted, COLUMNNAME_IsEmployee, COLUMNNAME_IsOneTime, COLUMNNAME_IsProspect, COLUMNNAME_IsSalesRep, COLUMNNAME_IsSummary, COLUMNNAME_IsTaxExempt, COLUMNNAME_IsVendor, COLUMNNAME_M_DiscountSchema_ID, COLUMNNAME_M_PriceList_ID, COLUMNNAME_NAICS, COLUMNNAME_Name, COLUMNNAME_Name2, COLUMNNAME_NumberEmployees, COLUMNNAME_PaymentRule, COLUMNNAME_PaymentRulePO, COLUMNNAME_PO_DiscountSchema_ID, COLUMNNAME_PO_PaymentTerm_ID, COLUMNNAME_PO_PriceList_ID, COLUMNNAME_POReference, COLUMNNAME_PotentialLifeTimeValue, COLUMNNAME_Rating, COLUMNNAME_ReferenceNo, COLUMNNAME_SalesRep_ID, COLUMNNAME_SalesVolume, COLUMNNAME_SendEMail, COLUMNNAME_ShareOfCustomer, COLUMNNAME_ShelfLifeMinPct, COLUMNNAME_SO_CreditLimit, COLUMNNAME_SO_CreditUsed, COLUMNNAME_SO_Description, COLUMNNAME_SOCreditStatus, COLUMNNAME_TaxID, COLUMNNAME_TotalOpenBalance, COLUMNNAME_URL, COLUMNNAME_Value, Model, Table_ID, Table_Name
     
    Constructor Summary
    MBPartner(Properties ctx)
              Constructor for new BPartner from Template
    MBPartner(Properties ctx, int C_BPartner_ID, String trxName)
              Default Constructor
    MBPartner(Properties ctx, ResultSet rs, String trxName)
              Default Constructor
    MBPartner(X_I_BPartner impBP)
              Import Contstructor
     
    Method Summary
    protected  boolean afterDelete(boolean success)
              After Delete
    protected  boolean afterSave(boolean newRecord, boolean success)
              After Save
    protected  boolean beforeDelete()
              Before Delete
    protected  boolean beforeSave(boolean newRecord)
              Before Save
    static MBPartner get(Properties ctx, int C_BPartner_ID)
              Get BPartner with Value
    static MBPartner get(Properties ctx, String Value)
              Get BPartner with Value
     int getAD_OrgBP_ID_Int()
              Get Linked Organization.
     MBPBankAccount[] getBankAccounts(boolean requery)
              Get Bank Accounts
    static MBPartner getBPartnerCashTrx(Properties ctx, int AD_Client_ID)
              Get Cash Trx Business Partner
     MBPGroup getBPGroup()
              Get BP Group
     MUser getContact(int AD_User_ID)
              Get specified or first Contact
     MUser[] getContacts(boolean reload)
              Get All Contacts
     BigDecimal getCreditWatchRatio()
              Get Credit Watch Ratio
     MBPartnerLocation getLocation(int C_BPartner_Location_ID)
              Get explicit or first bill Location
     MBPartnerLocation[] getLocations(boolean reload)
              Get All Locations (only active)
     int getM_DiscountSchema_ID()
              Get DiscountSchema
     int getM_PriceList_ID()
              Get PriceList
    static BigDecimal getNotInvoicedAmt(int C_BPartner_ID)
              Get Not Invoiced Shipment Value
     int getPO_DiscountSchema_ID()
              Get PO DiscountSchema
     int getPO_PriceList_ID()
              Get PO PriceList
     int getPrimaryAD_User_ID()
              Get Primary AD_User_ID
     int getPrimaryC_BPartner_Location_ID()
              Get Primary C_BPartner_Location_ID
     MBPartnerLocation getPrimaryC_BPartner_Location()
              Get Primary C_BPartner_Location
     String getSOCreditStatus(BigDecimal additionalAmt)
              Get SO CreditStatus with additional amount
    static MBPartner getTemplate(Properties ctx, int AD_Client_ID)
              Get Empty Template Business Partner
     BigDecimal getTotalOpenBalance(boolean calculate)
              Get Total Open Balance
     boolean isCreditStopHold()
              Credit Status is Stop or Hold.
     void setActualLifeTimeValue()
              Set Actual Life Time Value from DB
     void setAD_OrgBP_ID(int AD_OrgBP_ID)
              Set Linked Organization.
     void setBPGroup(MBPGroup group)
              Get BP Group
     void setClientOrg(int AD_Client_ID, int AD_Org_ID)
              Set Client/Org
     void setPrimaryAD_User_ID(int AD_User_ID)
              Set Primary AD_User_ID
     void setPrimaryC_BPartner_Location_ID(int C_BPartner_Location_ID)
              Set Primary C_BPartner_Location_ID
     void setSOCreditStatus()
              Set Credit Status
     void setTotalOpenBalance()
              Calculate Total Open Balance and SO_CreditUsed.
     void setTotalOpenBalance(BigDecimal TotalOpenBalance)
              Set Total Open Balance
     String toString()
              String Representation
     
    Methods inherited from class org.compiere.model.X_C_BPartner
    get_AccessLevel, getAcqusitionCost, getActualLifeTimeValue, getAD_Language, getAD_OrgBP_ID, getBPartner_Parent_ID, getC_BP_Group_ID, getC_BP_Group, getC_BPartner_ID, getC_Dunning_ID, getC_Dunning, getC_Greeting_ID, getC_Greeting, getC_InvoiceSchedule_ID, getC_InvoiceSchedule, getC_PaymentTerm_ID, getC_PaymentTerm, getC_TaxGroup_ID, getC_TaxGroup, getDeliveryRule, getDeliveryViaRule, getDescription, getDocumentCopies, getDunningGrace, getDUNS, getFirstSale, getFlatDiscount, getFreightCostRule, getInvoice_PrintFormat_ID, getInvoiceRule, getKeyNamePair, getM_PriceList, getNAICS, getName, getName2, getNumberEmployees, getPaymentRule, getPaymentRulePO, getPO_PaymentTerm_ID, getPOReference, getPotentialLifeTimeValue, getRating, getReferenceNo, getSalesRep_ID, getSalesVolume, getShareOfCustomer, getShelfLifeMinPct, getSO_CreditLimit, getSO_CreditUsed, getSO_Description, getSOCreditStatus, getTaxID, getTotalOpenBalance, getURL, getValue, initPO, isCustomer, isDiscountPrinted, isEmployee, isOneTime, isProspect, isSalesRep, isSendEMail, isSummary, isTaxExempt, isVendor, setAcqusitionCost, setActualLifeTimeValue, setAD_Language, setAD_OrgBP_ID, setBPartner_Parent_ID, setC_BP_Group_ID, setC_BPartner_ID, setC_Dunning_ID, setC_Greeting_ID, setC_InvoiceSchedule_ID, setC_PaymentTerm_ID, setC_TaxGroup_ID, setDeliveryRule, setDeliveryViaRule, setDescription, setDocumentCopies, setDunningGrace, setDUNS, setFirstSale, setFlatDiscount, setFreightCostRule, setInvoice_PrintFormat_ID, setInvoiceRule, setIsCustomer, setIsDiscountPrinted, setIsEmployee, setIsOneTime, setIsProspect, setIsSalesRep, setIsSummary, setIsTaxExempt, setIsVendor, setM_DiscountSchema_ID, setM_PriceList_ID, setNAICS, setName, setName2, setNumberEmployees, setPaymentRule, setPaymentRulePO, setPO_DiscountSchema_ID, setPO_PaymentTerm_ID, setPO_PriceList_ID, setPOReference, setPotentialLifeTimeValue, setRating, setReferenceNo, setSalesRep_ID, setSalesVolume, setSendEMail, setShareOfCustomer, setShelfLifeMinPct, setSO_CreditLimit, setSO_CreditUsed, setSO_Description, setSOCreditStatus, setTaxID, setURL, setValue
     
    Methods inherited from class org.compiere.model.PO
    compare, copyValues, copyValues, createAttachment, delete_Accounting, delete_Tree, delete, delete, deleteEx, deleteEx, dump, dump, equals, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_Table_ID, get_TableName, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_new, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadComplete, loadDefaults, loadSpecial, lock, save, save, saveEx, saveEx, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_ColumnUpdateable, set_CustomColumn, set_TrxName, set_TrxName, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, setAD_Client_ID, setAD_Org_ID, setClientOrg, setDoc, setDocWorkflowMgr, setIsActive, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     
    Methods inherited from interface org.compiere.model.I_Persistent
    save
     

    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 Contstructor

    Parameters:
    impBP - import
    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,
                                int C_BPartner_ID)
    Get BPartner with Value

    Parameters:
    ctx - context
    Value - value
    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

    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

    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

    setAD_OrgBP_ID

    public void setAD_OrgBP_ID(int AD_OrgBP_ID)
    Set Linked Organization. (is Button)

    Parameters:
    AD_OrgBP_ID -

    getAD_OrgBP_ID_Int

    public int getAD_OrgBP_ID_Int()
    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


    getTotalOpenBalance

    public BigDecimal getTotalOpenBalance(boolean calculate)
    Get Total Open Balance

    Parameters:
    calculate - if null calculate it
    Returns:
    Open Balance

    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

    setTotalOpenBalance

    public void setTotalOpenBalance(BigDecimal TotalOpenBalance)
    Set Total Open Balance

    Specified by:
    setTotalOpenBalance in interface I_C_BPartner
    Overrides:
    setTotalOpenBalance in class X_C_BPartner
    Parameters:
    TotalOpenBalance -

    getBPGroup

    public MBPGroup getBPGroup()
    Get BP Group

    Returns:
    group

    setBPGroup

    public void setBPGroup(MBPGroup group)
    Get BP Group

    Parameters:
    group - group

    getM_PriceList_ID

    public int getM_PriceList_ID()
    Get PriceList

    Specified by:
    getM_PriceList_ID in interface I_C_BPartner
    Overrides:
    getM_PriceList_ID in class X_C_BPartner
    Returns:
    price List

    getPO_PriceList_ID

    public int getPO_PriceList_ID()
    Get PO PriceList

    Specified by:
    getPO_PriceList_ID in interface I_C_BPartner
    Overrides:
    getPO_PriceList_ID in class X_C_BPartner
    Returns:
    price list

    getM_DiscountSchema_ID

    public int getM_DiscountSchema_ID()
    Get DiscountSchema

    Specified by:
    getM_DiscountSchema_ID in interface I_C_BPartner
    Overrides:
    getM_DiscountSchema_ID in class X_C_BPartner
    Returns:
    Discount Schema

    getPO_DiscountSchema_ID

    public int getPO_DiscountSchema_ID()
    Get PO DiscountSchema

    Specified by:
    getPO_DiscountSchema_ID in interface I_C_BPartner
    Overrides:
    getPO_DiscountSchema_ID in class X_C_BPartner
    Returns:
    po discount

    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

    beforeDelete

    protected boolean beforeDelete()
    Before Delete

    Overrides:
    beforeDelete in class PO
    Returns:
    true

    afterDelete

    protected boolean afterDelete(boolean success)
    After Delete

    Overrides:
    afterDelete in class PO
    Parameters:
    success -
    Returns:
    deleted

    Adempiere 3.5.2a

    Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.