Compiere 3.1

org.compiere.model
Class MBPartner

java.lang.Object
  extended by org.compiere.framework.PO
      extended by org.compiere.model.X_C_BPartner
          extended by org.compiere.model.MBPartner
All Implemented Interfaces:
Serializable, Cloneable, Comparator<PO>, 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
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.compiere.model.X_C_BPartner
accessLevel, AD_LANGUAGE_AD_Reference_ID, AD_ORGBP_ID_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, Model, 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, PO_RETURNPOLICY_ID_AD_Reference_ID, RATING_A, RATING_AD_Reference_ID, RATING_B, RATING_C, RATING_NotRated, SALESREP_ID_AD_Reference_ID, SOCREDITSTATUS_AD_Reference_ID, SOCREDITSTATUS_CreditHold, SOCREDITSTATUS_CreditOK, SOCREDITSTATUS_CreditStop, SOCREDITSTATUS_CreditWatch, SOCREDITSTATUS_NoCreditCheck, Table_ID, Table_Name, updatedMS
 
Fields inherited from class org.compiere.framework.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, log, p_changeVO, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
 
Constructor Summary
MBPartner(Ctx ctx, int C_BPartner_ID, String trxName)
          Default Constructor
MBPartner(Ctx ctx, ResultSet rs, String trxName)
          Default Constructor
MBPartner(Ctx ctx, String trxName)
          Constructor for new BPartner from Template
MBPartner(X_I_BPartner impBP)
          Import Contstructor
 
Method Summary
protected  boolean afterSave(boolean newRecord, boolean success)
          After Save
protected  boolean beforeDelete()
          Before Delete
protected  boolean beforeSave(boolean newRecord)
          Before Save
static ArrayList<MBPartner> findAll(Ctx ctx, String bpValue, String bpName, String taxID, String postal, String city, String uValue, String uName, String uPhone, String email, Timestamp birthday, boolean andLogic, int maxRows)
          Get All Business Partner matching the criteria.
static MBPartner get(Ctx ctx, int C_BPartner_ID)
          Get BPartner with Value
static MBPartner get(Ctx 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(Ctx ctx, int AD_Client_ID)
          Get Cash Trx Business Partner
 MBPGroup getBPGroup()
          Get BP Group
 int getC_ConsolidationReference_ID()
          Get Consolidation Reference
 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
 int getM_DiscountSchema_ID()
          Get DiscountSchema
 int getM_PriceList_ID()
          Get PriceList
 int getM_ReturnPolicy_ID()
          Get ReturnPolicy
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 getPO_ReturnPolicy_ID()
          Get Vendor ReturnPolicy
 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(Ctx 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.
static void main(String[] args)
          Test
 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_Size_ID, getC_BP_Status_ID, getC_BPartner_ID, getC_Dunning_ID, getC_Greeting_ID, getC_IndustryCode_ID, getC_InvoiceSchedule_ID, getC_PaymentTerm_ID, getDeliveryRule, getDeliveryViaRule, getDescription, getDocumentCopies, getDUNS, getFirstSale, getFlatDiscount, getFreightCostRule, getInvoice_PrintFormat_ID, getInvoiceRule, getKeyNamePair, 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, isDeliveryRuleValid, isDeliveryViaRuleValid, isDiscountPrinted, isEmployee, isFreightCostRuleValid, isInvoiceRuleValid, isOneTime, isPaymentRulePOValid, isPaymentRuleValid, isProspect, isRatingValid, isSalesRep, isSendEMail, isSOCreditStatusValid, isSummary, isTaxExempt, isVendor, setAcqusitionCost, setActualLifeTimeValue, setAD_Language, setAD_OrgBP_ID, setBPartner_Parent_ID, setC_BP_Group_ID, setC_BP_Size_ID, setC_BP_Status_ID, setC_BPartner_ID, setC_ConsolidationReference_ID, setC_Dunning_ID, setC_Greeting_ID, setC_IndustryCode_ID, setC_InvoiceSchedule_ID, setC_PaymentTerm_ID, setDeliveryRule, setDeliveryViaRule, setDescription, setDocumentCopies, setDUNS, setFirstSale, setFlatDiscount, setFreightCostRule, setInvoice_PrintFormat_ID, setInvoiceRule, setIsCustomer, setIsDiscountPrinted, setIsEmployee, setIsOneTime, setIsProspect, setIsSalesRep, setIsSummary, setIsTaxExempt, setIsVendor, setM_DiscountSchema_ID, setM_PriceList_ID, setM_ReturnPolicy_ID, setNAICS, setName, setName2, setNumberEmployees, setPaymentRule, setPaymentRulePO, setPO_DiscountSchema_ID, setPO_PaymentTerm_ID, setPO_PriceList_ID, setPO_ReturnPolicy_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.framework.PO
addAttachment, addAttachment, addError, afterDelete, compare, convertToBigDecimal, convertToBoolean, convertToInt, convertToTimestamp, copy, copyValues, copyValues, createAttachment, delete_Accounting, delete, delete, dump, dump, equals, get_ChangeVO, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_EntityType, get_HashMap, get_ID, get_IDOld, get_Info, get_KeyColumns, get_Logger, get_Table_ID, get_Table_ID, get_TableName, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_ValuesAsString, get_WhereClause, get_xmlDocument, get_xmlString, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getVO, hashCode, insert_Accounting, is_Changed, is_KeyColumn, is_new, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, load, load, load, load, loadComplete, loadDefaults, loadSpecial, lock, save, save, saveNew_getID, saveNewInsertSQL, saveNewSpecial, saveUpdate, set_ChangeVO, set_ColumnUpdateable, set_CustomColumn, set_TrxName, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueString, setAD_Client_ID, setAD_Org_ID, setClientOrg, setContext, setCtx, setDocWorkflowMgr, setIsActive, setStandardDefaults, setUpdateable, setUpdatedBy, toStringX, unlock, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MBPartner

public MBPartner(Ctx ctx,
                 String trxName)
Constructor for new BPartner from Template

Parameters:
ctx - context
trxName - trx

MBPartner

public MBPartner(Ctx ctx,
                 ResultSet rs,
                 String trxName)
Default Constructor

Parameters:
ctx - context
rs - ResultSet to load from
trxName - transaction

MBPartner

public MBPartner(Ctx 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

findAll

public static ArrayList<MBPartner> findAll(Ctx ctx,
                                           String bpValue,
                                           String bpName,
                                           String taxID,
                                           String postal,
                                           String city,
                                           String uValue,
                                           String uName,
                                           String uPhone,
                                           String email,
                                           Timestamp birthday,
                                           boolean andLogic,
                                           int maxRows)
Get All Business Partner matching the criteria. If you don't use % in the parameter, it must match exactly

Parameters:
ctx - context (for sql security)
bpValue - business partner value
bpName - business partner name
taxID - business partner tax id or ssn
postal - location postal
city - location city
uValue - user value
uName - user name
uPhone - user phone
email - user email
birthday - user birthday
andLogic - if more than one parameter, use AND logic if true otherwise OR
maxRows - max numbers to return
Returns:
array of business partners

getTemplate

public static MBPartner getTemplate(Ctx 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(Ctx 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(Ctx ctx,
                            String Value)
Get BPartner with Value

Parameters:
ctx - context
Value - value
Returns:
BPartner or null

get

public static MBPartner get(Ctx 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

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:
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

setTotalOpenBalance

public void setTotalOpenBalance(BigDecimal TotalOpenBalance)
Set Total Open Balance

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

Overrides:
getM_PriceList_ID in class X_C_BPartner
Returns:
price List

getPO_PriceList_ID

public int getPO_PriceList_ID()
Get PO PriceList

Overrides:
getPO_PriceList_ID in class X_C_BPartner
Returns:
price list

getM_DiscountSchema_ID

public int getM_DiscountSchema_ID()
Get DiscountSchema

Overrides:
getM_DiscountSchema_ID in class X_C_BPartner
Returns:
Discount Schema

getPO_DiscountSchema_ID

public int getPO_DiscountSchema_ID()
Get PO DiscountSchema

Overrides:
getPO_DiscountSchema_ID in class X_C_BPartner
Returns:
po discount

getM_ReturnPolicy_ID

public int getM_ReturnPolicy_ID()
Get ReturnPolicy

Overrides:
getM_ReturnPolicy_ID in class X_C_BPartner
Returns:
Return Policy

getPO_ReturnPolicy_ID

public int getPO_ReturnPolicy_ID()
Get Vendor ReturnPolicy

Overrides:
getPO_ReturnPolicy_ID in class X_C_BPartner
Returns:
Return Policy

getC_ConsolidationReference_ID

public int getC_ConsolidationReference_ID()
Get Consolidation Reference

Overrides:
getC_ConsolidationReference_ID in class X_C_BPartner
Returns:
Consolidation Reference

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

main

public static void main(String[] args)
Test

Parameters:
args -

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.