Re: Invoice - Delivery Note - Question
Posted: 16 Jul 2008, 05:44
Hi Jan,
I have had a little bit of time to begin looking at how I can modify this so that a user can print out an invoice from the account maintenance page. What I have done is to begin with this code:-
[code]
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @created For VirtueMart 1.1 created by Jan Pavelka
* @info https://www.phoca.cz/
* @copyright Copyright (C) 2008 Jan Pavelka. All rights reserved.
* @modified by Laurie Lewis to run from Account Maintenance for user access.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @copyright Copyright (C) 2006 Ingemar Fällman. All rights reserved.
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
global $VM_LANG, $mosConfig_live_site;
$order_id = vmGet( $_REQUEST, 'order_id', 0);
// Get Order information
$dbo =& new ps_DB;
$q = "SELECT * FROM #__{vm}_orders WHERE ";
$q .= "#__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id'";
$dbo->query($q);
if ($dbo->next_record()) {
$user_id = $dbo->f("user_id");
// Get Vendor_to information
$dbv = new ps_DB;
$q = "SELECT * from #__{vm}_vendor ";
$q .= "WHERE vendor_id = '".$_SESSION['ps_vendor_id']."'";
$dbv->query($q);
$dbv->next_record();
// Get Bill_To information
$dbbt = new ps_DB;
$q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id ='$order_id ' ";
$q .= "AND address_type='BT' " ;
$dbbt->query($q);
$dbbt->next_record();
// Get Ship_To information
$dbst = new ps_DB;
$q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id='$order_id' ";
$q .= "AND address_type='ST' " ;
$dbst->query($q);
$dbst->next_record();
// Retrieve Payment Information
$dbpm = new ps_DB;
$q = "SELECT * FROM `#__{vm}_payment_method`, `#__{vm}_order_payment`, `#__{vm}_orders` ";
$q .= "WHERE #__{vm}_order_payment.order_id='$order_id' ";
$q .= "AND #__{vm}_payment_method.payment_method_id=#__{vm}_order_payment.payment_method_id ";
$q .= "AND #__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id' ";
$dbpm->query($q);
$dbpm->next_record();
require_once( JPATH_COMPONENT.DS.'pdf'.DS.'delivery.pdf.php' );
PhocaDeliveryPDF::createPDF( $VM_LANG, $d, $dbv, $dbo, $dbbt, $dbst, $dbpm, $current_admin_user, $obliterated, $doc);
if ($doc =='') {
exit;
} else {
return true;
}
}
else
{
echo '<h4>'._LOGIN_TEXT .'</h4><br/>';
include(PAGEPATH.'checkout.login_form.php');
echo '<br/><br/>';
}
?>
[/code]
but, unfortunately I have this error message coming up. I have put xampp onto the laptop while I am away from the office and looking at this so not sure if that is the problem, but here is the error message:-
[quote]
Warning: require_once(C:\xampp\htdocs\mdh_test\components\com_virtuemart\pdf\delivery.pdf.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\mdh_test\administrator\components\com_virtuemart\html\account.order_pdf.php on line 64
Fatal error: require_once() [function.require]: Failed opening required 'C:\xampp\htdocs\mdh_test\components\com_virtuemart\pdf\delivery.pdf.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\mdh_test\administrator\components\com_virtuemart\html\account.order_pdf.php on line 64
[/quote]
any ideas???
Thanks
Laurie
I have had a little bit of time to begin looking at how I can modify this so that a user can print out an invoice from the account maintenance page. What I have done is to begin with this code:-
[code]
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @created For VirtueMart 1.1 created by Jan Pavelka
* @info https://www.phoca.cz/
* @copyright Copyright (C) 2008 Jan Pavelka. All rights reserved.
* @modified by Laurie Lewis to run from Account Maintenance for user access.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @copyright Copyright (C) 2006 Ingemar Fällman. All rights reserved.
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
global $VM_LANG, $mosConfig_live_site;
$order_id = vmGet( $_REQUEST, 'order_id', 0);
// Get Order information
$dbo =& new ps_DB;
$q = "SELECT * FROM #__{vm}_orders WHERE ";
$q .= "#__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id'";
$dbo->query($q);
if ($dbo->next_record()) {
$user_id = $dbo->f("user_id");
// Get Vendor_to information
$dbv = new ps_DB;
$q = "SELECT * from #__{vm}_vendor ";
$q .= "WHERE vendor_id = '".$_SESSION['ps_vendor_id']."'";
$dbv->query($q);
$dbv->next_record();
// Get Bill_To information
$dbbt = new ps_DB;
$q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id ='$order_id ' ";
$q .= "AND address_type='BT' " ;
$dbbt->query($q);
$dbbt->next_record();
// Get Ship_To information
$dbst = new ps_DB;
$q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id='$order_id' ";
$q .= "AND address_type='ST' " ;
$dbst->query($q);
$dbst->next_record();
// Retrieve Payment Information
$dbpm = new ps_DB;
$q = "SELECT * FROM `#__{vm}_payment_method`, `#__{vm}_order_payment`, `#__{vm}_orders` ";
$q .= "WHERE #__{vm}_order_payment.order_id='$order_id' ";
$q .= "AND #__{vm}_payment_method.payment_method_id=#__{vm}_order_payment.payment_method_id ";
$q .= "AND #__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id' ";
$dbpm->query($q);
$dbpm->next_record();
require_once( JPATH_COMPONENT.DS.'pdf'.DS.'delivery.pdf.php' );
PhocaDeliveryPDF::createPDF( $VM_LANG, $d, $dbv, $dbo, $dbbt, $dbst, $dbpm, $current_admin_user, $obliterated, $doc);
if ($doc =='') {
exit;
} else {
return true;
}
}
else
{
echo '<h4>'._LOGIN_TEXT .'</h4><br/>';
include(PAGEPATH.'checkout.login_form.php');
echo '<br/><br/>';
}
?>
[/code]
but, unfortunately I have this error message coming up. I have put xampp onto the laptop while I am away from the office and looking at this so not sure if that is the problem, but here is the error message:-
[quote]
Warning: require_once(C:\xampp\htdocs\mdh_test\components\com_virtuemart\pdf\delivery.pdf.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\mdh_test\administrator\components\com_virtuemart\html\account.order_pdf.php on line 64
Fatal error: require_once() [function.require]: Failed opening required 'C:\xampp\htdocs\mdh_test\components\com_virtuemart\pdf\delivery.pdf.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\mdh_test\administrator\components\com_virtuemart\html\account.order_pdf.php on line 64
[/quote]
any ideas???
Thanks
Laurie