--- better_gantt.rb	2011-06-17 19:20:25.558317100 +0900
+++ redmine_better_gantt_chart/lib/redmine/helpers/better_gantt.rb	2011-06-17 19:17:47.263106600 +0900
@@ -1,3 +1,4 @@
+# -*- coding: cp932 -*-
 # Redmine - project management software
 # Copyright (C) 2006-2011  Jean-Philippe Lang
 #
@@ -255,9 +256,36 @@
         case options[:format]
         when :pdf
           options[:pdf].Line(15, options[:top], PDF::TotalWidth, options[:top])
+          vertical_line_pdf(options)
         end
       end
 
+      # --------------------------vertical line.start      
+      def vertical_line_pdf(options)
+        left = options[:subject_width]
+        day = 0
+        options[:pdf].SetFontStyle('B',7)
+        width = options[:zoom]
+        options[:pdf].SetDrawColor(200,200,200)
+        (self.date_to - self.date_from).to_i.times do 
+          leftwidth = (left + width ).to_i
+          options[:pdf].SetY(options[:top_start].to_i)
+          options[:pdf].SetX(left)
+          options[:pdf].RDMCell(width, options[:top].to_i - options[:top_start].to_i, "", "R", 0, "C")
+          if Time.now.beginning_of_day == self.date_from.since(day.days)
+            options[:pdf].SetDrawColor(255, 0, 0)
+            options[:pdf].Line( leftwidth, options[:top_start].to_i, leftwidth, options[:top])
+            options[:pdf].SetDrawColor(200,200,200)
+          else
+            options[:pdf].Line( leftwidth, options[:top_start].to_i, leftwidth, options[:top])  
+          end
+          left = left + width
+          day = day + 1
+        end
+        options[:pdf].SetDrawColor(0, 0, 0)
+      end
+      # --------------------------vertical line.end
+
       def subject_for_project(project, options)
         case options[:format]
         when :html
@@ -540,13 +568,16 @@
         headers_height = header_height
         show_weeks = false
         show_days = false
+        show_day_num = false # <= �ǉ�
 
         if self.months < 7
           show_weeks = true
           headers_height = 2*header_height
           if self.months < 3
             show_days = true
-            headers_height = 3*header_height
+            show_day_num = true
+            #headers_height = 3*header_height
+            headers_height = 4*header_height
           end
         end
 
@@ -606,6 +637,14 @@
             width = zoom
             pdf.SetY(y_start + 2 * header_height)
             pdf.SetX(left)
+            case(wday)
+            when 6
+              pdf.SetTextColor(0, 0, 255)
+            when 7
+              pdf.SetTextColor(255, 0, 0)
+            else
+              pdf.SetTextColor(0, 0, 0)
+            end
             pdf.RDMCell(width, height, day_name(wday).first, "LTR", 0, "C")
             left = left + width
             wday = wday + 1
@@ -613,12 +652,49 @@
           end
         end
 
+        
+        # Day num headers
+        if show_day_num # num
+          left = subject_width
+          height = header_height
+          wday = self.date_from.cwday
+          day_num = self.date_from
+          pdf.SetFontStyle('B',7)
+          (self.date_to - self.date_from + 1).to_i.times do
+            width = zoom
+            pdf.SetY(y_start + 3 * header_height)
+            pdf.SetX(left)
+            case(wday)
+            when 6
+              pdf.SetTextColor(0, 0, 255)
+            when 7
+              pdf.SetTextColor(255, 0, 0)
+            else
+              pdf.SetTextColor(0, 0, 0)
+            end
+            pdf.RDMCell(width, height, day_num.day.to_s, "LTR", 0, "C")
+            left = left + width
+            day_num = day_num + 1
+            wday = wday + 1
+            wday = 1 if wday > 7
+          end
+        end
+
         pdf.SetY(y_start)
         pdf.SetX(15)
+        case(wday)
+        when 6
+          pdf.SetTextColor(0, 0, 255)
+        when 7
+          pdf.SetTextColor(255, 0, 0)
+        else
+          pdf.SetTextColor(0, 0, 0)
+        end
         pdf.RDMCell(subject_width+g_width-15, headers_height, "", 1)
 
         # Tasks
         top = headers_height + y_start
+        pdf.SetTextColor(0, 0, 0)
         options = {
           :top => top,
           :zoom => zoom,
@@ -628,6 +704,7 @@
           :indent_increment => 5,
           :top_increment => 5,
           :format => :pdf,
+          :top_start => top,
           :pdf => pdf
         }
         render(options)
@@ -715,8 +792,10 @@
       def pdf_new_page?(options)
         if options[:top] > 180
           options[:pdf].Line(15, options[:top], PDF::TotalWidth, options[:top])
+          vertical_line_pdf(options)
           options[:pdf].AddPage("L")
-          options[:top] = 15
+          #options[:top] = 15
+          options[:top] = options[:top_start] = 15
           options[:pdf].Line(15, options[:top] - 0.1, PDF::TotalWidth, options[:top] - 0.1)
         end
       end
