Page 1 of 1

[Solved]Need to change Invoice to apply to german law

Posted: 30 Mar 2012, 19:52
by Nukem36
Hi!

I'm using the IDnR plugin quiet a long time now and have to change the invoice, cause of german laws:

If a customer order 2 items (1 with 19% ax and another 1 book with 7% tax) this must be visible one the invoice. I found out, that in plugins/phocapdf/virtuemart/ file virtuemartpdfoutput.php should be changed. I think lines 140-145 should be the right ones, looking like this:

Code: Select all

			if($type == 'invoice' || $type == 'receipt') {
				$i[$j]['price_without_tax']['item']	= $CURRENCY_DISPLAY->getFullValue($price_without_tax['item'], '', $c);
				$i[$j]['price_without_tax']['sum']	= $CURRENCY_DISPLAY->getFullValue($price_without_tax['sum'], '', $c);
				$i[$j]['price_tax']['sum']			= $CURRENCY_DISPLAY->getFullValue($price_tax['sum'], '', $c);
				$i[$j]['price_with_tax']['sum']		= $CURRENCY_DISPLAY->getFullValue($price_with_tax['sum'], '', $c);
What I couldn't find out is: what code do I have to add/change to get the pricetax f.e. 1,45€ and a text like; (7% tax)

It would be greate if anyone could give me a solution or a hint

Regards
Nukem36

Re: Need to change Invoice to apply to german law

Posted: 31 Mar 2012, 17:35
by Nukem36
Hi!

just to inform what I did up to here: I made an update to the newest com_phocainstall_vm, what went fine. Unfortunatly my problem is not solved.

Thanks for any help or hint!

Regards
Nukem36

Re: Need to change Invoice to apply to german law

Posted: 03 Apr 2012, 00:05
by Jan
Did you try to change it directly on the server?

Re: Need to change Invoice to apply to german law

Posted: 09 Apr 2012, 20:06
by Nukem36
Hi!

after searching around for hours and with a hint from Jan I did the changes by myself:

Edit file /plugins/phocapdf/virtuemart/virtuemartpdfoutput.php

search the following lines:

Code: Select all

$price_with_tax['item']		= $value->product_final_price;
				$price_with_tax['sum'] 		= $value->product_final_price * $value->product_quantity_delivered;
				$price_without_tax['item'] 	= $value->product_item_price;
				$price_without_tax['sum'] 	= $value->product_item_price * $value->product_quantity_delivered;
				$price_tax['item'] 		= $price_with_tax['item'] - $price_without_tax['item'];
				$price_tax['sum'] 		= $price_with_tax['sum'] - $price_without_tax['sum'];
				$without_tax['item_total'] 	+= $price_without_tax['sum'];
				$with_tax['item_total'] 	+= $price_with_tax['sum'];
				$tax['item_total'] 		+= $price_tax['sum'];
and change it to:

Code: Select all

$price_with_tax['item']		= $value->product_final_price;
				$price_with_tax['sum'] 		= $value->product_final_price * $value->product_quantity_delivered;
				$price_without_tax['item'] 	= $value->product_item_price;
				$price_without_tax['sum'] 	= $value->product_item_price * $value->product_quantity_delivered;
				$price_tax['item'] 		= $price_with_tax['item'] - $price_without_tax['item'];
				$price_tax['sum'] 		= $price_with_tax['sum'] - $price_without_tax['sum'];

[b]$price_taxrate = 100 * $price_tax['item'] / $price_without_tax['item'];[/b]

				$without_tax['item_total'] 	+= $price_without_tax['sum'];
				$with_tax['item_total'] 	+= $price_with_tax['sum'];
				$tax['item_total'] 		+= $price_tax['sum'];
The output to invoice is in line ~150. Search for this code:

Code: Select all

				$i[$j]['price_without_tax']['item']	= $CURRENCY_DISPLAY->getFullValue($price_without_tax['item'], '', $c);
				$i[$j]['price_without_tax']['sum']	= $CURRENCY_DISPLAY->getFullValue($price_without_tax['sum'], '', $c);
				$i[$j]['price_tax']['sum']			= $CURRENCY_DISPLAY->getFullValue($price_tax['sum'], '', $c);
				$i[$j]['price_with_tax']['sum']		= $CURRENCY_DISPLAY->getFullValue($price_with_tax['sum'], '', $c);
and change it to:

Code: Select all

				$i[$j]['price_without_tax']['item']	= $CURRENCY_DISPLAY->getFullValue($price_without_tax['item'], '', $c);
				$i[$j]['price_without_tax']['sum']	= $CURRENCY_DISPLAY->getFullValue($price_without_tax['sum'], '', $c);
				$i[$j]['price_tax']['sum']			= $CURRENCY_DISPLAY->getFullValue($price_tax['sum'], '', $c);
[b]				$i[$j]['price_tax']['sum']		.= "\n(".round($price_taxrate)."%)";[/b]
				$i[$j]['price_with_tax']['sum']		= $CURRENCY_DISPLAY->getFullValue($price_with_tax['sum'], '', $c);

The highlighted line CALCULATES the taxrate, so its a hack and not really pretty, but should work for most cases. I used this cause otherwise I would have to change a lot of code, to read out the taxrate-id from VM database and searching with that ID in a new table for the value.

The output is rounded with no decimals and formatted to the german form, f.e. (7%)

Maybe this helps somebody out

Nukem36

Re: [Solved]Need to change Invoice to apply to german law

Posted: 18 Apr 2012, 21:50
by Jan
Hi, thank you very much for the guide.

Jan

Re: [Solved]Need to change Invoice to apply to german law

Posted: 10 Jan 2013, 22:57
by Kevin
Hi Nukem, Hi Jan,

ich habe das selbe Problem. Mein Shop muss ebenfalls Rechnungen mit zwei verschiedenen MwSt. Sätzen generieren.
Leider funktioniert deine Anleitung bei mir nicht. Sobald ich die Codes wie angegeben abändere, habe ich einen Fehler und es werden keine PDF`s mehr erstellt.

Gibt es vielleicht noch eine andere Lösung für dieses Problem?

Gruß Kevin

Re: [Solved]Need to change Invoice to apply to german law

Posted: 11 Jan 2013, 13:25
by Jan
Ja, leider muss da der Fehler identifiert, sonst weiss niemand was da passiert :-( :-(

Jan