";
$appt_table_data = "";
- $total_elders=0; $elders_with_yearly_ppi=0;
+ $total_comps=0; $comps_with_quarterly_int=0;
// Display a scheduling table for each district
for ($d=0; $d < count($districts); $d++) {
@@ -1261,13 +1277,13 @@ class eq
$this->t->set_var('district_number',$districts[$d]['district']);
$this->t->set_var('district_name',$districts[$d]['name']);
$supervisor = $districts[$d]['supervisor'];
- $table_title = "District ".$districts[$d]['district'].": ".$districts[$d]['name'].": All Elders with Yearly PPI Not Completed";
- $appt_table_title = "District ".$districts[$d]['district'].": ".$districts[$d]['name'].": Yearly PPI Appointment Slots";
+ $table_title = "District ".$districts[$d]['district'].": ".$districts[$d]['name'].": All Elders with Interviews Not Completed";
+ $appt_table_title = "District ".$districts[$d]['district'].": ".$districts[$d]['name'].": Interview Appointment Slots";
$this->t->set_var('table_title',$table_title);
$this->t->set_var('appt_table_title',$appt_table_title);
// query the database for all the appointments
- $sql = "SELECT * FROM eq_appointment where district=".$districts[$d]['district']." and date>=CURDATE() ORDER BY date ASC, time ASC";
+ $sql = "SELECT * FROM eq_appointment where presidency=".$districts[$d]['presidency']." and date>=CURDATE() ORDER BY date ASC, time ASC";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
@@ -1290,10 +1306,10 @@ class eq
$appt_table_data.= '
';
@@ -1308,105 +1324,143 @@ class eq
$this->t->set_var('appt_header_row',$appt_header_row);
$this->t->set_var('appt_table_width',$appt_table_width);
- // PPI SCHEDULING TABLE
- $sql = "SELECT * FROM eq_elder where valid=1 ORDER BY ppi_pri ASC";
- $this->db->query($sql,__LINE__,__FILE__);
+ // INTERVIEW SCHEDULING TABLE
- $i=0;
- $elder_id = NULL;
+ // Select all the unique companionship numbers for this district
+ $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $districts[$d]['district'];
+ $this->db->query($sql,__LINE__,__FILE__);
+ $j=0;
while ($this->db->next_record())
{
- $sql2 = "SELECT * FROM eq_companionship where valid=1 and elder=".$this->db->f('elder');
- $this->db2->query($sql2,__LINE__,__FILE__);
-
- if(((!$this->db2->next_record()) && ($d == count($districts) - 1)) ||
- ($this->db2->f('district') == $districts[$d]['district'])) {
- $elder_id[$i] = $this->db->f('elder');
- $elder_name[$i] = $this->db->f('name');
- $elder_phone[$elder_id[$i]] = $this->db->f('phone');
- $elder_ppi_pri[$elder_id[$i]] = $this->db->f('ppi_pri');
- $elder_ppi_notes[$elder_id[$i]] = $this->db->f('ppi_notes');
- $i++;
- $total_elders++;
- }
+ $unique_companionships[$j]['companionship'] = $this->db->f('companionship');
+ $j++;
}
- $max = count($elder_id);
-
- for($i=0; $i < $max; $i++) {
- $id = $elder_id[$i];
- $name = $elder_name[$i];
- $phone = $elder_phone[$id];
- $ppi_pri = $elder_ppi_pri[$id];
- $ppi_notes = $elder_ppi_notes[$id];
+ $i=0;
+ for ($j=0; $j < count($unique_companionships); $j++) {
+ // Select all the companions from each companionship
+ $sql = "SELECT * FROM eq_companionship where valid=1 and ".
+ "companionship=". $unique_companionships[$j]['companionship'];
+ $this->db->query($sql,__LINE__,__FILE__);
+ $k=0; $int_completed=0;
+ $comp = $unique_companionships[$j]['companionship'];
+ $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
+ $this->t->set_var('tr_color',$tr_color);
+ $total_comps++;
+ while ($this->db->next_record())
+ {
+ // Get this companions information
+ $elder_id = $this->db->f('elder');
+ $aaronic_id = $this->db->f('aaronic');
+
+ $sql = "SELECT * FROM eq_elder where elder=$elder_id";
+ $this->db2->query($sql,__LINE__,__FILE__);
+ if($this->db2->next_record())
+ {
+ $elder_id = $this->db2->f('elder');
+ $elder_name = $this->db2->f('name');
+ $elder_phone[$elder_id] = $this->db2->f('phone');
+ $elder_int_pri[$elder_id] = $this->db2->f('int_pri');
+ $elder_int_notes[$elder_id] = $this->db2->f('int_notes');
+ $elder_aaronic = 0;
+ }
+ else {
+ $sql = "SELECT * FROM eq_aaronic where aaronic=$aaronic_id";
+ $this->db2->query($sql,__LINE__,__FILE__);
+ if($this->db2->next_record())
+ {
+ $elder_id = $this->db2->f('aaronic');
+ $elder_name = $this->db2->f('name');
+ $elder_phone[$elder_id] = $this->db2->f('phone');
+ $elder_aaronic = 1;
+ }
+ }
- // 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.= "