Exemplo n.º 1
0
    public function frmaddSalary($data=null)
    {
    	
    	$request=Zend_Controller_Front::getInstance()->getRequest();
    	 
    	$_title = new Zend_Dojo_Form_Element_TextBox('adv_search');
    	$_title->setAttribs(array('dojoType'=>$this->tvalidate,
    			'onkeyup'=>'this.submit()',
    			'placeholder'=>$this->tr->translate("SEARCH_SALARY_INFO")
    	));
    	$_title->setValue($request->getParam("adv_search"));
    	 
    	$_btn_search = new Zend_Dojo_Form_Element_SubmitButton('btn_search');
    	$_btn_search->setAttribs(array(
    			'dojoType'=>'dijit.form.Button',
    			'iconclass'=>'dijitIconSearch'
    	));
    	 
    	 
    	$_status_search=  new Zend_Dojo_Form_Element_FilteringSelect('status_search');
    	$_status_search->setAttribs(array('dojoType'=>$this->filter));
    	$_status_opt = array(
    			-1=>$this->tr->translate("ALL"),
    			1=>$this->tr->translate("ACTIVE"),
    			0=>$this->tr->translate("DACTIVE"));
    	$_status_search->setMultiOptions($_status_opt);
    	$_status_search->setValue($request->getParam("status_search"));

    	$db = new Application_Model_DbTable_DbGlobal();
    	$staff_name = new Zend_Dojo_Form_Element_FilteringSelect('staff_name');
    	$rows = $db ->getAllCOName();
    	$options=array(''=>"------Select------",-1=>"Add New");
    	if(!empty($rows))foreach($rows AS $row) $options[$row['co_id']]=$row['co_khname'];
    	$staff_name->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
    			'class'=>'fullside',
    			'onchange'=>'popupCheckStaff(1);'
    	));
    	$staff_name->setMultiOptions($options);
    	
    	$db_Sex=new Application_Model_DbTable_DbGlobal();
    	$opt_Sex=$db_Sex->getVewOptoinTypeByType(8,1);
    	$Sex=new Zend_Dojo_Form_Element_FilteringSelect('sex');
    	$Sex->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
    			'required'=>true,
    			'class'=>'fullside'
    	));
    	$Sex->setMultiOptions($opt_Sex);
    	
    	$position_=new Zend_Dojo_Form_Element_FilteringSelect('position');
    	$position_->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
//     			'dojoType'=>$this->filter,
    			'required'=>true,
    			'class'=>'fullside'
    			));
    	
    	$db_position=new Application_Model_DbTable_DbGlobal();
    	$opt_position=$db_position->getAllStaffPosition(null,1);
    	$position_->setMultiOptions($opt_position);
    	$position_->setValue($request->getParam('position'));
    	
    	$Basic_salary=new Zend_Dojo_Form_Element_NumberTextBox('basic_salary');
    	$Basic_salary->setAttribs(array(
    			'dojoType'=>'dijit.form.NumberTextBox',
    			'required'=>true,
    			'class'=>'fullside'
    			));
    	$Basic_salary->setValue(0);
    	
    	
    	$date_start=new Zend_Dojo_Form_Element_DateTextBox('date_start');
    	$date_start->setAttribs(array(
    			'dojoType'=>'dijit.form.DateTextBox',
    			'class'=>'fullside',
    			));
    	$date_start->setValue(date('Y-m-d'));
    	
    	$date_get_salary=new Zend_Dojo_Form_Element_DateTextBox('date_get_salary');
    	$date_get_salary->setAttribs(array(
    			'dojoType'=>'dijit.form.DateTextBox',
    			'class'=>'fullside',
    			));
    	$date_get_salary->setValue(date('Y-m-d'));
    	
    	$date_end_contract=new Zend_Dojo_Form_Element_DateTextBox('date_end_contract');
    	$date_end_contract->setAttribs(array(
    			'dojoType'=>'dijit.form.DateTextBox',
    			'class'=>'fullside',
    			));
    	$date_end_contract->setValue(date('Y-m-d'));
    	
    	$status=  new Zend_Dojo_Form_Element_FilteringSelect('status');
    	$status->setAttribs(array('dojoType'=>'dijit.form.FilteringSelect','class'=>'fullside',));
    	$status_opt = array(
    			1=>$this->tr->translate("ACTIVE"),
    			0=>$this->tr->translate("DACTIVE"));
    	$status->setMultiOptions($status_opt);
    	
    	$db = new Application_Model_DbTable_DbGlobal();
    	$_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
    	$_branch_id->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
    			'class'=>'fullside',
    			'required' =>'true'
    	));
    	$rows = $db->getAllBranchName();
    	$options=array(''=>"---ស្វែងរកសាខា---");
    	if(!empty($rows))
    		foreach($rows AS $row){
    		$options[$row['br_id']]=$row['branch_namekh'];
    	}
    	$_branch_id->setMultiOptions($options);
    	$_branch_id->setValue($request->getParam('branch_id'));
    	
    	
    	$staff_code=new Zend_Dojo_Form_Element_NumberTextBox('staff_code');
    	$staff_code->setAttribs(array(
    			'dojoType'=>'dijit.form.NumberTextBox',
    			'class'=>'fullside',
    			'required'=>true
    			));
    	
    	$for_month=new Zend_Dojo_Form_Element_FilteringSelect('for_month');
    	$for_month->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
    			'class'=>'fullside',
    			'required'=>true
    	));
    	$opt_month="";
    	for($i=1;$i<=12;$i++){
    		$opt_month[$i]=$i;
    	}
    	$for_month->setMultiOptions($opt_month);
    	
    	$employee = new Zend_Dojo_Form_Element_FilteringSelect('employee');
    	$rows = $db ->getAllCOName();
    	$options=array(''=>"---ស្វែងរកតាមរយៈឈ្មោះ---");
    	if(!empty($rows))foreach($rows AS $row) $options[$row['co_id']]=$row['co_khname'];
    	$employee->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
    			'class'=>'fullside',
    			'onchange'=>'popupCheckCO();'
    	));
    	$employee->setMultiOptions($options);
    	$employee->setValue($request->getParam('employee'));
    	
    	$from_date=new Zend_Dojo_Form_Element_DateTextBox('from_date');
    	$from_date->setAttribs(array(
    			'dojoType'=>'dijit.form.DateTextBox',
    			'required'=>true,
    			'class'=>'fullside'
    	));
    	$fromdate=$request->getParam("from_date");
    	if(empty($fromdate)){
    		$fromdate=date('Y-m-d');
    	}
    	$from_date->setValue($fromdate);
    	
    	$to_date=new Zend_Dojo_Form_Element_DateTextBox('to_date');
    	$to_date->setAttribs(array(
    			'dojoType'=>'dijit.form.DateTextBox',
    			'required'=>true,
    			'class'=>'fullside'
    	));
    	$todate=$request->getParam("to_date");
     	if(empty($todate)){
     		$todate=date('Y-m-d');
     	}

    	$to_date->setValue($todate);
    	
    	$_id = new Zend_Form_Element_Hidden('id');
    	if($data!=null){
    		$Basic_salary->setValue($data['basic_salary']);
    		$date_start->setValue($data['date_start']);
    		$date_get_salary->setValue($data['date_get_salary']);
    		$status->setValue($data['status']);
    		$_branch_id->setValue($data['branch_id']);
    		$_id->setValue($data['id']);
    	}
    	
		$this->addElements(array($from_date,$to_date,$employee,$_status_search,$_btn_search,$_title,$_id,$date_end_contract,$position_,$staff_code,$for_month,$status,$_branch_id,$_id,$staff_name,$Basic_salary,$date_start,$date_get_salary));
		return $this;
    }
Exemplo n.º 2
0
 public function FrmAddCO($_data = null)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $_title = new Zend_Dojo_Form_Element_TextBox('adv_search');
     $_title->setAttribs(array('dojoType' => $this->tvalidate, 'onkeyup' => 'this.submit()', 'placeholder' => $this->tr->translate("SEARCH_STAFF_INFO")));
     $_title->setValue($request->getParam("adv_search"));
     $_status_search = new Zend_Dojo_Form_Element_FilteringSelect('status_search');
     $_status_search->setAttribs(array('dojoType' => $this->filter));
     $_status_opt = array(-1 => $this->tr->translate("ALL"), 1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $_status_search->setMultiOptions($_status_opt);
     $_status_search->setValue($request->getParam("status_search"));
     $_btn_search = new Zend_Dojo_Form_Element_SubmitButton('btn_search');
     $_btn_search->setAttribs(array('dojoType' => 'dijit.form.Button', 'iconclass' => 'dijitIconSearch'));
     $_co_id = new Zend_Dojo_Form_Element_TextBox('co_id');
     $_co_id->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
     $_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
     $_branch_id->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true'));
     $db = new Application_Model_DbTable_DbGlobal();
     $rows = $db->getAllBranchName();
     $options = '';
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $_branch_id->setMultiOptions($options);
     $_name_kh = new Zend_Dojo_Form_Element_TextBox('name_kh');
     $_name_kh->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
     $_enname = new Zend_Dojo_Form_Element_TextBox('first_name');
     $_enname->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
     $_lname = new Zend_Dojo_Form_Element_TextBox('last_name');
     $_lname->setAttribs(array('dojoType' => $this->text, 'class' => 'fullside'));
     $_sex = new Zend_Dojo_Form_Element_FilteringSelect('co_sex');
     $_sex->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $opt = array(1 => "Male", 2 => "Femail");
     $_sex->setMultiOptions($opt);
     $_tel = new Zend_Dojo_Form_Element_TextBox('tel');
     $_tel->setAttribs(array('dojoType' => $this->tvalidate, 'class' => 'fullside'));
     $_position = new Zend_Dojo_Form_Element_FilteringSelect('position');
     $_position->setAttribs(array('dojoType' => $this->filter, 'required' => 'true', 'class' => 'fullside'));
     $db = new Application_Model_DbTable_DbGlobal();
     $opt = $db->getAllStaffPosition(null, 1);
     $_position->setMultiOptions($opt);
     $_department = new Zend_Dojo_Form_Element_FilteringSelect('department_id');
     $_department->setAttribs(array('dojoType' => $this->filter, 'required' => 'true', 'class' => 'fullside', 'OnChange' => 'popupDepartment()'));
     $db = new Application_Model_DbTable_DbGlobal();
     $opt = $db->getAllDepartment(null, 1);
     $_department->setMultiOptions($opt);
     $_figer_print_id = new Zend_Dojo_Form_Element_TextBox('figer_print_id');
     $_figer_print_id->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
     $_email = new Zend_Dojo_Form_Element_ValidationTextBox('email');
     $_email->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside'));
     // 		$pattern="/^[a-zA-Z]+[a-zA-Z0-9]*@[a-zA-Z]+[a-zA-Z0-9][a-zA-Z]{2,4}([a-zA-Z]{2,4})?$/";
     // 		if(preg_match($pattern,$_email));
     $_national_id = new Zend_Dojo_Form_Element_TextBox('national_id');
     $_national_id->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_address = new Zend_Dojo_Form_Element_TextBox('address');
     $_address->setAttribs(array('dojoType' => $this->text, 'class' => 'fullside'));
     $_pob = new Zend_Dojo_Form_Element_TextBox('pob');
     $_pob->setAttribs(array('dojoType' => $this->text, 'class' => 'fullside'));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $_status->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_status_opt = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $_status->setMultiOptions($_status_opt);
     $_display = new Zend_Dojo_Form_Element_FilteringSelect('display');
     $_display->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_display_opt = array(1 => $this->tr->translate("NAME_KHMER"), 2 => $this->tr->translate("NAME_ENGLISH"));
     $_display->setMultiOptions($_display_opt);
     $_degree = new Zend_Dojo_Form_Element_FilteringSelect('degree');
     $_degree->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $degree_opt = $db->getAllDegree();
     $_degree->setMultiOptions($degree_opt);
     $_degree->setValue($request->getParam('degree'));
     $_basic_salary = new Zend_Dojo_Form_Element_NumberTextBox('basic_salary');
     $_basic_salary->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => true));
     $_start_work = new Zend_Dojo_Form_Element_DateTextBox('start_date');
     $_start_work->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'onchange' => 'calculateDay();'));
     $_start_work->setValue(date('Y-m-d'));
     $_end_work = new Zend_Dojo_Form_Element_DateTextBox('end_date');
     $_end_work->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside'));
     $_photo = new Zend_Form_Element_File('photo');
     $_end_work->setValue(date('Y-m-d'));
     $_contract = new Zend_Dojo_Form_Element_TextBox('contract_no');
     $_contract->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
     $_note = new Zend_Dojo_Form_Element_TextBox('note');
     $_note->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
     $opt_shift = array(1 => 'ពេញម៉ោង', 2 => 'ក្រៅម៉ោង');
     $_shift = new Zend_Dojo_Form_Element_FilteringSelect('shift');
     $_shift->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'Checktime(2)'));
     $_shift->setMultiOptions($opt_shift);
     $opt_workingtime = array(1 => 'ពេលព្រឹក និង ពេលល្ងាច​', 2 => 'ពេលព្រឹក', 3 => 'ពេលល្ងាច');
     $_workingtime = new Zend_Dojo_Form_Element_FilteringSelect('workingtime');
     $_workingtime->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'Checktime(1)'));
     $_workingtime->setMultiOptions($opt_workingtime);
     $_annual_lives = new Zend_Dojo_Form_Element_NumberTextBox('annual_lives');
     $_annual_lives->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_id = new Zend_Form_Element_Hidden('id');
     if (!empty($_data)) {
         $_co_id->setValue($_data['co_code']);
         $_name_kh->setValue($_data['co_khname']);
         $_enname->setValue($_data['co_firstname']);
         $_lname->setValue($_data['co_lastname']);
         $_annual_lives->setValue($_data['annual_lives']);
         $_position->setValue($_data['position_id']);
         $_display->setValue($_data['displayby']);
         $_national_id->setValue($_data['national_id']);
         $_pob->setValue($_data['pob']);
         $_degree->setValue($_data['degree']);
         $_tel->setValue($_data['tel']);
         $_email->setValue($_data['email']);
         $_address->setValue($_data['address']);
         $_status->setValue($_data['status']);
         $_id->setValue($_data['co_id']);
         $_basic_salary->setValue($_data['basic_salary']);
         $_start_work->setValue($_data['start_date']);
         $_end_work->setValue($_data['end_date']);
         $_contract->setValue($_data['contract_no']);
         $_note->setValue($_data['note']);
         //echo $_data['note']; exit();
         $_shift->setValue($_data['shift']);
         $_workingtime->setValue($_data['workingtime']);
         $_department->setValue($_data['department_id']);
         $_figer_print_id->setValue($_data['figer_print_id']);
         $_photo->setValue($_data['photo']);
     }
     $this->addElements(array($_figer_print_id, $_department, $_photo, $_annual_lives, $_btn_search, $_status_search, $_title, $_id, $_co_id, $_name_kh, $_branch_id, $_degree, $_national_id, $_display, $_enname, $_lname, $_sex, $_tel, $_email, $_pob, $_address, $_shift, $_workingtime, $_status, $_position, $_basic_salary, $_start_work, $_end_work, $_contract, $_note));
     return $this;
 }
 public function AdvanceSearch($data = null, $type = null)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $_title = new Zend_Dojo_Form_Element_TextBox('adv_search');
     $_title->setAttribs(array('dojoType' => $this->tvalidate, 'onkeyup' => 'this.submit()', 'placeholder' => $this->tr->translate("ADVANCE_SEARCH")));
     $_title->setValue($request->getParam("adv_search"));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $_status->setAttribs(array('dojoType' => $this->filter));
     $_status_opt = array(-1 => $this->tr->translate("ALL"), 1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $_status->setMultiOptions($_status_opt);
     $_status->setValue($request->getParam("status"));
     $db = new Application_Model_DbTable_DbGlobal();
     $employee = new Zend_Dojo_Form_Element_FilteringSelect('employee');
     $rows = $db->getAllCOName();
     $options = array('' => "---ស្វែងរកតាមរយៈឈ្មោះ---");
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['co_id']] = $row['co_khname'];
         }
     }
     $employee->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'popupCheckCO();'));
     $employee->setMultiOptions($options);
     $employee->setValue($request->getParam('employee'));
     $_btn_search = new Zend_Dojo_Form_Element_SubmitButton('btn_search');
     $_btn_search->setAttribs(array('dojoType' => 'dijit.form.Button', 'iconclass' => 'dijitIconSearch', 'label' => 'Search'));
     $branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
     $branch_id->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true'));
     $rows = $db->getAllBranchName();
     $options_branch = array('' => "---ស្វែងរកតាមរយៈសាខា---");
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options_branch[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $branch_id->setMultiOptions($options_branch);
     $branch_id->setValue($request->getParam("branch_id"));
     $approve_by = new Zend_Dojo_Form_Element_FilteringSelect('approve_by');
     $rows = $db->getAllCOName();
     $options_approve = array('' => "---ស្វែងរកអ្នកយល់ព្រម---");
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options_approve[$row['co_id']] = $row['co_khname'];
         }
     }
     $approve_by->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'popupCheckCO();'));
     $approve_by->setMultiOptions($options_approve);
     $approve_by->setValue($request->getParam("approve_by"));
     $opt_type = $db->getVewOptoinTypeByType(7, 1);
     $type = new Zend_Dojo_Form_Element_FilteringSelect('type');
     $type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'required' => true, 'class' => 'fullside'));
     $type->setMultiOptions($opt_type);
     $type->setValue($request->getParam("type"));
     // 		$from_date=new Zend_Dojo_Form_Element_DateTextBox('from_date');
     // 		$from_date->setAttribs(array(
     // 				'dojoType'=>'dijit.form.DateTextBox',
     // 				'required'=>true,
     // 				'class'=>'fullside'
     // 		));
     // 		$from_date->setValue(date('Y-m-d'));
     // // 		$from_date->setValue($request->getParam("from_date"));
     // 		$to_date=new Zend_Dojo_Form_Element_DateTextBox('to_date');
     // 		$to_date->setAttribs(array(
     // 				'dojoType'=>'dijit.form.DateTextBox',
     // 				'required'=>true,
     // 				'class'=>'fullside'
     // 		));
     // 		$to_date->setValue(date('Y-m-d'));
     // // 		$to_date->setValue($request->getParam("to_date"));
     $from_date = new Zend_Dojo_Form_Element_DateTextBox('start_date');
     $from_date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'required' => 'true', 'class' => 'fullside', 'onchange' => 'CalculateDate();'));
     $_date = $request->getParam("start_date");
     if (empty($_date)) {
         $_date = date('Y-m-d');
     }
     $from_date->setValue($_date);
     $to_date = new Zend_Dojo_Form_Element_DateTextBox('end_date');
     $to_date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'required' => 'true', 'class' => 'fullside'));
     $_date = $request->getParam("end_date");
     if (empty($_date)) {
         $_date = date("Y-m-d");
     }
     $to_date->setValue($_date);
     $position_ = new Zend_Dojo_Form_Element_FilteringSelect('position');
     $position_->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'required' => true, 'class' => 'fullside'));
     $opt_position = $db->getAllStaffPosition(null, 1);
     $position_->setMultiOptions($opt_position);
     $position_->setValue($request->getParam("position"));
     $this->addElements(array($position_, $from_date, $to_date, $type, $employee, $_title, $_title, $_status, $_btn_search, $branch_id, $approve_by));
     return $this;
 }