Jump to content

[solved]finance chart


joeri

Recommended Posts

  • Moderators

hello all i am stuck again building a new template i need to change the width of the finance charts and stuff

i alterd every code i found related to that but it keeps the samle width

as you seen in the picture the chart is smaller but the black sheet stays large

regards joeri

Link to comment
Share on other sites

In the template is the object HTML for the breakdown flash chart, like so:


<object width="700" height="450" data="http://www.unityvirtual.net/lib/js/ofc/open-flash-chart.swf" type="application/x-shockwave-flash">
<param name="flashvars" value="data-file=http://www.unityvirtual.net/action.php/finances/viewmonthchart?">
</object>

Have you changed the width and height accordingly? If not, it will overrule any CSS and may be your problem.

For the Balance Sheet, you'll need to edit the HTML as it is also hard-coded in the table properties.

Link to comment
Share on other sites

  • Moderators

in my finance_summarysheet.tpl i have the following standard code

<?php
/*
* DO NOT EDIT THIS TEMPLATE UNLESS:
*   1. YOU HAVE ALOT OF TIME
*   2. YOU DON'T MIND LOSING SOME HAIR
*   3. YOU HAVE BIG BALLS MADE OF STEEL
*
*    It can cause incontinence
*
*    YOU HAVE BEEN WARNED!!!
*/
?><?php Template::Show('finance_header.tpl'); ?>
<h3><?php echo $title?></h3>
<?php

   $total = 0;

   $profit = array();
   $pilot_pay = array();
   $revenue = array();    
   $expenses = array();
   $flightexpenses = array();
   $fuelexpenses = array();
   $months=array();

?>
<table width="500px" align="center" class="balancesheet" cellpadding="0" cellspacing="0">

   <tr class="balancesheet_header" style="text-align: center">
       <td width="" align="left">Month</td>
       <td width="" align="center">Flights</td>
       <td width="" align="left">Revenue</td>
       <td width="" align="center" nowrap>Pilot Pay</td>
       <td width="" align="left">Expenses</td>
       <td width="" align="left">Fuel</td>
       <td width="" align="center">Total</td>
   </tr>

<?php
echo '<pre>';
//print_r($allfinances);
echo '</pre>';
foreach ($allfinances as $month)
{
?>
   <tr>
       <td align="right">
           <?php
           echo $month->ym;
           ?>
       </td>
       <td align="center">
       <?php
           echo $month->total;
       ?>
       </td>
       <td align="right" nowrap>
           <?php
           echo FinanceData::FormatMoney($month->gross);
           ?>
       </td>
       <td align="right" nowrap>
           <?php
           echo FinanceData::FormatMoney(-1 * $month->pilotpay);
           ?>
       </td>
       <td align="right" nowrap>
           <?php
           echo FinanceData::FormatMoney((-1) * $month->expenses_total);
           ?>
       </td>
       <td align="right" nowrap>
           <?php
           echo FinanceData::FormatMoney((-1) * $month->fuelprice);
           ?>
       </td>
       <td align="right" nowrap>
           <?php
           $profit[] = round($month->revenue, 2);
           $total += $month->revenue;
           echo FinanceData::FormatMoney($month->revenue);
           ?>
       </td>
   </tr>
<?php
}
?>
<tr class="balancesheet_header" style="border-bottom: 1px dotted">
   <td align="" colspan="8" style="padding: 1px;"></td>
</tr>

<tr>
   <td align="right" colspan="6"><strong>Total:</strong></td>
   <td align="right" colspan="2"><strong><?php echo FinanceData::FormatMoney($total);?></strong></td>
</tr>

</table>

<h3>Breakdown</h3>
<div align="center">
<?php
/*
   Added in 2.0!
*/
$chart_width = '500';
$chart_height = '500';

/* Don't need to change anything below this here */
?>
<div align="center" style="width: 100%;">
   <div align="center" id="summary_chart"></div>
</div>

<script type="text/javascript" src="<?php echo fileurl('/lib/js/ofc/js/json/json2.js')?>"></script>
<script type="text/javascript" src="<?php echo fileurl('/lib/js/ofc/js/swfobject.js')?>"></script>
<script type="text/javascript">
swfobject.embedSWF("<?php echo fileurl('/lib/js/ofc/open-flash-chart.swf');?>",
   "summary_chart", "<?php echo $chart_width;?>", "<?php echo $chart_height;?>",
   "9.0.0", "expressInstall.swf",
   {"data-file":"<?php echo actionurl('/finances/viewmonthchart?'.$_SERVER['QUERY_STRING']); ?>"});
</script>
<?php
/* End added in 2.0
*/
?>
</div>

i have tried multiple times to alter al width lines(mainly line 27) but nothing works

i don't have anny flash chart in there or i am looking in the wrong tpl

regards

Link to comment
Share on other sites

Topic says solved, but just so others might see the solution. In the template above, you've got the width hardcoded into the HTML code for the table like so:

<table width="500px" align="center" class="balancesheet" cellpadding="0" cellspacing="0">

If you change 500 to whatever you need, that'll change the table width.

The code for the flash chart is at the bottom in the javascript:

<script type="text/javascript">
swfobject.embedSWF("<?php echo fileurl('/lib/js/ofc/open-flash-chart.swf');?>",
	"summary_chart", "<?php echo $chart_width;?>", "<?php echo $chart_height;?>",
	"9.0.0", "expressInstall.swf",
	{"data-file":"<?php echo actionurl('/finances/viewmonthchart?'.$_SERVER['QUERY_STRING']); ?>"});
</script>

It's calling two PHP variables, which are assigned just a few lines above:

$chart_width = '500';
$chart_height = '500';

So just change those numbers to the width and height you want your flash chart to be.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...