# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI;
+use C4::Acquisition;
use C4::Auth;
+use C4::Bookseller qw/GetBookSellerFromId/;
+use C4::Budgets;
use C4::Koha;
use C4::Dates qw/format_date/;
use C4::Serials;
my $dbh = C4::Context->dbh;
my ($template, $loggedinuser, $cookie, $hemisphere);
my $subscriptionid = $query->param('subscriptionid');
+
+if ( $op and $op eq "close" ) {
+ C4::Serials::CloseSubscription( $subscriptionid );
+} elsif ( $op and $op eq "reopen" ) {
+ C4::Serials::ReopenSubscription( $subscriptionid );
+}
+
my $subs = GetSubscription($subscriptionid);
$subs->{enddate} = GetExpirationDate($subscriptionid);
$tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
$tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
$tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
- $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber};
+ $tmpl_infos->{invoiceid} = $lastOrderReceived->{invoiceid};
$tmpl_infos->{spent_exists} = 1;
}
}
$template->param(
- subscriptionid => $subscriptionid,
+ subscriptionid => $subscriptionid,
serialslist => \@serialslist,
hasRouting => $hasRouting,
routing => C4::Context->preference("RoutingSerials"),
default_bib_view => $default_bib_view,
(uc(C4::Context->preference("marcflavour"))) => 1,
show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
- );
+ basketno => $order->{basketno},
+ %$tmpl_infos,
+);
output_html_with_http_headers $query, $cookie, $template->output;
}
return 'detail';
}
+
+sub get_value_with_gst_params {
+ my $value = shift;
+ my $gstrate = shift;
+ my $bookseller = shift;
+ if ( $bookseller->{listincgst} ) {
+ return ( $value, $value / ( 1 + $gstrate ) );
+ } else {
+ return ( $value * ( 1 + $gstrate ), $value );
+ }
+}
+
+sub get_gste {
+ my $value = shift;
+ my $gstrate = shift;
+ my $bookseller = shift;
+ if ( $bookseller->{invoiceincgst} ) {
+ return $value / ( 1 + $gstrate );
+ } else {
+ return $value;
+ }
+}
+
+sub get_gst {
+ my $value = shift;
+ my $gstrate = shift;
+ my $bookseller = shift;
+ if ( $bookseller->{invoiceincgst} ) {
+ return $value / ( 1 + $gstrate ) * $gstrate;
+ } else {
+ return $value * ( 1 + $gstrate ) - $value;
+ }
+}