function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'Potentials', 'potential_', $model);
         $entity = new Accounts();
         if ($this->focusColumnValue('related_to')) {
             $entity->retrieve_entity_info($this->focusColumnValue('related_to'), 'Accounts');
         }
         $this->generateEntityModel($entity, 'Accounts', 'account_', $model);
         $entity = new Contacts();
         if ($this->focusColumnValue('contact_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('contact_id'), 'Contacts');
         }
         $this->generateEntityModel($entity, 'Contacts', 'contact_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('potential_no', $this->focusColumnValue('potential_no'));
         $model->set('potential_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'HelpDesk', 'helpdesk_', $model);
         $entity = new Products();
         if ($this->focusColumnValue('product_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('product_id'), 'Products');
         }
         $this->generateEntityModel($entity, 'Products', 'product_', $model);
         if ($this->focusColumnValue('parent_id')) {
             $setype = getSalesEntityType($this->focusColumnValue('parent_id'));
         }
         $account = new Accounts();
         $contact = new Contacts();
         if ($setype == 'Accounts') {
             $account->retrieve_entity_info($this->focusColumnValue('parent_id'), $setype);
         } elseif ($setype == 'Contacts') {
             $contact->retrieve_entity_info($this->focusColumnValue('parent_id'), $setype);
         }
         $this->generateEntityModel($account, 'Accounts', 'account_', $model);
         $this->generateEntityModel($contact, 'Contacts', 'contact_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('helpdesk_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'SPPayments', 'payment_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('payment_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         $model->set('payment_payer', getParentName($this->focusColumnValue('payer')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
 function Output($filename, $type)
 {
     parent::Output($filename, $type);
 }