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

(-)a/C4/Acquisition.pm (-5 / +7 lines)
Lines 918-924 Else, the upcoming July 1st is used. Link Here
918
918
919
=item defaults entrydate to Now
919
=item defaults entrydate to Now
920
920
921
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".
921
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".
922
922
923
=back
923
=back
924
924
Lines 1137-1143 C<$ordernumber>. Link Here
1137
1137
1138
sub ModReceiveOrder {
1138
sub ModReceiveOrder {
1139
    my (
1139
    my (
1140
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost,
1140
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost, $ecost,
1141
        $invoiceno, $freight, $rrp, $budget_id, $datereceived
1141
        $invoiceno, $freight, $rrp, $budget_id, $datereceived
1142
    )
1142
    )
1143
    = @_;
1143
    = @_;
Lines 1168-1177 sub ModReceiveOrder { Link Here
1168
                , unitprice=?
1168
                , unitprice=?
1169
                , freight=?
1169
                , freight=?
1170
                , rrp=?
1170
                , rrp=?
1171
                , ecost=?
1171
                , quantity=?
1172
                , quantity=?
1172
            WHERE biblionumber=? AND ordernumber=?");
1173
            WHERE biblionumber=? AND ordernumber=?");
1173
1174
1174
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber);
1175
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$ecost,$quantrec,$biblionumber,$ordernumber);
1175
        $sth->finish;
1176
        $sth->finish;
1176
1177
1177
        # create a new order for the remaining items, and set its bookfund.
1178
        # create a new order for the remaining items, and set its bookfund.
Lines 1184-1192 sub ModReceiveOrder { Link Here
1184
} else {
1185
} else {
1185
        $sth=$dbh->prepare("update aqorders
1186
        $sth=$dbh->prepare("update aqorders
1186
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1187
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1187
                                unitprice=?,freight=?,rrp=?
1188
                                unitprice=?,freight=?,rrp=?,ecost=?
1188
                            where biblionumber=? and ordernumber=?");
1189
                            where biblionumber=? and ordernumber=?");
1189
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber);
1190
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$ecost,$biblionumber,$ordernumber);
1190
        $sth->finish;
1191
        $sth->finish;
1191
    }
1192
    }
1192
    return $datereceived;
1193
    return $datereceived;
Lines 1336-1341 sub GetParcel { Link Here
1336
                aqorders.listprice,
1337
                aqorders.listprice,
1337
                aqorders.rrp,
1338
                aqorders.rrp,
1338
                aqorders.ecost,
1339
                aqorders.ecost,
1340
                aqorders.gstrate,
1339
                biblio.title
1341
                biblio.title
1340
        FROM aqorders
1342
        FROM aqorders
1341
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1343
        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 207-212 if ( $orderinfo->{quantity} ne '0' ) { Link Here
207
                "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
177
                "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
208
                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
178
                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
209
                "biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
179
                "biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
180
                "aqorders.branchcode"         => $$orderinfo{branchcode} ? $$orderinfo{branchcode} : "",
181
                "aqorders.quantity"           => $$orderinfo{quantity} ? $$orderinfo{quantity} : "",
182
                "aqorders.listprice"          => $$orderinfo{listprice} ? $$orderinfo{listprice} : "",
183
                "aqorders.uncertainprice"     => $$orderinfo{uncertainprice} ? $$orderinfo{uncertainprice} : "",
184
                "aqorders.rrp"                => $$orderinfo{rrp} ? $$orderinfo{rrp} : "",
185
                "aqorders.ecost"              => $$orderinfo{ecost} ? $$orderinfo{ecost} : "",
186
                "aqorders.discount"           => $$orderinfo{discount} ? $$orderinfo{discount} : "",
210
            });
187
            });
211
188
212
        # create the record in catalogue, with framework ''
189
        # create the record in catalogue, with framework ''
Lines 219-224 if ( $orderinfo->{quantity} ne '0' ) { Link Here
219
		$orderinfo->{biblionumber}=$biblionumber;
196
		$orderinfo->{biblionumber}=$biblionumber;
220
    }
197
    }
221
198
199
    $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
200
222
    # if we already have $ordernumber, then it's an ordermodif
201
    # if we already have $ordernumber, then it's an ordermodif
223
    if ($$orderinfo{ordernumber}) {
202
    if ($$orderinfo{ordernumber}) {
224
        ModOrder( $orderinfo);
203
        ModOrder( $orderinfo);
(-)a/acqui/addorderiso2709.pl (-5 / +13 lines)
Lines 207-216 if ($op eq ""){ Link Here
207
        # we suppose the currency is correct, as we have no possibilities to get it.
207
        # we suppose the currency is correct, as we have no possibilities to get it.
208
        my $price= GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
208
        my $price= GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
209
        if ($price){
209
        if ($price){
210
            # in France, the cents separator is the , but sometimes, ppl use a .
211
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
212
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
210
            $price = $num->unformat_number($price);
213
            $price = $num->unformat_number($price);
211
        }
214
        }
212
        if ($price){
215
        if ($price){
213
            $orderinfo{'listprice'} = $price;
214
            eval {
216
            eval {
215
		require C4::Acquisition;
217
		require C4::Acquisition;
216
		import C4::Acquisition qw/GetBasket/;
218
		import C4::Acquisition qw/GetBasket/;
Lines 227-239 if ($op eq ""){ Link Here
227
	    }
229
	    }
228
            my $basket     = GetBasket( $orderinfo{basketno} );
230
            my $basket     = GetBasket( $orderinfo{basketno} );
229
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
231
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
230
            my $gst        = $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
232
            $orderinfo{gstrate} = $bookseller->{gstrate};
231
            $orderinfo{'unitprice'} = $orderinfo{listprice} - ( $orderinfo{listprice} * ( $bookseller->{discount} / 100 ) );
233
            if ( $bookseller->{listincgst} ) {
232
            $orderinfo{'ecost'} = $orderinfo{unitprice};
234
                $orderinfo{ecost} = $price;
235
            } else {
236
                $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} );
237
            }
238
            $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} );
239
            $orderinfo{listprice} = $orderinfo{rrp};
240
            $orderinfo{unitprice} = $orderinfo{ecost};
241
            $orderinfo{total} = $orderinfo{ecost};
233
        } else {
242
        } else {
234
            $orderinfo{'listprice'} = 0;
243
            $orderinfo{'listprice'} = 0;
235
        }
244
        }
236
        $orderinfo{'rrp'} = $orderinfo{'listprice'};
237
245
238
        # remove uncertainprice flag if we have found a price in the MARC record
246
        # remove uncertainprice flag if we have found a price in the MARC record
239
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
247
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
(-)a/acqui/basket.pl (-117 / +123 lines)
Lines 221-341 if ( $op eq 'delete_confirm' ) { Link Here
221
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
221
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
222
      $basket->{creationdate}, $basket->{authorisedby};
222
      $basket->{creationdate}, $basket->{authorisedby};
223
223
224
	#to get active currency
224
    #to get active currency
225
	my $cur = GetCurrency();
225
    my $cur = GetCurrency();
226
226
227
227
228
    my @results = GetOrders( $basketno );
228
    my @results = GetOrders( $basketno );
229
    
230
	my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
231
	$gist = 0 if $gist == 0.0000;
232
	my $discount = $bookseller->{'discount'} / 100;
233
    my $total_rrp = 0;      # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'}
234
    my $total_rrp_gsti = 0; # RRP Total, GST included
235
    my $total_rrp_gste = 0; # RRP Total, GST excluded
236
    my $gist_rrp = 0;
237
    my $total_rrp_est = 0;
238
239
    my $qty_total;
240
    my @books_loop;
229
    my @books_loop;
241
    my $suggestion;
242
230
243
    for my $order ( @results ) {
231
    my @book_foot_loop;
244
        my $rrp = $order->{'listprice'} || 0;
232
    my %foot;
245
		my $qty = $order->{'quantity'} || 0;
233
    my $total_quantity = 0;
246
        if (!defined $order->{quantityreceived}) {
234
    my $total_gste = 0;
247
            $order->{quantityreceived} = 0;
235
    my $total_gsti = 0;
248
        }
236
    my $total_gstvalue = 0;
249
        for ( qw(rrp ecost quantityreceived)) {
237
    for my $order (@results) {
250
            if (!defined $order->{$_}) {
238
        my $line = get_order_infos( $order, $bookseller);
251
                $order->{$_} = 0;
239
        if ( $line->{uncertainprice} ) {
252
            }
253
        }
254
255
        my $budget = GetBudget(  $order->{'budget_id'} );
256
        $rrp = ConvertCurrency( $order->{'currency'}, $rrp );
257
258
        $total_rrp += $qty * $order->{'rrp'};
259
        my $line_total = $qty * $order->{'ecost'};
260
        $total_rrp_est += $qty * $order->{'ecost'};
261
		# FIXME: what about the "actual cost" field?
262
        $qty_total += $qty;
263
        my %line = %{ $order };
264
        my $biblionumber = $order->{'biblionumber'};
265
        my $countbiblio = CountBiblioInOrders($biblionumber);
266
        my $ordernumber = $order->{'ordernumber'};
267
        my @subscriptions = GetSubscriptionsId ($biblionumber);
268
        my $itemcount = GetItemsCount($biblionumber);
269
        my $holds  = GetHolds ($biblionumber);
270
        my @items = GetItemnumbersFromOrder( $ordernumber );
271
        my $itemholds;
272
        foreach my $item (@items){
273
            my $nb = GetItemHolds($biblionumber, $item);
274
            if ($nb){
275
                $itemholds += $nb;
276
            }
277
        }
278
        # 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
279
        $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
280
        $line{items}                = ($itemcount) - (scalar @items);
281
        $line{left_item}            = 1 if $line{items} >= 1;
282
        $line{left_biblio}          = 1 if $countbiblio > 1;
283
        $line{biblios}              = $countbiblio - 1;
284
        $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
285
        $line{subscriptions}        = scalar @subscriptions;
286
        ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
287
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
288
        $line{holds}                = $holds;
289
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
290
        $line{order_received}       = ( $qty == $order->{'quantityreceived'} );
291
        $line{basketno}             = $basketno;
292
        $line{budget_name}          = $budget->{budget_name};
293
        $line{rrp}                  = sprintf( "%.2f", $line{'rrp'} );
294
        $line{ecost}                = sprintf( "%.2f", $line{'ecost'} );
295
        $line{line_total}           = sprintf( "%.2f", $line_total );
296
        if ($line{uncertainprice}) {
297
            $template->param( uncertainprices => 1 );
240
            $template->param( uncertainprices => 1 );
298
            $line{rrp} .= ' (Uncertain)';
299
        }
241
        }
300
	if ($line{'title'}){
242
301
	    my $volume = $order->{'volume'};
243
        push @books_loop, $line;
302
	    my $seriestitle = $order->{'seriestitle'};
244
303
	    $line{'title'} .= " / $seriestitle" if $seriestitle;
245
        $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
304
	    $line{'title'} .= " / $volume" if $volume;
246
        $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
305
	} else {
247
        $total_gstvalue += $$line{gstvalue};
306
	    $line{'title'} = "Deleted bibliographic notice, can't find title.";
248
        $foot{$$line{gstgsti}}{quantity}  += $$line{quantity};
307
	}
249
        $total_quantity += $$line{quantity};
308
250
        $foot{$$line{gstgsti}}{totalgste} += $$line{totalgste};
309
        $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
251
        $total_gste += $$line{totalgste};
310
        $line{suggestionid}         = $suggestion->{suggestionid};
252
        $foot{$$line{gstgsti}}{totalgsti} += $$line{totalgsti};
311
        $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
253
        $total_gsti += $$line{totalgsti};
312
        $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
313
314
        push @books_loop, \%line;
315
    }
254
    }
316
255
317
my $total_est_gste;
256
    push @book_foot_loop, map {$_} values %foot;
318
    my $total_est_gsti;
257
319
    my $gist_est;
258
    # Get cancelled orders
320
    if ($gist){                                                    # if we have GST
259
    @results = GetCancelledOrders($basketno);
321
       if ( $bookseller->{'listincgst'} ) {                        # if prices already includes GST
260
    my @cancelledorders_loop;
322
           $total_rrp_gsti = $total_rrp;                           # we know $total_rrp_gsti
261
    for my $order (@results) {
323
           $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 );      # and can reverse compute other values
262
        my $line = get_infos( $order, $bookseller);
324
           $gist_rrp       = $total_rrp_gsti - $total_rrp_gste;    #
263
        push @cancelledorders_loop, $line;
325
           $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount );
264
    }
326
           $total_est_gsti = $total_rrp_est;
327
        } else {                                                    # if prices does not include GST
328
           $total_rrp_gste = $total_rrp;                           # then we use the common way to compute other values
329
           $gist_rrp       = $total_rrp_gste * $gist;              #
330
           $total_rrp_gsti = $total_rrp_gste + $gist_rrp;          #
331
           $total_est_gste = $total_rrp_est;
332
           $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount );
333
       }
334
       $gist_est = $gist_rrp - ( $gist_rrp * $discount );
335
    } else {
336
    $total_rrp_gsti = $total_rrp;
337
    $total_est_gsti = $total_rrp_est;
338
}
339
265
340
    my $contract = &GetContract($basket->{contractnumber});
266
    my $contract = &GetContract($basket->{contractnumber});
341
    my @orders = GetOrders($basketno);
267
    my @orders = GetOrders($basketno);
Lines 371-388 my $total_est_gste; Link Here
371
        booksellerid         => $bookseller->{'id'},
297
        booksellerid         => $bookseller->{'id'},
372
        name                 => $bookseller->{'name'},
298
        name                 => $bookseller->{'name'},
373
        books_loop           => \@books_loop,
299
        books_loop           => \@books_loop,
300
        book_foot_loop       => \@book_foot_loop,
374
        cancelledorders_loop => \@cancelledorders,
301
        cancelledorders_loop => \@cancelledorders,
375
        gist_rate            => sprintf( "%.2f", $gist * 100 ) . '%',
302
        total_quantity       => $total_quantity,
376
        total_rrp_gste       => sprintf( "%.2f", $total_rrp_gste ),
303
        total_gste           => sprintf( "%.2f", $total_gste ),
377
        total_est_gste       => sprintf( "%.2f", $total_est_gste ),
304
        total_gsti           => sprintf( "%.2f", $total_gsti ),
378
        gist_est             => sprintf( "%.2f", $gist_est ),
305
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
379
        gist_rrp             => sprintf( "%.2f", $gist_rrp ),        
306
        currency             => $cur->{'currency'},
380
        total_rrp_gsti       => sprintf( "%.2f", $total_rrp_gsti ),
307
        listincgst           => $bookseller->{listincgst},
381
        total_est_gsti       => sprintf( "%.2f", $total_est_gsti ),
382
#        currency             => $bookseller->{'listprice'},
383
	currency		=> $cur->{'currency'},
384
        qty_total            => $qty_total,
385
        GST                  => $gist,
386
        basketgroups         => $basketgroups,
308
        basketgroups         => $basketgroups,
387
        grouped              => $basket->{basketgroupid},
309
        grouped              => $basket->{basketgroupid},
388
        unclosable           => @orders ? 0 : 1, 
310
        unclosable           => @orders ? 0 : 1, 
Lines 390-393 my $total_est_gste; Link Here
390
    );
312
    );
391
}
313
}
392
314
315
sub get_order_infos {
316
    my $order = shift;
317
    my $bookseller = shift;
318
    my $qty = $order->{'quantity'} || 0;
319
    if ( !defined $order->{quantityreceived} ) {
320
        $order->{quantityreceived} = 0;
321
    }
322
    my $budget = GetBudget( $order->{'budget_id'} );
323
324
    my %line = %{ $order };
325
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
326
    $line{basketno}       = $basketno;
327
    $line{budget_name}    = $budget->{budget_name};
328
    $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
329
    if ( $bookseller->{'listincgst'} ) {
330
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
331
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
332
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
333
        $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
334
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
335
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
336
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
337
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
338
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
339
    } else {
340
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
341
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
342
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
343
        $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
344
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
345
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
346
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
347
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
348
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
349
    }
350
351
    if ( $line{uncertainprice} ) {
352
        $line{rrpgste} .= ' (Uncertain)';
353
    }
354
    if ( $line{'title'} ) {
355
        my $volume      = $order->{'volume'};
356
        my $seriestitle = $order->{'seriestitle'};
357
        $line{'title'} .= " / $seriestitle" if $seriestitle;
358
        $line{'title'} .= " / $volume"      if $volume;
359
    } else {
360
        $line{'title'} = "Deleted bibliographic notice, can't find title.";
361
    }
362
363
    my $biblionumber = $order->{'biblionumber'};
364
    my $countbiblio = CountBiblioInOrders($biblionumber);
365
    my $ordernumber = $order->{'ordernumber'};
366
    my @subscriptions = GetSubscriptionsId ($biblionumber);
367
    my $itemcount = GetItemsCount($biblionumber);
368
    my $holds  = GetHolds ($biblionumber);
369
    my @items = GetItemnumbersFromOrder( $ordernumber );
370
    my $itemholds;
371
    foreach my $item (@items){
372
        my $nb = GetItemHolds($biblionumber, $item);
373
        if ($nb){
374
            $itemholds += $nb;
375
        }
376
    }
377
    # 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
378
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
379
    $line{items}                = ($itemcount) - (scalar @items);
380
    $line{left_item}            = 1 if $line{items} >= 1;
381
    $line{left_biblio}          = 1 if $countbiblio > 1;
382
    $line{biblios}              = $countbiblio - 1;
383
    $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
384
    $line{subscriptions}        = scalar @subscriptions;
385
    ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
386
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
387
    $line{holds}                = $holds;
388
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
389
390
391
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
392
    $line{suggestionid}         = $$suggestion{suggestionid};
393
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
394
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
395
396
    return \%line;
397
}
398
393
output_html_with_http_headers $query, $cookie, $template->output;
399
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/acqui/finishreceive.pl (-21 / +53 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);
59
my $unitprice        = $input->param('cost');
58
60
59
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
61
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
60
if ($quantityrec > $origquantityrec ) {
62
if ($quantityrec > $origquantityrec ) {
Lines 94-107 if ($quantityrec > $origquantityrec ) { Link Here
94
            NewOrderItem($itemnumber, $ordernumber);
96
            NewOrderItem($itemnumber, $ordernumber);
95
        }
97
        }
96
    }
98
    }
97
    
99
100
    $order->{rrp} = $rrp;
101
    $order->{ecost} = $ecost;
102
    $order->{unitprice} = $unitprice;
103
    my $bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid);
104
    if ( $bookseller->{listincgst} ) {
105
        if ( not $bookseller->{invoiceincgst} ) {
106
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} );
107
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} );
108
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} );
109
        }
110
    } else {
111
        if ( $bookseller->{invoiceincgst} ) {
112
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} );
113
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} );
114
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} );
115
        }
116
    }
117
98
    # save the quantity received.
118
    # save the quantity received.
99
    $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived);
119
    $datereceived = ModReceiveOrder(
120
        $biblionumber,
121
        $ordernumber,
122
        $quantityrec,
123
        $user,
124
        $order->{unitprice},
125
        $order->{ecost},
126
        $invoiceno,
127
        $freight,
128
        $order->{rrp},
129
        undef,
130
        $datereceived
131
    );
100
}
132
}
101
133
102
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
134
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
103
135
104
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str");
136
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&datereceived=$datereceived$error_url_str");
105
137
106
################################ End of script ################################
138
################################ End of script ################################
107
139
Lines 112-118 sub update_item { Link Here
112
        booksellerid         => $booksellerid,
144
        booksellerid         => $booksellerid,
113
        dateaccessioned      => $datereceived,
145
        dateaccessioned      => $datereceived,
114
        price                => $unitprice,
146
        price                => $unitprice,
115
        replacementprice     => $replacement,
147
        replacementprice     => $rrp,
116
        replacementpricedate => $datereceived,
148
        replacementpricedate => $datereceived,
117
    }, $biblionumber, $itemnumber );
149
    }, $biblionumber, $itemnumber );
118
}
150
}
(-)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 377-395 $template->param( Link Here
377
    quantity         => $data->{'quantity'},
387
    quantity         => $data->{'quantity'},
378
    quantityrec      => $data->{'quantity'},
388
    quantityrec      => $data->{'quantity'},
379
    rrp              => $data->{'rrp'},
389
    rrp              => $data->{'rrp'},
380
    listprice        => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
390
    gst_values       => \@gst_values,
381
    total            => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
391
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
382
    ecost            => $data->{'ecost'},
392
    gstreg           => $bookseller->{'gstreg'},
383
    unitprice        => sprintf("%.2f", $data->{'unitprice'}),
393
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
394
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
395
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
396
    unitprice        => sprintf( "%.2f", $data->{unitprice} || 0),
384
    notes            => $data->{'notes'},
397
    notes            => $data->{'notes'},
385
    publishercode    => $data->{'publishercode'},
398
    publishercode    => $data->{'publishercode'},
386
    barcode_subfield => $barcode_subfield,
399
    barcode_subfield => $barcode_subfield,
387
    
388
    import_batch_id  => $import_batch_id,
400
    import_batch_id  => $import_batch_id,
389
390
# CHECKME: gst-stuff needs verifing, mason.
391
    gstrate          => $bookseller->{'gstrate'} // C4::Context->preference("gist") // 0,
392
    gstreg           => $bookseller->{'gstreg'},
393
);
401
);
394
402
395
output_html_with_http_headers $input, $cookie, $template->output;
403
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/orderreceive.pl (-37 / +56 lines)
Lines 81-88 use C4::Suggestions; Link Here
81
my $input      = new CGI;
81
my $input      = new CGI;
82
82
83
my $dbh          = C4::Context->dbh;
83
my $dbh          = C4::Context->dbh;
84
my $booksellerid   = $input->param('booksellerid');
84
my $booksellerid = $input->param('booksellerid');
85
my $ordernumber       = $input->param('ordernumber');
85
my $ordernumber  = $input->param('ordernumber');
86
my $search       = $input->param('receive');
86
my $search       = $input->param('receive');
87
my $invoice      = $input->param('invoice');
87
my $invoice      = $input->param('invoice');
88
my $freight      = $input->param('freight');
88
my $freight      = $input->param('freight');
Lines 92-107 my $datereceived = $input->param('datereceived'); Link Here
92
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
92
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
93
93
94
my $bookseller = GetBookSellerFromId($booksellerid);
94
my $bookseller = GetBookSellerFromId($booksellerid);
95
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst'));
96
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
97
my $results = SearchOrder($ordernumber,$search);
95
my $results = SearchOrder($ordernumber,$search);
98
96
99
100
my $count   = scalar @$results;
97
my $count   = scalar @$results;
101
my $order 	= GetOrder($ordernumber);
98
my $order   = GetOrder($ordernumber);
99
my $gstrate = $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
102
100
103
101
104
my $date = @$results[0]->{'entrydate'};
102
my $date = $order->{entrydate};
105
103
106
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
104
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
107
    {
105
    {
Lines 125-170 if ( $count == 1 ) { Link Here
125
        }
123
        }
126
        my @itemloop;
124
        my @itemloop;
127
        push @itemloop,$cell;
125
        push @itemloop,$cell;
128
        
126
129
        $template->param(items => \@itemloop);
127
        $template->param(items => \@itemloop);
130
    }
128
    }
131
129
132
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
130
    $order->{quantityreceived} = '' if $order->{quantityreceived} == 0;
133
        @$results[0]->{'quantityreceived'} = '';
131
    $order->{unitprice} = '' if $order->{unitprice} == 0;
134
    }
132
135
    if ( @$results[0]->{'unitprice'} == 0 ) {
133
    my $rrp;
136
        @$results[0]->{'unitprice'} = '';
134
    my $ecost;
137
    }
135
    my $unitprice;
136
    if ( $bookseller->{listincgst} ) {
137
        if ( $bookseller->{invoiceincgst} ) {
138
            $rrp = $order->{rrp};
139
            $ecost = $order->{ecost};
140
            $unitprice = $order->{unitprice};
141
        } else {
142
            $rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
143
            $ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
144
            $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
145
        }
146
    } else {
147
        if ( $bookseller->{invoiceincgst} ) {
148
            $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
149
            $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
150
            $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
151
        } else {
152
            $rrp = $order->{rrp};
153
            $ecost = $order->{ecost};
154
            $unitprice = $order->{unitprice};
155
        }
156
     }
138
157
139
    my $suggestion   = GetSuggestionInfoFromBiblionumber(@$results[0]->{'biblionumber'});
158
    my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
140
159
141
    my $authorisedby = @$results[0]->{'authorisedby'};
160
    my $authorisedby = $order->{authorisedby};
142
    my $member = GetMember( borrowernumber => $authorisedby );
161
    my $member = GetMember( borrowernumber => $authorisedby );
143
162
144
    my $budget = GetBudget( @$results[0]->{'budget_id'} );
163
    my $budget = GetBudget( $order->{budget_id} );
145
164
146
    $template->param(
165
    $template->param(
147
        count                 => 1,
166
        count                 => 1,
148
        biblionumber          => @$results[0]->{'biblionumber'},
167
        biblionumber          => $order->{biblionumber},
149
        ordernumber           => @$results[0]->{'ordernumber'},
168
        ordernumber           => $order->{ordernumber},
150
        biblioitemnumber      => @$results[0]->{'biblioitemnumber'},
169
        biblioitemnumber      => $order->{biblioitemnumber},
151
        booksellerid            => @$results[0]->{'booksellerid'},
170
        booksellerid          => $booksellerid,
152
        freight               => $freight,
171
        freight               => $freight,
153
        gst                   => $gst,
172
        gstrate               => $gstrate,
154
        name                  => $bookseller->{'name'},
173
        name                  => $bookseller->{name},
155
        date                  => format_date($date),
174
        date                  => format_date($date),
156
        title                 => @$results[0]->{'title'},
175
        title                 => $order->{title},
157
        author                => @$results[0]->{'author'},
176
        author                => $order->{author},
158
        copyrightdate         => @$results[0]->{'copyrightdate'},
177
        copyrightdate         => $order->{copyrightdate},
159
        isbn                  => @$results[0]->{'isbn'},
178
        isbn                  => $order->{isbn},
160
        seriestitle           => @$results[0]->{'seriestitle'},
179
        seriestitle           => $order->{seriestitle},
161
        bookfund              => $budget->{budget_name},
180
        bookfund              => $budget->{budget_name}, # FIXME OR $order->{'bookfundid'}, ?
162
        quantity              => @$results[0]->{'quantity'},
181
        quantity              => $order->{quantity},
163
        quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1,
182
        quantityreceivedplus1 => $order->{quantityreceived} + 1,
164
        quantityreceived      => @$results[0]->{'quantityreceived'},
183
        quantityreceived      => $order->{quantityreceived},
165
        rrp                   => @$results[0]->{'rrp'},
184
        rrp                   => sprintf( "%.2f", $rrp ),
166
        ecost                 => @$results[0]->{'ecost'},
185
        ecost                 => sprintf( "%.2f", $ecost ),
167
        unitprice             => @$results[0]->{'unitprice'},
186
        unitprice             => $unitprice,
168
        memberfirstname       => $member->{firstname} || "",
187
        memberfirstname       => $member->{firstname} || "",
169
        membersurname         => $member->{surname} || "",
188
        membersurname         => $member->{surname} || "",
170
        invoice               => $invoice,
189
        invoice               => $invoice,
Lines 184-193 else { Link Here
184
        $line{invoice}      = $invoice;
203
        $line{invoice}      = $invoice;
185
        $line{datereceived} = $datereceived->output();
204
        $line{datereceived} = $datereceived->output();
186
        $line{freight}      = $freight;
205
        $line{freight}      = $freight;
187
        $line{gst}          = $gst;
206
        $line{gstrate}      = $gstrate;
188
        $line{title}        = @$results[$i]->{'title'};
207
        $line{title}        = @$results[$i]->{'title'};
189
        $line{author}       = @$results[$i]->{'author'};
208
        $line{author}       = @$results[$i]->{'author'};
190
        $line{booksellerid}   = $booksellerid;
209
        $line{booksellerid} = $booksellerid;
191
        push @loop, \%line;
210
        push @loop, \%line;
192
    }
211
    }
193
212
(-)a/acqui/parcel.pl (-45 / +99 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 $supplier = $input->param('booksellerid') || '';
144
    my $supplier = $input->param('booksellerid') || '';
Lines 110-116 if($input->param('format') eq "json"){ Link Here
110
    foreach my $order (@$orders){
149
    foreach my $order (@$orders){
111
        if($order->{quantityreceived} < $order->{quantity}){
150
        if($order->{quantityreceived} < $order->{quantity}){
112
            my $data = {};
151
            my $data = {};
113
            
152
            my $ecost = get_value_with_gst_params( $order->{ecost}, $order->{gstrate}, $bookseller );
153
114
            $data->{basketno} = $order->{basketno};
154
            $data->{basketno} = $order->{basketno};
115
            $data->{ordernumber} = $order->{ordernumber};
155
            $data->{ordernumber} = $order->{ordernumber};
116
            $data->{title} = $order->{title};
156
            $data->{title} = $order->{title};
Lines 120-131 if($input->param('format') eq "json"){ Link Here
120
            $data->{biblionumber} = $order->{biblionumber};
160
            $data->{biblionumber} = $order->{biblionumber};
121
            $data->{freight} = $order->{freight};
161
            $data->{freight} = $order->{freight};
122
            $data->{quantity} = $order->{quantity};
162
            $data->{quantity} = $order->{quantity};
123
            $data->{ecost} = $order->{ecost};
163
            $data->{ecost}        = sprintf( "%.2f", $ecost );
124
            $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity});
164
            $data->{ordertotal}   = sprintf( "%.2f", $ecost * $order->{quantity} );
125
            push @datas, $data;
165
            push @datas, $data;
126
        }
166
        }
127
    }
167
    }
128
    
168
129
    my $json_text = to_json(\@datas);
169
    my $json_text = to_json(\@datas);
130
    $template->param(return => $json_text);
170
    $template->param(return => $json_text);
131
    output_html_with_http_headers $input, $cookie, $template->output;
171
    output_html_with_http_headers $input, $cookie, $template->output;
Lines 135-141 if($input->param('format') eq "json"){ Link Here
135
my ($template, $loggedinuser, $cookie)
175
my ($template, $loggedinuser, $cookie)
136
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
176
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
137
                 query => $input,
177
                 query => $input,
138
				 type => "intranet",
178
                 type => "intranet",
139
                 authnotrequired => 0,
179
                 authnotrequired => 0,
140
                 flagsrequired => {acquisition => 'order_receive'},
180
                 flagsrequired => {acquisition => 'order_receive'},
141
                 debug => 1,
181
                 debug => 1,
Lines 156-199 if( scalar(@rcv_err) ) { Link Here
156
196
157
my $cfstr         = "%.2f";                                                           # currency format string -- could get this from currency table.
197
my $cfstr         = "%.2f";                                                           # currency format string -- could get this from currency table.
158
my @parcelitems   = GetParcel($booksellerid, $invoice, $datereceived->output('iso'));
198
my @parcelitems   = GetParcel($booksellerid, $invoice, $datereceived->output('iso'));
159
my $countlines    = scalar @parcelitems;
199
#my $countlines    = scalar @parcelitems; FIXME from comm, it's used ?
160
my $totalprice    = 0;
200
my $totalprice    = 0;
161
my $totalfreight  = 0;
201
my $totalfreight  = 0;
162
my $totalquantity = 0;
202
my $totalquantity = 0;
163
my $total;
203
my $total;
164
my $tototal;
204
my $tototal;
165
my @loop_received = ();
205
my @loop_received = ();
166
206
my @book_foot_loop;
167
for (my $i = 0 ; $i < $countlines ; $i++) {
207
my %foot;
168
208
my $total_quantity = 0;
169
    #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'};   #weird, are the freight fees counted by book? (pierre)
209
my $total_gste = 0;
170
    $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'};    #weird, are the freight fees counted by book? (pierre)
210
my $total_gsti = 0;
171
    $parcelitems[$i]->{'unitprice'} += 0;
211
212
for my $item ( @parcelitems ) {
213
    $item->{unitprice} = get_value_with_gst_params( $item->{unitprice}, $item->{gstrate}, $bookseller );
214
    $total = ( $item->{'unitprice'} ) * $item->{'quantityreceived'};    #weird, are the freight fees counted by book? (pierre)
215
    $item->{'unitprice'} += 0;
172
    my %line;
216
    my %line;
173
    %line          = %{ $parcelitems[$i] };
217
    %line          = %{ $item };
218
    my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
219
    $line{ecost} = sprintf( "%.2f", $ecost );
174
    $line{invoice} = $invoice;
220
    $line{invoice} = $invoice;
175
    $line{gst}     = $gst;
176
    $line{total} = sprintf($cfstr, $total);
221
    $line{total} = sprintf($cfstr, $total);
177
    $line{booksellerid} = $booksellerid;
222
    $line{booksellerid} = $booksellerid;
178
    push @loop_received, \%line;
223
    $totalprice += $item->{'unitprice'};
179
    $totalprice += $parcelitems[$i]->{'unitprice'};
224
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
180
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
225
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
226
    my $gst = get_gst( $line{total}, $line{gstrate}, $bookseller );
227
    $foot{$line{gstrate}}{gstrate} = $line{gstrate};
228
    $foot{$line{gstrate}}{value} += sprintf( "%.2f", $gst );
229
    $total_quantity += $line{quantity};
230
    $total_gste += $gste;
231
    $total_gsti += $gste + $gst;
181
232
182
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
233
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
183
    $line{suggestionid}         = $suggestion->{suggestionid};
234
    $line{suggestionid}         = $suggestion->{suggestionid};
184
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
235
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
185
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
236
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
186
237
187
    #double FIXME - totalfreight is redefined later.
238
    $totalfreight = $item->{'freight'};
239
    $totalquantity += $item->{'quantityreceived'};
188
240
189
# FIXME - each order in a  parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget..
190
    if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) {
191
        warn "FREIGHT CHARGE MISMATCH!!";
192
    }
193
    $totalfreight = $parcelitems[$i]->{'freight'};
194
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
195
    $tototal       += $total;
241
    $tototal       += $total;
196
}
242
243
    my $budget = GetBudget( $line{budget_id} );
244
    $line{budget_name} = $budget->{'budget_name'};
245
246
    push @loop_received, \%line;
247
 }
248
249
push @book_foot_loop, map { $_ } values %foot;
197
250
198
my $pendingorders = GetPendingOrders($booksellerid);
251
my $pendingorders = GetPendingOrders($booksellerid);
199
my $countpendings = scalar @$pendingorders;
252
my $countpendings = scalar @$pendingorders;
Lines 205-227 my @loop_orders = (); Link Here
205
for (my $i = 0 ; $i < $countpendings ; $i++) {
258
for (my $i = 0 ; $i < $countpendings ; $i++) {
206
    my %line;
259
    my %line;
207
    %line = %{$pendingorders->[$i]};
260
    %line = %{$pendingorders->[$i]};
208
   
261
262
    my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
263
    $line{unitprice} = get_value_with_gst_params( $line{unitprice}, $line{gstrate}, $bookseller );
209
    $line{quantity}+=0;
264
    $line{quantity}+=0;
210
    $line{quantityreceived}+=0;
265
    $line{quantityreceived}+=0;
211
    $line{unitprice}+=0;
266
    $line{unitprice}+=0;
212
    $totalPunitprice += $line{unitprice};
267
    $totalPunitprice += $line{unitprice};
213
    $totalPquantity +=$line{quantity};
268
    $totalPquantity +=$line{quantity};
214
    $totalPqtyrcvd +=$line{quantityreceived};
269
    $totalPqtyrcvd +=$line{quantityreceived};
215
    $totalPecost += $line{ecost};
270
    $totalPecost += $ecost;
216
    $line{ecost} = sprintf("%.2f",$line{ecost});
271
    $line{ecost} = sprintf( "%.2f", $ecost );
217
    $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
272
    $line{ordertotal} = sprintf( "%.2f", $ecost * $line{quantity} );
218
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
273
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
219
    $line{invoice} = $invoice;
274
    $line{invoice} = $invoice;
220
    $line{gst} = $gst;
221
    $line{total} = $total;
222
    $line{booksellerid} = $booksellerid;
275
    $line{booksellerid} = $booksellerid;
223
    $ordergrandtotal += $line{ecost} * $line{quantity};
276
    $ordergrandtotal += $ecost * $line{quantity};
224
    
277
225
    my $biblionumber = $line{'biblionumber'};
278
    my $biblionumber = $line{'biblionumber'};
226
    my $countbiblio = CountBiblioInOrders($biblionumber);
279
    my $countbiblio = CountBiblioInOrders($biblionumber);
227
    my $ordernumber = $line{'ordernumber'};
280
    my $ordernumber = $line{'ordernumber'};
Lines 242-247 for (my $i = 0 ; $i < $countpendings ; $i++) { Link Here
242
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
295
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
243
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
296
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
244
297
298
    my $budget = GetBudget( $line{budget_id} );
299
    $line{budget_name} = $budget->{'budget_name'};
300
245
    # 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
301
    # 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
246
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
302
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
247
    $line{items}                = ($itemcount) - (scalar @items);
303
    $line{items}                = ($itemcount) - (scalar @items);
Lines 254-261 for (my $i = 0 ; $i < $countpendings ; $i++) { Link Here
254
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
310
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
255
    $line{holds}                = $holds;
311
    $line{holds}                = $holds;
256
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
312
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
257
    
313
258
    
259
    push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
314
    push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
260
}
315
}
261
$freight = $totalfreight unless $freight;
316
$freight = $totalfreight unless $freight;
Lines 293-299 if ($count>$resultsperpage){ Link Here
293
                    );
348
                    );
294
}
349
}
295
350
296
#$totalfreight=$freight;
297
$tototal = $tototal + $freight;
351
$tototal = $tototal + $freight;
298
352
299
$template->param(
353
$template->param(
Lines 303-327 $template->param( Link Here
303
    formatteddatereceived => $datereceived->output(),
357
    formatteddatereceived => $datereceived->output(),
304
    name                  => $bookseller->{'name'},
358
    name                  => $bookseller->{'name'},
305
    booksellerid            => $booksellerid,
359
    booksellerid            => $booksellerid,
306
    gst                   => $gst,
307
    freight               => $freight,
360
    freight               => $freight,
308
    invoice               => $invoice,
361
    invoice               => $invoice,
309
    countreceived         => $countlines,
310
    loop_received         => \@loop_received,
362
    loop_received         => \@loop_received,
311
    countpending          => $countpendings,
312
    loop_orders           => \@loop_orders,
363
    loop_orders           => \@loop_orders,
364
    book_foot_loop        => \@book_foot_loop,
313
    totalprice            => sprintf($cfstr, $totalprice),
365
    totalprice            => sprintf($cfstr, $totalprice),
314
    totalfreight          => $totalfreight,
366
    totalfreight          => $totalfreight,
315
    totalquantity         => $totalquantity,
367
    totalquantity         => $totalquantity,
316
    tototal               => sprintf($cfstr, $tototal),
368
    tototal               => sprintf($cfstr, $tototal),
317
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
369
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
318
    gst                   => $gst,
370
    grandtot              => sprintf($cfstr, $tototal ),
319
    grandtot              => sprintf($cfstr, $tototal + $gst),
320
    totalPunitprice       => sprintf("%.2f", $totalPunitprice),
371
    totalPunitprice       => sprintf("%.2f", $totalPunitprice),
321
    totalPquantity        => $totalPquantity,
372
    totalPquantity        => $totalPquantity,
322
    totalPqtyrcvd         => $totalPqtyrcvd,
373
    totalPqtyrcvd         => $totalPqtyrcvd,
323
    totalPecost           => sprintf("%.2f", $totalPecost),
374
    totalPecost           => sprintf("%.2f", $totalPecost),
324
    resultsperpage        => $resultsperpage,
375
    resultsperpage        => $resultsperpage,
376
    total_quantity       => $total_quantity,
377
    total_gste           => sprintf( "%.2f", $total_gste ),
378
    total_gsti           => sprintf( "%.2f", $total_gsti ),
325
);
379
);
326
output_html_with_http_headers $input, $cookie, $template->output;
380
output_html_with_http_headers $input, $cookie, $template->output;
327
 
381
 
(-)a/acqui/supplier.pl (-12 / +7 lines)
Lines 68-79 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
68
        debug           => 1,
68
        debug           => 1,
69
    }
69
    }
70
);
70
);
71
my $seller_gstrate = $supplier->{'gstrate'};
72
71
73
# ensure the scalar isn't flagged as a string
74
$seller_gstrate = ( defined $seller_gstrate ) ? $seller_gstrate + 0 : undef;
75
my $tax_rate = $seller_gstrate // C4::Context->preference('gist') // 0;
76
$tax_rate *= 100;
77
#build array for currencies
72
#build array for currencies
78
if ( $op eq 'display' ) {
73
if ( $op eq 'display' ) {
79
74
Lines 108-118 if ( $op eq 'display' ) { Link Here
108
        gstreg        => $supplier->{'gstreg'},
103
        gstreg        => $supplier->{'gstreg'},
109
        listincgst    => $supplier->{'listincgst'},
104
        listincgst    => $supplier->{'listincgst'},
110
        invoiceincgst => $supplier->{'invoiceincgst'},
105
        invoiceincgst => $supplier->{'invoiceincgst'},
106
        gstrate       => $supplier->{'gstrate'} + 0.0,
111
        discount      => $supplier->{'discount'},
107
        discount      => $supplier->{'discount'},
112
        invoiceprice  => $supplier->{'invoiceprice'},
108
        invoiceprice  => $supplier->{'invoiceprice'},
113
        listprice     => $supplier->{'listprice'},
109
        listprice     => $supplier->{'listprice'},
114
        GST           => $tax_rate,
115
        default_tax   => defined($seller_gstrate),
116
        basketcount   => $supplier->{'basketcount'},
110
        basketcount   => $supplier->{'basketcount'},
117
        subscriptioncount   => $supplier->{'subscriptioncount'},
111
        subscriptioncount   => $supplier->{'subscriptioncount'},
118
        contracts     => $contracts,
112
        contracts     => $contracts,
Lines 146-154 if ( $op eq 'display' ) { Link Here
146
            };
140
            };
147
    }
141
    }
148
142
149
    my $default_gst_rate = (C4::Context->preference('gist') * 100) || '0.0';
143
    # get option values from gist syspref
144
    my @gst_values = map {
145
        option => $_
146
    }, split( '\|', C4::Context->preference("gist") );
150
147
151
    my $gstrate = defined $supplier->{gstrate} ? $supplier->{gstrate} * 100 : '';
152
    $template->param(
148
    $template->param(
153
        booksellerid => $booksellerid,
149
        booksellerid => $booksellerid,
154
        name         => $supplier->{'name'},
150
        name         => $supplier->{'name'},
Lines 174-185 if ( $op eq 'display' ) { Link Here
174
        gstreg        => $supplier->{'gstreg'},
170
        gstreg        => $supplier->{'gstreg'},
175
        listincgst    => $supplier->{'listincgst'},
171
        listincgst    => $supplier->{'listincgst'},
176
        invoiceincgst => $supplier->{'invoiceincgst'},
172
        invoiceincgst => $supplier->{'invoiceincgst'},
177
        gstrate       => $gstrate,
173
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
174
        gst_values    => \@gst_values,
178
        discount      => $supplier->{'discount'},
175
        discount      => $supplier->{'discount'},
179
        loop_currency => $loop_currency,
176
        loop_currency => $loop_currency,
180
        GST           => $tax_rate,
181
        enter         => 1,
177
        enter         => 1,
182
        default_gst_rate => $default_gst_rate,
183
    );
178
    );
184
}
179
}
185
180
(-)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{'active'}=$input->param('status');
105
$data{'active'}=$input->param('status');
111
if($data{'name'}) {
106
if($data{'name'}) {
112
	if ($data{'id'}){
107
	if ($data{'id'}){
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2721-2727 CREATE TABLE `aqorders` ( Link Here
2721
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2721
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2722
  `rrp` decimal(13,2) default NULL,
2722
  `rrp` decimal(13,2) default NULL,
2723
  `ecost` decimal(13,2) default NULL,
2723
  `ecost` decimal(13,2) default NULL,
2724
  `gst` decimal(13,2) default NULL,
2724
  gstrate decimal(6,4) default NULL,
2725
  discount float(6,4) default NULL,
2725
  `budget_id` int(11) NOT NULL,
2726
  `budget_id` int(11) NOT NULL,
2726
  `budgetgroup_id` int(11) NOT NULL,
2727
  `budgetgroup_id` int(11) NOT NULL,
2727
  `budgetdate` date default NULL,
2728
  `budgetdate` date default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (+15 lines)
Lines 4994-4999 if ( C4::Context->preference("Version") lt TransformToNum($DBversion) ) { Link Here
4994
    SetVersion($DBversion);
4994
    SetVersion($DBversion);
4995
}
4995
}
4996
4996
4997
4998
$DBversion = "3.07.00.XXX";
4999
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5000
    $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4)  DEFAULT NULL");
5001
    print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
5002
    SetVersion($DBversion);
5003
}
5004
5005
$DBversion = "3.07.00.XXX";
5006
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5007
    $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
5008
    print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
5009
    SetVersion($DBversion);
5010
}
5011
4997
=head1 FUNCTIONS
5012
=head1 FUNCTIONS
4998
5013
4999
=head2 DropAllForeignKeys($table)
5014
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-38 / +14 lines)
Lines 646-691 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);
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);
667
    var ecost = new Number(Math.floor(rrp * (100 - discount ))/100);
668
    var GST   = new Number(0);
669
    if (gst_on) {
670
            rrp=rrp * (1+f.gstrate.value / 100);
671
        GST=ecost * f.gstrate.value / 100;
672
    }
673
674
    var total =  new Number( (ecost + GST) * quantity);
675
656
676
    f.rrp.value = rrp.toFixed(2);
657
    var rrp   = new Number(listprice*exchangerate);
677
658
    var ecost = new Number(Math.floor(rrp * (100 - discount )) / 100);
678
//	f.rrp.value = rrp
659
    var total =  new Number( ecost * quantity);
679
//	f.rrp.value = 'moo'
660
    $("#rrp").val(rrp.toFixed(2));
680
661
    $("#ecost").val(ecost.toFixed(2));
681
    f.ecost.value = ecost.toFixed(2);
662
    $("#total").val(total.toFixed(2));
682
    f.total.value = total.toFixed(2);
663
    $("listprice").val(listprice.toFixed(2));
683
    f.listprice.value =  listprice.toFixed(2);
684
664
685
//  gst-stuff needs verifing, mason.
686
    if (f.GST) {
687
        f.GST.value=GST;
688
    }
689
    return true;
665
    return true;
690
}
666
}
691
667
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-54 / +94 lines)
Lines 2-20 Link Here
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
6
<script type="text/javascript">
7
//<![CDATA[
8
    function updateColumnsVisibility(visible) {
9
        if ( visible ) {
10
            $("table .gste, .gsti").show();
11
        } else {
12
            [% IF ( listincgst ) %]
13
                $("table .gste").hide();
14
            [% ELSE %]
15
                $("table .gsti").hide();
16
            [% END %]
17
        }
18
    }
19
20
    $(document).ready(function() {
21
        $("#show_all_details").click(function(){
22
            updateColumnsVisibility($(this+":checked").val());
23
        });
24
25
        $("#show_all_details").attr('checked', false);
26
        updateColumnsVisibility(false);
27
    });
28
//]]>
29
</script>
30
5
[% UNLESS ( closedate ) %]
31
[% UNLESS ( closedate ) %]
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
32
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
7
<script type="text/javascript">
33
<script type="text/javascript">
8
//<![CDATA[
34
//<![CDATA[
9
    $(document).ready(function() {
35
    $(document).ready(function() {
10
        $("#orders").tablesorter({
36
        $("#orders").tablesorter({});
11
            headers: {
12
                9: { sorter: false },
13
                10: { sorter: false }
14
            }
15
        });
16
        $("#cancelledorderst").tablesorter();
37
        $("#cancelledorderst").tablesorter();
17
    });
38
    });
39
18
            function confirm_close() {
40
            function confirm_close() {
19
                var is_confirmed = confirm(_('Are you sure you want to close this basket?'));
41
                var is_confirmed = confirm(_('Are you sure you want to close this basket?'));
20
                if (is_confirmed) {
42
                if (is_confirmed) {
Lines 214-229 Link Here
214
236
215
        [% UNLESS ( delete_confirm ) %]
237
        [% UNLESS ( delete_confirm ) %]
216
        <div id="acqui_basket_content" class="yui-g">
238
        <div id="acqui_basket_content" class="yui-g">
239
        <label for="show_all_details">
240
            <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
241
            Show all details
242
        </label>
217
        <h2>Order Details</h2>
243
        <h2>Order Details</h2>
218
        [% IF ( books_loop ) %]
244
        [% IF ( books_loop ) %]
219
            <table id="orders">
245
            <table id="orders">
220
                <thead>
246
                <thead>
221
                    <tr>
247
                    <tr>
222
                        <th>Order</th>
248
                        <th>Order</th>
223
                        <th>RRP</th>
249
                        <th class="gste">RRP Tax Exc.</th>
224
                        <th>Est.</th>
250
                        <th class="gste">ecost Tax Exc.</th>
251
                        <th class="gsti">RRP Tax Inc.</th>
252
                        <th class="gsti">ecost Tax Inc.</th>
225
                        <th>Qty.</th>
253
                        <th>Qty.</th>
226
                        <th>Total</th>
254
                        <th class="gste">Total Tax Exc. ([% currency %])</th>
255
                        <th class="gsti">Total Tax Inc. ([% currency %])</th>
256
                        <th>GST %</th>
257
                        <th>GST</th>
227
                        <th>Fund</th>
258
                        <th>Fund</th>
228
                        [% IF ( active ) %]
259
                        [% IF ( active ) %]
229
                            [% UNLESS ( closedate ) %]
260
                            [% UNLESS ( closedate ) %]
Lines 234-277 Link Here
234
                    </tr>
265
                    </tr>
235
                </thead>
266
                </thead>
236
                <tfoot>
267
                <tfoot>
237
                [% IF ( GST ) %]
268
                [% FOREACH foot_loo IN book_foot_loop %]
238
                <tr>
269
                    <tr>
239
                    <th scope="row">Total Tax Exc.</th>
270
                        <th>Total (GST [% foot_loo.gstgsti %])</th>
240
                    <td>[% total_rrp_gste %]</td>
271
                        <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
241
                    <td>&nbsp;</td>
272
                        <th>[% foot_loo.quantity %]</th>
242
                    <td>[% qty_total %]</td>
273
                        <th class="gste">[% foot_loo.totalgste %]</th>
243
                    <td>[% total_est_gste %]</td>
274
                        <th class="gsti">[% foot_loo.totalgsti %]</th>
244
                        [% IF ( active ) %]
275
                        <th/>
245
                            [% IF ( closedate ) %]
276
                        <th>[% foot_loo.gstvalue %]</th>
246
                            <td colspan="1" rowspan="3">&nbsp;</td>
277
                        <th/>
247
                            [% ELSE %]
278
                        [% IF ( foot_loo.active ) %]
248
                            <td colspan="3" rowspan="3">&nbsp;</td>
279
                            [% UNLESS ( foot_loo.closedate ) %]
280
                                <th/>&nbsp;<th/>
249
                            [% END %]
281
                            [% END %]
250
                        [% END %]
282
                        [% END %]
251
                </tr>
283
                    </tr>
252
                <tr>
284
                [% END %]
253
                    <th scope="row">Tax ([% gist_rate %])</th>
254
                    <td>[% gist_rrp %]</td>
255
                    <td>&nbsp;</td>
256
                    <td>&nbsp;</td>
257
                    <td>[% gist_est %]</td>
258
                </tr>
259
                <tr>
260
                    <th scope="row">Total Tax Inc. ([% currency %])</th>
261
                    <td>[% total_rrp_gsti %]</td>
262
                    <td>&nbsp;</td>
263
                    <td>[% qty_total %]</td>
264
                    <td>[% total_est_gsti %]</td>
265
                </tr>
266
                [% ELSE %]
267
                <tr>
285
                <tr>
268
                    <th scope="row">Total ([% currency %])</th>
286
                    <th>Total ([% currency %])</th>
269
                    <td>[% total_rrp_gsti %]</td>
287
                    <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
270
                    <td>&nbsp;</td>
288
                    <th>[% total_quantity %]</th>
271
                    <td>[% qty_total %]</td>
289
                    <th class="gste">[% total_gste %]</th>
272
                    <td>[% total_est_gsti %]</td>
290
                    <th class="gsti">[% total_gsti %]</th>
291
                    <th/>
292
                    <th>[% total_gstvalue %]</th>
293
                    <th/>
294
                    [% IF ( books_loo.active ) %]
295
                        [% UNLESS ( books_loo.closedate ) %]
296
                            <th/>&nbsp;<th/>
297
                        [% END %]
298
                    [% END %]
273
                </tr>
299
                </tr>
274
                [% END %]
275
                </tfoot>
300
                </tfoot>
276
                <tbody>
301
                <tbody>
277
                [% FOREACH books_loo IN books_loop %]
302
                [% FOREACH books_loo IN books_loop %]
Lines 297-306 Link Here
297
                                [% END %]
322
                                [% END %]
298
                            </p>
323
                            </p>
299
                        </td>
324
                        </td>
300
                        <td class="number">[% books_loo.rrp %]</td>
325
                        <td class="number gste">[% books_loo.rrpgste %]</td>
301
                        <td class="number">[% books_loo.ecost %]</td>
326
                        <td class="number gste">[% books_loo.ecostgste %]</td>
327
                        <td class="number gsti">[% books_loo.rrpgsti %]</td>
328
                        <td class="number gsti">[% books_loo.ecostgsti %]</td>
302
                        <td class="number">[% books_loo.quantity %]</td>
329
                        <td class="number">[% books_loo.quantity %]</td>
303
                        <td class="number">[% books_loo.line_total %]</td>
330
                        <td class="number gste">[% books_loo.totalgste %]</td>
331
                        <td class="number gsti">[% books_loo.totalgsti %]</td>
332
                        <td class="number">[% books_loo.gstgsti %]</td>
333
                        <td class="number">[% books_loo.gstvalue %]</td>
304
                        <td>[% books_loo.budget_name %]</td>
334
                        <td>[% books_loo.budget_name %]</td>
305
                        [% IF ( active ) %]
335
                        [% IF ( active ) %]
306
                            [% UNLESS ( closedate ) %]
336
                            [% UNLESS ( closedate ) %]
Lines 352-361 Link Here
352
              <thead>
382
              <thead>
353
                <tr>
383
                <tr>
354
                  <th>Order</th>
384
                  <th>Order</th>
355
                  <th>RRP</th>
385
                  <th class="gste">RRP Tax Exc.</th>
356
                  <th>Est.</th>
386
                  <th class="gste">ecost Tax Exc.</th>
387
                  <th class="gsti">RRP Tax Inc.</th>
388
                  <th class="gsti">ecost Tax Inc.</th>
357
                  <th>Qty.</th>
389
                  <th>Qty.</th>
358
                  <th>Total</th>
390
                  <th class="gste">Total Tax Exc. ([% currency %])</th>
391
                  <th class="gsti">Total Tax Inc. ([% currency %])</th>
392
                  <th>GST %</th>
393
                  <th>GST</th>
359
                  <th>Fund</th>
394
                  <th>Fund</th>
360
                </tr>
395
                </tr>
361
              </thead>
396
              </thead>
Lines 378-388 Link Here
378
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
413
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
379
                      </p>
414
                      </p>
380
                    </td>
415
                    </td>
381
                    <td><p>[% order.rrp %]</p></td>
416
                    <td class="number gste">[% order.rrpgste %]</td>
382
                    <td><p>[% order.ecost %]</p></td>
417
                    <td class="number gste">[% order.ecostgste %]</td>
383
                    <td><p>[% order.quantity %]</p></td>
418
                    <td class="number gsti">[% order.rrpgsti %]</td>
384
                    <td><p>[% order.line_total %]</p></td>
419
                    <td class="number gsti">[% order.ecostgsti %]</td>
385
                    <td><p>[% order.budget_name %]</p></td>
420
                    <td class="number">[% order.quantity %]</td>
421
                    <td class="number gste">[% order.totalgste %]</td>
422
                    <td class="number gsti">[% order.totalgsti %]</td>
423
                    <td class="number">[% order.gstgsti %]</td>
424
                    <td class="number">[% order.gstvalue %]</td>
425
                    <td>[% order.budget_name %]
386
                  </tr>
426
                  </tr>
387
                [% END %]
427
                [% END %]
388
              </tbody>
428
              </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-40 / +51 lines)
Lines 148-154 $(document).ready(function() Link Here
148
//]]>
148
//]]>
149
</script>
149
</script>
150
</head>
150
</head>
151
<body>
151
<body onload="updateCosts()">
152
152
153
[% INCLUDE 'header.inc' %]
153
[% INCLUDE 'header.inc' %]
154
[% INCLUDE 'acquisitions-search.inc' %]
154
[% INCLUDE 'acquisitions-search.inc' %]
Lines 225-242 $(document).ready(function() Link Here
225
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
225
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
226
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
226
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
227
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
227
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
228
        <input type="hidden" name="discount" value="[% discount %]" />
228
        <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
229
        <input type="hidden" name="listinc" value="[% listincgst %]" />
229
        <input type="hidden" name="applygst" id="applygst" value="[% gstreg %]" />
230
<!--        <input type="hidden" name="currency" value="[% currency %]" />-->
230
        <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
231
        <input type="hidden" name="applygst" value="[% gstreg %]" />
232
        <input type="hidden" name="invoiceincgst" value="[% invoiceincgst %]" />
233
        <input type="hidden" name="gstrate" value="[% gstrate %]" />
234
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
231
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
235
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
232
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
233
        <input type="hidden" name="currency_rate" id="currency_rate" value="[% currency_rate %]" />
236
234
237
        [% FOREACH loop_currencie IN loop_currencies %]
238
            <input type="hidden" id="[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
239
        [% END %]
240
        <ol><li>
235
        <ol><li>
241
            [% IF ( biblionumber ) %]
236
            [% IF ( biblionumber ) %]
242
            <span class="label">Title</span>
237
            <span class="label">Title</span>
Lines 378-386 $(document).ready(function() Link Here
378
                [% ELSE %]
373
                [% ELSE %]
379
                <label class="required" for="quantity">Quantity: </label>
374
                <label class="required" for="quantity">Quantity: </label>
380
                    [% IF ( items ) %]
375
                    [% IF ( items ) %]
381
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="calcNeworderTotal();" />
376
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="updateCosts();" />
382
                    [% ELSE %]
377
                    [% ELSE %]
383
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
378
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
384
                    [% END %]
379
                    [% END %]
385
                [% END %]
380
                [% END %]
386
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
381
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
Lines 414-420 $(document).ready(function() Link Here
414
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
409
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
415
                [% ELSE %]
410
                [% ELSE %]
416
			<label for="currency">Currency:</label>
411
			<label for="currency">Currency:</label>
417
			<select name="currency" id="currency" onchange="calcNeworderTotal();">
412
			<select name="currency" id="currency" onchange="updateCosts();">
418
			[% FOREACH loop_currencie IN loop_currencies %]
413
			[% FOREACH loop_currencie IN loop_currencies %]
419
	                [% 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 %]
414
	                [% 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 %]
420
			</select>
415
			</select>
Lines 422-432 $(document).ready(function() Link Here
422
                </li>
417
                </li>
423
            <li>
418
            <li>
424
                [% IF ( close ) %]
419
                [% IF ( close ) %]
425
            <span class="label">Vendor price: </span>
420
                    <span class="label">Vendor price: </span>
426
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
421
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
427
                [% ELSE %]
422
                [% ELSE %]
428
                <label for="listprice">Vendor price: </label>
423
                <label for="listprice">Vendor price: </label>
429
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="calcNeworderTotal()" />
424
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="updateCosts()" />
430
                [% END %]
425
                [% END %]
431
            </li>
426
            </li>
432
            [% UNLESS ( close ) %]
427
            [% UNLESS ( close ) %]
Lines 439-491 $(document).ready(function() Link Here
439
                [% END %]
434
                [% END %]
440
            </li>
435
            </li>
441
            [% END %]
436
            [% END %]
442
			<li>
437
            <li>
443
                [% IF ( close ) %]
438
                [% IF ( close ) %]
444
            <span class="label">Replacement cost: </span>
439
                    <span class="label">gstrate: </span>
445
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
440
                    <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
446
                [% ELSE %]
441
                [% ELSE %]
447
                <label for="rrp">Replacement cost: </label>
442
                    <label for="gst">gstrate: </label>
448
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
443
                    <select name="gstrate" id="gstrate" onchange="updateCosts();">
444
                    [% FOREACH gst IN gst_values %]
445
                       <option value="[% gst.option %]"[% IF ( gst.option == gstrate ) %] selected="selected"[% END %]>[% gst.option * 100 | format("%.1f") %]%</option>
446
                    [% END %]
447
                    </select>
449
                [% END %]
448
                [% END %]
450
            </li>
449
            </li>
451
            <li>
450
            <li>
451
                <label for="discount">Discount: </label>
452
                [% IF ( close ) %]
452
                [% IF ( close ) %]
453
            <label for="ecost">Budgeted cost: </label>
453
                    [% IF ( orderdiscount ) %]
454
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
454
                        <input type="hidden" name="discount" id="discount" value="[% orderdiscount %]" />[% orderdiscount_2dp %]%
455
                    [% ELSE %]
456
                        <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
457
                    [% END %]
455
                [% ELSE %]
458
                [% ELSE %]
456
                <label for="ecost">Budgeted cost: </label>
459
                    [% IF ( orderdiscount ) %]
457
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
460
                        <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
461
                    [% ELSE %]
462
                        <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
463
                    [% END %]
458
                [% END %]
464
                [% END %]
459
                [% IF ( discount_2dp ) %]  (adjusted for [% discount_2dp %]% discount)  [% END %]
460
461
            </li>
465
            </li>
462
            [% IF ( GST ) %]
463
            <li>
466
            <li>
464
                [% IF ( close ) %]
467
                [% IF ( close ) %]
465
            <label for="GST">Budgeted GST: </label>
468
                    <span class="label">Replacement cost: </span>
466
                <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
469
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
467
                [% ELSE %]
470
                [% ELSE %]
468
                <label for="GST">Budgeted GST: </label>
471
                    <label for="rrp">Replacement cost: </label>
469
                <input type="text" size="20" name="gst" id="GST" value="" />
472
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
473
                [% END %]
474
            </li>
475
            <li>
476
                [% IF ( close ) %]
477
                    <label for="ecost">Budgeted cost: </label>
478
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
479
                [% ELSE %]
480
                    <label for="ecost">Budgeted cost: </label>
481
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
470
                [% END %]
482
                [% END %]
471
            </li>
483
            </li>
472
            [% END %]
473
            <li>
484
            <li>
474
                [% IF ( close ) %]
485
                [% IF ( close ) %]
475
            <label for="total">Total: </label>
486
                    <label for="total">Total: </label>
476
                <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
487
                    <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
477
                [% ELSE %]
488
                [% ELSE %]
478
                <label for="total">Total: </label>
489
                    <label for="total">Total: </label>
479
                <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
490
                    <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
480
                [% END %]
491
                [% END %]
481
            </li>
492
            </li>
482
            <li>
493
            <li>
483
                [% IF ( close ) %]
494
                [% IF ( close ) %]
484
            <label for="cost">Actual cost: </label>
495
                    <label for="unitprice">Actual cost: </label>
485
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
496
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
486
                [% ELSE %]
497
                [% ELSE %]
487
                <label for="cost">Actual cost: </label>
498
                    <label for="unitprice">Actual cost: </label>
488
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
499
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
489
                [% END %]
500
                [% END %]
490
            </li>
501
            </li>
491
            <li>
502
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-3 / +3 lines)
Lines 96-102 Link Here
96
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
96
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
97
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
97
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
98
    <input type="hidden" name="freight" value="[% freight %]" />
98
    <input type="hidden" name="freight" value="[% freight %]" />
99
    <input type="hidden" name="gst" value="[% gst %]" />
99
    <input type="hidden" name="gstrate" value="[% gstrate %]" />
100
	</div>
100
	</div>
101
	<div class="yui-u">
101
	<div class="yui-u">
102
    <fieldset class="rows">
102
    <fieldset class="rows">
Lines 148-154 Link Here
148
148
149
</div>
149
</div>
150
</div><div class="yui-g"><fieldset class="action">
150
</div><div class="yui-g"><fieldset class="action">
151
        <input type="button"  value="Save" onclick="javascript:if(check_additem()) { this.form.submit(); } else { alert( _('Duplicate barcodes detected.  Please correct the errors and resubmit.') ); return false };" /> <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% booksellerid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
151
        <input type="button"  value="Save" onclick="javascript:if(check_additem()) { this.form.submit(); } else { alert( _('Duplicate barcodes detected.  Please correct the errors and resubmit.') ); return false };" /> <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% booksellerid %]&amp;invoice=[% invoice %]&amp;gstrate=[% gstrate %]&amp;freight=[% freight %]">Cancel</a>
152
</fieldset></div>    </form>
152
</fieldset></div>    </form>
153
[% ELSE %]
153
[% ELSE %]
154
<div id="acqui_acquire_orderlist">
154
<div id="acqui_acquire_orderlist">
Lines 165-171 Link Here
165
        <tr>
165
        <tr>
166
            <td>[% loo.basketno %]</td>
166
            <td>[% loo.basketno %]</td>
167
            <td>[% loo.isbn %]</td>
167
            <td>[% loo.isbn %]</td>
168
         <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>
168
         <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>
169
            <td>[% loo.author %]</td>
169
            <td>[% loo.author %]</td>
170
            <td>[% loo.quantity %]</td>
170
            <td>[% loo.quantity %]</td>
171
            <td>[% loo.quantityreceived %]</td>
171
            <td>[% loo.quantityreceived %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-51 / +24 lines)
Lines 19-25 Link Here
19
19
20
    $(document).ready(function(){
20
    $(document).ready(function(){
21
    $("#pendingt").tablesorter({
21
    $("#pendingt").tablesorter({
22
		headers: { 2: { sorter: 'articles' },3: { sorter: false },7:{sorter:false}}
22
		headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}}
23
    });
23
    });
24
24
25
	rowCountPending  = $("#pendingt tbody.filterclass tr").length;
25
	rowCountPending  = $("#pendingt tbody.filterclass tr").length;
Lines 44-50 Link Here
44
	$("#pendingcollapserow").remove();
44
	$("#pendingcollapserow").remove();
45
    $("#pendingt tr").show();
45
    $("#pendingt tr").show();
46
	$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
46
	$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
47
	$("#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>");
47
	$("#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>");
48
48
49
    }
49
    }
50
50
Lines 53-73 Link Here
53
	$("#pendingcollapserow").remove();
53
	$("#pendingcollapserow").remove();
54
	$("#pendingt tr").show();
54
	$("#pendingt tr").show();
55
    $("#pendingt tbody.filterclass tr.orderfound").remove();
55
    $("#pendingt tbody.filterclass tr.orderfound").remove();
56
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + "<a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
56
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + " <a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
57
    }
57
    }
58
58
59
    // Collapse already received items table
59
    // Collapse already received items table
60
    function receivedCollapse() {
60
    function receivedCollapse() {
61
	$("#receivedcollapserow").remove();
61
	$("#receivedcollapserow").remove();
62
	$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
62
	$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
63
	$("#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>");
63
	$("#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>");
64
    }
64
    }
65
65
66
    // Expand already received items table
66
    // Expand already received items table
67
    function receivedExpand() {
67
    function receivedExpand() {
68
	$("#receivedcollapserow").remove();
68
	$("#receivedcollapserow").remove();
69
	$("#receivedt tr").show();
69
	$("#receivedt tr").show();
70
	$("#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>");
70
	$("#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>");
71
    }
71
    }
72
72
73
    // Launch filtering
73
    // Launch filtering
Lines 89-95 Link Here
89
	var callback =  {
89
	var callback =  {
90
		success: function(o) {
90
		success: function(o) {
91
			var jsonString = o.responseText;
91
			var jsonString = o.responseText;
92
			var gst = "[% gst %]";
93
			try {
92
			try {
94
				var orders = YAHOO.lang.JSON.parse(jsonString);
93
				var orders = YAHOO.lang.JSON.parse(jsonString);
95
				var foundCount = orders.length;
94
				var foundCount = orders.length;
Lines 106-112 Link Here
106
                       + '<td>' + order.ecost + '</td>'
105
                       + '<td>' + order.ecost + '</td>'
107
                       + '<td>' + order.ordertotal + '</td>'
106
                       + '<td>' + order.ordertotal + '</td>'
108
                       + '<td>'
107
                       + '<td>'
109
                       + '<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> /'
108
                       + '<a href="orderreceive.pl?ordernumber=' + order.ordernumber + '&amp;datereceived=[% invoicedatereceived %]&amp;invoice=[% invoice %]&amp;freight=' + order.freight + '&amp;booksellerid=[% booksellerid %]">Receive</a> /'
110
                       + '<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>'
109
                       + '<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>'
111
                       + '</td></tr>').appendTo("table#pendingt");
110
                       + '</td></tr>').appendTo("table#pendingt");
112
				}
111
				}
Lines 214-232 Link Here
214
            <th>Quantity</th>
213
            <th>Quantity</th>
215
            <th>Unit cost</th>
214
            <th>Unit cost</th>
216
            <th>Order cost</th>
215
            <th>Order cost</th>
216
            <th>Fund</th>
217
            <th>&nbsp;</th>
217
            <th>&nbsp;</th>
218
            <th>&nbsp;</th>
218
            <th>&nbsp;</th>
219
        </tr>
219
        </tr>
220
    </thead>
220
    </thead>
221
		<tfoot>
222
            <tr><td colspan="4" class="total">TOTAL</td>
223
                <td> [% totalPquantity %] </td>
224
				<td>&nbsp;</td>
225
                <td>[% ordergrandtotal %]</td>
226
				<td>&nbsp;</td>
227
				<td>&nbsp;</td>
228
            </tr>
229
		</tfoot>
230
    <tbody class="filterclass">
221
    <tbody class="filterclass">
231
        [% FOREACH loop_order IN loop_orders %]
222
        [% FOREACH loop_order IN loop_orders %]
232
	[% UNLESS ( loop.odd ) %]
223
	[% UNLESS ( loop.odd ) %]
Lines 257-264 Link Here
257
                <td>[% loop_order.quantity %]</td>
248
                <td>[% loop_order.quantity %]</td>
258
                <td>[% loop_order.ecost %]</td>
249
                <td>[% loop_order.ecost %]</td>
259
                <td>[% loop_order.ordertotal %]</td>
250
                <td>[% loop_order.ordertotal %]</td>
251
                <td>[% loop_order.budget_name %]</td>
260
				<td>
252
				<td>
261
				    <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;datereceived=[% loop_order.invoicedatereceived %]&amp;invoice=[% loop_order.invoice %]&amp;gst=[% loop_order.gst %]&amp;freight=[% loop_order.freight %]&amp;booksellerid=[% loop_order.booksellerid %]">Receive</a>
253
				    <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>
262
				    
254
				    
263
				</td>
255
				</td>
264
				<td>
256
				<td>
Lines 324-363 Link Here
324
		<th>TOTAL</th>
316
		<th>TOTAL</th>
325
	    </tr>
317
	    </tr>
326
	</thead>
318
	</thead>
327
<tfoot>
319
    <tfoot>
328
	    <tr>
320
        <tr>
329
		<td colspan="4" class="total">SUBTOTAL</td>
321
            <th colspan="7" class="total">Total Tax Exc.</th>
330
		<td colspan="2">&nbsp;</td>
322
            <th>[% total_gste %]</th>
331
		<td>[% totalprice %]</td>
323
        </tr>
332
		<td>[% tototal %]</td>
324
        [% FOREACH book_foot IN book_foot_loop %]
333
	    </tr>
325
            <tr>
334
	      
326
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
335
	      [% IF ( totalfreight ) %]
327
                <th>[% book_foot.value %]</th>
336
		    <tr>
328
            </tr>
337
			<td colspan="6">&nbsp;
329
        [% END %]
338
		</td>
330
        <tr>
339
			    <td>Shipping</td>
331
            <th colspan="7" class="total">Total Tax Inc.</th>
340
		<td>[% totalfreight %]</td>
332
            <th>[% total_gsti %]</th>
341
	    	</tr> 
333
        </tr>
342
	    [% END %]
343
	      [% IF ( gst ) %]
344
		    <tr>
345
			<td colspan="6">
346
		<p class="message">
347
			    <b>HELP</b><br />
348
		    The total at the bottom of the page should be within a few cents of the total for the invoice.
349
		</p>
350
		</td>
351
			    <td><b>Tax rate</b></td>
352
		<td>[% gst %]</td>
353
	    	</tr> 
354
	    [% END %]
355
	    <tr>
356
	    <td colspan="4" class="total">TOTAL</td>
357
		<td>[% totalquantity %]</td>
358
		<td colspan="2">&nbsp;</td>
359
		<td>[% grandtot %]</td>
360
	    </tr>
361
    </tfoot>
334
    </tfoot>
362
	<tbody class="filterclass">
335
	<tbody class="filterclass">
363
	    [% FOREACH loop_receive IN loop_received %]
336
	    [% FOREACH loop_receive IN loop_received %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-3 / +12 lines)
Lines 133-142 if (f.company.value == "") { Link Here
133
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
133
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
134
                [% END %]</li>
134
                [% END %]</li>
135
            </ol>
135
            </ol>
136
             <ol>
137
                <li>
138
                    <label for="gst">Tax rate</label>
139
                    <select name="gstrate" id="gstrate">
140
                    [% FOREACH gst IN gst_values %]
141
                       <option value="[% gst.option %]"[% IF ( gstrate == gst.option ) %] selected="selected"[% END %]>[% gst.option * 100 | format ("%.1f") %] %</option>
142
                    [% END %]
143
                    </select>
144
                </li>
145
            </ol>
136
            <ol>
146
            <ol>
137
            <li><label for="discount">Discount</label>
147
            <li><label for="discount">Discount</label>
138
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
148
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
139
            <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>
140
            <li><label for="notes">Notes</label>
149
            <li><label for="notes">Notes</label>
141
                <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
150
                <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
142
        </fieldset>
151
        </fieldset>
Lines 187-193 if (f.company.value == "") { Link Here
187
                    [% END %]</p>
196
                    [% END %]</p>
188
            <p><strong>List prices are: </strong>[% listprice %]</p>
197
            <p><strong>List prices are: </strong>[% listprice %]</p>
189
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
198
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
190
            [% IF ( GST ) %]<p><strong>Tax Number Registered: </strong>
199
            [% IF ( gstrate ) %]<p><strong>Tax Number Registered: </strong>
191
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
200
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
192
            <p><strong>List Item Price Includes Tax: </strong>
201
            <p><strong>List Item Price Includes Tax: </strong>
193
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
202
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
Lines 196-202 if (f.company.value == "") { Link Here
196
            <p><strong>Discount: </strong>
205
            <p><strong>Discount: </strong>
197
                [% discount %] %</p>
206
                [% discount %] %</p>
198
            <p><strong>Tax rate: </strong>
207
            <p><strong>Tax rate: </strong>
199
                [% GST %]%[% UNLESS ( default_tax ) %] (default)[% END %]</p>
208
                [% 0 + gstrate * 100 | format("%.1f") %]%</p>
200
            [% IF ( notes ) %]<p><strong>Notes: </strong>
209
            [% IF ( notes ) %]<p><strong>Notes: </strong>
201
                [% notes %]</p>[% END %]
210
                [% notes %]</p>[% END %]
202
        </div>
211
        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-2 / +2 lines)
Lines 29-37 Acquisitions: Link Here
29
              US: 360,000.00 (US)
29
              US: 360,000.00 (US)
30
              FR: 360 000,00 (FR)
30
              FR: 360 000,00 (FR)
31
    -
31
    -
32
        - The default tax rate is   
32
        - Default tax rates are
33
        - pref: gist
33
        - pref: gist
34
        - (enter in numeric form, 0.12 for 12%)
34
        - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separe with |)
35
35
36
    Printing:
36
    Printing:
37
    -
37
    -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+34 lines)
Lines 117-122 $(document).ready(function() { Link Here
117
     </div>
117
     </div>
118
</div>
118
</div>
119
</div>
119
</div>
120
    [% IF ( show_acquisition_details ) %]
121
        <div id="acquisition_details">
122
            <h2>Acquisition details</h2>
123
            <table>
124
                <thead>
125
                    <tr><th></th><th>Price Exc. Taxes</th><th>Price Inc. Taxes</th><th>fund</th><th></th></tr>
126
                </thead>
127
                <tbody>
128
                    <tr>
129
                        <td>Ordered amount</td>
130
                        <td>[% valuegste_ordered %]</td>
131
                        <td>[% valuegsti_ordered %]</td>
132
                        <td>[% budget_name_ordered %]</td>
133
                        <td>
134
                            [% IF ( ordered_exists ) %]
135
                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">See basket informations</a>
136
                            [% END %]
137
                        </td>
138
                    </tr>
139
                    <tr>
140
                        <td>Spent amount</td>
141
                        <td>[% valuegste_spent %]</td>
142
                        <td>[% valuegsti_spent %]</td>
143
                        <td>[% budget_name_spent %]</td>
144
                        <td>
145
                            [% IF ( spent_exists ) %]
146
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoicenumber=[% invoicenumber %]">See invoice informations</a>
147
                            [% END %]
148
                        </td>
149
                    </tr>
150
                </tbody>
151
            </table>
152
        </div>
153
    <!-- /TMPL_IF -->
120
    <div id="subscription_planning">
154
    <div id="subscription_planning">
121
    <div class="yui-g">
155
    <div class="yui-g">
122
    <div class="rows">
156
    <div class="rows">
(-)a/serials/subscription-detail.pl (-1 / +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,
125
- 

Return to bug 5335