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

(-)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 616-621 sub GetBudget { Link Here
616
    return $result;
617
    return $result;
617
}
618
}
618
619
620
=head2 GetBudgetByOrderNumber
621
622
  &GetBudgetByOrderNumber($ordernumber);
623
624
get a specific budget by order number
625
626
=cut
627
628
# -------------------------------------------------------------------
629
sub GetBudgetByOrderNumber {
630
    my ( $ordernumber ) = @_;
631
    my $dbh = C4::Context->dbh;
632
    my $query = "
633
        SELECT aqbudgets.*
634
        FROM   aqbudgets, aqorders
635
        WHERE  ordernumber=?
636
        AND    aqorders.budget_id = aqbudgets.budget_id
637
        ";
638
    my $sth = $dbh->prepare($query);
639
    $sth->execute( $ordernumber );
640
    my $result = $sth->fetchrow_hashref;
641
    return $result;
642
}
643
619
=head2 GetChildBudgetsSpent
644
=head2 GetChildBudgetsSpent
620
645
621
  &GetChildBudgetsSpent($budget-id);
646
  &GetChildBudgetsSpent($budget-id);
(-)a/acqui/parcel.pl (-1 / +4 lines)
Lines 68-73 use CGI; Link Here
68
use C4::Output;
68
use C4::Output;
69
use C4::Dates qw/format_date format_date_in_iso/;
69
use C4::Dates qw/format_date format_date_in_iso/;
70
use C4::Suggestions;
70
use C4::Suggestions;
71
use C4::Reserves qw/GetReservesFromBiblionumber/;
71
use JSON;
72
use JSON;
72
73
73
my $input=new CGI;
74
my $input=new CGI;
Lines 176-181 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
176
    $line{gst}     = $gst;
177
    $line{gst}     = $gst;
177
    $line{total} = sprintf($cfstr, $total);
178
    $line{total} = sprintf($cfstr, $total);
178
    $line{booksellerid} = $booksellerid;
179
    $line{booksellerid} = $booksellerid;
180
    my ($count) = &GetReservesFromBiblionumber($line{biblionumber});
181
    $line{holds} = $count;
182
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
179
    push @loop_received, \%line;
183
    push @loop_received, \%line;
180
    $totalprice += $parcelitems[$i]->{'unitprice'};
184
    $totalprice += $parcelitems[$i]->{'unitprice'};
181
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
185
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
Lines 184-190 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
184
    $line{suggestionid}         = $suggestion->{suggestionid};
188
    $line{suggestionid}         = $suggestion->{suggestionid};
185
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
189
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
186
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
190
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
187
188
    #double FIXME - totalfreight is redefined later.
191
    #double FIXME - totalfreight is redefined later.
189
192
190
# FIXME - each order in a  parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget..
193
# FIXME - each order in a  parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget..
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-48 / +75 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 338-410 Link Here
338
        <thead>
339
        <thead>
339
	    <tr>
340
	    <tr>
340
		<th>Basket</th>
341
		<th>Basket</th>
341
        <th>Order line</th>
342
		<th>Order Line</th>
343
		<th>Holds</th>
342
		<th>Summary</th>
344
		<th>Summary</th>
343
        <th>View record</th>
345
                <th>View record</th>
344
		<th>Quantity</th>  
346
		<th>Quantity</th>  
347
		<th>Fund</th>
345
		<th>Est cost</th>
348
		<th>Est cost</th>
346
		<th>Actual cost</th>
349
		<th>Actual cost</th>
347
		<th>TOTAL</th>
350
		<th>Total</th>
348
	    </tr>
351
	    </tr>
349
    </thead>
352
	</thead>
350
    <tfoot>
353
	<tbody class="filterclass">
354
            [% SET funds = {} %]
355
            [% SET estimated_total = 0 %]
356
	    [% FOREACH loop_receive IN loop_received %]
357
                [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
358
                [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + loop_receive.ecost %]
359
                [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
360
361
                [% UNLESS ( loop.odd ) %]
362
                    <tr class="highlight">
363
                [% ELSE %]
364
                    <tr>
365
                [% END %]
366
367
                    <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</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>
370
                    <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
371
                    [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
372
                    [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
373
                    [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %]
374
                    [% IF ( loop_receive.suggestionid ) %]
375
                        <br/>
376
                        Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %]
377
                        (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&amp;op=show">suggestion #[% loop_receive.suggestionid %]</a>)
378
                    [% END %]
379
                    </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>
381
                    <td>[% loop_receive.quantityreceived %]</td>
382
                    <td>[% loop_receive.budget.budget_name %]</td>
383
                    <td>[% loop_receive.ecost %]</td>
384
                    <td>[% loop_receive.unitprice %]</td>
385
                    <td>[% loop_receive.total %]</td>
386
387
                </tr>
388
	    [% END %]
389
	</tbody>
390
391
<tfoot>
392
            [% FOREACH key IN funds.keys.sort %]
393
                <tr>
394
                    <td colspan="6" class="total"> &nbsp; </td>
395
                    <td><i>Subtotal for</i> [% key %]</td>
396
                    <td>[% currency( funds.$key.estimated ) %]</td>
397
                    <td>[% currency( funds.$key.actual ) %]</td>
398
                    <td>&nbsp;</td>
399
                </tr>
400
            [% END %]
401
351
	    <tr>
402
	    <tr>
352
		<td colspan="4" class="total">SUBTOTAL</td>
403
		<td colspan="5" class="total">SUBTOTAL</td>
353
		<td colspan="2">&nbsp;</td>
404
		<td colspan="2">&nbsp;</td>
354
		<td>[% totalprice %]</td>
405
		<td>[% currency( estimated_total ) %]</td>
355
		<td>[% tototal %]</td>
406
		<td>[% tototal %]</td>
407
                <td>&nbsp;</td>
356
	    </tr>
408
	    </tr>
357
	      
409
	      
358
	      [% IF ( totalfreight ) %]
410
	      [% IF ( totalfreight ) %]
359
		    <tr>
411
		    <tr>
360
			<td colspan="6">&nbsp;
412
			<td colspan="7">&nbsp;</td>
361
		</td>
413
			<td>Shipping</td>
362
			    <td>Shipping</td>
414
		        <td>[% totalfreight %]</td>
363
		<td>[% totalfreight %]</td>
415
		    </tr>
364
	    	</tr> 
416
	      [% END %]
365
	    [% END %]
366
	      [% IF ( gst ) %]
417
	      [% IF ( gst ) %]
367
		    <tr>
418
		    <tr>
368
			<td colspan="6">
419
			<td colspan="7">
369
		<p class="message">
420
		            <p class="message">
370
			    <b>HELP</b><br />
421
			        <b>HELP</b><br/>
371
		    The total at the bottom of the page should be within a few cents of the total for the invoice.
422
		                The total at the bottom of the page should be within a few cents of the total for the invoice.
372
		</p>
423
		            </p>
373
		</td>
424
		        </td>
374
			    <td><b>Tax rate</b></td>
425
			<td><b>Tax rate</b></td>
375
		<td>[% gst %]</td>
426
                        <td>[% gst %]</td>
376
	    	</tr> 
427
                    </tr>
377
	    [% END %]
428
	    [% END %]
378
	    <tr>
429
	    <tr>
379
	    <td colspan="4" class="total">TOTAL</td>
430
	        <td colspan="5" class="total">TOTAL</td>
380
		<td>[% totalquantity %]</td>
431
		<td>[% totalquantity %]</td>
381
		<td colspan="2">&nbsp;</td>
432
		<td colspan="3">&nbsp;</td>
382
		<td>[% grandtot %]</td>
433
		<td>[% grandtot %]</td>
383
	    </tr>
434
	    </tr>
384
    </tfoot>
435
    </tfoot>
385
	<tbody class="filterclass">
386
	    [% FOREACH loop_receive IN loop_received %]
387
            <tr>
388
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
389
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
390
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
391
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
392
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
393
                [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %]
394
                [% IF ( loop_receive.suggestionid ) %]
395
                    <br/>
396
                    Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %]
397
                    (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&amp;op=show">suggestion #[% loop_receive.suggestionid %]</a>)
398
                [% END %]
399
                </td>
400
                <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>
401
                <td>[% loop_receive.quantityreceived %]</td>
402
                <td>[% loop_receive.ecost %]</td>
403
                <td>[% loop_receive.unitprice %]</td>
404
                <td>[% loop_receive.total %]</td>
405
            </tr>
406
	    [% END %]
407
	</tbody>
408
    </table>
436
    </table>
409
    </form>
437
    </form>
410
	[% ELSE %]There are no received orders.[% END %]
438
	[% ELSE %]There are no received orders.[% END %]
411
- 

Return to bug 8037