public function Frmchengcallecterall()
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $branch = new Zend_Dojo_Form_Element_FilteringSelect('branch');
     $branch->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true));
     $rows = $db->getAllBranchName();
     $options = '';
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $branch->setMultiOptions($options);
     $db = new Application_Model_DbTable_DbGlobal();
     $owner = new Zend_Dojo_Form_Element_FilteringSelect('owner');
     $owner->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => "popupCheckStaff();"));
     $options = $db->getGroupCodeById(2, 0, 1);
     $owner->setMultiOptions($options);
     $db = new Application_Model_DbTable_DbGlobal();
     $owner_code = new Zend_Dojo_Form_Element_FilteringSelect('owner_code');
     $group_opt = $db->getGroupCodeById(1, 0, 1);
     //code,individual,option
     $owner_code->setMultiOptions($group_opt);
     $owner_code->setValue($request->getParam('client_code'));
     $from = new Zend_Dojo_Form_Element_FilteringSelect('from');
     $from->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true));
     $from->setValue($request->getParam('from'));
     $opt = $db->getCollteralType(1);
     $from->setMultiOptions($opt);
     $to = new Zend_Dojo_Form_Element_FilteringSelect('to');
     $to->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true));
     $opt = $db->getCollteralType(1);
     $to->setMultiOptions($opt);
     $owners = new Zend_Dojo_Form_Element_TextBox('owners');
     $owners->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'required' => true));
     $_personal = new Zend_Dojo_Form_Element_FilteringSelect('personal');
     $_personal->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $opt = array(1 => 'ផ្ទាល់ខ្លួន', 2 => 'អ្នកធានាជំនួស');
     $_personal->setMultiOptions($opt);
     $_personal->setValue(1);
     $numbernote = new Zend_Dojo_Form_Element_NumberTextBox('numbernote');
     $numbernote->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => true));
     $date = new Zend_Dojo_Form_Element_DateTextBox('date');
     $date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => true));
     $date->setValue(date('Y-m-d'));
     $note = new Zend_Dojo_Form_Element_TextBox('note');
     $note->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'required' => true));
     $status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $status->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true));
     $options = array(1 => "ប្រើប្រាស់", 2 => "មិនប្រើប្រាស់");
     $status->setMultiOptions($options);
     $detial = new Zend_Dojo_Form_Element_TextBox('detial');
     $detial->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'required' => true));
     $this->addElements(array($branch, $owner, $from, $to, $date, $note, $status, $owners, $owner_code, $detial, $_personal, $numbernote));
     return $this;
 }
 public function FrmClientBlackList($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("ADVANCE_SEARCH")));
     $_title->setValue($request->getParam("adv_search"));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('status_search');
     $_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_search"));
     $_btn_search = new Zend_Dojo_Form_Element_SubmitButton('btn_search');
     $_btn_search->setAttribs(array('dojoType' => 'dijit.form.Button', 'iconclass' => 'dijitIconSearch'));
     $db = new Application_Model_DbTable_DbGlobal();
     $branch = new Zend_Dojo_Form_Element_FilteringSelect('branch');
     $branch->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $rows = $db->getAllBranchName();
     $options = '';
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $branch->setMultiOptions($options);
     $client_code = new Zend_Dojo_Form_Element_FilteringSelect('client_code');
     $client_code->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true', 'onchange' => 'getmemberIdGroup();'));
     $group_opt = $db->getGroupCodeById(1, 0, 1);
     //code,individual,option
     $client_code->setMultiOptions($group_opt);
     $client_name = new Zend_Dojo_Form_Element_FilteringSelect('client_name');
     $client_name->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => 'true', 'onchange' => 'checkMember()'));
     $options = $db->getGroupCodeById(2, 0, 1);
     $client_name->setMultiOptions($options);
     $problem = new Zend_Dojo_Form_Element_ValidationTextBox('problem');
     $problem->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside', 'required' => true));
     $date = new Zend_Dojo_Form_Element_DateTextBox('date');
     $date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => true));
     $date->setValue(date('Y-m-d'));
     $status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $status->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $opt = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($opt);
     $from_date = new Zend_Dojo_Form_Element_DateTextBox('start_date');
     $from_date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', '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);
     $_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('' => "------Select Branch Name------");
     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'));
     $_id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $branch->setValue($data['branch_id']);
         $client_code->setValue($data['client_id']);
         $client_name->setValue($data['client_id']);
         $problem->setValue($data['reasonblack_list']);
         $date->setValue($data['date_blacklist']);
         $status->setValue($data['status_blacklist']);
         $_id->setValue($data['client_id']);
     }
     $this->addElements(array($_branch_id, $from_date, $to_date, $_id, $_title, $_status, $_btn_search, $branch, $client_code, $client_name, $problem, $date, $status));
     return $this;
 }
Exemple #3
0
	public function AdvanceSearch($data=null){
		
		$db = new Application_Model_DbTable_DbGlobal();
		
		$request=Zend_Controller_Front::getInstance()->getRequest();
		$_status=  new Zend_Dojo_Form_Element_FilteringSelect('status');
		$_status->setAttribs(array('dojoType'=>'dijit.form.FilteringSelect'));
		$_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"));
		
		$_title = new Zend_Dojo_Form_Element_TextBox('adv_search');
		$_title->setAttribs(array('dojoType'=>'dijit.form.TextBox',
				'onkeyup'=>'this.submit()',
				'placeholder'=>$this->tr->translate("ADVANCE_SEARCH")
		));
		$_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',
		
		));
		
		$_group_code = new Zend_Dojo_Form_Element_FilteringSelect('group_code');
		$_group_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
// 				'class'=>'fullside',
				'onchange'=>'getmemberIdGroup();'
		));
		$group_opt = $db ->getGroupCodeById(1,1,1);
		$_group_code->setMultiOptions($group_opt);
		$_group_code->setValue($request->getParam("group_code"));
		
		$_customer_code = new Zend_Dojo_Form_Element_FilteringSelect('customer_code');
		$_customer_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'onchange'=>'getmemberIdGroup();'
		));
		$group_opt = $db ->getGroupCodeById(1,0,1);//code,individual,option
		$_customer_code->setMultiOptions($group_opt);
		$_customer_code->setValue($request->getParam("customer_code"));
		
		$_member = new Zend_Dojo_Form_Element_FilteringSelect('member');
		$_member->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'onchange'=>'checkMember()'
		));
		$options = $db->getGroupCodeById(2,0,1);
		$_member->setMultiOptions($options);
		$_member->setValue($request->getParam("member"));
		
		$_groupid = new Zend_Dojo_Form_Element_FilteringSelect('group_id');
		$_groupid->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
 				'onchange'=>'popupCheckClient();'
				));
		$options = $db ->getGroupCodeById(2,1,1);//show name,show group,show option
		$_groupid->setMultiOptions($options);
		$_groupid->setValue($request->getParam("group_id"));
		
		$_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id');
		$_coid->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'onchange'=>'popupCheckCO();'
		));
		$options = $db ->getAllCOName(1);
		$_coid->setMultiOptions($options);
		$_coid->setValue($request->getParam("co_id"));
		
		$_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type');
		$_currency_type->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
		));
		$opt = array(-1=>"--Select Currency Type--",2=>"Dollar",1=>'Khmer',3=>"Bath");
		$_currency_type->setMultiOptions($opt);
		$_currency_type->setValue($request->getParam("currency_type"));
		
		$_repayment_method = new Zend_Dojo_Form_Element_FilteringSelect('repayment_method');
		$_repayment_method->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'required' =>'true',
				'onchange'=>'chechPaymentMethod()'
		));
		$options = $db->getAllPaymentMethod(null,1);
		$options[-1]="--Select Repayment Method--";
		$_repayment_method->setMultiOptions($options);
		$opt_method = $request->getParam("repayment_method");
		if(empty($opt_method)){
			$opt_method=-1;
		}
		$_repayment_method->setValue($opt_method);
		
		$_zone = new Zend_Dojo_Form_Element_FilteringSelect('zone');
		$_zone->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'onchange'=>'popupCheckZone();'
		));
		$options = $db ->getZoneList(1);
		$_zone->setMultiOptions($options);
		$_zone->setValue($request->getParam("zone"));
		
		$_releasedate = new Zend_Dojo_Form_Element_DateTextBox('start_date');
		$_releasedate->setAttribs(array('dojoType'=>'dijit.form.DateTextBox',
// 				'class'=>'fullside',
				'onchange'=>'CalculateDate();'));
		$_date = $request->getParam("start_date");
		
		if(empty($_date)){
			$_date = date('Y-m-d');
		}
		$_releasedate->setValue($_date);
		
		
		$_dateline = new Zend_Dojo_Form_Element_DateTextBox('end_date');
		$_dateline->setAttribs(array('dojoType'=>'dijit.form.DateTextBox','required'=>'true',
// 				'class'=>'fullside',
		));
		$_date = $request->getParam("end_date");
		
		if(empty($_date)){
			$_date = date("Y-m-d");
		}
		$_dateline->setValue($_date);
		
		
		$_payterm = new Zend_Dojo_Form_Element_FilteringSelect('payment_term');
		$_payterm->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
// 				'class'=>'fullside',
				'required' =>'true'
		));
		$options= array(1=>"Day",2=>"Week",3=>"Month");
		$_payterm->setMultiOptions($options);
		$_payterm->setValue($request->getParam("payment_term"));
		
		$_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
		$_branch_id->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
		));
		
		$rows = $db->getAllBranchName();
		$options=array(-1=>'---Select Branch---');
			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"));
		
		$_pay_every = new Zend_Dojo_Form_Element_FilteringSelect('pay_every');
		$_pay_every->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
// 				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'changeCollectType();'
		));
		
		$term_opt = $db->getVewOptoinTypeByType(14,1,3);
		unset($term_opt[-1]);
		$_pay_every->setMultiOptions($term_opt);
// 		$_pay_every->setValue(3);
		$_pay_every->setValue($request->getParam('pay_every'));
		
		$client_name = new Zend_Dojo_Form_Element_FilteringSelect("client_name");
		$opt_client = array(''=>'ជ្រើសរើស ឈ្មោះអតិថិជន');
		$rows = $db->getAllClient();
		if(!empty($rows))foreach($rows AS $row){
			$opt_client[$row['id']]=$row['name'];
		}
		$client_name->setMultiOptions($opt_client);
		$client_name->setAttribs(array('dojoType'=>'dijit.form.FilteringSelect',));
		$client_name->setValue($request->getParam("client_name"));
		
		if($data!=null){
			//print_r($data);
			$_branch_id->setValue($data['member_id']);
			$_member->setValue($data['client_id']);
			$_coid->setValue($data['co_id']);
			$_zone->setValue($data['zone_id']);
			$_releasedate->setValue($data['date_release']);
			$_currency_type->setValue($data['payment_method']);
			$client_name->setValue($data['client_name']);
		}
		$this->addElements(array($client_name,$_pay_every,$_groupid,$_title,$_branch_id,$_member,$_coid,$_currency_type,$_zone,$_releasedate
				,$_payterm,$_dateline,$_group_code,$_customer_code,$_status,$_btn_search,$_repayment_method));
		return $this;
		
	}	
 public function FrmChangeCollteral($data = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $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"));
     $_client_code = new Zend_Dojo_Form_Element_FilteringSelect('client_code');
     $_client_code->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'onchange' => 'getOwnerInfo();'));
     $group_opt = $db->getGroupCodeById(1, 0, 1);
     //code,individual,option
     $_client_code->setMultiOptions($group_opt);
     $_client_code->setValue($request->getParam('client_code'));
     $_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'));
     $_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
     $_branch_id->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'required' => 'true', 'onchange' => 'filterClient();'));
     $rows = $db->getAllBranchName();
     $options = array('' => "---Select Branch Name---");
     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'));
     $db = new Application_Model_DbTable_DbGlobal();
     $co_name = new Zend_Dojo_Form_Element_FilteringSelect('co_name');
     $rows = $db->getAllCOName();
     $options = array('' => "------Select------", -1 => "Add New");
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['co_id']] = $row['co_khname'];
         }
     }
     $co_name->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'onchange' => 'popupCheckCO();'));
     $Date = new Zend_Dojo_Form_Element_DateTextBox('date');
     $Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox'));
     $number_code = new Zend_Dojo_Form_Element_NumberTextBox('number_code');
     $number_code->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'required' => true));
     $contract_code = new Zend_Dojo_Form_Element_NumberTextBox('contract_code');
     $contract_code->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'required' => true));
     $_code = new Zend_Dojo_Form_Element_NumberTextBox('code');
     $_code->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'required' => true));
     $clint_name = new Zend_Dojo_Form_Element_FilteringSelect('client_name');
     $clint_name->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'onchange' => 'checkClientCode()'));
     $options = $db->getGroupCodeById(2, 0, 1);
     $clint_name->setMultiOptions($options);
     $owner = new Zend_Dojo_Form_Element_ValidationTextBox('owner');
     $owner->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox'));
     $db = new Application_Model_DbTable_DbGlobal();
     $collteral_type = new Zend_Dojo_Form_Element_FilteringSelect('collteral_type');
     $collteral_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect'));
     $opt = $db->getCollteralType(1);
     $opt = array('' => '------Select------', 1 => 'ផ្ទាល់ខ្លួន', 2 => 'អ្នកធានាជំនួស');
     $collteral_type->setMultiOptions($opt);
     $collteral_type->setValue($request->getParam('collteral_type'));
     $note = new Zend_Dojo_Form_Element_TextBox('note');
     $note->setAttribs(array('dojoType' => 'dijit.form.TextBox'));
     $_note = new Zend_Dojo_Form_Element_TextBox('_note');
     $_note->setAttribs(array('dojoType' => 'dijit.form.TextBox'));
     $_note->setValue('return back to client');
     $Date = new Zend_Dojo_Form_Element_DateTextBox('date');
     $Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox'));
     $Date->setValue(date('Y-m-d'));
     $stutas = new Zend_Dojo_Form_Element_FilteringSelect('Stutas');
     $stutas->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect'));
     $options = array(1 => "ប្រើប្រាស់", 0 => "មិនប្រើប្រាស់");
     $stutas->setMultiOptions($options);
     $cod_cal = new Zend_Dojo_Form_Element_TextBox('cod_cal');
     $cod_cal->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'readOnly' => 'readOnly', 'style' => 'color:red'));
     $code = Group_Model_DbTable_DbCallteral::getCallteralCode();
     $cod_cal->setValue($code);
     $db = new Application_Model_DbTable_DbGlobal();
     $from = new Zend_Dojo_Form_Element_FilteringSelect('from');
     $from->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'required' => true));
     $from->setValue($request->getParam('from'));
     $opt = $db->getCollteralType(1);
     $from->setMultiOptions($opt);
     $to = new Zend_Dojo_Form_Element_FilteringSelect('to');
     $to->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'required' => true));
     $opt = $db->getCollteralType(1);
     $to->setMultiOptions($opt);
     $to->setValue($request->getParam('to'));
     $receiver_name = new Zend_Dojo_Form_Element_ValidationTextBox('receiver_name');
     $receiver_name->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'required' => true));
     $giver_name = new Zend_Dojo_Form_Element_ValidationTextBox('giver_name');
     $giver_name->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'required' => true));
     $owner_name = new Zend_Dojo_Form_Element_TextBox('owner_name');
     $owner_name->setAttribs(array('dojoType' => 'dijit.form.TextBox'));
     $collteral_id = new Zend_Form_Element_Hidden('collteral_id');
     $collteral_id->setAttribs(array('dojoType' => 'dijit.form.TextBox'));
     $changecollteral_id = new Zend_Form_Element_Text('changecollteral_id');
     $changecollteral_id->setAttribs(array('dojoType' => 'dijit.form.TextBox'));
     $from_date = new Zend_Dojo_Form_Element_DateTextBox('start_date');
     $from_date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', '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'));
     $_date = $request->getParam("end_date");
     if (empty($_date)) {
         $_date = date("Y-m-d");
     }
     $to_date->setValue($_date);
     $id = new Zend_Form_Element_Hidden("id");
     $receiver_name->setValue($this->getUserName());
     if ($data != null) {
         $_branch_id->setValue($data['branch_id']);
         $giver_name->setValue($data['giver_name']);
         $receiver_name->setValue($data['receiver_name']);
         $note->setValue($data['note']);
         $Date->setValue($data['date']);
         $stutas->setValue($data['status']);
         $_note->setValue($data['return_note']);
         $id->setValue($data['id']);
         //$_client_code->setValue($data['owner_code_id']);
         //$clint_name->setValue($data['owner_id']);
         //$collteral_id->setValue($data['collteral_id']);
         //$changecollteral_id->setValue($data['id']);
         //$to->setValue($data['to_id']);
         //$collteral_type->setValue($data['collteral_type']);
         //$number_code->setValue($data['number_code']);
         // $owner_name->setValue($data['owner']);
     }
     $this->addElements(array($from_date, $to_date, $changecollteral_id, $collteral_id, $owner_name, $giver_name, $receiver_name, $_note, $from, $to, $_client_code, $_btn_search, $_status_search, $_title, $co_name, $Date, $number_code, $contract_code, $_code, $clint_name, $owner, $collteral_type, $note, $Date, $_branch_id, $id, $stutas, $cod_cal));
     return $this;
 }
Exemple #5
0
	public function FrmAddLoan($data=null){
		
		$_isgroup = new Zend_Dojo_Form_Element_CheckBox('is_group');
		$_isgroup->setAttribs(array(
				'dojoType'=>'dijit.form.CheckBox',
				'class'=>'fullside',
				// 				'onkeyup'=>'Calcuhundred()'
		));
		
		
		$_loan_code = new Zend_Dojo_Form_Element_TextBox('loan_code');
		$_loan_code->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'readonly'=>true,
				'style'=>'color:red; font-weight: bold;'
		));
		$db = new Application_Model_DbTable_DbGlobal();
		$loan_number = $db->getLoanNumber();
		$_loan_code->setValue($loan_number);
		
		$_loan_codes = new Zend_Dojo_Form_Element_TextBox('loan_codes');
		$_loan_codes->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'readonly'=>true,
				'style'=>'color:red; font-weight: bold;'
		));
// 		$loan_numbers = $db->getLoanNumber();
// 		$_loan_codes->setValue($loan_numbers);
		
		$_client_code = new Zend_Dojo_Form_Element_TextBox('client_code');
		$_client_code->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				
		));

		$_client_codes = new Zend_Dojo_Form_Element_TextBox('client_codes');
		$_client_codes->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
		
		));
		
		$_group_code = new Zend_Dojo_Form_Element_FilteringSelect('group_code');
		$_group_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'getmemberIdGroup();'
		));
// 		$group_opt = $db ->getGroupCodeById(1,1,1);
// 		$_group_code->setMultiOptions($group_opt);
		
		$get_laonnumber = new Zend_Dojo_Form_Element_FilteringSelect('get_laonnumber');
		$get_laonnumber->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'getInfoByLoanNumber();getLoanInfoByLoanNumber();'
		));
		$group_opt = $db->getLoanAllLoanNumber(1,1);
		$get_laonnumber->setMultiOptions($group_opt);
		
		$schedule_opt = new Zend_Dojo_Form_Element_FilteringSelect('reschedule_opt');
		$schedule_opt->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
		));
		$opt = $db->getVewOptoinTypeByType(25,1,null,1);
		$schedule_opt->setMultiOptions($opt);
		
		
		$dbs = new Loan_Model_DbTable_DbLoanIL();
		
		$_customer_code = new Zend_Dojo_Form_Element_FilteringSelect('customer_code');
		$_customer_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'showPopupclient;'
		));
// 		$group_opt = $dbs ->getClient(1);//code,individual,option
		$group_opt = $db->getGroupCodeById(1,0,1);//code,individual,option
		$_customer_code->setMultiOptions($group_opt);
		
		$_customer_codes = new Zend_Dojo_Form_Element_TextBox('customer_codes');
		$_customer_codes->setAttribs(array(
				'dojoType'=>'dijit.form.textbox',
				'class'=>'fullside',
				'onchange'=>'showPopupclient;'
		));
		// 		$group_opt = $dbs ->getClient(1);//code,individual,option
// 		$_member = new Zend_Dojo_Form_Element_FilteringSelect('member');
// 		$_member->setAttribs(array(
// 				'dojoType'=>'dijit.form.FilteringSelect',
// 				'class'=>'fullside',
// 				'onchange'=>'showPopupclient();'
// 		));
		
// 		$options = $db->getGroupCodeById(2,0,1);
// 		$_member->setMultiOptions($options);
		
		
		
		$_members = new Zend_Dojo_Form_Element_TextBox('members');
		$_members->setAttribs(array(
				'dojoType'=>'dijit.form.textbox',
				'class'=>'fullside',
				//'onchange'=>'showPopupclient();'
		));
		// 		$options = $dbs->getClient(2);
		
		
		$_groupid = new Zend_Dojo_Form_Element_FilteringSelect('group_id');
		$_groupid->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
 				'onchange'=>'popupCheckClient();'
				));
// 		$options = $db->getGroupCodeById(2,1,1);//show name,show group,show option
// 		$_groupid->setMultiOptions($options);
		
		$_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id');
		$_coid->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'popupCheckCO();'
		));
		$options = $db ->getAllCOName(1);
		$_coid->setMultiOptions($options);
		
		$_coids = new Zend_Dojo_Form_Element_FilteringSelect('co_ids');
		$_coids->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'popupCheckCO();'
		));
		$optionss = $db ->getAllCOName(1);
		$_coids->setMultiOptions($optionss);
		
		$_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type');
		$_currency_type->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
		));
// 		$opt = array(2=>"Dollar",1=>'Khmer',3=>"Bath");
		$opt = $db->getVewOptoinTypeByType(15,1,3,1);
		$_currency_type->setMultiOptions($opt);
		$_currency_type->setValue(2);
		
		$_loan_type = new Zend_Dojo_Form_Element_FilteringSelect('loan_type');
		$_loan_type->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onChange'=>'loantype();'
		));
		$opt = $db->getVewOptoinTypeByType(24,1,null,1);
		$opt[-1]="--- Add New---";
		$_loan_type->setMultiOptions($opt);
		
		$_loan_types = new Zend_Dojo_Form_Element_FilteringSelect('loan_types');
		$_loan_types->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onChange'=>'loantype();'
		));
		$opts = $db->getVewOptoinTypeByType(24,1,null,1);
		$opt[-1]="--- Add New---";
		$_loan_types->setMultiOptions($opts);
		
		$_zone = new Zend_Dojo_Form_Element_FilteringSelect('zone');
		$_zone->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'zone();'
		));
		$options = $db ->getZoneList(1);
		$options[-1]="--- Add New---";
		$_zone->setMultiOptions($options);
		
		$_zones = new Zend_Dojo_Form_Element_FilteringSelect('zones');
		$_zones->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'zone();'
		));
		$optionsf = $db ->getZoneList(1);
		$optionsf[-1]="--- Add New---";
		$_zones->setMultiOptions($optionsf);
		
		$_loan_fee = new Zend_Dojo_Form_Element_NumberTextBox('loan_fee');
		$_loan_fee->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required'=>true
		));
		$_loan_fee->setValue(0);
		
		$_loan_fees = new Zend_Dojo_Form_Element_NumberTextBox('loan_fees');
		$_loan_fees->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required'=>true
		));
		$_loan_fees->setValue(0);
		
		$_other_fee = new Zend_Dojo_Form_Element_NumberTextBox('other_fee');
		$_other_fee->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required'=>true,
		));
		$_other_fee->setValue(0);
		
		$_other_fees = new Zend_Dojo_Form_Element_NumberTextBox('other_fees');
		$_other_fees->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required'=>true,
		));
		$_other_fees->setValue(0);
		
		$_time_collect = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect');
		$_time_collect->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'onkeyup'=>'getFirstPayment();'
		));
 		$_time_collect->setValue(1);
 		
 		$_time_collect_pri = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect_pricipal');
 		$_time_collect_pri->setAttribs(array(
 				'dojoType'=>'dijit.form.NumberTextBox',
 				'class'=>'fullside',
 				'readonly'=>true,
 				'required'=>true
 		));
 		$_time_collect_pri->setValue(0);
 		
 		$dbs = new Loan_Model_DbTable_DbLoanss();
		$_amount = new Zend_Dojo_Form_Element_NumberTextBox('total_amount');
		$_amount->setAttribs(array(
						'dojoType'=>'dijit.form.NumberTextBox',
						'class'=>'fullside',
						'required' =>'true',
				        'onkeyup'=>'calCulateAdminFee();'
		));
		
		$_level = new Zend_Dojo_Form_Element_NumberTextBox('level');
		$_level->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_level->setValue(1);
		$_levels = new Zend_Dojo_Form_Element_NumberTextBox('levels');
		$_levels->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_levels->setValue(1);


		$_rate =  new Zend_Dojo_Form_Element_NumberTextBox("interest_rate");
		$_rate->setAttribs(array(
				'data-dojo-Type'=>'dijit.form.NumberTextBox',
				'data-dojo-props'=>"
				'required':true,
				'name':'interest_rate',
				'value':2.5,
				'class':'fullside',
				'invalidMessage':'អាចបញ្ជូលពី 1 ដល់'
				 
				"));
				
		$_period = new Zend_Dojo_Form_Element_NumberTextBox('period');
		$_period->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true',
				'onkeyup'=>'calCulatePeriod();'
		));
		$_period->setValue(12);
		
		$_releasedate = new Zend_Dojo_Form_Element_DateTextBox('release_date');
		$_releasedate->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'checkReleaseDate();'
		));
		$s_date = date('Y-m-d');
		$_releasedate->setValue($s_date);
		
		$_first_payment = new Zend_Dojo_Form_Element_DateTextBox('first_payment');
		$_first_payment->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				'required' =>'true',
			    'onchange'=>'calCulateEndDate();'
				
		));
		//$_first_payment->setValue('2005-12-30');
		
		$_dateline = new Zend_Dojo_Form_Element_DateTextBox('date_line');
		$_dateline->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				'required' =>'true',
				'readonly'=>true,
		));
		
		
		$_graice_pariod = new Zend_Dojo_Form_Element_TextBox('graice_pariod');
		$_graice_pariod->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'required'=>'true',
				'onKeyup'=>'CompareGraicePariod();'
				//'readOnly'=>true,
		));
		$_graice_pariod->setValue(0);
		
		$_collect_term = new Zend_Dojo_Form_Element_FilteringSelect('collect_termtype');
 		$_collect_term->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'changeGraicePeroid();'
		));
		$term_opt = $db->getVewOptoinTypeByType(14,1,3,1);
		$_collect_term->setMultiOptions($term_opt);
	
		$_payterm = new Zend_Dojo_Form_Element_FilteringSelect('payment_term');
		$_payterm->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_payterm->setMultiOptions($term_opt);
		$_pay_every = new Zend_Dojo_Form_Element_FilteringSelect('pay_every');
		$_pay_every->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'changeCollectType();'
		));
// 		$options= array(1=>"Day",2=>"Week",3=>"Month");
// 		$_pay_every->setMultiOptions($options);
		$_pay_every->setValue(3);
		$_pay_every->setMultiOptions($term_opt);
		$_every_payamount = new Zend_Dojo_Form_Element_FilteringSelect('every_payamount');
		$_every_payamount->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true'
		));
		$options= array(2=>"After",1=>"Before",3=>"Normal");
		$_every_payamount->setMultiOptions($options);
		
		$_time= new Zend_Dojo_Form_Element_TextBox('time');
		$_time->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
		));
		$set_time='10:00-11:00 AM';
		$_time->setValue($set_time);
		
		$_paybefore = new Zend_Dojo_Form_Element_NumberTextBox('pay_before');
		$_paybefore->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_paybefore->setValue(0);
		
		$_pay_late = new Zend_Dojo_Form_Element_NumberTextBox('pay_late');
		$_pay_late->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_pay_late->setValue(0);
		$arr=$db->getSystemSetting('interest_late');
		$_pay_late->setValue($arr['value']);
		
// 		print_r($arr);exit();
		
		$_branch_id = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
		$_branch_id->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'filterClient();'
		));
		
		$rows = $db->getAllBranchName();
		$options=array(''=>'---Select Branch---');
			if(!empty($rows))foreach($rows AS $row){
				$options[$row['br_id']]=$row['branch_namekh'];
			}
		$_branch_id->setMultiOptions($options);
		
// 		$_branch_ids = new Zend_Dojo_Form_Element_FilteringSelect('branch_ids');
// 		$_branch_ids->setAttribs(array(
// 				'dojoType'=>'dijit.form.FilteringSelect',
// 				'class'=>'fullside',
// 				'required' =>'true',
// 				'onchange'=>'filterClient();'
// 		));
		
// 		$rows = $db->getAllBranchName();
// 		$optionsa=array(''=>'---Select Branch---');
// 		if(!empty($rows))foreach($rows AS $row){
// 			$optionsa[$row['br_id']]=$row['branch_namekh'];
// 		}
// 		$_branch_ids->setMultiOptions($optionsa);
		
		$_repayment_method = new Zend_Dojo_Form_Element_FilteringSelect('repayment_method');
		$_repayment_method->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'chechPaymentMethod()'
		));
		$options = $db->getAllPaymentMethod(null,1);
		$_repayment_method->setMultiOptions($options);
		
		$_status = new Zend_Dojo_Form_Element_FilteringSelect('status_using');
		$_status->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true'
		));
// 		$options= array(1=>"Befor",2=>"After",3=>"Cancel");
		$options= array(1=>"Active",0=>"Cancel");
		$_status->setMultiOptions($options);
		
		$_interest = new Zend_Dojo_Form_Element_TextBox("interest");
		$_interest->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		
		$penalize = new Zend_Dojo_Form_Element_TextBox("penalize");
		$penalize->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		
		$_service_charge = new Zend_Dojo_Form_Element_TextBox("service_charge");
		$_service_charge->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		
		$_instalment_date = new Zend_Form_Element_Hidden("instalment_date");
		
		$_release_date = new Zend_Form_Element_Hidden("old_release_date");
		
		$_interest_rate = new Zend_Form_Element_Hidden("old_rate");
		
		$_old_payterm = new Zend_Form_Element_Hidden("old_payterm");
		
		$_id = new Zend_Form_Element_Hidden('id');
		if($data!=null){
// 			print_r($data);
			$_branch_id->setValue($data['branch_id']);
			$_loan_code->setValue($data['loan_number']);
			$_level->setValue($data['level']);
			$_loan_fee->setValue($data['admin_fee']);
			$_other_fee->setValue($data['other_fee']);
// 			$_member->setValue($data['client_id']);
			$_customer_code->setValue($data['client_id']);
			$_coid->setValue($data['co_id']);
			$_zone->setValue($data['zone_id']);
			$_releasedate->setValue($data['date_release']);
			$_period->setValue($data['total_duration']);
			$_first_payment->setValue($data['first_payment']);
			$_time->setValue($data['time_collect']);
			$_every_payamount->setValue($data['holiday']);
			$_amount->setValue($data['total_capital']);
			$_currency_type->setValue($data['currency_type']);
			$_rate->setValue($data['interest_rate']);//
			$_rate->setAttribs(array(
					'data-dojo-props'=>"
					'value':'".$data['interest_rate']."'"));
			$_repayment_method->setValue($data['payment_method']);
			$_graice_pariod->setValue($data['graice_period']);
			$_time_collect_pri->setValue($data['semi']);
			$_dateline->setValue($data['date_line']);
			$_pay_every->setValue($data['pay_term']);
			$_time_collect->setValue($data['amount_collect_principal']);
			$_collect_term->setValue($data['collect_typeterm']);
			$_pay_late->setValue($data['pay_after']);
			$_paybefore->setValue($data['pay_before']);
			$_id->setValue($data['g_id']);
			
			$_group_code->setValue($data['client_id']);
// 			$_groupid->setValue($data['client_id']);
			$get_laonnumber->setvalue($data['g_id']);
			$_status->setValue($data['status']);
			
// 			print_r($data);
		}
		$this->addElements(array($_groupid,$_old_payterm,$_interest_rate,$_release_date,$_instalment_date,$_interest,$penalize,$_service_charge,$schedule_opt,$_loan_types,$_loan_fees,$_other_fees,$_zones
				,$_client_codes,$_loan_codes,$_members,$_customer_codes,$_levels,$_coids,$get_laonnumber,$_loan_type,
				$_other_fee,$_isgroup,$_client_code,$_time_collect,$_loan_fee,$_level,$_paybefore,
				$_pay_late,$_branch_id,$_coid,$_currency_type,$_zone,$_amount,$_rate,$_releasedate
				,$_payterm,$_every_payamount,$_time,$_time_collect_pri,$_status,$_graice_pariod,$_period,
				$_first_payment,$_repayment_method,$_pay_every,$_loan_code,$_collect_term,$_dateline,
				$_group_code,$_customer_code,$_id));
		return $this;
		
	}	
	public function FrmAddLoan($data=null){
		
		$_isgroup = new Zend_Dojo_Form_Element_CheckBox('is_group');
		$_isgroup->setAttribs(array(
				'dojoType'=>'dijit.form.CheckBox',
				'class'=>'fullside',
				// 				'onkeyup'=>'Calcuhundred()'
		));
		
		
		$_loan_code = new Zend_Dojo_Form_Element_TextBox('loan_code');
		$_loan_code->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'readonly'=>true,
				'style'=>'color:red; font-weight: bold;'
		));
		$db = new Application_Model_DbTable_DbGlobal();
		$loan_number = $db->getLoanNumber();
		$_loan_code->setValue($loan_number);
		
		$_client_code = new Zend_Dojo_Form_Element_TextBox('client_code');
		$_client_code->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
		));
		
		$_group_code = new Zend_Dojo_Form_Element_FilteringSelect('group_code');
		$_group_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'getmemberIdGroup();'
		));
		$group_opt = $db ->getGroupCodeById(1,1,1);
		$_group_code->setMultiOptions($group_opt);
		
		$dbs = new Loan_Model_DbTable_DbLoanss();
		
		$_customer_code = new Zend_Dojo_Form_Element_FilteringSelect('customer_code');
		$_customer_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'getClientInfo(1);'
		));
		$group_opt = $dbs ->getClientByTypes(1);//code,individual,option
		$_customer_code->setMultiOptions($group_opt);
		
		
		$_member = new Zend_Dojo_Form_Element_FilteringSelect('member');
		$_member->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'getClientInfo(2)'
		));
		$options = $dbs->getClientByTypes(2);
		$_member->setMultiOptions($options);
		
		$db = new Application_Model_DbTable_DbGlobal();
		$_groupid = new Zend_Dojo_Form_Element_FilteringSelect('group_id');
		$_groupid->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
 				'onchange'=>'popupCheckClient();'
				));
		$options = $db ->getGroupCodeById(2,1,1);//show name,show group,show option
		$_groupid->setMultiOptions($options);
		
		$_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id');
		$_coid->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'popupCheckCO();'
		));
		$options = $db ->getAllCOName(1);
		$_coid->setMultiOptions($options);
		
		$_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type');
		$_currency_type->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
		));
		$opt = array(2=>"Dollar",1=>'Khmer',3=>"Bath");
// 		$opt = $db->getVewOptoinTypeByType(15,1,3);
		$_currency_type->setMultiOptions($opt);
		
		$_zone = new Zend_Dojo_Form_Element_FilteringSelect('zone');
		$_zone->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'popupCheckZone();'
		));
		$options = $db ->getZoneList(1);
		$_zone->setMultiOptions($options);
		
		$_loan_fee = new Zend_Dojo_Form_Element_NumberTextBox('loan_fee');
		$_loan_fee->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
		));
		$_loan_fee->setValue(0);
		
		$_time_collect = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect');
		$_time_collect->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'onkeyup'=>'getFirstPayment();'
		));
 		$_time_collect->setValue(1);
 		
 		$_time_collect_pri = new Zend_Dojo_Form_Element_NumberTextBox('amount_collect_pricipal');
 		$_time_collect_pri->setAttribs(array(
 				'dojoType'=>'dijit.form.NumberTextBox',
 				'class'=>'fullside',
 				'readonly'=>true,
 				'required'=>true
 		));
 		$_time_collect_pri->setValue(2);
 		
 		$dbs = new Loan_Model_DbTable_DbLoanss();
		$_amount = new Zend_Dojo_Form_Element_NumberTextBox('total_amount');
		$_amount->setAttribs(array(
						'dojoType'=>'dijit.form.NumberTextBox',
						'class'=>'fullside',
						'required' =>'true'
		));
		
		$_level = new Zend_Dojo_Form_Element_NumberTextBox('level');
		$_level->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_level->setValue(1);
		


		$_rate =  new Zend_Dojo_Form_Element_ValidationTextBox("interest_rate");
		$_rate->setAttribs(array(
				'data-dojo-Type'=>'dijit.form.ValidationTextBox',
				'data-dojo-props'=>"
				'required':true,
				'name':'interest_rate',
				'value':2.5,
				'class':'fullside',
				'invalidMessage':'អាចបញ្ជូលពី 1 ដល់  
				'"));
				
		$_period = new Zend_Dojo_Form_Element_NumberTextBox('period');
		$_period->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true',
				'onkeyup'=>'calCulatePeriod();'
		));
		$_period->setValue(12);
		
		$_releasedate = new Zend_Dojo_Form_Element_DateTextBox('release_date');
		$_releasedate->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'checkReleaseDate();'
		));
		$s_date = date('Y-m-d');
		$_releasedate->setValue($s_date);
		
		$_first_payment = new Zend_Dojo_Form_Element_DateTextBox('first_payment');
		$_first_payment->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				'required' =>'true',
				//'onchange'=>'calCulateFirstPayment();'
				
		));
		//$_first_payment->setValue('2005-12-30');
		
		$_dateline = new Zend_Dojo_Form_Element_DateTextBox('date_line');
		$_dateline->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				'required' =>'true',
				'readonly'=>true,
		));
		
		
		$_graice_pariod = new Zend_Dojo_Form_Element_TextBox('graice_pariod');
		$_graice_pariod->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
				'required'=>'true',
				'onKeyup'=>'CompareGraicePariod();'
				//'readOnly'=>true,
		));
		$_graice_pariod->setValue(0);
		
		$_collect_term = new Zend_Dojo_Form_Element_FilteringSelect('collect_termtype');
		$_collect_term->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'changeGraicePeroid();'
		));
		$term_opt = $db->getVewOptoinTypeByType(1,1,3);
		$_collect_term->setMultiOptions($term_opt);
	
		$_payterm = new Zend_Dojo_Form_Element_FilteringSelect('payment_term');
		$_payterm->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true'
		));
// 		$options= array(1=>"Day",2=>"Week",3=>"Month");
// 		$_payterm->setMultiOptions($options);
		$_payterm->setMultiOptions($term_opt);
		
		$_pay_every = new Zend_Dojo_Form_Element_FilteringSelect('pay_every');
		$_pay_every->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'changeCollectType();'
		));
// 		$options= array(1=>"Day",2=>"Week",3=>"Month");
// 		$_pay_every->setMultiOptions($options);
		$_pay_every->setValue(3);
		$_pay_every->setMultiOptions($term_opt);
		
		$_every_payamount = new Zend_Dojo_Form_Element_FilteringSelect('every_payamount');
		$_every_payamount->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true'
		));
		$options= array(2=>"After",1=>"Before",3=>"Normal");
		$_every_payamount->setMultiOptions($options);
		
		$_time= new Zend_Dojo_Form_Element_TextBox('time');
		$_time->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
		));
		$set_time='10:00-11:00 AM';
		$_time->setValue($set_time);
		
		$_paybefore = new Zend_Dojo_Form_Element_NumberTextBox('pay_before');
		$_paybefore->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_paybefore->setValue(0);
		
		$_pay_late = new Zend_Dojo_Form_Element_NumberTextBox('pay_late');
		$_pay_late->setAttribs(array(
				'dojoType'=>'dijit.form.NumberTextBox',
				'class'=>'fullside',
				'required' =>'true'
		));
		$_pay_late->setValue(0);
		
		$_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='';
			if(!empty($rows))foreach($rows AS $row){
				$options[$row['br_id']]=$row['branch_namekh'];
			}
		$_branch_id->setMultiOptions($options);
		
		$_repayment_method = new Zend_Dojo_Form_Element_FilteringSelect('repayment_method');
		$_repayment_method->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true',
				'onchange'=>'chechPaymentMethod()'
		));
		$options = $db->getAllPaymentMethod(null,1);
		$_repayment_method->setMultiOptions($options);
		
		$_holiday = new Zend_Dojo_Form_Element_FilteringSelect('holiday');
		$_holiday->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'required' =>'true'
		));
		$options= array(1=>"Befor",2=>"After",3=>"Cancel");
		$_holiday->setMultiOptions($options);
		
		$_id = new Zend_Form_Element_Hidden('id');
		if($data!=null){
// 			print_r($data);
			$_branch_id->setValue($data['branch_id']);
			$_loan_code->setValue($data['loan_number']);
			$_level->setValue($data['level']);
			$_loan_fee->setValue($data['admin_fee']);
			$_member->setValue($data['client_id']);
			$_customer_code->setValue($data['client_id']);
			$_coid->setValue($data['co_id']);
			$_zone->setValue($data['zone_id']);
			$_releasedate->setValue($data['date_release']);
			$_period->setValue($data['total_duration']);
			$_first_payment->setValue($data['first_payment']);
			$_time->setValue($data['time_collect']);
			$_every_payamount->setValue($data['holiday']);
			$_amount->setValue($data['total_capital']);
			$_currency_type->setValue($data['currency_type']);
			$_rate->setValue($data['interest_rate']);//
			$_rate->setAttribs(array(
					'data-dojo-props'=>"
					'value':'".$data['interest_rate']."'"));
			$_repayment_method->setValue($data['payment_method']);
			$_graice_pariod->setValue($data['graice_period']);
			$_time_collect_pri->setValue($data['semi']);
			$_dateline->setValue($data['date_line']);
			$_pay_every->setValue($data['pay_term']);
			$_time_collect->setValue($data['amount_collect_principal']);
			$_collect_term->setValue($data['collect_typeterm']);
			$_pay_late->setValue($data['pay_after']);
			$_paybefore->setValue($data['pay_before']);
			$_id->setValue($data['g_id']);
			
			$_group_code->setValue($data['client_id']);
			$_groupid->setValue($data['client_id']);
			
// 			print_r($data);
		}
		$this->addElements(array($_isgroup,$_groupid,$_client_code,$_time_collect,$_loan_fee,$_level,$_paybefore,$_pay_late,$_branch_id,$_member,$_coid,$_currency_type,$_zone,$_amount,$_rate,$_releasedate
				,$_payterm,$_every_payamount,$_time,$_time_collect_pri,$_holiday,$_graice_pariod,$_period,
				$_first_payment,$_repayment_method,$_pay_every,$_loan_code,$_collect_term,$_dateline,
				$_group_code,$_customer_code,$_id));
		return $this;
		
	}	
Exemple #7
0
	public function FrmTransfer($data=null){
		
		$request=Zend_Controller_Front::getInstance()->getRequest();
		
		$db = new Application_Model_DbTable_DbGlobal();
		$db_co = new Loan_Model_DbTable_DbTransferCoClient();
		$branch_name = new Zend_Dojo_Form_Element_FilteringSelect('branch_name');
    	$branch_name->setAttribs(array(
    			'dojoType'=>'dijit.form.FilteringSelect',
    			'class'=>'fullside',
    			'required' =>'true'
    	));
    	$rows = $db->getAllBranchName();
    	$options=array(''=>"------Select Branch Name------");
    	if(!empty($rows))
    		foreach($rows AS $row){
    		$options[$row['br_id']]=$row['branch_namekh'];
    	}
    	$branch_name->setMultiOptions($options);
    	$branch_name->setValue($request->getParam('branch_name'));    	
		
		$_date= new Zend_Dojo_Form_Element_DateTextBox('Date');
		$_date->setAttribs(array(
				'dojoType'=>'dijit.form.DateTextBox',
				'class'=>'fullside',
				
		));
		$_date->setValue(date('Y-m-d'));
		$co_code = new Zend_Dojo_Form_Element_FilteringSelect('co_code');
		$co_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>"getClientInfo(1);"
		));
	
		$_member = new Zend_Dojo_Form_Element_FilteringSelect('member');
		$_member->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>'getClientInfo(1);'
		));
		
		$db = new Application_Model_DbTable_DbGlobal();
		$options = $db->getGroupCodeById(2,0,1);
		$_member->setMultiOptions($options);
		
		$_customer_code = new Zend_Dojo_Form_Element_FilteringSelect('customer_code');
		$_customer_code->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				 'onchange'=>'getClientInfo(2);'
		));
		$group_opt = $db->getGroupCodeById(1,0,1);//code,individual,option
		$_customer_code->setMultiOptions($group_opt);
		
		
		$row_co = $db->getAllCOName();
		$options_co =array(''=>"------Select From CO ------");
		if (!empty($row_co))
			foreach ($row_co AS $row_cos){
			$options_co[$row_cos['co_id']] = $row_cos['co_firstname'];
		}
		$co_code->setMultiOptions($options_co);
		$co_code->setValue($request->getParam('co_code'));
		
		
		
		$formc_co = new Zend_Dojo_Form_Element_FilteringSelect('name_co');
		$formc_co->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
			    'onchange'=>"getClientInfo(2);"
				));
		$options = $db->getAllCOName(1);
		$options['']='---Select To CO---';
		$formc_co->setMultiOptions($options);
		$formc_co->setValue($request->getParam('name_co'));
		
		$name_client = new Zend_Dojo_Form_Element_FilteringSelect('name_client');
		$name_client->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>"getClientInfo(3);"
		));
		$row_co = $db_co->getcoinfo();
		$options_co =array(''=>"---Select Client Name---");
		if (!empty($row_co))
			foreach ($row_co AS $row_cos){
			$options_co[$row_cos['member_id']] = $row_cos['client_name'];
		}
		$name_client->setMultiOptions($options_co);
		
		$code_client = new Zend_Dojo_Form_Element_FilteringSelect('code_client');
		$code_client->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>"getClientInfo(4);"
		));
		$row_number = $db_co->getcoinfo();
		$options_numbers=array(''=>"---Select Client Code---");
		if (!empty($row_number))
			foreach ($row_number AS $row_client){
			$options_numbers[$row_client['member_id']] = $row_client['client_code'];
		}
		$code_client->setMultiOptions($options_numbers);
		
		$loan_number= new Zend_Dojo_Form_Element_FilteringSelect('loan_number');
		$loan_number->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>"getClientInfo(5);"
		));
		$row_number = $db_co->getcoinfo();
		$options_from =array(''=>"------Select Loan Number------");
		if (!empty($row_number))
			foreach ($row_number AS $row_numbers){
			$options_from[$row_numbers['member_id']] = $row_numbers['loan_number'];
		}		
		$loan_number->setMultiOptions($options_from);
		$loan_number->setValue($request->getParam("loan_number")); 
		
		$loan_client = new Zend_Dojo_Form_Element_FilteringSelect('loan_client');
		$loan_client->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
				'onchange'=>"getClientInfo(3);"
		));
		$loan_clientgroup = $db_co->getcoinfo();
		$options_loan_client =array(''=>"------Select Client Name------");
		if (!empty($loan_clientgroup))
			foreach ($loan_clientgroup AS $loan_clientgroups){
			$options_loan_client[$loan_clientgroups['member_id']] = $loan_clientgroups['client_name'];
		}
		$loan_client->setMultiOptions($options_loan_client);
		$loan_client->setValue($request->getParam('loan_client'));
		
		$desc = new Zend_Dojo_Form_Element_TextBox('note');
		$desc ->setAttribs(array(
				'dojoType'=>'dijit.form.TextBox',
				'class'=>'fullside',
		));
		$desc->setValue($request->getParam('note'));
		
		$note = new Zend_Dojo_Form_Element_Textarea('Note');
		$note ->setAttribs(array(
				'dojoType'=>'dijit.form.SimpleTextarea',
				'class'=>'fullside',
				'required' =>true,
				'style'=>'width:98%'
		));
		
		$user_id = new Zend_Dojo_Form_Element_FilteringSelect('user_id');
		$user_id->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'class'=>'fullside',
		));
		$row_froms = $db_co->getcoinfo();
		$options_from =array(''=>"------Select------");
		if (!empty($row_froms))
			foreach ($row_froms AS $row_from){
		}
		$user_id->setMultiOptions($options_from);	

		$_arr = array(1=>$this->tr->translate("ACTIVE"),0=>$this->tr->translate("DACTIVE"),-1=>$this->tr->translate("ALL"));
		$_status = new Zend_Dojo_Form_Element_FilteringSelect("status");
		$_status->setMultiOptions($_arr);
		$_status->setAttribs(array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'required'=>'true',
				'missingMessage'=>'Invalid Module!',
				'class'=>'fullside'));
		
		$star_date = new Zend_Dojo_Form_Element_DateTextBox('start_date');
		$star_date->setAttribs(array('dojoType'=>'dijit.form.DateTextBox'));
		$date = $request->getParam("start_date");
		
		if(empty($date)){
			$date = date('Y-m-01');
		}
		$star_date->setValue($date);
		
		$_enddate = new Zend_Dojo_Form_Element_DateTextBox('end_date');
		$_enddate->setAttribs(array('dojoType'=>'dijit.form.DateTextBox','required'=>'true',
		));
		$date = $request->getParam("end_date");
		
		if(empty($date)){
			$date = date("Y-m-d");
		}
		$_enddate->setValue($date);

		$_btn_search = new Zend_Dojo_Form_Element_SubmitButton('btn_search');
		$_btn_search->setAttribs(array(
				'dojoType'=>'dijit.form.Button',
				'iconclass'=>'dijitIconSearch',
		));
		
		if($data!=null){				
			$branch_name->setValue($data['branch_id']);
			$co_code->setValue($data['code_to']);
			$formc_co->setValue($data['to']);
			$name_client->setValue($data['client_id']);
			$code_client->setValue($data['client_id']);			
			$_status->setValue($data['status']);
			$_date->setValue($data['date']);
			$note->setValue($data['note']);
			$loan_number->setValue($data['loan_id']);
			$loan_client->setValue($data['loan_id']);
			$_member->setValue($data['client_id']);
			$_member->setValue($data['client_id']);
			$_customer_code->setValue($data['client_id']);
		}		
		
		$this->addElements(array($_customer_code,$_member,$_btn_search,$desc,$star_date,$_enddate,$loan_client,$loan_number,$_status,$branch_name,$_date,$formc_co,$name_client,$co_code,$code_client,$note,$user_id));
		return $this;
	}	
 public function FrmReturnCollteral($data = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $_client_code = new Zend_Dojo_Form_Element_FilteringSelect('client_code');
     $_client_code->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'getOwnerInfo();'));
     $group_opt = $db->getGroupCodeById(1, 0, 1);
     //code,individual,option
     $_client_code->setMultiOptions($group_opt);
     $_client_code->setValue($request->getParam('client_code'));
     $clint_name = new Zend_Dojo_Form_Element_FilteringSelect('client_name');
     $clint_name->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'checkClientCode()'));
     $options = $db->getGroupCodeById(2, 0, 1);
     $clint_name->setMultiOptions($options);
     $_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_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'));
     $Date = new Zend_Dojo_Form_Element_DateTextBox('date');
     $Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside'));
     $note = new Zend_Dojo_Form_Element_TextBox('note');
     $note->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside'));
     $note->setValue('out of loan');
     $Date->setValue(date('Y-m-d'));
     $stutas = new Zend_Dojo_Form_Element_FilteringSelect('stutas');
     $stutas->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $options = array(1 => "ប្រើប្រាស់", 0 => "មិនប្រើប្រាស់");
     $stutas->setMultiOptions($options);
     $receiver_name = new Zend_Dojo_Form_Element_ValidationTextBox('receiver_name');
     $receiver_name->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside', 'required' => true));
     $giver_name = new Zend_Dojo_Form_Element_ValidationTextBox('giver_name');
     $giver_name->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside', 'required' => true));
     $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);
     $from = new Zend_Dojo_Form_Element_FilteringSelect('from');
     $from->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true));
     $from->setValue($request->getParam('from'));
     $opt = $db->getCollteralType(1);
     $from->setMultiOptions($opt);
     $_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('' => "------Select Branch Name------");
     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'));
     $collteral_type = new Zend_Dojo_Form_Element_FilteringSelect('collteral_type');
     $collteral_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $opt = $db->getCollteralType(1);
     $collteral_type->setMultiOptions($opt);
     $collteral_type->setValue($request->getParam('collteral_type'));
     $id = new Zend_Form_Element_Hidden("id");
     $receiver_name->setValue($this->getUserName());
     if ($data != null) {
         $_branch_id->setValue($data['branch_id']);
         $clint_name->setValue($data['client_id']);
         $_client_code->setValue($data['client_id']);
         $giver_name->setValue($data['receiver_name']);
         $receiver_name->setValue($data['giver_name']);
         $note->setValue($data['note']);
         $Date->setValue($data['date']);
         $stutas->setValue($data['status']);
         $id->setValue($data['return_id']);
     }
     $this->addElements(array($collteral_type, $_branch_id, $from, $_client_code, $clint_name, $from_date, $to_date, $giver_name, $receiver_name, $_btn_search, $_status_search, $_title, $Date, $note, $Date, $id, $stutas));
     return $this;
 }