- // If this elder has had a yearly PPI this year, don't show him on the schedule list
- $year_start = $year - 1 . "-12-31"; $year_end = $year + 1 . "-01-01";
- $sql = "SELECT * FROM eq_ppi WHERE date > '$year_start' AND date < '$year_end' ".
- "AND elder=" . $id;
- $this->db2->query($sql,__LINE__,__FILE__);
-
- if(!$this->db2->next_record()) {
- $sql = "SELECT * FROM eq_ppi WHERE elder=" . $id . " ORDER BY date DESC";
- $this->db->query($sql,__LINE__,__FILE__);
- if($this->db->next_record()) { $date = $this->db->f('date'); } else { $date = ""; }
- $link_data['menuaction'] = 'eq.eq.ppi_update';
- $link_data['elder'] = $id;
- $link_data['aaronic'] = 0;
- $link_data['name'] = $name;
- $link_data['ppi'] = '';
- $link_data['eqpresppi'] = 1;
- $link_data['action'] = 'add';
- $link = $GLOBALS['phpgw']->link('/eq/index.php',$link_data);
- $table_data.= "<tr bgcolor=". $this->t->get_var('tr_color') ."><td title=\"$phone\"><a href=$link>$name</a></td>";
- $table_data.= "<td align=center>$phone</td>";
- //$table_data.= "<td align=center>$ppi_pri</td>";
- $table_data.= "<td align=center>";
- $table_data.= '<select name=ppi_notes['.$i.'][pri]>';
- foreach(range(0,6) as $num) {
- if($num == 0) { $num = 1; } else {$num = $num*5; }
- if($ppi_pri == $num) { $selected[$num] = 'selected="selected"'; } else { $selected[$num] = ''; }
- $table_data.= '<option value='.$num.' '.$selected[$num].'>'.$num.'</option>';
+ $id = $elder_id;
+ $name = $elder_name;
+ $phone = $elder_phone[$id];
+ $int_pri = $elder_int_pri[$id];
+ $int_notes = $elder_int_notes[$id];
+ $aaronic = $elder_aaronic;
+
+ // If the companionship has already had its quarterly interview,
+ // Skip the other companion in the companionship.
+ if($int_completed == 1) {
+ $completed_data.= "<tr bgcolor=". $this->t->get_var('tr_color2') ."><td title=\"$phone\"><a href=$link>$name</a></td>";
+ $completed_data.= "<td align=center>$phone</td>";
+ $completed_data.= "<td align=center><a href=".$link.">$date</a></td>";
+ $completed_data.= "<td align=left>$int_notes</td>";
+ $completed_data.= '</tr>';
+ $tr_color2 = $this->nextmatchs->alternate_row_color($tr_color2);
+ $this->t->set_var('tr_color2',$tr_color2);
+ $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
+ $this->t->set_var('tr_color',$tr_color);
+ continue;
+ }
+
+ // If this companionship has had a hometeaching interview this quarter, don't show them on the schedule list
+ $sql = "SELECT * FROM eq_interview WHERE date >= '$quarter_start' AND date < '$quarter_end' ".
+ "AND elder=" . $id;
+ $this->db2->query($sql,__LINE__,__FILE__);
+
+ if(!$this->db2->next_record()) {
+ $sql = "SELECT * FROM eq_interview WHERE elder=" . $id . " ORDER BY date DESC";
+ $this->db3->query($sql,__LINE__,__FILE__);
+ if($this->db3->next_record()) { $date = $this->db3->f('date'); } else { $date = ""; }
+ $link_data['menuaction'] = 'eq.eq.int_update';
+ $link_data['elder'] = $id;
+ $link_data['aaronic'] = 0;
+ $link_data['name'] = $name;
+ $link_data['interview'] = '';
+ $link_data['action'] = 'add';
+ $link = $GLOBALS['phpgw']->link('/eq/index.php',$link_data);
+ $table_data.= "<tr bgcolor=". $this->t->get_var('tr_color') ."><td title=\"$phone\"><a href=$link>$name</a></td>";
+ $table_data.= "<td align=center>$phone</td>";
+ $table_data.= "<td align=center>";
+ $table_data.= '<select name=int_notes['.$i.'][pri]>';
+ foreach(range(0,6) as $num) {
+ if($num == 0) { $num = 1; } else {$num = $num*5; }
+ if($int_pri == $num) { $selected[$num] = 'selected="selected"'; } else { $selected[$num] = ''; }
+ $table_data.= '<option value='.$num.' '.$selected[$num].'>'.$num.'</option>';
+ }
+ $table_data.= '</select></td>';
+ $table_data.= "<td align=center>$date</td>";
+ $table_data.= '<td><input type=text size="50" maxlength="128" name="int_notes['.$i.'][notes]" value="'.$int_notes.'">';
+ $table_data.= '<input type=hidden name="int_notes['.$i.'][elder_id]" value="'.$id.'">';
+ $table_data.= '<input type=hidden name="int_notes['.$i.'][elder_name]" value="'.$name.'">';
+ $table_data.= '<input type=hidden name="int_notes['.$i.'][aaronic]" value="'.$aaronic.'">';
+ $table_data.= '</td>';
+ $table_data.= '</tr>';
+ $i++;
+ } else {
+ $link_data['menuaction'] = 'eq.eq.int_update';
+ $link_data['interviewer'] = $this->db2->f('interviewer');
+ $link_data['elder'] = $this->db2->f('elder');
+ $link_data['aaronic'] = $this->db2->f('aaronic');
+ $link_data['name'] = $name;
+ $link_data['interview'] = $this->db2->f('int');
+ $link_data['action'] = 'view';
+ $link = $GLOBALS['phpgw']->link('/eq/index.php',$link_data);
+ $comps_with_quarterly_int++;
+ $int_completed=1;
+ $date = $this->db2->f('date');
+ $int_notes = $this->db2->f('notes');
+ if(strlen($int_notes) > 40) { $int_notes = substr($int_notes,0,40) . "..."; }
+ $completed_data.= "<tr bgcolor=". $this->t->get_var('tr_color2') ."><td title=\"$phone\"><a href=$link>$name</a></td>";
+ $completed_data.= "<td align=center>$phone</td>";
+ $completed_data.= "<td align=center><a href=".$link.">$date</a></td>";
+ $completed_data.= "<td align=left>$int_notes</td>";
+ $completed_data.= '</tr>';
+ }