bug #6054 - Add a filter by active budget on acqui-home
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
4268fd376f
commit
7cc7fb8c99
2 changed files with 58 additions and 6 deletions
|
@ -88,6 +88,11 @@ my $totordered = 0;
|
|||
my $totcomtd = 0;
|
||||
my $totavail = 0;
|
||||
|
||||
my $total_active = 0;
|
||||
my $totspent_active = 0;
|
||||
my $totordered_active = 0;
|
||||
my $totavail_active = 0;
|
||||
|
||||
foreach my $budget ( @{$budget_arr} ) {
|
||||
|
||||
$budget->{budget_code_indent} =~ s/\ /\ \;/g;
|
||||
|
@ -121,6 +126,13 @@ foreach my $budget ( @{$budget_arr} ) {
|
|||
$totordered += $budget->{'budget_ordered'};
|
||||
$totavail += $budget->{'budget_avail'};
|
||||
|
||||
if ($budget->{budget_period_active}){
|
||||
$total_active += $budget->{'budget_amount'};
|
||||
$totspent_active += $budget->{'budget_spent'};
|
||||
$totordered_active += $budget->{'budget_ordered'};
|
||||
$totavail_active += $budget->{'budget_avail'};
|
||||
}
|
||||
|
||||
for my $field (qw( budget_amount budget_spent budget_ordered budget_avail ) ) {
|
||||
$budget->{$field} = $num_formatter->format_price( $budget->{$field} );
|
||||
}
|
||||
|
@ -135,7 +147,11 @@ $template->param(
|
|||
totordered => $num_formatter->format_price($totordered),
|
||||
totcomtd => $num_formatter->format_price($totcomtd),
|
||||
totavail => $num_formatter->format_price($totavail),
|
||||
suggestions_count => $suggestions_count,
|
||||
total_active => $num_formatter->format_price($total_active),
|
||||
totspent_active => $num_formatter->format_price($totspent_active),
|
||||
totordered_active => $num_formatter->format_price($totordered_active),
|
||||
totavail_active => $num_formatter->format_price($totavail_active),
|
||||
suggestions_count => $suggestions_count,
|
||||
);
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
@ -1,6 +1,27 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
<title>Koha › Acquisitions</title>
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(document).ready(function() {
|
||||
$('#showallbudgets').click(function() {
|
||||
if ( $('#showallbudgets:checked').val() !== undefined) {
|
||||
$('.b_inactive').show();
|
||||
$('#b_inactive').show();
|
||||
$('.bu_active').show();
|
||||
$('.bu_inactive').hide();
|
||||
}
|
||||
else {
|
||||
$('.b_inactive').hide();
|
||||
$('#b_inactive').hide();
|
||||
$('.bu_inactive').show();
|
||||
$('.bu_active').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- TMPL_INCLUDE NAME="header.inc" -->
|
||||
|
@ -83,14 +104,15 @@
|
|||
<th>Total</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
<th align="right" ><!-- TMPL_VAR name="total" --></th>
|
||||
<th align="right" ><!-- TMPL_VAR name="totordered" --></th>
|
||||
<th align="right" ><!-- TMPL_VAR name="totspent" --></th>
|
||||
<th align="right" ><!-- TMPL_VAR name="totavail" --></th>
|
||||
<th align="right" ><span class="bu_active" style="display : none;"><!-- TMPL_VAR name="total" --></span><span class="bu_inactive" ><!-- TMPL_VAR name="total_active" --></span></th>
|
||||
<th align="right" ><span class="bu_active" style="display : none;"><!-- TMPL_VAR name="totordered" --></span><span class="bu_inactive" ><!-- TMPL_VAR name="totordered_active" --></span></th>
|
||||
<th align="right" ><span class="bu_active" style="display : none;"><!-- TMPL_VAR name="totspent" --></span><span class="bu_inactive" ><!-- TMPL_VAR name="totspent_active" --></span></th>
|
||||
<th align="right" ><span class="bu_active" style="display : none;"><!-- TMPL_VAR name="totavail" --></span><span class="bu_inactive" ><!-- TMPL_VAR name="totavail_active" --></span></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<!-- TMPL_LOOP name="loop_budget" -->
|
||||
<!-- TMPL_IF NAME="budget_period_active" -->
|
||||
<!--TMPL_IF NAME="__odd__" -->
|
||||
<tr>
|
||||
<!--TMPL_ELSE-->
|
||||
|
@ -104,10 +126,24 @@
|
|||
<td align="right" ><!-- TMPL_VAR name="budget_spent" --></td>
|
||||
<td align="right" ><!-- TMPL_VAR name="budget_avail" --></td>
|
||||
</tr>
|
||||
<!--TMPL_ELSE -->
|
||||
<!--TMPL_IF NAME="__odd__" -->
|
||||
<tr class="b_inactive" style="display : none;">
|
||||
<!--TMPL_ELSE-->
|
||||
<tr class="highlight" id = "b_inactive" style="display : none;">
|
||||
<!--/TMPL_IF-->
|
||||
<td align="center" ><!-- TMPL_VAR name="budget_code" --></td>
|
||||
<td align="center"><!-- TMPL_VAR name="budget_owner" --></td>
|
||||
<td align="center"><!-- TMPL_VAR name="budget_branchname" --></td>
|
||||
<td align="right" ><!-- TMPL_VAR name="budget_amount" --></td>
|
||||
<td align="right" ><!-- TMPL_VAR name="budget_ordered" --></td>
|
||||
<td align="right" ><!-- TMPL_VAR name="budget_spent" --></td>
|
||||
<td align="right" ><!-- TMPL_VAR name="budget_avail" --></td>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><span class="label">Show all : </span><input type="checkbox" id="showallbudgets" />
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue