Jump to content

Archived

This topic is now archived and is closed to further replies.

helohelo

invoice and VAT rules thats legal for European Uni

Recommended Posts

Hello JeanLuc,

 

in your instructions you mention:

 

======================================================

For those who want taxes automatically if the conditions below are OK:

the billing company field is not NULL

AND

the billing tva_intracom field is not NULL

AND

the billing country is different than the STORE_COUNTRY

AND

the delivery country is different than the STORE_COUNTRY

 

You can pick up the following files: catalog/includes/classes/order.php and catalog/includes/modules/order_total/ot_shipping.php on the forum of osCommerce.com and replace yours.

have a look here: http://forums.oscommerce.com/index.php?showtopic=76315

======================================================

 

However, I can't find these files in this thread. I have looked through all pages.

 

I have the following problem. A customer who did NOT enter a company name and did NOT enter a VAT-ID is NOT being charged vat. But! he should be. Is this an issue or have I done something wrong?

 

regards

tina

Does you're problem appear when you installed the contribution?

I don't think so because there is no changes concerning the calculation of taxes in the contribution...

The code concerning the prices with or without VAT is in this topic:

For the products prices in catalog/includes/classes/order.php: post on Feb 9 2004, 06:45 PM

For the shipping costs in catalog/includes/modules/order_total/ot_shipping.php: post on Jun 28 2004, 12:53 PM

 

BUT FIRST, I suggest you to remove the contribution (just comment all the codes you added) and see if the pb is still here...

 

Regards


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

thanks jeanLuc, seems you are right. I removed your contribution and am still having that pb, which wasnt there yesterday. Guess I messed up somewhere. So now I will go hunting ;)

Share this post


Link to post
Share on other sites

I hope i'm posting in the right thread, if not my appologies.

 

I've installed the TVA 4.1_1 contribution and it's working fine for me, but i would like it when the customers VAT number is visible in the admin section on the order, invoice and packinslip screens. I don't know wich code to add so the VAT number will visible, the Shops VAT number is displayed correct, so i suppose is wouldn't be too hard. (anyway, it's hard for me, i'm a complete PHP n00b :( )

 

When looking at admin/orders.php i see the following line:

            <td class="main"><?php echo TVA_SHOP_INTRACOM; ?></td>

 

I suppose the customers VAT number can be made visible likewise ? I hope someone can help me.

 

With kindest regards,

 

Martin

Share this post


Link to post
Share on other sites

Funny enough I have had this contribition(excellent at that ;)) running for a while now and I have never noticed that the vat number wasn't visible in the admin up unitl last week, this isn't good news, any ideas what is going on?

 

Andrew

 

 

I hope i'm posting in the right thread, if not my appologies.

 

I've installed the TVA 4.1_1 contribution and it's working fine for me, but i would like it when the customers VAT number is visible in the admin section on the order, invoice and packinslip screens. I don't know wich code to add so the VAT number will visible, the Shops VAT number is displayed correct, so i suppose is wouldn't be too hard. (anyway, it's hard for me, i'm a complete PHP n00b :( )

 

When looking at admin/orders.php i see the following line:

 ? ? ? ? ? ?<td class="main"><?php echo TVA_SHOP_INTRACOM; ?></td>

 

I suppose the customers VAT number can be made visible likewise ? I hope someone can help me.

 

With kindest regards,

 

Martin

Share this post


Link to post
Share on other sites
Funny enough I have had this contribition(excellent at that ;)) running for a while now and I have never noticed that the vat number wasn't visible in the admin up unitl last week, this isn't good news, any ideas what is going on?

 

Andrew

 

Well, i think that you haven't filled in the VAT number of your shop in de admin section. The VAT number displayed is that of your shop and not your customers VAT number. That's also my question above, how can I alter the code so the cutomers VAT wil be displayed also on invoice etc. in the admin section. ;)

Share this post


Link to post
Share on other sites

I don't understand how can it be...

 

The contrib normally displays the customers' VAT number in the orders, invoices or packingslips.

The number appears in the last line of the billing address...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites
I don't understand how can it be...

 

The contrib normally displays the customers' VAT number in the orders, invoices or packingslips.

The number appears in the last line of the billing address...

 

I've added the contribution manually because i've had some other contributions installed allready. I will double check it, maybe i've made a mistake somewhere.

 

Martin.

Share this post


Link to post
Share on other sites
I've added the contribution manually because i've had some other contributions installed allready. I will double check it, maybe i've made a mistake somewhere.

 

Martin.

 

Hi lampje, Hi jean Luc,

I also try for decaded to impliment the COSTUMER VAt nr in the invoice etc. But its not there. Sure the SHOPOWNER VATnumber is in there. But Jean Luc, you indeed have the COSTUMER VAt nr in the invoice?

 

lampje if you find what it is, please share your solution with us?


Keesjan

Share this post


Link to post
Share on other sites
Hi lampje, Hi jean Luc,

I also try for decaded to impliment the COSTUMER VAt nr in the invoice etc. But its not there. Sure the SHOPOWNER VATnumber is in there. But Jean Luc, you indeed have the COSTUMER VAt nr in the invoice?

 

lampje if you find what it is, please share your solution with us?

 

Unfortunately i'm unable to locate the problem, since my knowledge about PHP is about '0,000001' ;)

 

I had the contrib installed in it's original form on a early backup off my shop with no other contribs installed and i encounter the same problem. So I think we have to ask the author nicely if he can fix it/implement it for us.

Until then i have to make seperate invoices for my B2B customers, it aren't that many yet, but it would be a pain in the ass when that number increases. So hereby i recommend it for the following update. ;)

 

Martin

Share this post


Link to post
Share on other sites
I had the contrib installed in it's original form on a early backup off my shop with no other contribs installed and i encounter the same problem. So I think we have to ask the author nicely if he can fix it/implement it for us.

Until then i have to make seperate invoices for my B2B customers, it aren't that many yet, but it would be a pain in the ass when that number increases. So hereby i recommend it for the following update. ;)

 

Martin

 

Just verify that you modified the code as explained in the install.txt file especially :

in admin/includes/functions/general.php (the tep_address_format() function in two places);

in admin/includes/classes/orders.php;

in admin/includes/invoice.php;

in admin/includes/packingslip.php

 

I checked all the instructions: everything seems OK in the install file... :-"


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites
Just verify that you modified the code as explained in the install.txt file especially :

in admin/includes/functions/general.php (the tep_address_format() function in two places);

I checked all the instructions: everything seems OK in the install file... :-"

 

Could you explain what you mean with:

 

(the tep_address_format() function in two places) ?

 

I tried several times in different ways to implement the contribution, but the result is always the same, the VAT number won't show up in the adres fields in the admin section. Strange thing is that it does show up like it should in the catalog section when the customer places the order.

Share this post


Link to post
Share on other sites
(the tep_address_format() function in two places) ?
In the tep_address_format() function, there is 2 places where you must add or replace code:
=========================================================

In admin / includes / functions / general.php

 

 

After these lines (around 341):

 

? function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {

? ? $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'");

? ? $address_format = tep_db_fetch_array($address_format_query);

 

? ? $company = tep_output_string_protected($address['company']);

 

Add:

 

//BOF for VAT INTRACOM_v3.3

? $tva_intracom = tep_output_string_protected($address['tva_intracom']);

// EOF for TVA_INTRACOM_v3.3

 

---------------------------------

 

After these lines (around 403):

 

? ? $fmt = $address_format['format'];

? ? eval("\$address = \"$fmt\";");

 

Replace:

if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) {

? ? ? ? $address = $company . $cr . $address;

? ?  }

 

By:

 

// Nouveau code pour TVA_INTRACOM_v3.3

? ? if (ACCOUNT_COMPANY == 'true') {

?  if (tep_not_null($company)) {

? ? ?  $address = $company . $cr . $address;

? ?  }

?  if (tep_not_null($tva_intracom)) {

? ? ?  $address = $address . $cr . ENTRY_TVA_INTRACOM . $cr . $tva_intracom;

? ?  }

? }

// EOF


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

Ok, I give up. Probbably i'm doing something wrong, but I just can't get it to work.

 

I tried to install an fresh oscommerce and copied the supplied files in de contribution file into the right directories. I also tried every older version of the contribution, but still no luck. I think it has something to do with my lack of knowledge of PHP and won't bother you with it any longer since the code is ok like you said. Only strange thing is that the vat number displays correctly in the confirmation mail etc. So it's working partial.

 

Thanks so far for your help!

 

With kindest regards, Martin

Share this post


Link to post
Share on other sites

Hi JeanLuc,

 

i've been fiddling around with the code a little bit and found out that the VAT number isn't display when it is equal to NULL. When i disabled that check the VAT number still wasn't visible, but the description was visible, so I concluded thet VAT number must be NULL for some reason. Strange thing is that de VAT number is visible in the adresses wich are in the checkout_payment en checkout_shipping BUT in the last screen when completing an order it is gone, so in checkout_confirmation the VAT number has disappeared from the adress. Maybe you have an idea what could be wrong now I provided this info.

I like your contribution very much, and allthough i said i give up, i'm quite stuborn :lol:

 

Sincerely Lampje

 

p.s. Forgive my bad english......

Share this post


Link to post
Share on other sites
p.s. Forgive my bad english......
Are you kidding... :blush: Didn't you notice mine...

 

Finally I think I found the pb...

Since the beginning of this contribution (version 1.0... :blush: :-" ), I notice an error in the install.txt file : The modification in the catalog/includes/classes/order.php file is not explained....but it should have been done...

The modification in the catalog/admin/includes/classes/order.php file must to be done also in the catalog/includes/classes/order.php file.

It's exactly the same so you must read in you're install.txt file:

========================================================

In catalog/admin/includes/classes/order.php

AND in catalog/includes/classes/order.php

 

After that line (around 26):

 

? ? function query($order_id)

{

 

Add database field "billing_tva_intracom" in the following request:

 

// We have added "billing_tva_intracom" for VAT INTRACOM_v3.3

? ? ? $order_query = tep_db_query("select customers_name, customers_company,

customers_street_address, customers_suburb, customers_city,

customers_postcode, customers_state, customers_country, customers_telephone,

customers_email_address, customers_address_format_id, delivery_name,

delivery_company, delivery_street_address, delivery_suburb, delivery_city,

delivery_postcode, delivery_state, delivery_country,

delivery_address_format_id, billing_name, billing_company,

billing_tva_intracom, billing_street_address, billing_suburb, billing_city,

billing_postcode, billing_state, billing_country, billing_address_format_id,

payment_method, cc_type, cc_owner, cc_number, cc_expires, currency,

currency_value, date_purchased, orders_status, last_modified from " .

TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

 

 

---------------------------------

 

After these lines (around 70):

 

? ? ? $this->billing = array('name' => $order['billing_name'],

? ? ? ? ? ? ? ? ? ? ? ? ? ?  'company' => $order['billing_company'],

 

Add:

 

//BOF for VAT INTRACOM_v3.3

? 'tva_intracom' => $order['billing_tva_intracom'],

// EOF for TVA_INTRACOM_v3.3

 

=================================

 

I'm sorry about this oversight .... :blush:

I was always testing the contribution in my correct installation where the modification is done....

I put a correction in the contribution section immediately... :-"

 

Regards...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites
Are you kidding... :blush: Didn't you notice mine...

 

Finally I think I found the pb...

Since the beginning of this contribution (version 1.0... :blush:  :-" ), I notice an error in the install.txt file : The modification in the catalog/includes/classes/order.php file is not explained....but it should have been done...

The modification in the catalog/admin/includes/classes/order.php file must to be done also in the catalog/includes/classes/order.php file.

It's exactly the same so you must read in you're install.txt file:

I'm sorry about this oversight .... :blush:

I was always testing the contribution in my correct installation where the modification is done....

I put a correction in the contribution section immediately... :-"

 

Regards...

 

GREAT ! Thanks a 1000 x

Maybe your english isn't that good(Not that I can judge that), but yur PHP skills make up for that 100%

I don't have time right now to try it, but i am confident your right in your sollution.

 

Merci Beaucoup!

?a c'est fantastique et c'est tress formidable.

 

Martin

Share this post


Link to post
Share on other sites

I'm sorry, the modifications which have to be done in the catalog/includes/classes/order.php file are different from those in the catalog/admin/includes/classes/order.php file.

 

You must do this in catalog/includes/classes/order.php:

 

========================================================

In catalog/includes/classes/order.php

 

 

After those lines (around 34):

 

    function query($order_id) {

      global $languages_id;

 

      $order_id = tep_db_prepare_input($order_id);

 

Add database field "billing_tva_intracom" in the following request:

 

      //Add for TVA_intracom : "billing_tva_intracom"

      $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_tva_intracom, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

     

---------------------------------

 

After these lines (around 93):

 

      $this->billing = array('name' => $order['billing_name'],

                            'company' => $order['billing_company'],

 

Add:

 

//BOF for VAT INTRACOM

  'tva_intracom' => $order['billing_tva_intracom'],

// EOF for TVA_INTRACOM

 

---------------------------------

 

After those lines (around 141):

 

    function cart() {

      global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment;

 

      $this->content_type = $cart->get_content_type();

 

Add database field "ab.entry_tva_intracom" in the following request:

 

      //Add for TVA_intracom : "ab.entry_tva_intracom"

      $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");

 

 

---------------------------------

After this line (around 146):

 

      $shipping_address = tep_db_fetch_array($shipping_address_query);

 

Add database field "ab.entry_tva_intracom" in the following request:

 

      $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");

 

 

---------------------------------

 

After those lines (around 212):

 

      $this->billing = array('firstname' => $billing_address['entry_firstname'],

                            'lastname' => $billing_address['entry_lastname'],

                            'company' => $billing_address['entry_company'],

 

Add:

 

//BOF for VAT INTRACOM

  'tva_intracom' => $billing_address['entry_tva_intracom'],

// EOF for TVA_INTRACOM

 

 

 

=================================

 

Regards


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

SOLVED - had forgotten to edit checkout_process - oops :)

--

Hi - thanks for a great contribution.

 

I have a "minor" problem thats actually rather bad :(

 

It all works well, when I make the order - VAT is deducted if correct VAT-nr. is entered etc.

When the order is concluded - the field billing_tva_intracom is set to NULL - and I haven't been able to find where this field is set to see why this has not been set with the VAT-nr. given.

 

Any hints as to where I might look for this?

 

Thank you in advance

Share this post


Link to post
Share on other sites

In checkout_process.php (around line 80), there is a line added by the contribution in the array "$sql_data_array":

// Ajout pour TVA_INTRACOM_v3.0
? 'billing_tva_intracom' => $order->billing['tva_intracom'],
// Fin ajout pour TVA_INTRACOM_v3.0

 

Be sure you've done this modification correctly...


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

Hello ,

 

I can I fix the VAT value with this module ?

 

Ex , I would like to define 21% for belgium

 

Is this module calculate automatically the price if the vat number is present and the country of the delivery is not the same as the shipper country

 

Regards

Share this post


Link to post
Share on other sites

Hi JeanLuc and others,

 

I messed up my taxes (they wehere counted twice = 19 +19%)

 

So this is fixed now but the vat setings are working no more correct (see below). Sorry to bother you with this and I explaned it to others many times but I cannot fix it now:

 

I set up:

 

Tax Zones

Europe

Netherlands ( my countrey)

Rest Of World

 

Tax Classes

no tax

taxable electronic services

taxable electronic services (Netherlands)

 

Tax Rates

 

Tax Class Zone Tax Rate

taxable electronic services (Netherlands) Netherlands 19.00%

taxable electronic services Europe 19.00%

no tax Rest Of World 0.00%

 

Is this ok?

 

My problem:

When I test with the Danish (correct) vat number DE228861723 as VAT and as shop country Denmark I get prices with vat = this is ok When I change the shop county to Netherlands prices are also with Vat. This is not correct; client is Eu country with correct vat and not from same country as shop owner (Netherlands) so prices should be without vat.

 

Next tests all with shop owner country set to Netherlands.

 

Test Denmark shopper without vat = prices are set with vat = correct.

 

Test denmark shopper with correct vat = prices are set with vat = incorrect, should be with vat.

 

Test non eu shopper without vat = prices are set without vat = correct.

 

Test netherland shopper without vat = prices are set without vat = incorrect, should be with vat.

 

Test Netherlands with correct vat = prices are set without vat = incorrect, should be with vat.


Keesjan

Share this post


Link to post
Share on other sites
Hello ,

 

I can I fix the VAT value with this module ?

 

Ex , I would like to define 21% for belgium

 

Is this module calculate automatically the price if the vat number is present and the country of the delivery is not the same as the shipper country

 

Regards

 

That's right with the last version where the modified files for calculation of VAT are included:

The vat is not added IF:

the billing company field is not NULL

AND

the billing tva_intracom field is not NULL

AND

the billing country is different than the STORE_COUNTRY

AND

the delivery country is different than the STORE_COUNTRY

 

Regards


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites
Hi JeanLuc and others,

 

I messed up my taxes (they wehere counted twice = 19 +19%)

 

So this is fixed now but the vat setings are working no more correct (see below). Sorry to bother you with this and I explaned it to others many times but I cannot fix it now:

 

I set up:

 

Tax Zones 

Europe 

Netherlands  ( my countrey)

Rest Of World

 

Tax Classes

no tax 

taxable electronic services 

taxable electronic services (Netherlands)

 

Tax Rates 

 

Tax                                                      Class Zone                Tax Rate

taxable electronic services (Netherlands)  Netherlands                19.00% 

taxable electronic services                      Europe                      19.00% 

no tax                                                    Rest Of World              0.00% 

 

Is this ok?

 

My problem:

When I test with the Danish (correct) vat number DE228861723 as VAT and as shop country Denmark I get prices with vat = this is ok When I change the shop county to Netherlands prices are also with Vat. This is not correct; client is Eu country with correct vat and not from same country as shop owner (Netherlands) so prices should be without vat.

 

Next tests all with shop owner country set to Netherlands.

 

Test Denmark shopper without vat = prices are set with vat = correct.

 

Test denmark shopper with correct vat = prices are set with vat = incorrect, should be with vat.

 

Test non eu shopper without vat = prices are set without vat = correct.

 

Test netherland shopper without vat = prices are set without vat = incorrect, should be with vat.

 

Test Netherlands with correct vat = prices are set without vat = incorrect, should be with vat.

 

The way this contribution adds or not the vat is VERY simple:

if the below conditions are OK, VAT is NOT added:

the billing company field is not NULL

AND

the billing tva_intracom field is not NULL

AND

the billing country is different than the STORE_COUNTRY

AND

the delivery country is different than the STORE_COUNTRY

 

That's all, it is verified in catalog/includes/classes/order.php and catalog/includes/modules/order_total/ot_shipping.php....


JeanLuc

OsC: MS2

Share this post


Link to post
Share on other sites

×