This fix the way to get spent datas, to user aqbudgetid instead of bookfund.
LEFT JOIN aqorderbreakdown USING (ordernumber)
LEFT JOIN aqbasket USING (basketno)
LEFT JOIN aqbudget USING (bookfundid)
- WHERE bookfundid=?
+ WHERE aqbudgetid=?
AND (datecancellationprinted IS NULL OR datecancellationprinted = '0000-00-00')
AND closedate BETWEEN startdate AND enddate
AND creationdate > startdate
+
ORDER BY datereceived
";
my $sth = $dbh->prepare($query);
- $sth->execute( $id);
+ $sth->execute($id);
my ($spent, $comtd) = (0, 0);
while ( my $data = $sth->fetchrow_hashref ) {
my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
my @results = GetBookFunds($homebranch);
+
my $count = scalar @results;
my $classlist = '';
my @loop_budget = ();
for (my $i=0; $i<$count; $i++){
- my ($spent,$comtd)=GetBookFundBreakdown($results[$i]->{'bookfundid'},$results[$i]->{'startdate'},$results[$i]->{'enddate'});
+ my ($spent,$comtd)=GetBookFundBreakdown($results[$i]->{'aqbudgetid'},$results[$i]->{'startdate'},$results[$i]->{'enddate'});
my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
my %line;
$line{bookfundname} = $results[$i]->{'bookfundname'};
my $dbh = C4::Context->dbh;
my $input = new CGI;
-my $bookfund = $input->param('bookfund');
+my $budgetid = $input->param('aqbudgetid');
my $start = $input->param('start');
my $end = $input->param('end');
LEFT JOIN aqorderbreakdown USING (ordernumber)
LEFT JOIN aqbasket USING (basketno)
LEFT JOIN aqbudget USING (bookfundid)
- WHERE bookfundid=?
+ WHERE aqbudgetid=?
AND (datecancellationprinted IS NULL OR datecancellationprinted = '0000-00-00')
AND closedate BETWEEN startdate AND enddate
AND creationdate > startdate
ORDER BY datereceived
";
my $sth = $dbh->prepare($query);
-$sth->execute( $bookfund);
+$sth->execute( $budgetid );
my $total = 0;
my $toggle;
<tr>
<td><!-- TMPL_VAR name="bookfundname" --></td>
<td><a href="/cgi-bin/koha/admin/aqbudget.pl?op=add_form&aqbudgetid=<!--TMPL_VAR NAME="aqbudgetid"-->"><!-- TMPL_VAR name="budgetamount" --></a></td>
- <td><a href="/cgi-bin/koha/acqui/spent.pl?bookfund=<!--TMPL_VAR NAME="bookfundid"-->&start=<!--TMPL_VAR NAME="sdate"-->&end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="spent" --></a></td>
+ <td><a href="/cgi-bin/koha/acqui/spent.pl?aqbudgetid=<!--TMPL_VAR NAME="aqbudgetid"-->&start=<!--TMPL_VAR NAME="sdate"-->&end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="spent" --></a></td>
<td><a href="/cgi-bin/koha/acqui/bookfund.pl?bookfund=<!--TMPL_VAR NAME="bookfundid"-->&start=<!--TMPL_VAR NAME="sdate"-->&end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="comtd" --></a></td>
<td><!-- TMPL_VAR name="avail" --></td>
</tr>