Bugzilla – Attachment 35995 Details for
Bug 11062
Invoice's shipment/shipping cost should be included PRE-gst tax (as an option)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11062: Fill shipping tax excluded
Bug-11062-Fill-shipping-tax-excluded.patch (text/plain), 12.55 KB, created by
Jonathan Druart
on 2015-02-18 15:45:57 UTC
(
hide
)
Description:
Bug 11062: Fill shipping tax excluded
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-02-18 15:45:57 UTC
Size:
12.55 KB
patch
obsolete
>From a5e87511cca6a912d00c36f5bce4952d2ad00b43 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 18 Feb 2015 15:55:08 +0100 >Subject: [PATCH] Bug 11062: Fill shipping tax excluded > >This patch adds the ability to enter the shipping tax excluded. > >Note that the total will continue to be calculated using the shipping >tax included. >--- > C4/Acquisition.pm | 2 +- > C4/Bookseller.pm | 9 +++-- > acqui/parcels.pl | 10 +++++- > acqui/supplier.pl | 2 ++ > acqui/updatesupplier.pl | 2 ++ > .../intranet-tmpl/prog/en/modules/acqui/invoice.tt | 11 ++++-- > .../prog/en/modules/acqui/supplier.tt | 42 +++++++++++++++++++--- > 7 files changed, 67 insertions(+), 11 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 75a4784..049c831 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2622,7 +2622,7 @@ sub AddInvoice { > return unless(%invoice and $invoice{invoicenumber}); > > my @columns = qw(invoicenumber booksellerid shipmentdate billingdate >- closedate shipping shipmentcost_budgetid); >+ closedate shipping shipping_tax_rate shipmentcost_budgetid); > > my @set_strs; > my @set_args; >diff --git a/C4/Bookseller.pm b/C4/Bookseller.pm >index 0f8d368..ecd3c14 100644 >--- a/C4/Bookseller.pm >+++ b/C4/Bookseller.pm >@@ -139,9 +139,9 @@ sub AddBookseller { > postal, phone, accountnumber,fax, url, > active, listprice, invoiceprice, gstreg, > listincgst,invoiceincgst, tax_rate, discount, notes, >- deliverytime >+ deliverytime, shipping_tax_rate, shippingincgst > ) >- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | >+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | > ; > my $sth = $dbh->prepare($query); > $sth->execute( >@@ -155,6 +155,7 @@ sub AddBookseller { > $data->{'listincgst'}, $data->{'invoiceincgst'}, > $data->{'tax_rate'}, $data->{'discount'}, > $data->{notes}, $data->{deliverytime}, >+ $data->{shipping_tax_rate}, $data->{shippingincgst}, > ); > > # return the id of this new supplier >@@ -196,7 +197,8 @@ sub ModBookseller { > postal=?,phone=?,accountnumber=?,fax=?,url=?, > active=?,listprice=?, invoiceprice=?, > gstreg=?,listincgst=?,invoiceincgst=?, >- discount=?,notes=?,tax_rate=?,deliverytime=? >+ discount=?,notes=?,tax_rate=?,deliverytime=?, >+ shipping_tax_rate = ?, shippingincgst = ? > WHERE id=?'; > my $sth = $dbh->prepare($query); > my $cnt = $sth->execute( >@@ -210,6 +212,7 @@ sub ModBookseller { > $data->{'listincgst'}, $data->{'invoiceincgst'}, > $data->{'discount'}, $data->{'notes'}, > $data->{'tax_rate'}, $data->{deliverytime}, >+ $data->{shipping_tax_rate}, $data->{shippingincgst}, > $data->{'id'} > ); > $contacts ||= $data->{'contacts'}; >diff --git a/acqui/parcels.pl b/acqui/parcels.pl >index 952d0f2..244cb35 100755 >--- a/acqui/parcels.pl >+++ b/acqui/parcels.pl >@@ -107,12 +107,15 @@ if($shipmentdate) { > $shipmentdate = C4::Dates->new($shipmentdate)->output('iso'); > } > >+my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); >+ > if ( $op and $op eq 'new' ) { > if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) { > my @invoices = GetInvoices( > supplierid => $booksellerid, > invoicenumber => $invoicenumber, > ); >+ > if ( scalar @invoices > 0 ) { > $template->{'VARS'}->{'duplicate_invoices'} = \@invoices; > $template->{'VARS'}->{'invoicenumber'} = $invoicenumber; >@@ -125,11 +128,17 @@ if ( $op and $op eq 'new' ) { > $op = 'confirm' unless $template->{'VARS'}->{'duplicate_invoices'}; > } > if ($op and $op eq 'confirm') { >+ my $shipping_tax_rate = $bookseller->{shipping_tax_rate}; >+ unless ( $bookseller->{shippingincgst} ) { >+ $shipping = $shipping * ( 1 + $shipping_tax_rate ); >+ } >+ > my $invoiceid = AddInvoice( > invoicenumber => $invoicenumber, > booksellerid => $booksellerid, > shipmentdate => $shipmentdate, > shipping => $shipping, >+ shipping_tax_rate => $shipping_tax_rate, > shipmentcost_budgetid => $shipmentcost_budgetid, > ); > if(defined $invoiceid) { >@@ -141,7 +150,6 @@ if ($op and $op eq 'confirm') { > } > } > >-my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); > my @parcels = GetInvoices( > supplierid => $booksellerid, > invoicenumber => $code, >diff --git a/acqui/supplier.pl b/acqui/supplier.pl >index 4b359a7..631776c 100755 >--- a/acqui/supplier.pl >+++ b/acqui/supplier.pl >@@ -83,6 +83,7 @@ if ( $op eq 'display' ) { > $template->param( > active => $supplier->{'active'}, > tax_rate => $supplier->{'tax_rate'} + 0.0, >+ shipping_tax_rate => $supplier->{'shipping_tax_rate'} + 0.0, > invoiceprice => $supplier->{'invoiceprice'}, > listprice => $supplier->{'listprice'}, > basketcount => $supplier->{'basketcount'}, >@@ -127,6 +128,7 @@ if ( $op eq 'display' ) { > # set active ON by default for supplier add (id empty for add) > active => $booksellerid ? $supplier->{'active'} : 1, > tax_rate => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0, >+ shipping_tax_rate => $supplier->{shipping_tax_rate} ? $supplier->{shipping_tax_rate}+0.0 : 0, > gst_values => \@gst_values, > loop_currency => $loop_currency, > enter => 1, >diff --git a/acqui/updatesupplier.pl b/acqui/updatesupplier.pl >index 3981864..fcfb6dd 100755 >--- a/acqui/updatesupplier.pl >+++ b/acqui/updatesupplier.pl >@@ -96,8 +96,10 @@ $data{'invoiceprice'}=$input->param('invoice_currency'); > $data{'gstreg'}=$input->param('gst'); > $data{'listincgst'}=$input->param('list_gst'); > $data{'invoiceincgst'}=$input->param('invoice_gst'); >+$data{shippingincgst} = $input->param('shippingincgst'); > #have to transform this into fraction so it's easier to use > $data{'tax_rate'} = $input->param('tax_rate'); >+$data{shipping_tax_rate} = $input->param('shipping_tax_rate'); > $data{'discount'} = $input->param('discount'); > $data{deliverytime} = $input->param('deliverytime'); > $data{'active'}=$input->param('status'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >index 812cf9d..c3e6345 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >@@ -79,8 +79,15 @@ > <li><label for="billingdate">Billing date:</label> > <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li> > >- <li><label for="shipmentcost">Shipping cost:</label> >- <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost %]" /></li> >+ <li><label for="shipping">shipping:</label> >+ <input type="text" size="10" id="shipping" name="shipping" value="[% shipping %]" /></li> >+ >+ <li><label for="shipping_tax_rate">shipping tax rate:</label> >+ <input type="text" size="10" id="shipping_tax_rate" name="shipping_tax_rate" value="[% shipping_tax_rate %]" /></li> >+ >+ <li><label for="shipping_tax_value">shipping_tax_value :</label> >+ <input type="text" size="10" id="shipping_tax_value" name="shipping_tax_value" value="[% shipping_tax_value %]" /></li> >+ > <li><label for="shipment_budget_id">Fund:</label> > <select id="shipment_budget_id" name="shipment_budget_id"> > <option value="">No fund</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >index 9ff0901..3beacff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >@@ -236,6 +236,14 @@ function delete_contact(ev) { > [% END %] > </select> > </li> >+ <li><label for="shipping_currency">Shipping prices are: </label> >+ <select name="shipping_currency" id="shipping_currency"> >+ [% FOREACH loop_currenc IN loop_currency %] >+ [% IF ( loop_currenc.shippingprice ) %]<option value="[% loop_currenc.currency %]" selected="selected">[% loop_currenc.currency %]</option> >+ [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %] >+ [% END %] >+ </select> >+ </li> > </ol> > <ol class="radio"> > <li><label for="gstyes" class="radio">Tax number registered:</label> >@@ -264,6 +272,15 @@ function delete_contact(ev) { > <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" /> > <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" /> > [% END %]</li> >+ <li><label for="shipping_gstyes" class="radio">Shipping prices:</label> >+ [% IF ( shippingincgst ) %] >+ <label for="shipping_gstyes">Include tax</label> <input type="radio" id="shipping_gstyes" name="shippingincgst" value="1" checked="checked" /> >+ <label for="shipping_gstno">Don't include tax</label> <input type="radio" id="shipping_gstno" name="shippingincgst" value="0" /> >+ [% ELSE %] >+ <label for="shipping_gstyes">Include tax</label> <input type="radio" id="shipping_gstyes" name="shippingincgst" value="1" /> >+ <label for="shipping_gstno">Don't include tax</label> <input type="radio" id="shipping_gstno" name="shippingincgst" value="0" checked="checked" /> >+ [% END %]</li> >+ > </ol> > [% IF gst_values %] > <ol> >@@ -279,6 +296,19 @@ function delete_contact(ev) { > [% END %] > </select> > </li> >+ <li> >+ <label for="shipping_tax_rate">Shipping tax rate: </label> >+ <select name="shipping_tax_rate" id="shipping_tax_rate"> >+ [% FOREACH gst IN gst_values %] >+ [% IF ( shipping_tax_rate == gst.option ) %] >+ <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option> >+ [% ELSE %] >+ <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ > </ol> > [% ELSE %] > <input type="hidden" name="tax_rate" value="0" /> >@@ -325,12 +355,16 @@ function delete_contact(ev) { > [% END %]</p> > <p><strong>List prices are: </strong>[% listprice %]</p> > <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p> >- [% IF ( tax_rate ) %]<p><strong>Tax number registered: </strong> >+ [% IF tax_rate %] >+ <p><strong>Tax number registered: </strong> > [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p> >- <p><strong>List item price includes tax: </strong> >+ <p><strong>List item price includes tax: </strong> > [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p> >- <p><strong>Invoice item price includes tax: </strong> >- [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p>[% END %] >+ <p><strong>Invoice item price includes tax: </strong> >+ [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p> >+ <p><strong>Shipping price includes tax: </strong> >+ [% IF ( shippingincgst ) %]Yes[% ELSE %]No[% END %]</p> >+ [% END %] > <p><strong>Discount: </strong> > [% discount | format("%.1f") %] %</p> > <p><strong>Tax rate: </strong> >-- >2.1.0
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 11062
:
28891
|
31033
|
35994
| 35995 |
35996