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

(-)a/acqui/addorderiso2709.pl (-8 / +12 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl -d
2
2
3
#A script that lets the user populate a basket from an iso2709 file
3
#A script that lets the user populate a basket from an iso2709 file
4
#the script first displays a list of import batches, then when a batch is selected displays all the biblios in it.
4
#the script first displays a list of import batches, then when a batch is selected displays all the biblios in it.
Lines 175-180 if ($op eq ""){ Link Here
175
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
175
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
176
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
176
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
177
        my $c_discount = shift ( @discount);
177
        my $c_discount = shift ( @discount);
178
        if ($c_discount) {
179
            $c_discount =~ s/%//g; #This screws up number conversion badly
180
            $c_discount =~ s/,/./g; #Make this an actual digit for Perl
181
            $c_discount = $c_discount / 100 if $c_discount >= 1;
182
        }
178
        $c_discount = $c_discount / 100 if $c_discount > 1;
183
        $c_discount = $c_discount / 100 if $c_discount > 1;
179
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
184
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
180
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
185
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
Lines 233-251 if ($op eq ""){ Link Here
233
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
238
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
234
            if ( $bookseller->{listincgst} ) {
239
            if ( $bookseller->{listincgst} ) {
235
                if ( $c_discount ) {
240
                if ( $c_discount ) {
236
                    $orderinfo{ecost} = $price;
241
                    $orderinfo{ecost} = $price * ( 1 - $c ); #Get the VAT included discounted price
237
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
242
                    $orderinfo{rrp}   = $price; #Replacement price is the non-discounted price. Otherwise our patrons can start making profit by stealing books.
238
                } else {
243
                } else {
239
                    $orderinfo{ecost} = $price * ( 1 - $c );
244
                    $orderinfo{ecost} = $price;
240
                    $orderinfo{rrp}   = $price;
245
                    $orderinfo{rrp}   = $price;
241
                }
246
                }
242
            } else {
247
            } else {
243
                if ( $c_discount ) {
248
                if ( $c_discount ) {
244
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
249
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} ) * ( 1 - $c ); #Add VAT/GST and the discount
245
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
250
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} ); #Add the VAT
246
                } else {
251
                } else {
247
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
252
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
248
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
253
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
249
                }
254
                }
250
            }
255
            }
251
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
256
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
252
- 

Return to bug 14680