Skip to content

Commit

Permalink
Retirando a pergunta de quanto de imposto vc paga.
Browse files Browse the repository at this point in the history
Signed-off-by: Thiago Berlitz Rondon <thiago.rondon@gmail.com>
  • Loading branch information
thiagorondon committed May 17, 2011
1 parent 9eac219 commit 7b74e76
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 223 deletions.
3 changes: 0 additions & 3 deletions lib/CMD/Controller/Data.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ sub node : Chained('base') Args(1) {
sub handle_TREE : Private {
my ( $self, $c ) = @_;

my $imposto = $c->req->query_parameters->{imposto} || 1000;
my $tree = $c->stash->{tree};
my $tt = $c->stash->{tt};
my $total_collection = $c->stash->{total_collection};
Expand Down Expand Up @@ -77,7 +76,6 @@ sub handle_TREE : Private {
# Make tree for openspending javascript.
map {
my $item = $_;
my $valor_usuario = $item->valor * $imposto / $total_collection;
my $valor_porcentagem = $item->valor * 100 / $total;
my $color = shift(@bgcolor) || $bgcolor_default;
my $valor_print = formata_valor( $item->valor );
Expand All @@ -104,7 +102,6 @@ sub handle_TREE : Private {
value => $porcentagem,
printable_value => $valor_print,
porcentagem => $porcentagem,
valor_usuario => formata_real( $valor_usuario, 4 ),
valor_tabela => formata_real( $item->valor ),
link => $link,

Expand Down
11 changes: 6 additions & 5 deletions lib/CMD/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,33 @@ sub programa : Chained('base') Args(1) {
$yyout{$yy} =
$rs->search_rs({ codigo => $collection->codigo,
funcao => $collection->funcao, subfuncao => $collection->subfuncao,
year => $yy })->get_column('valor')->sum;
ano => $yy })->get_column('valor')->sum;
}

my $total = $rs->search_rs({ codigo => $collection->codigo,
funcao => $collection->funcao, subfuncao => $collection->subfuncao,
year => $tt
ano => $tt
})
->get_column('valor')->sum;

my $total_direto = $rs->search_rs({ codigo => $collection->codigo,
funcao => $collection->funcao, subfuncao => $collection->subfuncao,
estado => undef,
year => $tt
ano => $tt
})->get_column('valor')->sum;

my $total_repasse = $rs->search_rs({ codigo => $collection->codigo,
funcao => $collection->funcao, subfuncao => $collection->subfuncao,
estado => { '!=', undef },
year => $tt
ano => $tt
},

)->get_column('valor')->sum;

my $objs = $rs->search({ codigo => $collection->codigo,
funcao => $collection->funcao, subfuncao => $collection->subfuncao,
estado => { '!=' => undef },
year => $tt
ano => $tt
});
my %estado;

Expand Down Expand Up @@ -122,6 +122,7 @@ sub programa : Chained('base') Args(1) {
total_repasse => formata_real($total_repasse),
raw_total_direto => $total_direto || 0,
raw_total_repasse => $total_repasse || 0,
raw_total => $total || 0,
estados => [ @estados ],
yyout => \%yyout
);
Expand Down
20 changes: 1 addition & 19 deletions root/src/node.tt
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,8 @@ getNode([% node %]);
<div id="totais"><div class="total"></div></div>

<br clear="all"/>

<div id="beta">
<p>
<b>Esta é uma versão beta, e ainda estamos trabalhando com a melhoria dos dados e a sincronização deles com o portal da transparência.</b>
</p>
</div>

<div id="quadroimposto">
<p>
<label for="amount">Quanto de imposto federal você pagou ? (de R$ 1.000,00 até R$ 1.000.000,00)</label>
<input type="text" id="amount" value="R$ 1.000,00" style="border:0; color:#f6931f; font-weight:bold;" />
</p>

<div id="imposto"></div>

<br/><br/>
</div>
<br clear="all"/>

<div class="my-new-list"></div>

<br/>


167 changes: 0 additions & 167 deletions root/src/prog.tt

This file was deleted.

3 changes: 2 additions & 1 deletion root/src/root.tt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Base:
</td><td>
<select name="base" id="base" onchange="javascript:base2nodes();">
<option value=""></option>
[% FOREACH item IN bases.all %]
<option value="[% item.id %]">[% item.nome %]</option>
[% END %]
Expand All @@ -33,7 +34,7 @@ Periodo:

<br/><br/>

Faça um tour pelo site!
Nós ajude a construir este site! Entre em <a href="/contato">contato</a> conosco!

<br/><br/>

26 changes: 2 additions & 24 deletions root/static/js/functions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var imposto = 1000;
var last_year = 2010;

function getNode(id) {
Expand Down Expand Up @@ -35,9 +34,9 @@ function showData(data,rdata,url,year) {

var items = [];

items.push('<table id="datalist" class="tablesorter" width="95%" align="center"><thead><tr><th>Descri&ccedil;&atilde;o</th><th>Total de gastos</th><th>Quanto você gastou ?</th><th>Porcentagem nesta vis&atilde;o</th></tr></thead><tbody>');
items.push('<table id="datalist" class="tablesorter" width="95%" align="center"><thead><tr><th>Descri&ccedil;&atilde;o</th><th>Total de gastos</th><th>Porcentagem nesta vis&atilde;o</th></tr></thead><tbody>');
$.each(rdata.children, function(key, val) {
items.push('<tr class="alt"><td width="320">' + '<a href="#">' + val.data.title + '</a></td><td align="right">R$ ' + val.data.valor_tabela + '</td><td align="right">R$ ' + val.data.valor_usuario + '</td><td align="right" width="200">' + val.data.porcentagem + '%</td></tr>');
items.push('<tr class="alt"><td width="320">' + '<a href="#">' + val.data.title + '</a></td><td align="right">R$ ' + val.data.valor_tabela + '</td><td align="right">' + val.data.porcentagem + '%</td></tr>');
});
items.push('</tbody></table>');

Expand Down Expand Up @@ -67,27 +66,6 @@ function showData(data,rdata,url,year) {
$("#datalist").tablesorter();

}
$(document).ready(function() {
$("#imposto").slider ( {
value: 1000,
min: 1000,
max: 1000000,
step: 1000,
slide: function( event, ui ) {
var formated_value = $().number_format(ui.value, {
numberOfDecimals:2,
decimalSeparator: ',',
thousandSeparator: '.',
symbol: 'R$'});
$( "#amount" ).val( formated_value );
imposto = ui.value;
},
change: function( event, ui ) {
getYear(last_year);
}
});

});

function changeYear() {
var url = '/year/' + $('#year').val();
Expand Down
14 changes: 10 additions & 4 deletions root/static/js/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ function redirect2node() {
}
}

function base2nodes() {
var url = '/data/base2nodes/' + $('#base').val();
$('#periodo').hide();
function populate_periodo(url) {
$.getJSON(url, function(ret) {
data = ret.data;
var options = '<option value=""></option>';
Expand All @@ -21,6 +19,14 @@ function base2nodes() {
}
$("select#node").html(options);
});
$('#periodo').show();
}

function base2nodes() {
if ($('#base').val()) {
var url = '/data/base2nodes/' + $('#base').val();
$('#periodo').hide();
populate_periodo(url);
$('#periodo').show();
}
}

0 comments on commit 7b74e76

Please sign in to comment.