|
Lines 116-147
my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($su
Link Here
|
| 116 |
|
116 |
|
| 117 |
my $default_bib_view = get_default_view(); |
117 |
my $default_bib_view = get_default_view(); |
| 118 |
|
118 |
|
| 119 |
my ( $order, $bookseller, $tmpl_infos ); |
|
|
| 120 |
if ( defined $subscriptionid ) { |
| 121 |
my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid; |
| 122 |
my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid; |
| 123 |
if ( defined $lastOrderNotReceived ) { |
| 124 |
my $basket = GetBasket $lastOrderNotReceived->{basketno}; |
| 125 |
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} ); |
| 126 |
( $tmpl_infos->{value_tax_included_ordered}, $tmpl_infos->{value_tax_excluded_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{tax_rate}, $bookseller ); |
| 127 |
$tmpl_infos->{value_tax_included_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_ordered} ); |
| 128 |
$tmpl_infos->{value_tax_excluded_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_ordered} ); |
| 129 |
$tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id}; |
| 130 |
$tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno}; |
| 131 |
$tmpl_infos->{ordered_exists} = 1; |
| 132 |
} |
| 133 |
if ( defined $lastOrderReceived ) { |
| 134 |
my $basket = GetBasket $lastOrderReceived->{basketno}; |
| 135 |
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} ); |
| 136 |
( $tmpl_infos->{value_tax_included_spent}, $tmpl_infos->{value_tax_excluded_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{tax_rate}, $bookseller ); |
| 137 |
$tmpl_infos->{value_tax_included_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_spent} ); |
| 138 |
$tmpl_infos->{value_tax_excluded_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_spent} ); |
| 139 |
$tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id}; |
| 140 |
$tmpl_infos->{invoiceid} = $lastOrderReceived->{invoiceid}; |
| 141 |
$tmpl_infos->{spent_exists} = 1; |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } ); |
119 |
my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } ); |
| 146 |
for my $field ( @$additional_fields ) { |
120 |
for my $field ( @$additional_fields ) { |
| 147 |
if ( $field->{authorised_value_category} ) { |
121 |
if ( $field->{authorised_value_category} ) { |
|
Lines 150-155
for my $field ( @$additional_fields ) {
Link Here
|
| 150 |
} |
124 |
} |
| 151 |
$template->param( additional_fields_for_subscription => $additional_fields ); |
125 |
$template->param( additional_fields_for_subscription => $additional_fields ); |
| 152 |
|
126 |
|
|
|
127 |
# FIXME Do we want to hide canceled orders? |
| 128 |
my $orders = Koha::Acquisition::Orders->search( { subscriptionid => $subscriptionid } ); |
| 129 |
|
| 153 |
$template->param( |
130 |
$template->param( |
| 154 |
subscriptionid => $subscriptionid, |
131 |
subscriptionid => $subscriptionid, |
| 155 |
serialslist => \@serialslist, |
132 |
serialslist => \@serialslist, |
|
Lines 166-175
$template->param(
Link Here
|
| 166 |
intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'), |
143 |
intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'), |
| 167 |
irregular_issues => scalar @irregular_issues, |
144 |
irregular_issues => scalar @irregular_issues, |
| 168 |
default_bib_view => $default_bib_view, |
145 |
default_bib_view => $default_bib_view, |
|
|
146 |
orders => $orders, |
| 169 |
(uc(C4::Context->preference("marcflavour"))) => 1, |
147 |
(uc(C4::Context->preference("marcflavour"))) => 1, |
| 170 |
show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0, |
|
|
| 171 |
basketno => $order->{basketno}, |
| 172 |
%$tmpl_infos, |
| 173 |
); |
148 |
); |
| 174 |
|
149 |
|
| 175 |
output_html_with_http_headers $query, $cookie, $template->output; |
150 |
output_html_with_http_headers $query, $cookie, $template->output; |
|
Lines 188-223
sub get_default_view {
Link Here
|
| 188 |
} |
163 |
} |
| 189 |
return 'detail'; |
164 |
return 'detail'; |
| 190 |
} |
165 |
} |
| 191 |
|
|
|
| 192 |
sub get_value_with_gst_params { |
| 193 |
my $value = shift; |
| 194 |
my $tax_rate = shift; |
| 195 |
my $bookseller = shift; |
| 196 |
if ( $bookseller->listincgst ) { |
| 197 |
return ( $value, $value / ( 1 + $tax_rate ) ); |
| 198 |
} else { |
| 199 |
return ( $value * ( 1 + $tax_rate ), $value ); |
| 200 |
} |
| 201 |
} |
| 202 |
|
| 203 |
sub get_tax_excluded { |
| 204 |
my $value = shift; |
| 205 |
my $tax_rate = shift; |
| 206 |
my $bookseller = shift; |
| 207 |
if ( $bookseller->invoiceincgst ) { |
| 208 |
return $value / ( 1 + $tax_rate ); |
| 209 |
} else { |
| 210 |
return $value; |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
sub get_gst { |
| 215 |
my $value = shift; |
| 216 |
my $tax_rate = shift; |
| 217 |
my $bookseller = shift; |
| 218 |
if ( $bookseller->invoiceincgst ) { |
| 219 |
return $value / ( 1 + $tax_rate ) * $tax_rate; |
| 220 |
} else { |
| 221 |
return $value * ( 1 + $tax_rate ) - $value; |
| 222 |
} |
| 223 |
} |
| 224 |
- |