Merge branch 'master' of git@github.com:apippin/tc
authorAlan Pippin <apippin@pippins.net>
Mon, 11 Oct 2010 18:33:32 +0000 (12:33 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Mon, 11 Oct 2010 18:33:32 +0000 (12:33 -0600)
inc/class.tc.inc.php
mls/MLSFileTrimmerInstaller.msi
mls/windowsGUI/MLSFileTrimmer/CSVTrimmer.cs
mls/windowsGUI/MLSFileTrimmer/Window1.xaml
mls/windowsGUI/MLSFileTrimmer/Window1.xaml.cs
setup/tc_config
templates/default/ppi_sched.tpl

index f07b9b936a2f0d12ca5b4f19ae71170ebe06fd33..7f2700edac40282d17acb9c66432d995ac87c036 100644 (file)
@@ -35,6 +35,7 @@ class tc
        var $script_path;
        var $max_appointments;
        var $max_presidency_members;
+       var $ppi_frequency_label;
 
        var $public_functions = array
        (
@@ -105,6 +106,18 @@ class tc
                $this->current_month = $this->current_month-0; // Make it numeric
                $this->current_year = `date '+%Y'`;
                $this->current_year = $this->current_year-0; // Make it numeric
+               
+               if ($this->ppi_frequency == 12) {
+                       $this->ppi_frequency_label = "Annual";
+               } else if ($this->ppi_frequency == 6) {
+                       $this->ppi_frequency_label = "Semi-Annual";
+               } else if ($this->ppi_frequency == 3) {
+                       $this->ppi_frequency_label = "Quarterly";
+               } else if ($this->ppi_frequency == 1) {
+                       $this->ppi_frequency_label = "Monthly";
+               } else {
+                       $this->ppi_frequency_label = "Periodic";
+               }
 
                echo parse_navbar();
                $this->display_app_header();    
@@ -825,7 +838,7 @@ class tc
                $this->t->set_var('assignment_data',$assignment_data);
 
                // Create individual selection boxes
-               $sql = "SELECT * FROM tc_individual WHERE steward='$this->default_stewardship'";
+               $sql = "SELECT * FROM tc_individual";
                $this->db->query($sql,__LINE__,__FILE__);
                $i=0;
                while ($this->db->next_record()) {
@@ -1344,13 +1357,13 @@ class tc
                $this->t->set_var('lang_reset','Clear Changes');
 
                $this->t->set_var('ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_view'));
-               $this->t->set_var('ppi_link_title','Yearly PPIs');
+               $this->t->set_var('ppi_link_title',$this->ppi_frequency_label . ' PPIs');
 
                $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched'));
-               $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs');
+               $this->t->set_var('schedule_ppi_link_title','Schedule ' . $this->ppi_frequency_label . ' PPIs');
 
                $this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched&action=save'));
-               $this->t->set_var('title','Yearly PPI Scheduler');
+               $this->t->set_var('title',$this->ppi_frequency_label . ' PPI Scheduler');
 
                $indiv_width=500; $phone_width=25; $pri_width=10; $notes_width=128; $ppi_date_width=20;
                $table_width=$indiv_width + $phone_width + $pri_width + $notes_width + $ppi_date_width;
@@ -1362,6 +1375,10 @@ class tc
                $table_data=""; $completed_data=""; $totals_data="";
 
                $year = date('Y');
+               $month = date('m');
+               $period = intval(($month-1)/$this->ppi_frequency) + 1;
+               $start_of_period = ($period-1)*$this->ppi_frequency + 1;
+               $end_of_period = $period * $this->ppi_frequency;
 
                if($action == 'save') {
                        // Save any changes made to the appointment table
@@ -1454,9 +1471,9 @@ class tc
                  // Display a scheduling table for this presidency member
                  $district_number = '*';
                  $district_name = $presidency_name;
-                 $table_title = "District ".$district_number.": ".$district_name.": All indivs with Yearly PPI Not Completed";
-                 $appt_table_title = "District ".$district_number.": ".$district_name.": Yearly PPI Appointment Slots";
-                 $this->t->set_var('table_title',$table_title);
+                 $not_completed_table_title = "District ".$district_number.": ".$district_name.": All indivs with " . $this->ppi_frequency_label . " PPI Not Completed";
+                 $appt_table_title = "District ".$district_number.": ".$district_name.": ".$this->ppi_frequency_label." PPI Appointment Slots";
+                 $this->t->set_var('not_completed_table_title',$not_completed_table_title);
                  $this->t->set_var('appt_table_title',$appt_table_title);
 
                  // query the database for all the appointments
@@ -1529,7 +1546,7 @@ class tc
                }
 
                $max = count($individual);
-
+               
                for($i=0; $i < $max; $i++) {
                        $id = $individual[$i];
                        $name = $indiv_name[$i];
@@ -1537,9 +1554,10 @@ class tc
                        $priority = $indiv_priority[$id];
                        $notes = $indiv_notes[$id];
 
-                       // If this individual 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 tc_interview WHERE date > '$year_start' AND date < '$year_end' ".
+                       // If this individual has had a PPI this period, don't show him on the schedule list
+                       $year_start = $year . "-" . $start_of_period . "-01";
+                       $year_end = $year . "-" . $end_of_period . "-31";
+                       $sql = "SELECT * FROM tc_interview WHERE date >= '$year_start' AND date <= '$year_end' ".
                               "AND individual=" . $id . " AND interview_type='ppi' ORDER BY date DESC";
                        $this->db2->query($sql,__LINE__,__FILE__);
 
@@ -1605,6 +1623,7 @@ class tc
                        }
                } // End for individuals Loop
 
+               $completed_table_title = "District ".$district_number.": ".$district_name.": All indivs with " . $this->ppi_frequency_label . " PPI Completed";
                $name_width=175; $phone_width=100; $date_width=100; $notes_width=300;
                $completed_table_width=$name_width + $phone_width + $date_width + $notes_width;
                $completed_header_row = "<th width=$name_width><font size=-2>Individual</th>";
@@ -1612,6 +1631,7 @@ class tc
                $completed_header_row.= "<th width=$date_width><font size=-2>Date</th>";
                $completed_header_row.= "<th width=$notes_width><font size=-2>PPI Notes</th>";
 
+               $this->t->set_var('completed_table_title',$completed_table_title);
                $this->t->set_var('table_width',$table_width);
                $this->t->set_var('header_row',$header_row);
                $this->t->set_var('table_data',$table_data);
@@ -1626,7 +1646,7 @@ class tc
                $totals_header_row = "<th width=$indivs_width><font size=-2>Individuals</th>";
                $totals_header_row.= "<th width=$totals_width><font size=-2>$year</th>";
                $totals_data.= "<tr bgcolor=". $this->t->get_var('tr_color') .">";
-               $totals_data.= "<td align=left><font size=-2><b>Total Individuals with yearly PPIs completed:</b></font></td>";
+               $totals_data.= "<td align=left><font size=-2><b>Total Individuals with " . $this->ppi_frequency_label . " PPIs completed:</b></font></td>";
                $totals_data.= "<td align=center><font size=-2><b>$indivs_with_yearly_ppi / $total_indivs</b></font></td>";
                $percent = ceil(($indivs_with_yearly_ppi / $total_indivs)*100);
                $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
@@ -2318,12 +2338,12 @@ class tc
                $this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_view'));
 
                $this->t->set_var('ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_view'));
-               $this->t->set_var('ppi_link_title','Yearly PPIs'); 
+               $this->t->set_var('ppi_link_title',$this->ppi_frequency_label . ' PPIs'); 
 
                $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched'));
-               $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs');
+               $this->t->set_var('schedule_ppi_link_title','Schedule ' . $this->ppi_frequency_label . ' PPIs');
 
-               $this->t->set_var('title','Yearly PPIs');
+               $this->t->set_var('title',$this->ppi_frequency_label . ' PPIs');
                $num_months = get_var('num_months',array('GET','POST'));
                if($num_months == '') { $num_months = $this->default_ppi_num_years; }
                $this->t->set_var('num_months',$num_months);
@@ -3518,7 +3538,7 @@ class tc
                $this->t->set_var('schedule_int_link_title','Schedule Hometeaching Interviews');
 
                $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched'));
-               $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs');
+               $this->t->set_var('schedule_ppi_link_title','Schedule ' . $this->ppi_frequency_label . ' PPIs');
 
                $date_width=160; $time_width=220; $indiv_width=170; $family_width=180; $location_width=100;
                $table_width=$date_width + $time_width + $indiv_width + $family_width + $location_width;
index 5d63238bb79e331a1e39c96aa9b05fd9d559c858..848eabf48624db645e3f84379633addac3ba5311 100644 (file)
Binary files a/mls/MLSFileTrimmerInstaller.msi and b/mls/MLSFileTrimmerInstaller.msi differ
index 9b39874ddda26b0229a475a2e611478b895a6528..97b25c52c3b085f14456b23b16584e123311500c 100644 (file)
@@ -1,9 +1,7 @@
 using System;\r
 using System.Collections;\r
-using System.Collections.Generic;\r
-using System.Linq;\r
-using System.Text;\r
 using System.IO;\r
+using System.Text;\r
 \r
 namespace MLSFileTrimmer\r
 {\r
index 074a27eb1f10214c572d1c9bb47e6784209004c8..13b01b0dc462470deb7a597b9cefe8e48d271953 100644 (file)
@@ -1,13 +1,25 @@
 <Window x:Class="MLSFileTrimmer.Window1"\r
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
-    Title="MLS File Trimmer" Height="200" Width="600" MaxHeight="Infinity" MaxWidth="Infinity" MinHeight="0" MinWidth="0" ResizeMode="CanMinimize">\r
+    Title="MLS File Trimmer" Height="200" Width="600" MaxHeight="Infinity" MaxWidth="Infinity" MinHeight="0" MinWidth="0" ResizeMode="CanResize">\r
     <Grid Background="Silver">\r
-        <Label Margin="20,30,30,0" Name="label4" VerticalAlignment="Top" Height="30">Please specify the directory where the MLS csv files are.</Label>\r
-        <TextBox Margin="20,70,130,60" Name="outputDirtextBox" FlowDirection="LeftToRight" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" TextWrapping="NoWrap" Height="30" />\r
-        <Button Margin="0,70,20,61" Name="outDirButton" HorizontalAlignment="Right" Width="100" Height="30" Click="outDirButton_Click">Browse</Button>\r
-        <Button Margin="0,0,20,20" Name="parseButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="100" Height="30" Click="parseButton_Click">OK</Button>\r
-        <Label Height="28" HorizontalAlignment="Right" Margin="0,27.233,20,0" Name="finishedLabel" VerticalAlignment="Top" Width="100" FontSize="16" Foreground="Red" HorizontalContentAlignment="Center" Visibility="Hidden">Finished!</Label>\r
-        <Label Height="28" HorizontalAlignment="Right" Margin="0,27.233,20,0" Name="trimmingLabel" VerticalAlignment="Top" Width="100" FontSize="16" Foreground="Green" HorizontalContentAlignment="Center" Visibility="Hidden" >Trimming...</Label>\r
+        <Grid.RowDefinitions>\r
+            <RowDefinition Height="1*"/>\r
+            <RowDefinition Height="1*"/>\r
+            <RowDefinition Height="1*"/>\r
+            <RowDefinition Height="1*"/>\r
+        </Grid.RowDefinitions> \r
+        <Grid.ColumnDefinitions>\r
+            <ColumnDefinition Width="80*"/>\r
+            <ColumnDefinition Width="20*"/>\r
+        </Grid.ColumnDefinitions>\r
+        \r
+        <Label Grid.Row="0" Grid.Column="0" Margin="5,5" Name="label4" VerticalAlignment="Center" >Please specify the directory where the MLS csv files are.</Label>\r
+        <TextBox Grid.Row="1" Grid.Column="0" Margin="5,5" Name="outputDirTextBox" FlowDirection="LeftToRight" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" TextWrapping="NoWrap"/>\r
+        <Button Grid.Row="1" Grid.Column="1" Margin="5,5" Name="outDirButton" Click="outDirButton_Click">Browse</Button>\r
+        <Button Grid.Row="2" Grid.Column="1" Margin="5,5" Name="parseButton" Click="parseButton_Click">OK</Button>\r
+        <Button Grid.Row="3" Grid.Column="1" Margin="5,5" Name="exitButton" Click="exitButton_Click">Exit</Button>\r
+        <Label Grid.Row="0" Grid.Column="1" Margin="5,5" Name="finishedLabel" FontSize="16" Foreground="Red" Visibility="Hidden">Finished!</Label>\r
+        <Label Grid.Row="0" Grid.Column="1" Margin="5,5" Name="trimmingLabel" FontSize="16" Foreground="Green" Visibility="Hidden" >Trimming...</Label>\r
     </Grid>\r
 </Window>\r
index 098aa47ccffcab94bc4bb75f41cb6cade824348f..9ababe2165d57d745186243a9938c8a3e7211ecb 100644 (file)
@@ -1,24 +1,13 @@
 using System;\r
-using System.Collections.Generic;\r
-using System.Linq;\r
+using System.ComponentModel;\r
+using System.IO;\r
 using System.Text;\r
+using System.Threading;\r
 using System.Windows;\r
-using System.Windows.Controls;\r
-using System.Windows.Data;\r
-using System.Windows.Documents;\r
-using System.Windows.Input;\r
-using System.Windows.Media;\r
-using System.Windows.Media.Imaging;\r
-using System.Windows.Navigation;\r
-using System.Windows.Shapes;\r
-using Microsoft.Win32;\r
-using System.IO;\r
-using FolderBrowserDialog = System.Windows.Forms.FolderBrowserDialog;\r
-using System.Xml.Serialization;\r
 using System.Xml;\r
+using System.Xml.Serialization;\r
 using Ionic.Zip;\r
-using System.ComponentModel;\r
-using System.Threading;\r
+using FolderBrowserDialog = System.Windows.Forms.FolderBrowserDialog;\r
 \r
 namespace MLSFileTrimmer\r
 {\r
@@ -62,7 +51,7 @@ namespace MLSFileTrimmer
             openFolderDialog.RootFolder = Environment.SpecialFolder.MyDocuments;\r
             if (openFolderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)\r
             {\r
-                outputDirtextBox.Text = openFolderDialog.SelectedPath;\r
+                outputDirTextBox.Text = openFolderDialog.SelectedPath;\r
                 currentDirectory = openFolderDialog.SelectedPath;\r
             }\r
         }\r
@@ -70,14 +59,14 @@ namespace MLSFileTrimmer
         private void parseButton_Click(object sender, RoutedEventArgs e)\r
         {\r
             // make sure the directory exists\r
-            if (outputDirtextBox.Text.Equals(String.Empty))\r
+            if (outputDirTextBox.Text.Equals(String.Empty))\r
             {\r
                 MessageBox.Show("Please select the correct output directory.");\r
                 return;\r
             }\r
-            else if (!Directory.Exists(outputDirtextBox.Text))\r
+            else if (!Directory.Exists(outputDirTextBox.Text))\r
             {\r
-                MessageBox.Show(outputDirtextBox.Text + " does not exist. Please select the correct output directory.");\r
+                MessageBox.Show(outputDirTextBox.Text + " does not exist. Please select the correct output directory.");\r
             }\r
 \r
             // make sure the original files exist\r
@@ -147,5 +136,10 @@ namespace MLSFileTrimmer
             this.trimmingLabel.Visibility = Visibility.Hidden;\r
             this.finishedLabel.Visibility = Visibility.Visible;\r
         }\r
+\r
+        private void exitButton_Click(object sender, RoutedEventArgs e)\r
+        {\r
+            this.Close();\r
+        }\r
     }\r
 }\r
index 19849a213839e2efc22b5eb9656edff024cb5d3b..7b959ae1d8ec139f1a013ab2d2e20be1737ebee2 100644 (file)
@@ -33,6 +33,11 @@ $this->time_drop_down_lists = 1;
 // Examples: Monthly=1 Quarterly=3 Yearly=12
 $this->monthly_hometeaching_interview_stats = 3;
 
+// Frequency of PPIs in months
+// This number must evenly divide 12.
+// Examples: Monthly=1 Quarterly=3 Yearly=12
+$this->ppi_frequency = 12;
+
 // Specify who can hold yearly PPIs
 // 1 = EQ President 
 // 2 = EQ President + Counselors 
index 191a9a2aa76cb7c87157cda9c1b321429a6e4c1b..f694d4fd89d17fd3cb5c3ac8f1cfea5cf50722ee 100644 (file)
@@ -50,7 +50,7 @@
                </tr>
                <tr>
                        <td align="center" bgcolor="#c9c9c9" colspan=20>
-                               <font face="{font}"><b>{table_title}</b></font>
+                               <font face="{font}"><b>{not_completed_table_title}</b></font>
                        </td>
                </tr>
                <tr bgcolor="#c9c9c9"><font face="{font}">{header_row}</tr>
@@ -71,7 +71,7 @@
        <table border="0" width="{completed_table_width}" cellspacing="2" cellpadding="2">
                <tr>
                        <td align="center" bgcolor="#c9c9c9" colspan=20>
-                       <font face="{font}"><b>All Individuals with Yearly PPI Completed</b></font>
+                       <font face="{font}"><b>{completed_table_title}</b></font>
                        </td>
                </tr>
                <tr bgcolor="#c9c9c9"><font face="{font}">{completed_header_row}</tr>