Anything is possible :OD

If you were using MSSQL then the following might work

        SELECT
                DATEDIFF(leadtime_type, GETDATE(), deadline) 'Difference',
                leadtime,
                leadtime_type
        FROM yourTable

That'll give you the numbers you need to do the maths.

        <cfset multiplier = query.Difference / query.leadtime>

        <cfif multiplier GT query.leadtime * 2>
                <!--- No colour --->
        <cfelseif multiplier GT query.leadtime AND multiplier LT query.leadtime 
*
2>
                <!--- Green --->
        <cfelseif multiplier LT query.leadtime AND multiplier GT 0>
                <!--- Yellow --->
        <cfelseif multiplier LT 0>
                <!--- Red --->
        </cfif>

That was my first thought, God only knows if it's anywhere close. The LT's
and GT's in the CF mayneed to be GTE's and LTE's.

Good luck captain

Ade

-----Original Message-----
From: Chris Kavanagh [mailto:[EMAIL PROTECTED]
Sent: 31 January 2005 21:13
To: CF-Talk
Subject: Calculating lead time


Dear List,

So tasks in my task management system include these fields:

deadline                (date - MySQL "date")
leadtime                (number - MySQL "tinyint")
leadtime_type   (minutes, hours, days, weeks - MySQL "varchar")

On the "task list" view (an html table), I'd like the table rows to
change colour based on how close the deadline is.

- If the deadline is more than twice the "lead time" away - no bgcolor
(or class)
- Between 1 and 2 "lead times" - bgcolor green
- Within the "lead time" - bgcolor yellow
- Past the "deadline" - bgcolor red

Is this possible?  What functions should I investigate?

Kind regards,
CK.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.2 - Release Date: 28/01/2005


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192459
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to