--- include/utils/CommonUtils.php.orig	2009-04-19 18:18:34.000000000 +0200
+++ include/utils/CommonUtils.php	2009-04-19 18:20:41.000000000 +0200
@@ -475,6 +475,29 @@ function getAccountName($account_id)
 }
 
 /**
+ * Function to get the AccountNumber when a vtiger_account id is given
+ * Takes the input as $acount_id - vtiger_account id
+ * returns the vtiger_account number in string format.
+ */
+
+function getAccountNumber($account_id)
+{
+        global $log;
+        $log->debug("Entering getAccountNumber(".$account_id.") method ...");
+        $log->info("in getAccountNumber ".$account_id);
+
+        global $adb;
+        if($account_id != '')
+        {
+                $sql = "select account_no from vtiger_account where accountid=?";
+                $result = $adb->pquery($sql, array($account_id));
+                $account_no = $adb->query_result($result,0,"account_no");
+        }
+        $log->debug("Exiting getAccountNumber method ...");
+        return $account_no;
+}
+
+/**
  * Function to get the ProductName when a product id is given 
  * Takes the input as $product_id - product id
  * returns the product name in string format.
--- include/InventoryPDF.php.orig	2009-04-19 18:21:40.000000000 +0200
+++ include/InventoryPDF.php	2009-04-19 18:24:27.000000000 +0200
@@ -31,6 +31,7 @@ function get_invoice_pdf()
 	$focus->retrieve_entity_info($_REQUEST['record'],"Invoice");
 	$focus->apply_field_security();
 	$account_name = getAccountName($focus->column_fields[account_id]);
+	$account_no = getAccountNumber($focus->column_fields[account_id]);
 	$invoice_no = $focus->column_fields[invoice_no];
 	
 	$sql="select currency_symbol from vtiger_currency_info where id=?";
@@ -595,6 +596,7 @@ function get_so_pdf() {
 	$focus->retrieve_entity_info($_REQUEST['record'],"SalesOrder");
 	$focus->apply_field_security();
 	$account_name = getAccountName($focus->column_fields[account_id]);
+	$account_no = getAccountNumber($focus->column_fields[account_id]);
 	$so_no = $focus->column_fields[salesorder_no];
 	
 	$sql="select currency_symbol from vtiger_currency_info where id=?";
@@ -883,6 +885,7 @@ function get_quote_pdf() {
 	$focus->retrieve_entity_info($_REQUEST['record'],"Quotes");
 	$focus->apply_field_security();
 	$account_name = getAccountName($focus->column_fields[account_id]);
+	$account_no = getAccountNumber($focus->column_fields[account_id]);
 	$quote_no = $focus->column_fields[quote_no];
 	
 	if($focus->column_fields["hdnTaxType"] == "individual") {
--- modules/Quotes/pdf_templates/header.php.orig	2009-04-19 18:25:37.000000000 +0200
+++ modules/Quotes/pdf_templates/header.php	2009-04-19 18:26:18.000000000 +0200
@@ -32,7 +32,7 @@ $pdf->title( $app_strings["Quote"],"", $
 
 //  Account Number
 $acctBubble=array("147","17","12");
-$pdf->addBubbleBlock($account_id, $app_strings["Account Number"], $acctBubble);
+$pdf->addBubbleBlock($account_no, $app_strings["Account Number"], $acctBubble);
 
 // page number
 $pageBubble=array("180","17",0);
