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

(-)a/Koha/EDI.pm (+6 lines)
Lines 288-293 sub process_invoice { Link Here
288
                    }
288
                    }
289
289
290
                    my $price = _get_invoiced_price($line);
290
                    my $price = _get_invoiced_price($line);
291
                    my $tax_rate = $line->tax_rate;
292
                    if ($tax_rate && $tax_rate->{rate} != 0) {
293
                       $tax_rate->{rate} /= 100;
294
                    }
291
295
292
                    if ( $order->quantity > $line->quantity ) {
296
                    if ( $order->quantity > $line->quantity ) {
293
                        my $ordered = $order->quantity;
297
                        my $ordered = $order->quantity;
Lines 305-310 sub process_invoice { Link Here
305
                                unitprice        => $price,
309
                                unitprice        => $price,
306
                                invoiceid        => $invoiceid,
310
                                invoiceid        => $invoiceid,
307
                                datereceived     => $msg_date,
311
                                datereceived     => $msg_date,
312
                                tax_rate_on_receiving => $tax_rate->{rate},
308
                            }
313
                            }
309
                        );
314
                        );
310
                        my $p_updates =
315
                        my $p_updates =
Lines 324-329 sub process_invoice { Link Here
324
                        $order->datereceived($msg_date);
329
                        $order->datereceived($msg_date);
325
                        $order->invoiceid($invoiceid);
330
                        $order->invoiceid($invoiceid);
326
                        $order->unitprice($price);
331
                        $order->unitprice($price);
332
                        $order->tax_rate_on_receiving($tax_rate->{rate});
327
                        $order->orderstatus('complete');
333
                        $order->orderstatus('complete');
328
                        my $p_updates = update_price_from_invoice( $order,
334
                        my $p_updates = update_price_from_invoice( $order,
329
                            $invoice_message->vendor_id );
335
                            $invoice_message->vendor_id );
(-)a/Koha/Edifact/Line.pm (-1 / +24 lines)
Lines 801-806 sub tax { Link Here
801
    return $self->moa_amt('124');
801
    return $self->moa_amt('124');
802
}
802
}
803
803
804
sub tax_rate {
805
    my $self = shift;
806
    my $tr = {};
807
    foreach my $s ( @{ $self->{segs} } ) {
808
        if ( $s->tag eq 'TAX' && $s->elem( 0, 0 ) == 7 ) {
809
            $tr->{type} = $s->elem( 1, 0 ); # VAT, GST or IMP
810
            $tr->{rate} = $s->elem( 4, 3 ); # percentage
811
            # category values may be:
812
            # E = exempt from tax
813
            # G = export item, tax not charged
814
            # H = higher rate
815
            # L = lower rate
816
            # S = standard rate
817
            # Z = zero-rated
818
            $tr->{category} = $s->elem( 5, 0 );
819
            if (!defined $tr->{rate} && $tr->{category} eq 'Z') {
820
                $tr->{rate} = 0;
821
            }
822
            return $tr;
823
        }
824
    }
825
    return;
826
}
827
804
sub availability_date {
828
sub availability_date {
805
    my $self = shift;
829
    my $self = shift;
806
    if ( exists $self->{availability_date} ) {
830
    if ( exists $self->{availability_date} ) {
807
- 

Return to bug 18267