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.

961 lines
48 KiB

  1. <?php
  2. /**
  3. * This is a MetaControl class, providing a QForm or QPanel access to event handlers
  4. * and QControls to perform the Create, Edit, and Delete functionality
  5. * of the Order class. This code-generated class
  6. * contains all the basic elements to help a QPanel or QForm display an HTML form that can
  7. * manipulate a single Order object.
  8. *
  9. * To take advantage of some (or all) of these control objects, you
  10. * must create a new QForm or QPanel which instantiates a OrderMetaControl
  11. * class.
  12. *
  13. * Any and all changes to this file will be overwritten with any subsequent
  14. * code re-generation.
  15. *
  16. * @package Quinta CMS
  17. * @subpackage MetaControls
  18. * property-read Order $Order the actual Order data class being edited
  19. * property QLabel $IdControl
  20. * property-read QLabel $IdLabel
  21. * property QListBox $AccountIdControl
  22. * property-read QLabel $AccountIdLabel
  23. * property QLabel $CreationDateControl
  24. * property-read QLabel $CreationDateLabel
  25. * property QLabel $LastModificationControl
  26. * property-read QLabel $LastModificationLabel
  27. * property QDateTimePicker $CompletionDateControl
  28. * property-read QLabel $CompletionDateLabel
  29. * property QFloatTextBox $ProductTotalCostControl
  30. * property-read QLabel $ProductTotalCostLabel
  31. * property QFloatTextBox $ShippingCostControl
  32. * property-read QLabel $ShippingCostLabel
  33. * property QFloatTextBox $ShippingChargedControl
  34. * property-read QLabel $ShippingChargedLabel
  35. * property QFloatTextBox $HandlingCostControl
  36. * property-read QLabel $HandlingCostLabel
  37. * property QFloatTextBox $HandlingChargedControl
  38. * property-read QLabel $HandlingChargedLabel
  39. * property QFloatTextBox $TaxControl
  40. * property-read QLabel $TaxLabel
  41. * property QFloatTextBox $ProductTotalChargedControl
  42. * property-read QLabel $ProductTotalChargedLabel
  43. * property QTextBox $NotesControl
  44. * property-read QLabel $NotesLabel
  45. * property QListBox $ShippingMethodIdControl
  46. * property-read QLabel $ShippingMethodIdLabel
  47. * property QListBox $PaymentMethodIdControl
  48. * property-read QLabel $PaymentMethodIdLabel
  49. * property QListBox $StatusIdControl
  50. * property-read QLabel $StatusIdLabel
  51. * property QListBox $TypeIdControl
  52. * property-read QLabel $TypeIdLabel
  53. * property-read string $TitleVerb a verb indicating whether or not this is being edited or created
  54. * property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
  55. */
  56. class OrderMetaControlGen extends QBaseClass {
  57. // General Variables
  58. protected $objOrder;
  59. protected $objParentObject;
  60. protected $strTitleVerb;
  61. protected $blnEditMode;
  62. // Controls that allow the editing of Order's individual data fields
  63. protected $lblId;
  64. protected $lstAccount;
  65. protected $lblCreationDate;
  66. protected $lblLastModification;
  67. protected $calCompletionDate;
  68. protected $txtProductTotalCost;
  69. protected $txtShippingCost;
  70. protected $txtShippingCharged;
  71. protected $txtHandlingCost;
  72. protected $txtHandlingCharged;
  73. protected $txtTax;
  74. protected $txtProductTotalCharged;
  75. protected $txtNotes;
  76. protected $lstShippingMethod;
  77. protected $lstPaymentMethod;
  78. protected $lstStatus;
  79. protected $lstType;
  80. // Controls that allow the viewing of Order's individual data fields
  81. protected $lblAccountId;
  82. protected $lblCompletionDate;
  83. protected $lblProductTotalCost;
  84. protected $lblShippingCost;
  85. protected $lblShippingCharged;
  86. protected $lblHandlingCost;
  87. protected $lblHandlingCharged;
  88. protected $lblTax;
  89. protected $lblProductTotalCharged;
  90. protected $lblNotes;
  91. protected $lblShippingMethodId;
  92. protected $lblPaymentMethodId;
  93. protected $lblStatusId;
  94. protected $lblTypeId;
  95. // QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References
  96. // QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References
  97. /**
  98. * Main constructor. Constructor OR static create methods are designed to be called in either
  99. * a parent QPanel or the main QForm when wanting to create a
  100. * OrderMetaControl to edit a single Order object within the
  101. * QPanel or QForm.
  102. *
  103. * This constructor takes in a single Order object, while any of the static
  104. * create methods below can be used to construct based off of individual PK ID(s).
  105. *
  106. * @param mixed $objParentObject QForm or QPanel which will be using this OrderMetaControl
  107. * @param Order $objOrder new or existing Order object
  108. */
  109. public function __construct($objParentObject, Order $objOrder) {
  110. // Setup Parent Object (e.g. QForm or QPanel which will be using this OrderMetaControl)
  111. $this->objParentObject = $objParentObject;
  112. // Setup linked Order object
  113. $this->objOrder = $objOrder;
  114. // Figure out if we're Editing or Creating New
  115. if ($this->objOrder->__Restored) {
  116. $this->strTitleVerb = QApplication::Translate('Edit');
  117. $this->blnEditMode = true;
  118. } else {
  119. $this->strTitleVerb = QApplication::Translate('Create');
  120. $this->blnEditMode = false;
  121. }
  122. }
  123. /**
  124. * Static Helper Method to Create using PK arguments
  125. * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  126. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  127. * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to
  128. * edit, or if we are also allowed to create a new one, etc.
  129. *
  130. * @param mixed $objParentObject QForm or QPanel which will be using this OrderMetaControl
  131. * @param integer $intId primary key value
  132. * @param QMetaControlCreateType $intCreateType rules governing Order object creation - defaults to CreateOrEdit
  133. * @return OrderMetaControl
  134. */
  135. public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  136. // Attempt to Load from PK Arguments
  137. if (strlen($intId)) {
  138. $objOrder = Order::Load($intId);
  139. // Order was found -- return it!
  140. if ($objOrder)
  141. return new OrderMetaControl($objParentObject, $objOrder);
  142. // If CreateOnRecordNotFound not specified, throw an exception
  143. else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
  144. throw new QCallerException('Could not find a Order object with PK arguments: ' . $intId);
  145. // If EditOnly is specified, throw an exception
  146. } else if ($intCreateType == QMetaControlCreateType::EditOnly)
  147. throw new QCallerException('No PK arguments specified');
  148. // If we are here, then we need to create a new record
  149. return new OrderMetaControl($objParentObject, new Order());
  150. }
  151. /**
  152. * Static Helper Method to Create using PathInfo arguments
  153. *
  154. * @param mixed $objParentObject QForm or QPanel which will be using this OrderMetaControl
  155. * @param QMetaControlCreateType $intCreateType rules governing Order object creation - defaults to CreateOrEdit
  156. * @return OrderMetaControl
  157. */
  158. public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  159. $intId = QApplication::PathInfo(0);
  160. return OrderMetaControl::Create($objParentObject, $intId, $intCreateType);
  161. }
  162. /**
  163. * Static Helper Method to Create using QueryString arguments
  164. *
  165. * @param mixed $objParentObject QForm or QPanel which will be using this OrderMetaControl
  166. * @param QMetaControlCreateType $intCreateType rules governing Order object creation - defaults to CreateOrEdit
  167. * @return OrderMetaControl
  168. */
  169. public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  170. $intId = QApplication::QueryString('intId');
  171. return OrderMetaControl::Create($objParentObject, $intId, $intCreateType);
  172. }
  173. ///////////////////////////////////////////////
  174. // PUBLIC CREATE and REFRESH METHODS
  175. ///////////////////////////////////////////////
  176. /**
  177. * Create and setup QLabel lblId
  178. * @param string $strControlId optional ControlId to use
  179. * @return QLabel
  180. */
  181. public function lblId_Create($strControlId = null) {
  182. $this->lblId = new QLabel($this->objParentObject, $strControlId);
  183. $this->lblId->Name = QApplication::Translate('Id');
  184. if ($this->blnEditMode)
  185. $this->lblId->Text = $this->objOrder->Id;
  186. else
  187. $this->lblId->Text = 'N/A';
  188. return $this->lblId;
  189. }
  190. /**
  191. * Create and setup QListBox lstAccount
  192. * @param string $strControlId optional ControlId to use
  193. * @return QListBox
  194. */
  195. public function lstAccount_Create($strControlId = null) {
  196. $this->lstAccount = new QListBox($this->objParentObject, $strControlId);
  197. $this->lstAccount->Name = QApplication::Translate('Account');
  198. $this->lstAccount->Required = true;
  199. if (!$this->blnEditMode)
  200. $this->lstAccount->AddItem(QApplication::Translate('- Select One -'), null);
  201. $objAccountArray = Account::LoadAll();
  202. if ($objAccountArray) foreach ($objAccountArray as $objAccount) {
  203. $objListItem = new QListItem($objAccount->__toString(), $objAccount->Id);
  204. if (($this->objOrder->Account) && ($this->objOrder->Account->Id == $objAccount->Id))
  205. $objListItem->Selected = true;
  206. $this->lstAccount->AddItem($objListItem);
  207. }
  208. return $this->lstAccount;
  209. }
  210. /**
  211. * Create and setup QLabel lblAccountId
  212. * @param string $strControlId optional ControlId to use
  213. * @return QLabel
  214. */
  215. public function lblAccountId_Create($strControlId = null) {
  216. $this->lblAccountId = new QLabel($this->objParentObject, $strControlId);
  217. $this->lblAccountId->Name = QApplication::Translate('Account');
  218. $this->lblAccountId->Text = ($this->objOrder->Account) ? $this->objOrder->Account->__toString() : null;
  219. $this->lblAccountId->Required = true;
  220. return $this->lblAccountId;
  221. }
  222. /**
  223. * Create and setup QLabel lblCreationDate
  224. * @param string $strControlId optional ControlId to use
  225. * @return QLabel
  226. */
  227. public function lblCreationDate_Create($strControlId = null) {
  228. $this->lblCreationDate = new QLabel($this->objParentObject, $strControlId);
  229. $this->lblCreationDate->Name = QApplication::Translate('Creation Date');
  230. if ($this->blnEditMode)
  231. $this->lblCreationDate->Text = $this->objOrder->CreationDate;
  232. else
  233. $this->lblCreationDate->Text = 'N/A';
  234. return $this->lblCreationDate;
  235. }
  236. /**
  237. * Create and setup QLabel lblLastModification
  238. * @param string $strControlId optional ControlId to use
  239. * @return QLabel
  240. */
  241. public function lblLastModification_Create($strControlId = null) {
  242. $this->lblLastModification = new QLabel($this->objParentObject, $strControlId);
  243. $this->lblLastModification->Name = QApplication::Translate('Last Modification');
  244. if ($this->blnEditMode)
  245. $this->lblLastModification->Text = $this->objOrder->LastModification;
  246. else
  247. $this->lblLastModification->Text = 'N/A';
  248. return $this->lblLastModification;
  249. }
  250. /**
  251. * Create and setup QDateTimePicker calCompletionDate
  252. * @param string $strControlId optional ControlId to use
  253. * @return QDateTimePicker
  254. */
  255. public function calCompletionDate_Create($strControlId = null) {
  256. $this->calCompletionDate = new QDateTimePicker($this->objParentObject, $strControlId);
  257. $this->calCompletionDate->Name = QApplication::Translate('Completion Date');
  258. $this->calCompletionDate->DateTime = $this->objOrder->CompletionDate;
  259. $this->calCompletionDate->DateTimePickerType = QDateTimePickerType::DateTime;
  260. return $this->calCompletionDate;
  261. }
  262. /**
  263. * Create and setup QLabel lblCompletionDate
  264. * @param string $strControlId optional ControlId to use
  265. * @param string $strDateTimeFormat optional DateTimeFormat to use
  266. * @return QLabel
  267. */
  268. public function lblCompletionDate_Create($strControlId = null, $strDateTimeFormat = null) {
  269. $this->lblCompletionDate = new QLabel($this->objParentObject, $strControlId);
  270. $this->lblCompletionDate->Name = QApplication::Translate('Completion Date');
  271. $this->strCompletionDateDateTimeFormat = $strDateTimeFormat;
  272. $this->lblCompletionDate->Text = $this->objOrder->CompletionDate->__toString($strDateTimeFormat);
  273. return $this->lblCompletionDate;
  274. }
  275. protected $strCompletionDateDateTimeFormat;
  276. /**
  277. * Create and setup QFloatTextBox txtProductTotalCost
  278. * @param string $strControlId optional ControlId to use
  279. * @return QFloatTextBox
  280. */
  281. public function txtProductTotalCost_Create($strControlId = null) {
  282. $this->txtProductTotalCost = new QFloatTextBox($this->objParentObject, $strControlId);
  283. $this->txtProductTotalCost->Name = QApplication::Translate('Product Total Cost');
  284. $this->txtProductTotalCost->Text = $this->objOrder->ProductTotalCost;
  285. return $this->txtProductTotalCost;
  286. }
  287. /**
  288. * Create and setup QLabel lblProductTotalCost
  289. * @param string $strControlId optional ControlId to use
  290. * @param string $strFormat optional sprintf format to use
  291. * @return QLabel
  292. */
  293. public function lblProductTotalCost_Create($strControlId = null, $strFormat = null) {
  294. $this->lblProductTotalCost = new QLabel($this->objParentObject, $strControlId);
  295. $this->lblProductTotalCost->Name = QApplication::Translate('Product Total Cost');
  296. $this->lblProductTotalCost->Text = $this->objOrder->ProductTotalCost;
  297. $this->lblProductTotalCost->Format = $strFormat;
  298. return $this->lblProductTotalCost;
  299. }
  300. /**
  301. * Create and setup QFloatTextBox txtShippingCost
  302. * @param string $strControlId optional ControlId to use
  303. * @return QFloatTextBox
  304. */
  305. public function txtShippingCost_Create($strControlId = null) {
  306. $this->txtShippingCost = new QFloatTextBox($this->objParentObject, $strControlId);
  307. $this->txtShippingCost->Name = QApplication::Translate('Shipping Cost');
  308. $this->txtShippingCost->Text = $this->objOrder->ShippingCost;
  309. return $this->txtShippingCost;
  310. }
  311. /**
  312. * Create and setup QLabel lblShippingCost
  313. * @param string $strControlId optional ControlId to use
  314. * @param string $strFormat optional sprintf format to use
  315. * @return QLabel
  316. */
  317. public function lblShippingCost_Create($strControlId = null, $strFormat = null) {
  318. $this->lblShippingCost = new QLabel($this->objParentObject, $strControlId);
  319. $this->lblShippingCost->Name = QApplication::Translate('Shipping Cost');
  320. $this->lblShippingCost->Text = $this->objOrder->ShippingCost;
  321. $this->lblShippingCost->Format = $strFormat;
  322. return $this->lblShippingCost;
  323. }
  324. /**
  325. * Create and setup QFloatTextBox txtShippingCharged
  326. * @param string $strControlId optional ControlId to use
  327. * @return QFloatTextBox
  328. */
  329. public function txtShippingCharged_Create($strControlId = null) {
  330. $this->txtShippingCharged = new QFloatTextBox($this->objParentObject, $strControlId);
  331. $this->txtShippingCharged->Name = QApplication::Translate('Shipping Charged');
  332. $this->txtShippingCharged->Text = $this->objOrder->ShippingCharged;
  333. return $this->txtShippingCharged;
  334. }
  335. /**
  336. * Create and setup QLabel lblShippingCharged
  337. * @param string $strControlId optional ControlId to use
  338. * @param string $strFormat optional sprintf format to use
  339. * @return QLabel
  340. */
  341. public function lblShippingCharged_Create($strControlId = null, $strFormat = null) {
  342. $this->lblShippingCharged = new QLabel($this->objParentObject, $strControlId);
  343. $this->lblShippingCharged->Name = QApplication::Translate('Shipping Charged');
  344. $this->lblShippingCharged->Text = $this->objOrder->ShippingCharged;
  345. $this->lblShippingCharged->Format = $strFormat;
  346. return $this->lblShippingCharged;
  347. }
  348. /**
  349. * Create and setup QFloatTextBox txtHandlingCost
  350. * @param string $strControlId optional ControlId to use
  351. * @return QFloatTextBox
  352. */
  353. public function txtHandlingCost_Create($strControlId = null) {
  354. $this->txtHandlingCost = new QFloatTextBox($this->objParentObject, $strControlId);
  355. $this->txtHandlingCost->Name = QApplication::Translate('Handling Cost');
  356. $this->txtHandlingCost->Text = $this->objOrder->HandlingCost;
  357. return $this->txtHandlingCost;
  358. }
  359. /**
  360. * Create and setup QLabel lblHandlingCost
  361. * @param string $strControlId optional ControlId to use
  362. * @param string $strFormat optional sprintf format to use
  363. * @return QLabel
  364. */
  365. public function lblHandlingCost_Create($strControlId = null, $strFormat = null) {
  366. $this->lblHandlingCost = new QLabel($this->objParentObject, $strControlId);
  367. $this->lblHandlingCost->Name = QApplication::Translate('Handling Cost');
  368. $this->lblHandlingCost->Text = $this->objOrder->HandlingCost;
  369. $this->lblHandlingCost->Format = $strFormat;
  370. return $this->lblHandlingCost;
  371. }
  372. /**
  373. * Create and setup QFloatTextBox txtHandlingCharged
  374. * @param string $strControlId optional ControlId to use
  375. * @return QFloatTextBox
  376. */
  377. public function txtHandlingCharged_Create($strControlId = null) {
  378. $this->txtHandlingCharged = new QFloatTextBox($this->objParentObject, $strControlId);
  379. $this->txtHandlingCharged->Name = QApplication::Translate('Handling Charged');
  380. $this->txtHandlingCharged->Text = $this->objOrder->HandlingCharged;
  381. return $this->txtHandlingCharged;
  382. }
  383. /**
  384. * Create and setup QLabel lblHandlingCharged
  385. * @param string $strControlId optional ControlId to use
  386. * @param string $strFormat optional sprintf format to use
  387. * @return QLabel
  388. */
  389. public function lblHandlingCharged_Create($strControlId = null, $strFormat = null) {
  390. $this->lblHandlingCharged = new QLabel($this->objParentObject, $strControlId);
  391. $this->lblHandlingCharged->Name = QApplication::Translate('Handling Charged');
  392. $this->lblHandlingCharged->Text = $this->objOrder->HandlingCharged;
  393. $this->lblHandlingCharged->Format = $strFormat;
  394. return $this->lblHandlingCharged;
  395. }
  396. /**
  397. * Create and setup QFloatTextBox txtTax
  398. * @param string $strControlId optional ControlId to use
  399. * @return QFloatTextBox
  400. */
  401. public function txtTax_Create($strControlId = null) {
  402. $this->txtTax = new QFloatTextBox($this->objParentObject, $strControlId);
  403. $this->txtTax->Name = QApplication::Translate('Tax');
  404. $this->txtTax->Text = $this->objOrder->Tax;
  405. return $this->txtTax;
  406. }
  407. /**
  408. * Create and setup QLabel lblTax
  409. * @param string $strControlId optional ControlId to use
  410. * @param string $strFormat optional sprintf format to use
  411. * @return QLabel
  412. */
  413. public function lblTax_Create($strControlId = null, $strFormat = null) {
  414. $this->lblTax = new QLabel($this->objParentObject, $strControlId);
  415. $this->lblTax->Name = QApplication::Translate('Tax');
  416. $this->lblTax->Text = $this->objOrder->Tax;
  417. $this->lblTax->Format = $strFormat;
  418. return $this->lblTax;
  419. }
  420. /**
  421. * Create and setup QFloatTextBox txtProductTotalCharged
  422. * @param string $strControlId optional ControlId to use
  423. * @return QFloatTextBox
  424. */
  425. public function txtProductTotalCharged_Create($strControlId = null) {
  426. $this->txtProductTotalCharged = new QFloatTextBox($this->objParentObject, $strControlId);
  427. $this->txtProductTotalCharged->Name = QApplication::Translate('Product Total Charged');
  428. $this->txtProductTotalCharged->Text = $this->objOrder->ProductTotalCharged;
  429. return $this->txtProductTotalCharged;
  430. }
  431. /**
  432. * Create and setup QLabel lblProductTotalCharged
  433. * @param string $strControlId optional ControlId to use
  434. * @param string $strFormat optional sprintf format to use
  435. * @return QLabel
  436. */
  437. public function lblProductTotalCharged_Create($strControlId = null, $strFormat = null) {
  438. $this->lblProductTotalCharged = new QLabel($this->objParentObject, $strControlId);
  439. $this->lblProductTotalCharged->Name = QApplication::Translate('Product Total Charged');
  440. $this->lblProductTotalCharged->Text = $this->objOrder->ProductTotalCharged;
  441. $this->lblProductTotalCharged->Format = $strFormat;
  442. return $this->lblProductTotalCharged;
  443. }
  444. /**
  445. * Create and setup QTextBox txtNotes
  446. * @param string $strControlId optional ControlId to use
  447. * @return QTextBox
  448. */
  449. public function txtNotes_Create($strControlId = null) {
  450. $this->txtNotes = new QTextBox($this->objParentObject, $strControlId);
  451. $this->txtNotes->Name = QApplication::Translate('Notes');
  452. $this->txtNotes->Text = $this->objOrder->Notes;
  453. $this->txtNotes->TextMode = QTextMode::MultiLine;
  454. return $this->txtNotes;
  455. }
  456. /**
  457. * Create and setup QLabel lblNotes
  458. * @param string $strControlId optional ControlId to use
  459. * @return QLabel
  460. */
  461. public function lblNotes_Create($strControlId = null) {
  462. $this->lblNotes = new QLabel($this->objParentObject, $strControlId);
  463. $this->lblNotes->Name = QApplication::Translate('Notes');
  464. $this->lblNotes->Text = $this->objOrder->Notes;
  465. return $this->lblNotes;
  466. }
  467. /**
  468. * Create and setup QListBox lstShippingMethod
  469. * @param string $strControlId optional ControlId to use
  470. * @return QListBox
  471. */
  472. public function lstShippingMethod_Create($strControlId = null) {
  473. $this->lstShippingMethod = new QListBox($this->objParentObject, $strControlId);
  474. $this->lstShippingMethod->Name = QApplication::Translate('Shipping Method');
  475. $this->lstShippingMethod->AddItem(QApplication::Translate('- Select One -'), null);
  476. $objShippingMethodArray = ShippingMethod::LoadAll();
  477. if ($objShippingMethodArray) foreach ($objShippingMethodArray as $objShippingMethod) {
  478. $objListItem = new QListItem($objShippingMethod->__toString(), $objShippingMethod->Id);
  479. if (($this->objOrder->ShippingMethod) && ($this->objOrder->ShippingMethod->Id == $objShippingMethod->Id))
  480. $objListItem->Selected = true;
  481. $this->lstShippingMethod->AddItem($objListItem);
  482. }
  483. return $this->lstShippingMethod;
  484. }
  485. /**
  486. * Create and setup QLabel lblShippingMethodId
  487. * @param string $strControlId optional ControlId to use
  488. * @return QLabel
  489. */
  490. public function lblShippingMethodId_Create($strControlId = null) {
  491. $this->lblShippingMethodId = new QLabel($this->objParentObject, $strControlId);
  492. $this->lblShippingMethodId->Name = QApplication::Translate('Shipping Method');
  493. $this->lblShippingMethodId->Text = ($this->objOrder->ShippingMethod) ? $this->objOrder->ShippingMethod->__toString() : null;
  494. return $this->lblShippingMethodId;
  495. }
  496. /**
  497. * Create and setup QListBox lstPaymentMethod
  498. * @param string $strControlId optional ControlId to use
  499. * @return QListBox
  500. */
  501. public function lstPaymentMethod_Create($strControlId = null) {
  502. $this->lstPaymentMethod = new QListBox($this->objParentObject, $strControlId);
  503. $this->lstPaymentMethod->Name = QApplication::Translate('Payment Method');
  504. $this->lstPaymentMethod->AddItem(QApplication::Translate('- Select One -'), null);
  505. $objPaymentMethodArray = PaymentMethod::LoadAll();
  506. if ($objPaymentMethodArray) foreach ($objPaymentMethodArray as $objPaymentMethod) {
  507. $objListItem = new QListItem($objPaymentMethod->__toString(), $objPaymentMethod->Id);
  508. if (($this->objOrder->PaymentMethod) && ($this->objOrder->PaymentMethod->Id == $objPaymentMethod->Id))
  509. $objListItem->Selected = true;
  510. $this->lstPaymentMethod->AddItem($objListItem);
  511. }
  512. return $this->lstPaymentMethod;
  513. }
  514. /**
  515. * Create and setup QLabel lblPaymentMethodId
  516. * @param string $strControlId optional ControlId to use
  517. * @return QLabel
  518. */
  519. public function lblPaymentMethodId_Create($strControlId = null) {
  520. $this->lblPaymentMethodId = new QLabel($this->objParentObject, $strControlId);
  521. $this->lblPaymentMethodId->Name = QApplication::Translate('Payment Method');
  522. $this->lblPaymentMethodId->Text = ($this->objOrder->PaymentMethod) ? $this->objOrder->PaymentMethod->__toString() : null;
  523. return $this->lblPaymentMethodId;
  524. }
  525. /**
  526. * Create and setup QListBox lstStatus
  527. * @param string $strControlId optional ControlId to use
  528. * @return QListBox
  529. */
  530. public function lstStatus_Create($strControlId = null) {
  531. $this->lstStatus = new QListBox($this->objParentObject, $strControlId);
  532. $this->lstStatus->Name = QApplication::Translate('Status');
  533. $this->lstStatus->Required = true;
  534. foreach (OrderStatusType::$NameArray as $intId => $strValue)
  535. $this->lstStatus->AddItem(new QListItem($strValue, $intId, $this->objOrder->StatusId == $intId));
  536. return $this->lstStatus;
  537. }
  538. /**
  539. * Create and setup QLabel lblStatusId
  540. * @param string $strControlId optional ControlId to use
  541. * @return QLabel
  542. */
  543. public function lblStatusId_Create($strControlId = null) {
  544. $this->lblStatusId = new QLabel($this->objParentObject, $strControlId);
  545. $this->lblStatusId->Name = QApplication::Translate('Status');
  546. $this->lblStatusId->Text = ($this->objOrder->StatusId) ? OrderStatusType::$NameArray[$this->objOrder->StatusId] : null;
  547. $this->lblStatusId->Required = true;
  548. return $this->lblStatusId;
  549. }
  550. /**
  551. * Create and setup QListBox lstType
  552. * @param string $strControlId optional ControlId to use
  553. * @return QListBox
  554. */
  555. public function lstType_Create($strControlId = null) {
  556. $this->lstType = new QListBox($this->objParentObject, $strControlId);
  557. $this->lstType->Name = QApplication::Translate('Type');
  558. $this->lstType->AddItem(QApplication::Translate('- Select One -'), null);
  559. foreach (OrderType::$NameArray as $intId => $strValue)
  560. $this->lstType->AddItem(new QListItem($strValue, $intId, $this->objOrder->TypeId == $intId));
  561. return $this->lstType;
  562. }
  563. /**
  564. * Create and setup QLabel lblTypeId
  565. * @param string $strControlId optional ControlId to use
  566. * @return QLabel
  567. */
  568. public function lblTypeId_Create($strControlId = null) {
  569. $this->lblTypeId = new QLabel($this->objParentObject, $strControlId);
  570. $this->lblTypeId->Name = QApplication::Translate('Type');
  571. $this->lblTypeId->Text = ($this->objOrder->TypeId) ? OrderType::$NameArray[$this->objOrder->TypeId] : null;
  572. return $this->lblTypeId;
  573. }
  574. /**
  575. * Refresh this MetaControl with Data from the local Order object.
  576. * @param boolean $blnReload reload Order from the database
  577. * @return void
  578. */
  579. public function Refresh($blnReload = false) {
  580. if ($blnReload)
  581. $this->objOrder->Reload();
  582. if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objOrder->Id;
  583. if ($this->lstAccount) {
  584. $this->lstAccount->RemoveAllItems();
  585. if (!$this->blnEditMode)
  586. $this->lstAccount->AddItem(QApplication::Translate('- Select One -'), null);
  587. $objAccountArray = Account::LoadAll();
  588. if ($objAccountArray) foreach ($objAccountArray as $objAccount) {
  589. $objListItem = new QListItem($objAccount->__toString(), $objAccount->Id);
  590. if (($this->objOrder->Account) && ($this->objOrder->Account->Id == $objAccount->Id))
  591. $objListItem->Selected = true;
  592. $this->lstAccount->AddItem($objListItem);
  593. }
  594. }
  595. if ($this->lblAccountId) $this->lblAccountId->Text = ($this->objOrder->Account) ? $this->objOrder->Account->__toString() : null;
  596. if ($this->lblCreationDate) if ($this->blnEditMode) $this->lblCreationDate->Text = $this->objOrder->CreationDate;
  597. if ($this->lblLastModification) if ($this->blnEditMode) $this->lblLastModification->Text = $this->objOrder->LastModification;
  598. if ($this->calCompletionDate) $this->calCompletionDate->DateTime = $this->objOrder->CompletionDate;
  599. if ($this->lblCompletionDate) $this->lblCompletionDate->Text = $this->objOrder->CompletionDate->__toString($this->strCompletionDateDateTimeFormat);
  600. if ($this->txtProductTotalCost) $this->txtProductTotalCost->Text = $this->objOrder->ProductTotalCost;
  601. if ($this->lblProductTotalCost) $this->lblProductTotalCost->Text = $this->objOrder->ProductTotalCost;
  602. if ($this->txtShippingCost) $this->txtShippingCost->Text = $this->objOrder->ShippingCost;
  603. if ($this->lblShippingCost) $this->lblShippingCost->Text = $this->objOrder->ShippingCost;
  604. if ($this->txtShippingCharged) $this->txtShippingCharged->Text = $this->objOrder->ShippingCharged;
  605. if ($this->lblShippingCharged) $this->lblShippingCharged->Text = $this->objOrder->ShippingCharged;
  606. if ($this->txtHandlingCost) $this->txtHandlingCost->Text = $this->objOrder->HandlingCost;
  607. if ($this->lblHandlingCost) $this->lblHandlingCost->Text = $this->objOrder->HandlingCost;
  608. if ($this->txtHandlingCharged) $this->txtHandlingCharged->Text = $this->objOrder->HandlingCharged;
  609. if ($this->lblHandlingCharged) $this->lblHandlingCharged->Text = $this->objOrder->HandlingCharged;
  610. if ($this->txtTax) $this->txtTax->Text = $this->objOrder->Tax;
  611. if ($this->lblTax) $this->lblTax->Text = $this->objOrder->Tax;
  612. if ($this->txtProductTotalCharged) $this->txtProductTotalCharged->Text = $this->objOrder->ProductTotalCharged;
  613. if ($this->lblProductTotalCharged) $this->lblProductTotalCharged->Text = $this->objOrder->ProductTotalCharged;
  614. if ($this->txtNotes) $this->txtNotes->Text = $this->objOrder->Notes;
  615. if ($this->lblNotes) $this->lblNotes->Text = $this->objOrder->Notes;
  616. if ($this->lstShippingMethod) {
  617. $this->lstShippingMethod->RemoveAllItems();
  618. $this->lstShippingMethod->AddItem(QApplication::Translate('- Select One -'), null);
  619. $objShippingMethodArray = ShippingMethod::LoadAll();
  620. if ($objShippingMethodArray) foreach ($objShippingMethodArray as $objShippingMethod) {
  621. $objListItem = new QListItem($objShippingMethod->__toString(), $objShippingMethod->Id);
  622. if (($this->objOrder->ShippingMethod) && ($this->objOrder->ShippingMethod->Id == $objShippingMethod->Id))
  623. $objListItem->Selected = true;
  624. $this->lstShippingMethod->AddItem($objListItem);
  625. }
  626. }
  627. if ($this->lblShippingMethodId) $this->lblShippingMethodId->Text = ($this->objOrder->ShippingMethod) ? $this->objOrder->ShippingMethod->__toString() : null;
  628. if ($this->lstPaymentMethod) {
  629. $this->lstPaymentMethod->RemoveAllItems();
  630. $this->lstPaymentMethod->AddItem(QApplication::Translate('- Select One -'), null);
  631. $objPaymentMethodArray = PaymentMethod::LoadAll();
  632. if ($objPaymentMethodArray) foreach ($objPaymentMethodArray as $objPaymentMethod) {
  633. $objListItem = new QListItem($objPaymentMethod->__toString(), $objPaymentMethod->Id);
  634. if (($this->objOrder->PaymentMethod) && ($this->objOrder->PaymentMethod->Id == $objPaymentMethod->Id))
  635. $objListItem->Selected = true;
  636. $this->lstPaymentMethod->AddItem($objListItem);
  637. }
  638. }
  639. if ($this->lblPaymentMethodId) $this->lblPaymentMethodId->Text = ($this->objOrder->PaymentMethod) ? $this->objOrder->PaymentMethod->__toString() : null;
  640. if ($this->lstStatus) $this->lstStatus->SelectedValue = $this->objOrder->StatusId;
  641. if ($this->lblStatusId) $this->lblStatusId->Text = ($this->objOrder->StatusId) ? OrderStatusType::$NameArray[$this->objOrder->StatusId] : null;
  642. if ($this->lstType) $this->lstType->SelectedValue = $this->objOrder->TypeId;
  643. if ($this->lblTypeId) $this->lblTypeId->Text = ($this->objOrder->TypeId) ? OrderType::$NameArray[$this->objOrder->TypeId] : null;
  644. }
  645. ///////////////////////////////////////////////
  646. // PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
  647. ///////////////////////////////////////////////
  648. ///////////////////////////////////////////////
  649. // PUBLIC ORDER OBJECT MANIPULATORS
  650. ///////////////////////////////////////////////
  651. /**
  652. * This will save this object's Order instance,
  653. * updating only the fields which have had a control created for it.
  654. */
  655. public function SaveOrder() {
  656. try {
  657. // Update any fields for controls that have been created
  658. if ($this->lstAccount) $this->objOrder->AccountId = $this->lstAccount->SelectedValue;
  659. if ($this->calCompletionDate) $this->objOrder->CompletionDate = $this->calCompletionDate->DateTime;
  660. if ($this->txtProductTotalCost) $this->objOrder->ProductTotalCost = $this->txtProductTotalCost->Text;
  661. if ($this->txtShippingCost) $this->objOrder->ShippingCost = $this->txtShippingCost->Text;
  662. if ($this->txtShippingCharged) $this->objOrder->ShippingCharged = $this->txtShippingCharged->Text;
  663. if ($this->txtHandlingCost) $this->objOrder->HandlingCost = $this->txtHandlingCost->Text;
  664. if ($this->txtHandlingCharged) $this->objOrder->HandlingCharged = $this->txtHandlingCharged->Text;
  665. if ($this->txtTax) $this->objOrder->Tax = $this->txtTax->Text;
  666. if ($this->txtProductTotalCharged) $this->objOrder->ProductTotalCharged = $this->txtProductTotalCharged->Text;
  667. if ($this->txtNotes) $this->objOrder->Notes = $this->txtNotes->Text;
  668. if ($this->lstShippingMethod) $this->objOrder->ShippingMethodId = $this->lstShippingMethod->SelectedValue;
  669. if ($this->lstPaymentMethod) $this->objOrder->PaymentMethodId = $this->lstPaymentMethod->SelectedValue;
  670. if ($this->lstStatus) $this->objOrder->StatusId = $this->lstStatus->SelectedValue;
  671. if ($this->lstType) $this->objOrder->TypeId = $this->lstType->SelectedValue;
  672. // Update any UniqueReverseReferences (if any) for controls that have been created for it
  673. // Save the Order object
  674. $this->objOrder->Save();
  675. // Finally, update any ManyToManyReferences (if any)
  676. } catch (QCallerException $objExc) {
  677. $objExc->IncrementOffset();
  678. throw $objExc;
  679. }
  680. }
  681. /**
  682. * This will DELETE this object's Order instance from the database.
  683. * It will also unassociate itself from any ManyToManyReferences.
  684. */
  685. public function DeleteOrder() {
  686. $this->objOrder->Delete();
  687. }
  688. ///////////////////////////////////////////////
  689. // PUBLIC GETTERS and SETTERS
  690. ///////////////////////////////////////////////
  691. /**
  692. * Override method to perform a property "Get"
  693. * This will get the value of $strName
  694. *
  695. * @param string $strName Name of the property to get
  696. * @return mixed
  697. */
  698. public function __get($strName) {
  699. switch ($strName) {
  700. // General MetaControlVariables
  701. case 'Order': return $this->objOrder;
  702. case 'TitleVerb': return $this->strTitleVerb;
  703. case 'EditMode': return $this->blnEditMode;
  704. // Controls that point to Order fields -- will be created dynamically if not yet created
  705. case 'IdControl':
  706. if (!$this->lblId) return $this->lblId_Create();
  707. return $this->lblId;
  708. case 'IdLabel':
  709. if (!$this->lblId) return $this->lblId_Create();
  710. return $this->lblId;
  711. case 'AccountIdControl':
  712. if (!$this->lstAccount) return $this->lstAccount_Create();
  713. return $this->lstAccount;
  714. case 'AccountIdLabel':
  715. if (!$this->lblAccountId) return $this->lblAccountId_Create();
  716. return $this->lblAccountId;
  717. case 'CreationDateControl':
  718. if (!$this->lblCreationDate) return $this->lblCreationDate_Create();
  719. return $this->lblCreationDate;
  720. case 'CreationDateLabel':
  721. if (!$this->lblCreationDate) return $this->lblCreationDate_Create();
  722. return $this->lblCreationDate;
  723. case 'LastModificationControl':
  724. if (!$this->lblLastModification) return $this->lblLastModification_Create();
  725. return $this->lblLastModification;
  726. case 'LastModificationLabel':
  727. if (!$this->lblLastModification) return $this->lblLastModification_Create();
  728. return $this->lblLastModification;
  729. case 'CompletionDateControl':
  730. if (!$this->calCompletionDate) return $this->calCompletionDate_Create();
  731. return $this->calCompletionDate;
  732. case 'CompletionDateLabel':
  733. if (!$this->lblCompletionDate) return $this->lblCompletionDate_Create();
  734. return $this->lblCompletionDate;
  735. case 'ProductTotalCostControl':
  736. if (!$this->txtProductTotalCost) return $this->txtProductTotalCost_Create();
  737. return $this->txtProductTotalCost;
  738. case 'ProductTotalCostLabel':
  739. if (!$this->lblProductTotalCost) return $this->lblProductTotalCost_Create();
  740. return $this->lblProductTotalCost;
  741. case 'ShippingCostControl':
  742. if (!$this->txtShippingCost) return $this->txtShippingCost_Create();
  743. return $this->txtShippingCost;
  744. case 'ShippingCostLabel':
  745. if (!$this->lblShippingCost) return $this->lblShippingCost_Create();
  746. return $this->lblShippingCost;
  747. case 'ShippingChargedControl':
  748. if (!$this->txtShippingCharged) return $this->txtShippingCharged_Create();
  749. return $this->txtShippingCharged;
  750. case 'ShippingChargedLabel':
  751. if (!$this->lblShippingCharged) return $this->lblShippingCharged_Create();
  752. return $this->lblShippingCharged;
  753. case 'HandlingCostControl':
  754. if (!$this->txtHandlingCost) return $this->txtHandlingCost_Create();
  755. return $this->txtHandlingCost;
  756. case 'HandlingCostLabel':
  757. if (!$this->lblHandlingCost) return $this->lblHandlingCost_Create();
  758. return $this->lblHandlingCost;
  759. case 'HandlingChargedControl':
  760. if (!$this->txtHandlingCharged) return $this->txtHandlingCharged_Create();
  761. return $this->txtHandlingCharged;
  762. case 'HandlingChargedLabel':
  763. if (!$this->lblHandlingCharged) return $this->lblHandlingCharged_Create();
  764. return $this->lblHandlingCharged;
  765. case 'TaxControl':
  766. if (!$this->txtTax) return $this->txtTax_Create();
  767. return $this->txtTax;
  768. case 'TaxLabel':
  769. if (!$this->lblTax) return $this->lblTax_Create();
  770. return $this->lblTax;
  771. case 'ProductTotalChargedControl':
  772. if (!$this->txtProductTotalCharged) return $this->txtProductTotalCharged_Create();
  773. return $this->txtProductTotalCharged;
  774. case 'ProductTotalChargedLabel':
  775. if (!$this->lblProductTotalCharged) return $this->lblProductTotalCharged_Create();
  776. return $this->lblProductTotalCharged;
  777. case 'NotesControl':
  778. if (!$this->txtNotes) return $this->txtNotes_Create();
  779. return $this->txtNotes;
  780. case 'NotesLabel':
  781. if (!$this->lblNotes) return $this->lblNotes_Create();
  782. return $this->lblNotes;
  783. case 'ShippingMethodIdControl':
  784. if (!$this->lstShippingMethod) return $this->lstShippingMethod_Create();
  785. return $this->lstShippingMethod;
  786. case 'ShippingMethodIdLabel':
  787. if (!$this->lblShippingMethodId) return $this->lblShippingMethodId_Create();
  788. return $this->lblShippingMethodId;
  789. case 'PaymentMethodIdControl':
  790. if (!$this->lstPaymentMethod) return $this->lstPaymentMethod_Create();
  791. return $this->lstPaymentMethod;
  792. case 'PaymentMethodIdLabel':
  793. if (!$this->lblPaymentMethodId) return $this->lblPaymentMethodId_Create();
  794. return $this->lblPaymentMethodId;
  795. case 'StatusIdControl':
  796. if (!$this->lstStatus) return $this->lstStatus_Create();
  797. return $this->lstStatus;
  798. case 'StatusIdLabel':
  799. if (!$this->lblStatusId) return $this->lblStatusId_Create();
  800. return $this->lblStatusId;
  801. case 'TypeIdControl':
  802. if (!$this->lstType) return $this->lstType_Create();
  803. return $this->lstType;
  804. case 'TypeIdLabel':
  805. if (!$this->lblTypeId) return $this->lblTypeId_Create();
  806. return $this->lblTypeId;
  807. default:
  808. try {
  809. return parent::__get($strName);
  810. } catch (QCallerException $objExc) {
  811. $objExc->IncrementOffset();
  812. throw $objExc;
  813. }
  814. }
  815. }
  816. /**
  817. * Override method to perform a property "Set"
  818. * This will set the property $strName to be $mixValue
  819. *
  820. * @param string $strName Name of the property to set
  821. * @param string $mixValue New value of the property
  822. * @return mixed
  823. */
  824. public function __set($strName, $mixValue) {
  825. try {
  826. switch ($strName) {
  827. // Controls that point to Order fields
  828. case 'IdControl':
  829. return ($this->lblId = QType::Cast($mixValue, 'QControl'));
  830. case 'AccountIdControl':
  831. return ($this->lstAccount = QType::Cast($mixValue, 'QControl'));
  832. case 'CreationDateControl':
  833. return ($this->lblCreationDate = QType::Cast($mixValue, 'QControl'));
  834. case 'LastModificationControl':
  835. return ($this->lblLastModification = QType::Cast($mixValue, 'QControl'));
  836. case 'CompletionDateControl':
  837. return ($this->calCompletionDate = QType::Cast($mixValue, 'QControl'));
  838. case 'ProductTotalCostControl':
  839. return ($this->txtProductTotalCost = QType::Cast($mixValue, 'QControl'));
  840. case 'ShippingCostControl':
  841. return ($this->txtShippingCost = QType::Cast($mixValue, 'QControl'));
  842. case 'ShippingChargedControl':
  843. return ($this->txtShippingCharged = QType::Cast($mixValue, 'QControl'));
  844. case 'HandlingCostControl':
  845. return ($this->txtHandlingCost = QType::Cast($mixValue, 'QControl'));
  846. case 'HandlingChargedControl':
  847. return ($this->txtHandlingCharged = QType::Cast($mixValue, 'QControl'));
  848. case 'TaxControl':
  849. return ($this->txtTax = QType::Cast($mixValue, 'QControl'));
  850. case 'ProductTotalChargedControl':
  851. return ($this->txtProductTotalCharged = QType::Cast($mixValue, 'QControl'));
  852. case 'NotesControl':
  853. return ($this->txtNotes = QType::Cast($mixValue, 'QControl'));
  854. case 'ShippingMethodIdControl':
  855. return ($this->lstShippingMethod = QType::Cast($mixValue, 'QControl'));
  856. case 'PaymentMethodIdControl':
  857. return ($this->lstPaymentMethod = QType::Cast($mixValue, 'QControl'));
  858. case 'StatusIdControl':
  859. return ($this->lstStatus = QType::Cast($mixValue, 'QControl'));
  860. case 'TypeIdControl':
  861. return ($this->lstType = QType::Cast($mixValue, 'QControl'));
  862. default:
  863. return parent::__set($strName, $mixValue);
  864. }
  865. } catch (QCallerException $objExc) {
  866. $objExc->IncrementOffset();
  867. throw $objExc;
  868. }
  869. }
  870. }
  871. ?>