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.

159 lines
6.2 KiB

  1. <?php
  2. /**
  3. * AccountOrderEditPanel - provides a panel for user viewing and modification of a specific
  4. * order
  5. *
  6. *@author Erik Winn <sidewalksoftware@gmail.com>
  7. *
  8. *@version 0.3
  9. * @package Quinta
  10. * @subpackage Classes
  11. */
  12. class AccountOrderEditPanel extends QPanel{
  13. // Local instance of the OrderMetaControl
  14. protected $mctOrder;
  15. protected $objControlBlock;
  16. // Controls for Order's Data Fields
  17. public $lblId;
  18. public $lstAccount;
  19. public $lblCreationDate;
  20. public $lblLastModification;
  21. public $lblCompletionDate;
  22. public $txtShippingCost;
  23. public $txtProductTotalCost;
  24. public $txtShippingCharged;
  25. public $txtHandlingCharged;
  26. public $txtTax;
  27. public $txtProductTotalCharged;
  28. public $txtShippingNamePrefix;
  29. public $txtShippingFirstName;
  30. public $txtShippingMiddleName;
  31. public $txtShippingLastName;
  32. public $txtShippingNameSuffix;
  33. public $txtShippingStreet1;
  34. public $txtShippingStreet2;
  35. public $txtShippingSuburb;
  36. public $txtShippingCounty;
  37. public $txtShippingCity;
  38. public $lstShippingZone;
  39. public $lstShippingCountry;
  40. public $txtShippingPostalCode;
  41. public $txtBillingNamePrefix;
  42. public $txtBillingFirstName;
  43. public $txtBillingMiddleName;
  44. public $txtBillingLastName;
  45. public $txtBillingNameSuffix;
  46. public $txtBillingStreet1;
  47. public $txtBillingStreet2;
  48. public $txtBillingSuburb;
  49. public $txtBillingCounty;
  50. public $txtBillingCity;
  51. public $lstBillingZone;
  52. public $lstBillingCountry;
  53. public $txtBillingPostalCode;
  54. public $txtNotes;
  55. public $lstShippingMethod;
  56. public $lstStatus;
  57. // Other Controls
  58. public $btnSave;
  59. public $btnBack;
  60. // Callback
  61. protected $strClosePanelMethod;
  62. public function __construct($objParentObject,
  63. $objControlBlock,
  64. $strClosePanelMethod,
  65. $intId = null,
  66. $strControlId = null)
  67. {
  68. try {
  69. parent::__construct($objParentObject, $strControlId);
  70. } catch (QCallerException $objExc) {
  71. $objExc->IncrementOffset();
  72. throw $objExc;
  73. }
  74. $this->objControlBlock =& $objControlBlock;
  75. $this->strTemplate = __QUINTA_CORE_VIEWS__ . '/AccountOrderEditPanel.tpl.php';
  76. $this->strClosePanelMethod = $strClosePanelMethod;
  77. $this->mctOrder = OrderMetaControl::Create($this, $intId);
  78. $this->lblId = $this->mctOrder->lblId_Create();
  79. $this->lstAccount = $this->mctOrder->lstAccount_Create();
  80. $this->lblCreationDate = $this->mctOrder->lblCreationDate_Create();
  81. $this->lblLastModification = $this->mctOrder->lblLastModification_Create();
  82. $this->lblCompletionDate = $this->mctOrder->lblCompletionDate_Create();
  83. $this->txtShippingCost = $this->mctOrder->txtShippingCost_Create();
  84. $this->txtProductTotalCost = $this->mctOrder->txtProductTotalCost_Create();
  85. $this->txtShippingCharged = $this->mctOrder->txtShippingCharged_Create();
  86. $this->txtHandlingCharged = $this->mctOrder->txtHandlingCharged_Create();
  87. $this->txtTax = $this->mctOrder->txtTax_Create();
  88. $this->txtProductTotalCharged = $this->mctOrder->txtProductTotalCharged_Create();
  89. $this->txtShippingNamePrefix = $this->mctOrder->txtShippingNamePrefix_Create();
  90. $this->txtShippingFirstName = $this->mctOrder->txtShippingFirstName_Create();
  91. $this->txtShippingMiddleName = $this->mctOrder->txtShippingMiddleName_Create();
  92. $this->txtShippingLastName = $this->mctOrder->txtShippingLastName_Create();
  93. $this->txtShippingNameSuffix = $this->mctOrder->txtShippingNameSuffix_Create();
  94. $this->txtShippingStreet1 = $this->mctOrder->txtShippingStreet1_Create();
  95. $this->txtShippingStreet2 = $this->mctOrder->txtShippingStreet2_Create();
  96. $this->txtShippingSuburb = $this->mctOrder->txtShippingSuburb_Create();
  97. $this->txtShippingCounty = $this->mctOrder->txtShippingCounty_Create();
  98. $this->txtShippingCity = $this->mctOrder->txtShippingCity_Create();
  99. $this->lstShippingZone = $this->mctOrder->lstShippingZone_Create();
  100. $this->lstShippingCountry = $this->mctOrder->lstShippingCountry_Create();
  101. $this->txtShippingPostalCode = $this->mctOrder->txtShippingPostalCode_Create();
  102. $this->txtBillingNamePrefix = $this->mctOrder->txtBillingNamePrefix_Create();
  103. $this->txtBillingFirstName = $this->mctOrder->txtBillingFirstName_Create();
  104. $this->txtBillingMiddleName = $this->mctOrder->txtBillingMiddleName_Create();
  105. $this->txtBillingLastName = $this->mctOrder->txtBillingLastName_Create();
  106. $this->txtBillingNameSuffix = $this->mctOrder->txtBillingNameSuffix_Create();
  107. $this->txtBillingStreet1 = $this->mctOrder->txtBillingStreet1_Create();
  108. $this->txtBillingStreet2 = $this->mctOrder->txtBillingStreet2_Create();
  109. $this->txtBillingSuburb = $this->mctOrder->txtBillingSuburb_Create();
  110. $this->txtBillingCounty = $this->mctOrder->txtBillingCounty_Create();
  111. $this->txtBillingCity = $this->mctOrder->txtBillingCity_Create();
  112. $this->lstBillingZone = $this->mctOrder->lstBillingZone_Create();
  113. $this->lstBillingCountry = $this->mctOrder->lstBillingCountry_Create();
  114. $this->txtBillingPostalCode = $this->mctOrder->txtBillingPostalCode_Create();
  115. $this->txtNotes = $this->mctOrder->txtNotes_Create();
  116. $this->lstShippingMethod = $this->mctOrder->lstShippingMethod_Create();
  117. $this->lstStatus = $this->mctOrder->lstStatus_Create();
  118. $this->btnSave = new QButton($this);
  119. $this->btnSave->Text = Quinta::Translate('Save');
  120. if(IndexPage::$blnAjaxOk)
  121. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  122. else
  123. $this->btnSave->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnSave_Click'));
  124. $this->btnSave->CausesValidation = $this;
  125. $this->btnBack = new QButton($this);
  126. $this->btnBack->Text = Quinta::Translate('Back');
  127. if(IndexPage::$blnAjaxOk)
  128. $this->btnBack->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnBack_Click'));
  129. else
  130. $this->btnBack->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnBack_Click'));
  131. }
  132. public function btnSave_Click($strFormId, $strControlId, $strParameter){
  133. $this->mctOrder->SaveOrder();
  134. $this->CloseSelf(true);
  135. }
  136. public function btnBack_Click($strFormId, $strControlId, $strParameter){
  137. $this->CloseSelf(false);
  138. }
  139. // Close Myself and Call ClosePanelMethod Callback
  140. protected function CloseSelf($blnChangesMade){
  141. $strMethod = $this->strClosePanelMethod;
  142. $this->objControlBlock->$strMethod($blnChangesMade);
  143. }
  144. }
  145. ?>