Problem with invoices and customer infos...

Before you ask about IDnR Addon see the VirtueMart - Invoice, Delivery Note and Receipt Addon
Mister Paul
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 17 Aug 2010, 22:19

Problem with invoices and customer infos...

Post by Mister Paul »

Hi,
there is a problem with invoices if customer changes his infos after the order: the PDF is created with his new infos (jos_vm_user_info) instead of those when he created the order (jos_vm_order_user_info)
So the invoice could become completely incoherent (regarding VAT, ...)

I made slight modifications in administrator/components/com_virtuemart/pdf/phoca.tcpdf.php
1°BILL TO
- I inserted a request before: // begin bill to

Code: Select all

		$dbstc = new ps_DB;
		$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='BT'";
		$dbstc->query($qt);
		$dbstc->next_record();
- I mage a global find/replace : $hD['dbbt'] by $dbbtc
- changed this line for country :
$this->Cell(0,0,$hD['vmBTCountry'],0,0,'L'); replaced by: $this->Cell(0,0,$dbbtc->f("country"),0,0,'L');

2°SHIP TO
- a request before: // begin ship to

Code: Select all

		$dbstc = new ps_DB;
		$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='ST'";
		$dbstc->query($qt);
		$dbstc->next_record();
- global find/replace : $hD['dbst'] by $dbstc
- this line for country :
$this->Cell(0,0,$hD['vmSTCountry'],0,0,'L'); replaced by: $this->Cell(0,0,$dbstc->f("country"),0,0,'L');
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Problem with invoices and customer infos...

Post by Jan »

Hi, thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
Mister Paul
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 17 Aug 2010, 22:19

Re: Problem with invoices and customer infos...

Post by Mister Paul »

Oops I made an update because I didn't checked if there was no shipping to address!

Code: Select all

$dbstc = new ps_DB;
		$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='ST'";
		$dbstc->query($qt);
		$dbstc->next_record();
		
		// If there is no shipping address specified, we take the biil to address:
		if (is_null($dbstc->loadResult())) {
			$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='BT'";
			$dbstc->query($qt);
		}
:wink:
Post Reply