%( $Id: anclist_afm.txt mickroue(a)yahoo.fr 20131203 templ=templm %)
  
%( %import;anclist_deslist_stat_age %)
%( begin $Id: anclist_deslist_stat_age.txt mickroue(a)yahoo.fr 20131203 templ=templm %)

%define;stat_age1()
  <div class="col">
    110<br%/>100<br%/>90<br%/>80<br%/>
    70<br%/>60<br%/>50<br%/>40<br%/>
    30<br%/>20<br%/>10<br%/>0
  </div>
  <div class="body">
    %reset_count;
    %foreach;sorted_list_item;
      %if;(item.1 = 0)
        %incr_count;
        %if;(next_item.2 != item.2)
          %let;l_width0;%expr(count * l_size)%in;
          %let;l_width;%if;(l_width0 > max_width)%max_width;%else;%l_width0;%end;%in;
          <span class="a%item.1;%item.2;" style="border-left:solid %l_width;px #4682B4;">%count;</span>
          %reset_count;
        %end;
      %end;
      %if;(item.1 = 1)
        %incr_count;
        %if;(next_item.2 != item.2)
          %let;l_width0;%expr(count * l_size)%in;
          %let;l_width;%if;(l_width0 > max_width)%max_width;%else;%l_width0;%end;%in;
          <span class="a%item.1;%item.2;" style="border-left:solid %l_width;px #FF69B4;">%count;</span>
          %reset_count;
        %end;
      %end;
    %end;
  </div>
%end;

%define;stat_age2()
  %let;l_height;%expr(40 + (count *2))%in;
  <div class="body bcbg1" style="height:%l_height;px;">
    %reset_count;
    %foreach;sorted_list_item;
      %incr_count;
      %let;l_top;%expr(20 + (count * 2))%in;
      %let;l_left0;%expr(20 + item.2 * 8)%in;
      %let;l_left;%if;(l_left0 > 840)840%else;%l_left0;%end;%in;
      %if;(count = 1)
        <span class="date">%item.1;</span>
        <span class="lev">%level;</span>
      %end;
      %if;(next_item.1 = "")<span class="date" style="top:%l_top;px;">%item.1;</span>%end;
      <a href="%prefix;i=%item.4;" class="link"
         style="color:#%if;(item.3 = 0)4682B4;%else;FF69B4%end;;left:%l_left;px;top:%l_top;px;">%item.2;</a>
    %end;
  </div>
%end;
%( end $Id: anclist_deslist_stat_age.txt mickroue(a)yahoo.fr 20131203 templ=templm %)  
%( age father mother by generation tf1 = afm %)
%apply;gen()
%reset_count;
%empty_sorted_list;
%foreach;ancestor_level(l_v)
  %if;(level > 1 and (evar.only != "on" or level = l_v))
    %foreach;ancestor;
      %if;(ancestor.same = "" and ancestor.has_parents)
        %let;l_aby;%if;(ancestor.birth_date.year = "" or ancestor.birth_date.prec = ".." or ancestor.birth_date.prec = "|")0%else;%ancestor.birth_date.year;%end;%in;
        %let;l_fby;%if;(ancestor.father.birth_date.year = "" or ancestor.father.birth_date.prec = ".." or ancestor.father.birth_date.prec = "|")9999%else;%ancestor.father.birth_date.year;%end;%in;
        %let;l_mby;%if;(ancestor.mother.birth_date.year = "" or ancestor.mother.birth_date.prec = ".." or ancestor.mother.birth_date.prec = "|")9999%else;%ancestor.mother.birth_date.year;%end;%in;
        %if;(l_aby > l_fby)
          %incr_count;
          %let;l_age;%expr((l_aby - l_fby)/10)%in;
          %apply;add_in_sorted_list(0,l_age,ancestor.father.index,count)
        %end;
        %if;(l_aby > l_mby)
          %incr_count;
          %let;l_age;%expr((l_aby - l_mby)/10)%in;
          %apply;add_in_sorted_list(1,l_age,ancestor.mother.index,count)
        %end;
      %end;
    %end;
  %end;
%end;
%let;max_width;360%in;
%let;l_size;%expr(36 / ((40 + count) / 4 / 10))%in;
<div class="stat_age1 bcbg1">
  <table class="title" width="100%%"><tr>
  <td>[*age]</td>
  <td align="center">[*age]
    (<span style="color:#4682B4;"/>[father/mother]0</span>,
     <span style="color:#FF69B4;"/>[father/mother]1</span>)</td>
  <td align="right"><em>%count; [date/dates]1</em></td>
  </tr></table>
  %apply;stat_age1()
</div>
<div class="stat_age2 bcbg1">
  <table class="title" width="100%%"><tr>
    <td>[*generation/generations]0</td>
    <td align="center">[*age]
        (<span style="color:#4682B4;"/>[father/mother]0</span>,
         <span style="color:#FF69B4;"/>[father/mother]1</span>)</td>
    <td align="right">[*date of birth]</td>
  </tr></table>
  %foreach;ancestor_level(l_v)
    %empty_sorted_list;
    %reset_count;
    %if;(level > 1 and (evar.only != "on" or level = l_v))
      %foreach;ancestor;
        %if;(ancestor.same = "" and ancestor.has_parents)
          %let;l_aby;%if;(ancestor.birth_date.year = "" or ancestor.birth_date.prec = ".." or ancestor.birth_date.prec = "|")0%else;%ancestor.birth_date.year;%end;%in;
          %let;l_fby;%if;(ancestor.father.birth_date.year = "" or ancestor.father.birth_date.prec = ".." or ancestor.father.birth_date.prec = "|")9999%else;%ancestor.father.birth_date.year;%end;%in;
          %let;l_mby;%if;(ancestor.mother.birth_date.year = "" or ancestor.mother.birth_date.prec = ".." or ancestor.mother.birth_date.prec = "|")9999%else;%ancestor.mother.birth_date.year;%end;%in;
          %if;(l_aby >= l_fby)
            %incr_count;
            %let;l_age;%expr(l_aby - l_fby)%in;
            %apply;add_in_sorted_list(l_aby,l_age,0,ancestor.index,count)
          %end;
          %if;(l_aby >= l_mby)
            %incr_count;
            %let;l_age;%expr(l_aby - l_mby)%in;
            %apply;add_in_sorted_list(l_aby,l_age,1,ancestor.index,count)
          %end;
        %end;
      %end;
      %apply;stat_age2()
    %end;
  %end;
</div>