Update_Recurring_Frequency

Recurring Frequency Update

Major Business Rule

Object Name: B0900058

Parent DLL: CFIN

Location: Client/Server

Language: C

Functional Description

Purpose

This function will advance the date that passed in to a new date based on the recurring frequency 
passed in.


Setup Notes and Prerequisites

Pass in the Company and the date you want to advance along with the desired recurring frequency 

value.  Valid values are:


"WK" - Weekly - adds 1 week to the given date.

"MO" - Monthly - sets date to the next period's Period End Date.

"QT" - Quarterly - Sets date to Period End Date of 3 periods away.

"SA" - Semi-Annually - Sets date to same day of month, 6 months away.

"AN" - Annually - Sets date to same day of month, 12 months away.


An updated date will be passed back in the Updated Date parameter.  This function is enabled to 

handle leap years.


Technical Specification

If Recurring Frequency is "MO"
   Call Return FYPN (X0903)

   Add 1 to returned Period

   Call Get Normal Number Of Periods (B1400010)

   Compare New Period to Normal Number of Periods

   If New Period is greater than Normal Number Of Periods

      Add 1 to New Fiscal Year

      Subtract Normal Number Of Periods from New Period

   Call Return Date (X0903)

If Recurring Frequency is "SA"

   Add 6 to Date's month

   If Date's Month is greater than 12

      Add 1 to Date's Fiscal Year

      Subtract 12 from Date's Month

   If Day of Date's Month is greater than Normal Days in Month

      Add 1 to Date's Month

      Subtract Normal Days in Month from Day of Date's Month 

      If Date's Month is greater than 12

         Add 1 to Date's Fiscal Year

         Subtract 12 from Date's Month

If Recurring Frequency is "QT"

   Call Return FYPN (X0903)

   Add 3 to returned Period

   Call Get Normal Number Of Periods (B1400010)

   Compare New Period to Normal Number of Periods

   If New Period is greater than Normal Number Of Periods

      Add 1 to New Fiscal Year

      Subtract Normal Number Of Periods from New Period

   Call Return Date (X0903)

If Recurring Frequency is "WK"

   Add 7 to Date's day

   If Day of Date's Month is greater than Normal Days in Month

      Add 1 to Date's Month

      Subtract Normal Days in Month from Day of Date's Month 

      If Date's Month is greater than 12

         Add 1 to Date's Fiscal Year

         Subtract 12 from Date's Month

If Recurring Frequency is "AN"

   Add 1 to Date's year

   If Date's Month is greater than 12

      Add 1 to Date's Fiscal Year

      Subtract 12 from Date's Month

   If Day of Date's Month is greater than Normal Days in Month

      Add 1 to Date's Month

      Subtract Normal Days in Month from Day of Date's Month 

      If Date's Month is greater than 12

         Add 1 to Date's Fiscal Year

         Subtract 12 from Date's Month

^

Data Structure

D0900058 - Recurring Frequency Update

Parameter NameData ItemData TypeReq/OptI/O/Both
szCompanyCOcharNONENONE

Special Input Expected
Pass in the Company to be used to determine date information, usually the Document Company.

^

jdDateforglandvoucherjuliaDGJJDEDATENONENONE

Special Input Expected
Pass in the G/L Date to be updated.

^

szFrequencyrecurringRFcharNONENONE

Special Input Expected
Pass in the two character recurring frequency.  Valid values are:


WK - Weekly

MO - Monthly

QT - Quarterly

SA - Semi-Annually

AN - Annually

^

jdDate_Updated_GLDateDGJJDEDATENONENONE

Special Output Returned
This parameter will contain the newly updated G/L Date.

^

Related Functions

B1400010 Get Normal Number of Periods
X0903 Fiscal Date Edits +

Related Tables

None