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

(-)a/Koha/Number/Price.pm (-1 / +6 lines)
Lines 95-101 sub _format_params { Link Here
95
    my ( $self, $params ) = @_;
95
    my ( $self, $params ) = @_;
96
    my $with_symbol = $params->{with_symbol} || 0;
96
    my $with_symbol = $params->{with_symbol} || 0;
97
    my $p_cs_precedes = $params->{p_cs_precedes};
97
    my $p_cs_precedes = $params->{p_cs_precedes};
98
    my $currency        = Koha::Acquisition::Currencies->get_active;
98
99
    my $currency =
100
      $params->{currency}
101
      ? Koha::Acquisition::Currencies->find( $params->{currency} )
102
      : Koha::Acquisition::Currencies->get_active;
103
99
    my $currency_format = C4::Context->preference("CurrencyFormat");
104
    my $currency_format = C4::Context->preference("CurrencyFormat");
100
105
101
    my $int_curr_symbol = ( $with_symbol and $currency ) ? $currency->symbol : q||;
106
    my $int_curr_symbol = ( $with_symbol and $currency ) ? $currency->symbol : q||;
(-)a/acqui/invoice.pl (+3 lines)
Lines 262-267 my $total_quantity = 0; Link Here
262
my $total_tax_excluded = 0;
262
my $total_tax_excluded = 0;
263
my $total_tax_included = 0;
263
my $total_tax_included = 0;
264
my $total_tax_value = 0;
264
my $total_tax_value = 0;
265
my $has_invoice_unitprice;
265
foreach my $order (@$orders) {
266
foreach my $order (@$orders) {
266
    my $line = get_infos( $order, $bookseller);
267
    my $line = get_infos( $order, $bookseller);
267
268
Lines 282-287 foreach my $order (@$orders) { Link Here
282
    $total_tax_included += get_rounded_price($$line{total_tax_included});
283
    $total_tax_included += get_rounded_price($$line{total_tax_included});
283
284
284
    $line->{orderline} = $line->{parent_ordernumber};
285
    $line->{orderline} = $line->{parent_ordernumber};
286
    $has_invoice_unitprice = 1 if defined $line->{invoice_unitprice};
285
    push @orders_loop, $line;
287
    push @orders_loop, $line;
286
}
288
}
287
289
Lines 344-349 $template->param( Link Here
344
    currency                    => Koha::Acquisition::Currencies->get_active,
346
    currency                    => Koha::Acquisition::Currencies->get_active,
345
    budgets                     => $budget_loop,
347
    budgets                     => $budget_loop,
346
    budget                      => GetBudget( $shipmentcost_budgetid ),
348
    budget                      => GetBudget( $shipmentcost_budgetid ),
349
    has_invoice_unitprice       => $has_invoice_unitprice,
347
);
350
);
348
351
349
defined( $invoice_files ) && $template->param( files => $invoice_files->GetFilesInfo() );
352
defined( $invoice_files ) && $template->param( files => $invoice_files->GetFilesInfo() );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (+19 lines)
Lines 355-360 Link Here
355
              <tr>
355
              <tr>
356
                <th class="anti-the">Summary</th>
356
                <th class="anti-the">Summary</th>
357
                <th>Library</th>
357
                <th>Library</th>
358
                [% IF has_invoice_unitprice %]
359
                    <th>Invoice price</th>
360
                [% END %]
358
                <th class="tax_excluded">Actual cost tax exc.</th>
361
                <th class="tax_excluded">Actual cost tax exc.</th>
359
                <th class="tax_included">Actual cost tax inc.</th>
362
                <th class="tax_included">Actual cost tax inc.</th>
360
                <th class="replacementprice">Replacement price</th>
363
                <th class="replacementprice">Replacement price</th>
Lines 386-391 Link Here
386
                    [% END %]
389
                    [% END %]
387
                  </td>
390
                  </td>
388
                  <td><p>[% order.branchcode | html %]</p></td>
391
                  <td><p>[% order.branchcode | html %]</p></td>
392
                  [% IF has_invoice_unitprice %]
393
                      <td>
394
                          [% IF order.invoice_unitprice %]
395
                              [% order.invoice_unitprice | $Price with_symbol => 1, currency => order.invoice_currency %] [% order.invoice_currency %]
396
                          [% END %]
397
                      </td>
398
                  [% END %]
389
                  <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
399
                  <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
390
                  <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
400
                  <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
391
                  <td class="number replacementprice">[% order.replacementprice | $Price %] [% IF ( order.uncertainprice ) %] <span>(Uncertain)</span> [% END %]</td>
401
                  <td class="number replacementprice">[% order.replacementprice | $Price %] [% IF ( order.uncertainprice ) %] <span>(Uncertain)</span> [% END %]</td>
Lines 405-410 Link Here
405
              [% FOR tf IN foot_loop %]
415
              [% FOR tf IN foot_loop %]
406
                <tr>
416
                <tr>
407
                    <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
417
                    <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
418
                    [% IF has_invoice_unitprice %]
419
                        <th></th>
420
                    [% END %]
408
                    <th class="tax_excluded"></th>
421
                    <th class="tax_excluded"></th>
409
                    <th class="tax_included"></th>
422
                    <th class="tax_included"></th>
410
                    <th class="replacementprice"/>
423
                    <th class="replacementprice"/>
Lines 418-423 Link Here
418
              [% END %]
431
              [% END %]
419
              <tr>
432
              <tr>
420
                <th colspan="2">Total ([% currency.symbol | html %])</th>
433
                <th colspan="2">Total ([% currency.symbol | html %])</th>
434
                [% IF has_invoice_unitprice %]
435
                    <th></th>
436
                [% END %]
421
                <th class="tax_excluded"></th>
437
                <th class="tax_excluded"></th>
422
                <th class="tax_included"></th>
438
                <th class="tax_included"></th>
423
                <th class="replacementprice"/>
439
                <th class="replacementprice"/>
Lines 430-435 Link Here
430
              </tr>
446
              </tr>
431
              <tr>
447
              <tr>
432
                <th colspan="2">Total + adjustments + shipment cost ([% currency.symbol | html %])</th>
448
                <th colspan="2">Total + adjustments + shipment cost ([% currency.symbol | html %])</th>
449
                [% IF has_invoice_unitprice %]
450
                    <th></th>
451
                [% END %]
433
                <th class="tax_excluded"></th>
452
                <th class="tax_excluded"></th>
434
                <th class="tax_included"></th>
453
                <th class="tax_included"></th>
435
                <th class="replacementprice"/>
454
                <th class="replacementprice"/>
(-)a/t/Number/Price.t (-2 / +14 lines)
Lines 1-6 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
2
3
use Test::More tests => 35;
3
use Test::More tests => 37;
4
4
5
use Test::MockModule;
5
use Test::MockModule;
6
use t::lib::Mocks;
6
use t::lib::Mocks;
Lines 105-110 is( Koha::Number::Price->new(3)->unformat, '3', 'FR: unformat 3' ); Link Here
105
is( Koha::Number::Price->new(1234567890)->unformat,
105
is( Koha::Number::Price->new(1234567890)->unformat,
106
    '1234567890', 'FR: unformat 1234567890' );
106
    '1234567890', 'FR: unformat 1234567890' );
107
107
108
# FIXME This is not ideal, we would like to have the format options at currency level
109
is(
110
    Koha::Number::Price->new(42)->format( { %$format, with_symbol => 1 } ),
111
    '€42,00',
112
    'The default currency is picked if none passed'
113
);
114
is(
115
    Koha::Number::Price->new(42)
116
      ->format( { %$format, with_symbol => 1, currency => 'USD' } ),
117
    '$42,00',
118
    'The specified currency is used'
119
);
120
108
# Price formatting for Switzerland: 1'234'567.89
121
# Price formatting for Switzerland: 1'234'567.89
109
t::lib::Mocks::mock_preference( 'CurrencyFormat', 'CH' );
122
t::lib::Mocks::mock_preference( 'CurrencyFormat', 'CH' );
110
$currency = Koha::Acquisition::Currency->new({
123
$currency = Koha::Acquisition::Currency->new({
111
- 

Return to bug 32705