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

(-)a/C4/Acquisition.pm (-5 / +7 lines)
Lines 922-928 Else, the upcoming July 1st is used. Link Here
922
922
923
=item defaults entrydate to Now
923
=item defaults entrydate to Now
924
924
925
The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "biblioitemnumber", "rrp", "ecost", "gst", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "bookfundid".
925
The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "biblioitemnumber", "rrp", "ecost", "gstrate", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "bookfundid".
926
926
927
=back
927
=back
928
928
Lines 1164-1170 C<$ordernumber>. Link Here
1164
1164
1165
sub ModReceiveOrder {
1165
sub ModReceiveOrder {
1166
    my (
1166
    my (
1167
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost,
1167
        $biblionumber, $ordernumber,  $quantrec, $user, $cost, $ecost,
1168
        $invoiceno, $freight, $rrp, $budget_id, $datereceived, $received_items
1168
        $invoiceno, $freight, $rrp, $budget_id, $datereceived, $received_items
1169
    )
1169
    )
1170
    = @_;
1170
    = @_;
Lines 1195-1204 sub ModReceiveOrder { Link Here
1195
                , unitprice=?
1195
                , unitprice=?
1196
                , freight=?
1196
                , freight=?
1197
                , rrp=?
1197
                , rrp=?
1198
                , ecost=?
1198
                , quantity=?
1199
                , quantity=?
1199
            WHERE biblionumber=? AND ordernumber=?");
1200
            WHERE biblionumber=? AND ordernumber=?");
1200
1201
1201
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber);
1202
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$ecost,$quantrec,$biblionumber,$ordernumber);
1202
        $sth->finish;
1203
        $sth->finish;
1203
1204
1204
        # create a new order for the remaining items, and set its bookfund.
1205
        # create a new order for the remaining items, and set its bookfund.
Lines 1223-1231 sub ModReceiveOrder { Link Here
1223
    } else {
1224
    } else {
1224
        $sth=$dbh->prepare("update aqorders
1225
        $sth=$dbh->prepare("update aqorders
1225
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1226
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1226
                                unitprice=?,freight=?,rrp=?
1227
                                unitprice=?,freight=?,rrp=?,ecost=?
1227
                            where biblionumber=? and ordernumber=?");
1228
                            where biblionumber=? and ordernumber=?");
1228
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber);
1229
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$ecost,$biblionumber,$ordernumber);
1229
        $sth->finish;
1230
        $sth->finish;
1230
    }
1231
    }
1231
    return $datereceived;
1232
    return $datereceived;
Lines 1379-1384 sub GetParcel { Link Here
1379
                aqorders.listprice,
1380
                aqorders.listprice,
1380
                aqorders.rrp,
1381
                aqorders.rrp,
1381
                aqorders.ecost,
1382
                aqorders.ecost,
1383
                aqorders.gstrate,
1382
                biblio.title
1384
                biblio.title
1383
        FROM aqorders
1385
        FROM aqorders
1384
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1386
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
(-)a/acqui/addorder.pl (-33 / +12 lines)
Lines 153-191 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
153
my $orderinfo					= $input->Vars;
153
my $orderinfo					= $input->Vars;
154
$orderinfo->{'list_price'}    ||=  0;
154
$orderinfo->{'list_price'}    ||=  0;
155
$orderinfo->{'uncertainprice'} ||= 0;
155
$orderinfo->{'uncertainprice'} ||= 0;
156
#my $ordernumber        = $input->param('ordernumber');
156
157
#my $basketno      = $input->param('basketno');
157
my $user = $input->remote_user;
158
#my $booksellerid  = $input->param('booksellerid');
158
159
#my $existing      = $input->param('existing');    # existing biblio, (not basket or order)
160
#my $title         = $input->param('title');
161
#my $author        = $input->param('author');
162
#my $publicationyear= $input->param('publicationyear');
163
#my $isbn          = $input->param('ISBN');
164
#my $itemtype      = $input->param('format');
165
#my $quantity      = $input->param('quantity');		# FIXME: else ERROR!
166
#my $branch        = $input->param('branch');
167
#my $series        = $input->param('series');
168
#my $notes         = $input->param('notes');
169
#my $budget_id     = $input->param('budget_id');
170
#my $sort1         = $input->param('sort1');
171
#my $sort2         = $input->param('sort2');
172
#my $rrp           = $input->param('rrp');
173
#my $ecost         = $input->param('ecost');
174
#my $gst           = $input->param('GST');
175
#my $budget        = $input->param('budget');
176
#my $cost          = $input->param('cost');
177
#my $sub           = $input->param('sub');
178
#my $purchaseorder = $input->param('purchaseordernumber');
179
#my $invoice       = $input->param('invoice');
180
#my $publishercode = $input->param('publishercode');
181
#my $suggestionid  = $input->param('suggestionid');
182
#my $biblionumber  = $input->param('biblionumber');
183
#my $uncertainprice = $input->param('uncertainprice');
184
#my $import_batch_id= $input->param('import_batch_id');
185
#
186
#my $createbibitem = $input->param('createbibitem');
187
#
188
my $user          = $input->remote_user;
189
# create, modify or delete biblio
159
# create, modify or delete biblio
190
# create if $quantity>=0 and $existing='no'
160
# create if $quantity>=0 and $existing='no'
191
# modify if $quantity>=0 and $existing='yes'
161
# modify if $quantity>=0 and $existing='yes'
Lines 208-213 if ( $orderinfo->{quantity} ne '0' ) { Link Here
208
                "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
178
                "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
209
                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
179
                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
210
                "biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
180
                "biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
181
                "aqorders.branchcode"         => $$orderinfo{branchcode} ? $$orderinfo{branchcode} : "",
182
                "aqorders.quantity"           => $$orderinfo{quantity} ? $$orderinfo{quantity} : "",
183
                "aqorders.listprice"          => $$orderinfo{listprice} ? $$orderinfo{listprice} : "",
184
                "aqorders.uncertainprice"     => $$orderinfo{uncertainprice} ? $$orderinfo{uncertainprice} : "",
185
                "aqorders.rrp"                => $$orderinfo{rrp} ? $$orderinfo{rrp} : "",
186
                "aqorders.ecost"              => $$orderinfo{ecost} ? $$orderinfo{ecost} : "",
187
                "aqorders.discount"           => $$orderinfo{discount} ? $$orderinfo{discount} : "",
211
            });
188
            });
212
189
213
        # create the record in catalogue, with framework ''
190
        # create the record in catalogue, with framework ''
Lines 220-225 if ( $orderinfo->{quantity} ne '0' ) { Link Here
220
		$orderinfo->{biblionumber}=$biblionumber;
197
		$orderinfo->{biblionumber}=$biblionumber;
221
    }
198
    }
222
199
200
    $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
201
223
    # if we already have $ordernumber, then it's an ordermodif
202
    # if we already have $ordernumber, then it's an ordermodif
224
    if ($$orderinfo{ordernumber}) {
203
    if ($$orderinfo{ordernumber}) {
225
        ModOrder( $orderinfo);
204
        ModOrder( $orderinfo);
(-)a/acqui/addorderiso2709.pl (-5 / +10 lines)
Lines 206-212 if ($op eq ""){ Link Here
206
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
206
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
207
207
208
        if ($price){
208
        if ($price){
209
            $orderinfo{'listprice'} = $price;
210
            eval {
209
            eval {
211
		require C4::Acquisition;
210
		require C4::Acquisition;
212
		import C4::Acquisition qw/GetBasket/;
211
		import C4::Acquisition qw/GetBasket/;
Lines 223-235 if ($op eq ""){ Link Here
223
	    }
222
	    }
224
            my $basket     = GetBasket( $orderinfo{basketno} );
223
            my $basket     = GetBasket( $orderinfo{basketno} );
225
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
224
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
226
            my $gst        = $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
225
            $orderinfo{gstrate} = $bookseller->{gstrate};
227
            $orderinfo{'unitprice'} = $orderinfo{listprice} - ( $orderinfo{listprice} * ( $bookseller->{discount} / 100 ) );
226
            if ( $bookseller->{listincgst} ) {
228
            $orderinfo{'ecost'} = $orderinfo{unitprice};
227
                $orderinfo{ecost} = $price;
228
            } else {
229
                $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} );
230
            }
231
            $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} );
232
            $orderinfo{listprice} = $orderinfo{rrp};
233
            $orderinfo{unitprice} = $orderinfo{ecost};
234
            $orderinfo{total} = $orderinfo{ecost};
229
        } else {
235
        } else {
230
            $orderinfo{'listprice'} = 0;
236
            $orderinfo{'listprice'} = 0;
231
        }
237
        }
232
        $orderinfo{'rrp'} = $orderinfo{'listprice'};
233
238
234
        # remove uncertainprice flag if we have found a price in the MARC record
239
        # remove uncertainprice flag if we have found a price in the MARC record
235
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
240
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
(-)a/acqui/basket.pl (-117 / +123 lines)
Lines 231-351 if ( $op eq 'delete_confirm' ) { Link Here
231
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
231
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
232
      $basket->{creationdate}, $basket->{authorisedby};
232
      $basket->{creationdate}, $basket->{authorisedby};
233
233
234
	#to get active currency
234
    #to get active currency
235
	my $cur = GetCurrency();
235
    my $cur = GetCurrency();
236
236
237
237
238
    my @results = GetOrders( $basketno );
238
    my @results = GetOrders( $basketno );
239
    
240
	my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
241
	$gist = 0 if $gist == 0.0000;
242
	my $discount = $bookseller->{'discount'} / 100;
243
    my $total_rrp = 0;      # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'}
244
    my $total_rrp_gsti = 0; # RRP Total, GST included
245
    my $total_rrp_gste = 0; # RRP Total, GST excluded
246
    my $gist_rrp = 0;
247
    my $total_rrp_est = 0;
248
249
    my $qty_total;
250
    my @books_loop;
239
    my @books_loop;
251
    my $suggestion;
252
240
253
    for my $order ( @results ) {
241
    my @book_foot_loop;
254
        my $rrp = $order->{'listprice'} || 0;
242
    my %foot;
255
		my $qty = $order->{'quantity'} || 0;
243
    my $total_quantity = 0;
256
        if (!defined $order->{quantityreceived}) {
244
    my $total_gste = 0;
257
            $order->{quantityreceived} = 0;
245
    my $total_gsti = 0;
258
        }
246
    my $total_gstvalue = 0;
259
        for ( qw(rrp ecost quantityreceived)) {
247
    for my $order (@results) {
260
            if (!defined $order->{$_}) {
248
        my $line = get_order_infos( $order, $bookseller);
261
                $order->{$_} = 0;
249
        if ( $line->{uncertainprice} ) {
262
            }
263
        }
264
265
        my $budget = GetBudget(  $order->{'budget_id'} );
266
        $rrp = ConvertCurrency( $order->{'currency'}, $rrp );
267
268
        $total_rrp += $qty * $order->{'rrp'};
269
        my $line_total = $qty * $order->{'ecost'};
270
        $total_rrp_est += $qty * $order->{'ecost'};
271
		# FIXME: what about the "actual cost" field?
272
        $qty_total += $qty;
273
        my %line = %{ $order };
274
        my $biblionumber = $order->{'biblionumber'};
275
        my $countbiblio = CountBiblioInOrders($biblionumber);
276
        my $ordernumber = $order->{'ordernumber'};
277
        my @subscriptions = GetSubscriptionsId ($biblionumber);
278
        my $itemcount = GetItemsCount($biblionumber);
279
        my $holds  = GetHolds ($biblionumber);
280
        my @items = GetItemnumbersFromOrder( $ordernumber );
281
        my $itemholds;
282
        foreach my $item (@items){
283
            my $nb = GetItemHolds($biblionumber, $item);
284
            if ($nb){
285
                $itemholds += $nb;
286
            }
287
        }
288
        # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
289
        $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
290
        $line{items}                = ($itemcount) - (scalar @items);
291
        $line{left_item}            = 1 if $line{items} >= 1;
292
        $line{left_biblio}          = 1 if $countbiblio > 1;
293
        $line{biblios}              = $countbiblio - 1;
294
        $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
295
        $line{subscriptions}        = scalar @subscriptions;
296
        ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
297
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
298
        $line{holds}                = $holds;
299
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
300
        $line{order_received}       = ( $qty == $order->{'quantityreceived'} );
301
        $line{basketno}             = $basketno;
302
        $line{budget_name}          = $budget->{budget_name};
303
        $line{rrp}                  = sprintf( "%.2f", $line{'rrp'} );
304
        $line{ecost}                = sprintf( "%.2f", $line{'ecost'} );
305
        $line{line_total}           = sprintf( "%.2f", $line_total );
306
        if ($line{uncertainprice}) {
307
            $template->param( uncertainprices => 1 );
250
            $template->param( uncertainprices => 1 );
308
            $line{rrp} .= ' (Uncertain)';
309
        }
251
        }
310
	if ($line{'title'}){
252
311
	    my $volume = $order->{'volume'};
253
        push @books_loop, $line;
312
	    my $seriestitle = $order->{'seriestitle'};
254
313
	    $line{'title'} .= " / $seriestitle" if $seriestitle;
255
        $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
314
	    $line{'title'} .= " / $volume" if $volume;
256
        $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
315
	} else {
257
        $total_gstvalue += $$line{gstvalue};
316
	    $line{'title'} = "Deleted bibliographic notice, can't find title.";
258
        $foot{$$line{gstgsti}}{quantity}  += $$line{quantity};
317
	}
259
        $total_quantity += $$line{quantity};
318
260
        $foot{$$line{gstgsti}}{totalgste} += $$line{totalgste};
319
        $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
261
        $total_gste += $$line{totalgste};
320
        $line{suggestionid}         = $suggestion->{suggestionid};
262
        $foot{$$line{gstgsti}}{totalgsti} += $$line{totalgsti};
321
        $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
263
        $total_gsti += $$line{totalgsti};
322
        $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
323
324
        push @books_loop, \%line;
325
    }
264
    }
326
265
327
my $total_est_gste;
266
    push @book_foot_loop, map {$_} values %foot;
328
    my $total_est_gsti;
267
329
    my $gist_est;
268
    # Get cancelled orders
330
    if ($gist){                                                    # if we have GST
269
    @results = GetCancelledOrders($basketno);
331
       if ( $bookseller->{'listincgst'} ) {                        # if prices already includes GST
270
    my @cancelledorders_loop;
332
           $total_rrp_gsti = $total_rrp;                           # we know $total_rrp_gsti
271
    for my $order (@results) {
333
           $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 );      # and can reverse compute other values
272
        my $line = get_order_infos( $order, $bookseller);
334
           $gist_rrp       = $total_rrp_gsti - $total_rrp_gste;    #
273
        push @cancelledorders_loop, $line;
335
           $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount );
274
    }
336
           $total_est_gsti = $total_rrp_est;
337
        } else {                                                    # if prices does not include GST
338
           $total_rrp_gste = $total_rrp;                           # then we use the common way to compute other values
339
           $gist_rrp       = $total_rrp_gste * $gist;              #
340
           $total_rrp_gsti = $total_rrp_gste + $gist_rrp;          #
341
           $total_est_gste = $total_rrp_est;
342
           $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount );
343
       }
344
       $gist_est = $gist_rrp - ( $gist_rrp * $discount );
345
    } else {
346
    $total_rrp_gsti = $total_rrp;
347
    $total_est_gsti = $total_rrp_est;
348
}
349
275
350
    my $contract = &GetContract($basket->{contractnumber});
276
    my $contract = &GetContract($basket->{contractnumber});
351
    my @orders = GetOrders($basketno);
277
    my @orders = GetOrders($basketno);
Lines 382-399 my $total_est_gste; Link Here
382
        booksellerid         => $bookseller->{'id'},
308
        booksellerid         => $bookseller->{'id'},
383
        name                 => $bookseller->{'name'},
309
        name                 => $bookseller->{'name'},
384
        books_loop           => \@books_loop,
310
        books_loop           => \@books_loop,
311
        book_foot_loop       => \@book_foot_loop,
385
        cancelledorders_loop => \@cancelledorders,
312
        cancelledorders_loop => \@cancelledorders,
386
        gist_rate            => sprintf( "%.2f", $gist * 100 ) . '%',
313
        total_quantity       => $total_quantity,
387
        total_rrp_gste       => sprintf( "%.2f", $total_rrp_gste ),
314
        total_gste           => sprintf( "%.2f", $total_gste ),
388
        total_est_gste       => sprintf( "%.2f", $total_est_gste ),
315
        total_gsti           => sprintf( "%.2f", $total_gsti ),
389
        gist_est             => sprintf( "%.2f", $gist_est ),
316
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
390
        gist_rrp             => sprintf( "%.2f", $gist_rrp ),        
317
        currency             => $cur->{'currency'},
391
        total_rrp_gsti       => sprintf( "%.2f", $total_rrp_gsti ),
318
        listincgst           => $bookseller->{listincgst},
392
        total_est_gsti       => sprintf( "%.2f", $total_est_gsti ),
393
#        currency             => $bookseller->{'listprice'},
394
	currency		=> $cur->{'currency'},
395
        qty_total            => $qty_total,
396
        GST                  => $gist,
397
        basketgroups         => $basketgroups,
319
        basketgroups         => $basketgroups,
398
        grouped              => $basket->{basketgroupid},
320
        grouped              => $basket->{basketgroupid},
399
        unclosable           => @orders ? 0 : 1, 
321
        unclosable           => @orders ? 0 : 1, 
Lines 401-404 my $total_est_gste; Link Here
401
    );
323
    );
402
}
324
}
403
325
326
sub get_order_infos {
327
    my $order = shift;
328
    my $bookseller = shift;
329
    my $qty = $order->{'quantity'} || 0;
330
    if ( !defined $order->{quantityreceived} ) {
331
        $order->{quantityreceived} = 0;
332
    }
333
    my $budget = GetBudget( $order->{'budget_id'} );
334
335
    my %line = %{ $order };
336
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
337
    $line{basketno}       = $basketno;
338
    $line{budget_name}    = $budget->{budget_name};
339
    $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
340
    if ( $bookseller->{'listincgst'} ) {
341
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
342
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
343
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
344
        $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
345
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
346
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
347
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
348
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
349
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
350
    } else {
351
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
352
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
353
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
354
        $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
355
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
356
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
357
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
358
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
359
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
360
    }
361
362
    if ( $line{uncertainprice} ) {
363
        $line{rrpgste} .= ' (Uncertain)';
364
    }
365
    if ( $line{'title'} ) {
366
        my $volume      = $order->{'volume'};
367
        my $seriestitle = $order->{'seriestitle'};
368
        $line{'title'} .= " / $seriestitle" if $seriestitle;
369
        $line{'title'} .= " / $volume"      if $volume;
370
    } else {
371
        $line{'title'} = "Deleted bibliographic notice, can't find title.";
372
    }
373
374
    my $biblionumber = $order->{'biblionumber'};
375
    my $countbiblio = CountBiblioInOrders($biblionumber);
376
    my $ordernumber = $order->{'ordernumber'};
377
    my @subscriptions = GetSubscriptionsId ($biblionumber);
378
    my $itemcount = GetItemsCount($biblionumber);
379
    my $holds  = GetHolds ($biblionumber);
380
    my @items = GetItemnumbersFromOrder( $ordernumber );
381
    my $itemholds;
382
    foreach my $item (@items){
383
        my $nb = GetItemHolds($biblionumber, $item);
384
        if ($nb){
385
            $itemholds += $nb;
386
        }
387
    }
388
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
389
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
390
    $line{items}                = ($itemcount) - (scalar @items);
391
    $line{left_item}            = 1 if $line{items} >= 1;
392
    $line{left_biblio}          = 1 if $countbiblio > 1;
393
    $line{biblios}              = $countbiblio - 1;
394
    $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
395
    $line{subscriptions}        = scalar @subscriptions;
396
    ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
397
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
398
    $line{holds}                = $holds;
399
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
400
401
402
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
403
    $line{suggestionid}         = $$suggestion{suggestionid};
404
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
405
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
406
407
    return \%line;
408
}
409
404
output_html_with_http_headers $query, $cookie, $template->output;
410
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/acqui/finishreceive.pl (-20 / +52 lines)
Lines 28-33 use C4::Output; Link Here
28
use C4::Context;
28
use C4::Context;
29
use C4::Acquisition;
29
use C4::Acquisition;
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::Bookseller;
31
use C4::Items;
32
use C4::Items;
32
use C4::Search;
33
use C4::Search;
33
use List::MoreUtils qw/any/;
34
use List::MoreUtils qw/any/;
Lines 37-60 my $flagsrequired = {acquisition => 'order_receive'}; Link Here
37
38
38
checkauth($input, 0, $flagsrequired, 'intranet');
39
checkauth($input, 0, $flagsrequired, 'intranet');
39
40
40
my $user=$input->remote_user;
41
my $user             = $input->remote_user;
41
my $biblionumber = $input->param('biblionumber');
42
my $biblionumber     = $input->param('biblionumber');
42
my $biblioitemnumber=$input->param('biblioitemnumber');
43
my $biblioitemnumber = $input->param('biblioitemnumber');
43
my $ordernumber=$input->param('ordernumber');
44
my $ordernumber      = $input->param('ordernumber');
44
my $origquantityrec=$input->param('origquantityrec');
45
my $origquantityrec  = $input->param('origquantityrec');
45
my $quantityrec=$input->param('quantityrec');
46
my $quantityrec      = $input->param('quantityrec');
46
my $quantity=$input->param('quantity');
47
my $quantity         = $input->param('quantity');
47
my $unitprice=$input->param('cost');
48
my $unitprice        = $input->param('cost');
48
my $invoiceno=$input->param('invoice');
49
my $invoiceno        = $input->param('invoice');
49
my $datereceived=$input->param('datereceived');
50
my $datereceived     = $input->param('datereceived');
50
my $replacement=$input->param('rrp');
51
my $freight          = $input->param('freight');
51
my $gst=$input->param('gst');
52
my $booksellerid     = $input->param('booksellerid');
52
my $freight=$input->param('freight');
53
my $cnt              = 0;
53
my $booksellerid = $input->param('booksellerid');
54
my $cnt=0;
55
my $error_url_str;
54
my $error_url_str;
56
my $ecost = $input->param('ecost');
55
my $ecost            = $input->param('ecost');
57
my $note = $input->param("note");
56
my $rrp              = $input->param('rrp');
57
my $note             = $input->param("note");
58
my $order            = GetOrder($ordernumber);
58
59
59
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
60
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
60
if ($quantityrec > $origquantityrec ) {
61
if ($quantityrec > $origquantityrec ) {
Lines 100-112 if ($quantityrec > $origquantityrec ) { Link Here
100
        @received_items = $input->param('items_to_receive');
101
        @received_items = $input->param('items_to_receive');
101
    }
102
    }
102
103
104
    $order->{rrp} = $rrp;
105
    $order->{ecost} = $ecost;
106
    $order->{unitprice} = $unitprice;
107
    my $bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid);
108
    if ( $bookseller->{listincgst} ) {
109
        if ( not $bookseller->{invoiceincgst} ) {
110
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} );
111
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} );
112
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} );
113
        }
114
    } else {
115
        if ( $bookseller->{invoiceincgst} ) {
116
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} );
117
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} );
118
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} );
119
        }
120
    }
121
103
    # save the quantity received.
122
    # save the quantity received.
104
    $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived, \@received_items);
123
    $datereceived = ModReceiveOrder(
124
        $biblionumber,
125
        $ordernumber,
126
        $quantityrec,
127
        $user,
128
        $order->{unitprice},
129
        $order->{ecost},
130
        $invoiceno,
131
        $freight,
132
        $order->{rrp},
133
        undef,
134
        $datereceived,
135
        \@received_items,
136
    );
105
}
137
}
106
138
107
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
139
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
108
140
109
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str");
141
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&datereceived=$datereceived$error_url_str");
110
142
111
################################ End of script ################################
143
################################ End of script ################################
112
144
Lines 117-123 sub update_item { Link Here
117
        booksellerid         => $booksellerid,
149
        booksellerid         => $booksellerid,
118
        dateaccessioned      => $datereceived,
150
        dateaccessioned      => $datereceived,
119
        price                => $unitprice,
151
        price                => $unitprice,
120
        replacementprice     => $replacement,
152
        replacementprice     => $rrp,
121
        replacementpricedate => $datereceived,
153
        replacementpricedate => $datereceived,
122
    }, $biblionumber, $itemnumber );
154
    }, $biblionumber, $itemnumber );
123
}
155
}
(-)a/acqui/neworderempty.pl (-15 / +23 lines)
Lines 334-339 $template->param( Link Here
334
    budget_name  => $budget_name
334
    budget_name  => $budget_name
335
) if ($close);
335
) if ($close);
336
336
337
# get option values for gist syspref
338
my @gst_values = map {
339
    option => $_
340
}, split( '\|', C4::Context->preference("gist") );
341
342
my $cur = GetCurrency();
343
337
$template->param(
344
$template->param(
338
    existing         => $biblionumber,
345
    existing         => $biblionumber,
339
    ordernumber           => $ordernumber,
346
    ordernumber           => $ordernumber,
Lines 353-370 $template->param( Link Here
353
    suggestionid         => $suggestion->{suggestionid},
360
    suggestionid         => $suggestion->{suggestionid},
354
    surnamesuggestedby   => $suggestion->{surnamesuggestedby},
361
    surnamesuggestedby   => $suggestion->{surnamesuggestedby},
355
    firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
362
    firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
356
    biblionumber     => $biblionumber,
363
    biblionumber         => $biblionumber,
357
    uncertainprice   => $data->{'uncertainprice'},
364
    uncertainprice       => $data->{'uncertainprice'},
358
    authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'},
365
    authorisedbyname     => $borrower->{'firstname'} . " " . $borrower->{'surname'},
359
    biblioitemnumber => $data->{'biblioitemnumber'},
366
    biblioitemnumber     => $data->{'biblioitemnumber'},
360
    discount_2dp     => sprintf( "%.2f",  $bookseller->{'discount'}) ,   # for display
367
    discount_2dp         => sprintf( "%.2f",  $bookseller->{'discount'} ) ,   # for display
361
    discount         => $bookseller->{'discount'},
368
    discount             => $bookseller->{'discount'},
369
    orderdiscount_2dp    => sprintf( "%.2f", $data->{'discount'} || 0 ),
370
    orderdiscount        => $data->{'discount'},
362
    listincgst       => $bookseller->{'listincgst'},
371
    listincgst       => $bookseller->{'listincgst'},
363
    invoiceincgst    => $bookseller->{'invoiceincgst'},
372
    invoiceincgst    => $bookseller->{'invoiceincgst'},
364
    name             => $bookseller->{'name'},
373
    name             => $bookseller->{'name'},
365
    cur_active_sym   => $active_currency->{'symbol'},
374
    cur_active_sym   => $active_currency->{'symbol'},
366
    cur_active       => $active_currency->{'currency'},
375
    cur_active       => $active_currency->{'currency'},
367
    loop_currencies  => \@loop_currency,
376
    loop_currencies  => \@loop_currency,
377
    currency_rate    => $cur->{rate},
368
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
378
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
369
    title            => $data->{'title'},
379
    title            => $data->{'title'},
370
    author           => $data->{'author'},
380
    author           => $data->{'author'},
Lines 378-396 $template->param( Link Here
378
    quantity         => $data->{'quantity'},
388
    quantity         => $data->{'quantity'},
379
    quantityrec      => $data->{'quantity'},
389
    quantityrec      => $data->{'quantity'},
380
    rrp              => $data->{'rrp'},
390
    rrp              => $data->{'rrp'},
381
    listprice        => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
391
    gst_values       => \@gst_values,
382
    total            => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
392
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
383
    ecost            => $data->{'ecost'},
393
    gstreg           => $bookseller->{'gstreg'},
384
    unitprice        => sprintf("%.2f", $data->{'unitprice'}||0),
394
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
395
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
396
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
397
    unitprice        => sprintf( "%.2f", $data->{unitprice} || 0),
385
    notes            => $data->{'notes'},
398
    notes            => $data->{'notes'},
386
    publishercode    => $data->{'publishercode'},
399
    publishercode    => $data->{'publishercode'},
387
    barcode_subfield => $barcode_subfield,
400
    barcode_subfield => $barcode_subfield,
388
    
389
    import_batch_id  => $import_batch_id,
401
    import_batch_id  => $import_batch_id,
390
391
# CHECKME: gst-stuff needs verifing, mason.
392
    gstrate          => $bookseller->{'gstrate'} // C4::Context->preference("gist") // 0,
393
    gstreg           => $bookseller->{'gstreg'},
394
    (uc(C4::Context->preference("marcflavour"))) => 1
402
    (uc(C4::Context->preference("marcflavour"))) => 1
395
);
403
);
396
404
(-)a/acqui/orderreceive.pl (-14 / +36 lines)
Lines 93-100 my $datereceived = $input->param('datereceived'); Link Here
93
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
93
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
94
94
95
my $bookseller = GetBookSellerFromId($booksellerid);
95
my $bookseller = GetBookSellerFromId($booksellerid);
96
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst'));
97
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
98
my $results = SearchOrder($ordernumber,$search);
96
my $results = SearchOrder($ordernumber,$search);
99
97
100
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
98
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 159-174 if ( $count == 1 ) { Link Here
159
        $template->param(items => \@items);
157
        $template->param(items => \@items);
160
    }
158
    }
161
159
162
    if ( $order->{'unitprice'} == 0 ) {
160
    $order->{quantityreceived} = '' if $order->{quantityreceived} == 0;
163
        $order->{'unitprice'} = '';
161
    $order->{unitprice} = '' if $order->{unitprice} == 0;
164
    }
162
163
    my $rrp;
164
    my $ecost;
165
    my $unitprice;
166
    if ( $bookseller->{listincgst} ) {
167
        if ( $bookseller->{invoiceincgst} ) {
168
            $rrp = $order->{rrp};
169
            $ecost = $order->{ecost};
170
            $unitprice = $order->{unitprice};
171
        } else {
172
            $rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
173
            $ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
174
            $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
175
        }
176
    } else {
177
        if ( $bookseller->{invoiceincgst} ) {
178
            $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
179
            $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
180
            $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
181
        } else {
182
            $rrp = $order->{rrp};
183
            $ecost = $order->{ecost};
184
            $unitprice = $order->{unitprice};
185
        }
186
     }
165
187
166
    my $suggestion   = GetSuggestionInfoFromBiblionumber($order->{'biblionumber'});
188
    my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
167
189
168
    my $authorisedby = $order->{'authorisedby'};
190
    my $authorisedby = $order->{authorisedby};
169
    my $member = GetMember( borrowernumber => $authorisedby );
191
    my $member = GetMember( borrowernumber => $authorisedby );
170
192
171
    my $budget = GetBudget( $order->{'budget_id'} );
193
    my $budget = GetBudget( $order->{budget_id} );
172
194
173
    $template->param(
195
    $template->param(
174
        AcqCreateItem         => $AcqCreateItem,
196
        AcqCreateItem         => $AcqCreateItem,
Lines 178-184 if ( $count == 1 ) { Link Here
178
        biblioitemnumber      => $order->{'biblioitemnumber'},
200
        biblioitemnumber      => $order->{'biblioitemnumber'},
179
        booksellerid          => $order->{'booksellerid'},
201
        booksellerid          => $order->{'booksellerid'},
180
        freight               => $freight,
202
        freight               => $freight,
181
        gst                   => $gst,
203
        gstrate               => $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0,
182
        name                  => $bookseller->{'name'},
204
        name                  => $bookseller->{'name'},
183
        date                  => format_date($order->{entrydate}),
205
        date                  => format_date($order->{entrydate}),
184
        title                 => $order->{'title'},
206
        title                 => $order->{'title'},
Lines 190-198 if ( $count == 1 ) { Link Here
190
        quantity              => $order->{'quantity'},
212
        quantity              => $order->{'quantity'},
191
        quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
213
        quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
192
        quantityreceived      => $order->{'quantityreceived'},
214
        quantityreceived      => $order->{'quantityreceived'},
193
        rrp                   => $order->{'rrp'},
215
        rrp                   => sprintf( "%.2f", $rrp ),
194
        ecost                 => sprintf( "%.2f",$order->{'ecost'}),
216
        ecost                 => sprintf( "%.2f", $ecost ),
195
        unitprice             => sprintf( "%.2f",$order->{'unitprice'}),
217
        unitprice             => sprintf( "%.2f", $unitprice),
196
        memberfirstname       => $member->{firstname} || "",
218
        memberfirstname       => $member->{firstname} || "",
197
        membersurname         => $member->{surname} || "",
219
        membersurname         => $member->{surname} || "",
198
        invoice               => $invoice,
220
        invoice               => $invoice,
Lines 212-221 else { Link Here
212
        $line{invoice}      = $invoice;
234
        $line{invoice}      = $invoice;
213
        $line{datereceived} = $datereceived->output();
235
        $line{datereceived} = $datereceived->output();
214
        $line{freight}      = $freight;
236
        $line{freight}      = $freight;
215
        $line{gst}          = $gst;
237
        $line{gstrate}      = @$results[$i]->{'gstrate'} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
216
        $line{title}        = @$results[$i]->{'title'};
238
        $line{title}        = @$results[$i]->{'title'};
217
        $line{author}       = @$results[$i]->{'author'};
239
        $line{author}       = @$results[$i]->{'author'};
218
        $line{booksellerid}   = $booksellerid;
240
        $line{booksellerid} = $booksellerid;
219
        push @loop, \%line;
241
        push @loop, \%line;
220
    }
242
    }
221
243
(-)a/acqui/parcel.pl (-46 / +100 lines)
Lines 76-83 my $bookseller=GetBookSellerFromId($booksellerid); Link Here
76
76
77
my $invoice=$input->param('invoice') || '';
77
my $invoice=$input->param('invoice') || '';
78
my $freight=$input->param('freight');
78
my $freight=$input->param('freight');
79
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst'));
79
80
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
80
#my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); # FIXME from comm
81
#my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
82
81
my $datereceived =  ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) 
83
my $datereceived =  ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) 
82
					:  C4::Dates->new($input->param('datereceived'), 'iso')   ;
84
					:  C4::Dates->new($input->param('datereceived'), 'iso')   ;
83
$datereceived = C4::Dates->new() unless $datereceived;
85
$datereceived = C4::Dates->new() unless $datereceived;
Lines 90-105 my $resultsperpage = $input->param('resultsperpage'); Link Here
90
$resultsperpage = 20 unless ($resultsperpage);
92
$resultsperpage = 20 unless ($resultsperpage);
91
$startfrom=0 unless ($startfrom);
93
$startfrom=0 unless ($startfrom);
92
94
95
sub get_value_with_gst_params {
96
    my $value = shift;
97
    my $gstrate = shift;
98
    my $bookseller = shift;
99
    if ( $bookseller->{listincgst} ) {
100
        if ( $bookseller->{invoiceincgst} ) {
101
            return $value;
102
        } else {
103
            return $value / ( 1 + $gstrate );
104
        }
105
    } else {
106
        if ( $bookseller->{invoiceincgst} ) {
107
            return $value * ( 1 + $gstrate );
108
        } else {
109
            return $value;
110
        }
111
    }
112
}
113
114
sub get_gste {
115
    my $value = shift;
116
    my $gstrate = shift;
117
    my $bookseller = shift;
118
    return $bookseller->{invoiceincgst}
119
        ? $value / ( 1 + $gstrate )
120
        : $value;
121
}
122
123
sub get_gst {
124
    my $value = shift;
125
    my $gstrate = shift;
126
    my $bookseller = shift;
127
    return $bookseller->{invoiceincgst}
128
        ? $value / ( 1 + $gstrate ) * $gstrate
129
        : $value * ( 1 + $gstrate ) - $value;
130
}
131
93
if($input->param('format') eq "json"){
132
if($input->param('format') eq "json"){
94
    my ($template, $loggedinuser, $cookie)
133
    my ($template, $loggedinuser, $cookie)
95
        = get_template_and_user({template_name => "acqui/ajax.tmpl",
134
        = get_template_and_user({template_name => "acqui/ajax.tmpl",
96
                 query => $input,
135
                 query => $input,
97
				 type => "intranet",
136
                 type => "intranet",
98
                 authnotrequired => 0,
137
                 authnotrequired => 0,
99
                 flagsrequired => {acquisition => 'order_receive'},
138
                 flagsrequired => {acquisition => 'order_receive'},
100
                 debug => 1,
139
                 debug => 1,
101
    });
140
    });
102
       
141
103
    my @datas;
142
    my @datas;
104
    my $search   = $input->param('search')     || '';
143
    my $search   = $input->param('search')     || '';
105
    my $ean      = $input->param('ean')        || '';
144
    my $ean      = $input->param('ean')        || '';
Lines 111-117 if($input->param('format') eq "json"){ Link Here
111
    foreach my $order (@$orders) {
150
    foreach my $order (@$orders) {
112
        if ( $order->{quantityreceived} < $order->{quantity} ) {
151
        if ( $order->{quantityreceived} < $order->{quantity} ) {
113
            my $data = {};
152
            my $data = {};
114
            
153
            my $ecost = get_value_with_gst_params( $order->{ecost}, $order->{gstrate}, $bookseller );
154
115
            $data->{basketno} = $order->{basketno};
155
            $data->{basketno} = $order->{basketno};
116
            $data->{ordernumber} = $order->{ordernumber};
156
            $data->{ordernumber} = $order->{ordernumber};
117
            $data->{title} = $order->{title};
157
            $data->{title} = $order->{title};
Lines 121-132 if($input->param('format') eq "json"){ Link Here
121
            $data->{biblionumber} = $order->{biblionumber};
161
            $data->{biblionumber} = $order->{biblionumber};
122
            $data->{freight} = $order->{freight};
162
            $data->{freight} = $order->{freight};
123
            $data->{quantity} = $order->{quantity};
163
            $data->{quantity} = $order->{quantity};
124
            $data->{ecost} = $order->{ecost};
164
            $data->{ecost}        = sprintf( "%.2f", $ecost );
125
            $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity});
165
            $data->{ordertotal}   = sprintf( "%.2f", $ecost * $order->{quantity} );
126
            push @datas, $data;
166
            push @datas, $data;
127
        }
167
        }
128
    }
168
    }
129
    
169
130
    my $json_text = to_json(\@datas);
170
    my $json_text = to_json(\@datas);
131
    $template->param(return => $json_text);
171
    $template->param(return => $json_text);
132
    output_html_with_http_headers $input, $cookie, $template->output;
172
    output_html_with_http_headers $input, $cookie, $template->output;
Lines 136-142 if($input->param('format') eq "json"){ Link Here
136
my ($template, $loggedinuser, $cookie)
176
my ($template, $loggedinuser, $cookie)
137
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
177
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
138
                 query => $input,
178
                 query => $input,
139
				 type => "intranet",
179
                 type => "intranet",
140
                 authnotrequired => 0,
180
                 authnotrequired => 0,
141
                 flagsrequired => {acquisition => 'order_receive'},
181
                 flagsrequired => {acquisition => 'order_receive'},
142
                 debug => 1,
182
                 debug => 1,
Lines 157-200 if( scalar(@rcv_err) ) { Link Here
157
197
158
my $cfstr         = "%.2f";                                                           # currency format string -- could get this from currency table.
198
my $cfstr         = "%.2f";                                                           # currency format string -- could get this from currency table.
159
my @parcelitems   = GetParcel($booksellerid, $invoice, $datereceived->output('iso'));
199
my @parcelitems   = GetParcel($booksellerid, $invoice, $datereceived->output('iso'));
160
my $countlines    = scalar @parcelitems;
200
#my $countlines    = scalar @parcelitems; FIXME from comm, it's used ?
161
my $totalprice    = 0;
201
my $totalprice    = 0;
162
my $totalfreight  = 0;
202
my $totalfreight  = 0;
163
my $totalquantity = 0;
203
my $totalquantity = 0;
164
my $total;
204
my $total;
165
my $tototal;
205
my $tototal;
166
my @loop_received = ();
206
my @loop_received = ();
167
207
my @book_foot_loop;
168
for (my $i = 0 ; $i < $countlines ; $i++) {
208
my %foot;
169
209
my $total_quantity = 0;
170
    #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'};   #weird, are the freight fees counted by book? (pierre)
210
my $total_gste = 0;
171
    $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'};    #weird, are the freight fees counted by book? (pierre)
211
my $total_gsti = 0;
172
    $parcelitems[$i]->{'unitprice'} += 0;
212
213
for my $item ( @parcelitems ) {
214
    $item->{unitprice} = get_value_with_gst_params( $item->{unitprice}, $item->{gstrate}, $bookseller );
215
    $total = ( $item->{'unitprice'} ) * $item->{'quantityreceived'};    #weird, are the freight fees counted by book? (pierre)
216
    $item->{'unitprice'} += 0;
173
    my %line;
217
    my %line;
174
    %line          = %{ $parcelitems[$i] };
218
    %line          = %{ $item };
219
    my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
220
    $line{ecost} = sprintf( "%.2f", $ecost );
175
    $line{invoice} = $invoice;
221
    $line{invoice} = $invoice;
176
    $line{gst}     = $gst;
177
    $line{total} = sprintf($cfstr, $total);
222
    $line{total} = sprintf($cfstr, $total);
178
    $line{booksellerid} = $booksellerid;
223
    $line{booksellerid} = $booksellerid;
179
    push @loop_received, \%line;
224
    $totalprice += $item->{'unitprice'};
180
    $totalprice += $parcelitems[$i]->{'unitprice'};
225
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
181
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
226
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
227
    my $gst = get_gst( $line{total}, $line{gstrate}, $bookseller );
228
    $foot{$line{gstrate}}{gstrate} = $line{gstrate};
229
    $foot{$line{gstrate}}{value} += sprintf( "%.2f", $gst );
230
    $total_quantity += $line{quantity};
231
    $total_gste += $gste;
232
    $total_gsti += $gste + $gst;
182
233
183
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
234
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
184
    $line{suggestionid}         = $suggestion->{suggestionid};
235
    $line{suggestionid}         = $suggestion->{suggestionid};
185
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
236
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
186
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
237
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
187
238
188
    #double FIXME - totalfreight is redefined later.
239
    $totalfreight = $item->{'freight'};
240
    $totalquantity += $item->{'quantityreceived'};
189
241
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..
191
    if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) {
192
        warn "FREIGHT CHARGE MISMATCH!!";
193
    }
194
    $totalfreight = $parcelitems[$i]->{'freight'};
195
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
196
    $tototal       += $total;
242
    $tototal       += $total;
197
}
243
244
    my $budget = GetBudget( $line{budget_id} );
245
    $line{budget_name} = $budget->{'budget_name'};
246
247
    push @loop_received, \%line;
248
 }
249
250
push @book_foot_loop, map { $_ } values %foot;
198
251
199
my $pendingorders = GetPendingOrders($booksellerid);
252
my $pendingorders = GetPendingOrders($booksellerid);
200
my $countpendings = scalar @$pendingorders;
253
my $countpendings = scalar @$pendingorders;
Lines 206-228 my @loop_orders = (); Link Here
206
for (my $i = 0 ; $i < $countpendings ; $i++) {
259
for (my $i = 0 ; $i < $countpendings ; $i++) {
207
    my %line;
260
    my %line;
208
    %line = %{$pendingorders->[$i]};
261
    %line = %{$pendingorders->[$i]};
209
   
262
263
    my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
264
    $line{unitprice} = get_value_with_gst_params( $line{unitprice}, $line{gstrate}, $bookseller );
210
    $line{quantity}+=0;
265
    $line{quantity}+=0;
211
    $line{quantityreceived}+=0;
266
    $line{quantityreceived}+=0;
212
    $line{unitprice}+=0;
267
    $line{unitprice}+=0;
213
    $totalPunitprice += $line{unitprice};
268
    $totalPunitprice += $line{unitprice};
214
    $totalPquantity +=$line{quantity};
269
    $totalPquantity +=$line{quantity};
215
    $totalPqtyrcvd +=$line{quantityreceived};
270
    $totalPqtyrcvd +=$line{quantityreceived};
216
    $totalPecost += $line{ecost};
271
    $totalPecost += $ecost;
217
    $line{ecost} = sprintf("%.2f",$line{ecost});
272
    $line{ecost} = sprintf( "%.2f", $ecost );
218
    $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
273
    $line{ordertotal} = sprintf( "%.2f", $ecost * $line{quantity} );
219
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
274
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
220
    $line{invoice} = $invoice;
275
    $line{invoice} = $invoice;
221
    $line{gst} = $gst;
222
    $line{total} = $total;
223
    $line{booksellerid} = $booksellerid;
276
    $line{booksellerid} = $booksellerid;
224
    $ordergrandtotal += $line{ecost} * $line{quantity};
277
    $ordergrandtotal += $ecost * $line{quantity};
225
    
278
226
    my $biblionumber = $line{'biblionumber'};
279
    my $biblionumber = $line{'biblionumber'};
227
    my $countbiblio = CountBiblioInOrders($biblionumber);
280
    my $countbiblio = CountBiblioInOrders($biblionumber);
228
    my $ordernumber = $line{'ordernumber'};
281
    my $ordernumber = $line{'ordernumber'};
Lines 243-248 for (my $i = 0 ; $i < $countpendings ; $i++) { Link Here
243
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
296
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
244
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
297
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
245
298
299
    my $budget = GetBudget( $line{budget_id} );
300
    $line{budget_name} = $budget->{'budget_name'};
301
246
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
302
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
247
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
303
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
248
    $line{items}                = ($itemcount) - (scalar @items);
304
    $line{items}                = ($itemcount) - (scalar @items);
Lines 255-262 for (my $i = 0 ; $i < $countpendings ; $i++) { Link Here
255
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
311
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
256
    $line{holds}                = $holds;
312
    $line{holds}                = $holds;
257
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
313
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
258
    
314
259
    
260
    push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
315
    push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
261
}
316
}
262
$freight = $totalfreight unless $freight;
317
$freight = $totalfreight unless $freight;
Lines 294-300 if ($count>$resultsperpage){ Link Here
294
                    );
349
                    );
295
}
350
}
296
351
297
#$totalfreight=$freight;
298
$tototal = $tototal + $freight;
352
$tototal = $tototal + $freight;
299
353
300
$template->param(
354
$template->param(
Lines 304-329 $template->param( Link Here
304
    formatteddatereceived => $datereceived->output(),
358
    formatteddatereceived => $datereceived->output(),
305
    name                  => $bookseller->{'name'},
359
    name                  => $bookseller->{'name'},
306
    booksellerid            => $booksellerid,
360
    booksellerid            => $booksellerid,
307
    gst                   => $gst,
308
    freight               => $freight,
361
    freight               => $freight,
309
    invoice               => $invoice,
362
    invoice               => $invoice,
310
    countreceived         => $countlines,
311
    loop_received         => \@loop_received,
363
    loop_received         => \@loop_received,
312
    countpending          => $countpendings,
313
    loop_orders           => \@loop_orders,
364
    loop_orders           => \@loop_orders,
365
    book_foot_loop        => \@book_foot_loop,
314
    totalprice            => sprintf($cfstr, $totalprice),
366
    totalprice            => sprintf($cfstr, $totalprice),
315
    totalfreight          => $totalfreight,
367
    totalfreight          => $totalfreight,
316
    totalquantity         => $totalquantity,
368
    totalquantity         => $totalquantity,
317
    tototal               => sprintf($cfstr, $tototal),
369
    tototal               => sprintf($cfstr, $tototal),
318
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
370
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
319
    gst                   => $gst,
371
    grandtot              => sprintf($cfstr, $tototal ),
320
    grandtot              => sprintf($cfstr, $tototal + $gst),
321
    totalPunitprice       => sprintf("%.2f", $totalPunitprice),
372
    totalPunitprice       => sprintf("%.2f", $totalPunitprice),
322
    totalPquantity        => $totalPquantity,
373
    totalPquantity        => $totalPquantity,
323
    totalPqtyrcvd         => $totalPqtyrcvd,
374
    totalPqtyrcvd         => $totalPqtyrcvd,
324
    totalPecost           => sprintf("%.2f", $totalPecost),
375
    totalPecost           => sprintf("%.2f", $totalPecost),
325
    resultsperpage        => $resultsperpage,
376
    resultsperpage        => $resultsperpage,
326
    (uc(C4::Context->preference("marcflavour"))) => 1
377
    (uc(C4::Context->preference("marcflavour"))) => 1,
378
    total_quantity       => $total_quantity,
379
    total_gste           => sprintf( "%.2f", $total_gste ),
380
    total_gsti           => sprintf( "%.2f", $total_gsti ),
327
);
381
);
328
output_html_with_http_headers $input, $cookie, $template->output;
382
output_html_with_http_headers $input, $cookie, $template->output;
329
 
383
 
(-)a/acqui/supplier.pl (-12 / +7 lines)
Lines 67-78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
67
        debug           => 1,
67
        debug           => 1,
68
    }
68
    }
69
);
69
);
70
my $seller_gstrate = $supplier->{'gstrate'};
71
70
72
# ensure the scalar isn't flagged as a string
73
$seller_gstrate = ( defined $seller_gstrate ) ? $seller_gstrate + 0 : undef;
74
my $tax_rate = $seller_gstrate // C4::Context->preference('gist') // 0;
75
$tax_rate *= 100;
76
#build array for currencies
71
#build array for currencies
77
if ( $op eq 'display' ) {
72
if ( $op eq 'display' ) {
78
73
Lines 102-113 if ( $op eq 'display' ) { Link Here
102
        gstreg        => $supplier->{'gstreg'},
97
        gstreg        => $supplier->{'gstreg'},
103
        listincgst    => $supplier->{'listincgst'},
98
        listincgst    => $supplier->{'listincgst'},
104
        invoiceincgst => $supplier->{'invoiceincgst'},
99
        invoiceincgst => $supplier->{'invoiceincgst'},
100
        gstrate       => $supplier->{'gstrate'} + 0.0,
105
        discount      => $supplier->{'discount'},
101
        discount      => $supplier->{'discount'},
106
        deliverytime  => $supplier->{deliverytime},
102
        deliverytime  => $supplier->{deliverytime},
107
        invoiceprice  => $supplier->{'invoiceprice'},
103
        invoiceprice  => $supplier->{'invoiceprice'},
108
        listprice     => $supplier->{'listprice'},
104
        listprice     => $supplier->{'listprice'},
109
        GST           => $tax_rate,
110
        default_tax   => defined($seller_gstrate),
111
        basketcount   => $supplier->{'basketcount'},
105
        basketcount   => $supplier->{'basketcount'},
112
        subscriptioncount   => $supplier->{'subscriptioncount'},
106
        subscriptioncount   => $supplier->{'subscriptioncount'},
113
        contracts     => $contracts,
107
        contracts     => $contracts,
Lines 142-150 if ( $op eq 'display' ) { Link Here
142
            };
136
            };
143
    }
137
    }
144
138
145
    my $default_gst_rate = (C4::Context->preference('gist') * 100) || '0.0';
139
    # get option values from gist syspref
140
    my @gst_values = map {
141
        option => $_
142
    }, split( '\|', C4::Context->preference("gist") );
146
143
147
    my $gstrate = defined $supplier->{gstrate} ? $supplier->{gstrate} * 100 : '';
148
    $template->param(
144
    $template->param(
149
        booksellerid => $booksellerid,
145
        booksellerid => $booksellerid,
150
        name         => $supplier->{'name'},
146
        name         => $supplier->{'name'},
Lines 170-182 if ( $op eq 'display' ) { Link Here
170
        gstreg        => $supplier->{'gstreg'},
166
        gstreg        => $supplier->{'gstreg'},
171
        listincgst    => $supplier->{'listincgst'},
167
        listincgst    => $supplier->{'listincgst'},
172
        invoiceincgst => $supplier->{'invoiceincgst'},
168
        invoiceincgst => $supplier->{'invoiceincgst'},
173
        gstrate       => $gstrate,
169
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
170
        gst_values    => \@gst_values,
174
        discount      => $supplier->{'discount'},
171
        discount      => $supplier->{'discount'},
175
        deliverytime  => $supplier->{deliverytime},
172
        deliverytime  => $supplier->{deliverytime},
176
        loop_currency => $loop_currency,
173
        loop_currency => $loop_currency,
177
        GST           => $tax_rate,
178
        enter         => 1,
174
        enter         => 1,
179
        default_gst_rate => $default_gst_rate,
180
    );
175
    );
181
}
176
}
182
177
(-)a/acqui/updatesupplier.pl (-7 / +2 lines)
Lines 100-112 $data{'gstreg'}=$input->param('gst'); Link Here
100
$data{'listincgst'}=$input->param('list_gst');
100
$data{'listincgst'}=$input->param('list_gst');
101
$data{'invoiceincgst'}=$input->param('invoice_gst');
101
$data{'invoiceincgst'}=$input->param('invoice_gst');
102
#have to transform this into fraction so it's easier to use
102
#have to transform this into fraction so it's easier to use
103
my $gstrate = $input->param('gstrate');
103
$data{'gstrate'} = $input->param('gstrate');
104
if ($gstrate eq '') {
104
$data{'discount'} = $input->param('discount');
105
    $data{'gstrate'} = undef;
106
} else {
107
    $data{'gstrate'} = $input->param('gstrate')/100;
108
}
109
$data{'discount'}=$input->param('discount');
110
$data{deliverytime} = $input->param('deliverytime');
105
$data{deliverytime} = $input->param('deliverytime');
111
$data{'active'}=$input->param('status');
106
$data{'active'}=$input->param('status');
112
if($data{'name'}) {
107
if($data{'name'}) {
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2739-2745 CREATE TABLE `aqorders` ( Link Here
2739
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2739
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2740
  `rrp` decimal(13,2) default NULL,
2740
  `rrp` decimal(13,2) default NULL,
2741
  `ecost` decimal(13,2) default NULL,
2741
  `ecost` decimal(13,2) default NULL,
2742
  `gst` decimal(13,2) default NULL,
2742
  gstrate decimal(6,4) default NULL,
2743
  discount float(6,4) default NULL,
2743
  `budget_id` int(11) NOT NULL,
2744
  `budget_id` int(11) NOT NULL,
2744
  `budgetgroup_id` int(11) NOT NULL,
2745
  `budgetgroup_id` int(11) NOT NULL,
2745
  `budgetdate` date default NULL,
2746
  `budgetdate` date default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (+15 lines)
Lines 5392-5397 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5392
    SetVersion ($DBversion);
5392
    SetVersion ($DBversion);
5393
}
5393
}
5394
5394
5395
5396
$DBversion = "3.09.00.XXX";
5397
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5398
    $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4)  DEFAULT NULL");
5399
    print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
5400
    SetVersion($DBversion);
5401
}
5402
5403
$DBversion = "3.09.00.XXX";
5404
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5405
    $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
5406
    print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
5407
    SetVersion($DBversion);
5408
}
5409
5395
=head1 FUNCTIONS
5410
=head1 FUNCTIONS
5396
5411
5397
=head2 TableExists($table)
5412
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-39 / +15 lines)
Lines 646-694 function messenger(X,Y,etc){ // FIXME: unused? Link Here
646
646
647
//  NEXT BLOCK IS USED BY NEWORDERBEMPTY
647
//  NEXT BLOCK IS USED BY NEWORDERBEMPTY
648
648
649
function calcNeworderTotal(){
649
function updateCosts(){
650
    //collect values
650
    var quantity = new Number($("#quantity").val());
651
    var f        = document.getElementById('Aform');
651
    var discount = new Number($("#discount").val());
652
    var quantity = new Number(f.quantity.value);
652
    var applygst = new Number ($("#applygst").val());
653
    var discount = new Number(f.discount.value);
653
    var listprice   =  new Number($("#listprice").val());
654
    var listinc  = new Number (f.listinc.value);
654
    var exchangerate =  new Number($("#currency_rate").val());
655
    //var currency = f.currency.value;
655
    var gst_on=false;
656
    var applygst = new Number (f.applygst.value);
656
657
    var listprice   =  new Number(f.listprice.value);
658
    var invoiceingst =  new Number (f.invoiceincgst.value);
659
//    var exchangerate =  new Number(f.elements[currency].value);      //get exchange rate
660
        var currcode = new String(document.getElementById('currency').value);
661
	var exchangerate =  new Number(document.getElementById(currcode).value);
662
663
    var gst_on=(!listinc && invoiceingst);
664
665
    //do real stuff
666
    var rrp   = new Number(listprice*exchangerate);
657
    var rrp   = new Number(listprice*exchangerate);
667
    var ecost = rrp;
658
    var ecost = rrp;
668
    if (100-discount != 100) { //Prevent rounding issues if no discount
659
    if ( 100-discount != 100 ) { //Prevent rounding issues if no discount
669
        ecost = new Number(Math.floor(rrp * (100 - discount ))/100);
660
        ecost = new Number(Math.floor(rrp * (100 - discount )) / 100);
670
    }
661
    }
671
    var GST   = new Number(0);
662
    var total =  new Number( ecost * quantity);
672
    if (gst_on) {
663
    $("#rrp").val(rrp.toFixed(2));
673
            rrp=rrp * (1+f.gstrate.value / 100);
664
    $("#ecost").val(ecost.toFixed(2));
674
        GST=ecost * f.gstrate.value / 100;
665
    $("#total").val(total.toFixed(2));
675
    }
666
    $("listprice").val(listprice.toFixed(2));
676
677
    var total =  new Number( (ecost + GST) * quantity);
678
667
679
    f.rrp.value = rrp.toFixed(2);
680
681
//	f.rrp.value = rrp
682
//	f.rrp.value = 'moo'
683
684
    f.ecost.value = ecost.toFixed(2);
685
    f.total.value = total.toFixed(2);
686
    f.listprice.value =  listprice.toFixed(2);
687
688
//  gst-stuff needs verifing, mason.
689
    if (f.GST) {
690
        f.GST.value=GST;
691
    }
692
    return true;
668
    return true;
693
}
669
}
694
670
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-1 / +1 lines)
Lines 163-169 Link Here
163
                            [% ELSE %]
163
                            [% ELSE %]
164
                            <li>
164
                            <li>
165
                            <label for="currency">Currency:</label>
165
                            <label for="currency">Currency:</label>
166
                            <select name="currency" id="currency" onchange="calcNeworderTotal();">
166
                            <select name="currency" id="currency">
167
                            [% FOREACH loop_currencie IN loop_currencies %]
167
                            [% FOREACH loop_currencie IN loop_currencies %]
168
                                    [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
168
                                    [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
169
                            </select>
169
                            </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-45 / +92 lines)
Lines 6-11 Link Here
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7
[% INCLUDE 'datatables-strings.inc' %]
7
[% INCLUDE 'datatables-strings.inc' %]
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9
10
<script type="text/javascript">
11
//<![CDATA[
12
    function updateColumnsVisibility(visible) {
13
        if ( visible ) {
14
            $("table .gste, .gsti").show();
15
        } else {
16
            [% IF ( listincgst ) %]
17
                $("table .gste").hide();
18
            [% ELSE %]
19
                $("table .gsti").hide();
20
            [% END %]
21
        }
22
    }
23
24
    $(document).ready(function() {
25
        $("#show_all_details").click(function(){
26
            updateColumnsVisibility($(this+":checked").val());
27
        });
28
29
        $("#show_all_details").attr('checked', false);
30
        updateColumnsVisibility(false);
31
    });
32
//]]>
33
</script>
34
9
[% UNLESS ( closedate ) %]
35
[% UNLESS ( closedate ) %]
10
<script type="text/javascript">
36
<script type="text/javascript">
11
//<![CDATA[
37
//<![CDATA[
Lines 229-244 Link Here
229
255
230
        [% UNLESS ( delete_confirm ) %]
256
        [% UNLESS ( delete_confirm ) %]
231
        <div id="acqui_basket_content" class="yui-g">
257
        <div id="acqui_basket_content" class="yui-g">
258
        <label for="show_all_details">
259
            <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
260
            Show all details
261
        </label>
232
        <h2>Order Details</h2>
262
        <h2>Order Details</h2>
233
        [% IF ( books_loop ) %]
263
        [% IF ( books_loop ) %]
234
            <table id="orders">
264
            <table id="orders">
235
                <thead>
265
                <thead>
236
                    <tr>
266
                    <tr>
237
                        <th>Order</th>
267
                        <th>Order</th>
238
                        <th>RRP</th>
268
                        <th class="gste">RRP tax exc.</th>
239
                        <th>Est.</th>
269
                        <th class="gste">ecost tax exc.</th>
270
                        <th class="gsti">RRP tax inc.</th>
271
                        <th class="gsti">ecost tax inc.</th>
240
                        <th>Qty.</th>
272
                        <th>Qty.</th>
241
                        <th>Total</th>
273
                        <th class="gste">Total tax exc. ([% currency %])</th>
274
                        <th class="gsti">Total tax inc. ([% currency %])</th>
275
                        <th>GST %</th>
276
                        <th>GST</th>
242
                        <th>Fund</th>
277
                        <th>Fund</th>
243
                        [% IF ( active ) %]
278
                        [% IF ( active ) %]
244
                            [% UNLESS ( closedate ) %]
279
                            [% UNLESS ( closedate ) %]
Lines 249-293 Link Here
249
                    </tr>
284
                    </tr>
250
                </thead>
285
                </thead>
251
                <tfoot>
286
                <tfoot>
252
                [% IF ( GST ) %]
287
                [% FOREACH foot_loo IN book_foot_loop %]
253
                <tr>
288
                    <tr>
254
                    <th scope="row">Total tax exc.</th>
289
                        <th>Total (GST [% foot_loo.gstgsti %])</th>
255
                    <td>[% total_rrp_gste %]</td>
290
                        <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
256
                    <td>&nbsp;</td>
291
                        <th>[% foot_loo.quantity %]</th>
257
                    <td>[% qty_total %]</td>
292
                        <th class="gste">[% foot_loo.totalgste %]</th>
258
                    <td>[% total_est_gste %]</td>
293
                        <th class="gsti">[% foot_loo.totalgsti %]</th>
259
                        [% IF ( active ) %]
294
                        <th/>
260
                            [% IF ( closedate ) %]
295
                        <th>[% foot_loo.gstvalue %]</th>
261
                            <td colspan="1" rowspan="3">&nbsp;</td>
296
                        <th/>
262
                            [% ELSE %]
297
                        [% IF ( foot_loo.active ) %]
263
                            <td colspan="3" rowspan="3">&nbsp;</td>
298
                            [% UNLESS ( foot_loo.closedate ) %]
299
                                <th/>&nbsp;<th/>
264
                            [% END %]
300
                            [% END %]
265
                        [% END %]
301
                        [% END %]
266
                </tr>
267
                <tr>
268
                    <th scope="row">Tax ([% gist_rate %])</th>
269
                    <td>[% gist_rrp %]</td>
270
                    <td>&nbsp;</td>
302
                    <td>&nbsp;</td>
271
                    <td>&nbsp;</td>
303
                    <td>&nbsp;</td>
272
                    <td>[% gist_est %]</td>
304
                    </tr>
273
                </tr>
305
                [% END %]
274
                <tr>
306
                <tr>
275
                    <th scope="row">Total tax inc. ([% currency %])</th>
307
                    <th>Total ([% currency %])</th>
276
                    <td>[% total_rrp_gsti %]</td>
308
                    <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
309
                    <th>[% total_quantity %]</th>
310
                    <th class="gste">[% total_gste %]</th>
311
                    <th class="gsti">[% total_gsti %]</th>
312
                    <th/>
313
                    <th>[% total_gstvalue %]</th>
314
                    <th/>
315
                    [% IF ( books_loo.active ) %]
316
                        [% UNLESS ( books_loo.closedate ) %]
317
                            <th/>&nbsp;<th/>
318
                        [% END %]
319
                    [% END %]
277
                    <td>&nbsp;</td>
320
                    <td>&nbsp;</td>
278
                    <td>[% qty_total %]</td>
279
                    <td>[% total_est_gsti %]</td>
280
                </tr>
281
                [% ELSE %]
282
                <tr>
283
                    <th scope="row">Total ([% currency %])</th>
284
                    <td>[% total_rrp_gsti %]</td>
285
                    <td>&nbsp;</td>
321
                    <td>&nbsp;</td>
286
                    <td>[% qty_total %]</td>
287
                    <td>[% total_est_gsti %]</td>
288
                    <td colspan="3">&nbsp;</td>
289
                </tr>
322
                </tr>
290
                [% END %]
291
                </tfoot>
323
                </tfoot>
292
                <tbody>
324
                <tbody>
293
                [% FOREACH books_loo IN books_loop %]
325
                [% FOREACH books_loo IN books_loop %]
Lines 313-322 Link Here
313
                                [% END %]
345
                                [% END %]
314
                            </p>
346
                            </p>
315
                        </td>
347
                        </td>
316
                        <td class="number [% IF books_loo.rrp.search('^0') %]error[% END %]">[% books_loo.rrp %]</td>
348
                        <td class="number gste [% IF books_loo.rrpgste.search('^0') %]error[% END %]">[% books_loo.rrpgste %]</td>
317
                        <td class="number [% IF books_loo.ecost.search('^0') %]error[% END %]">[% books_loo.ecost %]</td>
349
                        <td class="number gste [% IF books_loo.ecostgste.search('^0') %]error[% END %]">[% books_loo.ecostgste %]</td>
350
                        <td class="number gsti [% IF books_loo.rrpgsti.search('^0') %]error[% END %]">[% books_loo.rrpgsti %]</td>
351
                        <td class="number gsti [% IF books_loo.ecostgsti.search('^0') %]error[% END %]">[% books_loo.ecostgsti %]</td>
318
                        <td class="number [% IF books_loo.quantity.search('^0') %]error[% END %]">[% books_loo.quantity %]</td>
352
                        <td class="number [% IF books_loo.quantity.search('^0') %]error[% END %]">[% books_loo.quantity %]</td>
319
                        <td class="number [% IF books_loo.line_total.search('^0') %]error[% END %]">[% books_loo.line_total %]</td>
353
                        <td class="number gste [% IF books_loo.totalgste.search('^0') %]error[% END %]">[% books_loo.totalgste %]</td>
354
                        <td class="number gsti [% IF books_loo.totalgsti.search('^0') %]error[% END %]">[% books_loo.totalgsti %]</td>
355
                        <td class="number [% IF books_loo.gstgsti.search('^0') %]error[% END %]">[% books_loo.gstgsti %]</td>
356
                        <td class="number [% IF books_loo.gstvalue.search('^0') %]error[% END %]">[% books_loo.gstvalue %]</td>
320
                        <td>[% books_loo.budget_name %]</td>
357
                        <td>[% books_loo.budget_name %]</td>
321
                        [% IF ( active ) %]
358
                        [% IF ( active ) %]
322
                            [% UNLESS ( closedate ) %]
359
                            [% UNLESS ( closedate ) %]
Lines 368-377 Link Here
368
              <thead>
405
              <thead>
369
                <tr>
406
                <tr>
370
                  <th>Order</th>
407
                  <th>Order</th>
371
                  <th>RRP</th>
408
                  <th class="gste">RRP tax exc.</th>
372
                  <th>Est.</th>
409
                  <th class="gste">ecost tax exc.</th>
410
                  <th class="gsti">RRP tax inc.</th>
411
                  <th class="gsti">ecost tax inc.</th>
373
                  <th>Qty.</th>
412
                  <th>Qty.</th>
374
                  <th>Total</th>
413
                  <th class="gste">Total tax exc. ([% currency %])</th>
414
                  <th class="gsti">Total tax inc. ([% currency %])</th>
415
                  <th>GST %</th>
416
                  <th>GST</th>
375
                  <th>Fund</th>
417
                  <th>Fund</th>
376
                </tr>
418
                </tr>
377
              </thead>
419
              </thead>
Lines 394-404 Link Here
394
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
436
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
395
                      </p>
437
                      </p>
396
                    </td>
438
                    </td>
397
                    <td><p>[% order.rrp %]</p></td>
439
                    <td class="number gste">[% order.rrpgste %]</td>
398
                    <td><p>[% order.ecost %]</p></td>
440
                    <td class="number gste">[% order.ecostgste %]</td>
399
                    <td><p>[% order.quantity %]</p></td>
441
                    <td class="number gsti">[% order.rrpgsti %]</td>
400
                    <td><p>[% order.line_total %]</p></td>
442
                    <td class="number gsti">[% order.ecostgsti %]</td>
401
                    <td><p>[% order.budget_name %]</p></td>
443
                    <td class="number">[% order.quantity %]</td>
444
                    <td class="number gste">[% order.totalgste %]</td>
445
                    <td class="number gsti">[% order.totalgsti %]</td>
446
                    <td class="number">[% order.gstgsti %]</td>
447
                    <td class="number">[% order.gstvalue %]</td>
448
                    <td>[% order.budget_name %]
402
                  </tr>
449
                  </tr>
403
                [% END %]
450
                [% END %]
404
              </tbody>
451
              </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-40 / +51 lines)
Lines 106-112 $(document).ready(function() Link Here
106
        [% END %]
106
        [% END %]
107
107
108
        $("#quantity").change(function() {
108
        $("#quantity").change(function() {
109
            calcNeworderTotal();
109
            updateCosts();
110
        });
110
        });
111
111
112
        //We apply the fonction only for modify option
112
        //We apply the fonction only for modify option
Lines 143-149 $(document).ready(function() Link Here
143
//]]>
143
//]]>
144
</script>
144
</script>
145
</head>
145
</head>
146
<body id="acq_neworderempty" class="acq">
146
<body id="acq_neworderempty" class="acq" onload="updateCosts()">
147
147
148
[% INCLUDE 'header.inc' %]
148
[% INCLUDE 'header.inc' %]
149
[% INCLUDE 'acquisitions-search.inc' %]
149
[% INCLUDE 'acquisitions-search.inc' %]
Lines 222-239 $(document).ready(function() Link Here
222
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
222
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
223
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
223
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
224
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
224
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
225
        <input type="hidden" name="discount" value="[% discount %]" />
225
        <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
226
        <input type="hidden" name="listinc" value="[% listincgst %]" />
226
        <input type="hidden" name="applygst" id="applygst" value="[% gstreg %]" />
227
<!--        <input type="hidden" name="currency" value="[% currency %]" />-->
227
        <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
228
        <input type="hidden" name="applygst" value="[% gstreg %]" />
229
        <input type="hidden" name="invoiceincgst" value="[% invoiceincgst %]" />
230
        <input type="hidden" name="gstrate" value="[% gstrate %]" />
231
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
228
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
232
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
229
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
230
        <input type="hidden" name="currency_rate" id="currency_rate" value="[% currency_rate %]" />
233
231
234
        [% FOREACH loop_currencie IN loop_currencies %]
235
            <input type="hidden" id="[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
236
        [% END %]
237
        <ol><li>
232
        <ol><li>
238
            [% IF ( biblionumber ) %]
233
            [% IF ( biblionumber ) %]
239
            <span class="label">Title</span>
234
            <span class="label">Title</span>
Lines 394-400 $(document).ready(function() Link Here
394
                    [% IF (AcqCreateItemOrdering) %]
389
                    [% IF (AcqCreateItemOrdering) %]
395
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
390
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
396
                    [% ELSE %]
391
                    [% ELSE %]
397
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" />
392
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
398
                    [% END %]
393
                    [% END %]
399
                [% END %]
394
                [% END %]
400
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
395
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
Lines 428-434 $(document).ready(function() Link Here
428
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
423
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
429
                [% ELSE %]
424
                [% ELSE %]
430
			<label for="currency">Currency:</label>
425
			<label for="currency">Currency:</label>
431
			<select name="currency" id="currency" onchange="calcNeworderTotal();">
426
			<select name="currency" id="currency" onchange="updateCosts();">
432
			[% FOREACH loop_currencie IN loop_currencies %]
427
			[% FOREACH loop_currencie IN loop_currencies %]
433
	                [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
428
	                [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
434
			</select>
429
			</select>
Lines 436-446 $(document).ready(function() Link Here
436
                </li>
431
                </li>
437
            <li>
432
            <li>
438
                [% IF ( close ) %]
433
                [% IF ( close ) %]
439
            <span class="label">Vendor price: </span>
434
                    <span class="label">Vendor price: </span>
440
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
435
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
441
                [% ELSE %]
436
                [% ELSE %]
442
                <label for="listprice">Vendor price: </label>
437
                <label for="listprice">Vendor price: </label>
443
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="calcNeworderTotal()" />
438
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="updateCosts()" />
444
                [% END %]
439
                [% END %]
445
            </li>
440
            </li>
446
            [% UNLESS ( close ) %]
441
            [% UNLESS ( close ) %]
Lines 453-505 $(document).ready(function() Link Here
453
                [% END %]
448
                [% END %]
454
            </li>
449
            </li>
455
            [% END %]
450
            [% END %]
456
			<li>
451
            <li>
457
                [% IF ( close ) %]
452
                [% IF ( close ) %]
458
            <span class="label">Replacement cost: </span>
453
                    <span class="label">gstrate: </span>
459
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
454
                    <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
460
                [% ELSE %]
455
                [% ELSE %]
461
                <label for="rrp">Replacement cost: </label>
456
                    <label for="gst">gstrate: </label>
462
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
457
                    <select name="gstrate" id="gstrate" onchange="updateCosts();">
458
                    [% FOREACH gst IN gst_values %]
459
                       <option value="[% gst.option %]"[% IF ( gst.option == gstrate ) %] selected="selected"[% END %]>[% gst.option * 100 | format("%.1f") %]%</option>
460
                    [% END %]
461
                    </select>
463
                [% END %]
462
                [% END %]
464
            </li>
463
            </li>
465
            <li>
464
            <li>
465
                <label for="discount">Discount: </label>
466
                [% IF ( close ) %]
466
                [% IF ( close ) %]
467
            <label for="ecost">Budgeted cost: </label>
467
                    [% IF ( orderdiscount ) %]
468
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
468
                        <input type="hidden" name="discount" id="discount" value="[% orderdiscount %]" />[% orderdiscount_2dp %]%
469
                    [% ELSE %]
470
                        <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
471
                    [% END %]
469
                [% ELSE %]
472
                [% ELSE %]
470
                <label for="ecost">Budgeted cost: </label>
473
                    [% IF ( orderdiscount ) %]
471
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
474
                        <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
475
                    [% ELSE %]
476
                        <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
477
                    [% END %]
472
                [% END %]
478
                [% END %]
473
                [% IF ( discount_2dp ) %]  (adjusted for [% discount_2dp %]% discount)  [% END %]
474
475
            </li>
479
            </li>
476
            [% IF ( GST ) %]
477
            <li>
480
            <li>
478
                [% IF ( close ) %]
481
                [% IF ( close ) %]
479
            <label for="GST">Budgeted GST: </label>
482
                    <span class="label">Replacement cost: </span>
480
                <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
483
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
481
                [% ELSE %]
484
                [% ELSE %]
482
                <label for="GST">Budgeted GST: </label>
485
                    <label for="rrp">Replacement cost: </label>
483
                <input type="text" size="20" name="gst" id="GST" value="" />
486
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
487
                [% END %]
488
            </li>
489
            <li>
490
                [% IF ( close ) %]
491
                    <label for="ecost">Budgeted cost: </label>
492
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
493
                [% ELSE %]
494
                    <label for="ecost">Budgeted cost: </label>
495
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
484
                [% END %]
496
                [% END %]
485
            </li>
497
            </li>
486
            [% END %]
487
            <li>
498
            <li>
488
                [% IF ( close ) %]
499
                [% IF ( close ) %]
489
            <label for="total">Total: </label>
500
                    <label for="total">Total: </label>
490
                <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
501
                    <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
491
                [% ELSE %]
502
                [% ELSE %]
492
                <label for="total">Total: </label>
503
                    <label for="total">Total: </label>
493
                <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
504
                    <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
494
                [% END %]
505
                [% END %]
495
            </li>
506
            </li>
496
            <li>
507
            <li>
497
                [% IF ( close ) %]
508
                [% IF ( close ) %]
498
            <label for="cost">Actual cost: </label>
509
                    <label for="unitprice">Actual cost: </label>
499
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
510
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
500
                [% ELSE %]
511
                [% ELSE %]
501
                <label for="cost">Actual cost: </label>
512
                    <label for="unitprice">Actual cost: </label>
502
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
513
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
503
                [% END %]
514
                [% END %]
504
            </li>
515
            </li>
505
            <li>
516
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-3 / +3 lines)
Lines 241-247 Link Here
241
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
241
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
242
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
242
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
243
    <input type="hidden" name="freight" value="[% freight %]" />
243
    <input type="hidden" name="freight" value="[% freight %]" />
244
    <input type="hidden" name="gst" value="[% gst %]" />
244
    <input type="hidden" name="gstrate" value="[% gstrate %]" />
245
	</div>
245
	</div>
246
	<div class="yui-u">
246
	<div class="yui-u">
247
    <fieldset class="rows">
247
    <fieldset class="rows">
Lines 302-308 Link Here
302
</div>
302
</div>
303
</div><div class="yui-g"><fieldset class="action">
303
</div><div class="yui-g"><fieldset class="action">
304
        <input type="submit"  value="Save" />
304
        <input type="submit"  value="Save" />
305
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
305
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=rate[% gstrate %]&amp;freight=[% freight %]">Cancel</a>
306
</fieldset></div>    </form>
306
</fieldset></div>    </form>
307
[% ELSE %]
307
[% ELSE %]
308
<div id="acqui_acquire_orderlist">
308
<div id="acqui_acquire_orderlist">
Lines 319-325 Link Here
319
        <tr>
319
        <tr>
320
            <td>[% loo.basketno %]</td>
320
            <td>[% loo.basketno %]</td>
321
            <td>[% loo.isbn %]</td>
321
            <td>[% loo.isbn %]</td>
322
         <td><a href="orderreceive.pl?datereceived=[% loo.datereceived %]&amp;receive=[% loo.ordernumber %]&amp;biblio=[% loo.biblionumber %]&amp;invoice=[% loo.invoice %]&amp;freight=[% loo.freight %]&amp;gst=[% loo.gst %]&amp;id=[% loo.id %]">[% loo.title |html %]</a></td>
322
         <td><a href="orderreceive.pl?datereceived=[% loo.datereceived %]&amp;receive=[% loo.ordernumber %]&amp;biblio=[% loo.biblionumber %]&amp;invoice=[% loo.invoice %]&amp;freight=[% loo.freight %]&amp;gstrate=[% loo.gstrate %]&amp;id=[% loo.id %]">[% loo.title |html %]</a></td>
323
            <td>[% loo.author %]</td>
323
            <td>[% loo.author %]</td>
324
            <td>[% loo.quantity %]</td>
324
            <td>[% loo.quantity %]</td>
325
            <td>[% loo.quantityreceived %]</td>
325
            <td>[% loo.quantityreceived %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-51 / +30 lines)
Lines 16-22 Link Here
16
    $(document).ready(function(){
16
    $(document).ready(function(){
17
        var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
17
        var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
18
            "aoColumnDefs": [
18
            "aoColumnDefs": [
19
                { "aTargets": [ 3, 7, 8 ], "bSortable": false, "bSearchable": false },
19
                { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false },
20
            ],
20
            ],
21
            "aoColumns": [
21
            "aoColumns": [
22
                { "sType": "num-html" },
22
                { "sType": "num-html" },
Lines 28-33 Link Here
28
                null,
28
                null,
29
                null,
29
                null,
30
                null,
30
                null,
31
                null,
31
            ],
32
            ],
32
            "sPaginationType": "four_button"
33
            "sPaginationType": "four_button"
33
        } ) );
34
        } ) );
Lines 47-52 Link Here
47
            ],
48
            ],
48
            "sPaginationType": "four_button"
49
            "sPaginationType": "four_button"
49
        } ) );
50
        } ) );
51
/*
52
    $("#pendingt").tablesorter({
53
		headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}}
54
    });
55
*/
50
56
51
	rowCountPending  = $("#pendingt tbody.filterclass tr").length;
57
	rowCountPending  = $("#pendingt tbody.filterclass tr").length;
52
	rowCountReceived = $("#receivedt tbody.filterclass tr").length;
58
	rowCountReceived = $("#receivedt tbody.filterclass tr").length;
Lines 70-76 Link Here
70
	$("#pendingcollapserow").remove();
76
	$("#pendingcollapserow").remove();
71
    $("#pendingt tr").show();
77
    $("#pendingt tr").show();
72
	$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
78
	$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
73
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + _("Only the first ")  + rowsToCollapse +  _(" items are displayed.") + "<a href=\"javascript:pendingExpand();\">" + _("Click here to show all ")  + rowCountPending + _(" items") + "<\/a>.<\/p>");
79
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + _("Only the first ")  + rowsToCollapse +  _(" items are displayed.") + " <a href=\"javascript:pendingExpand();\">" + _("Click here to show all ")  + rowCountPending + _(" items") + "<\/a>.<\/p>");
74
80
75
    }
81
    }
76
82
Lines 79-99 Link Here
79
	$("#pendingcollapserow").remove();
85
	$("#pendingcollapserow").remove();
80
	$("#pendingt tr").show();
86
	$("#pendingt tr").show();
81
    $("#pendingt tbody.filterclass tr.orderfound").remove();
87
    $("#pendingt tbody.filterclass tr.orderfound").remove();
82
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + "<a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
88
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + " <a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
83
    }
89
    }
84
90
85
    // Collapse already received items table
91
    // Collapse already received items table
86
    function receivedCollapse() {
92
    function receivedCollapse() {
87
	$("#receivedcollapserow").remove();
93
	$("#receivedcollapserow").remove();
88
	$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
94
	$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
89
	$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + "<a href=\"javascript:receivedExpand();\">" + _("Click here to show all ") + rowCountReceived + _(" items") + "<\/a>.<\/p>");
95
	$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + " <a href=\"javascript:receivedExpand();\">" + _("Click here to show all ") + rowCountReceived + _(" items") + "<\/a>.<\/p>");
90
    }
96
    }
91
97
92
    // Expand already received items table
98
    // Expand already received items table
93
    function receivedExpand() {
99
    function receivedExpand() {
94
	$("#receivedcollapserow").remove();
100
	$("#receivedcollapserow").remove();
95
	$("#receivedt tr").show();
101
	$("#receivedt tr").show();
96
	$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("All ") + rowCountReceived + _(" items are displayed.") + "<a href=\"javascript:receivedCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
102
	$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("All ") + rowCountReceived + _(" items are displayed.") + " <a href=\"javascript:receivedCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
97
    }
103
    }
98
104
99
    // Launch filtering
105
    // Launch filtering
Lines 116-122 Link Here
116
	var callback =  {
122
	var callback =  {
117
		success: function(o) {
123
		success: function(o) {
118
			var jsonString = o.responseText;
124
			var jsonString = o.responseText;
119
			var gst = "[% gst %]";
120
			try {
125
			try {
121
				var orders = YAHOO.lang.JSON.parse(jsonString);
126
				var orders = YAHOO.lang.JSON.parse(jsonString);
122
				var foundCount = orders.length;
127
				var foundCount = orders.length;
Lines 133-139 Link Here
133
                       + '<td>' + order.ecost + '</td>'
138
                       + '<td>' + order.ecost + '</td>'
134
                       + '<td>' + order.ordertotal + '</td>'
139
                       + '<td>' + order.ordertotal + '</td>'
135
                       + '<td>'
140
                       + '<td>'
136
                       + '<a href="orderreceive.pl?ordernumber=' + order.ordernumber + '&amp;datereceived=[% invoicedatereceived %]&amp;invoice=[% invoice %]&amp;gst=' + gst + '&amp;freight=' + order.freight + '&amp;booksellerid=[% booksellerid %]">Receive</a> /'
141
                       + '<a href="orderreceive.pl?ordernumber=' + order.ordernumber + '&amp;datereceived=[% invoicedatereceived %]&amp;invoice=[% invoice %]&amp;freight=' + order.freight + '&amp;booksellerid=[% booksellerid %]">Receive</a> /'
137
                       + '<a href="parcel.pl?type=intra&amp;ordernumber=' + order.ordernumber + '&amp;biblionumber=' + order.biblionumber + '&amp;action=cancelorder&amp;booksellerid=[% booksellerid %]&amp;datereceived=[% invoicedatereceived %]&amp;invoice=[% invoice %]" onclick="return confirm(\'' + _('Are you sure you want to cancel this order?') + '\');">Cancel</a>'
142
                       + '<a href="parcel.pl?type=intra&amp;ordernumber=' + order.ordernumber + '&amp;biblionumber=' + order.biblionumber + '&amp;action=cancelorder&amp;booksellerid=[% booksellerid %]&amp;datereceived=[% invoicedatereceived %]&amp;invoice=[% invoice %]" onclick="return confirm(\'' + _('Are you sure you want to cancel this order?') + '\');">Cancel</a>'
138
                       + '</td></tr>').appendTo("table#pendingt");
143
                       + '</td></tr>').appendTo("table#pendingt");
139
				}
144
				}
Lines 241-259 Link Here
241
            <th>Quantity</th>
246
            <th>Quantity</th>
242
            <th>Unit cost</th>
247
            <th>Unit cost</th>
243
            <th>Order cost</th>
248
            <th>Order cost</th>
249
            <th>Fund</th>
244
            <th>&nbsp;</th>
250
            <th>&nbsp;</th>
245
            <th>&nbsp;</th>
251
            <th>&nbsp;</th>
246
        </tr>
252
        </tr>
247
    </thead>
253
    </thead>
248
		<tfoot>
249
            <tr><td colspan="4" class="total">TOTAL</td>
250
                <td> [% totalPquantity %] </td>
251
				<td>&nbsp;</td>
252
                <td>[% ordergrandtotal %]</td>
253
				<td>&nbsp;</td>
254
				<td>&nbsp;</td>
255
            </tr>
256
		</tfoot>
257
    <tbody class="filterclass">
254
    <tbody class="filterclass">
258
        [% FOREACH loop_order IN loop_orders %]
255
        [% FOREACH loop_order IN loop_orders %]
259
            <tr>
256
            <tr>
Lines 280-288 Link Here
280
                <td>[% loop_order.quantity %]</td>
277
                <td>[% loop_order.quantity %]</td>
281
                <td>[% loop_order.ecost %]</td>
278
                <td>[% loop_order.ecost %]</td>
282
                <td>[% loop_order.ordertotal %]</td>
279
                <td>[% loop_order.ordertotal %]</td>
280
                <td>[% loop_order.budget_name %]</td>
283
				<td>
281
				<td>
284
                              <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;datereceived=[% invoicedatereceived %]&amp;invoice=[% invoice %]&amp;gst=[% loop_order.gst %]&amp;freight=[% loop_order.freight %]&amp;booksellerid=[% loop_order.booksellerid %]">Receive</a>
282
                    <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;datereceived=[% loop_order.invoicedatereceived %]&amp;invoice=[% loop_order.invoice %]&amp;freight=[% loop_order.freight %]&amp;booksellerid=[% loop_order.booksellerid %]">Receive</a>
285
				    
283
286
				</td>
284
				</td>
287
				<td>
285
				<td>
288
				    [% IF ( loop_order.left_holds_on_order ) %]
286
				    [% IF ( loop_order.left_holds_on_order ) %]
Lines 348-386 Link Here
348
	    </tr>
346
	    </tr>
349
    </thead>
347
    </thead>
350
    <tfoot>
348
    <tfoot>
351
	    <tr>
349
        <tr>
352
		<td colspan="4" class="total">SUBTOTAL</td>
350
            <th colspan="7" class="total">Total tax exc.</th>
353
		<td colspan="2">&nbsp;</td>
351
            <th>[% total_gste %]</th>
354
		<td>[% totalprice %]</td>
352
        </tr>
355
		<td>[% tototal %]</td>
353
        [% FOREACH book_foot IN book_foot_loop %]
356
	    </tr>
354
            <tr>
357
	      
355
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
358
	      [% IF ( totalfreight ) %]
356
                <th>[% book_foot.value %]</th>
359
		    <tr>
357
            </tr>
360
			<td colspan="6">&nbsp;
358
        [% END %]
361
		</td>
359
        <tr>
362
			    <td>Shipping</td>
360
            <th colspan="7" class="total">Total tax inc.</th>
363
		<td>[% totalfreight %]</td>
361
            <th>[% total_gsti %]</th>
364
	    	</tr> 
362
        </tr>
365
	    [% END %]
366
	      [% IF ( gst ) %]
367
		    <tr>
368
			<td colspan="6">
369
		<p class="message">
370
			    <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.
372
		</p>
373
		</td>
374
			    <td><b>Tax rate</b></td>
375
		<td>[% gst %]</td>
376
	    	</tr> 
377
	    [% END %]
378
	    <tr>
379
	    <td colspan="4" class="total">TOTAL</td>
380
		<td>[% totalquantity %]</td>
381
		<td colspan="2">&nbsp;</td>
382
		<td>[% grandtot %]</td>
383
	    </tr>
384
    </tfoot>
363
    </tfoot>
385
	<tbody class="filterclass">
364
	<tbody class="filterclass">
386
	    [% FOREACH loop_receive IN loop_received %]
365
	    [% FOREACH loop_receive IN loop_received %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-4 / +13 lines)
Lines 129-135 if (f.company.value == "") { Link Here
129
            </li>
129
            </li>
130
            </ol>
130
            </ol>
131
            <ol class="radio">
131
            <ol class="radio">
132
            <li><label for="gstyes" class="radio">Tax Number Registered:</label>
132
            <li><label for="gstyes" class="radio">Tax number registered:</label>
133
                [% IF ( gstreg ) %]
133
                [% IF ( gstreg ) %]
134
                    <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
134
                    <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
135
                    <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
135
                    <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
Lines 156-165 if (f.company.value == "") { Link Here
156
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
156
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
157
                [% END %]</li>
157
                [% END %]</li>
158
            </ol>
158
            </ol>
159
             <ol>
160
                <li>
161
                    <label for="gst">Tax rate</label>
162
                    <select name="gstrate" id="gstrate">
163
                    [% FOREACH gst IN gst_values %]
164
                       <option value="[% gst.option %]"[% IF ( gstrate == gst.option ) %] selected="selected"[% END %]>[% gst.option * 100 | format ("%.1f") %] %</option>
165
                    [% END %]
166
                    </select>
167
                </li>
168
            </ol>
159
            <ol>
169
            <ol>
160
            <li><label for="discount">Discount</label>
170
            <li><label for="discount">Discount</label>
161
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
171
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
162
            <li><label for="gstrate">Tax rate</label><input type="text" name="gstrate" id="gstrate" size="6" value="[% gstrate %]"/>% (leave blank for default tax of [% default_gst_rate %]%)</li>
163
            <li>
172
            <li>
164
                <label for="deliverytime">Delivery time</label>
173
                <label for="deliverytime">Delivery time</label>
165
                <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
174
                <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
Lines 214-220 if (f.company.value == "") { Link Here
214
                    [% END %]</p>
223
                    [% END %]</p>
215
            <p><strong>List prices are: </strong>[% listprice %]</p>
224
            <p><strong>List prices are: </strong>[% listprice %]</p>
216
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
225
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
217
            [% IF ( GST ) %]<p><strong>Tax number registered: </strong>
226
            [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
218
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
227
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
219
            <p><strong>List item price includes tax: </strong>
228
            <p><strong>List item price includes tax: </strong>
220
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
229
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
Lines 223-229 if (f.company.value == "") { Link Here
223
            <p><strong>Discount: </strong>
232
            <p><strong>Discount: </strong>
224
                [% discount %] %</p>
233
                [% discount %] %</p>
225
            <p><strong>Tax rate: </strong>
234
            <p><strong>Tax rate: </strong>
226
                [% GST %]%[% UNLESS ( default_tax ) %] (default)[% END %]</p>
235
                [% 0 + gstrate * 100 | format("%.1f") %]%</p>
227
            [% IF deliverytime.defined %]
236
            [% IF deliverytime.defined %]
228
                <p><strong>Delivery time: </strong>
237
                <p><strong>Delivery time: </strong>
229
                    [% deliverytime %] days</p>
238
                    [% deliverytime %] days</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-2 / +2 lines)
Lines 32-40 Acquisitions: Link Here
32
                  US: 360,000.00 (US)
32
                  US: 360,000.00 (US)
33
                  FR: 360 000,00 (FR)
33
                  FR: 360 000,00 (FR)
34
        -
34
        -
35
            - The default tax rate is
35
            - Default tax rates are
36
            - pref: gist
36
            - pref: gist
37
            - (enter in numeric form, 0.12 for 12%)
37
            - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
38
38
39
    Printing:
39
    Printing:
40
        -
40
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+34 lines)
Lines 126-131 $(document).ready(function() { Link Here
126
     </div>
126
     </div>
127
</div>
127
</div>
128
</div>
128
</div>
129
    [% IF ( show_acquisition_details ) %]
130
        <div id="acquisition_details">
131
            <h2>Acquisition details</h2>
132
            <table>
133
                <thead>
134
                    <tr><th></th><th>Price exc. taxes</th><th>Price inc. taxes</th><th>fund</th><th></th></tr>
135
                </thead>
136
                <tbody>
137
                    <tr>
138
                        <td>Ordered amount</td>
139
                        <td>[% valuegste_ordered %]</td>
140
                        <td>[% valuegsti_ordered %]</td>
141
                        <td>[% budget_name_ordered %]</td>
142
                        <td>
143
                            [% IF ( ordered_exists ) %]
144
                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">See basket informations</a>
145
                            [% END %]
146
                        </td>
147
                    </tr>
148
                    <tr>
149
                        <td>Spent amount</td>
150
                        <td>[% valuegste_spent %]</td>
151
                        <td>[% valuegsti_spent %]</td>
152
                        <td>[% budget_name_spent %]</td>
153
                        <td>
154
                            [% IF ( spent_exists ) %]
155
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoicenumber=[% invoicenumber %]">See invoice informations</a>
156
                            [% END %]
157
                        </td>
158
                    </tr>
159
                </tbody>
160
            </table>
161
        </div>
162
    <!-- /TMPL_IF -->
129
    <div id="subscription_planning">
163
    <div id="subscription_planning">
130
    <div class="yui-g">
164
    <div class="yui-g">
131
    <div class="rows">
165
    <div class="rows">
(-)a/serials/subscription-detail.pl (+27 lines)
Lines 119-124 if (! $subs->{periodicity}) { Link Here
119
    $subs->{periodicity} = '0';
119
    $subs->{periodicity} = '0';
120
}
120
}
121
my $default_bib_view = get_default_view();
121
my $default_bib_view = get_default_view();
122
123
my ( $order, $bookseller, $tmpl_infos );
124
if ( defined $subscriptionid ) {
125
    my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid;
126
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
127
    if ( defined $lastOrderNotReceived ) {
128
        my $basket = GetBasket $$lastOrderNotReceived{basketno};
129
        my $bookseller = GetBookSellerFromId $$basket{booksellerid};
130
        ( $$tmpl_infos{valuegsti_ordered}, $$tmpl_infos{valuegste_ordered} ) = get_value_with_gst_params ( $$lastOrderNotReceived{ecost}, $$lastOrderNotReceived{gstrate}, $bookseller );
131
        $$tmpl_infos{valuegsti_ordered} = sprintf( "%.2f", $$tmpl_infos{valuegsti_ordered} );
132
        $$tmpl_infos{valuegste_ordered} = sprintf( "%.2f", $$tmpl_infos{valuegste_ordered} );
133
        $$tmpl_infos{budget_name_ordered} = GetBudgetName $$lastOrderNotReceived{budget_id};
134
        $$tmpl_infos{basketno} = $$lastOrderNotReceived{basketno};
135
        $$tmpl_infos{ordered_exists} = 1;
136
    }
137
    if ( defined $lastOrderReceived ) {
138
        my $basket = GetBasket $$lastOrderReceived{basketno};
139
        my $bookseller = GetBookSellerFromId $$basket{booksellerid};
140
        ( $$tmpl_infos{valuegsti_spent}, $$tmpl_infos{valuegste_spent} ) = get_value_with_gst_params ( $$lastOrderReceived{unitprice}, $$lastOrderReceived{gstrate}, $bookseller );
141
        $$tmpl_infos{valuegsti_spent} = sprintf( "%.2f", $$tmpl_infos{valuegsti_spent} );
142
        $$tmpl_infos{valuegste_spent} = sprintf( "%.2f", $$tmpl_infos{valuegste_spent} );
143
        $$tmpl_infos{budget_name_spent} = GetBudgetName $$lastOrderReceived{budget_id};
144
        $$tmpl_infos{invoicenumber} = $$lastOrderReceived{booksellerinvoicenumber};
145
        $$tmpl_infos{spent_exists} = 1;
146
    }
147
}
148
122
$template->param(
149
$template->param(
123
	subscriptionid => $subscriptionid,
150
	subscriptionid => $subscriptionid,
124
    serialslist => \@serialslist,
151
    serialslist => \@serialslist,
(-)a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm (+1 lines)
Lines 48-53 sub one_parcel : Test( 17 ) { Link Here
48
                                        undef,         # $quantrec,
48
                                        undef,         # $quantrec,
49
                                        undef,         # $user,
49
                                        undef,         # $user,
50
                                        undef,         # $cost,
50
                                        undef,         # $cost,
51
                                        undef,         # $ecost,
51
                                        $invoice,         # $invoiceno,
52
                                        $invoice,         # $invoiceno,
52
                                        undef,         # $freight,
53
                                        undef,         # $freight,
53
                                        undef,         # $rrp,
54
                                        undef,         # $rrp,
(-)a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm (-1 / +1 lines)
Lines 276-281 sub create_order { Link Here
276
                                        undef,         # $quantrec,
276
                                        undef,         # $quantrec,
277
                                        undef,         # $user,
277
                                        undef,         # $user,
278
                                        undef,         # $cost,
278
                                        undef,         # $cost,
279
                                        undef,         # $ecost,
279
                                        $param{'invoice'},         # $invoiceno,
280
                                        $param{'invoice'},         # $invoiceno,
280
                                        undef,         # $freight,
281
                                        undef,         # $freight,
281
                                        undef,         # $rrp,
282
                                        undef,         # $rrp,
282
- 

Return to bug 5335