public function timeline()
 {
     $isin = isset($_REQUEST['id']) ? $_REQUEST['id'] : $_REQUEST['isin'];
     $conn = $this->get_connection();
     $transaction_factory = new Transaction();
     $transaction = $transaction_factory->find_all(array('where_clause' => "`isin` = '{$conn->escape($isin)}'", 'order_by' => '`data` ASC', 'limit' => 1))[0];
     if ($transaction) {
         $month_from = date('Y-m-01', strtotime($transaction->data));
     } else {
         $month_from = date('Y-m-01');
     }
     $bond = new Bond();
     $bond->find_by_id($isin);
     // print_r($bond);
     $month_to = date('Y-m-d', mktime(0, 0, 0, date('m', strtotime($bond->scadenza)) + 1, 0, date('Y', strtotime($bond->scadenza))));
     // FIXME: avoid redirects
     $this->redirect_to(array('action' => 'index', 'query_string' => QueryString::from_assoc(array('isin' => $isin, 'month-from' => $month_from, 'month-to' => $month_to))));
 }
 /**
  *  @fn browse
  *  @short Browses an instrument
  *  @details Action to browse an instrument, rendering the graph of the stock
  *  value, as well as specialized views for the instrument type, e.g. issue,
  *  expiration and payment dates for bonds, etc.
  */
 public function browse()
 {
     $conn = $this->get_connection();
     if (!isset($_REQUEST['id'])) {
         $_REQUEST['id'] = $_REQUEST['isin'];
     }
     $this->stock = new Stock();
     if ($this->stock->find_by_id($_REQUEST['id'])) {
         $this->inspect();
         $this->redirect_to(array('action' => 'browse', 'id' => $_REQUEST['id'], 'query_string' => $this->request->querystring, 'after' => 300));
     } else {
         $this->flash('Titolo non trovato. Vuoi aggiungerlo?');
         $this->redirect_to(array('action' => 'add', 'query_string' => QueryString::from_assoc(array('isin' => $_REQUEST['id']))));
     }
 }
Exemple #3
0
?>
">
  <td class="cell10"><input type="checkbox" name="isin[]" value="<?php 
echo $payment->stock->isin;
?>
" /></td>
  <td class="cell10">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td><?php 
print $this->link_to($payment->portfolio_stock->isin, array('controller' => 'titoli', 'action' => 'browse', 'id' => $payment->portfolio_stock->isin));
?>
</td>
        <td>&nbsp;</td>
        <td align="right"><a href="<?php 
echo $this->url_to(array('query_string' => QueryString::from_assoc(array('isin' => $payment->portfolio_stock->isin, 'month-from' => $_REQUEST['month-from'], 'month-to' => $_REQUEST['month-to']))));
?>
"><img src="/img/circled_arrow.png" alt="Filtra" /></a></td>
      </tr>
    </table>
  </td>
  <td class="cell10">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td><?php 
print $this->link_to($payment->stock->title, array('controller' => 'titoli', 'action' => 'browse', 'id' => $payment->stock->isin));
?>
</td>
        <td>&nbsp;</td>
        <td align="right"><?php 
print a('<img src="/img/circled_arrow.png" alt="Modifica" />', array('href' => $this->url_to(array('controller' => 'titoli', 'action' => 'edit', 'id' => $payment->stock->isin))));
Exemple #4
0
    ?>
  </style>
  <div class="by-month">
<?php 
    $month = date('Y-m', strtotime($_REQUEST['month-from']));
    while ($month <= date('Y-m', strtotime($_REQUEST['month-to']))) {
        $month_t = strtotime($month);
        $count = isset($cedole_by_month[$month]) ? $cedole_by_month[$month] : 0;
        $importo = isset($importo_by_month[$month]) ? $importo_by_month[$month] : array();
        ?>
  <div title="<?php 
        printf('%s: %s cedole (%.2f EUR)', $month, $count, $importo);
        ?>
">
    <a href="<?php 
        print $this->url_to(array('query_string' => QueryString::from_assoc(array('month-from' => date('Y-m-d', mktime(0, 0, 0, date('m', $month_t), 1, date('Y', $month_t))), 'month-to' => date('Y-m-d', mktime(0, 0, 0, date('m', $month_t) + 1, 0, date('Y', $month_t)))))));
        ?>
"
      class="month-<?php 
        echo explode('-', $month)[1];
        ?>
 size-<?php 
        echo $month;
        ?>
 <?php 
        if ($month > date('Y-m')) {
            echo 'future';
        }
        ?>
"></a>
    <span><?php 
Exemple #5
0
?>
			</td>
			<td>
				<input type="button" onclick="successivo();return false" title="Successivo [N]" value="&rarr;" />
			</td>
		</tr>
	</table>
	<div class="bucket_nw">
		<div class="bucket_ne">
			<div class="bucket_n"></div>
		</div>
	</div>
	<div class="bucket_w">
		<div class="bucket_e">
			<img id="qimg" src="<?php 
print $this->url_to(array('controller' => 'graph', 'action' => 'quotazione', 'id' => @$_REQUEST['id'], 'query_string' => QueryString::from_assoc(array('view' => @$_REQUEST['view'], 'day' => @$_REQUEST['day'], 'month' => @$_REQUEST['month'], 'year' => @$_REQUEST['year']))));
?>
" alt="Grafico" />

			<p style="text-align:right;margin:0">
				<label for="f_day">Periodo:</label>
				<input type="button" value="&larr;" onclick="prima()" title="Indietro [&larr;]" />
<?php 
$days = array();
for ($i = 1; $i <= 31; $i++) {
    $days[$i] = $i;
}
print select('day', $days, isset($_REQUEST['day']) && !empty($_REQUEST['day']) ? $_REQUEST['day'] : date("d"), array('id' => 'f_day', 'onchange' => "this.form.submit()"));
$months = array();
for ($i = 1; $i <= 12; $i++) {
    $months[$i] = date("F", mktime(0, 0, 0, $i, 1, 0));