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 611-616 sub GetBudget { Link Here
611
    return $result;
612
    return $result;
612
}
613
}
613
614
615
=head2 GetBudgetByOrderNumber
616
617
  &GetBudgetByOrderNumber($ordernumber);
618
619
get a specific budget by order number
620
621
=cut
622
623
# -------------------------------------------------------------------
624
sub GetBudgetByOrderNumber {
625
    my ( $ordernumber ) = @_;
626
    my $dbh = C4::Context->dbh;
627
    my $query = "
628
        SELECT aqbudgets.*
629
        FROM   aqbudgets, aqorders
630
        WHERE  ordernumber=?
631
        AND    aqorders.budget_id = aqbudgets.budget_id
632
        ";
633
    my $sth = $dbh->prepare($query);
634
    $sth->execute( $ordernumber );
635
    my $result = $sth->fetchrow_hashref;
636
    return $result;
637
}
638
614
=head2 GetChildBudgetsSpent
639
=head2 GetChildBudgetsSpent
615
640
616
  &GetChildBudgetsSpent($budget-id);
641
  &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 175-180 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
175
    $line{gst}     = $gst;
176
    $line{gst}     = $gst;
176
    $line{total} = sprintf($cfstr, $total);
177
    $line{total} = sprintf($cfstr, $total);
177
    $line{booksellerid} = $booksellerid;
178
    $line{booksellerid} = $booksellerid;
179
    my ($count) = &GetReservesFromBiblionumber($line{biblionumber});
180
    $line{holds} = $count;
181
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
178
    push @loop_received, \%line;
182
    push @loop_received, \%line;
179
    $totalprice += $parcelitems[$i]->{'unitprice'};
183
    $totalprice += $parcelitems[$i]->{'unitprice'};
180
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
184
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
Lines 183-189 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
183
    $line{suggestionid}         = $suggestion->{suggestionid};
187
    $line{suggestionid}         = $suggestion->{suggestionid};
184
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
188
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
185
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
189
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
186
187
    #double FIXME - totalfreight is redefined later.
190
    #double FIXME - totalfreight is redefined later.
188
191
189
# 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..
192
# 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 (-50 / +72 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 315-391 Link Here
315
        <thead>
316
        <thead>
316
	    <tr>
317
	    <tr>
317
		<th>Basket</th>
318
		<th>Basket</th>
318
        <th>Order line</th>
319
		<th>Order Line</th>
320
		<th>Holds</th>
319
		<th>Summary</th>
321
		<th>Summary</th>
320
        <th>View record</th>
322
                <th>View record</th>
321
		<th>Quantity</th>  
323
		<th>Quantity</th>  
324
		<th>Fund</th>
322
		<th>Est cost</th>
325
		<th>Est cost</th>
323
		<th>Actual cost</th>
326
		<th>Actual cost</th>
324
		<th>TOTAL</th>
327
		<th>Total</th>
325
	    </tr>
328
	    </tr>
326
	</thead>
329
	</thead>
330
	<tbody class="filterclass">
331
            [% SET funds = {} %]
332
            [% SET estimated_total = 0 %]
333
	    [% FOREACH loop_receive IN loop_received %]
334
                [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
335
                [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + loop_receive.ecost %]
336
                [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
337
338
                [% UNLESS ( loop.odd ) %]
339
                    <tr class="highlight">
340
                [% ELSE %]
341
                    <tr>
342
                [% END %]
343
344
                    <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
345
                    <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
346
                    <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>
348
                    [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
349
                    [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
350
                    [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %]
351
                    [% IF ( loop_receive.suggestionid ) %]
352
                        <br/>
353
                        Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %]
354
                        (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&amp;op=show">suggestion #[% loop_receive.suggestionid %]</a>)
355
                    [% END %]
356
                    </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>
358
                    <td>[% loop_receive.quantityreceived %]</td>
359
                    <td>[% loop_receive.budget.budget_name %]</td>
360
                    <td>[% loop_receive.ecost %]</td>
361
                    <td>[% loop_receive.unitprice %]</td>
362
                    <td>[% loop_receive.total %]</td>
363
364
                </tr>
365
	    [% END %]
366
	</tbody>
367
327
<tfoot>
368
<tfoot>
369
            [% FOREACH key IN funds.keys.sort %]
370
                <tr>
371
                    <td colspan="6" class="total"> &nbsp; </td>
372
                    <td><i>Subtotal for</i> [% key %]</td>
373
                    <td>[% currency( funds.$key.estimated ) %]</td>
374
                    <td>[% currency( funds.$key.actual ) %]</td>
375
                    <td>&nbsp;</td>
376
                </tr>
377
            [% END %]
328
	    <tr>
378
	    <tr>
329
		<td colspan="4" class="total">SUBTOTAL</td>
379
		<td colspan="5" class="total">SUBTOTAL</td>
330
		<td colspan="2">&nbsp;</td>
380
		<td colspan="2">&nbsp;</td>
331
		<td>[% totalprice %]</td>
381
		<td>[% currency( estimated_total ) %]</td>
332
		<td>[% tototal %]</td>
382
		<td>[% tototal %]</td>
383
                <td>&nbsp;</td>
333
	    </tr>
384
	    </tr>
334
	      
385
	      
335
	      [% IF ( totalfreight ) %]
386
	      [% IF ( totalfreight ) %]
336
		    <tr>
387
		    <tr>
337
			<td colspan="6">&nbsp;
388
			<td colspan="7">&nbsp;</td>
338
		</td>
389
			<td>Shipping</td>
339
			    <td>Shipping</td>
390
		        <td>[% totalfreight %]</td>
340
		<td>[% totalfreight %]</td>
391
		    </tr>
341
	    	</tr> 
392
	      [% END %]
342
	    [% END %]
343
	      [% IF ( gst ) %]
393
	      [% IF ( gst ) %]
344
		    <tr>
394
		    <tr>
345
			<td colspan="6">
395
			<td colspan="7">
346
		<p class="message">
396
		            <p class="message">
347
			    <b>HELP</b><br />
397
			        <b>HELP</b><br/>
348
		    The total at the bottom of the page should be within a few cents of the total for the invoice.
398
		                The total at the bottom of the page should be within a few cents of the total for the invoice.
349
		</p>
399
		            </p>
350
		</td>
400
		        </td>
351
			    <td><b>Tax rate</b></td>
401
			<td><b>Tax rate</b></td>
352
		<td>[% gst %]</td>
402
                        <td>[% gst %]</td>
353
	    	</tr> 
403
                    </tr>
354
	    [% END %]
404
	    [% END %]
355
	    <tr>
405
	    <tr>
356
	    <td colspan="4" class="total">TOTAL</td>
406
	        <td colspan="5" class="total">TOTAL</td>
357
		<td>[% totalquantity %]</td>
407
		<td>[% totalquantity %]</td>
358
		<td colspan="2">&nbsp;</td>
408
		<td colspan="3">&nbsp;</td>
359
		<td>[% grandtot %]</td>
409
		<td>[% grandtot %]</td>
360
	    </tr>
410
	    </tr>
361
    </tfoot>
411
    </tfoot>
362
	<tbody class="filterclass">
363
	    [% FOREACH loop_receive IN loop_received %]
364
        [% UNLESS ( loop.odd ) %]
365
            <tr class="highlight">
366
        [% ELSE %]
367
            <tr>
368
        [% END %]
369
                <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td>
370
                <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td>
371
                <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a>
372
                [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %]
373
                [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %]
374
                [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %]
375
                [% IF ( loop_receive.suggestionid ) %]
376
                    <br/>
377
                    Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %]
378
                    (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&amp;op=show">suggestion #[% loop_receive.suggestionid %]</a>)
379
                [% END %]
380
                </td>
381
                <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>
382
                <td>[% loop_receive.quantityreceived %]</td>
383
                <td>[% loop_receive.ecost %]</td>
384
                <td>[% loop_receive.unitprice %]</td>
385
                <td>[% loop_receive.total %]</td>
386
            </tr>
387
	    [% END %]
388
	</tbody>
389
    </table>
412
    </table>
390
    </form>
413
    </form>
391
	[% ELSE %]There are no received orders.[% END %]
414
	[% ELSE %]There are no received orders.[% END %]
392
- 

Return to bug 8037