FROM accountlines
WHERE borrowernumber=?
AND notify_id=?
- AND (accounttype='FU' OR accounttype='N' OR accounttype='M'OR accounttype='A'OR accounttype='F'OR accounttype='L' OR accounttype='IP' OR accounttype='CH' OR accounttype='RE' OR accounttype='RL')
AND amountoutstanding != '0'
ORDER BY notify_id,accounttype
");
+# AND (accounttype='FU' OR accounttype='N' OR accounttype='M'OR accounttype='A'OR accounttype='F'OR accounttype='L' OR accounttype='IP' OR accounttype='CH' OR accounttype='RE' OR accounttype='RL')
+
$sth->execute( $borrowernumber, $notifyid );
my $total = 0;
while ( my $data = $sth->fetchrow_hashref ) {
}
-=item AmountNotify
+=item NumberNotifyId
-(@notify) = &AmountNotify($borrowernumber);
+(@notify) = &NumberNotifyId($borrowernumber);
Returns amount for all file per borrowers
C<@notify> array contains all file per borrowers
C<$totalnotify> contains amount of a file
-C<$notify_id> contains the file number for the borrower number nad item number
+C<$notify_id> contains the file number for the borrower number and item number
=cut
sub AmountNotify{
- my ($notifyid)=@_;
+ my ($notifyid,$borrowernumber)=@_;
my $dbh = C4::Context->dbh;
my $query=qq| SELECT sum(amountoutstanding)
FROM accountlines
- WHERE notify_id=?|;
+ WHERE notify_id=? AND borrowernumber = ?|;
my $sth=$dbh->prepare($query);
- $sth->execute($notifyid);
- my $totalnotify=$sth->fetchrow;
+ $sth->execute($notifyid,$borrowernumber);
+ my $totalnotify=$sth->fetchrow;
$sth->finish;
return ($totalnotify);
}
<!-- TMPL_LOOP name="allfile" -->
<!-- TMPL_LOOP name="loop_pay" -->
<tr>
- <td><select name="payfine<!-- TMPL_VAR name="i" -->">
+ <td>
+ <!-- TMPL_IF EXPR="amountoutstanding > 0" -->
+ <select name="payfine<!-- TMPL_VAR name="i" -->">
<option value="no">Unpaid</option>
<option value="yes">Paid</option>
<option value="wo">Writeoff</option>
</select>
+ <!-- /TMPL_IF -->
<input type="hidden" name="itemnumber<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="itemnumber" -->" />
<input type="hidden" name="accounttype<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="accounttype" -->" />
<input type="hidden" name="amount<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="amount" -->" />
<!-- TMPL_IF NAME="total"-->
<tr>
- <td colspan="6">Total Due</td>
+ <td colspan="6">Sub Total</td>
<td><!-- TMPL_VAR name="total" --></td>
</tr>
<!--/TMPL_IF-->
<!-- /TMPL_LOOP -->
+<tr>
+ <td colspan="6">Total Due</td>
+ <td><!-- TMPL_VAR name="total" --></td>
+</tr>
</table>
<fieldset class="action"><input type="submit" name="submit" value="Make Payment" class="submit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Cancel</a></fieldset></form><!-- TMPL_ELSE --><p><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> has no outstanding fines.</p><!-- /TMPL_IF -->
</div></div>
GetBorNotifyAcctRecord( $borrowernumber, $notify[$j] );
for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
my %line;
- if ( $accts->[$i]{'amountoutstanding'} > 0 ) {
+ if ( $accts->[$i]{'amountoutstanding'} != 0 ) {
$accts->[$i]{'amount'} += 0.00;
$accts->[$i]{'amountoutstanding'} += 0.00;
$line{i} = $j . "" . $i;
push( @loop_pay, \%line );
}
- my $totalnotify = AmountNotify( $notify[$j] );
+ my $totalnotify = AmountNotify( $notify[$j], $borrowernumber );
( $totalnotify = '0' ) if ( $totalnotify =~ /^0.00/ );
push @allfile,
{
'loop_pay' => \@loop_pay,
'notify' => $notify[$j],
- 'total' => $totalnotify
+ 'total' => sprintf( "%.2f",$totalnotify),
+
};
}