~intrahealth+informatics/ihris-plan/1.0.4-release

« back to all changes in this revision

Viewing changes to lib/iHRIS_PageProjectionReport.php

  • Committer: Luke Duncan
  • Date: 2008-09-05 14:50:25 UTC
  • Revision ID: lduncan@intrahealth.org-20080905145025-w16mkedzeud0i8u2
Added initial projection lines to the model page to show how the projection looked as of the initial year.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
            $cost = array( "" => "Total Cost" );
74
74
            $orig = array( "" => "Supply (Original)" );
75
75
            $orig_cost = array( "" => "Total Cost (Original)" );
 
76
            $init_required = array( "" => "");
 
77
            $init_supply = array( "" => "");
76
78
            $breakdown = array();
77
79
            $axis = array_merge( array( "" ), array_keys( $population['pop'] ) );
 
80
            $use_initial = false;
78
81
            foreach( $this->projection->children['pool'] as $pool ) {
79
82
                if ( in_array( $pool->getId(), $ids ) ) {
80
83
                    /*
88
91
                            */
89
92
                    $pool_data = $pool->projectPool( $includes );
90
93
                    $orig_data = $pool->projectPool();
 
94
                    $use_pool_initial = false;
 
95
                    if ( count( $pool_data['real']['begin_supply'] ) > 1 || count( $pool_data['real']['target'] ) + count( $pool_data['real']['ratio'] ) > 1 ) {
 
96
                        $years = array_keys( $population['pop'] );
 
97
                        $initial_data = $pool->projectPool( $includes, $years[0] );
 
98
                        $use_pool_initial = true;
 
99
                        $use_initial = true;
 
100
                        $init_required[""] = "Required (" . $years[0] . ")";
 
101
                        $init_supply[""] = "Supply (" . $years[0] . ")";
 
102
                    }
91
103
                    foreach( $population['pop'] as $year => $pop ) {
92
104
                        $required[$year] += $pool_data['target'][$year];
93
105
                        $supply[$year] += $pool_data['begin_supply'][$year];
97
109
                        $cost_title = I2CE_List::lookup( $year_cost[0], 'currency' );
98
110
                        $orig_year_cost = $orig_data['total_cost'][$year]->getValue();
99
111
                        $orig_cost[$year] += $orig_year_cost[1];
 
112
                        if ( $use_pool_initial ) {
 
113
                            $init_required[$year] += $initial_data['target'][$year];
 
114
                            $init_supply[$year] += $initial_data['begin_supply'][$year];
 
115
                        } else {
 
116
                            $init_required[$year] += $pool_data['target'][$year];
 
117
                            $init_supply[$year] += $pool_data['begin_supply'][$year];
 
118
                        }
 
119
                        
100
120
 
101
121
                        /*
102
122
                        $breakdown[$pool->getId()]['required'][$year] = $pool_data['target'][$year];
158
178
                    }
159
179
                } else {
160
180
                */
161
 
                    $chart['chart_data'] = array( $axis, $required, $supply );
 
181
                    $chart['chart_data'] = array( $axis );
 
182
                    if ( $use_initial ) {
 
183
                        $chart['chart_data'][] = $init_required;
 
184
                        $chart['chart_data'][] = $init_supply;
 
185
                        $chart['series_color'][] = "480220";
 
186
                        $chart['series_color'][] = "262f34";
 
187
                    }
 
188
                    $chart['chart_data'][] = $required;
 
189
                    $chart['chart_data'][] = $supply;
 
190
                    $chart['series_color'][] = "a30649";
 
191
                    $chart['series_color'][] = "69808f";
162
192
                    if ( count( array_diff_assoc( $supply, $orig ) ) > 1 ) {
163
193
                        $chart['chart_data'][2][""] .= " (Modified)";
 
194
                        if ( $use_initial ) {
 
195
                            $chart['chart_data'][4][""] .= " (Modified)";
 
196
                        }
164
197
                        $chart['chart_data'][] = $orig;
 
198
                        $chart['series_color'][] = "06a349";
165
199
                    }
166
 
                    $chart['series_color'] = array( "a30649", "69808f", "06a349" );
167
200
                /* } */
168
201
                $chart['axis_category'] = array( "size" => 10, "orientation" => "diagonal_down" );
169
202
            }
307
340
                        }
308
341
    
309
342
                        $this->dataCell( $target_row, $data['target'][$year], "bold", $data['real']['target'][$year] );
310
 
                        $this->dataCell( $tpp_row, $data['target_per_pop'][$year] );
 
343
                        $this->dataCell( $tpp_row, $data['target_per_pop'][$year], "bold", $data['real']['ratio'][$year] );
311
344
    
312
345
                        $this->dataCell( $begin_row, $data['begin_supply'][$year], "bold" . ($data['begin_supply'][$year] < $data['target'][$year] ? "_red" : "_green" ), $data['real']['begin_supply'][$year] );
313
346
                        $this->dataCell( $bpp_row, ($data['begin_supply'][$year] > 0 ? round( $pop / $data['begin_supply'][$year] ) : 0 ) );