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 178-183 if ($op eq ""){ Link Here
178
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
178
        my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1;
179
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
179
        my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id;
180
        my $c_discount = shift ( @discount);
180
        my $c_discount = shift ( @discount);
181
        if ($c_discount) {
182
            $c_discount =~ s/%//g; #This screws up number conversion badly
183
            $c_discount =~ s/,/./g; #Make this an actual digit for Perl
184
            $c_discount = $c_discount / 100 if $c_discount >= 1;
185
        }
181
        $c_discount = $c_discount / 100 if $c_discount > 1;
186
        $c_discount = $c_discount / 100 if $c_discount > 1;
182
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
187
        my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || '';
183
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
188
        my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || '';
Lines 237-255 if ($op eq ""){ Link Here
237
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
242
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
238
            if ( $bookseller->{listincgst} ) {
243
            if ( $bookseller->{listincgst} ) {
239
                if ( $c_discount ) {
244
                if ( $c_discount ) {
240
                    $orderinfo{ecost} = $price;
245
                    $orderinfo{ecost} = $price * ( 1 - $c ); #Get the VAT included discounted price
241
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
246
                    $orderinfo{rrp}   = $price; #Replacement price is the non-discounted price. Otherwise our patrons can start making profit by stealing books.
242
                } else {
247
                } else {
243
                    $orderinfo{ecost} = $price * ( 1 - $c );
248
                    $orderinfo{ecost} = $price;
244
                    $orderinfo{rrp}   = $price;
249
                    $orderinfo{rrp}   = $price;
245
                }
250
                }
246
            } else {
251
            } else {
247
                if ( $c_discount ) {
252
                if ( $c_discount ) {
248
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
253
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} ) * ( 1 - $c ); #Add VAT/GST and the discount
249
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
254
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} ); #Add the VAT
250
                } else {
255
                } else {
251
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
256
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
252
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
257
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
253
                }
258
                }
254
            }
259
            }
255
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
260
            $orderinfo{listprice} = $orderinfo{rrp} / $cur->{rate};
256
- 

Return to bug 14680