Viewing by month: December 2010

Calculate Next Billing Date

I had a need to figure out the next billing date after today, based on a known start date and billing interval. Here’s the function I came up with to make it happen.

<cffunction name="getNextBilling" access="public" output="false" returntype="date" >
 <cfargument 
 name="StartDate" 
 type="date" 
 required="true" 
 hint="The date the billing started" 
 />
 <cfargument 
 name="BillingInterval" 
 type="numeric" 
 required="true" 
 hint="The number of units for the billing. For example, 
 if something is billed every 90 days, this value will be 90" 
 />
 <cfargument 
 name="IntervalUnit" 
 type="string" 
 default="d" 
 required="false" 
 hint="The date part for the billing interval. This is the 
 CF datepart, such as 'd', 'm', 'yyyy', etc. The default is 'd'." 
 />
 <cfset var TimeFromStart = DateDiff(Arguments.IntervalUnit, StartDate, Now()) />
 <cfreturn DateAdd(Arguments.IntervalUnit, TimeFromStart + Arguments.BillingInterval - (TimeFromStart MOD Arguments.BillingInterval), Arguments.Startdate) />
</cffunction>

Let me know if you spot a problem with the solution, or have suggestions for improvement.

2 comments | Posted by Daniel Short on Dec 10, 2010 at 1:37 PM | Categories: ColdFusion -

Show in Finder in Eclipse

It's horribly annoying trying to find a file on your file system when it's buried folders deep in your project, on who knows which hard drive. In an effort to make this easier I scoured the interwebs for you, and found a solution.
Read complete post
4 comments | Posted by Daniel Short on Dec 8, 2010 at 9:28 PM | Categories: ColdFusion -

AltStyle によって変換されたページ (->オリジナル) /