View | Details | Raw Unified | Return to bug 2889
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl (-1 / +5 lines)
Lines 32-48 Link Here
32
    <th>Description of charges</th>
32
    <th>Description of charges</th>
33
    <th>Amount</th>
33
    <th>Amount</th>
34
    <th>Outstanding</th>
34
    <th>Outstanding</th>
35
    <!-- TMPL_IF NAME="reverse_col" -->
35
    <th>&nbsp;</th>
36
    <th>&nbsp;</th>
37
    <!-- /TMPL_IF -->
36
  </tr>
38
  </tr>
37
39
38
	<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
40
	<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
39
  <!-- TMPL_LOOP NAME="accounts" -->
41
  <!-- TMPL_LOOP NAME="accounts" -->
40
42
41
   <!-- TMPL_IF NAME="toggle" --> <tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
43
   <!-- TMPL_IF NAME="__odd__" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
42
      <td><!-- TMPL_VAR NAME="date" --></td>
44
      <td><!-- TMPL_VAR NAME="date" --></td>
43
      <td><!-- TMPL_VAR NAME="description" -->&nbsp;<!-- TMPL_IF NAME="itemnumber" --><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">View item</a>&nbsp;<!-- /TMPL_IF --><!-- TMPL_IF NAME="printtitle" --> <!-- TMPL_VAR NAME="title" escape="html" --><!-- /TMPL_IF --></td>
45
      <td><!-- TMPL_VAR NAME="description" -->&nbsp;<!-- TMPL_IF NAME="itemnumber" --><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">View item</a>&nbsp;<!-- /TMPL_IF --><!-- TMPL_IF NAME="printtitle" --> <!-- TMPL_VAR NAME="title" escape="html" --><!-- /TMPL_IF --></td>
44
      <!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td>
46
      <!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td>
45
      <!-- TMPL_IF NAME="amountoutstandingcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amountoutstanding" --></td>
47
      <!-- TMPL_IF NAME="amountoutstandingcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amountoutstanding" --></td>
48
    <!-- TMPL_IF NAME="reverse_col" -->
46
      <td>
49
      <td>
47
	<!-- TMPL_IF NAME="payment" -->
50
	<!-- TMPL_IF NAME="payment" -->
48
		<a href="boraccount.pl?action=reverse&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&accountno=<!-- TMPL_VAR NAME="accountno" -->">Reverse</a>
51
		<a href="boraccount.pl?action=reverse&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&accountno=<!-- TMPL_VAR NAME="accountno" -->">Reverse</a>
Lines 50-55 Link Here
50
		&nbsp;
53
		&nbsp;
51
	<!-- /TMPL_IF -->
54
	<!-- /TMPL_IF -->
52
      </td>
55
      </td>
56
	<!-- /TMPL_IF -->
53
    </tr>
57
    </tr>
54
58
55
  <!-- /TMPL_LOOP -->
59
  <!-- /TMPL_LOOP -->
(-)a/members/boraccount.pl (-39 / +22 lines)
Lines 63-111 if ( $data->{'category_type'} eq 'C') { Link Here
63
}
63
}
64
64
65
#get account details
65
#get account details
66
my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber);
66
my ($total,$accts,undef)=GetMemberAccountRecords($borrowernumber);
67
my $totalcredit;
67
my $totalcredit;
68
if($total <= 0){
68
if($total <= 0){
69
        $totalcredit = 1;
69
        $totalcredit = 1;
70
}
70
}
71
my @accountrows; # this is for the tmpl-loop
71
72
72
my $reverse_col = 0; # Flag whether we need to show the reverse column
73
my $toggle;
73
foreach my $accountline ( @{$accts}) {
74
for (my $i=0;$i<$numaccts;$i++){
74
    $accountline->{amount} += 0.00;
75
    if($i%2){
75
    if ($accountline->{amount} <= 0 ) {
76
            $toggle = 0;
76
        $accountline->{amountcredit} = 1;
77
    } else {
78
            $toggle = 1;
79
    }
77
    }
80
    $accts->[$i]{'toggle'} = $toggle;
78
    $accountline->{amountoutstanding} += 0.00;
81
    $accts->[$i]{'amount'}+=0.00;
79
    if ( $accountline->{amountoutstanding} <= 0 ) {
82
    if($accts->[$i]{'amount'} <= 0){
80
        $accountline->{amountoutstandingcredit} = 1;
83
        $accts->[$i]{'amountcredit'} = 1;
84
    }
81
    }
85
    $accts->[$i]{'amountoutstanding'}+=0.00;
82
86
    if($accts->[$i]{'amountoutstanding'} <= 0){
83
    $accountline->{date} = format_date($accountline->{date});
87
        $accts->[$i]{'amountoutstandingcredit'} = 1;
84
    $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
85
    $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
86
    if ($accountline->{accounttype} eq 'Pay') {
87
        $accountline->{payment} = 1;
88
        $reverse_col = 1;
88
    }
89
    }
89
    my %row = ( 'date'              => format_date($accts->[$i]{'date'}),
90
    if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){
90
                'amountcredit' => $accts->[$i]{'amountcredit'},
91
        $accountline->{printtitle} = 1;
91
                'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
92
                'toggle' => $accts->[$i]{'toggle'},
93
                'description'       => $accts->[$i]{'description'},
94
				'itemnumber'       => $accts->[$i]{'itemnumber'},
95
				'biblionumber'       => $accts->[$i]{'biblionumber'},
96
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
97
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
98
                'accountno' => $accts->[$i]{'accountno'},
99
                'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ),
100
                
101
                );
102
    
103
    if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
104
        $row{'printtitle'}=1;
105
        $row{'title'} = $accts->[$i]{'title'};
106
    }
92
    }
107
    
108
    push(@accountrows, \%row);
109
}
93
}
110
94
111
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
95
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
Lines 121-127 $template->param( Link Here
121
    cardnumber          => $data->{'cardnumber'},
105
    cardnumber          => $data->{'cardnumber'},
122
    categorycode        => $data->{'categorycode'},
106
    categorycode        => $data->{'categorycode'},
123
    category_type       => $data->{'category_type'},
107
    category_type       => $data->{'category_type'},
124
 #   category_description => $data->{'description'},
125
    categoryname		 => $data->{'description'},
108
    categoryname		 => $data->{'description'},
126
    address             => $data->{'address'},
109
    address             => $data->{'address'},
127
    address2            => $data->{'address2'},
110
    address2            => $data->{'address2'},
Lines 134-140 $template->param( Link Here
134
	branchname			=> GetBranchName($data->{'branchcode'}),
117
	branchname			=> GetBranchName($data->{'branchcode'}),
135
    total               => sprintf("%.2f",$total),
118
    total               => sprintf("%.2f",$total),
136
    totalcredit         => $totalcredit,
119
    totalcredit         => $totalcredit,
137
	is_child        => ($data->{'category_type'} eq 'C'),
120
    is_child            => ($data->{'category_type'} eq 'C'),
138
    accounts            => \@accountrows );
121
    reverse_col         => $reverse_col,
122
    accounts            => $accts );
139
123
140
output_html_with_http_headers $input, $cookie, $template->output;
124
output_html_with_http_headers $input, $cookie, $template->output;
141
- 

Return to bug 2889