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.

185 lines
8.2 KiB

13 years ago
  1. <?php
  2. /**
  3. * AccountOrderEditPanel - provides a panel for user viewing and modification of a specific
  4. * order
  5. *
  6. *@author Erik Winn <erikwinnmail@yahoo.com>
  7. *
  8. *
  9. * $Id: AccountOrderEditPanel.class.php 286 2008-10-10 23:33:36Z erikwinn $
  10. *@version 0.1
  11. *
  12. *@copyright (C) 2008 by Erik Winn
  13. *@license GPL v.2
  14. This program is free software; you can redistribute it and/or modify
  15. it under the terms of the GNU General Public License as published by
  16. the Free Software Foundation; either version 2 of the License, or
  17. (at your option) any later version.
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. GNU General Public License for more details.
  22. You should have received a copy of the GNU General Public License
  23. along with this program; if not, write to the Free Software
  24. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
  25. *
  26. * @package Quasi
  27. * @subpackage Classes
  28. */
  29. class AccountOrderEditPanel extends QPanel
  30. {
  31. // Local instance of the OrderMetaControl
  32. protected $mctOrder;
  33. protected $objControlBlock;
  34. // Controls for Order's Data Fields
  35. public $lblId;
  36. public $lstAccount;
  37. public $lblCreationDate;
  38. public $lblLastModificationDate;
  39. public $lblCompletionDate;
  40. public $txtShippingCost;
  41. public $txtProductTotalCost;
  42. public $txtShippingCharged;
  43. public $txtHandlingCharged;
  44. public $txtTax;
  45. public $txtProductTotalCharged;
  46. public $txtShippingNamePrefix;
  47. public $txtShippingFirstName;
  48. public $txtShippingMiddleName;
  49. public $txtShippingLastName;
  50. public $txtShippingNameSuffix;
  51. public $txtShippingStreet1;
  52. public $txtShippingStreet2;
  53. public $txtShippingSuburb;
  54. public $txtShippingCounty;
  55. public $txtShippingCity;
  56. public $lstShippingZone;
  57. public $lstShippingCountry;
  58. public $txtShippingPostalCode;
  59. public $txtBillingNamePrefix;
  60. public $txtBillingFirstName;
  61. public $txtBillingMiddleName;
  62. public $txtBillingLastName;
  63. public $txtBillingNameSuffix;
  64. public $txtBillingStreet1;
  65. public $txtBillingStreet2;
  66. public $txtBillingSuburb;
  67. public $txtBillingCounty;
  68. public $txtBillingCity;
  69. public $lstBillingZone;
  70. public $lstBillingCountry;
  71. public $txtBillingPostalCode;
  72. public $txtNotes;
  73. public $lstShippingMethod;
  74. public $lstStatus;
  75. // Other Controls
  76. public $btnSave;
  77. public $btnBack;
  78. // Callback
  79. protected $strClosePanelMethod;
  80. public function __construct($objParentObject,
  81. $objControlBlock,
  82. $strClosePanelMethod,
  83. $intId = null,
  84. $strControlId = null)
  85. {
  86. try {
  87. parent::__construct($objParentObject, $strControlId);
  88. } catch (QCallerException $objExc) {
  89. $objExc->IncrementOffset();
  90. throw $objExc;
  91. }
  92. $this->objControlBlock =& $objControlBlock;
  93. $this->strTemplate = __QUASI_CORE_TEMPLATES__ . '/AccountOrderEditPanel.tpl.php';
  94. $this->strClosePanelMethod = $strClosePanelMethod;
  95. $this->mctOrder = OrderMetaControl::Create($this, $intId);
  96. $this->lblId = $this->mctOrder->lblId_Create();
  97. $this->lstAccount = $this->mctOrder->lstAccount_Create();
  98. $this->lblCreationDate = $this->mctOrder->lblCreationDate_Create();
  99. $this->lblLastModificationDate = $this->mctOrder->lblLastModificationDate_Create();
  100. $this->lblCompletionDate = $this->mctOrder->lblCompletionDate_Create();
  101. $this->txtShippingCost = $this->mctOrder->txtShippingCost_Create();
  102. $this->txtProductTotalCost = $this->mctOrder->txtProductTotalCost_Create();
  103. $this->txtShippingCharged = $this->mctOrder->txtShippingCharged_Create();
  104. $this->txtHandlingCharged = $this->mctOrder->txtHandlingCharged_Create();
  105. $this->txtTax = $this->mctOrder->txtTax_Create();
  106. $this->txtProductTotalCharged = $this->mctOrder->txtProductTotalCharged_Create();
  107. $this->txtShippingNamePrefix = $this->mctOrder->txtShippingNamePrefix_Create();
  108. $this->txtShippingFirstName = $this->mctOrder->txtShippingFirstName_Create();
  109. $this->txtShippingMiddleName = $this->mctOrder->txtShippingMiddleName_Create();
  110. $this->txtShippingLastName = $this->mctOrder->txtShippingLastName_Create();
  111. $this->txtShippingNameSuffix = $this->mctOrder->txtShippingNameSuffix_Create();
  112. $this->txtShippingStreet1 = $this->mctOrder->txtShippingStreet1_Create();
  113. $this->txtShippingStreet2 = $this->mctOrder->txtShippingStreet2_Create();
  114. $this->txtShippingSuburb = $this->mctOrder->txtShippingSuburb_Create();
  115. $this->txtShippingCounty = $this->mctOrder->txtShippingCounty_Create();
  116. $this->txtShippingCity = $this->mctOrder->txtShippingCity_Create();
  117. $this->lstShippingZone = $this->mctOrder->lstShippingZone_Create();
  118. $this->lstShippingCountry = $this->mctOrder->lstShippingCountry_Create();
  119. $this->txtShippingPostalCode = $this->mctOrder->txtShippingPostalCode_Create();
  120. $this->txtBillingNamePrefix = $this->mctOrder->txtBillingNamePrefix_Create();
  121. $this->txtBillingFirstName = $this->mctOrder->txtBillingFirstName_Create();
  122. $this->txtBillingMiddleName = $this->mctOrder->txtBillingMiddleName_Create();
  123. $this->txtBillingLastName = $this->mctOrder->txtBillingLastName_Create();
  124. $this->txtBillingNameSuffix = $this->mctOrder->txtBillingNameSuffix_Create();
  125. $this->txtBillingStreet1 = $this->mctOrder->txtBillingStreet1_Create();
  126. $this->txtBillingStreet2 = $this->mctOrder->txtBillingStreet2_Create();
  127. $this->txtBillingSuburb = $this->mctOrder->txtBillingSuburb_Create();
  128. $this->txtBillingCounty = $this->mctOrder->txtBillingCounty_Create();
  129. $this->txtBillingCity = $this->mctOrder->txtBillingCity_Create();
  130. $this->lstBillingZone = $this->mctOrder->lstBillingZone_Create();
  131. $this->lstBillingCountry = $this->mctOrder->lstBillingCountry_Create();
  132. $this->txtBillingPostalCode = $this->mctOrder->txtBillingPostalCode_Create();
  133. $this->txtNotes = $this->mctOrder->txtNotes_Create();
  134. $this->lstShippingMethod = $this->mctOrder->lstShippingMethod_Create();
  135. $this->lstStatus = $this->mctOrder->lstStatus_Create();
  136. $this->btnSave = new QButton($this);
  137. $this->btnSave->Text = Quasi::Translate('Save');
  138. if(IndexPage::$blnAjaxOk)
  139. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  140. else
  141. $this->btnSave->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnSave_Click'));
  142. $this->btnSave->CausesValidation = $this;
  143. $this->btnBack = new QButton($this);
  144. $this->btnBack->Text = Quasi::Translate('Back');
  145. if(IndexPage::$blnAjaxOk)
  146. $this->btnBack->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnBack_Click'));
  147. else
  148. $this->btnBack->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnBack_Click'));
  149. }
  150. public function btnSave_Click($strFormId, $strControlId, $strParameter)
  151. {
  152. $this->mctOrder->SaveOrder();
  153. $this->CloseSelf(true);
  154. }
  155. public function btnBack_Click($strFormId, $strControlId, $strParameter)
  156. {
  157. $this->CloseSelf(false);
  158. }
  159. // Close Myself and Call ClosePanelMethod Callback
  160. protected function CloseSelf($blnChangesMade)
  161. {
  162. $strMethod = $this->strClosePanelMethod;
  163. $this->objControlBlock->$strMethod($blnChangesMade);
  164. }
  165. }
  166. ?>