/**
  *  Constructor
  *	@param ctx context
  *  @param bp BP
  *	@param bpc BP Contact
  *  @param location Location
  */
 public MBPBankAccount(Ctx ctx, MBPartner bp, MUser bpc, MLocation location)
     : this(ctx, 0, bp.Get_TrxName())
 {
     SetIsACH(false);
     //
     SetC_BPartner_ID(bp.GetC_BPartner_ID());
     //
     SetA_Name(bpc.GetName());
     SetA_EMail(bpc.GetEMail());
     //
     SetA_Street(location.GetAddress1());
     SetA_City(location.GetCity());
     SetA_Zip(location.GetPostal());
     SetA_State(location.GetRegionName(true));
     SetA_Country(location.GetCountryName());
 }
Esempio n. 2
0
        /**
         *  Make name Unique
         *  @param address address
         */
        private void MakeUnique(MLocation address)
        {
            //	_uniqueName = address.toString();
            //	return;

            if (_uniqueName.Length == 0)
            {
                _uniqueName.Clear();
            }
            _unique++;

            // 0 + Address1
            // to set address1
            if (_uniqueName.Length == 0)
            {
                String xx = address.GetAddress1();
                if (xx != null && xx.Length > 0)
                {
                    _uniqueName.Append(xx);
                }
                // Set address2, address3 and address4 in case of VA077
                if (VAdvantage.Utility.Env.IsModuleInstalled("VA077_"))
                {
                    xx = address.GetAddress2();
                    if (xx != null && xx.Length > 0)
                    {
                        if (_uniqueName.Length > 0)
                        {
                            _uniqueName.Append(" ");
                        }
                        _uniqueName.Append(xx);
                    }
                    xx = address.GetAddress3();
                    if (xx != null && xx.Length > 0)
                    {
                        if (_uniqueName.Length > 0)
                        {
                            _uniqueName.Append(" ");
                        }
                        _uniqueName.Append(xx);
                    }
                    xx = address.GetAddress4();
                    if (xx != null && xx.Length > 0)
                    {
                        if (_uniqueName.Length > 0)
                        {
                            _uniqueName.Append(" ");
                        }
                        _uniqueName.Append(xx);
                    }
                }
                _unique = 0;
            }

            //	0 - City
            // to set address1 and City as Name
            if (_unique == 0 && _uniqueName.Length >= 0)
            {
                String xx = address.GetCity();
                if (xx != null && xx.Length > 0)
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName.Append(" ");
                    }
                    _uniqueName.Append(xx);
                }
                // Copy region, postal code country name in case of VA077
                if (VAdvantage.Utility.Env.IsModuleInstalled("VA077_"))
                {
                    xx = address.GetRegionName(true);
                    if (xx != null && xx.Length > 0)
                    {
                        if (_uniqueName.Length > 0)
                        {
                            _uniqueName.Append(" ");
                        }
                        _uniqueName.Append(xx);
                    }
                    xx = address.GetPostal();
                    if (xx != null && xx.Length > 0)
                    {
                        if (_uniqueName.Length > 0)
                        {
                            _uniqueName.Append(" ");
                        }
                        _uniqueName.Append(xx);
                    }
                    xx = address.GetCountryName();
                    if (xx != null && xx.Length > 0)
                    {
                        if (_uniqueName.Length > 0)
                        {
                            _uniqueName.Append(" ");
                        }
                        _uniqueName.Append(xx);
                    }
                }
                _unique = 0;
            }

            //	1 + Address1
            if (_unique == 1 || _uniqueName.Length == 0)
            {
                String xx = address.GetAddress1();
                if (xx != null && xx.Length > 0)
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName.Append(" ");
                    }
                    _uniqueName.Append(xx);
                }
                _unique = 1;
            }
            //	2 + Address2
            if (_unique == 2 || _uniqueName.Length == 0)
            {
                String xx = address.GetAddress2();
                if (xx != null && xx.Length > 0)
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName.Append(" ");
                    }
                    _uniqueName.Append(xx);
                }
                _unique = 2;
            }
            //	3 - Region
            if (_unique == 3 || _uniqueName.Length == 0)
            {
                String xx = address.GetRegionName(true);
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName.Append(" ");
                    }
                    _uniqueName.Append(xx);
                }
                _unique = 3;
            }
            // 5 - Country
            if (_unique == 5 || _uniqueName.Length == 0)
            {
                String xx = address.GetCountryName();
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName.Append(" ");
                    }
                    _uniqueName.Append(xx);
                }
                _unique = 5;
            }
            //	4 - ID
            if (_unique == 4 || _uniqueName.Length == 0)
            {
                int id = Get_ID();
                if (id == 0)
                {
                    id = address.Get_ID();
                }
                _uniqueName.Append("#" + id);
                _unique = 4;
            }
        }
        /**
         *  Make name Unique
         *  @param address address
         */
        private void MakeUnique(MLocation address)
        {
            //	_uniqueName = address.toString();
            //	return;

            if (_uniqueName == null)
            {
                _uniqueName = "";
            }
            _unique++;

            // 0 + Address1
            // to set address1
            if (_uniqueName.Length == 0)
            {
                String xx = address.GetAddress1();
                if (xx != null && xx.Length > 0)
                {
                    _uniqueName = xx;
                }
                _unique = 0;
            }

            //	0 - City
            // to set address1 and City as Name
            if (_unique == 0 && _uniqueName.Length >= 0)
            {
                String xx = address.GetCity();
                if (xx != null && xx.Length > 0)
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName += " ";
                    }
                    _uniqueName += xx;
                }
                _unique = 0;
            }

            //	1 + Address1
            if (_unique == 1 || _uniqueName.Length == 0)
            {
                String xx = address.GetAddress1();
                if (xx != null && xx.Length > 0)
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName += " ";
                    }
                    _uniqueName += xx;
                }
                _unique = 1;
            }
            //	2 + Address2
            if (_unique == 2 || _uniqueName.Length == 0)
            {
                String xx = address.GetAddress2();
                if (xx != null && xx.Length > 0)
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName += " ";
                    }
                    _uniqueName += xx;
                }
                _unique = 2;
            }
            //	3 - Region
            if (_unique == 3 || _uniqueName.Length == 0)
            {
                String xx = address.GetRegionName(true);
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName += " ";
                    }
                    _uniqueName += xx;
                }
                _unique = 3;
            }
            // 5 - Country
            if (_unique == 5 || _uniqueName.Length == 0)
            {
                String xx = address.GetCountryName();
                {
                    if (_uniqueName.Length > 0)
                    {
                        _uniqueName += " ";
                    }
                    _uniqueName += xx;
                }
                _unique = 5;
            }
            //	4 - ID
            if (_unique == 4 || _uniqueName.Length == 0)
            {
                int id = Get_ID();
                if (id == 0)
                {
                    id = address.Get_ID();
                }
                _uniqueName += "#" + id;
                _unique      = 4;
            }
        }