protected virtual void Account_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            Account row = (Account)e.Row;

            if (!string.IsNullOrEmpty(row.CuryID))
            {
                CASetup casetup = PXSelect <CASetup> .Select(this);

                if (casetup != null && casetup.TransitAcctId != null && casetup.TransitAcctId == row.AccountID)
                {
                    PXException exception = new PXException(CA.Messages.CashInTransitAccountCanNotBeDenominated);
                    sender.RaiseExceptionHandling <Account.curyID>(row, row.CuryID, exception);
                    throw exception;
                }

                string newCuryid;
                if (e.Operation == PXDBOperation.Update)
                {
                    newCuryid = row.CuryID;
                    byte[] timestamp = PXDatabase.SelectTimeStamp();

                    PXDatabase.Update <GLHistory>(new PXDataFieldAssign("CuryID", newCuryid),
                                                  new PXDataFieldRestrict("AccountID", ((Account)e.Row).AccountID),
                                                  new PXDataFieldRestrict("CuryID", PXDbType.VarChar, 5, null, PXComp.ISNULL),
                                                  new PXDataFieldRestrict("tstamp", PXDbType.Timestamp, 8, timestamp, PXComp.LE));
                }
            }
        }
Example #2
0
        public Closing()
        {
            GLSetup setup       = GLSetup.Current;
            APSetup apSetup     = APSetup.Select();
            ARSetup arSetup     = ARSetup.Select();
            INSetup inSetup     = INSetup.Select();
            CASetup caSetup     = CASetup.Select();
            FASetup faSetup     = FASetup.Select();
            PRSetup prSetup     = PRSetup.Select();
            PXCache periodCache = Caches[typeof(FinPeriod)];

            PXUIFieldAttribute.SetEnabled <FinPeriod.finPeriodID>(periodCache, null, false);
            PXUIFieldAttribute.SetEnabled <FinPeriod.descr>(periodCache, null, false);

            PXUIFieldAttribute.SetVisible <FinPeriod.aPClosed>(periodCache, null, apSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.aRClosed>(periodCache, null, arSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.iNClosed>(periodCache, null, inSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.cAClosed>(periodCache, null, caSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.fAClosed>(periodCache, null, faSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.pRClosed>(periodCache, null, prSetup != null);

            Caches[typeof(FinPeriod)].AllowInsert = false;
            Caches[typeof(FinPeriod)].AllowDelete = false;

            if (this.GetType() != typeof(Closing))
            {
                ShowDocuments.SetCaption(PXMessages.LocalizeNoPrefix(GL.Messages.ShowDocumentsNonGL));
            }
        }
Example #3
0
        public ARBatchEntry()
        {
            CASetup caSetup = CASetup.Current;
            ARSetup arSetup = ARSetup.Current;

            RowUpdated.AddHandler <CABatch>(ParentFieldUpdated);
        }
        public SummaryPostingController(JournalEntry journalEntry, CASetup caSetup)
        {
            _journalEntry = journalEntry;
            _caSetup      = caSetup;

            var glTranCache = (PXCache <GLTran>)journalEntry.GLTranModuleBatNbr.Cache;

            _glTranCustomComparer      = glTranCache.GetKeyComparer();
            _groupComparer             = new GLTranGroupComparer(_caSetup);
            _summaryTransactionsGroups = new Dictionary <GLTran, Dictionary <GLTran, GLTran> >(_groupComparer);
        }
Example #5
0
        public Closing()
        {
            GLSetup setup       = GLSetup.Current;
            APSetup apSetup     = APSetup.Select();
            ARSetup arSetup     = ARSetup.Select();
            INSetup inSetup     = INSetup.Select();
            CASetup caSetup     = CASetup.Select();
            FASetup faSetup     = FASetup.Select();
            PXCache periodCache = Caches[typeof(FinPeriod)];

            PXUIFieldAttribute.SetEnabled <FinPeriod.finPeriodID>(periodCache, null, false);
            PXUIFieldAttribute.SetEnabled <FinPeriod.descr>(periodCache, null, false);

            PXUIFieldAttribute.SetVisible <FinPeriod.aPClosed>(periodCache, null, apSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.aRClosed>(periodCache, null, arSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.iNClosed>(periodCache, null, inSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.cAClosed>(periodCache, null, caSetup != null);
            PXUIFieldAttribute.SetVisible <FinPeriod.fAClosed>(periodCache, null, faSetup != null);

            Caches[typeof(FinPeriod)].AllowInsert = false;
            Caches[typeof(FinPeriod)].AllowDelete = false;
        }
        public ARBatchEntry()
        {
            CASetup setup = casetup.Current;

            RowUpdated.AddHandler <CABatch>(ParentFieldUpdated);
        }
Example #7
0
        public virtual IEnumerable close(PXAdapter adapter)
        {
            APSetup apSetup = APSetup.Select();
            ARSetup arSetup = ARSetup.Select();
            INSetup inSetup = INSetup.Select();
            CASetup caSetup = CASetup.Select();
            FASetup faSetup = FASetup.Select();

            List <FinPeriod> list = new List <FinPeriod>();

            bool YearClosed = true;

            foreach (FinPeriod period in adapter.Get())
            {
                if (period.Selected == true)
                {
                    if (period.Active != true)
                    {
                        throw new FiscalPeriodInactiveException(period.FinPeriodID);
                    }

                    if (Accessinfo.ScreenID == "GL.50.30.00")
                    {
                        if (apSetup != null && period.APClosed != true)
                        {
                            throw new PXException(Messages.PeriodOpenInAPModule);
                        }
                        if (arSetup != null && period.ARClosed != true)
                        {
                            throw new PXException(Messages.PeriodOpenInARModule);
                        }
                        if (caSetup != null && period.CAClosed != true)
                        {
                            throw new PXException(Messages.PeriodOpenInCAModule);
                        }
                        if (inSetup != null && PXAccess.FeatureInstalled <CS.FeaturesSet.distributionModule>() && period.INClosed != true)
                        {
                            throw new PXException(Messages.PeriodOpenInINModule);
                        }
                        if (faSetup != null && PXAccess.FeatureInstalled <CS.FeaturesSet.fixedAsset>() && period.FAClosed != true)
                        {
                            throw new PXException(Messages.PeriodOpenInFAModule);
                        }
                    }

                    list.Add(period);
                }
                else
                {
                    YearClosed = false;
                }
            }

            if (YearClosed)
            {
                if ((FinPeriod)NextFiscalYear.Select(list[list.Count - 1].FinYear) == null)
                {
                    throw new PXException(Messages.NoPeriodsForNextYear);
                }
            }

            if (list.Count > 0)
            {
                StartClosePeriod(list);
            }
            return(adapter.Get());
        }
 public GLTranGroupComparer(CASetup caSetup)
 {
     _caSetup        = caSetup;
     _isSubFeatureOn = PXAccess.FeatureInstalled <FeaturesSet.subAccount>();
 }