Bugzilla – Attachment 65251 Details for
Bug 18267
Update price and tax fields in EDI to reflect DB changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Record tax rate from the invoice
0004-Bug-18267-Record-tax-rate-on-receipt-from-EDI-Invoic.patch (text/plain), 3.31 KB, created by
Colin Campbell
on 2017-07-25 15:46:58 UTC
(
hide
)
Description:
Record tax rate from the invoice
Filename:
MIME Type:
Creator:
Colin Campbell
Created:
2017-07-25 15:46:58 UTC
Size:
3.31 KB
patch
obsolete
>From 07d9e0b1f6085128ec8fa67ff70c2195448a2c5a Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 10 Jul 2017 16:16:17 +0100 >Subject: [PATCH 4/7] Bug 18267 - Record tax rate on receipt from EDI Invoice > >As part of the newly introduced price fields there >is also a tax_rate_on_receiving that needs setting. > >This records the main tax rate on receipting. Edifact has the >potential to be more complex than Koha allows i.e. the >line amount may be made of different amounts (incorporating >servicing, etc) at different tax rates. This concentrates >on the main tax rate. > >The tax rate will be receiced as a percentage value e.g. 20.00 >need to convert to a decimal fraction 0.20 as assumed in Koha >calculations >--- > Koha/EDI.pm | 6 ++++++ > Koha/Edifact/Line.pm | 24 ++++++++++++++++++++++++ > 2 files changed, 30 insertions(+) > >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 75db70770e..d1e0d452ee 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -288,6 +288,10 @@ sub process_invoice { > } > > my $price = _get_invoiced_price($line); >+ my $tax_rate = $line->tax_rate; >+ if ($tax_rate && $tax_rate->{rate} != 0) { >+ $tax_rate->{rate} /= 100; >+ } > > if ( $order->quantity > $line->quantity ) { > my $ordered = $order->quantity; >@@ -305,6 +309,7 @@ sub process_invoice { > unitprice => $price, > invoiceid => $invoiceid, > datereceived => $msg_date, >+ tax_rate_on_receiving => $tax_rate->{rate}, > } > ); > my $p_updates = >@@ -324,6 +329,7 @@ sub process_invoice { > $order->datereceived($msg_date); > $order->invoiceid($invoiceid); > $order->unitprice($price); >+ $order->tax_rate_on_receiving($tax_rate->{rate}); > $order->orderstatus('complete'); > my $p_updates = update_price_from_invoice( $order, > $invoice_message->vendor_id ); >diff --git a/Koha/Edifact/Line.pm b/Koha/Edifact/Line.pm >index 05abfeeb13..ccb975cfa7 100644 >--- a/Koha/Edifact/Line.pm >+++ b/Koha/Edifact/Line.pm >@@ -801,6 +801,30 @@ sub tax { > return $self->moa_amt('124'); > } > >+sub tax_rate { >+ my $self = shift; >+ my $tr = {}; >+ foreach my $s ( @{ $self->{segs} } ) { >+ if ( $s->tag eq 'TAX' && $s->elem( 0, 0 ) == 7 ) { >+ $tr->{type} = $s->elem( 1, 0 ); # VAT, GST or IMP >+ $tr->{rate} = $s->elem( 4, 3 ); # percentage >+ # category values may be: >+ # E = exempt from tax >+ # G = export item, tax not charged >+ # H = higher rate >+ # L = lower rate >+ # S = standard rate >+ # Z = zero-rated >+ $tr->{category} = $s->elem( 5, 0 ); >+ if (!defined $tr->{rate} && $tr->{category} eq 'Z') { >+ $tr->{rate} = 0; >+ } >+ return $tr; >+ } >+ } >+ return; >+} >+ > sub availability_date { > my $self = shift; > if ( exists $self->{availability_date} ) { >-- >2.13.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18267
:
61600
|
61601
|
61602
|
61605
|
61606
|
65244
|
65245
|
65246
|
65250
|
65251
|
65252
|
65253
|
65254
|
68536
|
68707
|
68708
|
68709
|
68710
|
68711
|
68712
|
68713
|
68714
|
113569
|
113597
|
113897