A QCodo powered CMS
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.

81 lines
2.2 KiB

  1. <?php
  2. if(!defined('QUINTACMS') ) die("No quinta.");
  3. if (!defined("ORDERTOTALSCONTROLLER.CLASS.PHP")){
  4. define("ORDERTOTALSCONTROLLER.CLASS.PHP",1);
  5. /**
  6. * Class OrderTotalsController - display totals summary for an order.
  7. *@author Erik Winn <sidewalksoftware@gmail.com>
  8. *
  9. *@version 0.3
  10. *
  11. *@package Quinta
  12. * @subpackage Modules
  13. */
  14. class OrderTotalsController extends QPanel{
  15. protected $objOrder;
  16. protected $blnShowTitle;
  17. public $lblSubTotal;
  18. public $lblTax;
  19. public $lblShipping;
  20. public $lblHandling;
  21. public $lblGrandTotal;
  22. public function __construct($objParentObject,
  23. $objOrder,
  24. $blnShowTitle = true,
  25. $strControlId = null)
  26. {
  27. try {
  28. parent::__construct($objParentObject, $strControlId);
  29. } catch (QCallerException $objExc) {
  30. $objExc->IncrementOffset();
  31. throw $objExc;
  32. }
  33. $this->blnShowTitle = $blnShowTitle;
  34. $this->strTemplate = __QUINTA_CORE_VIEWS__ . '/OrderTotalsController.tpl.php';
  35. $this->lblSubTotal = new QLabel($this);
  36. $this->lblTax = new QLabel($this);
  37. $this->lblShipping = new QLabel($this);
  38. $this->lblHandling = new QLabel($this);
  39. $this->lblGrandTotal = new QLabel($this);
  40. $this->SetTotals($objOrder);
  41. }
  42. public function SetTotals($objOrder){
  43. $this->objOrder =& $objOrder;
  44. $this->lblSubTotal->Text = money_format('%n', $objOrder->ProductTotalCharged);
  45. if($objOrder->Tax > 0)
  46. $this->lblTax->Text = money_format('%n', $objOrder->Tax);
  47. if($objOrder->ShippingCharged > 0)
  48. $this->lblShipping->Text = money_format('%n', $objOrder->ShippingCharged);
  49. if($objOrder->HandlingCharged > 0)
  50. $this->lblHandling->Text = money_format('%n', $objOrder->HandlingCharged);
  51. $fltTotal = $objOrder->ProductTotalCharged
  52. + $objOrder->ShippingCharged
  53. + $objOrder->HandlingCharged
  54. + $objOrder->Tax;
  55. $this->lblGrandTotal->Text = money_format('%n', $fltTotal);
  56. }
  57. public function __get($strName){
  58. switch ($strName){
  59. case 'ShowTitle':
  60. return $this->blnShowTitle ;
  61. default:
  62. try {
  63. return parent::__get($strName);
  64. } catch (QCallerException $objExc) {
  65. $objExc->IncrementOffset();
  66. throw $objExc;
  67. }
  68. }
  69. }
  70. }//end class
  71. }//end define
  72. ?>