Example #1
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #2
0
 /**
  * create the form to change permission
  *
  * in this form we can set the acl roles, which are allowed or denied
  * for this action
  *
  * @param Admin_Model_DbRow_Controller $controller
  * @param Admin_Model_DbRow_Action $action
  * @param array $roles array of Admin_Model_DbTable_Acl_Role Objects
  * @param array $rulesAllow
  * @param array $rulesDeny
  */
 public function __construct(Admin_Model_DbRow_Controller $controller, Admin_Model_DbRow_Action $action, array $roles, array $rulesAllow, array $rulesDeny)
 {
     parent::__construct($controller);
     $rolesAllow = new Zend_Form_Element_MultiCheckbox('rolesallow', array('label' => 'Allow access', 'order' => 7));
     $rolesDeny = new Zend_Form_Element_MultiCheckbox('rolesdeny', array('label' => 'Explicit Deny Access', 'order' => 8));
     foreach ($roles as $role) {
         $rolesAllow->addMultiOption($role->get('id'), $role->get('name'));
         $rolesDeny->addMultiOption($role->get('id'), $role->get('name'));
     }
     $rolesAllow->setValue($rulesAllow);
     $rolesDeny->setValue($rulesDeny);
     $this->addElements(array($rolesAllow, $rolesDeny, new Zend_Form_Element_Hidden('id', array('required' => true, 'value' => $action->get('id'), 'order' => 11))));
     // remove description element (from base form)
     $this->removeElement('description');
     $this->getElement('action')->setValue($action->get('actionName'));
 }
Example #3
0
 public function getForm()
 {
     $form = new Zend_Form();
     $form->setMethod('post');
     $form->setDecorators(array(array('ViewScript', array('viewScript' => 'reports/report1Form.phtml'))));
     $items = $this->getPeriodItems('REQ_MOZ_CONTMOVEMENT');
     $e = new Zend_Form_Element_Select('period', array('label' => 'Період', 'multiOptions' => $items, 'required' => true));
     $form->addElement($e);
     $items = $this->getGuideItems('T_STRUCTURE_ITEM', true, false, 'CT.TITLE');
     $e = new Zend_Form_Element_Select('establishment', array('label' => 'Установа', 'multiOptions' => $items));
     $form->addElement($e);
     $items = $this->getGuideItems('T_EDUFORM', true);
     $e = new Zend_Form_Element_Select('eduform', array('label' => 'Форма навчання', 'multiOptions' => $items));
     $form->addElement($e);
     $items = $this->getGuideItems('T_EDUBASIS', true);
     $e = new Zend_Form_Element_Select('edubase', array('label' => 'Форма фінансування', 'multiOptions' => $items));
     $form->addElement($e);
     $items = $this->getGuideItems('T_COUNTRY', true);
     $e = new Zend_Form_Element_Select('country', array('label' => 'Громадянство (країна)', 'multiOptions' => $items));
     $form->addElement($e);
     $items = $this->getGuideItems('T_COUNTRYTYPE', true);
     $e = new Zend_Form_Element_Select('countrytype', array('label' => 'Тип громадянства', 'multiOptions' => $items));
     $form->addElement($e);
     $items = $this->getGuideItems('T_EDULEVEL');
     $e = new Zend_Form_Element_MultiCheckbox('edulevel', array('label' => 'Рівень підготовки', 'multiOptions' => $items));
     $e->setValue(array_keys($items));
     $form->addElement($e);
     $refreshAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'page', 'action' => 'show'));
     $e = new Zend_Form_Element_Submit('refresh', array('label' => 'Обновити', 'onclick' => "document.forms[0].action='{$refreshAct}'"));
     $form->addElement($e);
     $excelAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'reports', 'action' => 'excel', 'report' => 1));
     $e = new Zend_Form_Element_Submit('excel', array('label' => 'Excel', 'onclick' => "document.forms[0].action='{$excelAct}'"));
     $form->addElement($e);
     $form->setElementDecorators(array('ViewHelper', 'Errors'));
     $auth = Zend_Auth::getInstance();
     $ident = $auth->getIdentity();
     if ($ident->STRUCTURE_CODE != 0) {
         $form->getElement('establishment')->setValue($ident->STRUCTUREID);
     }
     return $form;
 }
Example #4
0
 public function init()
 {
     $roleDt = new Application_Model_DbTable_Role();
     $primaryKey = $roleDt->getPrimaryKey();
     $this->setMethod('post');
     $this->setEnctype('multipart/form-data');
     $this->setAttrib('idrol', $primaryKey);
     $this->setAction('/admin/role/edit');
     $objType2 = new Admin_Model_Acl();
     $objfea = new Admin_Model_AclRole();
     $e = new Zend_Form_Element_Hidden($primaryKey);
     $this->addElement($e);
     $e = new Zend_Form_Element_MultiCheckbox('idacl');
     $e->setMultiOptions($objType2->getGreatAll());
     if ($this->_idrol !== null) {
         $ma = $objfea->getRoleAcl($this->_idrol);
         $idsgreat = array();
         foreach ($ma as $resulta) {
             $idsgreat[] = $resulta['idacl'];
         }
         $e->setValue($idsgreat);
         $role = new Admin_Model_Role();
         $b = $role->getRoleId($this->_idrol);
     }
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('name');
     $e->setAttrib('class', 'inpt-medium');
     $e->setAttrib('placeholder', 'Nombre');
     $this->addElement($e);
     $e = new Zend_Form_Element_Checkbox('state');
     $e->setValue(true);
     $this->addElement($e);
     foreach ($this->getElements() as $element) {
         $element->removeDecorator('Label');
         $element->removeDecorator('DtDdWrapper');
         $element->removeDecorator('HtmlTag');
     }
 }
Example #5
0
 public function getConfigForm($populate = false)
 {
     $form = new Stuffpress_Form();
     // Add the blog url element
     $element = $form->createElement('text', 'url', array('label' => 'Feed URL', 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     // Add the blog title element
     $element = $form->createElement('text', 'title', array('label' => 'Title', 'decorators' => $form->elementDecorators));
     $element->setRequired(false);
     $form->addElement($element);
     // Add the icon path element
     $element = $form->createElement('text', 'icon', array('label' => 'Icon', 'decorators' => $form->elementDecorators));
     $element->setRequired(false);
     $form->addElement($element);
     // Options
     $options = array();
     if ($this->getPropertyDefault('hide_content')) {
         $options[] = 'hide_content';
     }
     $e = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('hide_content' => 'Hide blog post (only title will be shown)')));
     $e->setLabel('Options');
     $e->setValue($options);
     $form->addElement($e);
     // Populate
     if ($populate) {
         $options = array();
         $values = $this->getProperties();
         if ($this->getProperty('hide_content')) {
             $options[] = 'hide_content';
         }
         $values['options'] = $options;
         $form->populate($values);
     }
     return $form;
 }
Example #6
0
 public function getConfigForm($populate = false)
 {
     $form = new Stuffpress_Form();
     // Add the blog url element
     $label = $this->getServiceName() . " username";
     $element = $form->createElement('text', 'username', array('label' => $label, 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     // Options
     $options = array();
     if ($this->getPropertyDefault('hide_replies')) {
         $options[] = 'hide_replies';
     }
     $e = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('hide_replies' => 'Hide @replies tweets')));
     $e->setLabel('Options');
     $e->setValue($options);
     $form->addElement($e);
     if ($populate) {
         $options = array();
         $values = $this->getProperties();
         if ($this->getProperty('hide_replies')) {
             $options[] = 'hide_replies';
         }
         $values['options'] = $options;
         $form->populate($values);
     }
     return $form;
 }
Example #7
0
 public function getConfigForm($populate = false)
 {
     $form = new Stuffpress_Form();
     $element = $form->createElement('text', 'username', array('label' => 'Username', 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     $element = $form->createElement('text', 'userid', array('label' => 'User ID', 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     $options = array();
     if ($this->getPropertyDefault('hide_content')) {
         $options[] = 'hide_content';
     }
     $e = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('hide_content' => 'Hide Scribd description (only title will be shown)')));
     $e->setLabel('Options');
     $e->setValue($options);
     $form->addElement($e);
     if ($populate) {
         $options = array();
         $values = $this->getProperties();
         if ($this->getProperty('hide_content')) {
             $options[] = 'hide_content';
         }
         $values['options'] = $options;
         $form->populate($values);
     }
     return $form;
 }
 private function getForm($source_id = 0, $item_id = 0)
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName("form_add_comment_{$source_id}_{$item_id}");
     // Create and configure comment element:
     $comment = $form->createElement('textarea', 'comment', array('label' => 'Comment:', 'rows' => 4, 'cols' => 60, 'decorators' => $form->elementDecorators));
     $comment->setRequired(true);
     $comment->addFilter('StripTags');
     if ($this->_application->user) {
         $name = $form->createElement('hidden', 'name');
         $name->setValue($this->_application->user->username);
         $name->setDecorators(array(array('ViewHelper')));
         $email = $form->createElement('hidden', 'email');
         $email->setValue($this->_application->user->email);
         $email->setDecorators(array(array('ViewHelper')));
         $config = Zend_Registry::get('configuration');
         $host = $config->web->host;
         $url = $this->_application->getPublicDomain();
         $website = $form->createElement('hidden', 'website');
         $website->setValue($url);
         $website->setDecorators(array(array('ViewHelper')));
         $website->addFilter('StripTags');
     } else {
         // Create and configure username element:
         $name = $form->createElement('text', 'name', array('label' => 'Name:', 'decorators' => $form->elementDecorators));
         $name->addFilter('StringToLower');
         $name->addValidator('alnum');
         $name->addValidator('stringLength', false, array(4, 20));
         $name->setRequired(true);
         // Create and configure email element:
         $email = $form->createElement('text', 'email', array('label' => 'Email (confidential):', 'decorators' => $form->elementDecorators));
         $email->addValidator(new Zend_Validate_EmailAddress());
         $email->setRequired(true);
         // Create and configure website element:
         // TODO Add URL validator
         $website = $form->createElement('text', 'website', array('label' => 'Website (optional):', 'decorators' => $form->elementDecorators));
         $website->addFilter('StripTags');
         $website->setRequired(false);
     }
     $options = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('notify' => 'Notify me of followup comments via e-mail')));
     $options->setValue(array('notify'));
     // Add elements to form:
     $form->addElement($comment);
     $form->addElement($name);
     $form->addElement($email);
     $form->addElement($website);
     $form->addElement($options);
     // Add a hidden element with the source id
     $element = $form->createElement('hidden', 'source');
     $element->setValue($source_id);
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     // Add a hidden element with the item id
     $element = $form->createElement('hidden', 'item');
     $element->setValue($item_id);
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     // Post button
     $button = $form->createElement('button', 'post', array('label' => 'Post', 'onclick' => "submitFormAddComment({$source_id}, {$item_id});", 'decorators' => array('ViewHelper')));
     $button->setDecorators(array(array('ViewHelper')));
     $form->addElement($button);
     // Cancel button
     $button = $form->createElement('button', 'cancel', array('label' => 'Cancel', 'onclick' => "cancelFormAddComment({$source_id}, {$item_id});", 'decorators' => array('ViewHelper')));
     $button->setDecorators(array(array('ViewHelper')));
     $form->addElement($button);
     $form->addDisplayGroup(array('post', 'cancel'), 'buttons', array('decorators' => $form->groupDecorators));
     return $form;
 }
Example #9
0
 protected function buildAutoForm()
 {
     //
     global $gANNOTATION_KEYS;
     extract($gANNOTATION_KEYS);
     if ($this->recurseSubEntities) {
         $this->addSaveButton('upper_submit');
     }
     foreach ($this->entityColumns as $propertyName => $def) {
         if (!isset($def['annotations'][$annoKeyAwe])) {
             continue;
         }
         $elementType = false;
         $element = false;
         // annotation keys
         $anno = $def['annotations'];
         // determine element type
         if (isset($anno[$annoKeyId])) {
             $elementType = 'hidden_primary_key';
         } else {
             if (isset($anno[$annoKeyM21])) {
                 $elementType = $this->recurseSubEntities ? 'foreign_dropdown' : 'hidden_foreign_key';
             } else {
                 if (isset($anno[$annoKey12m]) && $this->recurseSubEntities && $anno[$annoKeyAwe]->editInline && $this->repopData && !$this->isRestful) {
                     $elementType = 'foreign_editInline';
                 } else {
                     if (isset($anno[$annoKeyM2m])) {
                         $elementType = 'foreign_multi_checkbox';
                     } else {
                         if (isset($anno[$annoKeyCol])) {
                             $elementType = 'entity';
                         }
                     }
                 }
             }
         }
         // Render that type of element
         switch ($elementType) {
             case 'hidden_primary_key':
                 //
                 $element = new Zend_Form_Element_Hidden('id');
                 $element->setDecorators(array('ViewHelper'));
                 if ($this->repopData) {
                     $element->setValue($this->repopData->id);
                 }
                 break;
             case 'hidden_foreign_key':
                 //
                 $elementName = isset($anno[$annoKeyJoinColumn]->name) ? $anno[$annoKeyJoinColumn]->name : $propertyName . '_id';
                 $element = new Zend_Form_Element_Hidden($elementName);
                 $element->setDecorators(array('ViewHelper'));
                 $element->setValue($this->repopData->{$propertyName}->id);
                 break;
             case 'entity':
                 //
                 // setup properties
                 // use a label param if set,
                 // otherwise use the @Column annotation's name property
                 // replace underscores with spaces and capitalize each word
                 // otherwise default to the property name of the object
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $type = $anno[$annoKeyAwe]->type ? $anno[$annoKeyAwe]->type : $this->getDefaultElementType($anno[$annoKeyCol]->type);
                 $colType = $anno[$annoKeyCol]->type;
                 $params = isset($anno[$annoKeyAwe]->params) ? $anno[$annoKeyAwe]->params : array();
                 $validators = count((array) $anno[$annoKeyAwe]->validators) ? (array) $anno[$annoKeyAwe]->validators : $this->getDefaultElementValidators($anno[$annoKeyCol]);
                 // build element
                 $element = new $type($propertyName, $params);
                 $element->setLabel($label);
                 $validatorList = array();
                 foreach ($validators as $v => $args) {
                     $validatorList[] = new $v((array) $args);
                 }
                 $element->setValidators($validatorList);
                 // repopulate data
                 if ($this->repopData) {
                     if ($colType == 'datetime' || $colType == 'date') {
                         $value = $this->repopData->{$propertyName}->format('Y-m-d');
                     } else {
                         $value = $this->repopData->{$propertyName};
                     }
                     $element->setValue($value);
                 }
                 break;
             case 'foreign_dropdown':
                 //
                 // setup properties
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $targetEntity = $anno[$annoKeyM21]->targetEntity;
                 $displayColumn = $anno[$annoKeyAwe]->displayColumn;
                 $join_column = $anno[$annoKeyJoinColumn]->name;
                 // get related entities
                 $dql = "select e from {$targetEntity} e";
                 $foreignEntities = $this->_doctrine->createQuery($dql)->getResult();
                 $dropdowns = array();
                 $dropdowns[''] = '';
                 foreach ($foreignEntities as $id => $f) {
                     $dropdowns[$f->id] = $f->{$displayColumn};
                 }
                 // build element
                 $element = new Zend_Form_Element_Select($join_column);
                 $element->setMultiOptions($dropdowns);
                 $element->setLabel($label);
                 // repopulate data
                 if ($this->repopData && $this->repopData->{$propertyName}) {
                     $element->setValue($this->repopData->{$propertyName}->id);
                 }
                 break;
             case 'foreign_multi_checkbox':
                 //
                 // setup properties
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $targetEntity = $anno[$annoKeyM2m]->targetEntity;
                 $displayColumn = $anno[$annoKeyAwe]->displayColumn;
                 $inverseColumn = $anno[$annoKeyJoinTable]->inverseJoinColumns[0]->name;
                 $targetId = str_replace('\\', '_', $targetEntity);
                 $attribute = str_replace('_id', '', "{$inverseColumn}s");
                 // get related entities
                 $dql = "select e from {$targetEntity} e";
                 $foreignEntities = $this->_doctrine->createQuery($dql)->getResult();
                 $foreignColumns = $this->getEntityColumnDefs($targetEntity);
                 $options = array();
                 if (count($foreignEntities)) {
                     foreach ($foreignEntities as $fe) {
                         $options[$fe->id] = $fe->{$displayColumn};
                     }
                 }
                 // build element
                 $element = new Zend_Form_Element_MultiCheckbox("{$inverseColumn}s");
                 $element->setMultiOptions($options);
                 $element->setLabel($label);
                 // repopulate data
                 $values = array();
                 foreach ($this->repopData->{$attribute} as $subEntity) {
                     $values[] = $subEntity->id;
                 }
                 $element->setValue($values);
                 break;
             case 'foreign_editInline':
                 //
                 // setup properties
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $targetEntity = $anno[$annoKey12m]->targetEntity;
                 $editInline = $anno[$annoKeyAwe]->editInline;
                 $targetId = str_replace('\\', '_', $targetEntity);
                 $subformName = "{$targetId}_subform";
                 // get sub entities
                 $sub_entities = $this->repopData->{$propertyName};
                 $subEntityColumns = $this->getEntityColumnDefs($targetEntity);
                 // build sub forms
                 $subform = new Zend_Form_SubForm();
                 $subform->setLegend($label);
                 $recurse = false;
                 $parent = $this->repopData;
                 $x = 0;
                 foreach ($sub_entities as $subEntity) {
                     $autoCrudForm = new Awe_Form_AutoMagic($subformName, $subEntityColumns, $subEntity, $recurse, $parent);
                     $subform->addSubform($autoCrudForm, $x++);
                 }
                 $this->addSubform($subform, $targetId);
                 break;
         }
         if ($element) {
             $this->getAutoSubform('entity')->addElement($element);
         }
     }
     if ($this->recurseSubEntities) {
         $this->addSaveButton('lower_submit');
     }
 }
 public function productDetailReport($data = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $location = $data["LocationId"];
     $brand = $data["branch_id"];
     $category = $data["category_id"];
     //     	$item = new report_Model_DbQuery();
     //     	$rs = $item->getItem($data);
     //     	$a= count($rs);
     //print_r($rs);exit();
     $rs = $db->getGlobalDb('SELECT pro_id, item_name,item_code FROM tb_product WHERE item_name!="" ORDER BY item_name ');
     $options = array('' => $tr->translate('Select_Products'));
     foreach ($rs as $read) {
         $options[$read['pro_id']] = $read['item_code'] . " " . $read['item_name'];
     }
     $pro_id = new Zend_Form_Element_Select('item');
     $pro_id->setMultiOptions($options);
     $proValue = $request->getParam('item');
     $pro_id->setAttribs(array('id' => 'item'));
     $pro_id->setValue($proValue);
     $this->addElement($pro_id);
     $reportTypeElement = new Zend_Form_Element_Select("report_type");
     $opt = array("" => $tr->translate('REPORT_TYPE'), 1 => "All Report", 2 => "Purchase Report", 3 => "Sales Report", 4 => "Transfer Report", 5 => "Poduct Information Report", 6 => "Customize Report");
     $reportTypeElement->setMultiOptions($opt);
     $reportTypeElement->setAttribs(array('onChange' => 'report()'));
     $reportTypeValue = $request->getParam('report_type');
     $reportTypeElement->setValue($reportTypeValue);
     $this->addElement($reportTypeElement);
     $check = new Zend_Form_Element_MultiCheckbox("report_num");
     $check->setAttribs(array("class" => "validate[required]"));
     $opt_check = array(1 => 'Purchase Report', 2 => 'Sales Report', 3 => 'Transfer Report', 4 => 'Poduct Information Report');
     $check->setMultiOptions($opt_check);
     $check_value = $request->getParam("report_num");
     $check->setValue($check_value);
     $this->addElement($check);
     $sql = 'SELECT DISTINCT Name,LocationId FROM tb_sublocation WHERE Name!="" AND status=1 ';
     $user = $this->GetuserInfo();
     if ($user["level"] != 1 and $user["level"] != 2) {
         $sql .= " AND LocationId= " . $user["location_id"];
     }
     $rs = $db->getGlobalDb($sql);
     $options = array('' => $tr->translate('Please_Select_Location'));
     $locationValue = $request->getParam('LocationId');
     foreach ($rs as $read) {
         $options[$read['LocationId']] = $read['Name'];
     }
     $location_id = new Zend_Form_Element_Select('LocationId');
     $location_id->setMultiOptions($options);
     $location_id->setAttribs(array('id' => 'LocationId', 'onchange' => 'getProductByLocation();'));
     $location_id->setValue($locationValue);
     $rs = $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category WHERE Name!="" ORDER BY CategoryId');
     $options = array('' => $tr->translate('Please_Select'));
     $cateValue = $request->getParam('category_id');
     foreach ($rs as $read) {
         $options[$read['CategoryId']] = $read['Name'];
     }
     $cate_element = new Zend_Form_Element_Select('category_id');
     $cate_element->setMultiOptions($options);
     $cate_element->setAttribs(array('id' => 'category_id', 'onchange' => 'this.form.submit()'));
     $cate_element->setValue($cateValue);
     $this->addElement($cate_element);
     $rs = $db->getGlobalDb('SELECT branch_id, Name FROM tb_branch WHERE Name!="" ORDER BY branch_id ');
     $options = array('' => $tr->translate('Please_Select'));
     $branchValue = $request->getParam('branch_id');
     foreach ($rs as $read) {
         $options[$read['branch_id']] = $read['Name'];
     }
     $branch_element = new Zend_Form_Element_Select('branch_id');
     $branch_element->setMultiOptions($options);
     $branch_element->setAttribs(array('id' => 'branch_id', 'onchange' => 'getProductByBrand()'));
     $branch_element->setValue($branchValue);
     $this->addElement($branch_element);
     $date = new Zend_Date();
     $startDate = new Zend_Form_Element_Text("start_date");
     $startDatevalue = $request->getParam("start_date");
     //$startDate->setAttribs(array("class"=>"validate[required]"));
     $startDate->setValue($startDatevalue);
     $endDate = new Zend_Form_Element_Text("end_date");
     //$endDate->setValue($date->get("DD-MM-YY"));
     $endDatevalue = $request->getParam("end_date");
     //$endDate->setAttribs(array("class"=>"validate[required]"));
     $endDate->setValue($endDatevalue);
     $this->addElements(array($startDate, $endDate, $location_id));
     Application_Form_DateTimePicker::addDateField(array('start_date', 'end_date'));
     return $this;
 }