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

(-)a/C4/Acquisition.pm (-4 / +7 lines)
Lines 1021-1027 Else, the upcoming July 1st is used. Link Here
1021
1021
1022
=item defaults entrydate to Now
1022
=item defaults entrydate to Now
1023
1023
1024
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".
1024
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".
1025
1025
1026
=back
1026
=back
1027
1027
Lines 1270-1276 C<$ordernumber>. Link Here
1270
1270
1271
sub ModReceiveOrder {
1271
sub ModReceiveOrder {
1272
    my (
1272
    my (
1273
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost,
1273
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost, $ecost,
1274
        $invoiceid, $rrp, $budget_id, $datereceived, $received_items
1274
        $invoiceid, $rrp, $budget_id, $datereceived, $received_items
1275
    )
1275
    )
1276
    = @_;
1276
    = @_;
Lines 1306-1311 sub ModReceiveOrder { Link Here
1306
        ");
1306
        ");
1307
1307
1308
        $sth->execute($order->{quantity} - $quantrec, $ordernumber);
1308
        $sth->execute($order->{quantity} - $quantrec, $ordernumber);
1309
1309
        $sth->finish;
1310
        $sth->finish;
1310
1311
1311
        delete $order->{'ordernumber'};
1312
        delete $order->{'ordernumber'};
Lines 1315-1320 sub ModReceiveOrder { Link Here
1315
        $order->{'invoiceid'} = $invoiceid;
1316
        $order->{'invoiceid'} = $invoiceid;
1316
        $order->{'unitprice'} = $cost;
1317
        $order->{'unitprice'} = $cost;
1317
        $order->{'rrp'} = $rrp;
1318
        $order->{'rrp'} = $rrp;
1319
        $order->{ecost} = $ecost;
1318
        $order->{'orderstatus'} = 3;    # totally received
1320
        $order->{'orderstatus'} = 3;    # totally received
1319
        $new_ordernumber = NewOrder($order);
1321
        $new_ordernumber = NewOrder($order);
1320
1322
Lines 1326-1334 sub ModReceiveOrder { Link Here
1326
    } else {
1328
    } else {
1327
        $sth=$dbh->prepare("update aqorders
1329
        $sth=$dbh->prepare("update aqorders
1328
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1330
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1329
                                unitprice=?,rrp=?
1331
                                unitprice=?,rrp=?,ecost=?
1330
                            where biblionumber=? and ordernumber=?");
1332
                            where biblionumber=? and ordernumber=?");
1331
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$biblionumber,$ordernumber);
1333
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1332
        $sth->finish;
1334
        $sth->finish;
1333
    }
1335
    }
1334
    return ($datereceived, $new_ordernumber);
1336
    return ($datereceived, $new_ordernumber);
Lines 1598-1603 sub GetParcel { Link Here
1598
                aqorders.listprice,
1600
                aqorders.listprice,
1599
                aqorders.rrp,
1601
                aqorders.rrp,
1600
                aqorders.ecost,
1602
                aqorders.ecost,
1603
                aqorders.gstrate,
1601
                biblio.title
1604
                biblio.title
1602
        FROM aqorders
1605
        FROM aqorders
1603
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1606
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
(-)a/acqui/addorder.pl (-33 / +12 lines)
Lines 153-191 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
153
my $orderinfo					= $input->Vars;
153
my $orderinfo					= $input->Vars;
154
$orderinfo->{'list_price'}    ||=  0;
154
$orderinfo->{'list_price'}    ||=  0;
155
$orderinfo->{'uncertainprice'} ||= 0;
155
$orderinfo->{'uncertainprice'} ||= 0;
156
#my $ordernumber        = $input->param('ordernumber');
156
157
#my $basketno      = $input->param('basketno');
157
my $user = $input->remote_user;
158
#my $booksellerid  = $input->param('booksellerid');
158
159
#my $existing      = $input->param('existing');    # existing biblio, (not basket or order)
160
#my $title         = $input->param('title');
161
#my $author        = $input->param('author');
162
#my $publicationyear= $input->param('publicationyear');
163
#my $isbn          = $input->param('ISBN');
164
#my $itemtype      = $input->param('format');
165
#my $quantity      = $input->param('quantity');		# FIXME: else ERROR!
166
#my $branch        = $input->param('branch');
167
#my $series        = $input->param('series');
168
#my $notes         = $input->param('notes');
169
#my $budget_id     = $input->param('budget_id');
170
#my $sort1         = $input->param('sort1');
171
#my $sort2         = $input->param('sort2');
172
#my $rrp           = $input->param('rrp');
173
#my $ecost         = $input->param('ecost');
174
#my $gst           = $input->param('GST');
175
#my $budget        = $input->param('budget');
176
#my $cost          = $input->param('cost');
177
#my $sub           = $input->param('sub');
178
#my $purchaseorder = $input->param('purchaseordernumber');
179
#my $invoice       = $input->param('invoice');
180
#my $publishercode = $input->param('publishercode');
181
#my $suggestionid  = $input->param('suggestionid');
182
#my $biblionumber  = $input->param('biblionumber');
183
#my $uncertainprice = $input->param('uncertainprice');
184
#my $import_batch_id= $input->param('import_batch_id');
185
#
186
#my $createbibitem = $input->param('createbibitem');
187
#
188
my $user          = $input->remote_user;
189
# create, modify or delete biblio
159
# create, modify or delete biblio
190
# create if $quantity>=0 and $existing='no'
160
# create if $quantity>=0 and $existing='no'
191
# modify if $quantity>=0 and $existing='yes'
161
# modify if $quantity>=0 and $existing='yes'
Lines 208-213 if ( $orderinfo->{quantity} ne '0' ) { Link Here
208
                "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
178
                "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
209
                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
179
                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
210
                "biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
180
                "biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
181
                "aqorders.branchcode"         => $$orderinfo{branchcode} ? $$orderinfo{branchcode} : "",
182
                "aqorders.quantity"           => $$orderinfo{quantity} ? $$orderinfo{quantity} : "",
183
                "aqorders.listprice"          => $$orderinfo{listprice} ? $$orderinfo{listprice} : "",
184
                "aqorders.uncertainprice"     => $$orderinfo{uncertainprice} ? $$orderinfo{uncertainprice} : "",
185
                "aqorders.rrp"                => $$orderinfo{rrp} ? $$orderinfo{rrp} : "",
186
                "aqorders.ecost"              => $$orderinfo{ecost} ? $$orderinfo{ecost} : "",
187
                "aqorders.discount"           => $$orderinfo{discount} ? $$orderinfo{discount} : "",
211
            });
188
            });
212
189
213
        # create the record in catalogue, with framework ''
190
        # create the record in catalogue, with framework ''
Lines 220-225 if ( $orderinfo->{quantity} ne '0' ) { Link Here
220
		$orderinfo->{biblionumber}=$biblionumber;
197
		$orderinfo->{biblionumber}=$biblionumber;
221
    }
198
    }
222
199
200
    $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
201
223
    # if we already have $ordernumber, then it's an ordermodif
202
    # if we already have $ordernumber, then it's an ordermodif
224
    if ($$orderinfo{ordernumber}) {
203
    if ($$orderinfo{ordernumber}) {
225
        ModOrder( $orderinfo);
204
        ModOrder( $orderinfo);
(-)a/acqui/addorderiso2709.pl (-5 / +10 lines)
Lines 205-211 if ($op eq ""){ Link Here
205
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
205
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
206
206
207
        if ($price){
207
        if ($price){
208
            $orderinfo{'listprice'} = $price;
209
            eval {
208
            eval {
210
		require C4::Acquisition;
209
		require C4::Acquisition;
211
		import C4::Acquisition qw/GetBasket/;
210
		import C4::Acquisition qw/GetBasket/;
Lines 222-234 if ($op eq ""){ Link Here
222
	    }
221
	    }
223
            my $basket     = GetBasket( $orderinfo{basketno} );
222
            my $basket     = GetBasket( $orderinfo{basketno} );
224
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
223
            my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
225
            my $gst        = $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
224
            $orderinfo{gstrate} = $bookseller->{gstrate};
226
            $orderinfo{'unitprice'} = $orderinfo{listprice} - ( $orderinfo{listprice} * ( $bookseller->{discount} / 100 ) );
225
            if ( $bookseller->{listincgst} ) {
227
            $orderinfo{'ecost'} = $orderinfo{unitprice};
226
                $orderinfo{ecost} = $price;
227
            } else {
228
                $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} );
229
            }
230
            $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} );
231
            $orderinfo{listprice} = $orderinfo{rrp};
232
            $orderinfo{unitprice} = $orderinfo{ecost};
233
            $orderinfo{total} = $orderinfo{ecost};
228
        } else {
234
        } else {
229
            $orderinfo{'listprice'} = 0;
235
            $orderinfo{'listprice'} = 0;
230
        }
236
        }
231
        $orderinfo{'rrp'} = $orderinfo{'listprice'};
232
237
233
        # remove uncertainprice flag if we have found a price in the MARC record
238
        # remove uncertainprice flag if we have found a price in the MARC record
234
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
239
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
(-)a/acqui/basket.pl (-117 / +123 lines)
Lines 238-358 if ( $op eq 'delete_confirm' ) { Link Here
238
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
238
      "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
239
      $basket->{creationdate}, $basket->{authorisedby};
239
      $basket->{creationdate}, $basket->{authorisedby};
240
240
241
	#to get active currency
241
    #to get active currency
242
	my $cur = GetCurrency();
242
    my $cur = GetCurrency();
243
243
244
244
245
    my @results = GetOrders( $basketno );
245
    my @results = GetOrders( $basketno );
246
    
247
	my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
248
	$gist = 0 if $gist == 0.0000;
249
	my $discount = $bookseller->{'discount'} / 100;
250
    my $total_rrp = 0;      # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'}
251
    my $total_rrp_gsti = 0; # RRP Total, GST included
252
    my $total_rrp_gste = 0; # RRP Total, GST excluded
253
    my $gist_rrp = 0;
254
    my $total_rrp_est = 0;
255
256
    my $qty_total;
257
    my @books_loop;
246
    my @books_loop;
258
    my $suggestion;
259
247
260
    for my $order ( @results ) {
248
    my @book_foot_loop;
261
        my $rrp = $order->{'listprice'} || 0;
249
    my %foot;
262
		my $qty = $order->{'quantity'} || 0;
250
    my $total_quantity = 0;
263
        if (!defined $order->{quantityreceived}) {
251
    my $total_gste = 0;
264
            $order->{quantityreceived} = 0;
252
    my $total_gsti = 0;
265
        }
253
    my $total_gstvalue = 0;
266
        for ( qw(rrp ecost quantityreceived)) {
254
    for my $order (@results) {
267
            if (!defined $order->{$_}) {
255
        my $line = get_order_infos( $order, $bookseller);
268
                $order->{$_} = 0;
256
        if ( $line->{uncertainprice} ) {
269
            }
270
        }
271
272
        my $budget = GetBudget(  $order->{'budget_id'} );
273
        $rrp = ConvertCurrency( $order->{'currency'}, $rrp );
274
275
        $total_rrp += $qty * $order->{'rrp'};
276
        my $line_total = $qty * $order->{'ecost'};
277
        $total_rrp_est += $qty * $order->{'ecost'};
278
		# FIXME: what about the "actual cost" field?
279
        $qty_total += $qty;
280
        my %line = %{ $order };
281
        my $biblionumber = $order->{'biblionumber'};
282
        my $countbiblio = CountBiblioInOrders($biblionumber);
283
        my $ordernumber = $order->{'ordernumber'};
284
        my @subscriptions = GetSubscriptionsId ($biblionumber);
285
        my $itemcount = GetItemsCount($biblionumber);
286
        my $holds  = GetHolds ($biblionumber);
287
        my @items = GetItemnumbersFromOrder( $ordernumber );
288
        my $itemholds;
289
        foreach my $item (@items){
290
            my $nb = GetItemHolds($biblionumber, $item);
291
            if ($nb){
292
                $itemholds += $nb;
293
            }
294
        }
295
        # 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
296
        $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
297
        $line{items}                = ($itemcount) - (scalar @items);
298
        $line{left_item}            = 1 if $line{items} >= 1;
299
        $line{left_biblio}          = 1 if $countbiblio > 1;
300
        $line{biblios}              = $countbiblio - 1;
301
        $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
302
        $line{subscriptions}        = scalar @subscriptions;
303
        ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
304
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
305
        $line{holds}                = $holds;
306
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
307
        $line{order_received}       = ( $qty == $order->{'quantityreceived'} );
308
        $line{basketno}             = $basketno;
309
        $line{budget_name}          = $budget->{budget_name};
310
        $line{rrp}                  = sprintf( "%.2f", $line{'rrp'} );
311
        $line{ecost}                = sprintf( "%.2f", $line{'ecost'} );
312
        $line{line_total}           = sprintf( "%.2f", $line_total );
313
        if ($line{uncertainprice}) {
314
            $template->param( uncertainprices => 1 );
257
            $template->param( uncertainprices => 1 );
315
            $line{rrp} .= ' (Uncertain)';
316
        }
258
        }
317
	if ($line{'title'}){
259
318
	    my $volume = $order->{'volume'};
260
        push @books_loop, $line;
319
	    my $seriestitle = $order->{'seriestitle'};
261
320
	    $line{'title'} .= " / $seriestitle" if $seriestitle;
262
        $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
321
	    $line{'title'} .= " / $volume" if $volume;
263
        $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
322
	} else {
264
        $total_gstvalue += $$line{gstvalue};
323
	    $line{'title'} = "Deleted bibliographic notice, can't find title.";
265
        $foot{$$line{gstgsti}}{quantity}  += $$line{quantity};
324
	}
266
        $total_quantity += $$line{quantity};
325
267
        $foot{$$line{gstgsti}}{totalgste} += $$line{totalgste};
326
        $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
268
        $total_gste += $$line{totalgste};
327
        $line{suggestionid}         = $suggestion->{suggestionid};
269
        $foot{$$line{gstgsti}}{totalgsti} += $$line{totalgsti};
328
        $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
270
        $total_gsti += $$line{totalgsti};
329
        $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
330
331
        push @books_loop, \%line;
332
    }
271
    }
333
272
334
my $total_est_gste;
273
    push @book_foot_loop, map {$_} values %foot;
335
    my $total_est_gsti;
274
336
    my $gist_est;
275
    # Get cancelled orders
337
    if ($gist){                                                    # if we have GST
276
    @results = GetCancelledOrders($basketno);
338
       if ( $bookseller->{'listincgst'} ) {                        # if prices already includes GST
277
    my @cancelledorders_loop;
339
           $total_rrp_gsti = $total_rrp;                           # we know $total_rrp_gsti
278
    for my $order (@results) {
340
           $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 );      # and can reverse compute other values
279
        my $line = get_order_infos( $order, $bookseller);
341
           $gist_rrp       = $total_rrp_gsti - $total_rrp_gste;    #
280
        push @cancelledorders_loop, $line;
342
           $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount );
281
    }
343
           $total_est_gsti = $total_rrp_est;
344
        } else {                                                    # if prices does not include GST
345
           $total_rrp_gste = $total_rrp;                           # then we use the common way to compute other values
346
           $gist_rrp       = $total_rrp_gste * $gist;              #
347
           $total_rrp_gsti = $total_rrp_gste + $gist_rrp;          #
348
           $total_est_gste = $total_rrp_est;
349
           $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount );
350
       }
351
       $gist_est = $gist_rrp - ( $gist_rrp * $discount );
352
    } else {
353
    $total_rrp_gsti = $total_rrp;
354
    $total_est_gsti = $total_rrp_est;
355
}
356
282
357
    my $contract = &GetContract($basket->{contractnumber});
283
    my $contract = &GetContract($basket->{contractnumber});
358
    my @orders = GetOrders($basketno);
284
    my @orders = GetOrders($basketno);
Lines 391-408 my $total_est_gste; Link Here
391
        booksellerid         => $bookseller->{'id'},
317
        booksellerid         => $bookseller->{'id'},
392
        name                 => $bookseller->{'name'},
318
        name                 => $bookseller->{'name'},
393
        books_loop           => \@books_loop,
319
        books_loop           => \@books_loop,
320
        book_foot_loop       => \@book_foot_loop,
394
        cancelledorders_loop => \@cancelledorders,
321
        cancelledorders_loop => \@cancelledorders,
395
        gist_rate            => sprintf( "%.2f", $gist * 100 ) . '%',
322
        total_quantity       => $total_quantity,
396
        total_rrp_gste       => sprintf( "%.2f", $total_rrp_gste ),
323
        total_gste           => sprintf( "%.2f", $total_gste ),
397
        total_est_gste       => sprintf( "%.2f", $total_est_gste ),
324
        total_gsti           => sprintf( "%.2f", $total_gsti ),
398
        gist_est             => sprintf( "%.2f", $gist_est ),
325
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
399
        gist_rrp             => sprintf( "%.2f", $gist_rrp ),        
326
        currency             => $cur->{'currency'},
400
        total_rrp_gsti       => sprintf( "%.2f", $total_rrp_gsti ),
327
        listincgst           => $bookseller->{listincgst},
401
        total_est_gsti       => sprintf( "%.2f", $total_est_gsti ),
402
#        currency             => $bookseller->{'listprice'},
403
	currency		=> $cur->{'currency'},
404
        qty_total            => $qty_total,
405
        GST                  => $gist,
406
        basketgroups         => $basketgroups,
328
        basketgroups         => $basketgroups,
407
        grouped              => $basket->{basketgroupid},
329
        grouped              => $basket->{basketgroupid},
408
        unclosable           => @orders ? 0 : 1, 
330
        unclosable           => @orders ? 0 : 1, 
Lines 410-413 my $total_est_gste; Link Here
410
    );
332
    );
411
}
333
}
412
334
335
sub get_order_infos {
336
    my $order = shift;
337
    my $bookseller = shift;
338
    my $qty = $order->{'quantity'} || 0;
339
    if ( !defined $order->{quantityreceived} ) {
340
        $order->{quantityreceived} = 0;
341
    }
342
    my $budget = GetBudget( $order->{'budget_id'} );
343
344
    my %line = %{ $order };
345
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
346
    $line{basketno}       = $basketno;
347
    $line{budget_name}    = $budget->{budget_name};
348
    $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
349
    if ( $bookseller->{'listincgst'} ) {
350
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
351
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
352
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
353
        $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
354
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
355
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
356
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
357
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
358
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
359
    } else {
360
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
361
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
362
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
363
        $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
364
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
365
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
366
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
367
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
368
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
369
    }
370
371
    if ( $line{uncertainprice} ) {
372
        $line{rrpgste} .= ' (Uncertain)';
373
    }
374
    if ( $line{'title'} ) {
375
        my $volume      = $order->{'volume'};
376
        my $seriestitle = $order->{'seriestitle'};
377
        $line{'title'} .= " / $seriestitle" if $seriestitle;
378
        $line{'title'} .= " / $volume"      if $volume;
379
    } else {
380
        $line{'title'} = "Deleted bibliographic notice, can't find title.";
381
    }
382
383
    my $biblionumber = $order->{'biblionumber'};
384
    my $countbiblio = CountBiblioInOrders($biblionumber);
385
    my $ordernumber = $order->{'ordernumber'};
386
    my @subscriptions = GetSubscriptionsId ($biblionumber);
387
    my $itemcount = GetItemsCount($biblionumber);
388
    my $holds  = GetHolds ($biblionumber);
389
    my @items = GetItemnumbersFromOrder( $ordernumber );
390
    my $itemholds;
391
    foreach my $item (@items){
392
        my $nb = GetItemHolds($biblionumber, $item);
393
        if ($nb){
394
            $itemholds += $nb;
395
        }
396
    }
397
    # 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
398
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
399
    $line{items}                = ($itemcount) - (scalar @items);
400
    $line{left_item}            = 1 if $line{items} >= 1;
401
    $line{left_biblio}          = 1 if $countbiblio > 1;
402
    $line{biblios}              = $countbiblio - 1;
403
    $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
404
    $line{subscriptions}        = scalar @subscriptions;
405
    ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
406
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
407
    $line{holds}                = $holds;
408
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
409
410
411
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
412
    $line{suggestionid}         = $$suggestion{suggestionid};
413
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
414
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
415
416
    return \%line;
417
}
418
413
output_html_with_http_headers $query, $cookie, $template->output;
419
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/acqui/finishreceive.pl (-21 / +52 lines)
Lines 28-33 use C4::Output; Link Here
28
use C4::Context;
28
use C4::Context;
29
use C4::Acquisition;
29
use C4::Acquisition;
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::Bookseller;
31
use C4::Items;
32
use C4::Items;
32
use C4::Search;
33
use C4::Search;
33
use List::MoreUtils qw/any/;
34
use List::MoreUtils qw/any/;
Lines 37-60 my $flagsrequired = {acquisition => 'order_receive'}; Link Here
37
38
38
checkauth($input, 0, $flagsrequired, 'intranet');
39
checkauth($input, 0, $flagsrequired, 'intranet');
39
40
40
my $user=$input->remote_user;
41
my $user             = $input->remote_user;
41
my $biblionumber = $input->param('biblionumber');
42
my $biblionumber     = $input->param('biblionumber');
42
my $biblioitemnumber=$input->param('biblioitemnumber');
43
my $biblioitemnumber = $input->param('biblioitemnumber');
43
my $ordernumber=$input->param('ordernumber');
44
my $ordernumber      = $input->param('ordernumber');
44
my $origquantityrec=$input->param('origquantityrec');
45
my $origquantityrec  = $input->param('origquantityrec');
45
my $quantityrec=$input->param('quantityrec');
46
my $quantityrec      = $input->param('quantityrec');
46
my $quantity=$input->param('quantity');
47
my $quantity         = $input->param('quantity');
47
my $unitprice=$input->param('cost');
48
my $unitprice        = $input->param('cost');
48
my $invoiceid = $input->param('invoiceid');
49
my $invoiceid        = $input->param('invoiceid');
49
my $invoice = GetInvoice($invoiceid);
50
my $invoice          = GetInvoice($invoiceid);
50
my $invoiceno = $invoice->{invoicenumber};
51
my $invoiceno        = $invoice->{invoicenumber};
51
my $datereceived= $invoice->{shipmentdate};
52
my $datereceived     = $invoice->{shipmentdate};
52
my $replacement=$input->param('rrp');
53
my $booksellerid     = $input->param('booksellerid');
53
my $gst=$input->param('gst');
54
my $cnt              = 0;
54
my $booksellerid = $input->param('booksellerid');
55
my $error_url_str;
55
my $cnt=0;
56
my $ecost            = $input->param('ecost');
56
my $ecost = $input->param('ecost');
57
my $rrp              = $input->param('rrp');
57
my $note = $input->param("note");
58
my $note             = $input->param("note");
59
my $order            = GetOrder($ordernumber);
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 63-74 if ($quantityrec > $origquantityrec ) { Link Here
63
        @received_items = $input->param('items_to_receive');
65
        @received_items = $input->param('items_to_receive');
64
    }
66
    }
65
67
68
    $order->{rrp} = $rrp;
69
    $order->{ecost} = $ecost;
70
    $order->{unitprice} = $unitprice;
71
    my $bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid);
72
    if ( $bookseller->{listincgst} ) {
73
        if ( not $bookseller->{invoiceincgst} ) {
74
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} );
75
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} );
76
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} );
77
        }
78
    } else {
79
        if ( $bookseller->{invoiceincgst} ) {
80
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} );
81
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} );
82
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} );
83
        }
84
    }
85
66
    my $new_ordernumber = $ordernumber;
86
    my $new_ordernumber = $ordernumber;
67
    # save the quantity received.
87
    # save the quantity received.
68
    if ( $quantityrec > 0 ) {
88
    if ( $quantityrec > 0 ) {
69
        ($datereceived, $new_ordernumber) = ModReceiveOrder(
89
        ($datereceived, $new_ordernumber) = ModReceiveOrder(
70
            $biblionumber, $ordernumber, $quantityrec, $user, $unitprice,
90
            $biblionumber,
71
            $invoiceid, $replacement, undef, $datereceived, \@received_items);
91
            $ordernumber,
92
            $quantityrec,
93
            $user,
94
            $order->{unitprice},
95
            $order->{ecost},
96
            $invoiceno,
97
            $order->{rrp},
98
            undef,
99
            $datereceived,
100
            \@received_items,
101
        );
72
    }
102
    }
73
103
74
    # now, add items if applicable
104
    # now, add items if applicable
Lines 107-112 if ($quantityrec > $origquantityrec ) { Link Here
107
            NewOrderItem($itemnumber, $new_ordernumber);
137
            NewOrderItem($itemnumber, $new_ordernumber);
108
        }
138
        }
109
    }
139
    }
140
110
}
141
}
111
142
112
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
143
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
Lines 122-128 sub update_item { Link Here
122
        booksellerid         => $booksellerid,
153
        booksellerid         => $booksellerid,
123
        dateaccessioned      => $datereceived,
154
        dateaccessioned      => $datereceived,
124
        price                => $unitprice,
155
        price                => $unitprice,
125
        replacementprice     => $replacement,
156
        replacementprice     => $rrp,
126
        replacementpricedate => $datereceived,
157
        replacementpricedate => $datereceived,
127
    }, $biblionumber, $itemnumber );
158
    }, $biblionumber, $itemnumber );
128
}
159
}
(-)a/acqui/neworderempty.pl (-15 / +23 lines)
Lines 331-336 $template->param( Link Here
331
    budget_name  => $budget_name
331
    budget_name  => $budget_name
332
) if ($close);
332
) if ($close);
333
333
334
# get option values for gist syspref
335
my @gst_values = map {
336
    option => $_
337
}, split( '\|', C4::Context->preference("gist") );
338
339
my $cur = GetCurrency();
340
334
$template->param(
341
$template->param(
335
    existing         => $biblionumber,
342
    existing         => $biblionumber,
336
    ordernumber           => $ordernumber,
343
    ordernumber           => $ordernumber,
Lines 350-367 $template->param( Link Here
350
    suggestionid         => $suggestion->{suggestionid},
357
    suggestionid         => $suggestion->{suggestionid},
351
    surnamesuggestedby   => $suggestion->{surnamesuggestedby},
358
    surnamesuggestedby   => $suggestion->{surnamesuggestedby},
352
    firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
359
    firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
353
    biblionumber     => $biblionumber,
360
    biblionumber         => $biblionumber,
354
    uncertainprice   => $data->{'uncertainprice'},
361
    uncertainprice       => $data->{'uncertainprice'},
355
    authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'},
362
    authorisedbyname     => $borrower->{'firstname'} . " " . $borrower->{'surname'},
356
    biblioitemnumber => $data->{'biblioitemnumber'},
363
    biblioitemnumber     => $data->{'biblioitemnumber'},
357
    discount_2dp     => sprintf( "%.2f",  $bookseller->{'discount'}) ,   # for display
364
    discount_2dp         => sprintf( "%.2f",  $bookseller->{'discount'} ) ,   # for display
358
    discount         => $bookseller->{'discount'},
365
    discount             => $bookseller->{'discount'},
366
    orderdiscount_2dp    => sprintf( "%.2f", $data->{'discount'} || 0 ),
367
    orderdiscount        => $data->{'discount'},
359
    listincgst       => $bookseller->{'listincgst'},
368
    listincgst       => $bookseller->{'listincgst'},
360
    invoiceincgst    => $bookseller->{'invoiceincgst'},
369
    invoiceincgst    => $bookseller->{'invoiceincgst'},
361
    name             => $bookseller->{'name'},
370
    name             => $bookseller->{'name'},
362
    cur_active_sym   => $active_currency->{'symbol'},
371
    cur_active_sym   => $active_currency->{'symbol'},
363
    cur_active       => $active_currency->{'currency'},
372
    cur_active       => $active_currency->{'currency'},
364
    loop_currencies  => \@loop_currency,
373
    loop_currencies  => \@loop_currency,
374
    currency_rate    => $cur->{rate},
365
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
375
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
366
    title            => $data->{'title'},
376
    title            => $data->{'title'},
367
    author           => $data->{'author'},
377
    author           => $data->{'author'},
Lines 375-393 $template->param( Link Here
375
    quantity         => $data->{'quantity'},
385
    quantity         => $data->{'quantity'},
376
    quantityrec      => $data->{'quantity'},
386
    quantityrec      => $data->{'quantity'},
377
    rrp              => $data->{'rrp'},
387
    rrp              => $data->{'rrp'},
378
    listprice        => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
388
    gst_values       => \@gst_values,
379
    total            => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
389
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
380
    ecost            => $data->{'ecost'},
390
    gstreg           => $bookseller->{'gstreg'},
381
    unitprice        => sprintf("%.2f", $data->{'unitprice'}||0),
391
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
392
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
393
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
394
    unitprice        => sprintf( "%.2f", $data->{unitprice} || 0),
382
    notes            => $data->{'notes'},
395
    notes            => $data->{'notes'},
383
    publishercode    => $data->{'publishercode'},
396
    publishercode    => $data->{'publishercode'},
384
    barcode_subfield => $barcode_subfield,
397
    barcode_subfield => $barcode_subfield,
385
    
386
    import_batch_id  => $import_batch_id,
398
    import_batch_id  => $import_batch_id,
387
388
# CHECKME: gst-stuff needs verifing, mason.
389
    gstrate          => $bookseller->{'gstrate'} // C4::Context->preference("gist") // 0,
390
    gstreg           => $bookseller->{'gstreg'},
391
    (uc(C4::Context->preference("marcflavour"))) => 1
399
    (uc(C4::Context->preference("marcflavour"))) => 1
392
);
400
);
393
401
(-)a/acqui/orderreceive.pl (-13 / +36 lines)
Lines 93-99 my $search = $input->param('receive'); Link Here
93
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
93
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
94
94
95
my $bookseller = GetBookSellerFromId($booksellerid);
95
my $bookseller = GetBookSellerFromId($booksellerid);
96
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
97
my $results = SearchOrder($ordernumber,$search);
96
my $results = SearchOrder($ordernumber,$search);
98
97
99
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
98
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 158-173 if ( $count == 1 ) { Link Here
158
        $template->param(items => \@items);
157
        $template->param(items => \@items);
159
    }
158
    }
160
159
161
    if ( $order->{'unitprice'} == 0 ) {
160
    $order->{quantityreceived} = '' if $order->{quantityreceived} == 0;
162
        $order->{'unitprice'} = '';
161
    $order->{unitprice} = '' if $order->{unitprice} == 0;
163
    }
162
163
    my $rrp;
164
    my $ecost;
165
    my $unitprice;
166
    if ( $bookseller->{listincgst} ) {
167
        if ( $bookseller->{invoiceincgst} ) {
168
            $rrp = $order->{rrp};
169
            $ecost = $order->{ecost};
170
            $unitprice = $order->{unitprice};
171
        } else {
172
            $rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
173
            $ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
174
            $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
175
        }
176
    } else {
177
        if ( $bookseller->{invoiceincgst} ) {
178
            $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
179
            $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
180
            $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
181
        } else {
182
            $rrp = $order->{rrp};
183
            $ecost = $order->{ecost};
184
            $unitprice = $order->{unitprice};
185
        }
186
     }
164
187
165
    my $suggestion   = GetSuggestionInfoFromBiblionumber($order->{'biblionumber'});
188
    my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
166
189
167
    my $authorisedby = $order->{'authorisedby'};
190
    my $authorisedby = $order->{authorisedby};
168
    my $member = GetMember( borrowernumber => $authorisedby );
191
    my $member = GetMember( borrowernumber => $authorisedby );
169
192
170
    my $budget = GetBudget( $order->{'budget_id'} );
193
    my $budget = GetBudget( $order->{budget_id} );
171
194
172
    $template->param(
195
    $template->param(
173
        AcqCreateItem         => $AcqCreateItem,
196
        AcqCreateItem         => $AcqCreateItem,
Lines 177-183 if ( $count == 1 ) { Link Here
177
        biblioitemnumber      => $order->{'biblioitemnumber'},
200
        biblioitemnumber      => $order->{'biblioitemnumber'},
178
        booksellerid          => $order->{'booksellerid'},
201
        booksellerid          => $order->{'booksellerid'},
179
        freight               => $freight,
202
        freight               => $freight,
180
        gst                   => $gst,
203
        gstrate               => $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0,
181
        name                  => $bookseller->{'name'},
204
        name                  => $bookseller->{'name'},
182
        date                  => format_date($order->{entrydate}),
205
        date                  => format_date($order->{entrydate}),
183
        title                 => $order->{'title'},
206
        title                 => $order->{'title'},
Lines 189-197 if ( $count == 1 ) { Link Here
189
        quantity              => $order->{'quantity'},
212
        quantity              => $order->{'quantity'},
190
        quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
213
        quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
191
        quantityreceived      => $order->{'quantityreceived'},
214
        quantityreceived      => $order->{'quantityreceived'},
192
        rrp                   => $order->{'rrp'},
215
        rrp                   => sprintf( "%.2f", $rrp ),
193
        ecost                 => sprintf( "%.2f",$order->{'ecost'}),
216
        ecost                 => sprintf( "%.2f", $ecost ),
194
        unitprice             => sprintf( "%.2f",$order->{'unitprice'}),
217
        unitprice             => sprintf( "%.2f", $unitprice),
195
        memberfirstname       => $member->{firstname} || "",
218
        memberfirstname       => $member->{firstname} || "",
196
        membersurname         => $member->{surname} || "",
219
        membersurname         => $member->{surname} || "",
197
        invoiceid             => $invoice->{invoiceid},
220
        invoiceid             => $invoice->{invoiceid},
Lines 212-221 else { Link Here
212
        $line{invoice}      = $invoice->{invoicenumber};
235
        $line{invoice}      = $invoice->{invoicenumber};
213
        $line{datereceived} = $datereceived->output();
236
        $line{datereceived} = $datereceived->output();
214
        $line{freight}      = $freight;
237
        $line{freight}      = $freight;
215
        $line{gst}          = $gst;
238
        $line{gstrate}      = @$results[$i]->{'gstrate'} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
216
        $line{title}        = @$results[$i]->{'title'};
239
        $line{title}        = @$results[$i]->{'title'};
217
        $line{author}       = @$results[$i]->{'author'};
240
        $line{author}       = @$results[$i]->{'author'};
218
        $line{booksellerid}   = $booksellerid;
241
        $line{booksellerid} = $booksellerid;
219
        push @loop, \%line;
242
        push @loop, \%line;
220
    }
243
    }
221
244
(-)a/acqui/parcel.pl (-39 / +83 lines)
Lines 71-76 use JSON; Link Here
71
71
72
my $input=new CGI;
72
my $input=new CGI;
73
73
74
sub get_value_with_gst_params {
75
    my $value = shift;
76
    my $gstrate = shift;
77
    my $bookseller = shift;
78
    if ( $bookseller->{listincgst} ) {
79
        if ( $bookseller->{invoiceincgst} ) {
80
            return $value;
81
        } else {
82
            return $value / ( 1 + $gstrate );
83
        }
84
    } else {
85
        if ( $bookseller->{invoiceincgst} ) {
86
            return $value * ( 1 + $gstrate );
87
        } else {
88
            return $value;
89
        }
90
    }
91
}
92
93
sub get_gste {
94
    my $value = shift;
95
    my $gstrate = shift;
96
    my $bookseller = shift;
97
    return $bookseller->{invoiceincgst}
98
        ? $value / ( 1 + $gstrate )
99
        : $value;
100
}
101
102
sub get_gst {
103
    my $value = shift;
104
    my $gstrate = shift;
105
    my $bookseller = shift;
106
    return $bookseller->{invoiceincgst}
107
        ? $value / ( 1 + $gstrate ) * $gstrate
108
        : $value * ( 1 + $gstrate ) - $value;
109
}
110
74
my ($template, $loggedinuser, $cookie)
111
my ($template, $loggedinuser, $cookie)
75
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
112
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
76
                 query => $input,
113
                 query => $input,
Lines 125-145 my $countlines = scalar @parcelitems; Link Here
125
my $totalprice    = 0;
162
my $totalprice    = 0;
126
my $totalquantity = 0;
163
my $totalquantity = 0;
127
my $total;
164
my $total;
128
my $tototal;
129
my @loop_received = ();
165
my @loop_received = ();
130
166
my @book_foot_loop;
131
for (my $i = 0 ; $i < $countlines ; $i++) {
167
my %foot;
132
168
my $total_quantity = 0;
133
    $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'};
169
my $total_gste = 0;
134
    $parcelitems[$i]->{'unitprice'} += 0;
170
my $total_gsti = 0;
171
172
for my $item ( @parcelitems ) {
173
    $item->{unitprice} = get_value_with_gst_params( $item->{unitprice}, $item->{gstrate}, $bookseller );
174
    $total = ( $item->{'unitprice'} ) * $item->{'quantityreceived'};
175
    $item->{'unitprice'} += 0;
135
    my %line;
176
    my %line;
136
    %line          = %{ $parcelitems[$i] };
177
    %line          = %{ $item };
178
    my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
179
    $line{ecost} = sprintf( "%.2f", $ecost );
137
    $line{invoice} = $invoice->{invoicenumber};
180
    $line{invoice} = $invoice->{invoicenumber};
138
    $line{gst}     = $gst;
139
    $line{total} = sprintf($cfstr, $total);
181
    $line{total} = sprintf($cfstr, $total);
140
    $line{booksellerid} = $invoice->{booksellerid};
182
    $line{booksellerid} = $invoice->{booksellerid};
141
    $totalprice += $parcelitems[$i]->{'unitprice'};
183
    $totalprice += $item->{'unitprice'};
142
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
184
    $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
185
    my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
186
    my $gst = get_gst( $line{total}, $line{gstrate}, $bookseller );
187
    $foot{$line{gstrate}}{gstrate} = $line{gstrate};
188
    $foot{$line{gstrate}}{value} += sprintf( "%.2f", $gst );
189
    $total_quantity += $line{quantity};
190
    $total_gste += $gste;
191
    $total_gsti += $gste + $gst;
143
192
144
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
193
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
145
    $line{suggestionid}         = $suggestion->{suggestionid};
194
    $line{suggestionid}         = $suggestion->{suggestionid};
Lines 154-164 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
154
        }
203
        }
155
    }
204
    }
156
205
206
    my $budget = GetBudget( $line{budget_id} );
207
    $line{budget_name} = $budget->{'budget_name'};
208
157
    push @loop_received, \%line;
209
    push @loop_received, \%line;
158
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
210
    $totalquantity += $item->{'quantityreceived'};
159
    $tototal       += $total;
211
160
}
212
}
213
push @book_foot_loop, map { $_ } values %foot;
161
214
215
my @loop_orders = ();
162
if(!defined $invoice->{closedate}) {
216
if(!defined $invoice->{closedate}) {
163
    my $pendingorders;
217
    my $pendingorders;
164
    if($input->param('op') eq "search"){
218
    if($input->param('op') eq "search"){
Lines 174-202 if(!defined $invoice->{closedate}) { Link Here
174
    }
228
    }
175
    my $countpendings = scalar @$pendingorders;
229
    my $countpendings = scalar @$pendingorders;
176
230
177
    # pending orders totals
178
    my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd);
179
    my $ordergrandtotal;
180
    my @loop_orders = ();
181
    for (my $i = 0 ; $i < $countpendings ; $i++) {
231
    for (my $i = 0 ; $i < $countpendings ; $i++) {
182
        my %line;
232
        my %line;
183
        %line = %{$pendingorders->[$i]};
233
        %line = %{$pendingorders->[$i]};
184
234
185
        $line{quantity}+=0;
235
        my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
186
        $line{quantityreceived}+=0;
236
        $line{unitprice} = get_value_with_gst_params( $line{unitprice}, $line{gstrate}, $bookseller );
237
        $line{quantity} += 0;
238
        $line{quantityreceived} += 0;
187
        $line{unitprice}+=0;
239
        $line{unitprice}+=0;
188
        $totalPunitprice += $line{unitprice};
240
        $line{ecost} = sprintf( "%.2f", $ecost );
189
        $totalPquantity +=$line{quantity};
241
        $line{ordertotal} = sprintf( "%.2f", $ecost * $line{quantity} );
190
        $totalPqtyrcvd +=$line{quantityreceived};
191
        $totalPecost += $line{ecost};
192
        $line{ecost} = sprintf("%.2f",$line{ecost});
193
        $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
194
        $line{unitprice} = sprintf("%.2f",$line{unitprice});
242
        $line{unitprice} = sprintf("%.2f",$line{unitprice});
195
        $line{invoice} = $invoice;
243
        $line{invoice} = $invoice;
196
        $line{gst} = $gst;
197
        $line{total} = $total;
198
        $line{booksellerid} = $booksellerid;
244
        $line{booksellerid} = $booksellerid;
199
        $ordergrandtotal += $line{ecost} * $line{quantity};
245
246
200
247
201
        my $biblionumber = $line{'biblionumber'};
248
        my $biblionumber = $line{'biblionumber'};
202
        my $countbiblio = CountBiblioInOrders($biblionumber);
249
        my $countbiblio = CountBiblioInOrders($biblionumber);
Lines 231-236 if(!defined $invoice->{closedate}) { Link Here
231
        $line{holds}                = $holds;
278
        $line{holds}                = $holds;
232
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
279
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
233
280
281
        my $budget = GetBudget( $line{budget_id} );
282
        $line{budget_name} = $budget->{'budget_name'};
234
283
235
        push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
284
        push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
236
    }
285
    }
Lines 269-285 if(!defined $invoice->{closedate}) { Link Here
269
    }
318
    }
270
319
271
    $template->param(
320
    $template->param(
272
        countpending => $countpendings,
273
        loop_orders  => \@loop_orders,
321
        loop_orders  => \@loop_orders,
274
        ordergrandtotal => sprintf($cfstr, $ordergrandtotal),
275
        totalPunitprice => sprintf("%.2f", $totalPunitprice),
276
        totalPquantity  => $totalPquantity,
277
        totalPqtyrcvd   => $totalPqtyrcvd,
278
        totalPecost     => sprintf("%.2f", $totalPecost),
279
    );
322
    );
280
}
323
}
281
324
282
283
$template->param(
325
$template->param(
284
    invoiceid             => $invoice->{invoiceid},
326
    invoiceid             => $invoice->{invoiceid},
285
    invoice               => $invoice->{invoicenumber},
327
    invoice               => $invoice->{invoicenumber},
Lines 289-303 $template->param( Link Here
289
    formatteddatereceived => $datereceived->output(),
331
    formatteddatereceived => $datereceived->output(),
290
    name                  => $bookseller->{'name'},
332
    name                  => $bookseller->{'name'},
291
    booksellerid          => $bookseller->{id},
333
    booksellerid          => $bookseller->{id},
292
    gst                   => $gst,
293
    countreceived         => $countlines,
334
    countreceived         => $countlines,
294
    loop_received         => \@loop_received,
335
    loop_received         => \@loop_received,
336
    booksellerid          => $booksellerid,
337
    loop_orders           => \@loop_orders,
338
    book_foot_loop        => \@book_foot_loop,
295
    totalprice            => sprintf($cfstr, $totalprice),
339
    totalprice            => sprintf($cfstr, $totalprice),
296
    totalquantity         => $totalquantity,
340
    totalquantity         => $totalquantity,
297
    tototal               => sprintf($cfstr, $tototal),
298
    gst                   => $gst,
299
    grandtot              => sprintf($cfstr, $tototal + $gst),
300
    resultsperpage        => $resultsperpage,
341
    resultsperpage        => $resultsperpage,
301
    (uc(C4::Context->preference("marcflavour"))) => 1
342
    (uc(C4::Context->preference("marcflavour"))) => 1,
343
    total_quantity       => $total_quantity,
344
    total_gste           => sprintf( "%.2f", $total_gste ),
345
    total_gsti           => sprintf( "%.2f", $total_gsti ),
302
);
346
);
303
output_html_with_http_headers $input, $cookie, $template->output;
347
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/supplier.pl (-12 / +7 lines)
Lines 67-78 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
67
        debug           => 1,
67
        debug           => 1,
68
    }
68
    }
69
);
69
);
70
my $seller_gstrate = $supplier->{'gstrate'};
71
70
72
# ensure the scalar isn't flagged as a string
73
$seller_gstrate = ( defined $seller_gstrate ) ? $seller_gstrate + 0 : undef;
74
my $tax_rate = $seller_gstrate // C4::Context->preference('gist') // 0;
75
$tax_rate *= 100;
76
#build array for currencies
71
#build array for currencies
77
if ( $op eq 'display' ) {
72
if ( $op eq 'display' ) {
78
73
Lines 102-113 if ( $op eq 'display' ) { Link Here
102
        gstreg        => $supplier->{'gstreg'},
97
        gstreg        => $supplier->{'gstreg'},
103
        listincgst    => $supplier->{'listincgst'},
98
        listincgst    => $supplier->{'listincgst'},
104
        invoiceincgst => $supplier->{'invoiceincgst'},
99
        invoiceincgst => $supplier->{'invoiceincgst'},
100
        gstrate       => $supplier->{'gstrate'} + 0.0,
105
        discount      => $supplier->{'discount'},
101
        discount      => $supplier->{'discount'},
106
        deliverytime  => $supplier->{deliverytime},
102
        deliverytime  => $supplier->{deliverytime},
107
        invoiceprice  => $supplier->{'invoiceprice'},
103
        invoiceprice  => $supplier->{'invoiceprice'},
108
        listprice     => $supplier->{'listprice'},
104
        listprice     => $supplier->{'listprice'},
109
        GST           => $tax_rate,
110
        default_tax   => defined($seller_gstrate),
111
        basketcount   => $supplier->{'basketcount'},
105
        basketcount   => $supplier->{'basketcount'},
112
        subscriptioncount   => $supplier->{'subscriptioncount'},
106
        subscriptioncount   => $supplier->{'subscriptioncount'},
113
        contracts     => $contracts,
107
        contracts     => $contracts,
Lines 142-150 if ( $op eq 'display' ) { Link Here
142
            };
136
            };
143
    }
137
    }
144
138
145
    my $default_gst_rate = (C4::Context->preference('gist') * 100) || '0.0';
139
    # get option values from gist syspref
140
    my @gst_values = map {
141
        option => $_
142
    }, split( '\|', C4::Context->preference("gist") );
146
143
147
    my $gstrate = defined $supplier->{gstrate} ? $supplier->{gstrate} * 100 : '';
148
    $template->param(
144
    $template->param(
149
        booksellerid => $booksellerid,
145
        booksellerid => $booksellerid,
150
        name         => $supplier->{'name'},
146
        name         => $supplier->{'name'},
Lines 170-182 if ( $op eq 'display' ) { Link Here
170
        gstreg        => $supplier->{'gstreg'},
166
        gstreg        => $supplier->{'gstreg'},
171
        listincgst    => $supplier->{'listincgst'},
167
        listincgst    => $supplier->{'listincgst'},
172
        invoiceincgst => $supplier->{'invoiceincgst'},
168
        invoiceincgst => $supplier->{'invoiceincgst'},
173
        gstrate       => $gstrate,
169
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
170
        gst_values    => \@gst_values,
174
        discount      => $supplier->{'discount'},
171
        discount      => $supplier->{'discount'},
175
        deliverytime  => $supplier->{deliverytime},
172
        deliverytime  => $supplier->{deliverytime},
176
        loop_currency => $loop_currency,
173
        loop_currency => $loop_currency,
177
        GST           => $tax_rate,
178
        enter         => 1,
174
        enter         => 1,
179
        default_gst_rate => $default_gst_rate,
180
    );
175
    );
181
}
176
}
182
177
(-)a/acqui/updatesupplier.pl (-7 / +2 lines)
Lines 100-112 $data{'gstreg'}=$input->param('gst'); Link Here
100
$data{'listincgst'}=$input->param('list_gst');
100
$data{'listincgst'}=$input->param('list_gst');
101
$data{'invoiceincgst'}=$input->param('invoice_gst');
101
$data{'invoiceincgst'}=$input->param('invoice_gst');
102
#have to transform this into fraction so it's easier to use
102
#have to transform this into fraction so it's easier to use
103
my $gstrate = $input->param('gstrate');
103
$data{'gstrate'} = $input->param('gstrate');
104
if ($gstrate eq '') {
104
$data{'discount'} = $input->param('discount');
105
    $data{'gstrate'} = undef;
106
} else {
107
    $data{'gstrate'} = $input->param('gstrate')/100;
108
}
109
$data{'discount'}=$input->param('discount');
110
$data{deliverytime} = $input->param('deliverytime');
105
$data{deliverytime} = $input->param('deliverytime');
111
$data{'active'}=$input->param('status');
106
$data{'active'}=$input->param('status');
112
if($data{'name'}) {
107
if($data{'name'}) {
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2769-2775 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2769
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
2769
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
2770
  `rrp` decimal(13,2) default NULL, -- the replacement cost for this line item
2770
  `rrp` decimal(13,2) default NULL, -- the replacement cost for this line item
2771
  `ecost` decimal(13,2) default NULL, -- the estimated cost for this line item
2771
  `ecost` decimal(13,2) default NULL, -- the estimated cost for this line item
2772
  `gst` decimal(13,2) default NULL, -- the tax rate for this line item
2772
  `gstrate` decimal(6,4) default NULL, -- the tax rate for this line item
2773
  `discount` float(6,4) default NULL, -- the discount for this line item
2773
  `budget_id` int(11) NOT NULL, -- the fund this order goes against (aqbudgets.budget_id)
2774
  `budget_id` int(11) NOT NULL, -- the fund this order goes against (aqbudgets.budget_id)
2774
  `budgetgroup_id` int(11) NOT NULL, -- not used? always zero
2775
  `budgetgroup_id` int(11) NOT NULL, -- not used? always zero
2775
  `budgetdate` date default NULL, -- not used? always NULL
2776
  `budgetdate` date default NULL, -- not used? always NULL
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +14 lines)
Lines 5617-5623 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5617
5617
5618
    $dbh->do("UPDATE systempreferences SET options = concat(options,'|EAN13'), explanation = concat(explanation,'; EAN13 - incremental') WHERE variable = 'autoBarcode' AND options NOT LIKE '%EAN13%'");
5618
    $dbh->do("UPDATE systempreferences SET options = concat(options,'|EAN13'), explanation = concat(explanation,'; EAN13 - incremental') WHERE variable = 'autoBarcode' AND options NOT LIKE '%EAN13%'");
5619
    print "Upgrade to $DBversion done ( Added EAN13 barcode autogeneration sequence )\n";
5619
    print "Upgrade to $DBversion done ( Added EAN13 barcode autogeneration sequence )\n";
5620
5621
    SetVersion($DBversion);
5620
    SetVersion($DBversion);
5622
}
5621
}
5623
5622
Lines 5928-5933 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5928
}
5927
}
5929
5928
5930
5929
5930
$DBversion = "3.09.00.XXX";
5931
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5932
    $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4)  DEFAULT NULL");
5933
    print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
5934
    SetVersion($DBversion);
5935
}
5936
5937
$DBversion = "3.09.00.XXX";
5938
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5939
    $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
5940
    print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
5941
    SetVersion($DBversion);
5942
}
5943
5931
=head1 FUNCTIONS
5944
=head1 FUNCTIONS
5932
5945
5933
=head2 TableExists($table)
5946
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-39 / +15 lines)
Lines 639-687 function messenger(X,Y,etc){ // FIXME: unused? Link Here
639
639
640
//  NEXT BLOCK IS USED BY NEWORDERBEMPTY
640
//  NEXT BLOCK IS USED BY NEWORDERBEMPTY
641
641
642
function calcNeworderTotal(){
642
function updateCosts(){
643
    //collect values
643
    var quantity = new Number($("#quantity").val());
644
    var f        = document.getElementById('Aform');
644
    var discount = new Number($("#discount").val());
645
    var quantity = new Number(f.quantity.value);
645
    var applygst = new Number ($("#applygst").val());
646
    var discount = new Number(f.discount.value);
646
    var listprice   =  new Number($("#listprice").val());
647
    var listinc  = new Number (f.listinc.value);
647
    var exchangerate =  new Number($("#currency_rate").val());
648
    //var currency = f.currency.value;
648
    var gst_on=false;
649
    var applygst = new Number (f.applygst.value);
649
650
    var listprice   =  new Number(f.listprice.value);
651
    var invoiceingst =  new Number (f.invoiceincgst.value);
652
//    var exchangerate =  new Number(f.elements[currency].value);      //get exchange rate
653
        var currcode = new String(document.getElementById('currency').value);
654
	var exchangerate =  new Number(document.getElementById(currcode).value);
655
656
    var gst_on=(!listinc && invoiceingst);
657
658
    //do real stuff
659
    var rrp   = new Number(listprice*exchangerate);
650
    var rrp   = new Number(listprice*exchangerate);
660
    var ecost = rrp;
651
    var ecost = rrp;
661
    if (100-discount != 100) { //Prevent rounding issues if no discount
652
    if ( 100-discount != 100 ) { //Prevent rounding issues if no discount
662
        ecost = new Number(Math.floor(rrp * (100 - discount ))/100);
653
        ecost = new Number(Math.floor(rrp * (100 - discount )) / 100);
663
    }
654
    }
664
    var GST   = new Number(0);
655
    var total =  new Number( ecost * quantity);
665
    if (gst_on) {
656
    $("#rrp").val(rrp.toFixed(2));
666
            rrp=rrp * (1+f.gstrate.value / 100);
657
    $("#ecost").val(ecost.toFixed(2));
667
        GST=ecost * f.gstrate.value / 100;
658
    $("#total").val(total.toFixed(2));
668
    }
659
    $("listprice").val(listprice.toFixed(2));
669
670
    var total =  new Number( (ecost + GST) * quantity);
671
660
672
    f.rrp.value = rrp.toFixed(2);
673
674
//	f.rrp.value = rrp
675
//	f.rrp.value = 'moo'
676
677
    f.ecost.value = ecost.toFixed(2);
678
    f.total.value = total.toFixed(2);
679
    f.listprice.value =  listprice.toFixed(2);
680
681
//  gst-stuff needs verifing, mason.
682
    if (f.GST) {
683
        f.GST.value=GST;
684
    }
685
    return true;
661
    return true;
686
}
662
}
687
663
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-1 / +1 lines)
Lines 163-169 Link Here
163
                            [% ELSE %]
163
                            [% ELSE %]
164
                            <li>
164
                            <li>
165
                            <label for="currency">Currency:</label>
165
                            <label for="currency">Currency:</label>
166
                            <select name="currency" id="currency" onchange="calcNeworderTotal();">
166
                            <select name="currency" id="currency">
167
                            [% FOREACH loop_currencie IN loop_currencies %]
167
                            [% FOREACH loop_currencie IN loop_currencies %]
168
                                    [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
168
                                    [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
169
                            </select>
169
                            </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-48 / +93 lines)
Lines 6-11 Link Here
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7
[% INCLUDE 'datatables-strings.inc' %]
7
[% INCLUDE 'datatables-strings.inc' %]
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9
10
<script type="text/javascript">
11
//<![CDATA[
12
    function updateColumnsVisibility(visible) {
13
        if ( visible ) {
14
            $("table .gste, .gsti").show();
15
        } else {
16
            [% IF ( listincgst ) %]
17
                $("table .gste").hide();
18
            [% ELSE %]
19
                $("table .gsti").hide();
20
            [% END %]
21
        }
22
    }
23
24
    $(document).ready(function() {
25
        $("#show_all_details").click(function(){
26
            updateColumnsVisibility($(this+":checked").val());
27
        });
28
29
        $("#show_all_details").attr('checked', false);
30
        updateColumnsVisibility(false);
31
    });
32
//]]>
33
</script>
34
9
[% UNLESS ( closedate ) %]
35
[% UNLESS ( closedate ) %]
10
<script type="text/javascript">
36
<script type="text/javascript">
11
//<![CDATA[
37
//<![CDATA[
Lines 229-244 Link Here
229
255
230
        [% UNLESS ( delete_confirm ) %]
256
        [% UNLESS ( delete_confirm ) %]
231
        <div id="acqui_basket_content" class="yui-g">
257
        <div id="acqui_basket_content" class="yui-g">
258
        <label for="show_all_details">
259
            <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
260
            Show all details
261
        </label>
232
        <h2>Order Details</h2>
262
        <h2>Order Details</h2>
233
        [% IF ( books_loop ) %]
263
        [% IF ( books_loop ) %]
234
            <table id="orders">
264
            <table id="orders">
235
                <thead>
265
                <thead>
236
                    <tr>
266
                    <tr>
237
                        <th>Order</th>
267
                        <th>Order</th>
238
                        <th>RRP</th>
268
                        <th class="gste">RRP tax exc.</th>
239
                        <th>Est.</th>
269
                        <th class="gste">ecost tax exc.</th>
270
                        <th class="gsti">RRP tax inc.</th>
271
                        <th class="gsti">ecost tax inc.</th>
240
                        <th>Qty.</th>
272
                        <th>Qty.</th>
241
                        <th>Total</th>
273
                        <th class="gste">Total tax exc. ([% currency %])</th>
274
                        <th class="gsti">Total tax inc. ([% currency %])</th>
275
                        <th>GST %</th>
276
                        <th>GST</th>
242
                        <th>Fund</th>
277
                        <th>Fund</th>
243
                        [% IF ( active ) %]
278
                        [% IF ( active ) %]
244
                            [% UNLESS ( closedate ) %]
279
                            [% UNLESS ( closedate ) %]
Lines 249-293 Link Here
249
                    </tr>
284
                    </tr>
250
                </thead>
285
                </thead>
251
                <tfoot>
286
                <tfoot>
252
                [% IF ( GST ) %]
287
                [% FOREACH foot_loo IN book_foot_loop %]
253
                <tr>
288
                    <tr>
254
                    <th scope="row">Total tax exc.</th>
289
                        <th>Total (GST [% foot_loo.gstgsti %])</th>
255
                    <td>[% total_rrp_gste %]</td>
290
                        <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
256
                    <td>&nbsp;</td>
291
                        <th>[% foot_loo.quantity %]</th>
257
                    <td>[% qty_total %]</td>
292
                        <th class="gste">[% foot_loo.totalgste %]</th>
258
                    <td>[% total_est_gste %]</td>
293
                        <th class="gsti">[% foot_loo.totalgsti %]</th>
294
                        <th/>
295
                        <th>[% foot_loo.gstvalue %]</th>
296
                        <th/>
259
                        [% IF ( active ) %]
297
                        [% IF ( active ) %]
260
                            [% IF ( closedate ) %]
298
                            [% UNLESS ( closedate ) %]
261
                            <td colspan="1" rowspan="3">&nbsp;</td>
299
                                <th>&nbsp;</th>
262
                            [% ELSE %]
300
                                <th>&nbsp;</th>
263
                            <td colspan="3" rowspan="3">&nbsp;</td>
264
                            [% END %]
301
                            [% END %]
265
                        [% END %]
302
                        [% END %]
266
                </tr>
303
                    </tr>
267
                <tr>
304
                [% END %]
268
                    <th scope="row">Tax ([% gist_rate %])</th>
269
                    <td>[% gist_rrp %]</td>
270
                    <td>&nbsp;</td>
271
                    <td>&nbsp;</td>
272
                    <td>[% gist_est %]</td>
273
                </tr>
274
                <tr>
275
                    <th scope="row">Total tax inc. ([% currency %])</th>
276
                    <td>[% total_rrp_gsti %]</td>
277
                    <td>&nbsp;</td>
278
                    <td>[% qty_total %]</td>
279
                    <td>[% total_est_gsti %]</td>
280
                </tr>
281
                [% ELSE %]
282
                <tr>
305
                <tr>
283
                    <th scope="row">Total ([% currency %])</th>
306
                    <th>Total ([% currency %])</th>
284
                    <td>[% total_rrp_gsti %]</td>
307
                    <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
285
                    <td>&nbsp;</td>
308
                    <th>[% total_quantity %]</th>
286
                    <td>[% qty_total %]</td>
309
                    <th class="gste">[% total_gste %]</th>
287
                    <td>[% total_est_gsti %]</td>
310
                    <th class="gsti">[% total_gsti %]</th>
288
                    <td colspan="3">&nbsp;</td>
311
                    <th/>
312
                    <th>[% total_gstvalue %]</th>
313
                    <th/>
314
                    [% IF ( active ) %]
315
                        [% UNLESS ( closedate ) %]
316
                            <th>&nbsp;</th>
317
                            <th>&nbsp;</th>
318
                        [% END %]
319
                    [% END %]
289
                </tr>
320
                </tr>
290
                [% END %]
291
                </tfoot>
321
                </tfoot>
292
                <tbody>
322
                <tbody>
293
                [% FOREACH books_loo IN books_loop %]
323
                [% FOREACH books_loo IN books_loop %]
Lines 313-322 Link Here
313
                                [% END %]
343
                                [% END %]
314
                            </p>
344
                            </p>
315
                        </td>
345
                        </td>
316
                        <td class="number [% IF books_loo.rrp.search('^0') %]error[% END %]">[% books_loo.rrp %]</td>
346
                        <td class="number gste [% IF books_loo.rrpgste.search('^0') %]error[% END %]">[% books_loo.rrpgste %]</td>
317
                        <td class="number [% IF books_loo.ecost.search('^0') %]error[% END %]">[% books_loo.ecost %]</td>
347
                        <td class="number gste [% IF books_loo.ecostgste.search('^0') %]error[% END %]">[% books_loo.ecostgste %]</td>
348
                        <td class="number gsti [% IF books_loo.rrpgsti.search('^0') %]error[% END %]">[% books_loo.rrpgsti %]</td>
349
                        <td class="number gsti [% IF books_loo.ecostgsti.search('^0') %]error[% END %]">[% books_loo.ecostgsti %]</td>
318
                        <td class="number [% IF books_loo.quantity.search('^0') %]error[% END %]">[% books_loo.quantity %]</td>
350
                        <td class="number [% IF books_loo.quantity.search('^0') %]error[% END %]">[% books_loo.quantity %]</td>
319
                        <td class="number [% IF books_loo.line_total.search('^0') %]error[% END %]">[% books_loo.line_total %]</td>
351
                        <td class="number gste [% IF books_loo.totalgste.search('^0') %]error[% END %]">[% books_loo.totalgste %]</td>
352
                        <td class="number gsti [% IF books_loo.totalgsti.search('^0') %]error[% END %]">[% books_loo.totalgsti %]</td>
353
                        <td class="number [% IF books_loo.gstgsti.search('^0') %]error[% END %]">[% books_loo.gstgsti %]</td>
354
                        <td class="number [% IF books_loo.gstvalue.search('^0') %]error[% END %]">[% books_loo.gstvalue %]</td>
320
                        <td>[% books_loo.budget_name %]</td>
355
                        <td>[% books_loo.budget_name %]</td>
321
                        [% IF ( active ) %]
356
                        [% IF ( active ) %]
322
                            [% UNLESS ( closedate ) %]
357
                            [% UNLESS ( closedate ) %]
Lines 368-377 Link Here
368
              <thead>
403
              <thead>
369
                <tr>
404
                <tr>
370
                  <th>Order</th>
405
                  <th>Order</th>
371
                  <th>RRP</th>
406
                  <th class="gste">RRP tax exc.</th>
372
                  <th>Est.</th>
407
                  <th class="gste">ecost tax exc.</th>
408
                  <th class="gsti">RRP tax inc.</th>
409
                  <th class="gsti">ecost tax inc.</th>
373
                  <th>Qty.</th>
410
                  <th>Qty.</th>
374
                  <th>Total</th>
411
                  <th class="gste">Total tax exc. ([% currency %])</th>
412
                  <th class="gsti">Total tax inc. ([% currency %])</th>
413
                  <th>GST %</th>
414
                  <th>GST</th>
375
                  <th>Fund</th>
415
                  <th>Fund</th>
376
                </tr>
416
                </tr>
377
              </thead>
417
              </thead>
Lines 394-404 Link Here
394
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
434
                        [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
395
                      </p>
435
                      </p>
396
                    </td>
436
                    </td>
397
                    <td><p>[% order.rrp %]</p></td>
437
                    <td class="number gste">[% order.rrpgste %]</td>
398
                    <td><p>[% order.ecost %]</p></td>
438
                    <td class="number gste">[% order.ecostgste %]</td>
399
                    <td><p>[% order.quantity %]</p></td>
439
                    <td class="number gsti">[% order.rrpgsti %]</td>
400
                    <td><p>[% order.line_total %]</p></td>
440
                    <td class="number gsti">[% order.ecostgsti %]</td>
401
                    <td><p>[% order.budget_name %]</p></td>
441
                    <td class="number">[% order.quantity %]</td>
442
                    <td class="number gste">[% order.totalgste %]</td>
443
                    <td class="number gsti">[% order.totalgsti %]</td>
444
                    <td class="number">[% order.gstgsti %]</td>
445
                    <td class="number">[% order.gstvalue %]</td>
446
                    <td>[% order.budget_name %]
402
                  </tr>
447
                  </tr>
403
                [% END %]
448
                [% END %]
404
              </tbody>
449
              </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-40 / +55 lines)
Lines 106-112 $(document).ready(function() Link Here
106
        [% END %]
106
        [% END %]
107
107
108
        $("#quantity").change(function() {
108
        $("#quantity").change(function() {
109
            calcNeworderTotal();
109
            updateCosts();
110
        });
110
        });
111
111
112
        //We apply the fonction only for modify option
112
        //We apply the fonction only for modify option
Lines 143-149 $(document).ready(function() Link Here
143
//]]>
143
//]]>
144
</script>
144
</script>
145
</head>
145
</head>
146
<body id="acq_neworderempty" class="acq">
146
<body id="acq_neworderempty" class="acq" onload="updateCosts()">
147
147
148
[% INCLUDE 'header.inc' %]
148
[% INCLUDE 'header.inc' %]
149
[% INCLUDE 'acquisitions-search.inc' %]
149
[% INCLUDE 'acquisitions-search.inc' %]
Lines 222-239 $(document).ready(function() Link Here
222
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
222
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
223
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
223
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
224
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
224
        <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
225
        <input type="hidden" name="discount" value="[% discount %]" />
225
        <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
226
        <input type="hidden" name="listinc" value="[% listincgst %]" />
226
        <input type="hidden" name="applygst" id="applygst" value="[% gstreg %]" />
227
<!--        <input type="hidden" name="currency" value="[% currency %]" />-->
227
        <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
228
        <input type="hidden" name="applygst" value="[% gstreg %]" />
229
        <input type="hidden" name="invoiceincgst" value="[% invoiceincgst %]" />
230
        <input type="hidden" name="gstrate" value="[% gstrate %]" />
231
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
228
        <input type="hidden" name="suggestionid" value="[% suggestionid %]" />
232
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
229
        <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
230
        <input type="hidden" name="currency_rate" id="currency_rate" value="[% currency_rate %]" />
233
231
234
        [% FOREACH loop_currencie IN loop_currencies %]
235
            <input type="hidden" id="[% loop_currencie.currcode %]"  name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
236
        [% END %]
237
        <ol><li>
232
        <ol><li>
238
            [% IF ( biblionumber ) %]
233
            [% IF ( biblionumber ) %]
239
            <span class="label">Title</span>
234
            <span class="label">Title</span>
Lines 394-400 $(document).ready(function() Link Here
394
                    [% IF (AcqCreateItemOrdering) %]
389
                    [% IF (AcqCreateItemOrdering) %]
395
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
390
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
396
                    [% ELSE %]
391
                    [% ELSE %]
397
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" />
392
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
398
                    [% END %]
393
                    [% END %]
399
                [% END %]
394
                [% END %]
400
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
395
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
Lines 428-434 $(document).ready(function() Link Here
428
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
423
			<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
429
                [% ELSE %]
424
                [% ELSE %]
430
			<label for="currency">Currency:</label>
425
			<label for="currency">Currency:</label>
431
			<select name="currency" id="currency" onchange="calcNeworderTotal();">
426
			<select name="currency" id="currency" onchange="updateCosts();">
432
			[% FOREACH loop_currencie IN loop_currencies %]
427
			[% FOREACH loop_currencie IN loop_currencies %]
433
	                [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
428
	                [% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
434
			</select>
429
			</select>
Lines 436-446 $(document).ready(function() Link Here
436
                </li>
431
                </li>
437
            <li>
432
            <li>
438
                [% IF ( close ) %]
433
                [% IF ( close ) %]
439
            <span class="label">Vendor price: </span>
434
                    <span class="label">Vendor price: </span>
440
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
435
                    <input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
441
                [% ELSE %]
436
                [% ELSE %]
442
                <label for="listprice">Vendor price: </label>
437
                <label for="listprice">Vendor price: </label>
443
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="calcNeworderTotal()" />
438
                    <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="updateCosts()" />
444
                [% END %]
439
                [% END %]
445
            </li>
440
            </li>
446
            [% UNLESS ( close ) %]
441
            [% UNLESS ( close ) %]
Lines 453-505 $(document).ready(function() Link Here
453
                [% END %]
448
                [% END %]
454
            </li>
449
            </li>
455
            [% END %]
450
            [% END %]
456
			<li>
451
            <li>
457
                [% IF ( close ) %]
452
                [% IF ( close ) %]
458
            <span class="label">Replacement cost: </span>
453
                    <span class="label">gstrate: </span>
459
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
454
                    <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
460
                [% ELSE %]
455
                [% ELSE %]
461
                <label for="rrp">Replacement cost: </label>
456
                    <label for="gst">gstrate: </label>
462
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
457
                    <select name="gstrate" id="gstrate" onchange="updateCosts();">
458
                    [% FOREACH gst IN gst_values %]
459
                      [% IF ( gst.option == gstrate ) %]
460
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
461
                      [% ELSE %]
462
                        <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
463
                      [% END %]
464
                    [% END %]
465
                    </select>
463
                [% END %]
466
                [% END %]
464
            </li>
467
            </li>
465
            <li>
468
            <li>
469
                <label for="discount">Discount: </label>
466
                [% IF ( close ) %]
470
                [% IF ( close ) %]
467
            <label for="ecost">Budgeted cost: </label>
471
                    [% IF ( orderdiscount ) %]
468
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
472
                        <input type="hidden" name="discount" id="discount" value="[% orderdiscount %]" />[% orderdiscount_2dp %]%
473
                    [% ELSE %]
474
                        <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
475
                    [% END %]
469
                [% ELSE %]
476
                [% ELSE %]
470
                <label for="ecost">Budgeted cost: </label>
477
                    [% IF ( orderdiscount ) %]
471
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
478
                        <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
479
                    [% ELSE %]
480
                        <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
481
                    [% END %]
472
                [% END %]
482
                [% END %]
473
                [% IF ( discount_2dp ) %]  (adjusted for [% discount_2dp %]% discount)  [% END %]
474
475
            </li>
483
            </li>
476
            [% IF ( GST ) %]
477
            <li>
484
            <li>
478
                [% IF ( close ) %]
485
                [% IF ( close ) %]
479
            <label for="GST">Budgeted GST: </label>
486
                    <span class="label">Replacement cost: </span>
480
                <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
487
                    <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
481
                [% ELSE %]
488
                [% ELSE %]
482
                <label for="GST">Budgeted GST: </label>
489
                    <label for="rrp">Replacement cost: </label>
483
                <input type="text" size="20" name="gst" id="GST" value="" />
490
                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
491
                [% END %]
492
            </li>
493
            <li>
494
                [% IF ( close ) %]
495
                    <label for="ecost">Budgeted cost: </label>
496
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly"  />
497
                [% ELSE %]
498
                    <label for="ecost">Budgeted cost: </label>
499
                    <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
484
                [% END %]
500
                [% END %]
485
            </li>
501
            </li>
486
            [% END %]
487
            <li>
502
            <li>
488
                [% IF ( close ) %]
503
                [% IF ( close ) %]
489
            <label for="total">Total: </label>
504
                    <label for="total">Total: </label>
490
                <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
505
                    <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
491
                [% ELSE %]
506
                [% ELSE %]
492
                <label for="total">Total: </label>
507
                    <label for="total">Total: </label>
493
                <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
508
                    <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
494
                [% END %]
509
                [% END %]
495
            </li>
510
            </li>
496
            <li>
511
            <li>
497
                [% IF ( close ) %]
512
                [% IF ( close ) %]
498
            <label for="cost">Actual cost: </label>
513
                    <label for="unitprice">Actual cost: </label>
499
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
514
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
500
                [% ELSE %]
515
                [% ELSE %]
501
                <label for="cost">Actual cost: </label>
516
                    <label for="unitprice">Actual cost: </label>
502
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
517
                    <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
503
                [% END %]
518
                [% END %]
504
            </li>
519
            </li>
505
            <li>
520
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-1 / +1 lines)
Lines 263-269 Link Here
263
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
263
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
264
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
264
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
265
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
265
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
266
    <input type="hidden" name="gst" value="[% gst %]" />
266
    <input type="hidden" name="gstrate" value="[% gstrate %]" />
267
	</div>
267
	</div>
268
	<div class="yui-u">
268
	<div class="yui-u">
269
    <fieldset class="rows">
269
    <fieldset class="rows">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-51 / +31 lines)
Lines 17-23 Link Here
17
    $(document).ready(function(){
17
    $(document).ready(function(){
18
        var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
18
        var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
19
            "aoColumnDefs": [
19
            "aoColumnDefs": [
20
                { "aTargets": [ 3, 7, 8 ], "bSortable": false, "bSearchable": false },
20
                { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false },
21
            ],
21
            ],
22
            "aoColumns": [
22
            "aoColumns": [
23
                { "sType": "num-html" },
23
                { "sType": "num-html" },
Lines 29-40 Link Here
29
                null,
29
                null,
30
                null,
30
                null,
31
                null,
31
                null,
32
                null,
32
            ],
33
            ],
33
            "sPaginationType": "four_button"
34
            "sPaginationType": "four_button"
34
        } ) );
35
        } ) );
35
        var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
36
        var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
36
            "aoColumnDefs": [
37
            "aoColumnDefs": [
37
                { "aTargets": [ 3 ], "bSortable": false, "bSearchable": false },
38
                { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
38
            ],
39
            ],
39
            "aoColumns": [
40
            "aoColumns": [
40
                { "sType": "num-html" },
41
                { "sType": "num-html" },
Lines 49-54 Link Here
49
            ],
50
            ],
50
            "sPaginationType": "four_button"
51
            "sPaginationType": "four_button"
51
        } ) );
52
        } ) );
53
/*
54
    $("#pendingt").tablesorter({
55
		headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}}
56
    });
57
*/
52
58
53
	rowCountPending  = $("#pendingt tbody.filterclass tr").length;
59
	rowCountPending  = $("#pendingt tbody.filterclass tr").length;
54
	rowCountReceived = $("#receivedt tbody.filterclass tr").length;
60
	rowCountReceived = $("#receivedt tbody.filterclass tr").length;
Lines 73-79 Link Here
73
	$("#pendingcollapserow").remove();
79
	$("#pendingcollapserow").remove();
74
    $("#pendingt tr").show();
80
    $("#pendingt tr").show();
75
	$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
81
	$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
76
	$("#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>");
82
	$("#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>");
77
83
78
    }
84
    }
79
85
Lines 83-89 Link Here
83
	$("#pendingcollapserow").remove();
89
	$("#pendingcollapserow").remove();
84
	$("#pendingt tr").show();
90
	$("#pendingt tr").show();
85
    $("#pendingt tbody.filterclass tr.orderfound").remove();
91
    $("#pendingt tbody.filterclass tr.orderfound").remove();
86
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + "<a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
92
	$("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + " <a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
87
    }
93
    }
88
94
89
    // Collapse already received items table
95
    // Collapse already received items table
Lines 91-97 Link Here
91
        $.cookie("receivedKeepExpanded", 0, { path: "/", expires: 9999 });
97
        $.cookie("receivedKeepExpanded", 0, { path: "/", expires: 9999 });
92
	$("#receivedcollapserow").remove();
98
	$("#receivedcollapserow").remove();
93
	$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
99
	$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
94
	$("#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>");
100
	$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + " <a href=\"javascript:receivedExpand();\">" + _("Click here to show all ") + rowCountReceived + _(" items") + "<\/a>.<\/p>");
95
    }
101
    }
96
102
97
    // Expand already received items table
103
    // Expand already received items table
Lines 99-105 Link Here
99
        $.cookie("receivedKeepExpanded", 1, { path: "/", expires: 9999 });
105
        $.cookie("receivedKeepExpanded", 1, { path: "/", expires: 9999 });
100
	$("#receivedcollapserow").remove();
106
	$("#receivedcollapserow").remove();
101
	$("#receivedt tr").show();
107
	$("#receivedt tr").show();
102
	$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("All ") + rowCountReceived + _(" items are displayed.") + "<a href=\"javascript:receivedCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
108
	$("#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>");
103
    }
109
    }
104
110
105
//]]>
111
//]]>
Lines 208-226 Link Here
208
            <th>Quantity</th>
214
            <th>Quantity</th>
209
            <th>Unit cost</th>
215
            <th>Unit cost</th>
210
            <th>Order cost</th>
216
            <th>Order cost</th>
217
            <th>Fund</th>
211
            <th>&nbsp;</th>
218
            <th>&nbsp;</th>
212
            <th>&nbsp;</th>
219
            <th>&nbsp;</th>
213
        </tr>
220
        </tr>
214
    </thead>
221
    </thead>
215
		<tfoot>
216
            <tr><td colspan="4" class="total">TOTAL</td>
217
                <td> [% totalPquantity %] </td>
218
				<td>&nbsp;</td>
219
                <td>[% ordergrandtotal %]</td>
220
				<td>&nbsp;</td>
221
				<td>&nbsp;</td>
222
            </tr>
223
		</tfoot>
224
    <tbody class="filterclass">
222
    <tbody class="filterclass">
225
        [% FOREACH loop_order IN loop_orders %]
223
        [% FOREACH loop_order IN loop_orders %]
226
            <tr>
224
            <tr>
Lines 247-255 Link Here
247
                <td>[% loop_order.quantity %]</td>
245
                <td>[% loop_order.quantity %]</td>
248
                <td>[% loop_order.ecost %]</td>
246
                <td>[% loop_order.ecost %]</td>
249
                <td>[% loop_order.ordertotal %]</td>
247
                <td>[% loop_order.ordertotal %]</td>
248
                <td>[% loop_order.budget_name %]</td>
250
				<td>
249
				<td>
251
                              <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;invoiceid=[% invoiceid %]">Receive</a>
250
                              <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;invoiceid=[% invoiceid %]">Receive</a>
252
				    
253
				</td>
251
				</td>
254
				<td>
252
				<td>
255
                        [% IF ( loop_order.left_holds_on_order ) %]
253
                        [% IF ( loop_order.left_holds_on_order ) %]
Lines 324-364 Link Here
324
	    </tr>
322
	    </tr>
325
    </thead>
323
    </thead>
326
    <tfoot>
324
    <tfoot>
327
	    <tr>
325
        <tr>
328
		<td colspan="4" class="total">SUBTOTAL</td>
326
            <th colspan="7" class="total">Total tax exc.</th>
329
		<td colspan="2">&nbsp;</td>
327
            <th>[% total_gste %]</th>
330
		<td>[% totalprice %]</td>
328
            <th></th>
331
		<td>[% tototal %]</td>
329
        </tr>
332
        <td></td>
330
        [% FOREACH book_foot IN book_foot_loop %]
333
	    </tr>
331
            <tr>
334
	      
332
                <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
335
	      [% IF ( totalfreight ) %]
333
                <th>[% book_foot.value %]</th>
336
		    <tr>
334
                <th></th>
337
			<td colspan="6">&nbsp;
335
            </tr>
338
		</td>
336
        [% END %]
339
			    <td>Shipping</td>
337
        <tr>
340
		<td>[% totalfreight %]</td>
338
            <th colspan="7" class="total">Total tax inc.</th>
341
	    	</tr> 
339
            <th>[% total_gsti %]</th>
342
	    [% END %]
340
            <th></th>
343
	      [% IF ( gst ) %]
341
        </tr>
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
        <td></td>
361
	    </tr>
362
    </tfoot>
342
    </tfoot>
363
	<tbody class="filterclass">
343
	<tbody class="filterclass">
364
	    [% FOREACH loop_receive IN loop_received %]
344
	    [% FOREACH loop_receive IN loop_received %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-4 / +17 lines)
Lines 129-135 if (f.company.value == "") { Link Here
129
            </li>
129
            </li>
130
            </ol>
130
            </ol>
131
            <ol class="radio">
131
            <ol class="radio">
132
            <li><label for="gstyes" class="radio">Tax Number Registered:</label>
132
            <li><label for="gstyes" class="radio">Tax number registered:</label>
133
                [% IF ( gstreg ) %]
133
                [% IF ( gstreg ) %]
134
                    <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
134
                    <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
135
                    <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
135
                    <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
Lines 156-165 if (f.company.value == "") { Link Here
156
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
156
                    <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
157
                [% END %]</li>
157
                [% END %]</li>
158
            </ol>
158
            </ol>
159
             <ol>
160
                <li>
161
                    <label for="gst">Tax rate</label>
162
                    <select name="gstrate" id="gstrate">
163
                    [% FOREACH gst IN gst_values %]
164
                      [% IF ( gstrate == gst.option ) %]
165
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
166
                      [% ELSE %]
167
                        <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
168
                      [% END %]
169
                    [% END %]
170
                    </select>
171
                </li>
172
            </ol>
159
            <ol>
173
            <ol>
160
            <li><label for="discount">Discount</label>
174
            <li><label for="discount">Discount</label>
161
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
175
                <input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
162
            <li><label for="gstrate">Tax rate</label><input type="text" name="gstrate" id="gstrate" size="6" value="[% gstrate %]"/>% (leave blank for default tax of [% default_gst_rate %]%)</li>
163
            <li>
176
            <li>
164
                <label for="deliverytime">Delivery time</label>
177
                <label for="deliverytime">Delivery time</label>
165
                <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
178
                <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
Lines 214-220 if (f.company.value == "") { Link Here
214
                    [% END %]</p>
227
                    [% END %]</p>
215
            <p><strong>List prices are: </strong>[% listprice %]</p>
228
            <p><strong>List prices are: </strong>[% listprice %]</p>
216
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
229
            <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
217
            [% IF ( GST ) %]<p><strong>Tax number registered: </strong>
230
            [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
218
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
231
                    [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
219
            <p><strong>List item price includes tax: </strong>
232
            <p><strong>List item price includes tax: </strong>
220
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
233
                    [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
Lines 223-229 if (f.company.value == "") { Link Here
223
            <p><strong>Discount: </strong>
236
            <p><strong>Discount: </strong>
224
                [% discount %] %</p>
237
                [% discount %] %</p>
225
            <p><strong>Tax rate: </strong>
238
            <p><strong>Tax rate: </strong>
226
                [% GST %]%[% UNLESS ( default_tax ) %] (default)[% END %]</p>
239
                [% 0 + gstrate * 100 | format("%.1f") %]%</p>
227
            [% IF deliverytime.defined %]
240
            [% IF deliverytime.defined %]
228
                <p><strong>Delivery time: </strong>
241
                <p><strong>Delivery time: </strong>
229
                    [% deliverytime %] days</p>
242
                    [% deliverytime %] days</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-2 / +2 lines)
Lines 32-40 Acquisitions: Link Here
32
                  US: 360,000.00 (US)
32
                  US: 360,000.00 (US)
33
                  FR: 360 000,00 (FR)
33
                  FR: 360 000,00 (FR)
34
        -
34
        -
35
            - The default tax rate is
35
            - Default tax rates are
36
            - pref: gist
36
            - pref: gist
37
            - (enter in numeric form, 0.12 for 12%)
37
            - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
38
38
39
    Printing:
39
    Printing:
40
        -
40
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+34 lines)
Lines 126-131 $(document).ready(function() { Link Here
126
     </div>
126
     </div>
127
</div>
127
</div>
128
</div>
128
</div>
129
    [% IF ( show_acquisition_details ) %]
130
        <div id="acquisition_details">
131
            <h2>Acquisition details</h2>
132
            <table>
133
                <thead>
134
                    <tr><th></th><th>Price exc. taxes</th><th>Price inc. taxes</th><th>fund</th><th></th></tr>
135
                </thead>
136
                <tbody>
137
                    <tr>
138
                        <td>Ordered amount</td>
139
                        <td>[% valuegste_ordered %]</td>
140
                        <td>[% valuegsti_ordered %]</td>
141
                        <td>[% budget_name_ordered %]</td>
142
                        <td>
143
                            [% IF ( ordered_exists ) %]
144
                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">See basket informations</a>
145
                            [% END %]
146
                        </td>
147
                    </tr>
148
                    <tr>
149
                        <td>Spent amount</td>
150
                        <td>[% valuegste_spent %]</td>
151
                        <td>[% valuegsti_spent %]</td>
152
                        <td>[% budget_name_spent %]</td>
153
                        <td>
154
                            [% IF ( spent_exists ) %]
155
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoicenumber=[% invoicenumber %]">See invoice informations</a>
156
                            [% END %]
157
                        </td>
158
                    </tr>
159
                </tbody>
160
            </table>
161
        </div>
162
    [% END %]
129
    <div id="subscription_planning">
163
    <div id="subscription_planning">
130
    <div class="yui-g">
164
    <div class="yui-g">
131
    <div class="rows">
165
    <div class="rows">
(-)a/serials/subscription-detail.pl (-2 / +30 lines)
Lines 100-106 my $hasRouting = check_routing($subscriptionid); Link Here
100
100
101
# COMMENT hdl : IMHO, we should think about passing more and more data hash to template->param rather than duplicating code a new coding Guideline ?
101
# COMMENT hdl : IMHO, we should think about passing more and more data hash to template->param rather than duplicating code a new coding Guideline ?
102
102
103
for my $date qw(startdate enddate firstacquidate histstartdate histenddate){
103
for my $date ( qw(startdate enddate firstacquidate histstartdate histenddate) ) {
104
    $$subs{$date}      = format_date($$subs{$date}) if $date && $$subs{$date};
104
    $$subs{$date}      = format_date($$subs{$date}) if $date && $$subs{$date};
105
}
105
}
106
$subs->{location} = GetKohaAuthorisedValueLib("LOC",$subs->{location});
106
$subs->{location} = GetKohaAuthorisedValueLib("LOC",$subs->{location});
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,
Lines 138-144 $template->param( Link Here
138
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
165
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
139
    irregular_issues => scalar @irregular_issues,
166
    irregular_issues => scalar @irregular_issues,
140
    default_bib_view => $default_bib_view,
167
    default_bib_view => $default_bib_view,
141
    (uc(C4::Context->preference("marcflavour"))) => 1
168
    (uc(C4::Context->preference("marcflavour"))) => 1,
169
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
142
    );
170
    );
143
171
144
output_html_with_http_headers $query, $cookie, $template->output;
172
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/t/db_dependent/lib/KohaTest/Acquisition/GetParcel.pm (+1 lines)
Lines 48-53 sub one_parcel : Test( 17 ) { Link Here
48
                                        undef,         # $quantrec,
48
                                        undef,         # $quantrec,
49
                                        undef,         # $user,
49
                                        undef,         # $user,
50
                                        undef,         # $cost,
50
                                        undef,         # $cost,
51
                                        undef,         # $ecost,
51
                                        $invoice,         # $invoiceno,
52
                                        $invoice,         # $invoiceno,
52
                                        undef,         # $freight,
53
                                        undef,         # $freight,
53
                                        undef,         # $rrp,
54
                                        undef,         # $rrp,
(-)a/t/db_dependent/lib/KohaTest/Acquisition/GetParcels.pm (-1 / +1 lines)
Lines 276-281 sub create_order { Link Here
276
                                        undef,         # $quantrec,
276
                                        undef,         # $quantrec,
277
                                        undef,         # $user,
277
                                        undef,         # $user,
278
                                        undef,         # $cost,
278
                                        undef,         # $cost,
279
                                        undef,         # $ecost,
279
                                        $param{'invoice'},         # $invoiceno,
280
                                        $param{'invoice'},         # $invoiceno,
280
                                        undef,         # $freight,
281
                                        undef,         # $freight,
281
                                        undef,         # $rrp,
282
                                        undef,         # $rrp,
282
- 

Return to bug 5335