예제 #1
0
        protected virtual void Location_IsAPAccountSameAsMain_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            CR.Location record = (CR.Location)e.Row;

            if (record.IsAPAccountSameAsMain == false)
            {
                LocationAPAccountSub mainloc = APAccountSubLocation.Select();
                record.VAPAccountID         = mainloc.VAPAccountID;
                record.VAPSubID             = mainloc.VAPSubID;
                record.VAPAccountLocationID = record.LocationID;

                LocationAPAccountSub copyloc = new LocationAPAccountSub();
                copyloc.BAccountID   = record.BAccountID;
                copyloc.LocationID   = record.LocationID;
                copyloc.VAPAccountID = record.VAPAccountID;
                copyloc.VAPSubID     = record.VAPSubID;

                BusinessAccount.Cache.Current = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount));
                APAccountSubLocation.Insert(copyloc);
            }
            if (record.IsAPAccountSameAsMain == true)
            {
                record.VAPAccountID = null;
                record.VAPSubID     = null;
                BAccount baccount = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount));
                if (baccount != null)
                {
                    record.VAPAccountLocationID = baccount.DefLocationID;
                }
            }
        }
예제 #2
0
        protected virtual void LocationAPAccountSub_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            LocationAPAccountSub record = (LocationAPAccountSub)e.Row;

            if (!sender.ObjectsEqual <LocationAPAccountSub.vAPAccountID, LocationAPAccountSub.vAPSubID>(e.Row, e.OldRow))
            {
                Location mainloc = Location.Current;
                mainloc.VAPAccountID = record.VAPAccountID;
                mainloc.VAPSubID     = record.VAPSubID;

                if (Location.Cache.GetStatus(mainloc) == PXEntryStatus.Notchanged)
                {
                    Location.Cache.SetStatus(mainloc, PXEntryStatus.Updated);
                }
            }
        }
		protected virtual void Location_IsAPAccountSameAsMain_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
		{
			CR.Location record = (CR.Location)e.Row;

			if (record.IsAPAccountSameAsMain == false)
			{
				LocationAPAccountSub mainloc = APAccountSubLocation.Select();
				record.VAPAccountID = mainloc.VAPAccountID;
				record.VAPSubID = mainloc.VAPSubID;
				record.VAPAccountLocationID = record.LocationID;

				LocationAPAccountSub copyloc = new LocationAPAccountSub();
				copyloc.BAccountID = record.BAccountID;
				copyloc.LocationID = record.LocationID;
				copyloc.VAPAccountID = record.VAPAccountID;
				copyloc.VAPSubID = record.VAPSubID;

				BusinessAccount.Cache.Current = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount));
				APAccountSubLocation.Insert(copyloc);
			}
			if (record.IsAPAccountSameAsMain == true)
			{
				record.VAPAccountID = null;
				record.VAPSubID = null;
				BAccount baccount = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount));
				if (baccount != null)
				{
					record.VAPAccountLocationID = baccount.DefLocationID;
				}
			}
		}