Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Generate a calander

    Hi everyone,

    I would like to generate 12 tables of the calander for the whole year like
    this:

    sun mon tue wed thur fri sat
    Wk1 5 0 3 5 0 4 6
    Wk2 2 2 5 9 1 3 7
    Wk3 1 1 1 2 3 5 9

    All the data are store in the database. The number in the calander are the
    number of people who will attend the course. What is the fastest way / smartest
    way to generate the tables for the whole year? Please give me some hints

    FRANKLIN

    Franklin LO Guest

  2. Similar Questions and Discussions

    1. calander control
      where can i find a nice looking calander control to implement in an html page ? cheers
    2. Calander Component
      Would anyone out there like to share the CF calendar component that was in DRK 3. I would like to see if I can make it work for my company. ...
    3. Calander Form
      I have a worm form that sends appointment details to me via e-mail it arrives like this: On 2004-07-13 at 14:37:27, The following information...
    4. Cant add events to HTML controls in a Calander control
      Im not getting any error messages but the event is not going off when i click the button it just posts back to the same page. I know this code has...
    5. Calander For Field in form and in subform
      ACCESS XP 2002 I have a form that when the user picks the field DATEIN, that I need a calendar to popup, let the user select the date and that...
  3. #2

    Default Re: Generate a calander

    If you are not interested in the date but only in the week, you can easiely do
    by creating a 52 row table - Wk1 through Wk52. Your database can have one
    column named weekNumber, and 7 columns for the days of the week. The database
    would have 52 records, corresponding to the 52 rows in the table.

    jdeline Guest

  4. #3

    Default Re: Generate a calander

    Here is something i created while ago
    let me know if you need me to make easier to read



    <cfset weekstotal = 0>
    <CFif ParameterExists(session.Mnt_Emp_statusID)>
    <cfset statusID = #session.Mnt_Emp_statusID#>
    <cfset Empid = #session.Mnt_emp_Id#>
    <cfelse>
    <cfset statusID = #session.Emp_statusID#>
    <cfset Empid = #session.Emp_ID#>
    </CFif>
    <cfif ParameterExists(url.newdate)>
    <cfset weeknow = #week(url.newdate)#>
    <cfelseif ParameterExists(form.tdate)>
    <cfset weeknow = #week(form.tdate)#>
    <cfelseif ParameterExists(url.week)>
    <cfset weeknow = #url.week#>
    <cfelse>
    <cfset weeknow = #Week(now())#>
    </cfif>

    <cfset weekbefore = weeknow - 1>
    <cfset weekafter = weeknow + 1>
    <table border="1" width="100%" cellpadding="0" cellspacing="0"
    bordercolor="#DFDFDF">
    <cfloop index = "LoopCountM" from = 1 to = 12>
    <cfset thismonthdays = #DaysInMonth(CreateDate(2005, LoopCountM, 1))# >
    <cfloop index = "LoopCount" from = 1 to = #thismonthdays#>
    <cfset dayofthemonth = #CreateDate(2005, LoopCountM, LoopCount)#>
    <cfif #weeknow# eq #Week(dayofthemonth)#>
    <cfif #DayofWeekAsString(DayOfWeek(dayofthemonth))# is "Sunday"><cfset
    dayone = #DateFormat(dayofthemonth, "m/dd/yyyy")#> <tr><cfif not
    ParameterExists(url.print)><td><cfoutput><a href="index.cfm?module=time&<cfif
    ParameterExists(url.page)>page=#Url.page#&</cfif>week=#weekbefore#"> <<
    </a></cfoutput></td></cfif></cfif>
    <cfoutput>
    <td class="small" align="center" valign="top" bgcolor="#IIf(LoopCountM Mod
    2, DE('ffffff'), DE('99FF00'))#" <cfif dayofthemonth eq
    #todaydate#>class="red"</cfif>>
    <cfset date1 = #DateFormat(dayofthemonth, "mm/dd/yyyy")#>
    <cfinclude template="qry_gethoursempl.cfm">
    <cfinclude template="qry_holidaydates.cfm">

    <a href="index.cfm?module=time&<cfif
    ParameterExists(url.page)>page=#Url.page#&</cfif>week=#weeknow#&newdate=#date1#"
    class="small">
    #DateFormat(dayofthemonth, "ddd mm/dd")#</a><cfif holidaydates.Holiday neq
    ''><BR>#holidaydates.Holiday#</cfif><BR>
    #gethoursempl.THour#
    <cfif gethoursempl.THour eq ""><cfset THour= 0><cfelse><cfset THour=
    #gethoursempl.THour#></cfif>
    <cfset weekstotal = weekstotal + THour>
    </td>
    </cfoutput>

    <cfif #DayofWeekAsString(DayOfWeek(dayofthemonth))# is "Saturday"><cfset
    daytwo = #DateFormat(dayofthemonth, "m/dd/yyyy")#><cfif not
    ParameterExists(url.print)><cfoutput><cfif #weekstotal# gt 0><td
    align="center">Total<BR><strong>#weekstotal#</strong></td></cfif><td><a
    href="index.cfm?module=time&<cfif
    ParameterExists(url.page)>page=#Url.page#&</cfif>week=#weekafter#"> >>
    </a></td></cfoutput></cfif></tr></cfif>
    </cfif>
    </cfloop>
    </cfloop>
    <cfif not ParameterExists(url.print)>
    <tr><td colspan="7" align="center">
    <cfoutput><a href="index.cfm?module=time&<cfif
    ParameterExists(url.page)>page=#Url.page#&</cfif>" class="small">Today
    Date</a></cfoutput></td>
    <td colspan="2" class="small" align="center">
    <SCRIPT language=javascript src="/pop-up.js" type=text/javascript></SCRIPT>
    <cfoutput><a
    href="javascript:openNaviLGR('print.cfm?module=tim ecard_prt&week=#weeknow#&print
    =yes');"><img src="images/icon_print.gif" border="0"></a></cfoutput></td></tr>
    </cfif>
    </table>

    jorgepino Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139