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

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

Return to bug 5335