View | Details | Raw Unified | Return to bug 20726
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-21 / +52 lines)
Lines 1-7 Link Here
1
[% USE Asset %]
1
[% USE Asset %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE KohaDates %]
3
[% USE Branches %]
4
[% USE Branches %]
4
[% USE AuthorisedValues %]
5
[% USE AuthorisedValues %]
6
[% USE Price %]
5
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
6
[% INCLUDE 'doc-head-open.inc' %]
8
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; Serials &rsaquo; Details for subscription #[% subscriptionid %]</title>
9
<title>Koha &rsaquo; Serials &rsaquo; Details for subscription #[% subscriptionid %]</title>
Lines 327-368 Link Here
327
    </div>
329
    </div>
328
    </div>
330
    </div>
329
331
330
    [% IF ( show_acquisition_details ) %]
332
    [% IF orders %]
331
        <div id="acquisition_details">
333
        <div id="acquisition_details">
332
            <h2>Acquisition details</h2>
334
            <h2>Acquisition details</h2>
333
            <table>
335
            <table id="orders">
334
                <thead>
336
                <thead>
335
                    <tr><th></th><th>Price exc. taxes</th><th>Price inc. taxes</th><th>Fund</th><th></th></tr>
337
                    <tr>
338
                        <th>Invoice</th>
339
                        <th>Basket</th>
340
                        <th>Order number</th>
341
                        <th class="title-string">Creation date</th>
342
                        <th class="title-string">Receive date</th>
343
                        <th>Status</th>
344
                        <th>Fund</th>
345
                        <th>Ordered</th>
346
                        <th>Spent</th>
347
                    </tr>
336
                </thead>
348
                </thead>
337
                <tbody>
349
                <tbody>
350
                [% FOR order IN orders %]
338
                    <tr>
351
                    <tr>
339
                        <td>Ordered amount</td>
340
                        <td>[% value_tax_excluded_ordered %]</td>
341
                        <td>[% value_tax_included_ordered %]</td>
342
                        <td>[% budget_name_ordered %]</td>
343
                        <td>
352
                        <td>
344
                            [% IF ( ordered_exists ) %]
353
                        [% IF order.invoice %]
345
                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">See basket information</a>
354
                            [% IF CAN_user_acquisition %]
355
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid %]" title="Invoice detail page">
356
                                   [% order.invoice.invoicenumber %]</a>
357
                            [% ELSE %]
358
                                [% order.invoice.invoicenumber %]
346
                            [% END %]
359
                            [% END %]
360
                        [% END %]
347
                        </td>
361
                        </td>
348
                    </tr>
362
                        <td>[% IF CAN_user_acquisition_order_manage %]
349
                    <tr>
363
                            <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno %]">[% order.basket.basketname %] ([% order.basketno %])</a>
350
                        <td>Spent amount</td>
364
                        [% ELSE %]
351
                        <td>[% value_tax_excluded_spent %]</td>
365
                            [% order.basket.basketname %] ([% order.basketno %])
352
                        <td>[% value_tax_included_spent %]</td>
366
                        [% END %]</td>
353
                        <td>[% budget_name_spent %]</td>
367
                        <td>[% order.ordernumber %]</td>
368
                        <td><span title="[% order.basket.creationdate %]">[% order.basket.creationdate | $KohaDates%]</span></td>
369
                        <td><span title="[% order.datereceived %]">[% order.datereceived | $KohaDates%]</span></td>
354
                        <td>
370
                        <td>
355
                            [% IF ( spent_exists ) %]
371
                          [% SWITCH order.orderstatus %]
356
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">See invoice information</a>
372
                            [% CASE 'new' %]New
373
                            [% CASE 'ordered' %]Ordered
374
                            [% CASE 'partial' %]Partial
375
                            [% CASE 'complete' %]Complete
376
                            [% CASE 'cancelled' %]Cancelled
377
                          [% END %]
378
                        </td>
379
                        <td>[% order.fund.budget_name %]</td>
380
                        <td>
381
                            [% UNLESS order.datereceived %]
382
                                [% order.ecost_tax_excluded | $Price %] / [% order.ecost_tax_included | $Price %]
383
                            [% END %]
384
                        </td>
385
                        <td>
386
                            [% IF order.datereceived %]
387
                                [%# FIXME What if unitprice has not been filled? %]
388
                                [% order.unitprice_tax_excluded | $Price %] / [% order.unitprice_tax_included | $Price %]
357
                            [% END %]
389
                            [% END %]
358
                        </td>
390
                        </td>
359
                    </tr>
391
                    </tr>
392
                [% END %]
360
                </tbody>
393
                </tbody>
361
            </table>
394
            </table>
362
        </div>
395
          </div>
363
    [% END %]
396
      [% END %]
364
365
366
397
367
</div>
398
</div>
368
</div>
399
</div>
(-)a/serials/subscription-detail.pl (-63 / +4 lines)
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
- 

Return to bug 20726