protected virtual void TaxTran_RevisionID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            TaxHistory max = PXSelect <TaxHistory, Where
                                       <TaxHistory.vendorID, Equal <Current <TaxAdjustment.vendorID> >,
                                        And <TaxHistory.taxPeriodID, Equal <Current <TaxAdjustment.taxPeriod> > > >,
                                       OrderBy <Desc <TaxHistory.revisionID> > >
                             .Select(this);

            e.NewValue = max != null ? max.RevisionID : 1;
        }
        protected virtual void SOOrderType_INDocType_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            SOOrderType row = e.Row as SOOrderType;

            if (row != null && !PXAccess.FeatureInstalled <FeaturesSet.inventory>())
            {
                e.NewValue = INTranType.NoUpdate;
                e.Cancel   = true;
            }
        }
        protected virtual void TaxTran_TaxBucketID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            TaxTran tran = (TaxTran)e.Row;

            if (_TaxRev != null)
            {
                e.NewValue = _TaxRev.TaxBucketID;
                sender.SetValue <TaxTran.taxRate>(e.Row, _TaxRev.TaxRate);
            }
        }
Пример #4
0
        protected virtual void WZScenario_ScenarioID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            WZScenario row = e.Row as WZScenario;

            if (row == null)
            {
                return;
            }
            row.ScenarioID = Guid.NewGuid();
        }
        protected virtual void CAAdj_AdjRefNbr_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e, PXFieldDefaulting bs)
        {
            CAAdj row = e.Row as CAAdj;

            SetNumbering(sender, row);
            if (bs != null)
            {
                bs(sender, e);
            }
        }
Пример #6
0
        protected virtual void EPCustomWeek_EndDate_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            EPCustomWeek row = (EPCustomWeek)e.Row;

            if (row == null || row.StartDate == null)
            {
                return;
            }
            e.NewValue = GetEndOfDate(row.StartDate.Value.AddDays(6d));
        }
		protected virtual void RUTROTWorkType_Position_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
		{
			RUTROTWorkType row = (RUTROTWorkType)e.Row;
			if (row == null)
			{
				return;
			}
			RUTROTWorkType latest = PXSelectOrderBy<RUTROTWorkType, OrderBy<Desc<RUTROTWorkType.position>>>.SelectWindowed(this, 0, 1);
			e.NewValue = latest.Position + 1;
		}
Пример #8
0
        protected virtual void Person_GroupName_FieldDefaulting(PXCache sedner, PXFieldDefaultingEventArgs e)
        {
            var group = Groups.Current;

            if (string.IsNullOrEmpty(group?.Name) == false)
            {
                e.NewValue = group.Name;
                e.Cancel   = true;
            }
        }
Пример #9
0
        public virtual void ARTranSplit_LocationID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            PXCache cache = sender.Graph.Caches[typeof(ARTran)];

            if (cache.Current != null && (e.Row == null || ((ARTran)cache.Current).LineNbr == ((ARTranAsSplit)e.Row).LineNbr))
            {
                e.NewValue = ((ARTran)cache.Current).LocationID;
                e.Cancel   = true;
            }
        }
Пример #10
0
        protected void ARTran_DRTermEndDate_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
        {
            var line           = e.Row as ARTran;
            var currentInvoice = Base.Document.Current.GetExtension <ARRegisterExt>();


            if (line != null && line.RequiresTerms == true)
            {
                e.NewValue = currentInvoice.UsrContractEndDate;
            }
        }
Пример #11
0
 protected virtual void CurrencyInfo_CuryID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
 {
     if (CMSetup.Current.MCActivated == true)
     {
         if (vendor.Current != null && !string.IsNullOrEmpty(vendor.Current.CuryID))
         {
             e.NewValue = vendor.Current.CuryID;
             e.Cancel   = true;
         }
     }
 }
Пример #12
0
        protected virtual void INCategory_parentID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            INCategory row = e.Row as INCategory;

            if (row == null)
            {
                return;
            }
            e.NewValue = this.CurrentSelected.FolderID ?? 0;
            e.Cancel   = true;
        }
 protected virtual void CurrencyInfo_CuryID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
 {
     if (PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
     {
         if (vendor.Current != null && !string.IsNullOrEmpty(vendor.Current.CuryID))
         {
             e.NewValue = vendor.Current.CuryID;
             e.Cancel   = true;
         }
     }
 }
Пример #14
0
        public void AMLicenseProducts_WindowEndDate_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            if (!(e.Row is AMLicenseProducts row))
            {
                return;
            }
            var winSize  = Convert.ToDouble(PagePrimaryView.Current.AccountDefWindowSize);
            var currDate = Convert.ToDateTime(Accessinfo.BusinessDate);

            e.NewValue = currDate.AddDays(winSize);
        }
Пример #15
0
        public override void FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            base.FieldDefaulting(sender, e);

            FABook book = PXSelect <FABook, Where <FABook.updateGL, Equal <boolTrue> > > .SelectSingleBound(sender.Graph, new object[0]);

            if (book != null)
            {
                e.NewValue = book.BookCode;
            }
        }
        protected virtual void CABankTran_TranDate_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            CABankTran       row = e.Row as CABankTran;
            CABankTranHeader doc = this.Header.Current;

            if (row != null && doc != null)
            {
                e.NewValue = doc.TranMaxDate.HasValue ? doc.TranMaxDate : doc.DocDate;
                e.Cancel   = true;
            }
        }
Пример #17
0
        protected virtual void GLBudgetTree_GroupID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
        {
            GLBudgetTree row = e.Row as GLBudgetTree;

            if (row == null)
            {
                return;
            }
            row.GroupID       = Guid.NewGuid();
            row.ParentGroupID = this.CurrentSelected.Group == null ? Guid.Empty : this.CurrentSelected.Group;
        }
Пример #18
0
 protected virtual void CurrencyInfo_CuryID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
 {
     if ((bool)cmsetup.Current.MCActivated)
     {
         if (EPEmployee.Current != null && !string.IsNullOrEmpty(EPEmployee.Current.CuryID))
         {
             e.NewValue = EPEmployee.Current.CuryID;
             e.Cancel   = true;
         }
     }
 }
Пример #19
0
        protected virtual void Filter_WorkBookID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            var        page  = HttpContext.Current.CurrentHandler as Page;
            string     value = page.Request.QueryString["WorkBookID"];
            GLWorkBook wb    = PXSelect <GLWorkBook, Where <GLWorkBook.workBookID, Equal <Required <GLWorkBook.workBookID> > > > .Select(this, value);

            if (wb != null)
            {
                e.NewValue = wb.WorkBookID;
                e.Cancel   = true;
            }
        }
Пример #20
0
        public override void FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            base.FieldDefaulting(sender, e);

            FABookPeriod period = PXSelectJoin <FABookPeriod, LeftJoin <FABook, On <FABookPeriod.bookID, Equal <FABook.bookID> > >,
                                                Where <FABookPeriod.startDate, LessEqual <Current <AccessInfo.businessDate> >, And <FABookPeriod.endDate, Greater <Current <AccessInfo.businessDate> >, And <FABook.updateGL, Equal <boolTrue> > > > > .SelectSingleBound(sender.Graph, new object[0]);

            if (period != null)
            {
                e.NewValue = FinPeriodIDFormattingAttribute.FormatForDisplay(period.FinPeriodID);
            }
        }
Пример #21
0
 protected virtual void CurrencyInfo_CuryID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
 {
     if ((bool)cmsetup.Current.MCActivated)
     {
         Vendor v = BVendor.Current;
         if (v != null && !string.IsNullOrEmpty(v.CuryID))
         {
             e.NewValue = v.CuryID;
             e.Cancel   = true;
         }
     }
 }
        protected virtual void SOSalesPrice_CuryID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            SOSalesPrice row = e.Row as SOSalesPrice;

            if (row != null)
            {
                if (Filter.Current != null)
                {
                    row.CuryID = Filter.Current.CuryID;
                }
            }
        }
Пример #23
0
        protected virtual void Batch_BatchNbr_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e, PXFieldDefaulting bs)
        {
            Batch row = e.Row as Batch;

            if (Base.GetContextValue <GLVoucher.refNbr>() == null)
            {
                SetNumbering(sender, row);
            }
            if (bs != null)
            {
                bs(sender, e);
            }
        }
        public virtual object SetExpenseAccountSub(PXCache sender, PXFieldDefaultingEventArgs e, InventoryItem item, int?siteID,
                                                   GetAccountSubUsingPostingClassDelegate GetAccountSubUsingPostingClass,
                                                   GetAccountSubFromItemDelegate GetAccountSubFromItem)
        {
            object expenseAccountSubID = null;

            expenseAccountSubID = GetExpenseAccountSub(sender, e, item, siteID, GetAccountSubUsingPostingClass, GetAccountSubFromItem);

            e.NewValue = expenseAccountSubID;
            e.Cancel   = true;

            return(expenseAccountSubID);
        }
Пример #25
0
        protected virtual void BoundaryYears_YearTo_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            int?minyear = null;

            foreach (FABook book in Books.Select())
            {
                if (book.LastCalendarYear != null && (minyear == null || minyear > Convert.ToInt32(book.LastCalendarYear)))
                {
                    minyear = Convert.ToInt32(book.LastCalendarYear);
                }
            }
            e.NewValue = Convert.ToString(minyear + 1);
        }
Пример #26
0
        public override void FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            base.FieldDefaulting(sender, e);

            PXSelectBase <FinPeriod> select = new PXSelect <FinPeriod, Where <FinPeriod.finYear, Equal <Required <FinPeriod.finYear> > >, OrderBy <Asc <FinPeriod.periodNbr> > >(sender.Graph);

            FinPeriod fp = select.SelectWindowed(0, 1, DateTime.Now.Year);

            if (fp != null)
            {
                e.NewValue = FinPeriodIDFormattingAttribute.FormatForDisplay(fp.FinPeriodID);
            }
        }
Пример #27
0
        protected virtual void Contact_DefAddressID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
        {
            Contact row = e.Row as Contact;

            if (row != null)
            {
                BAccount acct = BAccountUtility.FindAccount(this, row.BAccountID);;
                if (acct != null)
                {
                    e.NewValue = acct.DefAddressID;
                }
            }
        }
Пример #28
0
 protected override void POLine_CuryUnitCost_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs args)
 {
     if (!SkipCostDefaulting && args.Row is POLine subcontractLine)
     {
         var subcontract = Document.Current;
         args.NewValue = GetCurrencyUnitCost(subcontract, subcontractLine, cache);
         if (subcontractLine.InventoryID != null && subcontract?.VendorID != null)
         {
             APVendorPriceMaint.CheckNewUnitCost <POLine, POLine.curyUnitCost>(
                 cache, subcontractLine, args.NewValue);
         }
     }
 }
Пример #29
0
        public virtual void ARTranSplit_InvtMult_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
        {
            PXCache cache = sender.Graph.Caches[typeof(ARTran)];

            if (cache.Current != null && (e.Row == null || ((ARTran)cache.Current).LineNbr == ((ARTranAsSplit)e.Row).LineNbr))
            {
                using (InvtMultScope <ARTran> ms = new InvtMultScope <ARTran>((ARTran)cache.Current))
                {
                    e.NewValue = ((ARTran)cache.Current).InvtMult;
                    e.Cancel   = true;
                }
            }
        }
        protected virtual void EPActivityApprove_Date_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
        {
            EPActivityApprove row = (EPActivityApprove)e.Row;

            if (row == null)
            {
                e.NewValue = null;
            }
            else
            {
                e.NewValue = CRActivityMaint.GetNextActivityStartDate <EPActivityApprove>(this, Activity.Select(), row, Filter.Current.FromWeek, Filter.Current.TillWeek, TempData.Cache, typeof(EP.CRActivityMaint.EPTempData.lastEnteredDate));
            }
        }