A Qcodo based CMS/ecommerce framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.6 KiB

12 years ago
  1. <?php
  2. if(!defined('QUASICMS') ) die("No quasi.");
  3. if (!defined("ORDERTOTALSVIEW.CLASS.PHP")){
  4. define("ORDERTOTALSVIEW.CLASS.PHP",1);
  5. /**
  6. * Class OrderTotalsView - display totals summary for an order.
  7. *@author Erik Winn <erikwinnmail@yahoo.com>
  8. *
  9. *
  10. * $Id: OrderTotalsView.class.php 234 2008-09-30 15:49:13Z erikwinn $
  11. *@version 0.1
  12. *
  13. *@copyright (C) 2008 by Erik Winn
  14. *@license GPL v.2
  15. This program is free software; you can redistribute it and/or modify
  16. it under the terms of the GNU General Public License as published by
  17. the Free Software Foundation; either version 2 of the License, or
  18. (at your option) any later version.
  19. This program is distributed in the hope that it will be useful,
  20. but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. GNU General Public License for more details.
  23. You should have received a copy of the GNU General Public License
  24. along with this program; if not, write to the Free Software
  25. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
  26. *
  27. *@package Quasi
  28. * @subpackage Modules
  29. */
  30. class OrderTotalsView extends QPanel
  31. {
  32. protected $objOrder;
  33. protected $blnShowTitle;
  34. public $lblSubTotal;
  35. public $lblTax;
  36. public $lblShipping;
  37. public $lblHandling;
  38. public $lblGrandTotal;
  39. public function __construct($objParentObject,
  40. $objOrder,
  41. $blnShowTitle = true,
  42. $strControlId = null)
  43. {
  44. try {
  45. parent::__construct($objParentObject, $strControlId);
  46. } catch (QCallerException $objExc) {
  47. $objExc->IncrementOffset();
  48. throw $objExc;
  49. }
  50. $this->blnShowTitle = $blnShowTitle;
  51. $this->strTemplate = __QUASI_CORE_TEMPLATES__ . '/OrderTotalsView.tpl.php';
  52. $this->lblSubTotal = new QLabel($this);
  53. $this->lblTax = new QLabel($this);
  54. $this->lblShipping = new QLabel($this);
  55. $this->lblHandling = new QLabel($this);
  56. $this->lblGrandTotal = new QLabel($this);
  57. $this->SetTotals($objOrder);
  58. }
  59. public function SetTotals($objOrder)
  60. {
  61. $this->objOrder =& $objOrder;
  62. $this->lblSubTotal->Text = money_format('%n', $objOrder->ProductTotalCharged);
  63. if($objOrder->Tax > 0)
  64. $this->lblTax->Text = money_format('%n', $objOrder->Tax);
  65. if($objOrder->ShippingCharged > 0)
  66. $this->lblShipping->Text = money_format('%n', $objOrder->ShippingCharged);
  67. if($objOrder->HandlingCharged > 0)
  68. $this->lblHandling->Text = money_format('%n', $objOrder->HandlingCharged);
  69. $fltTotal = $objOrder->ProductTotalCharged
  70. + $objOrder->ShippingCharged
  71. + $objOrder->HandlingCharged
  72. + $objOrder->Tax;
  73. $this->lblGrandTotal->Text = money_format('%n', $fltTotal);
  74. }
  75. public function __get($strName)
  76. {
  77. switch ($strName)
  78. {
  79. case 'ShowTitle':
  80. return $this->blnShowTitle ;
  81. default:
  82. try {
  83. return parent::__get($strName);
  84. } catch (QCallerException $objExc) {
  85. $objExc->IncrementOffset();
  86. throw $objExc;
  87. }
  88. }
  89. }
  90. }//end class
  91. }//end define
  92. ?>