public virtual void GLAllocation_StartFinPeriodID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { FinPeriod finPeriod = FinPeriodRepository.FindFinPeriodByDate(Accessinfo.BusinessDate, FinPeriod.organizationID.MasterValue); if (finPeriod != null) { e.NewValue = FinPeriodIDFormattingAttribute.FormatForDisplay(finPeriod.FinPeriodID); } }
public virtual void GLAllocation_StartFinPeriodID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { PXSelectBase selectdate = new PXSelect <FinPeriod, Where <FinPeriod.startDate, LessEqual <Required <FinPeriod.startDate> >, And <FinPeriod.endDate, Greater <Required <FinPeriod.endDate> > > > >(this); FinPeriod res = selectdate.View.SelectSingle(Accessinfo.BusinessDate, Accessinfo.BusinessDate) as FinPeriod; if (res != null) { e.NewValue = FinPeriodIDFormattingAttribute.FormatForDisplay(res.FinPeriodID); } }
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); } }
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); } }
public virtual void GLAllocation_EndFinPeriodID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { FinPeriod finPeriod = FinPeriodRepository.FindFinPeriodByDate(Accessinfo.BusinessDate, FinPeriod.organizationID.MasterValue); if (finPeriod != null) { FinPeriod lastPeriodOfYear = FinPeriodRepository.FindLastYearNotAdjustmentPeriod(finPeriod.FinYear, FinPeriod.organizationID.MasterValue); if (lastPeriodOfYear != null) { e.NewValue = FinPeriodIDFormattingAttribute.FormatForDisplay(lastPeriodOfYear.FinPeriodID); } } }
protected virtual void ShowOpenShipments(IEnumerable <FinPeriod> periods) { ParallelQuery <string> periodIDs = periods.Select(fp => fp.FinPeriodID).AsParallel(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters["FromPeriodID"] = FinPeriodIDFormattingAttribute.FormatForDisplay(periodIDs.Min()); parameters["ToPeriodID"] = FinPeriodIDFormattingAttribute.FormatForDisplay(periodIDs.Max()); Organization org = OrganizationMaint.FindOrganizationByID(this, Filter.Current.OrganizationID); parameters["OrgID"] = org?.OrganizationCD; throw new PXReportRequiredException(parameters, "IN656500", PXBaseRedirectException.WindowMode.NewWindow, "Documents Not Posted to Inventory"); }
/// <summary> /// Retrieves the first financial period of the year corresponding /// to the financial period specified. /// If no such period exists, returns <c>null</c>. /// </summary> public string GetFirstPeriodOfYear(string financialPeriodID) { if (financialPeriodID == null) { return(null); } PXGraph graph = PXGraph.CreateInstance <FiscalPeriodMaint>(); string firstPeriodOfYear = FinPeriodIDAttribute.GetFirstFinPeriodIDOfYear(financialPeriodID); if (!FinPeriodIDAttribute.PeriodExists(graph, financialPeriodID)) { return(null); } return(FinPeriodIDFormattingAttribute.FormatForDisplay(firstPeriodOfYear)); }
public override object Evaluate(PXCache cache, object item, Dictionary <Type, object> parameters) { string direction = (string)parameters[typeof(Direction)]; string periodID = (string)parameters[typeof(PeriodID)]; switch (direction) { case FormatDirection.Display: return(FinPeriodIDFormattingAttribute.FormatForDisplay(periodID)); case FormatDirection.Store: return(FinPeriodIDFormattingAttribute.FormatForStoring(periodID)); case FormatDirection.Error: return(FinPeriodIDFormattingAttribute.FormatForError(periodID)); default: return(null); } }
/// <summary> /// Retrieves the first financial period of the year corresponding /// to the financial period specified. /// If no such period exists, returns <c>null</c>. /// </summary> public string GetFirstPeriodOfYear(string financialPeriodID) { if (financialPeriodID == null) { return(null); } PXGraph graph = PXGraph.CreateInstance <MasterFinPeriodMaint>(); string firstPeriodOfYear = FinPeriodUtils.GetFirstFinPeriodIDOfYear(financialPeriodID); IFinPeriodRepository finPeriodRepository = graph.GetService <IFinPeriodRepository>(); if (!finPeriodRepository.PeriodExists(financialPeriodID, FinPeriod.organizationID.MasterValue)) { return(null); } return(FinPeriodIDFormattingAttribute.FormatForDisplay(firstPeriodOfYear)); }
/// <summary> /// Retrieves the financial period with the same <see cref="FinPeriod.PeriodNbr"/> /// as the one specified, but residing in the previous financial year. /// If no such period exists, returns <c>null</c>. /// </summary> public string GetSamePeriodInPreviousYear(string financialPeriodID) { if (financialPeriodID == null) { return(null); } PXGraph graph = PXGraph.CreateInstance <FiscalPeriodMaint>(); try { string resultingPeriodID = FinPeriodIDAttribute.GetSamePeriodInPreviousYear( graph, financialPeriodID); return(FinPeriodIDFormattingAttribute.FormatForDisplay(resultingPeriodID)); } catch (PXFinPeriodException) { return(null); } }
/// <summary> /// Retrieves the financial period with the same <see cref="MasterFinPeriod.PeriodNbr"/> /// as the one specified, but residing in the previous financial year. /// If no such period exists, returns <c>null</c>. /// </summary> public string GetSamePeriodInPreviousYear(string financialPeriodID) { if (financialPeriodID == null) { return(null); } PXGraph graph = PXGraph.CreateInstance <MasterFinPeriodMaint>(); try { IFinPeriodRepository finPeriodRepository = graph.GetService <IFinPeriodRepository>(); string resultingPeriodID = finPeriodRepository.GetSamePeriodInPreviousYear(financialPeriodID, FinPeriod.organizationID.MasterValue); return(FinPeriodIDFormattingAttribute.FormatForDisplay(resultingPeriodID)); } catch (PXFinPeriodException) { return(null); } }
public static string FormatPeriod(string period) { return(FinPeriodIDFormattingAttribute.FormatForDisplay(period)); }
protected virtual void DoTransfer(TransferFilter filter, List <FixedAsset> list) { DocumentList <FARegister> created = new DocumentList <FARegister>(this); foreach (FixedAsset asset in list) { FADetails det = PXSelect <FADetails, Where <FADetails.assetID, Equal <Current <FixedAsset.assetID> > > > .SelectSingleBound(this, new object[] { asset }); FALocationHistory location = PXSelect <FALocationHistory, Where <FALocationHistory.assetID, Equal <Current <FADetails.assetID> >, And <FALocationHistory.revisionID, Equal <Current <FADetails.locationRevID> > > > > .SelectSingleBound(this, new object[] { det }); int? destClassID = filter.ClassTo ?? asset.ClassID; int? destBranchID = filter.BranchTo ?? location.LocationID; string destDeptID = string.IsNullOrEmpty(filter.DepartmentTo) ? location.Department : filter.DepartmentTo; if (location.LocationID != destBranchID || location.Department != destDeptID || asset.ClassID != destClassID) { FADetails copy_det = (FADetails)Details.Cache.CreateCopy(det); FALocationHistory copy_loc = (FALocationHistory)Lochist.Cache.CreateCopy(location); copy_loc.RevisionID = ++copy_det.LocationRevID; copy_loc.LocationID = destBranchID; copy_loc.Department = destDeptID; copy_loc.PeriodID = filter.PeriodID; copy_loc.TransactionDate = filter.TransferDate; copy_loc.Reason = filter.Reason; TransactionEntry.SegregateRegister(this, (int)destBranchID, FARegister.origin.Transfer, null, filter.TransferDate, "", created); Details.Update(copy_det); location = Lochist.Insert(copy_loc); if (asset.ClassID != destClassID) { asset.ClassID = destClassID; AssetSelect.Cache.Update(asset); } FARegister reg = Register.Current; AssetProcess.TransferAsset(this, asset, location, ref reg); } } if (Register.Current != null && created.Find(Register.Current) == null) { created.Add(Register.Current); } Actions.PressSave(); if (fasetup.Current.AutoReleaseTransfer == true) { SelectTimeStamp(); PXLongOperation.StartOperation(this, delegate { AssetTranRelease.ReleaseDoc(created, false); }); } else if (created.Count > 0) { AssetTranRelease graph = CreateInstance <AssetTranRelease>(); AssetTranRelease.ReleaseFilter fltr = (AssetTranRelease.ReleaseFilter)graph.Filter.Cache.CreateCopy(graph.Filter.Current); fltr.Origin = FARegister.origin.Transfer; graph.Filter.Update(fltr); graph.SelectTimeStamp(); Dictionary <string, string> parameters = new Dictionary <string, string>(); for (int i = 0; i < created.Count; ++i) { FARegister reg = created[i]; reg.Selected = true; graph.FADocumentList.Update(reg); graph.FADocumentList.Cache.SetStatus(reg, PXEntryStatus.Updated); graph.FADocumentList.Cache.IsDirty = false; parameters["FARegister.RefNbr" + i] = reg.RefNbr; } parameters["PeriodFrom"] = FinPeriodIDFormattingAttribute.FormatForDisplay(filter.PeriodID); parameters["PeriodTo"] = FinPeriodIDFormattingAttribute.FormatForDisplay(filter.PeriodID); parameters["Mode"] = "U"; PXReportRequiredException reportex = new PXReportRequiredException(parameters, "FA642000", "Preview"); throw new PXRedirectWithReportException(graph, reportex, "Release FA Transaction"); } }