<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/controllers/graph_controller.rb</filename>
    </added>
    <added>
      <filename>app/helpers/graph_helper.rb</filename>
    </added>
    <added>
      <filename>app/views/graph/show.html.erb</filename>
    </added>
    <added>
      <filename>public/javascripts/json2.js</filename>
    </added>
    <added>
      <filename>public/stylesheets/graph.css</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1986,6 +1986,5 @@ def search_by_name
   def admin_menu
     render(:layout =&gt; &quot;layouts/menu&quot;)
   end
-  
 
 end</diff>
      <filename>app/controllers/patient_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -459,11 +459,10 @@ class Encounter &lt; OpenMRS
          
   def self.count_encounters_by_type_age_and_date(date,encounter_type = &quot;General Reception&quot;)
     enc_type_id = EncounterType.find_by_name(encounter_type).id
-    #todays_encounters = Patient.find(:all, :conditions =&gt; [&quot;DATE(date_created) = ?&quot;,date,enc_type_id],:group =&gt;&quot;patient_id&quot;)
-    todays_encounters = Encounter.find_by_sql(&quot;select p.patient_id from encounter e join patient p where Date(e.date_created)='#{date}' and p.patient_id=e.patient_id and e.encounter_type=17 group by e.patient_id&quot;).collect{|p|p.patient_id} rescue nil
+    todays_encounters = Encounter.find(:all,:conditions =&gt; [&quot;DATE(encounter_datetime) = ? and encounter_type=?&quot;,date,enc_type_id])
     patient_type = Hash.new(0)
-    todays_encounters.each{|p_id|
-      patient =  Patient.find(p_id)
+    todays_encounters.each{|enc|
+      patient =  Patient.find(enc.patient_id)
       patient_type[&quot;&gt; 16,(#{patient.gender.first})&quot;] += 1 if patient.age &gt;= 16 and patient.gender == &quot;Female&quot;
       patient_type[&quot;&gt; 16,(#{patient.gender.first})&quot;] += 1 if patient.age &gt;= 16 and patient.gender == &quot;Male&quot;
       patient_type[&quot;1 to 16,(#{patient.gender.first})&quot;] += 1 if patient.age &lt; 16 and patient.age &gt;= 1  and patient.gender == &quot;Female&quot;</diff>
      <filename>app/models/encounter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -137,14 +137,14 @@ function setFilingNumber(){
           &lt;tr&gt;&lt;td&gt;&lt;%= &quot;1 to 16&quot; %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= total_under_16_over_1_male %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= total_under_16_over_1_female %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= total_under_16_over_1_female + total_under_16_over_1_male %&gt;&lt;/td&gt;&lt;/tr&gt;
           &lt;tr&gt;&lt;td&gt;&lt;%= &quot;&gt; 16&quot; %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= total_over_16_male %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= total_over_16_female %&gt;&lt;/td&gt;&lt;td&gt;&lt;%=total_over_16_female + total_over_16_male %&gt;&lt;/td&gt;&lt;/tr&gt;
           &lt;tr&gt;&lt;td&gt;Total&lt;/td&gt;&lt;td&gt;&lt;%=total_male%&gt;&lt;/td&gt;&lt;td&gt;&lt;%=total_female%&gt;&lt;/td&gt;&lt;td&gt;&lt;%= total_male + total_female %&gt;&lt;/td&gt;&lt;/tr&gt;
-        &lt;/table&gt; 
+        &lt;/table&gt;
     &lt;% end %&gt;
    &lt;% end %&gt;
 
 
     &lt;% if @show_next_appointment_date %&gt;
-    Next appointment: &lt;%= if @next_appointment_date then @next_appointment_date.strftime(&quot;%d-%b-%Y&quot;) else &quot;(not set)&quot; end %&gt;
-      &lt;!-- TODO display as a calendar --&gt;
+    next appointment: &lt;%= if @next_appointment_date then @next_appointment_date.strftime(&quot;%d-%b-%y&quot;) else &quot;(not set)&quot; end %&gt;
+      &lt;!-- todo display as a calendar --&gt;
     &lt;% end %&gt;
   &lt;/div&gt;
 &lt;/div&gt;
@@ -152,33 +152,33 @@ function setFilingNumber(){
   
 &lt;div class=&quot;right&quot;&gt;
 &lt;% unless session[:encounter_datetime].nil? %&gt;
-  &lt;div class=&quot;date&quot; &lt;%= &quot;style='background-color:tomato'&quot; if session[:is_retrospective] %&gt;&gt;&lt;%= session[:encounter_datetime].strftime(&quot;%d %b %Y&quot;)  %&gt;&lt;/div&gt;
+  &lt;div class=&quot;date&quot; &lt;%= &quot;style='background-color:tomato'&quot; if session[:is_retrospective] %&gt;&gt;&lt;%= session[:encounter_datetime].strftime(&quot;%d %b %y&quot;)  %&gt;&lt;/div&gt;
 &lt;% end %&gt;
 
 
   &lt;table class=&quot;buttons&quot;&gt;
 
     &lt;% if @show_standard_visit_encounter %&gt;
-      &lt;%= link_to_onmousedown_in_tr_td &quot;Standard past visit&quot;, :controller =&gt; &quot;standard_encounter&quot;, :action =&gt;  'menu' %&gt;
+      &lt;%= link_to_onmousedown_in_tr_td &quot;standard past visit&quot;, :controller =&gt; &quot;standard_encounter&quot;, :action =&gt;  'menu' %&gt;
     &lt;% end %&gt;
 
     &lt;% if @show_find_or_register_patient %&gt;
-      &lt;%= link_to_onmousedown_in_tr_td &quot;Find or register patient&quot;, :action =&gt;  'search', :mode =&gt; &quot;patient&quot; %&gt;
+      &lt;%= link_to_onmousedown_in_tr_td &quot;find or register patient&quot;, :action =&gt;  'search', :mode =&gt; &quot;patient&quot; %&gt;
     &lt;% elsif  @show_find_patient %&gt;
-      &lt;%= link_to_onmousedown_in_tr_td &quot;Find patient&quot;, :action =&gt;  'search', :mode =&gt; &quot;patient&quot; %&gt;
+      &lt;%= link_to_onmousedown_in_tr_td &quot;find patient&quot;, :action =&gt;  'search', :mode =&gt; &quot;patient&quot; %&gt;
     &lt;% end %&gt;
 
     &lt;% if @show_find_or_register_guardian %&gt;
-      &lt;%= link_to_onmousedown_in_tr_td &quot;Find or register guardian&quot;, :action =&gt;  'search', :mode =&gt; &quot;guardian&quot; %&gt;
+      &lt;%= link_to_onmousedown_in_tr_td &quot;find or register guardian&quot;, :action =&gt;  'search', :mode =&gt; &quot;guardian&quot; %&gt;
     &lt;% end %&gt;
     &lt;% if @show_find_by_arv_number %&gt;
-      &lt;%= link_to_onmousedown_in_tr_td &quot;Find patient by arv number&quot;, :action =&gt;  'search_by_national_id', :mode =&gt; &quot;patient&quot; %&gt;
+      &lt;%= link_to_onmousedown_in_tr_td &quot;find patient by arv number&quot;, :action =&gt;  'search_by_national_id', :mode =&gt; &quot;patient&quot; %&gt;
     &lt;% end %&gt;
     &lt;% for form in @next_forms %&gt;
       &lt;%= link_to_onmousedown_in_tr_td form.name , :controller =&gt; 'form', :action =&gt;  'show', :id =&gt; form.id %&gt;
     &lt;% end unless @next_forms.nil? %&gt;
 
-    &lt;%= link_to_onmousedown_in_tr_td &quot;Give drugs&quot;, :controller =&gt; &quot;drug_order&quot;, :action =&gt;  'dispense' if @show_dispensation %&gt;
+    &lt;%= link_to_onmousedown_in_tr_td &quot;give drugs&quot;, :controller =&gt; &quot;drug_order&quot;, :action =&gt;  'dispense' if @show_dispensation %&gt;
     &lt;%= link_to_onmousedown_in_tr_td &quot;Print visit summary&quot;,:controller =&gt; &quot;label_printing&quot;,:action=&gt;&quot;print_drug_dispensed&quot; if @show_print_visit_summary and not @next_appointment_date.nil? %&gt;
     &lt;%= link_to_onmousedown_in_tr_td &quot;Update patient outcome&quot;, {:controller =&gt; &quot;patient&quot;, :action =&gt; &quot;update_outcome&quot;}, :id =&gt; &quot;update_patient_status&quot; if @show_update_outcome%&gt;
     &lt;%= link_to_onmousedown_in_tr_td &quot;Lab results&quot;, {:controller =&gt; &quot;patient&quot;, :action =&gt; 'lab_menu'} if  @show_lab_trail%&gt;</diff>
      <filename>app/views/patient/menu.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@ require 'has_many_through_association_extension'
 require 'fixtures'
 require 'float'
 require 'json/add/rails'
+require 'scruffy'
 #require 'cached_model'
 
 if RUBY_PLATFORM =~ /java/</diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -123,8 +123,8 @@ describe PatientController do
     new_patient = @patient
     old_patient = patient(:pete)
     old_patient.set_filing_number
-    patient_controller.printing_message(new_patient,old_patient)
-    response.should have_text(expected_text)
+    expected_text = patient_controller.printing_message(new_patient,old_patient)
+    expected_text.should == &quot;&lt;div id='patients_info_div'&gt;\n     &lt;table&gt;\n       &lt;tr&gt;&lt;td class='filing_instraction'&gt;Filing actions required&lt;/td&gt;&lt;td class='filing_instraction'&gt;Name&lt;/td&gt;&lt;td&gt;Old Label&lt;/td&gt;&lt;td&gt;New label&lt;/td&gt;&lt;/tr&gt;\n       &lt;tr&gt;&lt;td&gt;Move Active &#8594; Dormant&lt;/td&gt;&lt;td class='filing_instraction'&gt;Pete Puma&lt;/td&gt;&lt;td  class='old_label'&gt;&lt;p class=active_heading&gt;MPC Active&lt;/p&gt;&lt;b&gt;&lt;/b&gt;&lt;/td&gt;&lt;td  class='new_label'&gt;&lt;p class=dormant_heading&gt;MPC Dormant&lt;/p&gt;&lt;b&gt;0 00 01&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;  \n      &lt;tr&gt;&lt;td&gt;Move Dormant &#8594; Active&lt;/td&gt;&lt;td class='filing_instraction'&gt;Andreas Jahn&lt;/td&gt;&lt;td  class='old_label'&gt;&lt;p class=dormant_heading&gt;MPC Dormant&lt;/p&gt;&lt;b&gt;0 00 01&lt;/b&gt;&lt;/td&gt;&lt;td  class='new_label'&gt;&lt;p class=active_heading&gt;MPC Active&lt;/p&gt;&lt;b&gt;0 00 01&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;\n       &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;button class='page_button' onmousedown='print_filing_numbers();'&gt;Print&lt;/button&gt;&lt;/td&gt;&lt;td&gt;&lt;button  class='page_button' onmousedown='next_page();'&gt;Done&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;\n     &lt;/table&gt;&quot;
   end
 
 end</diff>
      <filename>spec/controllers/patient_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -281,7 +281,8 @@ module ZebraPrinter #:nodoc:
 
   class StandardLabel &lt; Label  
     def initialize()
-      super(801, 329, 'T')
+      dimensions = (GlobalProperty.find_by_property(&quot;label_width_height&quot;).property_value rescue nil || &quot;801,329&quot;).split(&quot;,&quot;).collect{|d|d.to_i}
+      super(dimensions.first, dimensions.last, 'T')
     end  
   end
   </diff>
      <filename>vendor/plugins/zebra_printer/lib/zebra_printer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>40db25f59c66dc22c95824dc8d01a8277d7df562</id>
    </parent>
  </parents>
  <author>
    <name>ice</name>
    <email>mwatha@baobabhealth.org</email>
  </author>
  <url>http://github.com/baobab/bart/commit/8c0fdbe16f7c93a98231d5b2bf078824c6f4b78d</url>
  <id>8c0fdbe16f7c93a98231d5b2bf078824c6f4b78d</id>
  <committed-date>2008-10-16T07:54:09-07:00</committed-date>
  <authored-date>2008-10-16T07:54:09-07:00</authored-date>
  <message>adding a new global property &quot;label_width_height&quot;;fixing bugs in controller specs</message>
  <tree>e352146a7857878efebaa3311880f8a76c85f2e9</tree>
  <committer>
    <name>ice</name>
    <email>mwatha@baobabhealth.org</email>
  </committer>
</commit>
