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

(-)a/C4/Acquisition.pm (-1 / +2 lines)
Lines 2336-2344 sub GetInvoiceDetails { Link Here
2336
    $invoice = $sth->fetchrow_hashref;
2336
    $invoice = $sth->fetchrow_hashref;
2337
2337
2338
    $query = qq{
2338
    $query = qq{
2339
        SELECT aqorders.*, biblio.*
2339
        SELECT aqorders.*, biblio.*, aqorders_items.itemnumber
2340
        FROM aqorders
2340
        FROM aqorders
2341
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2341
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
2342
          LEFT JOIN aqorders_items ON aqorders.ordernumber = aqorders_items.ordernumber
2342
        WHERE invoiceid = ?
2343
        WHERE invoiceid = ?
2343
    };
2344
    };
2344
    $sth = $dbh->prepare($query);
2345
    $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 636-641 sub GetBudget { Link Here
636
    return $result;
637
    return $result;
637
}
638
}
638
639
640
=head2 GetBudgetByOrderNumber
641
642
  &GetBudgetByOrderNumber($ordernumber);
643
644
get a specific budget by order number
645
646
=cut
647
648
# -------------------------------------------------------------------
649
sub GetBudgetByOrderNumber {
650
    my ( $ordernumber ) = @_;
651
    my $dbh = C4::Context->dbh;
652
    my $query = "
653
        SELECT aqbudgets.*
654
        FROM   aqbudgets, aqorders
655
        WHERE  ordernumber=?
656
        AND    aqorders.budget_id = aqbudgets.budget_id
657
        ";
658
    my $sth = $dbh->prepare($query);
659
    $sth->execute( $ordernumber );
660
    my $result = $sth->fetchrow_hashref;
661
    return $result;
662
}
663
639
=head2 GetChildBudgetsSpent
664
=head2 GetChildBudgetsSpent
640
665
641
  &GetChildBudgetsSpent($budget-id);
666
  &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 180-185 for my $item ( @parcelitems ) { Link Here
180
    $line{invoice} = $invoice->{invoicenumber};
181
    $line{invoice} = $invoice->{invoicenumber};
181
    $line{total} = sprintf($cfstr, $total);
182
    $line{total} = sprintf($cfstr, $total);
182
    $line{booksellerid} = $invoice->{booksellerid};
183
    $line{booksellerid} = $invoice->{booksellerid};
184
    my ($count) = &GetReservesFromBiblionumber($line{biblionumber},undef,$item->{itemnumber});
185
    $line{holds} = $count;
186
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
183
    $totalprice += $item->{'unitprice'};
187
    $totalprice += $item->{'unitprice'};
184
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
188
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
185
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
189
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
Lines 197-203 for my $item ( @parcelitems ) { Link Here
197
201
198
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
202
    if ( $line{parent_ordernumber} != $line{ordernumber} ) {
199
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
203
        if ( grep { $_->{ordernumber} == $line{parent_ordernumber} }
200
            @parcelitems )
204
            @parcelitems
205
            )
201
        {
206
        {
202
            $line{cannot_cancel} = 1;
207
            $line{cannot_cancel} = 1;
203
        }
208
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-12 / +35 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 305-340 Link Here
305
306
306
307
307
   [% IF ( loop_received ) %]
308
   [% IF ( loop_received ) %]
309
       [% SET funds = {} %]
310
       [% SET estimated_total = 0 %]
311
312
       [% FOREACH loop_receive IN loop_received %]
313
           [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
314
           [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + loop_receive.ecost %]
315
           [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
316
       [% END %]
317
308
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
318
   <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
309
    <table id="receivedt">
319
    <table id="receivedt">
310
        <thead>
320
        <thead>
311
	    <tr>
321
	    <tr>
312
		<th>Basket</th>
322
                <th>Basket</th>
313
        <th>Order line</th>
323
                <th>Order Line</th>
314
		<th>Summary</th>
324
                <th>Holds</th>
315
        <th>View record</th>
325
                <th>Summary</th>
316
		<th>Quantity</th>  
326
                <th>View record</th>
317
		<th>Est cost</th>
327
                <th>Quantity</th>  
318
		<th>Actual cost</th>
328
                <th>Fund</th>
319
		<th>TOTAL</th>
329
                <th>Est cost</th>
330
                <th>Actual cost</th>
331
                <th>TOTAL</th>
320
        <th></th>
332
        <th></th>
321
	    </tr>
333
	    </tr>
322
    </thead>
334
    </thead>
323
    <tfoot>
335
    <tfoot>
336
        [% FOREACH key IN funds.keys.sort %]
337
            <tr>
338
                <td colspan="6" class="total"> &nbsp; </td>
339
                <td><i>Subtotal for</i> [% key %]</td>
340
                <td>[% currency( funds.$key.estimated ) %]</td>
341
                <td>[% currency( funds.$key.actual ) %]</td>
342
                <td>&nbsp;</td>
343
                <td>&nbsp;</td>
344
            </tr>
345
        [% END %]
324
        <tr>
346
        <tr>
325
            <th colspan="7" class="total">Total tax exc.</th>
347
            <th colspan="9" class="total">Total tax exc.</th>
326
            <th>[% total_gste %]</th>
348
            <th>[% total_gste %]</th>
327
            <th></th>
349
            <th></th>
328
        </tr>
350
        </tr>
329
        [% FOREACH book_foot IN book_foot_loop %]
351
        [% FOREACH book_foot IN book_foot_loop %]
330
            <tr>
352
            <tr>
331
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
353
                <th colspan="9">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
332
                <th>[% book_foot.value %]</th>
354
                <th>[% book_foot.value %]</th>
333
                <th></th>
355
                <th></th>
334
            </tr>
356
            </tr>
335
        [% END %]
357
        [% END %]
336
        <tr>
358
        <tr>
337
            <th colspan="7" class="total">Total tax inc.</th>
359
            <th colspan="9" class="total">Total tax inc.</th>
338
            <th>[% total_gsti %]</th>
360
            <th>[% total_gsti %]</th>
339
            <th></th>
361
            <th></th>
340
        </tr>
362
        </tr>
Lines 344-349 Link Here
344
            <tr>
366
            <tr>
345
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
367
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
346
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
368
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
369
                <td>[% IF loop_receive.holds %] <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% loop_receive.biblionumber %]"><img src="/intranet-tmpl/prog/img/deny.gif" /></a></span>[% END %]</td>
347
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
370
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
348
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
371
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
349
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
372
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
Lines 356-361 Link Here
356
                </td>
379
                </td>
357
                <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>
380
                <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>
358
                <td>[% loop_receive.quantityreceived %]</td>
381
                <td>[% loop_receive.quantityreceived %]</td>
382
                <td>[% loop_receive.budget.budget_name %]</td>
359
                <td>[% loop_receive.ecost %]</td>
383
                <td>[% loop_receive.ecost %]</td>
360
                <td>[% loop_receive.unitprice %]</td>
384
                <td>[% loop_receive.unitprice %]</td>
361
                <td>[% loop_receive.total %]</td>
385
                <td>[% loop_receive.total %]</td>
362
- 

Return to bug 8037