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

(-)a/C4/Acquisition.pm (-1 / +2 lines)
Lines 2460-2470 sub GetInvoiceDetails { Link Here
2460
    my $invoice = $sth->fetchrow_hashref;
2460
    my $invoice = $sth->fetchrow_hashref;
2461
2461
2462
    $query = qq{
2462
    $query = qq{
2463
        SELECT aqorders.*, biblio.*,
2463
        SELECT aqorders.*, biblio.*, aqorders_items.itemnumber,
2464
        aqbasket.basketname
2464
        aqbasket.basketname
2465
        FROM aqorders
2465
        FROM aqorders
2466
          LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno
2466
          LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno
2467
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2467
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2468
          LEFT JOIN aqorders_items ON aqorders.ordernumber = aqorders_items.ordernumber
2468
        WHERE invoiceid = ?
2469
        WHERE invoiceid = ?
2469
    };
2470
    };
2470
    $sth = $dbh->prepare($query);
2471
    $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 277-285 of the reserves and an arrayref pointing to the reserves for C<$biblionumber>. Link Here
277
sub GetReservesFromBiblionumber {
277
sub GetReservesFromBiblionumber {
278
    my ($biblionumber) = shift or return (0, []);
278
    my ($biblionumber) = shift or return (0, []);
279
    my ($all_dates) = shift;
279
    my ($all_dates) = shift;
280
    my ($itemnumber) = shift;
281
    warn "ITEMNUMBER: $itemnumber";
280
    my $dbh   = C4::Context->dbh;
282
    my $dbh   = C4::Context->dbh;
281
283
282
    # Find the desired items in the reserves
284
    # Find the desired items in the reserves
285
    my @params;
283
    my $query = "
286
    my $query = "
284
        SELECT  reserve_id,
287
        SELECT  reserve_id,
285
                branchcode,
288
                branchcode,
Lines 298-309 sub GetReservesFromBiblionumber { Link Here
298
                suspend_until
301
                suspend_until
299
        FROM     reserves
302
        FROM     reserves
300
        WHERE biblionumber = ? ";
303
        WHERE biblionumber = ? ";
304
    push( @params, $biblionumber );
301
    unless ( $all_dates ) {
305
    unless ( $all_dates ) {
302
        $query .= "AND reservedate <= CURRENT_DATE()";
306
        $query .= " AND reservedate <= CURRENT_DATE() ";
307
    }
308
    if ( $itemnumber ) {
309
        $query .= " AND ( itemnumber IS NULL OR itemnumber = ? )";
310
        push( @params, $itemnumber );
303
    }
311
    }
304
    $query .= "ORDER BY priority";
312
    $query .= "ORDER BY priority";
305
    my $sth = $dbh->prepare($query);
313
    my $sth = $dbh->prepare($query);
306
    $sth->execute($biblionumber);
314
    $sth->execute( @params );
307
    my @results;
315
    my @results;
308
    my $i = 0;
316
    my $i = 0;
309
    while ( my $data = $sth->fetchrow_hashref ) {
317
    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 170-175 for my $item ( @parcelitems ) { Link Here
170
    $line{invoice} = $invoice->{invoicenumber};
171
    $line{invoice} = $invoice->{invoicenumber};
171
    $line{total} = sprintf($cfstr, $total);
172
    $line{total} = sprintf($cfstr, $total);
172
    $line{booksellerid} = $invoice->{booksellerid};
173
    $line{booksellerid} = $invoice->{booksellerid};
174
    my ($count) = &GetReservesFromBiblionumber($line{biblionumber},undef,$item->{itemnumber});
175
    $line{holds} = $count;
176
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
173
    $totalprice += $item->{'unitprice'};
177
    $totalprice += $item->{'unitprice'};
174
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
178
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
175
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
179
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
Lines 187-193 for my $item ( @parcelitems ) { Link Here
187
191
188
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
192
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
189
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
193
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
190
            @parcelitems )
194
            @parcelitems
195
            )
191
        {
196
        {
192
            $line{cannot_cancel} = 1;
197
            $line{cannot_cancel} = 1;
193
        }
198
        }
(-)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 58-69 Link Here
58
            "iCookieDuration": 60*60*24*1000, // 1000 days
59
            "iCookieDuration": 60*60*24*1000, // 1000 days
59
            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
60
            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
60
            "aoColumnDefs": [
61
            "aoColumnDefs": [
61
                { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
62
                { "aTargets": [ 4, -1 ], "bSortable": false, "bSearchable": false },
62
            ],
63
            ],
63
            "aoColumns": [
64
            "aoColumns": [
64
                { "sType": "num-html" },
65
                { "sType": "num-html" },
65
                { "sType": "num-html" },
66
                { "sType": "num-html" },
66
                { "sType": "html" },
67
                { "sType": "html" },
68
                { "sType": "html" },
69
                null,
67
                null,
70
                null,
68
                null,
71
                null,
69
                null,
72
                null,
Lines 298-333 Link Here
298
301
299
302
300
   [% IF ( loop_received ) %]
303
   [% IF ( loop_received ) %]
304
       [% SET funds = {} %]
305
       [% SET estimated_total = 0 %]
306
307
       [% FOREACH loop_receive IN loop_received %]
308
           [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
309
           [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
310
           [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
311
       [% END %]
312
301
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
313
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
302
    <table id="receivedt">
314
    <table id="receivedt">
303
        <thead>
315
        <thead>
304
	    <tr>
316
	    <tr>
305
		<th>Basket</th>
317
                <th>Basket</th>
306
        <th>Order line</th>
318
                <th>Order Line</th>
307
		<th>Summary</th>
319
                <th>Holds</th>
308
        <th>View record</th>
320
                <th>Summary</th>
309
		<th>Quantity</th>  
321
                <th>View record</th>
310
		<th>Est cost</th>
322
                <th>Quantity</th>
311
		<th>Actual cost</th>
323
                <th>Fund</th>
312
		<th>TOTAL</th>
324
                <th>Est cost</th>
325
                <th>Actual cost</th>
326
                <th>TOTAL</th>
313
        <th></th>
327
        <th></th>
314
	    </tr>
328
	    </tr>
315
    </thead>
329
    </thead>
316
    <tfoot>
330
    <tfoot>
331
        [% FOREACH key IN funds.keys.sort %]
332
            <tr>
333
                <td colspan="6" class="total"> &nbsp; </td>
334
                <td><i>Subtotal for</i> [% key %]</td>
335
                <td>[% currency( funds.$key.estimated ) %]</td>
336
                <td>[% currency( funds.$key.actual ) %]</td>
337
                <td>&nbsp;</td>
338
                <td>&nbsp;</td>
339
            </tr>
340
        [% END %]
317
        <tr>
341
        <tr>
318
            <th colspan="7" class="total">Total tax exc.</th>
342
            <th colspan="9" class="total">Total tax exc.</th>
319
            <th>[% total_gste %]</th>
343
            <th>[% total_gste %]</th>
320
            <th></th>
344
            <th></th>
321
        </tr>
345
        </tr>
322
        [% FOREACH book_foot IN book_foot_loop %]
346
        [% FOREACH book_foot IN book_foot_loop %]
323
            <tr>
347
            <tr>
324
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
348
                <th colspan="9">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
325
                <th>[% book_foot.value %]</th>
349
                <th>[% book_foot.value %]</th>
326
                <th></th>
350
                <th></th>
327
            </tr>
351
            </tr>
328
        [% END %]
352
        [% END %]
329
        <tr>
353
        <tr>
330
            <th colspan="7" class="total">Total tax inc.</th>
354
            <th colspan="9" class="total">Total tax inc.</th>
331
            <th>[% total_gsti %]</th>
355
            <th>[% total_gsti %]</th>
332
            <th></th>
356
            <th></th>
333
        </tr>
357
        </tr>
Lines 337-342 Link Here
337
            <tr>
361
            <tr>
338
                <td>[% loop_receive.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a>)</td>
362
                <td>[% loop_receive.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a>)</td>
339
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
363
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
364
                <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>
340
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
365
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
341
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
366
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
342
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
367
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
Lines 349-354 Link Here
349
                </td>
374
                </td>
350
                <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>
375
                <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>
351
                <td>[% loop_receive.quantityreceived %]</td>
376
                <td>[% loop_receive.quantityreceived %]</td>
377
                <td>[% loop_receive.budget.budget_name %]</td>
352
                <td>[% loop_receive.ecost %]</td>
378
                <td>[% loop_receive.ecost %]</td>
353
                <td>[% loop_receive.unitprice %]</td>
379
                <td>[% loop_receive.unitprice %]</td>
354
                <td>[% loop_receive.total %]</td>
380
                <td>[% loop_receive.total %]</td>
355
- 

Return to bug 8037