-$template->{VARS}->{'fund'} = $bookfund;
-$template->{VARS}->{'spent'} = \@spent;
-$template->{VARS}->{'total'} = $total;
-$template->{VARS}->{'fund_code'} = $fund_code;
+my $total = $subtotal;
+$query = qq{
+ SELECT invoicenumber, shipmentcost
+ FROM aqinvoices
+ WHERE shipmentcost_budgetid = ?
+};
+$sth = $dbh->prepare($query);
+$sth->execute($bookfund);
+my @shipmentcosts;
+while (my $data = $sth->fetchrow_hashref) {
+ push @shipmentcosts, {
+ shipmentcost => sprintf("%.2f", $data->{shipmentcost}),
+ invoicenumber => $data->{invoicenumber}
+ };
+ $total += $data->{shipmentcost};
+}