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

(-)a/C4/Acquisition.pm (-1 / +2 lines)
Lines 2409-2417 sub GetInvoiceDetails { Link Here
2409
    my $invoice = $sth->fetchrow_hashref;
2409
    my $invoice = $sth->fetchrow_hashref;
2410
2410
2411
    $query = qq{
2411
    $query = qq{
2412
        SELECT aqorders.*, biblio.*
2412
        SELECT aqorders.*, biblio.*, aqorders_items.itemnumber
2413
        FROM aqorders
2413
        FROM aqorders
2414
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2414
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2415
          LEFT JOIN aqorders_items ON aqorders.ordernumber = aqorders_items.ordernumber
2415
        WHERE invoiceid = ?
2416
        WHERE invoiceid = ?
2416
    };
2417
    };
2417
    $sth = $dbh->prepare($query);
2418
    $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 176-181 for my $item ( @parcelitems ) { Link Here
176
    $line{invoice} = $invoice->{invoicenumber};
177
    $line{invoice} = $invoice->{invoicenumber};
177
    $line{total} = sprintf($cfstr, $total);
178
    $line{total} = sprintf($cfstr, $total);
178
    $line{booksellerid} = $invoice->{booksellerid};
179
    $line{booksellerid} = $invoice->{booksellerid};
180
    my ($count) = &GetReservesFromBiblionumber($line{biblionumber},undef,$item->{itemnumber});
181
    $line{holds} = $count;
182
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
179
    $totalprice += $item->{'unitprice'};
183
    $totalprice += $item->{'unitprice'};
180
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
184
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
181
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
185
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
Lines 193-199 for my $item ( @parcelitems ) { Link Here
193
197
194
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
198
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
195
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
199
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
196
            @parcelitems )
200
            @parcelitems
201
            )
197
        {
202
        {
198
            $line{cannot_cancel} = 1;
203
            $line{cannot_cancel} = 1;
199
        }
204
        }
(-)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 40-51 Link Here
40
            "iCookieDuration": 60*60*24*1000, // 1000 days
41
            "iCookieDuration": 60*60*24*1000, // 1000 days
41
            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
42
            "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
42
            "aoColumnDefs": [
43
            "aoColumnDefs": [
43
                { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
44
                { "aTargets": [ 4, -1 ], "bSortable": false, "bSearchable": false },
44
            ],
45
            ],
45
            "aoColumns": [
46
            "aoColumns": [
46
                { "sType": "num-html" },
47
                { "sType": "num-html" },
47
                { "sType": "num-html" },
48
                { "sType": "num-html" },
48
                { "sType": "html" },
49
                { "sType": "html" },
50
                { "sType": "html" },
51
                null,
49
                null,
52
                null,
50
                null,
53
                null,
51
                null,
54
                null,
Lines 255-290 Link Here
255
258
256
259
257
   [% IF ( loop_received ) %]
260
   [% IF ( loop_received ) %]
261
       [% SET funds = {} %]
262
       [% SET estimated_total = 0 %]
263
264
       [% FOREACH loop_receive IN loop_received %]
265
           [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
266
           [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
267
           [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
268
       [% END %]
269
258
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
270
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
259
    <table id="receivedt">
271
    <table id="receivedt">
260
        <thead>
272
        <thead>
261
	    <tr>
273
	    <tr>
262
		<th>Basket</th>
274
                <th>Basket</th>
263
        <th>Order line</th>
275
                <th>Order Line</th>
264
		<th>Summary</th>
276
                <th>Holds</th>
265
        <th>View record</th>
277
                <th>Summary</th>
266
		<th>Quantity</th>  
278
                <th>View record</th>
267
		<th>Est cost</th>
279
                <th>Quantity</th>
268
		<th>Actual cost</th>
280
                <th>Fund</th>
269
		<th>TOTAL</th>
281
                <th>Est cost</th>
282
                <th>Actual cost</th>
283
                <th>TOTAL</th>
270
        <th></th>
284
        <th></th>
271
	    </tr>
285
	    </tr>
272
    </thead>
286
    </thead>
273
    <tfoot>
287
    <tfoot>
288
        [% FOREACH key IN funds.keys.sort %]
289
            <tr>
290
                <td colspan="6" class="total"> &nbsp; </td>
291
                <td><i>Subtotal for</i> [% key %]</td>
292
                <td>[% currency( funds.$key.estimated ) %]</td>
293
                <td>[% currency( funds.$key.actual ) %]</td>
294
                <td>&nbsp;</td>
295
                <td>&nbsp;</td>
296
            </tr>
297
        [% END %]
274
        <tr>
298
        <tr>
275
            <th colspan="7" class="total">Total tax exc.</th>
299
            <th colspan="9" class="total">Total tax exc.</th>
276
            <th>[% total_gste %]</th>
300
            <th>[% total_gste %]</th>
277
            <th></th>
301
            <th></th>
278
        </tr>
302
        </tr>
279
        [% FOREACH book_foot IN book_foot_loop %]
303
        [% FOREACH book_foot IN book_foot_loop %]
280
            <tr>
304
            <tr>
281
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
305
                <th colspan="9">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
282
                <th>[% book_foot.value %]</th>
306
                <th>[% book_foot.value %]</th>
283
                <th></th>
307
                <th></th>
284
            </tr>
308
            </tr>
285
        [% END %]
309
        [% END %]
286
        <tr>
310
        <tr>
287
            <th colspan="7" class="total">Total tax inc.</th>
311
            <th colspan="9" class="total">Total tax inc.</th>
288
            <th>[% total_gsti %]</th>
312
            <th>[% total_gsti %]</th>
289
            <th></th>
313
            <th></th>
290
        </tr>
314
        </tr>
Lines 294-299 Link Here
294
            <tr>
318
            <tr>
295
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
319
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
296
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
320
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
321
                <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>
297
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
322
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
298
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
323
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
299
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
324
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
Lines 306-311 Link Here
306
                </td>
331
                </td>
307
                <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>
332
                <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>
308
                <td>[% loop_receive.quantityreceived %]</td>
333
                <td>[% loop_receive.quantityreceived %]</td>
334
                <td>[% loop_receive.budget.budget_name %]</td>
309
                <td>[% loop_receive.ecost %]</td>
335
                <td>[% loop_receive.ecost %]</td>
310
                <td>[% loop_receive.unitprice %]</td>
336
                <td>[% loop_receive.unitprice %]</td>
311
                <td>[% loop_receive.total %]</td>
337
                <td>[% loop_receive.total %]</td>
312
- 

Return to bug 8037