Exemplo n.º 1
0
        public virtual void VendorClass_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            VendorClass row = (VendorClass)e.Row;
            PXSelectBase <CashAccount> select = new PXSelect <CashAccount, Where <CashAccount.cashAccountID,
                                                                                  Equal <Required <VendorClass.cashAcctID> > > >(this);

            if (!String.IsNullOrEmpty(row.CuryID) && (row.AllowOverrideCury ?? false) != true)
            {
                CashAccount acct = select.Select(row.CashAcctID);
                if (acct != null)
                {
                    if (row.CuryID != acct.CuryID)
                    {
                        if (cache.RaiseExceptionHandling <VendorClass.cashAcctID>(e.Row, acct.CashAccountCD, new PXSetPropertyException(Messages.VendorCuryDifferentDefPayCury, typeof(VendorClass.cashAcctID).Name)))
                        {
                            throw new PXRowPersistingException(typeof(VendorClass.cashAcctID).Name, null, Messages.VendorCuryDifferentDefPayCury, typeof(VendorClass.cashAcctID).Name);
                        }
                    }
                }
            }
            if (VendorClassRecord.Cache.GetStatus(e.Row) == PXEntryStatus.Inserted)
            {
                EPEmployeeClass e1 = PXSelect <EPEmployeeClass, Where <EPEmployeeClass.vendorClassID, Equal <Current <VendorClass.vendorClassID> > > > .SelectSingleBound(this, new object[] { e.Row });

                if (e1 != null)
                {
                    cache.IsDirty = false;
                    e.Cancel      = true;
                    throw new PXRowPersistingException(typeof(VendorClass.vendorClassID).Name, null, Messages.EmployeeClassExists);
                }
            }
        }
Exemplo n.º 2
0
 protected virtual void VendorClass_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
 {
     PXUIFieldAttribute.SetVisible <VendorClass.curyID>(cache, null, (bool)CMSetup.Current.MCActivated);
     PXUIFieldAttribute.SetVisible <VendorClass.curyRateTypeID>(cache, null, (bool)CMSetup.Current.MCActivated);
     PXUIFieldAttribute.SetVisible <VendorClass.allowOverrideCury>(cache, null, (bool)CMSetup.Current.MCActivated);
     PXUIFieldAttribute.SetVisible <VendorClass.allowOverrideRate>(cache, null, (bool)CMSetup.Current.MCActivated);
     if (e.Row != null)
     {
         VendorClass row = (VendorClass)e.Row;
         PXUIFieldAttribute.SetEnabled <VendorClass.cashAcctID>(cache, e.Row, String.IsNullOrEmpty(row.PaymentMethodID) == false);
     }
 }
Exemplo n.º 3
0
        protected virtual void VendorClass_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            var mcFeatureActivated = PXAccess.FeatureInstalled <FeaturesSet.multicurrency>();

            PXUIFieldAttribute.SetVisible <VendorClass.curyID>(cache, null, mcFeatureActivated);
            PXUIFieldAttribute.SetVisible <VendorClass.curyRateTypeID>(cache, null, mcFeatureActivated);
            PXUIFieldAttribute.SetVisible <VendorClass.allowOverrideCury>(cache, null, mcFeatureActivated);
            PXUIFieldAttribute.SetVisible <VendorClass.allowOverrideRate>(cache, null, mcFeatureActivated);
            if (e.Row != null)
            {
                VendorClass row = (VendorClass)e.Row;
                PXUIFieldAttribute.SetEnabled <VendorClass.cashAcctID>(cache, e.Row, String.IsNullOrEmpty(row.PaymentMethodID) == false);
            }
        }
Exemplo n.º 4
0
        public virtual void VendorClass_RowDeleting(PXCache cache, PXRowDeletingEventArgs e)
        {
            VendorClass vclass = (VendorClass)e.Row;

            if (vclass == null)
            {
                return;
            }

            APSetup setup = PXSelect <APSetup> .Select(this);

            if (setup != null && vclass.VendorClassID == setup.DfltVendorClassID)
            {
                throw new PXException(Messages.VendorClassCanNotBeDeletedBecauseItIsUsed);
            }
        }
Exemplo n.º 5
0
        public virtual void VendorClass_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
        {
            VendorClass row = (VendorClass)e.Row;

            if (row == null || row.VendorClassID == null)
            {
                return;
            }

            foreach (APNotification n in
                     PXSelect <APNotification,
                               Where <APNotification.sourceCD, Equal <APNotificationSource.vendor> > > .Select(this))
            {
                NotificationSource source = new NotificationSource();
                source.SetupID = n.SetupID;
                this.NotificationSources.Insert(source);
            }
        }
Exemplo n.º 6
0
        public virtual void VendorClass_CashAcctID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
        {
            VendorClass row = (VendorClass)e.Row;

            if (row != null)
            {
                VendorClass defaultVClass = PXSelectJoin <VendorClass,
                                                          InnerJoin <APSetup, On <VendorClass.vendorClassID, Equal <APSetup.dfltVendorClassID> > > > .Select(this);

                if (defaultVClass != null && row.VendorClassID != defaultVClass.VendorClassID &&
                    row.PaymentMethodID == defaultVClass.PaymentMethodID)
                {
                    e.NewValue = defaultVClass.CashAcctID;
                    e.Cancel   = true;
                }
                else
                {
                    e.NewValue = null;
                    e.Cancel   = true;
                }
            }
        }