protected virtual OrganizationFinYear GenerateSingleOrganizationFinYear(int organizationID, string startYearNumber, string startMasterFinPeriodID) { MasterFinYear startYear = FinPeriodRepository.FindMasterFinYearByID(startYearNumber); MasterFinPeriod startMasterFinPeriod = FinPeriodRepository.FindMasterFinPeriodByID(startMasterFinPeriodID); return(GenerateSingleOrganizationFinYear(organizationID, startYear, startMasterFinPeriod)); }
protected virtual OrganizationFinPeriod GenerateAdjustmentOrganizationFinPeriod(int organizationID, OrganizationFinPeriod prevFinPeriod) { (string masterYearNumber, string masterPeriodNumber) = FinPeriodUtils.ParseFinPeriodID(prevFinPeriod.FinPeriodID); MasterFinYear masterFinYear = FinPeriodRepository.FindMasterFinYearByID(masterYearNumber, clearQueryCache: true); string adjustmentMasterFinPeriodID = $"{masterYearNumber:0000}{masterFinYear.FinPeriods:00}"; (string yearNumber, string periodNumber) = FinPeriodUtils.ParseFinPeriodID(prevFinPeriod.FinPeriodID); periodNumber = $"{int.Parse(periodNumber) + 1:00}"; OrganizationFinPeriod orgFinPeriod = new OrganizationFinPeriod { OrganizationID = organizationID, FinPeriodID = FinPeriodUtils.ComposeFinPeriodID(yearNumber, periodNumber), MasterFinPeriodID = adjustmentMasterFinPeriodID, FinYear = yearNumber, PeriodNbr = periodNumber, Custom = prevFinPeriod.Custom, DateLocked = prevFinPeriod.DateLocked, StartDate = prevFinPeriod.EndDate, EndDate = prevFinPeriod.EndDate, Status = prevFinPeriod.Status, ARClosed = prevFinPeriod.ARClosed, APClosed = prevFinPeriod.APClosed, FAClosed = prevFinPeriod.FAClosed, CAClosed = prevFinPeriod.CAClosed, INClosed = prevFinPeriod.INClosed, Descr = Messages.AdjustmentPeriod, }; MasterFinPeriod masterFinPeriod = FinPeriodRepository.FindMasterFinPeriodByID(adjustmentMasterFinPeriodID); PXDBLocalizableStringAttribute.CopyTranslations <MasterFinPeriod.descr, OrganizationFinPeriod.descr>(this, masterFinPeriod, orgFinPeriod); return(orgFinPeriod); }