[followup](bug #3348) fix spent values and spent resume

This fix the way to get spent datas, to user aqbudgetid instead of bookfund.
This commit is contained in:
Nahuel ANGELINETTI 2010-01-21 12:15:49 +01:00 committed by Henri-Damien LAURENT
parent 584f93a1d5
commit 96e95bce3c
4 changed files with 9 additions and 7 deletions

View File

@ -232,14 +232,15 @@ sub GetBookFundBreakdown {
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 ) {

View File

@ -67,6 +67,7 @@ my $borrower= GetMember($loggedinuser);
my ( $flags, $homebranch )= ($borrower->{'flags'},$borrower->{'branchcode'});
my @results = GetBookFunds($homebranch);
my $count = scalar @results;
my $classlist = '';
@ -77,7 +78,7 @@ my $totavail = 0;
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'};

View File

@ -12,7 +12,7 @@ use CGI;
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');
@ -40,14 +40,14 @@ my $query =
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;

View File

@ -76,7 +76,7 @@
<tr>
<td><!-- TMPL_VAR name="bookfundname" --></td>
<td><a href="/cgi-bin/koha/admin/aqbudget.pl?op=add_form&amp;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"-->&amp;start=<!--TMPL_VAR NAME="sdate"-->&amp;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"-->&amp;start=<!--TMPL_VAR NAME="sdate"-->&amp;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"-->&amp;start=<!--TMPL_VAR NAME="sdate"-->&amp;end=<!-- TMPL_VAR NAME="edate"-->"><!-- TMPL_VAR name="comtd" --></a></td>
<td><!-- TMPL_VAR name="avail" --></td>
</tr>