Пример #1
0
 protected static function init()
 {
     include_once CORE_LIB_PATH . '/php-ofc-library/open-flash-chart.php';
     self::$chart = new open_flash_chart();
     self::$y_axis = new y_axis();
     self::$x_axis = new x_axis();
 }
Пример #2
0
 public function pirepcounts()
 {
     # Create the chart
     //$reportcounts = '';
     $data = PIREPData::getIntervalDataByDays(array(), 30);
     if (!$data) {
         $data = array();
         // so it doesn't error out
     }
     $bar_values = array();
     $bar_titles = array();
     foreach ($data as $val) {
         $bar_titles[] = $val->ym;
         $bar_values[] = floatval($val->total);
     }
     OFCharts::add_data_set($bar_titles, $bar_values);
     echo OFCharts::create_line_graph('Past 30 days PIREPS');
 }
Пример #3
0
 /**
  * Pilots::create_line_graph()
  * 
  * @param mixed $title
  * @param mixed $data
  * @return
  */
 protected function create_line_graph($title, $data)
 {
     if (!$data) {
         $data = array();
     }
     $bar_values = array();
     $bar_titles = array();
     foreach ($data as $val) {
         $bar_titles[] = $val->ym;
         $bar_values[] = floatval($val->total);
     }
     OFCharts::add_data_set($bar_titles, $bar_values);
     echo OFCharts::create_area_graph($title);
 }
Пример #4
0
 public function viewmonthchart()
 {
     $params = $this->formfilter();
     /**
      * Check the first letter in the type
      * m#### - month
      * y#### - year
      * 
      * No type indicates to view the 'overall'
      */
     $type = $this->get->type;
     if ($type[0] == 'y') {
         $type = str_replace('y', '', $type);
         $year = date('Y', $type);
         $finance_data = $this->getyearly($year);
         $title = 'Activity for ' . $year;
     } else {
         // This should be the last 3 months overview
         # Get the last 3 months
         $months = 3;
         $params['p.accepted'] = PIREP_ACCEPTED;
         $finance_data = PIREPData::getIntervalDataByMonth($params, $months);
         $title = 'Recent Activity';
     }
     $titles = array();
     $gross_data = array();
     $fuel_data = array();
     $expense_data = array();
     foreach ($finance_data as $month) {
         $titles[] = $month->ym;
         $gross_data[] = intval($month->revenue);
         $fuel_data[] = intval($month->fuelprice);
         $expense_data[] = intval($month->expenses_total);
     }
     // Add each set
     OFCharts::add_data_set($titles, $gross_data, 'Total Revenue', '#FF6633');
     OFCharts::add_data_set($titles, $expense_data, 'Expenses', '#2EB800');
     OFCharts::add_data_set($titles, $fuel_data, 'Fuel Costs', '#008AB8');
     //echo OFCharts::create_line_graph('Months Balance Data');
     echo OFCharts::create_area_graph($title);
 }
Пример #5
0
foreach ($month_data->expenses as $expense) {
    ?>
		
	<tr>
		<td align="right"><?php 
    echo $expense->name . '<br />' . $type[$expense->type];
    ?>
: </td>
		<td align="right"> <?php 
    echo str_replace('$', Config::Get('MONEY_UNIT'), FinanceData::FormatMoney(-1 * $expense->total));
    ?>
</td>
	</tr>
	<?php 
    # Load charts data too
    OFCharts::add_data_set($expense->name, $expense->total);
}
?>
	<tr class="balancesheet_header" style="border-bottom: 1px dotted">
		<td align="" colspan="2" style="padding: 1px;"></td>
	</tr>
	<tr>
		<td align="right"><strong>Expenses Total:</strong></td>
		<td align="right"> <?php 
echo str_replace('$', Config::Get('MONEY_UNIT'), FinanceData::FormatMoney(-1 * $month_data->expenses_total));
?>
</td>
	</tr>
	
	<tr class="balancesheet_header">
		<td align="" colspan="2">Totals</td>