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

(-)a/C4/Acquisition.pm (-1 / +2 lines)
Lines 2365-2373 sub GetInvoiceDetails { Link Here
2365
    my $invoice = $sth->fetchrow_hashref;
2365
    my $invoice = $sth->fetchrow_hashref;
2366
2366
2367
    $query = qq{
2367
    $query = qq{
2368
        SELECT aqorders.*, biblio.*
2368
        SELECT aqorders.*, biblio.*, aqorders_items.itemnumber
2369
        FROM aqorders
2369
        FROM aqorders
2370
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2370
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2371
          LEFT JOIN aqorders_items ON aqorders.ordernumber = aqorders_items.ordernumber
2371
        WHERE invoiceid = ?
2372
        WHERE invoiceid = ?
2372
    };
2373
    };
2373
    $sth = $dbh->prepare($query);
2374
    $sth = $dbh->prepare($query);
(-)a/C4/Budgets.pm (+25 lines)
Lines 34-39 BEGIN { Link Here
34
	@EXPORT = qw(
34
	@EXPORT = qw(
35
35
36
        &GetBudget
36
        &GetBudget
37
        &GetBudgetByOrderNumber
37
        &GetBudgets
38
        &GetBudgets
38
        &GetBudgetHierarchy
39
        &GetBudgetHierarchy
39
	    &AddBudget
40
	    &AddBudget
Lines 672-677 sub GetBudget { Link Here
672
    return $result;
673
    return $result;
673
}
674
}
674
675
676
=head2 GetBudgetByOrderNumber
677
678
  &GetBudgetByOrderNumber($ordernumber);
679
680
get a specific budget by order number
681
682
=cut
683
684
# -------------------------------------------------------------------
685
sub GetBudgetByOrderNumber {
686
    my ( $ordernumber ) = @_;
687
    my $dbh = C4::Context->dbh;
688
    my $query = "
689
        SELECT aqbudgets.*
690
        FROM   aqbudgets, aqorders
691
        WHERE  ordernumber=?
692
        AND    aqorders.budget_id = aqbudgets.budget_id
693
        ";
694
    my $sth = $dbh->prepare($query);
695
    $sth->execute( $ordernumber );
696
    my $result = $sth->fetchrow_hashref;
697
    return $result;
698
}
699
675
=head2 GetChildBudgetsSpent
700
=head2 GetChildBudgetsSpent
676
701
677
  &GetChildBudgetsSpent($budget-id);
702
  &GetChildBudgetsSpent($budget-id);
(-)a/C4/Reserves.pm (-2 / +10 lines)
Lines 256-264 of the reserves and an arrayref pointing to the reserves for C<$biblionumber>. Link Here
256
sub GetReservesFromBiblionumber {
256
sub GetReservesFromBiblionumber {
257
    my ($biblionumber) = shift or return (0, []);
257
    my ($biblionumber) = shift or return (0, []);
258
    my ($all_dates) = shift;
258
    my ($all_dates) = shift;
259
    my ($itemnumber) = shift;
260
    warn "ITEMNUMBER: $itemnumber";
259
    my $dbh   = C4::Context->dbh;
261
    my $dbh   = C4::Context->dbh;
260
262
261
    # Find the desired items in the reserves
263
    # Find the desired items in the reserves
264
    my @params;
262
    my $query = "
265
    my $query = "
263
        SELECT  branchcode,
266
        SELECT  branchcode,
264
                timestamp AS rtimestamp,
267
                timestamp AS rtimestamp,
Lines 276-287 sub GetReservesFromBiblionumber { Link Here
276
                suspend_until
279
                suspend_until
277
        FROM     reserves
280
        FROM     reserves
278
        WHERE biblionumber = ? ";
281
        WHERE biblionumber = ? ";
282
    push( @params, $biblionumber );
279
    unless ( $all_dates ) {
283
    unless ( $all_dates ) {
280
        $query .= "AND reservedate <= CURRENT_DATE()";
284
        $query .= " AND reservedate <= CURRENT_DATE() ";
285
    }
286
    if ( $itemnumber ) {
287
        $query .= " AND ( itemnumber IS NULL OR itemnumber = ? )";
288
        push( @params, $itemnumber );
281
    }
289
    }
282
    $query .= "ORDER BY priority";
290
    $query .= "ORDER BY priority";
283
    my $sth = $dbh->prepare($query);
291
    my $sth = $dbh->prepare($query);
284
    $sth->execute($biblionumber);
292
    $sth->execute( @params );
285
    my @results;
293
    my @results;
286
    my $i = 0;
294
    my $i = 0;
287
    while ( my $data = $sth->fetchrow_hashref ) {
295
    while ( my $data = $sth->fetchrow_hashref ) {
(-)a/acqui/parcel.pl (-1 / +6 lines)
Lines 67-72 use CGI; Link Here
67
use C4::Output;
67
use C4::Output;
68
use C4::Dates qw/format_date format_date_in_iso/;
68
use C4::Dates qw/format_date format_date_in_iso/;
69
use C4::Suggestions;
69
use C4::Suggestions;
70
use C4::Reserves qw/GetReservesFromBiblionumber/;
70
use JSON;
71
use JSON;
71
72
72
my $input=new CGI;
73
my $input=new CGI;
Lines 169-174 for my $item ( @parcelitems ) { Link Here
169
    $line{invoice} = $invoice->{invoicenumber};
170
    $line{invoice} = $invoice->{invoicenumber};
170
    $line{total} = sprintf($cfstr, $total);
171
    $line{total} = sprintf($cfstr, $total);
171
    $line{booksellerid} = $invoice->{booksellerid};
172
    $line{booksellerid} = $invoice->{booksellerid};
173
    my ($count) = &GetReservesFromBiblionumber($line{biblionumber},undef,$item->{itemnumber});
174
    $line{holds} = $count;
175
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
172
    $totalprice += $item->{'unitprice'};
176
    $totalprice += $item->{'unitprice'};
173
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
177
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
174
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
178
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
Lines 186-192 for my $item ( @parcelitems ) { Link Here
186
190
187
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
191
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
188
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
192
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
189
            @parcelitems )
193
            @parcelitems
194
            )
190
        {
195
        {
191
            $line{cannot_cancel} = 1;
196
            $line{cannot_cancel} = 1;
192
        }
197
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-13 / +38 lines)
Lines 1-3 Link Here
1
[% USE currency = format('%.2f') -%]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
3
            Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title>
4
            Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% formatteddatereceived %][% ELSE %]Receive orders from [% name %][% END %]</title>
Lines 43-54 Link Here
43
            "iCookieDuration": 60*60*24*1000, // 1000 days
44
            "iCookieDuration": 60*60*24*1000, // 1000 days
44
            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
45
            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
45
            "aoColumnDefs": [
46
            "aoColumnDefs": [
46
                { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
47
                { "aTargets": [ 4, -1 ], "bSortable": false, "bSearchable": false },
47
            ],
48
            ],
48
            "aoColumns": [
49
            "aoColumns": [
49
                { "sType": "num-html" },
50
                { "sType": "num-html" },
50
                { "sType": "num-html" },
51
                { "sType": "num-html" },
51
                { "sType": "html" },
52
                { "sType": "html" },
53
                { "sType": "html" },
54
                null,
52
                null,
55
                null,
53
                null,
56
                null,
54
                null,
57
                null,
Lines 261-296 Link Here
261
264
262
265
263
   [% IF ( loop_received ) %]
266
   [% IF ( loop_received ) %]
267
       [% SET funds = {} %]
268
       [% SET estimated_total = 0 %]
269
270
       [% FOREACH loop_receive IN loop_received %]
271
           [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
272
           [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
273
           [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
274
       [% END %]
275
264
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
276
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
265
    <table id="receivedt">
277
    <table id="receivedt">
266
        <thead>
278
        <thead>
267
	    <tr>
279
	    <tr>
268
		<th>Basket</th>
280
                <th>Basket</th>
269
        <th>Order line</th>
281
                <th>Order Line</th>
270
		<th>Summary</th>
282
                <th>Holds</th>
271
        <th>View record</th>
283
                <th>Summary</th>
272
		<th>Quantity</th>  
284
                <th>View record</th>
273
		<th>Est cost</th>
285
                <th>Quantity</th>
274
		<th>Actual cost</th>
286
                <th>Fund</th>
275
		<th>TOTAL</th>
287
                <th>Est cost</th>
288
                <th>Actual cost</th>
289
                <th>TOTAL</th>
276
        <th></th>
290
        <th></th>
277
	    </tr>
291
	    </tr>
278
    </thead>
292
    </thead>
279
    <tfoot>
293
    <tfoot>
294
        [% FOREACH key IN funds.keys.sort %]
295
            <tr>
296
                <td colspan="6" class="total"> &nbsp; </td>
297
                <td><i>Subtotal for</i> [% key %]</td>
298
                <td>[% currency( funds.$key.estimated ) %]</td>
299
                <td>[% currency( funds.$key.actual ) %]</td>
300
                <td>&nbsp;</td>
301
                <td>&nbsp;</td>
302
            </tr>
303
        [% END %]
280
        <tr>
304
        <tr>
281
            <th colspan="7" class="total">Total tax exc.</th>
305
            <th colspan="9" class="total">Total tax exc.</th>
282
            <th>[% total_gste %]</th>
306
            <th>[% total_gste %]</th>
283
            <th></th>
307
            <th></th>
284
        </tr>
308
        </tr>
285
        [% FOREACH book_foot IN book_foot_loop %]
309
        [% FOREACH book_foot IN book_foot_loop %]
286
            <tr>
310
            <tr>
287
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
311
                <th colspan="9">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
288
                <th>[% book_foot.value %]</th>
312
                <th>[% book_foot.value %]</th>
289
                <th></th>
313
                <th></th>
290
            </tr>
314
            </tr>
291
        [% END %]
315
        [% END %]
292
        <tr>
316
        <tr>
293
            <th colspan="7" class="total">Total tax inc.</th>
317
            <th colspan="9" class="total">Total tax inc.</th>
294
            <th>[% total_gsti %]</th>
318
            <th>[% total_gsti %]</th>
295
            <th></th>
319
            <th></th>
296
        </tr>
320
        </tr>
Lines 300-305 Link Here
300
            <tr>
324
            <tr>
301
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
325
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
302
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
326
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
327
                <td>[% IF loop_receive.holds %]<span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.holds %]</a></span>[% END %]</td>
303
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
328
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
304
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
329
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
305
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
330
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
Lines 312-317 Link Here
312
                </td>
337
                </td>
313
                <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
338
                <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
314
                <td>[% loop_receive.quantityreceived %]</td>
339
                <td>[% loop_receive.quantityreceived %]</td>
340
                <td>[% loop_receive.budget.budget_name %]</td>
315
                <td>[% loop_receive.ecost %]</td>
341
                <td>[% loop_receive.ecost %]</td>
316
                <td>[% loop_receive.unitprice %]</td>
342
                <td>[% loop_receive.unitprice %]</td>
317
                <td>[% loop_receive.total %]</td>
343
                <td>[% loop_receive.total %]</td>
318
- 

Return to bug 8037