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 231-351 if ( $op eq 'delete_confirm' ) { Link Here
231
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
231
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
232
      $basket->{creationdate}, $basket->{authorisedby};
232
      $basket->{creationdate}, $basket->{authorisedby};
233
233
234
	#to get active currency
234
    #to get active currency
235
	my $cur = GetCurrency();
235
    my $cur = GetCurrency();
236
236
237
237
238
    my @results = GetOrders( $basketno );
238
    my @results = GetOrders( $basketno );
239
    
240
	my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
241
	$gist = 0 if $gist == 0.0000;
242
	my $discount = $bookseller->{'discount'} / 100;
243
    my $total_rrp = 0;      # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'}
244
    my $total_rrp_gsti = 0; # RRP Total, GST included
245
    my $total_rrp_gste = 0; # RRP Total, GST excluded
246
    my $gist_rrp = 0;
247
    my $total_rrp_est = 0;
248
249
    my $qty_total;
250
    my @books_loop;
239
    my @books_loop;
251
    my $suggestion;
252
240
253
    for my $order ( @results ) {
241
    my @book_foot_loop;
254
        my $rrp = $order->{'listprice'} || 0;
242
    my %foot;
255
		my $qty = $order->{'quantity'} || 0;
243
    my $total_quantity = 0;
256
        if (!defined $order->{quantityreceived}) {
244
    my $total_gste = 0;
257
            $order->{quantityreceived} = 0;
245
    my $total_gsti = 0;
258
        }
246
    my $total_gstvalue = 0;
259
        for ( qw(rrp ecost quantityreceived)) {
247
    for my $order (@results) {
260
            if (!defined $order->{$_}) {
248
        my $line = get_order_infos( $order, $bookseller);
261
                $order->{$_} = 0;
249
        if ( $line->{uncertainprice} ) {
262
            }
263
        }
264
265
        my $budget = GetBudget(  $order->{'budget_id'} );
266
        $rrp = ConvertCurrency( $order->{'currency'}, $rrp );
267
268
        $total_rrp += $qty * $order->{'rrp'};
269
        my $line_total = $qty * $order->{'ecost'};
270
        $total_rrp_est += $qty * $order->{'ecost'};
271
		# FIXME: what about the "actual cost" field?
272
        $qty_total += $qty;
273
        my %line = %{ $order };
274
        my $biblionumber = $order->{'biblionumber'};
275
        my $countbiblio = CountBiblioInOrders($biblionumber);
276
        my $ordernumber = $order->{'ordernumber'};
277
        my @subscriptions = GetSubscriptionsId ($biblionumber);
278
        my $itemcount = GetItemsCount($biblionumber);
279
        my $holds  = GetHolds ($biblionumber);
280
        my @items = GetItemnumbersFromOrder( $ordernumber );
281
        my $itemholds;
282
        foreach my $item (@items){
283
            my $nb = GetItemHolds($biblionumber, $item);
284
            if ($nb){
285
                $itemholds += $nb;
286
            }
287
        }
288
        # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
289
        $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
290
        $line{items}                = ($itemcount) - (scalar @items);
291
        $line{left_item}            = 1 if $line{items} >= 1;
292
        $line{left_biblio}          = 1 if $countbiblio > 1;
293
        $line{biblios}              = $countbiblio - 1;
294
        $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
295
        $line{subscriptions}        = scalar @subscriptions;
296
        ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
297
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
298
        $line{holds}                = $holds;
299
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
300
        $line{order_received}       = ( $qty == $order->{'quantityreceived'} );
301
        $line{basketno}             = $basketno;
302
        $line{budget_name}          = $budget->{budget_name};
303
        $line{rrp}                  = sprintf( "%.2f", $line{'rrp'} );
304
        $line{ecost}                = sprintf( "%.2f", $line{'ecost'} );
305
        $line{line_total}           = sprintf( "%.2f", $line_total );
306
        if ($line{uncertainprice}) {
307
            $template->param( uncertainprices => 1 );
250
            $template->param( uncertainprices => 1 );
308
            $line{rrp} .= ' (Uncertain)';
309
        }
251
        }
310
	if ($line{'title'}){
252
311
	    my $volume = $order->{'volume'};
253
        push @books_loop, $line;
312
	    my $seriestitle = $order->{'seriestitle'};
254
313
	    $line{'title'} .= " / $seriestitle" if $seriestitle;
255
        $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
314
	    $line{'title'} .= " / $volume" if $volume;
256
        $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
315
	} else {
257
        $total_gstvalue += $$line{gstvalue};
316
	    $line{'title'} = "Deleted bibliographic notice, can't find title.";
258
        $foot{$$line{gstgsti}}{quantity}  += $$line{quantity};
317
	}
259
        $total_quantity += $$line{quantity};
318
260
        $foot{$$line{gstgsti}}{totalgste} += $$line{totalgste};
319
        $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
261
        $total_gste += $$line{totalgste};
320
        $line{suggestionid}         = $suggestion->{suggestionid};
262
        $foot{$$line{gstgsti}}{totalgsti} += $$line{totalgsti};
321
        $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
263
        $total_gsti += $$line{totalgsti};
322
        $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
323
324
        push @books_loop, \%line;
325
    }
264
    }
326
265
327
my $total_est_gste;
266
    push @book_foot_loop, map {$_} values %foot;
328
    my $total_est_gsti;
267
329
    my $gist_est;
268
    # Get cancelled orders
330
    if ($gist){                                                    # if we have GST
269
    @results = GetCancelledOrders($basketno);
331
       if ( $bookseller->{'listincgst'} ) {                        # if prices already includes GST
270
    my @cancelledorders_loop;
332
           $total_rrp_gsti = $total_rrp;                           # we know $total_rrp_gsti
271
    for my $order (@results) {
333
           $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 );      # and can reverse compute other values
272
        my $line = get_infos( $order, $bookseller);
334
           $gist_rrp       = $total_rrp_gsti - $total_rrp_gste;    #
273
        push @cancelledorders_loop, $line;
335
           $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount );
274
    }
336
           $total_est_gsti = $total_rrp_est;
337
        } else {                                                    # if prices does not include GST
338
           $total_rrp_gste = $total_rrp;                           # then we use the common way to compute other values
339
           $gist_rrp       = $total_rrp_gste * $gist;              #
340
           $total_rrp_gsti = $total_rrp_gste + $gist_rrp;          #
341
           $total_est_gste = $total_rrp_est;
342
           $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount );
343
       }
344
       $gist_est = $gist_rrp - ( $gist_rrp * $discount );
345
    } else {
346
    $total_rrp_gsti = $total_rrp;
347
    $total_est_gsti = $total_rrp_est;
348
}
349
275
350
    my $contract = &GetContract($basket->{contractnumber});
276
    my $contract = &GetContract($basket->{contractnumber});
351
    my @orders = GetOrders($basketno);
277
    my @orders = GetOrders($basketno);
Lines 382-399 my $total_est_gste; Link Here
382
        booksellerid         => $bookseller->{'id'},
308
        booksellerid         => $bookseller->{'id'},
383
        name                 => $bookseller->{'name'},
309
        name                 => $bookseller->{'name'},
384
        books_loop           => \@books_loop,
310
        books_loop           => \@books_loop,
311
        book_foot_loop       => \@book_foot_loop,
385
        cancelledorders_loop => \@cancelledorders,
312
        cancelledorders_loop => \@cancelledorders,
386
        gist_rate            => sprintf( "%.2f", $gist * 100 ) . '%',
313
        total_quantity       => $total_quantity,
387
        total_rrp_gste       => sprintf( "%.2f", $total_rrp_gste ),
314
        total_gste           => sprintf( "%.2f", $total_gste ),
388
        total_est_gste       => sprintf( "%.2f", $total_est_gste ),
315
        total_gsti           => sprintf( "%.2f", $total_gsti ),
389
        gist_est             => sprintf( "%.2f", $gist_est ),
316
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
390
        gist_rrp             => sprintf( "%.2f", $gist_rrp ),        
317
        currency             => $cur->{'currency'},
391
        total_rrp_gsti       => sprintf( "%.2f", $total_rrp_gsti ),
318
        listincgst           => $bookseller->{listincgst},
392
        total_est_gsti       => sprintf( "%.2f", $total_est_gsti ),
393
#        currency             => $bookseller->{'listprice'},
394
	currency		=> $cur->{'currency'},
395
        qty_total            => $qty_total,
396
        GST                  => $gist,
397
        basketgroups         => $basketgroups,
319
        basketgroups         => $basketgroups,
398
        grouped              => $basket->{basketgroupid},
320
        grouped              => $basket->{basketgroupid},
399
        unclosable           => @orders ? 0 : 1, 
321
        unclosable           => @orders ? 0 : 1, 
Lines 401-404 my $total_est_gste; Link Here
401
    );
323
    );
402
}
324
}
403
325
326
sub get_order_infos {
327
    my $order = shift;
328
    my $bookseller = shift;
329
    my $qty = $order->{'quantity'} || 0;
330
    if ( !defined $order->{quantityreceived} ) {
331
        $order->{quantityreceived} = 0;
332
    }
333
    my $budget = GetBudget( $order->{'budget_id'} );
334
335
    my %line = %{ $order };
336
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
337
    $line{basketno}       = $basketno;
338
    $line{budget_name}    = $budget->{budget_name};
339
    $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
340
    if ( $bookseller->{'listincgst'} ) {
341
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
342
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
343
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
344
        $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
345
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
346
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
347
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
348
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
349
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
350
    } else {
351
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
352
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
353
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
354
        $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
355
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
356
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
357
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
358
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
359
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
360
    }
361
362
    if ( $line{uncertainprice} ) {
363
        $line{rrpgste} .= ' (Uncertain)';
364
    }
365
    if ( $line{'title'} ) {
366
        my $volume      = $order->{'volume'};
367
        my $seriestitle = $order->{'seriestitle'};
368
        $line{'title'} .= " / $seriestitle" if $seriestitle;
369
        $line{'title'} .= " / $volume"      if $volume;
370
    } else {
371
        $line{'title'} = "Deleted bibliographic notice, can't find title.";
372
    }
373
374
    my $biblionumber = $order->{'biblionumber'};
375
    my $countbiblio = CountBiblioInOrders($biblionumber);
376
    my $ordernumber = $order->{'ordernumber'};
377
    my @subscriptions = GetSubscriptionsId ($biblionumber);
378
    my $itemcount = GetItemsCount($biblionumber);
379
    my $holds  = GetHolds ($biblionumber);
380
    my @items = GetItemnumbersFromOrder( $ordernumber );
381
    my $itemholds;
382
    foreach my $item (@items){
383
        my $nb = GetItemHolds($biblionumber, $item);
384
        if ($nb){
385
            $itemholds += $nb;
386
        }
387
    }
388
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
389
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
390
    $line{items}                = ($itemcount) - (scalar @items);
391
    $line{left_item}            = 1 if $line{items} >= 1;
392
    $line{left_biblio}          = 1 if $countbiblio > 1;
393
    $line{biblios}              = $countbiblio - 1;
394
    $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
395
    $line{subscriptions}        = scalar @subscriptions;
396
    ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
397
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
398
    $line{holds}                = $holds;
399
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
400
401
402
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
403
    $line{suggestionid}         = $$suggestion{suggestionid};
404
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
405
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
406
407
    return \%line;
408
}
409
404
output_html_with_http_headers $query, $cookie, $template->output;
410
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/acqui/finishreceive.pl (-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 (-36 / +55 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 128-169 if ( $count == 1 ) { Link Here
128
        );
126
        );
129
    }
127
    }
130
128
131
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
129
    $order->{quantityreceived} = '' if $order->{quantityreceived} == 0;
132
        @$results[0]->{'quantityreceived'} = '';
130
    $order->{unitprice} = '' if $order->{unitprice} == 0;
133
    }
131
134
    if ( @$results[0]->{'unitprice'} == 0 ) {
132
    my $rrp;
135
        @$results[0]->{'unitprice'} = '';
133
    my $ecost;
136
    }
134
    my $unitprice;
135
    if ( $bookseller->{listincgst} ) {
136
        if ( $bookseller->{invoiceincgst} ) {
137
            $rrp = $order->{rrp};
138
            $ecost = $order->{ecost};
139
            $unitprice = $order->{unitprice};
140
        } else {
141
            $rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
142
            $ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
143
            $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
144
        }
145
    } else {
146
        if ( $bookseller->{invoiceincgst} ) {
147
            $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
148
            $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
149
            $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
150
        } else {
151
            $rrp = $order->{rrp};
152
            $ecost = $order->{ecost};
153
            $unitprice = $order->{unitprice};
154
        }
155
     }
137
156
138
    my $suggestion   = GetSuggestionInfoFromBiblionumber(@$results[0]->{'biblionumber'});
157
    my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
139
158
140
    my $authorisedby = @$results[0]->{'authorisedby'};
159
    my $authorisedby = $order->{authorisedby};
141
    my $member = GetMember( borrowernumber => $authorisedby );
160
    my $member = GetMember( borrowernumber => $authorisedby );
142
161
143
    my $budget = GetBudget( @$results[0]->{'budget_id'} );
162
    my $budget = GetBudget( $order->{budget_id} );
144
163
145
    $template->param(
164
    $template->param(
146
        count                 => 1,
165
        count                 => 1,
147
        biblionumber          => @$results[0]->{'biblionumber'},
166
        biblionumber          => $order->{biblionumber},
148
        ordernumber           => @$results[0]->{'ordernumber'},
167
        ordernumber           => $order->{ordernumber},
149
        biblioitemnumber      => @$results[0]->{'biblioitemnumber'},
168
        biblioitemnumber      => $order->{biblioitemnumber},
150
        booksellerid            => @$results[0]->{'booksellerid'},
169
        booksellerid          => $booksellerid,
151
        freight               => $freight,
170
        freight               => $freight,
152
        gst                   => $gst,
171
        gstrate               => $gstrate,
153
        name                  => $bookseller->{'name'},
172
        name                  => $bookseller->{name},
154
        date                  => format_date($date),
173
        date                  => format_date($date),
155
        title                 => @$results[0]->{'title'},
174
        title                 => $order->{title},
156
        author                => @$results[0]->{'author'},
175
        author                => $order->{author},
157
        copyrightdate         => @$results[0]->{'copyrightdate'},
176
        copyrightdate         => $order->{copyrightdate},
158
        isbn                  => @$results[0]->{'isbn'},
177
        isbn                  => $order->{isbn},
159
        seriestitle           => @$results[0]->{'seriestitle'},
178
        seriestitle           => $order->{seriestitle},
160
        bookfund              => $budget->{budget_name},
179
        bookfund              => $budget->{budget_name}, # FIXME OR $order->{'bookfundid'}, ?
161
        quantity              => @$results[0]->{'quantity'},
180
        quantity              => $order->{quantity},
162
        quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1,
181
        quantityreceivedplus1 => $order->{quantityreceived} + 1,
163
        quantityreceived      => @$results[0]->{'quantityreceived'},
182
        quantityreceived      => $order->{quantityreceived},
164
        rrp                   => @$results[0]->{'rrp'},
183
        rrp                   => sprintf( "%.2f", $rrp ),
165
        ecost                 => @$results[0]->{'ecost'},
184
        ecost                 => sprintf( "%.2f", $ecost ),
166
        unitprice             => @$results[0]->{'unitprice'},
185
        unitprice             => $unitprice,
167
        memberfirstname       => $member->{firstname} || "",
186
        memberfirstname       => $member->{firstname} || "",
168
        membersurname         => $member->{surname} || "",
187
        membersurname         => $member->{surname} || "",
169
        invoice               => $invoice,
188
        invoice               => $invoice,
Lines 183-192 else { Link Here
183
        $line{invoice}      = $invoice;
202
        $line{invoice}      = $invoice;
184
        $line{datereceived} = $datereceived->output();
203
        $line{datereceived} = $datereceived->output();
185
        $line{freight}      = $freight;
204
        $line{freight}      = $freight;
186
        $line{gst}          = $gst;
205
        $line{gstrate}      = $gstrate;
187
        $line{title}        = @$results[$i]->{'title'};
206
        $line{title}        = @$results[$i]->{'title'};
188
        $line{author}       = @$results[$i]->{'author'};
207
        $line{author}       = @$results[$i]->{'author'};
189
        $line{booksellerid}   = $booksellerid;
208
        $line{booksellerid} = $booksellerid;
190
        push @loop, \%line;
209
        push @loop, \%line;
191
    }
210
    }
192
211
(-)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 67-78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
67
        debug           => 1,
67
        debug           => 1,
68
    }
68
    }
69
);
69
);
70
my $seller_gstrate = $supplier->{'gstrate'};
71
70
72
# ensure the scalar isn't flagged as a string
73
$seller_gstrate = ( defined $seller_gstrate ) ? $seller_gstrate + 0 : undef;
74
my $tax_rate = $seller_gstrate // C4::Context->preference('gist') // 0;
75
$tax_rate *= 100;
76
#build array for currencies
71
#build array for currencies
77
if ( $op eq 'display' ) {
72
if ( $op eq 'display' ) {
78
73
Lines 102-113 if ( $op eq 'display' ) { Link Here
102
        gstreg        => $supplier->{'gstreg'},
97
        gstreg        => $supplier->{'gstreg'},
103
        listincgst    => $supplier->{'listincgst'},
98
        listincgst    => $supplier->{'listincgst'},
104
        invoiceincgst => $supplier->{'invoiceincgst'},
99
        invoiceincgst => $supplier->{'invoiceincgst'},
100
        gstrate       => $supplier->{'gstrate'} + 0.0,
105
        discount      => $supplier->{'discount'},
101
        discount      => $supplier->{'discount'},
106
        deliverytime  => $supplier->{deliverytime},
102
        deliverytime  => $supplier->{deliverytime},
107
        invoiceprice  => $supplier->{'invoiceprice'},
103
        invoiceprice  => $supplier->{'invoiceprice'},
108
        listprice     => $supplier->{'listprice'},
104
        listprice     => $supplier->{'listprice'},
109
        GST           => $tax_rate,
110
        default_tax   => defined($seller_gstrate),
111
        basketcount   => $supplier->{'basketcount'},
105
        basketcount   => $supplier->{'basketcount'},
112
        subscriptioncount   => $supplier->{'subscriptioncount'},
106
        subscriptioncount   => $supplier->{'subscriptioncount'},
113
        contracts     => $contracts,
107
        contracts     => $contracts,
Lines 141-149 if ( $op eq 'display' ) { Link Here
141
            };
135
            };
142
    }
136
    }
143
137
144
    my $default_gst_rate = (C4::Context->preference('gist') * 100) || '0.0';
138
    # get option values from gist syspref
139
    my @gst_values = map {
140
        option => $_
141
    }, split( '\|', C4::Context->preference("gist") );
145
142
146
    my $gstrate = defined $supplier->{gstrate} ? $supplier->{gstrate} * 100 : '';
147
    $template->param(
143
    $template->param(
148
        booksellerid => $booksellerid,
144
        booksellerid => $booksellerid,
149
        name         => $supplier->{'name'},
145
        name         => $supplier->{'name'},
Lines 169-181 if ( $op eq 'display' ) { Link Here
169
        gstreg        => $supplier->{'gstreg'},
165
        gstreg        => $supplier->{'gstreg'},
170
        listincgst    => $supplier->{'listincgst'},
166
        listincgst    => $supplier->{'listincgst'},
171
        invoiceincgst => $supplier->{'invoiceincgst'},
167
        invoiceincgst => $supplier->{'invoiceincgst'},
172
        gstrate       => $gstrate,
168
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
169
        gst_values    => \@gst_values,
173
        discount      => $supplier->{'discount'},
170
        discount      => $supplier->{'discount'},
174
        deliverytime  => $supplier->{deliverytime},
171
        deliverytime  => $supplier->{deliverytime},
175
        loop_currency => $loop_currency,
172
        loop_currency => $loop_currency,
176
        GST           => $tax_rate,
177
        enter         => 1,
173
        enter         => 1,
178
        default_gst_rate => $default_gst_rate,
179
    );
174
    );
180
}
175
}
181
176
(-)a/acqui/updatesupplier.pl (-7 / +2 lines)
Lines 100-112 $data{'gstreg'}=$input->param('gst'); Link Here
100
$data{'listincgst'}=$input->param('list_gst');
100
$data{'listincgst'}=$input->param('list_gst');
101
$data{'invoiceincgst'}=$input->param('invoice_gst');
101
$data{'invoiceincgst'}=$input->param('invoice_gst');
102
#have to transform this into fraction so it's easier to use
102
#have to transform this into fraction so it's easier to use
103
my $gstrate = $input->param('gstrate');
103
$data{'gstrate'} = $input->param('gstrate');
104
if ($gstrate eq '') {
104
$data{'discount'} = $input->param('discount');
105
    $data{'gstrate'} = undef;
106
} else {
107
    $data{'gstrate'} = $input->param('gstrate')/100;
108
}
109
$data{'discount'}=$input->param('discount');
110
$data{deliverytime} = $input->param('deliverytime');
105
$data{deliverytime} = $input->param('deliverytime');
111
$data{'active'}=$input->param('status');
106
$data{'active'}=$input->param('status');
112
if($data{'name'}) {
107
if($data{'name'}) {
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2734-2740 CREATE TABLE `aqorders` ( Link Here
2734
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2734
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2735
  `rrp` decimal(13,2) default NULL,
2735
  `rrp` decimal(13,2) default NULL,
2736
  `ecost` decimal(13,2) default NULL,
2736
  `ecost` decimal(13,2) default NULL,
2737
  `gst` decimal(13,2) default NULL,
2737
  gstrate decimal(6,4) default NULL,
2738
  discount float(6,4) default NULL,
2738
  `budget_id` int(11) NOT NULL,
2739
  `budget_id` int(11) NOT NULL,
2739
  `budgetgroup_id` int(11) NOT NULL,
2740
  `budgetgroup_id` int(11) NOT NULL,
2740
  `budgetdate` date default NULL,
2741
  `budgetdate` date default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (+15 lines)
Lines 5197-5202 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5197
}
5197
}
5198
5198
5199
5199
5200
5201
$DBversion = "3.07.00.XXX";
5202
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5203
    $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4)  DEFAULT NULL");
5204
    print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
5205
    SetVersion($DBversion);
5206
}
5207
5208
$DBversion = "3.07.00.XXX";
5209
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5210
    $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
5211
    print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
5212
    SetVersion($DBversion);
5213
}
5214
5200
=head1 FUNCTIONS
5215
=head1 FUNCTIONS
5201
5216
5202
=head2 DropAllForeignKeys($table)
5217
=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/addorderiso2709.tt (-1 / +1 lines)
Lines 159-165 Link Here
159
                            [% ELSE %]
159
                            [% ELSE %]
160
                            <li>
160
                            <li>
161
                            <label for="currency">Currency:</label>
161
                            <label for="currency">Currency:</label>
162
                            <select name="currency" id="currency" onchange="calcNeworderTotal();">
162
                            <select name="currency" id="currency">
163
                            [% FOREACH loop_currencie IN loop_currencies %]
163
                            [% FOREACH loop_currencie IN loop_currencies %]
164
                                    [% 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 %]
164
                                    [% 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 %]
165
                            </select>
165
                            </select>
(-)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 215-230 Link Here
215
237
216
        [% UNLESS ( delete_confirm ) %]
238
        [% UNLESS ( delete_confirm ) %]
217
        <div id="acqui_basket_content" class="yui-g">
239
        <div id="acqui_basket_content" class="yui-g">
240
        <label for="show_all_details">
241
            <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
242
            Show all details
243
        </label>
218
        <h2>Order Details</h2>
244
        <h2>Order Details</h2>
219
        [% IF ( books_loop ) %]
245
        [% IF ( books_loop ) %]
220
            <table id="orders">
246
            <table id="orders">
221
                <thead>
247
                <thead>
222
                    <tr>
248
                    <tr>
223
                        <th>Order</th>
249
                        <th>Order</th>
224
                        <th>RRP</th>
250
                        <th class="gste">RRP tax exc.</th>
225
                        <th>Est.</th>
251
                        <th class="gste">ecost tax exc.</th>
252
                        <th class="gsti">RRP tax inc.</th>
253
                        <th class="gsti">ecost tax inc.</th>
226
                        <th>Qty.</th>
254
                        <th>Qty.</th>
227
                        <th>Total</th>
255
                        <th class="gste">Total tax exc. ([% currency %])</th>
256
                        <th class="gsti">Total tax inc. ([% currency %])</th>
257
                        <th>GST %</th>
258
                        <th>GST</th>
228
                        <th>Fund</th>
259
                        <th>Fund</th>
229
                        [% IF ( active ) %]
260
                        [% IF ( active ) %]
230
                            [% UNLESS ( closedate ) %]
261
                            [% UNLESS ( closedate ) %]
Lines 235-278 Link Here
235
                    </tr>
266
                    </tr>
236
                </thead>
267
                </thead>
237
                <tfoot>
268
                <tfoot>
238
                [% IF ( GST ) %]
269
                [% FOREACH foot_loo IN book_foot_loop %]
239
                <tr>
270
                    <tr>
240
                    <th scope="row">Total tax exc.</th>
271
                        <th>Total (GST [% foot_loo.gstgsti %])</th>
241
                    <td>[% total_rrp_gste %]</td>
272
                        <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
242
                    <td>&nbsp;</td>
273
                        <th>[% foot_loo.quantity %]</th>
243
                    <td>[% qty_total %]</td>
274
                        <th class="gste">[% foot_loo.totalgste %]</th>
244
                    <td>[% total_est_gste %]</td>
275
                        <th class="gsti">[% foot_loo.totalgsti %]</th>
245
                        [% IF ( active ) %]
276
                        <th/>
246
                            [% IF ( closedate ) %]
277
                        <th>[% foot_loo.gstvalue %]</th>
247
                            <td colspan="1" rowspan="3">&nbsp;</td>
278
                        <th/>
248
                            [% ELSE %]
279
                        [% IF ( foot_loo.active ) %]
249
                            <td colspan="3" rowspan="3">&nbsp;</td>
280
                            [% UNLESS ( foot_loo.closedate ) %]
281
                                <th/>&nbsp;<th/>
250
                            [% END %]
282
                            [% END %]
251
                        [% END %]
283
                        [% END %]
252
                </tr>
284
                    </tr>
253
                <tr>
285
                [% END %]
254
                    <th scope="row">Tax ([% gist_rate %])</th>
255
                    <td>[% gist_rrp %]</td>
256
                    <td>&nbsp;</td>
257
                    <td>&nbsp;</td>
258
                    <td>[% gist_est %]</td>
259
                </tr>
260
                <tr>
261
                    <th scope="row">Total tax inc. ([% currency %])</th>
262
                    <td>[% total_rrp_gsti %]</td>
263
                    <td>&nbsp;</td>
264
                    <td>[% qty_total %]</td>
265
                    <td>[% total_est_gsti %]</td>
266
                </tr>
267
                [% ELSE %]
268
                <tr>
286
                <tr>
269
                    <th scope="row">Total ([% currency %])</th>
287
                    <th>Total ([% currency %])</th>
270
                    <td>[% total_rrp_gsti %]</td>
288
                    <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
271
                    <td>&nbsp;</td>
289
                    <th>[% total_quantity %]</th>
272
                    <td>[% qty_total %]</td>
290
                    <th class="gste">[% total_gste %]</th>
273
                    <td>[% total_est_gsti %]</td>
291
                    <th class="gsti">[% total_gsti %]</th>
292
                    <th/>
293
                    <th>[% total_gstvalue %]</th>
294
                    <th/>
295
                    [% IF ( books_loo.active ) %]
296
                        [% UNLESS ( books_loo.closedate ) %]
297
                            <th/>&nbsp;<th/>
298
                        [% END %]
299
                    [% END %]
274
                </tr>
300
                </tr>
275
                [% END %]
276
                </tfoot>
301
                </tfoot>
277
                <tbody>
302
                <tbody>
278
                [% FOREACH books_loo IN books_loop %]
303
                [% FOREACH books_loo IN books_loop %]
Lines 298-307 Link Here
298
                                [% END %]
323
                                [% END %]
299
                            </p>
324
                            </p>
300
                        </td>
325
                        </td>
301
                        <td class="number">[% books_loo.rrp %]</td>
326
                        <td class="number gste">[% books_loo.rrpgste %]</td>
302
                        <td class="number">[% books_loo.ecost %]</td>
327
                        <td class="number gste">[% books_loo.ecostgste %]</td>
328
                        <td class="number gsti">[% books_loo.rrpgsti %]</td>
329
                        <td class="number gsti">[% books_loo.ecostgsti %]</td>
303
                        <td class="number">[% books_loo.quantity %]</td>
330
                        <td class="number">[% books_loo.quantity %]</td>
304
                        <td class="number">[% books_loo.line_total %]</td>
331
                        <td class="number gste">[% books_loo.totalgste %]</td>
332
                        <td class="number gsti">[% books_loo.totalgsti %]</td>
333
                        <td class="number">[% books_loo.gstgsti %]</td>
334
                        <td class="number">[% books_loo.gstvalue %]</td>
305
                        <td>[% books_loo.budget_name %]</td>
335
                        <td>[% books_loo.budget_name %]</td>
306
                        [% IF ( active ) %]
336
                        [% IF ( active ) %]
307
                            [% UNLESS ( closedate ) %]
337
                            [% UNLESS ( closedate ) %]
Lines 353-362 Link Here
353
              <thead>
383
              <thead>
354
                <tr>
384
                <tr>
355
                  <th>Order</th>
385
                  <th>Order</th>
356
                  <th>RRP</th>
386
                  <th class="gste">RRP tax exc.</th>
357
                  <th>Est.</th>
387
                  <th class="gste">ecost tax exc.</th>
388
                  <th class="gsti">RRP tax inc.</th>
389
                  <th class="gsti">ecost tax inc.</th>
358
                  <th>Qty.</th>
390
                  <th>Qty.</th>
359
                  <th>Total</th>
391
                  <th class="gste">Total tax exc. ([% currency %])</th>
392
                  <th class="gsti">Total tax inc. ([% currency %])</th>
393
                  <th>GST %</th>
394
                  <th>GST</th>
360
                  <th>Fund</th>
395
                  <th>Fund</th>
361
                </tr>
396
                </tr>
362
              </thead>
397
              </thead>
Lines 379-389 Link Here
379
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
414
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
380
                      </p>
415
                      </p>
381
                    </td>
416
                    </td>
382
                    <td><p>[% order.rrp %]</p></td>
417
                    <td class="number gste">[% order.rrpgste %]</td>
383
                    <td><p>[% order.ecost %]</p></td>
418
                    <td class="number gste">[% order.ecostgste %]</td>
384
                    <td><p>[% order.quantity %]</p></td>
419
                    <td class="number gsti">[% order.rrpgsti %]</td>
385
                    <td><p>[% order.line_total %]</p></td>
420
                    <td class="number gsti">[% order.ecostgsti %]</td>
386
                    <td><p>[% order.budget_name %]</p></td>
421
                    <td class="number">[% order.quantity %]</td>
422
                    <td class="number gste">[% order.totalgste %]</td>
423
                    <td class="number gsti">[% order.totalgsti %]</td>
424
                    <td class="number">[% order.gstgsti %]</td>
425
                    <td class="number">[% order.gstvalue %]</td>
426
                    <td>[% order.budget_name %]
387
                  </tr>
427
                  </tr>
388
                [% END %]
428
                [% END %]
389
              </tbody>
429
              </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-39 / +50 lines)
Lines 138-144 $(document).ready(function() Link Here
138
//]]>
138
//]]>
139
</script>
139
</script>
140
</head>
140
</head>
141
<body id="acq_neworderempty" class="acq">
141
<body id="acq_neworderempty" class="acq" onload="updateCosts()">
142
142
143
[% INCLUDE 'header.inc' %]
143
[% INCLUDE 'header.inc' %]
144
[% INCLUDE 'acquisitions-search.inc' %]
144
[% INCLUDE 'acquisitions-search.inc' %]
Lines 217-234 $(document).ready(function() Link Here
217
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
217
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
218
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
218
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
219
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
219
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
220
        <input type="hidden" name="discount" value="[% discount %]" />
220
        <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
221
        <input type="hidden" name="listinc" value="[% listincgst %]" />
221
        <input type="hidden" name="applygst" id="applygst" value="[% gstreg %]" />
222
<!--        <input type="hidden" name="currency" value="[% currency %]" />-->
222
        <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
223
        <input type="hidden" name="applygst" value="[% gstreg %]" />
224
        <input type="hidden" name="invoiceincgst" value="[% invoiceincgst %]" />
225
        <input type="hidden" name="gstrate" value="[% gstrate %]" />
226
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
223
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
227
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
224
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
225
        <input type="hidden" name="currency_rate" id="currency_rate" value="[% currency_rate %]" />
228
226
229
        [% FOREACH loop_currencie IN loop_currencies %]
230
            <input type="hidden" id="[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
231
        [% END %]
232
        <ol><li>
227
        <ol><li>
233
            [% IF ( biblionumber ) %]
228
            [% IF ( biblionumber ) %]
234
            <span class="label">Title</span>
229
            <span class="label">Title</span>
Lines 378-384 $(document).ready(function() Link Here
378
                    [% IF (AcqCreateItemOrdering) %]
373
                    [% IF (AcqCreateItemOrdering) %]
379
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" onchange="updateCosts();" />
374
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" onchange="updateCosts();" />
380
                    [% ELSE %]
375
                    [% ELSE %]
381
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
376
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
382
                    [% END %]
377
                    [% END %]
383
                [% END %]
378
                [% END %]
384
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
379
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
Lines 412-418 $(document).ready(function() Link Here
412
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
407
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
413
                [% ELSE %]
408
                [% ELSE %]
414
			<label for="currency">Currency:</label>
409
			<label for="currency">Currency:</label>
415
			<select name="currency" id="currency" onchange="calcNeworderTotal();">
410
			<select name="currency" id="currency" onchange="updateCosts();">
416
			[% FOREACH loop_currencie IN loop_currencies %]
411
			[% FOREACH loop_currencie IN loop_currencies %]
417
	                [% 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 %]
412
	                [% 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 %]
418
			</select>
413
			</select>
Lines 420-430 $(document).ready(function() Link Here
420
                </li>
415
                </li>
421
            <li>
416
            <li>
422
                [% IF ( close ) %]
417
                [% IF ( close ) %]
423
            <span class="label">Vendor price: </span>
418
                    <span class="label">Vendor price: </span>
424
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
419
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
425
                [% ELSE %]
420
                [% ELSE %]
426
                <label for="listprice">Vendor price: </label>
421
                <label for="listprice">Vendor price: </label>
427
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="calcNeworderTotal()" />
422
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="updateCosts()" />
428
                [% END %]
423
                [% END %]
429
            </li>
424
            </li>
430
            [% UNLESS ( close ) %]
425
            [% UNLESS ( close ) %]
Lines 437-489 $(document).ready(function() Link Here
437
                [% END %]
432
                [% END %]
438
            </li>
433
            </li>
439
            [% END %]
434
            [% END %]
440
			<li>
435
            <li>
441
                [% IF ( close ) %]
436
                [% IF ( close ) %]
442
            <span class="label">Replacement cost: </span>
437
                    <span class="label">gstrate: </span>
443
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
438
                    <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
444
                [% ELSE %]
439
                [% ELSE %]
445
                <label for="rrp">Replacement cost: </label>
440
                    <label for="gst">gstrate: </label>
446
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
441
                    <select name="gstrate" id="gstrate" onchange="updateCosts();">
442
                    [% FOREACH gst IN gst_values %]
443
                       <option value="[% gst.option %]"[% IF ( gst.option == gstrate ) %] selected="selected"[% END %]>[% gst.option * 100 | format("%.1f") %]%</option>
444
                    [% END %]
445
                    </select>
447
                [% END %]
446
                [% END %]
448
            </li>
447
            </li>
449
            <li>
448
            <li>
449
                <label for="discount">Discount: </label>
450
                [% IF ( close ) %]
450
                [% IF ( close ) %]
451
            <label for="ecost">Budgeted cost: </label>
451
                    [% IF ( orderdiscount ) %]
452
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
452
                        <input type="hidden" name="discount" id="discount" value="[% orderdiscount %]" />[% orderdiscount_2dp %]%
453
                    [% ELSE %]
454
                        <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
455
                    [% END %]
453
                [% ELSE %]
456
                [% ELSE %]
454
                <label for="ecost">Budgeted cost: </label>
457
                    [% IF ( orderdiscount ) %]
455
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
458
                        <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
459
                    [% ELSE %]
460
                        <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
461
                    [% END %]
456
                [% END %]
462
                [% END %]
457
                [% IF ( discount_2dp ) %]  (adjusted for [% discount_2dp %]% discount)  [% END %]
458
459
            </li>
463
            </li>
460
            [% IF ( GST ) %]
461
            <li>
464
            <li>
462
                [% IF ( close ) %]
465
                [% IF ( close ) %]
463
            <label for="GST">Budgeted GST: </label>
466
                    <span class="label">Replacement cost: </span>
464
                <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
467
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
465
                [% ELSE %]
468
                [% ELSE %]
466
                <label for="GST">Budgeted GST: </label>
469
                    <label for="rrp">Replacement cost: </label>
467
                <input type="text" size="20" name="gst" id="GST" value="" />
470
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
471
                [% END %]
472
            </li>
473
            <li>
474
                [% IF ( close ) %]
475
                    <label for="ecost">Budgeted cost: </label>
476
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
477
                [% ELSE %]
478
                    <label for="ecost">Budgeted cost: </label>
479
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
468
                [% END %]
480
                [% END %]
469
            </li>
481
            </li>
470
            [% END %]
471
            <li>
482
            <li>
472
                [% IF ( close ) %]
483
                [% IF ( close ) %]
473
            <label for="total">Total: </label>
484
                    <label for="total">Total: </label>
474
                <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
485
                    <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
475
                [% ELSE %]
486
                [% ELSE %]
476
                <label for="total">Total: </label>
487
                    <label for="total">Total: </label>
477
                <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
488
                    <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
478
                [% END %]
489
                [% END %]
479
            </li>
490
            </li>
480
            <li>
491
            <li>
481
                [% IF ( close ) %]
492
                [% IF ( close ) %]
482
            <label for="cost">Actual cost: </label>
493
                    <label for="unitprice">Actual cost: </label>
483
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
494
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
484
                [% ELSE %]
495
                [% ELSE %]
485
                <label for="cost">Actual cost: </label>
496
                    <label for="unitprice">Actual cost: </label>
486
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
497
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
487
                [% END %]
498
                [% END %]
488
            </li>
499
            </li>
489
            <li>
500
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-3 / +3 lines)
Lines 134-140 Link Here
134
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
134
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
135
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
135
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
136
    <input type="hidden" name="freight" value="[% freight %]" />
136
    <input type="hidden" name="freight" value="[% freight %]" />
137
    <input type="hidden" name="gst" value="[% gst %]" />
137
    <input type="hidden" name="gstrate" value="[% gstrate %]" />
138
	</div>
138
	</div>
139
	<div class="yui-u">
139
	<div class="yui-u">
140
    <fieldset class="rows">
140
    <fieldset class="rows">
Lines 191-197 Link Here
191
</div>
191
</div>
192
</div><div class="yui-g"><fieldset class="action">
192
</div><div class="yui-g"><fieldset class="action">
193
        <input type="submit"  value="Save" />
193
        <input type="submit"  value="Save" />
194
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
194
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=rate[% gstrate %]&amp;freight=[% freight %]">Cancel</a>
195
</fieldset></div>    </form>
195
</fieldset></div>    </form>
196
[% ELSE %]
196
[% ELSE %]
197
<div id="acqui_acquire_orderlist">
197
<div id="acqui_acquire_orderlist">
Lines 208-214 Link Here
208
        <tr>
208
        <tr>
209
            <td>[% loo.basketno %]</td>
209
            <td>[% loo.basketno %]</td>
210
            <td>[% loo.isbn %]</td>
210
            <td>[% loo.isbn %]</td>
211
         <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>
211
         <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>
212
            <td>[% loo.author %]</td>
212
            <td>[% loo.author %]</td>
213
            <td>[% loo.quantity %]</td>
213
            <td>[% loo.quantity %]</td>
214
            <td>[% loo.quantityreceived %]</td>
214
            <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 (-4 / +13 lines)
Lines 107-113 if (f.company.value == "") { Link Here
107
            </li>
107
            </li>
108
            </ol>
108
            </ol>
109
            <ol class="radio">
109
            <ol class="radio">
110
            <li><label for="gstyes" class="radio">Tax Number Registered:</label>
110
            <li><label for="gstyes" class="radio">Tax number registered:</label>
111
                [% IF ( gstreg ) %]
111
                [% IF ( gstreg ) %]
112
                    <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
112
                    <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
113
                    <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
113
                    <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
Lines 134-143 if (f.company.value == "") { Link Here
134
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
134
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
135
                [% END %]</li>
135
                [% END %]</li>
136
            </ol>
136
            </ol>
137
             <ol>
138
                <li>
139
                    <label for="gst">Tax rate</label>
140
                    <select name="gstrate" id="gstrate">
141
                    [% FOREACH gst IN gst_values %]
142
                       <option value="[% gst.option %]"[% IF ( gstrate == gst.option ) %] selected="selected"[% END %]>[% gst.option * 100 | format ("%.1f") %] %</option>
143
                    [% END %]
144
                    </select>
145
                </li>
146
            </ol>
137
            <ol>
147
            <ol>
138
            <li><label for="discount">Discount</label>
148
            <li><label for="discount">Discount</label>
139
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
149
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
140
            <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>
141
            <li>
150
            <li>
142
                <label for="deliverytime">Delivery time</label>
151
                <label for="deliverytime">Delivery time</label>
143
                <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
152
                <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
Lines 192-198 if (f.company.value == "") { Link Here
192
                    [% END %]</p>
201
                    [% END %]</p>
193
            <p><strong>List prices are: </strong>[% listprice %]</p>
202
            <p><strong>List prices are: </strong>[% listprice %]</p>
194
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
203
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
195
            [% IF ( GST ) %]<p><strong>Tax number registered: </strong>
204
            [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
196
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
205
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
197
            <p><strong>List item price includes tax: </strong>
206
            <p><strong>List item price includes tax: </strong>
198
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
207
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
Lines 201-207 if (f.company.value == "") { Link Here
201
            <p><strong>Discount: </strong>
210
            <p><strong>Discount: </strong>
202
                [% discount %] %</p>
211
                [% discount %] %</p>
203
            <p><strong>Tax rate: </strong>
212
            <p><strong>Tax rate: </strong>
204
                [% GST %]%[% UNLESS ( default_tax ) %] (default)[% END %]</p>
213
                [% 0 + gstrate * 100 | format("%.1f") %]%</p>
205
            [% IF deliverytime.defined %]
214
            [% IF deliverytime.defined %]
206
                <p><strong>Delivery time: </strong>
215
                <p><strong>Delivery time: </strong>
207
                    [% deliverytime %] days</p>
216
                    [% deliverytime %] days</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-2 / +2 lines)
Lines 32-40 Acquisitions: Link Here
32
              US: 360,000.00 (US)
32
              US: 360,000.00 (US)
33
              FR: 360 000,00 (FR)
33
              FR: 360 000,00 (FR)
34
    -
34
    -
35
        - The default tax rate is   
35
        - Default tax rates are
36
        - pref: gist
36
        - pref: gist
37
        - (enter in numeric form, 0.12 for 12%)
37
        - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separe with |)
38
38
39
    Printing:
39
    Printing:
40
    -
40
    -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+34 lines)
Lines 122-127 $(document).ready(function() { Link Here
122
     </div>
122
     </div>
123
</div>
123
</div>
124
</div>
124
</div>
125
    [% IF ( show_acquisition_details ) %]
126
        <div id="acquisition_details">
127
            <h2>Acquisition details</h2>
128
            <table>
129
                <thead>
130
                    <tr><th></th><th>Price exc. taxes</th><th>Price inc. taxes</th><th>fund</th><th></th></tr>
131
                </thead>
132
                <tbody>
133
                    <tr>
134
                        <td>Ordered amount</td>
135
                        <td>[% valuegste_ordered %]</td>
136
                        <td>[% valuegsti_ordered %]</td>
137
                        <td>[% budget_name_ordered %]</td>
138
                        <td>
139
                            [% IF ( ordered_exists ) %]
140
                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">See basket informations</a>
141
                            [% END %]
142
                        </td>
143
                    </tr>
144
                    <tr>
145
                        <td>Spent amount</td>
146
                        <td>[% valuegste_spent %]</td>
147
                        <td>[% valuegsti_spent %]</td>
148
                        <td>[% budget_name_spent %]</td>
149
                        <td>
150
                            [% IF ( spent_exists ) %]
151
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoicenumber=[% invoicenumber %]">See invoice informations</a>
152
                            [% END %]
153
                        </td>
154
                    </tr>
155
                </tbody>
156
            </table>
157
        </div>
158
    <!-- /TMPL_IF -->
125
    <div id="subscription_planning">
159
    <div id="subscription_planning">
126
    <div class="yui-g">
160
    <div class="yui-g">
127
    <div class="rows">
161
    <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