Ejemplo n.º 1
0
 public function addProgramName($data = null, $type = null)
 {
     $_title = new Zend_Dojo_Form_Element_TextBox('title');
     $_title->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
     $_db = new Application_Model_DbTable_DbGlobal();
     if (!empty($type)) {
         $rows = $_db->getServiceType(2);
     } else {
         $rows = $_db->getServiceType(1);
     }
     //array_unshift($rows,array('id' => '-1',"title"=>$this->tr->translate("ADD")) );
     $opt = "";
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $opt[$row['id']] = $row['title'];
         }
     }
     $_service_name = new Zend_Dojo_Form_Element_FilteringSelect("type");
     $_service_name->setMultiOptions($opt);
     $_service_name->setAttribs(array('dojoType' => $this->filter, 'required' => 'true', 'class' => 'fullside'));
     $_desc = new Zend_Dojo_Form_Element_Textarea('desc');
     $_desc->setAttribs(array('dojoType' => $this->tarea, 'class' => 'fullside', 'style' => 'width:96%;min-height:50px;'));
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('status_program');
     $_status->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_status_opt = array(1 => $this->tr->translate("ACTIVE"), 2 => $this->tr->translate("DACTIVE"));
     $_status->setMultiOptions($_status_opt);
     if (!empty($data)) {
         $_title->setValue($data['title']);
         $_desc->setValue($data['desc']);
     }
     $this->addElements(array($_service_name, $_title, $_desc, $_status));
     return $this;
 }
Ejemplo n.º 2
0
 public function editAction()
 {
     $db = new agreement_Model_DbTable_DbAgreement();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         try {
             $db->addAgreement($data);
             Application_Form_FrmMessage::Sucessfull("EDIT_SUCCESS", "/agreement/imdex/add");
         } catch (Exception $e) {
             Application_Form_FrmMessage::message("Application Error");
             Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
         }
     }
     $id = $this->getRequest()->getParam('id');
     if (empty($id)) {
         $this->_redirect("/agreement");
     }
     $this->view->row_agreement = $db->getAgreementById($id);
     print_r($db->getAgreementById($id));
     $db = new Application_Model_DbTable_DbGlobal();
     $this->view->rs_tax = $db->getAllTax();
     $owner = $db->getAllNameOwner();
     $this->view->country = $db->getAllCountry();
     $this->view->rows_owner = $owner;
     $cus = new Booking_Model_DbTable_DbBooking();
     $rows_cus = $cus->getIdNamecustomer();
     $this->view->rows_cus = $rows_cus;
     $row_vehicle = $cus->getVehiclerefNo();
     $this->view->row_vehicle = $row_vehicle;
     $db = new agreement_Model_DbTable_DbAgreement();
     $this->view->rsbooking = $db->getAllBookingNumber();
 }
Ejemplo n.º 3
0
 public function FrmBrand($frm = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $status = new Zend_Form_Element_Select('status');
     $_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
     $status->setMultiOptions($_arr_status);
     $status->setAttribs(array('class' => 'form-control validate[required]'));
     $parent = new Zend_Form_Element_Select("parent_id");
     $parent->setAttribs(array('class' => 'select', 'style' => 'width:100%'));
     $category = $db->getAllBrand();
     if (empty($category)) {
         $option_category = array('0' => 'No Brand To Select');
     } else {
         $option_category = array('0' => 'Choose Brand');
         foreach ($category as $row_cat) {
             $option_category[$row_cat["brand_id"]] = $row_cat["name_kh"];
         }
     }
     $parent->setMultiOptions($option_category);
     $brand_en = new Zend_Form_Element_Text("name_en");
     $brand_en->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In English', "OnChange" => "GetBrandName(1)"));
     $brand_km = new Zend_Form_Element_Text("name_km");
     $brand_km->setAttribs(array('class' => 'validate[required]', 'placeholder' => ' Brand Name In Khmer', "OnChange" => "GetBrandName(2)"));
     $icon = new Zend_Form_Element_File("icon");
     $this->addElements(array($icon, $status, $brand_en, $brand_km, $parent));
     if ($frm != "") {
         $parent->setValue($frm["parent_id"]);
         $brand_en->setValue($frm["name_en"]);
         $brand_km->setValue($frm["name_kh"]);
         $status->setValue($frm["status"]);
     }
     return $this;
 }
Ejemplo n.º 4
0
 public function FrmAddSchool($data = null)
 {
     $_classname = new Zend_Dojo_Form_Element_TextBox('schoolname');
     $_classname->setAttribs(array('dojoType' => $this->tvalidate, 'required' => 'true', 'class' => 'fullside'));
     $_province = new Zend_Dojo_Form_Element_FilteringSelect('province');
     $_province->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_db = new Application_Model_DbTable_DbGlobal();
     $rows_school = $_db->getGlobalDb("SELECT province_id,province_en_name FROM rms_province ");
     $opt_school = "";
     if (!empty($rows_school)) {
         foreach ($rows_school as $row) {
             $opt_school[$row['province_id']] = $row['province_en_name'];
         }
     }
     $_province->setMultiOptions($opt_school);
     $_status = new Zend_Dojo_Form_Element_FilteringSelect('status');
     $_status->setAttribs(array('dojoType' => $this->filter, 'class' => 'fullside'));
     $_status_opt = array(1 => $this->tr->translate("ACTIVE"), 2 => $this->tr->translate("DACTIVE"));
     $_status->setMultiOptions($_status_opt);
     $_submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
     $_submit->setLabel("save");
     $id = new Zend_Form_Element_Hidden('id');
     if (!empty($data)) {
         $_classname->setValue($data['school_name']);
         $_status->setValue($data['status']);
         $_province->setValue($data['province_id']);
         $id->setValue($data['id']);
     }
     $this->addElements(array($_classname, $_status, $_submit, $_province, $id));
     return $this;
 }
Ejemplo n.º 5
0
 public function addMeasure($data)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $_arr = array("measure_name" => $data["measure_name"]);
     $result = $db->addRecord($_arr, "tb_measure");
     return $result;
 }
Ejemplo n.º 6
0
 public function FrmGeneraljurnal($data = null)
 {
     $Brance = new Zend_Dojo_Form_Element_FilteringSelect('branch_id');
     $Brance->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true, 'onchange' => 'getJurnalcode();'));
     $db = new Application_Model_DbTable_DbGlobal();
     $rows = $db->getAllBranchName();
     $options = '';
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $rows = $db->getAllBranchName();
     $options = array('' => '---Select Branch---');
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['br_id']] = $row['branch_namekh'];
         }
     }
     $Brance->setMultiOptions($options);
     $_currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type');
     $_currency_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $opt = $db->getVewOptoinTypeByType(15, 1, 3, 1);
     $_currency_type->setMultiOptions($opt);
     $_currency_type->setValue(2);
     $parent = new Zend_Dojo_Form_Element_FilteringSelect('parent');
     $parent->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'required' => true, 'onchange' => 'getAllAccountNameByParents();'));
     $db = new Accounting_Model_DbTable_DbChartaccount();
     $option = $db->getAllchartaccount(3, 1);
     $parent->setMultiOptions($option);
     $Add_Date = new Zend_Dojo_Form_Element_DateTextBox('add_date');
     $Add_Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => true));
     $Add_Date->setValue(date('Y-m-d'));
     $Account_Number = new Zend_Dojo_Form_Element_TextBox('journal_code');
     $Account_Number->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'class' => 'fullside', 'readOnly' => 'readOnly', 'required' => 'true'));
     $invoice = new Zend_Dojo_Form_Element_TextBox('invoice');
     $invoice->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'));
     $Debit = new Zend_Dojo_Form_Element_NumberTextBox('debit');
     $Debit->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 1, 'readonly' => 'readonly'));
     // 		$Debit->setValue(0);
     $Credit = new Zend_Dojo_Form_Element_NumberTextBox('credit');
     $Credit->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 1, 'readonly' => 'readonly'));
     $id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $id->setValue($data['id']);
         $Brance->setValue($data['branch_id']);
         $Account_Number->setValue($data['journal_code']);
         $invoice->setValue($data['receipt_number']);
         $_currency_type->setValue($data['currency_id']);
         $Note->setValue($data['note']);
         $Add_Date->setValue($data['date']);
         $Debit->setValue($data['debit']);
         $Credit->setValue($data['credit']);
     }
     // 		$Credit->setValue(0);
     $this->addElements(array($id, $invoice, $_currency_type, $parent, $Add_Date, $Account_Number, $Note, $Debit, $Credit, $Brance));
     return $this;
 }
Ejemplo n.º 7
0
 public function editAction()
 {
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         try {
             $db_make = new Vehicle_Model_DbTable_DbMake();
             if (!empty($data['save_close'])) {
                 $db_make->updateMake($data);
                 Application_Form_FrmMessage::Sucessfull($this->tr->translate("INSERT_SUCCESS"), self::REDIRECT_URL_ADD_CLOSE);
             }
         } catch (Exception $e) {
             Application_Form_FrmMessage::message($this->tr->translate("INSERT_FAIL"));
             $err = $e->getMessage();
             Application_Model_DbTable_DbUserLog::writeMessageError($err);
         }
     }
     $id = $this->getRequest()->getParam('id');
     $db_make = new Vehicle_Model_DbTable_DbMake();
     $rows = $db_make->getMakeById($id);
     $this->view->row = $rows;
     $db = new Application_Model_DbTable_DbGlobal();
     $status = $db->getViews(2);
     $this->view->status_view = $status;
 }
Ejemplo n.º 8
0
 public function SelectItem()
 {
     $db = $this->getAdapter();
     $user_info = new Application_Model_DbTable_DbGetUserInfo();
     $result = $user_info->getUserInfo();
     $db = new Application_Model_DbTable_DbGlobal();
     $productSql = "SELECT\n\t\t\t\tp.pro_id\n\t\t\t\t,p.item_name\n\t\t\t\t,p.item_code\n\t\t\t\t,(SELECT g.Name FROM tb_category AS g WHERE g.CategoryId = (SELECT cate_id FROM tb_product WHERE pro_id = pl.`pro_id` LIMIT 1)) AS Cate_name\n\t\t\t\t,(SELECT b.Name FROM tb_branch AS b WHERE b.branch_id = (SELECT brand_id FROM tb_product WHERE pro_id = pl.`pro_id` LIMIT 1 )) AS Branch\n\t\t\t\t,(SELECT lo.Name FROM tb_sublocation AS lo WHERE lo.LocationId = pl.LocationId LIMIT 1) AS LocationName\n\t\t\t\t,pl.qty\n\t\t\tFROM tb_prolocation AS pl,tb_product AS p WHERE pl.`pro_id`=p.pro_id ";
     $str_condition = " AND pl.LocationId";
     $productSql .= $db->getAccessPermission($result["level"], $str_condition, $result["location_id"]);
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $productName = $this->getRequest()->getParam('s_name');
         if ($post['LocationId'] !== '' and $post['LocationId'] != 0) {
             $productSql .= " AND pl.LocationId = " . trim($post['LocationId']);
         }
         if ($post['p_name'] != '') {
             $productSql .= " AND p.item_name LIKE '%" . trim($post['p_name']) . "%'";
             $productSql .= " OR p.item_code LIKE '%" . trim($post['p_name']) . "%'";
         }
         if ($post['category_id'] !== '' and $post['category_id'] != 0) {
             //echo $post['category_id']; exit();
             $productSql .= " AND p.cate_id =" . trim($post['category_id']);
         }
         if ($post['branch_id'] !== '' and $post['branch_id'] != 0) {
             $productSql .= " AND p.brand_id =" . trim($post['branch_id']);
         }
     }
     //echo $productSql;exit();
     $productSql .= " ORDER BY p.item_name,p.cate_id DESC";
     return $rows = $db_rs->fetchAll($productSql);
 }
Ejemplo n.º 9
0
 public function editAction()
 {
     $db_model = new Driverguide_Model_DbTable_DbDriver();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         try {
             $id = $db_model->updateDriver($data);
             Application_Form_FrmMessage::Sucessfull("EDIT_SUCCESSS", "/driverguide");
         } catch (Exception $e) {
             Application_Form_FrmMessage::message("Application Error");
             Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
         }
     }
     $db = new Application_Model_DbTable_DbGlobal();
     $client_type = $db->getclientdtype();
     array_unshift($client_type, array('id' => -1, 'name' => '---Add New ---'));
     $this->view->clienttype = $client_type;
     $dbpop = new Application_Form_FrmPopupGlobal();
     $this->view->frm_popup_clienttype = $dbpop->frmPopupclienttype();
     $id = $this->getRequest()->getParam("id");
     $row = $db_model->getDriverById($id);
     $this->view->rs = $row;
     $fm = new Group_Form_FrmClient();
     $frm = $fm->FrmaddGuide($row);
     Application_Model_Decorator::removeAllDecorator($frm);
     $this->view->frm_client = $frm;
 }
Ejemplo n.º 10
0
 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     /////////////Filter stock/////////////////
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $nameElement = new Zend_Form_Element_Text('s_name');
     $nameValue = $request->getParam('s_name');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     $phonevalue = $request->getParam('phone');
     $phoneElement = new Zend_Form_Element_Text('phone');
     $phoneElement->setValue($phonevalue);
     $this->addElement($phoneElement);
     $rs = $db->getGlobalDb('SELECT LocationId,Name FROM tb_sublocation ORDER BY LocationId DESC ');
     $options = array('' => $tr->translate('Please_Select'));
     $agentValue = $request->getParam('stock_location');
     foreach ($rs as $read) {
         $options[$read['LocationId']] = $read['Name'];
     }
     $sale_agent = new Zend_Form_Element_Select('stock_location');
     $sale_agent->setMultiOptions($options);
     $sale_agent->setAttribs(array('id' => 'LocationId', 'class' => 'demo-code-language'));
     $sale_agent->setValue($agentValue);
     $this->addElement($sale_agent);
     return $this;
 }
Ejemplo n.º 11
0
 public function editAction()
 {
     if ($this->getRequest()->isPost()) {
         try {
             $_data = $this->getRequest()->getPost();
             $_dbmodel = new Application_Model_DbTable_DbDept();
             $_dbmodel->UpdateDepartment($_data);
             Application_Form_FrmMessage::Sucessfull("ការកៃប្រែដោយជោគជ័យ !", "/global/faculty/index");
             //$this->_redirect("");
         } catch (Exception $e) {
             $err = $e->getMessage();
             Application_Form_FrmMessage::message("Application Error!");
             Application_Model_DbTable_DbUserLog::writeMessageError($err);
             echo $e->getMessage();
             exit;
         }
     }
     $id = $this->getRequest()->getParam("id");
     $_db = new Application_Model_DbTable_DbGlobal();
     $_row = $_db->getDeptById($id);
     $frm = new Application_Form_FrmOther();
     $frm->FrmAddDept($_row);
     Application_Model_Decorator::removeAllDecorator($frm);
     $this->view->frm_dept = $frm;
 }
Ejemplo n.º 12
0
 public function indexAction()
 {
     try {
         $db = new Other_Model_DbTable_DbZone();
         if ($this->getRequest()->isPost()) {
             $search = $this->getRequest()->getPost();
         } else {
             $search = array('adv_search' => '', 'search_status' => -1);
         }
         $rs_rows = $db->getAllZoneArea($search);
         $glClass = new Application_Model_GlobalClass();
         $rs_rows = $glClass->getImgActive($rs_rows, BASE_URL, true);
         $list = new Application_Form_Frmtable();
         $collumns = array("ZONE_NAME", "ZONE_NUMBER", "DATE", "STATUS", "BY");
         $link = array('module' => 'other', 'controller' => 'zone', 'action' => 'edit');
         $this->view->list = $list->getCheckList(0, $collumns, $rs_rows, array('zone_name' => $link, 'zone_num' => $link));
     } catch (Exception $e) {
         Application_Form_FrmMessage::message("Application Error");
         echo $e->getMessage();
         Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
     }
     $frm = new Other_Form_FrmZone();
     $frm_co = $frm->FrmAddZone();
     Application_Model_Decorator::removeAllDecorator($frm_co);
     $this->view->frm_zone = $frm_co;
     $db = new Application_Model_DbTable_DbGlobal();
     $this->view->district = $db->getAllDistricts();
     $this->view->commune_name = $db->getCommune();
     $this->view->result = $search;
 }
Ejemplo n.º 13
0
 function indexAction()
 {
     $dbbooking = new Application_Model_DbTable_Dbstuffrental();
     $db_globle = new Application_Model_DbTable_DbGlobal();
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if (isset($post["term_condiction"])) {
             $dbbooking->createSessionStuffBooking($post, 3);
             //print_r("test");exit();
             $this->_redirect("stuffbooking/index");
         } elseif (isset($post["confirm_book"])) {
             $dbbooking->createSessionStuffBooking($post, 4);
             $this->_redirect("stuffbooking/index");
         }
     }
     $customer_session = new Zend_Session_Namespace('customer');
     $user_session = $customer_session->customer_session;
     if (!empty($user_session)) {
         $customer_user_session = $user_session;
         $customer_user = $customer_session->customer_id;
         $this->view->user_name = $customer_session->customer_name;
         $this->view->user_info = $customer_session->user_info;
     } else {
         $customer_user_session = 0;
     }
     $db = new Application_Model_DbTable_Dbbookingtaxi();
     $session = new Zend_Session_Namespace('stuffbooking');
     $this->view->bookinginfo = $session;
     $this->view->producttermcomdiction = $db_globle->getAllParameter('producttermcomdiction');
     $frmbooks = new Application_Form_FrmBooking();
     $frmbooking = $frmbooks->FromBooking();
     Application_Model_Decorator::removeAllDecorator($frmbooking);
     $this->view->frmbooking = $frmbooking;
     $this->view->user_session = $customer_user_session;
 }
Ejemplo n.º 14
0
 function  rptVillageAction(){
 	$db  = new Report_Model_DbTable_DbParamater();
 	$this->view->village_list = $db->getAllVillage();
 	//print_r($db->getAllstaff());
 	$key = new Application_Model_DbTable_DbKeycode();
 	$this->view->data=$key->getKeyCodeMiniInv(TRUE);
 	if($this->getRequest()->isPost()){
 		$search = $this->getRequest()->getPost();
 		//
 		if(isset($search['btn_search'])){
 			//print_r($search);exit();
 			$this->view->village_list = $db->getAllVillage($search);
 		}else{
 		$collumn = array("vill_id","village_namekh","village_name","displayby","commune_name","district_name","province_en_name","modify_date","status","user_name");
 		$this->exportFileToExcel('ln_village',$db->getAllVillage(),$collumn);
 		} 		
 	}else {
 		$search = array('adv_search' => '',
 				'search_status' => -1,
 				'province_name'=>0,
 				'district_name'=>'',
 				'commune_name'=>'');
 	}
 	$frm = new Other_Form_FrmVillage();
 	$frms = $frm->FrmAddVillage();
 	Application_Model_Decorator::removeAllDecorator($frms);
 	$this->view->frm_village= $frms;
 	
 	$db= new Application_Model_DbTable_DbGlobal();
 	$this->view->district = $db->getAllDistricts();
 	$this->view->commune_name = $db->getCommune();
 	$this->view->result = $search;
 }
Ejemplo n.º 15
0
 public function editAction()
 {
     $db = new Other_Model_DbTable_DbVillage();
     if ($this->getRequest()->isPost()) {
         $_data = $this->getRequest()->getPost();
         try {
             $db->addVillage($_data);
             Application_Form_FrmMessage::Sucessfull("ការ​បញ្ចូល​ជោគ​ជ័យ !", '/other/Village');
         } catch (Exception $e) {
             Application_Form_FrmMessage::message("ការ​បញ្ចូល​មិន​ជោគ​ជ័យ");
             $err = $e->getMessage();
             Application_Model_DbTable_DbUserLog::writeMessageError($err);
         }
     }
     $id = $this->getRequest()->getParam("id");
     $row = $db->getVillageById($id);
     $this->view->row = $row;
     if (empty($row)) {
         $this->_redirect('other/Village');
     }
     $fm = new Other_Form_FrmVillage();
     $frm = $fm->FrmAddVillage($row);
     Application_Model_Decorator::removeAllDecorator($frm);
     $this->view->frm_village = $frm;
     $db = new Application_Model_DbTable_DbGlobal();
     $this->view->district = $db->getAllDistricts();
     $this->view->commune_name = $db->getCommune();
 }
Ejemplo n.º 16
0
 public function addNewAgent($data)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $datainfo = array("name" => $data['agent_name'], "phone" => $data['phone'], "job_title" => $data['position'], "stock_id" => $data['location'], "description" => $data['desc']);
     $agent_id = $db->addRecord($datainfo, "tb_sale_agent");
     return $agent_id;
 }
Ejemplo n.º 17
0
 public function editAction()
 {
     $db_model = new Driverguide_Model_DbTable_Dbvehicleprice();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         try {
             $id = $db_model->updateVehicleRental($data);
             Application_Form_FrmMessage::Sucessfull("Edit Success", "/driverguide/vehicleprice");
         } catch (Exception $e) {
             Application_Form_FrmMessage::message("Application Error");
             Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
         }
     }
     $db = new Application_Model_GlobalClass();
     $this->view->package_option = $db->getAllPackageDayOption();
     $db = new Application_Model_DbTable_DbGlobal();
     $this->view->rs_tax = $db->getAllTax();
     $this->view->vehicle = $db_model->getVehecleName();
     $id = $this->getRequest()->getParam("id");
     $this->view->rows = $db_model->getVehiclePriceById($id);
     // 		print_r($db_model->getVehiclePriceById($id));
     $this->view->vehicle_id = $id;
     // 		$db=new Vehicle_Model_DbTable_DbVehicle();
     // 		$this->view->vehicle=$db->getVehicleById($id);
 }
Ejemplo n.º 18
0
 function addTransactionJournal($data)
 {
     $arr = array('branch_id' => $data['branch_id'], 'client_id' => $data['client_id'], 'receipt_number' => $data['receipt_number'], 'date' => $data['date'], 'create_date' => date('Y-m-d'), 'note' => $data['note'], 'user_id' => $this->getUserId(), 'from_location' => $data['from_location'], 'receipt_number' => $data['receipt_number']);
     $id = $this->insert($arr);
     unset($arr);
     $this->_name = 'ln_journal_detail';
     $acc_id = 1;
     $db_g = new Application_Model_DbTable_DbGlobal();
     $db_g->getAccountBranchByOther($acc_id, $data['branch_id'], $data['currency_type'], $data['balance'], 1);
     //update data to server
     $arr = array('jur_id' => $id, 'branch_id' => $data['branch_id'], 'account_type' => 1, 'balance' => $data['balance'], 'account_id' => $acc_id, 'is_increase' => 1, 'currency_type' => $data['currency_type']);
     $this->insert($arr);
     $arr['is_increase'] = 0;
     $acc_id = 2;
     $arr['account_id'] = $acc_id;
     $arr['account_type'] = 2;
     $accs = $db_g->getAccountBranchByOther($arr['account_id'], $data['branch_id'], $data['currency_type'], $data['balance'], $arr['is_increase']);
     $this->insert($arr);
     if (!empty($data['loan_fee'])) {
         $arr['is_increase'] = 1;
         $arr['account_id'] = 2;
         $arr['note'] = 'Admin fee from disburse loan ';
         $this->insert($arr);
         $db_g->getAccountBranchByOther($arr['account_id'], $data['branch_id'], $data['currency_type'], $data['loan_fee'], $arr['is_increase']);
         $arr['is_increase'] = 1;
         $arr['account_id'] = 3;
         $this->insert($arr);
         $db_g->getAccountBranchByOther($arr['account_id'], $data['branch_id'], $data['currency_type'], $data['loan_fee'], $arr['is_increase']);
     }
 }
Ejemplo n.º 19
0
 public function addBrand($data = null)
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $db = new Application_Model_DbTable_DbGlobal();
     $rowsbrand = $db->getGlobalDb('SELECT branch_id, Name
 			FROM tb_branch WHERE Name!="" ');
     $options = array('' => $tr->translate('Please_Select'));
     if ($rowsbrand) {
         foreach ($rowsbrand as $readBrand) {
             $options[$readBrand['branch_id']] = $readBrand['Name'];
         }
     }
     $brandElement = new Zend_Form_Element_Select('Parent brand');
     $brandElement->setAttribs(array('class' => 'demo-code-language'));
     $brandElement->setMultiOptions($options);
     $this->addElement($brandElement);
     $b_nameElement = new Zend_Form_Element_Text('brand Name');
     $b_nameElement->setAttribs(array('class' => 'validate[required]'));
     $this->addElement($b_nameElement);
     $optionsStatus = array(1 => $tr->translate("ACTIVE"), 2 => $tr->translate('DEACTIVE'));
     $statusElement = new Zend_Form_Element_Select('status');
     $statusElement->setAttribs(array('class' => 'demo-code-language'));
     $statusElement->setMultiOptions($optionsStatus);
     $this->addElement($statusElement);
     if ($data != null) {
         $idElement = new Zend_Form_Element_Hidden('id');
         $this->addElement($idElement);
         $statusElement->setValue($data["IsActive"]);
         $idElement->setValue($data['branch_id']);
         $b_nameElement->setValue($data['Name']);
         $brandElement->setValue($data['parent_id']);
     }
     return $this;
 }
Ejemplo n.º 20
0
 public function addClient($_data)
 {
     $photoname = str_replace(" ", "_", $_data['name_en'] . '-AGN') . '.jpg';
     $upload = new Zend_File_Transfer();
     $upload->addFilter('Rename', array('target' => PUBLIC_PATH . '/images/' . $photoname, 'overwrite' => true), 'photo');
     $receive = $upload->receive();
     if ($receive) {
         $_data['photo'] = $photoname;
     } else {
         $_data['photo'] = !empty($_data['id']) ? $_data['id'] : "";
     }
     try {
         $db = new Application_Model_DbTable_DbGlobal();
         $client_code = $db->getNewClientId();
         $_arr = array('title' => $_data['title'], 'customer_code' => $client_code, 'first_name' => $_data['name_kh'], 'last_name' => $_data['name_en'], 'sex' => $_data['sex'], 'dob' => $_data['dob_client'], 'pob' => $_data['country'], 'occupation' => $_data['occupation'], 'nationality' => $_data['nationality'], 'company_name' => $_data['company_name'], 'customer_type' => $_data['customer_type'], 'photo' => $_data['photo'], 'note' => $_data['desc'], 'passport_name' => $_data['passport'], 'pass_issuedate' => $_data['pissue_date'], 'pass_expireddate' => $_data['pexpired_date'], 'card_name' => $_data['card_code'], 'card_issuedate' => $_data['cissue_date'], 'card_expireddate' => $_data['cexpired_date'], 'ftb' => $_data['ftb'], 'ftb_issuedate' => $_data['fissue_date'], 'ftb_expireddate' => $_data['fexpired_date'], 'phone' => $_data['phone'], 'email' => $_data['email'], 'fax' => $_data['fax'], 'group_num' => $_data['group_num'], 'house_num' => $_data['address'], 'street' => $_data['street'], 'commune' => $_data['commune'], 'district' => $_data["district"], 'province_id' => $_data['province'], 'balance' => $_data['balance'], 'address1' => $_data['address1'], 'address2' => $_data['address2'], 'i_city' => $_data['i_city'], 'i_zipcode' => $_data['i_zipcode'], 'i_state' => $_data['state'], 'country' => $_data['countries'], 'i_phone' => $_data['i_phone'], 'status' => $_data['status'], 'date' => date("Y-m-d"));
         if (!empty($_data['id'])) {
             $where = 'id = ' . $_data['id'];
             $this->update($_arr, $where);
             return $_data['id'];
         } else {
             return $this->insert($_arr);
         }
     } catch (Exception $e) {
         Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
     }
 }
Ejemplo n.º 21
0
 function rptGeneralAction(){
 	// 		$fr=new Application_Form_FrmReportParameter();
 	// 		$form=$fr->getFormReport(array(
 	// 				'budget'=>-1,
 	// 				'division'=>-1,
 	// 				'fund_type'=>-1,
 	// 				'year'=>-1,
 	// 				'wa_type'=>-1,
 	// 				'fund_no'=>-1,
 	// 		),$this,true);
 	// 		$this->view->filter = $form;
 	
 	$file='/budget/budget.html';
 	// 		$head=$report->getHeadBudgetList('project',date('Y'));
 	$report=new Application_Model_DbTable_DbGlobal();
 	$content=$report->getContent($result_row);
 	$param=array(
 			'division'=>1,
 			'budget'=>1,
 			'head'=>1,
 			'content'=>1);
 	$db=new Application_Model_DbTable_DbGlobal();
 	$new=$db->setReportParam($param, $file);
 	$this->view->file=$new;
 }
Ejemplo n.º 22
0
 public function editAction()
 {
     $db_model = new Driverguide_Model_DbTable_Dbvehicleprice();
     $id = $this->getRequest()->getParam('id');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $db = new Driverguide_Model_DbTable_DbTaxiprice();
         try {
             if (!empty($data['save_close'])) {
                 $db->updateVehicletaxi($data);
                 Application_Form_FrmMessage::Sucessfull("INSERT_SUCCESSS", "/driverguide/taxiprice");
             }
         } catch (Exception $e) {
             //echo $e->getMessage();exit();
             Application_Form_FrmMessage::message("Application Error");
             Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
         }
     }
     $db = new Application_Model_GlobalClass();
     $this->view->pro_option = $db->getAllLocationOption();
     $db = new Application_Model_DbTable_DbGlobal();
     $this->view->rs_tax = $db->getAllTax();
     $this->view->vehicle = $db_model->getVehecleName();
     $db = new Driverguide_Model_DbTable_DbTaxiprice();
     $row = $this->view->row_taxi = $db->getVehicleTaxiById($id);
     //print_r($row);exit();
 }
Ejemplo n.º 23
0
 public function editAction()
 {
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         try {
             $db_model = new Vehicle_Model_DbTable_DbSubModel();
             if (isset($data['save_close'])) {
                 $db_model->updateSubmodel($data);
                 Application_Form_FrmMessage::Sucessfull($this->tr->translate("INSERT_SUCCESS"), self::REDIRECT_URL_CLOSE);
             }
         } catch (Exception $e) {
             Application_Form_FrmMessage::message($this->tr->translate("INSERT_FAIL"));
             $err = $e->getMessage();
             Application_Model_DbTable_DbUserLog::writeMessageError($err);
         }
     }
     $db = new Application_Model_DbTable_DbGlobal();
     $status = $db->getViews();
     $this->view->status_view = $status;
     //	$db = new Vehicle_Model_DbTable_DbMake();
     $model = $db->getAllMake();
     array_unshift($model, array('id' => -1, 'name' => 'បន្ថែម​អ្នក​ទទួល​ថ្មី'));
     $this->view->allmake = $model;
     $model = $db->getAllModels();
     $this->view->allmodel = $model;
     $id = $this->getRequest()->getParam('id');
     $sub_model = new Vehicle_Model_DbTable_DbSubModel();
     $row = $sub_model->getSubModelById($id);
     $this->view->row = $row;
 }
 public static function getDataAutocompleteData($sql)
 {
     $gb_db = new Application_Model_DbTable_DbGlobal();
     $rs = $gb_db->getGlobalDb($sql);
     //echo Zend_Json::encode($rs);
     $data = Zend_Json::encode($rs);
     return $data;
 }
Ejemplo n.º 25
0
 public function FrmTeller($data = null)
 {
     $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();'));
     $bran_ = new Zend_Dojo_Form_Element_FilteringSelect('bran');
     $bran_->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $account_number = new Zend_Dojo_Form_Element_NumberTextBox('account_number');
     $account_number->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     // 		$rows = $db ->getClientByType(1);
     // 		$options="";
     // 		if(!empty($rows))foreach($rows AS $row){
     // 			$options[$row['client_id']]=$row['name_en'].','.$row['province_en_name'].','.$row['district_name'].','.$row['commune_name'].','.$row['village_name'];
     // 		}
     //  		$_groupid->setMultiOptions($options);
     $_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id');
     $_coid = new Zend_Dojo_Form_Element_FilteringSelect('co_id');
     $rows = $db->getAllCOName();
     $options = array('' => "------Select------", -1 => "Add New");
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $options[$row['co_id']] = $row['co_khname'];
         }
     }
     $_coid->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'onchange' => 'popupCheckCO();'));
     $_coid->setMultiOptions($options);
     $_priciple_amount = new Zend_Dojo_Form_Element_NumberTextBox('priciple_amount');
     $_priciple_amount->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_loan_fee = new Zend_Dojo_Form_Element_NumberTextBox('loan_fee');
     $_loan_fee->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_os_amount = new Zend_Dojo_Form_Element_NumberTextBox('os_amount');
     $_os_amount->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_rate = new Zend_Dojo_Form_Element_NumberTextBox('total_interest');
     $_rate->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true'));
     // 		$value_interest = 2.5;
     // 		$_rate->setValue($value_interest);
     $_penalize_amount = new Zend_Dojo_Form_Element_NumberTextBox('penalize_amount');
     $_penalize_amount->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_penalize_amount->setValue(0);
     $_total_payment = new Zend_Dojo_Form_Element_NumberTextBox('total_payment');
     $_total_payment->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true'));
     $_note = new Zend_Dojo_Form_Element_NumberTextBox('note');
     $_note->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => 'true'));
     $cash_got = new Zend_Dojo_Form_Element_NumberTextBox('cash_got');
     $cash_got->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $cash_return = new Zend_Dojo_Form_Element_NumberTextBox('cash_return');
     $cash_return->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside'));
     $_collect_date = new Zend_Dojo_Form_Element_DateTextBox('collect_date');
     $_collect_date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => 'true'));
     $_date_paymented = new Zend_Dojo_Form_Element_DateTextBox('date_payment');
     $_date_paymented->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'class' => 'fullside', 'required' => 'true'));
     $invoice_number = new Zend_Dojo_Form_Element_ValidationTextBox('invoice_number');
     $invoice_number->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside', 'required' => 'true'));
     $c_date = date('Y-d-m');
     $_collect_date->setValue($c_date);
     $this->addElements(array($invoice_number, $_date_paymented, $bran_, $account_number, $_groupid, $_coid, $_priciple_amount, $_loan_fee, $_os_amount, $_rate, $_penalize_amount, $_collect_date, $_total_payment, $cash_got, $cash_return, $_note));
     return $this;
 }
Ejemplo n.º 26
0
 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;
 }
Ejemplo n.º 27
0
 public function FrmAddExpense($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 EXPENSE")));
     $_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'));
     $account_name = new Zend_Dojo_Form_Element_ValidationTextBox('account_name');
     $account_name->setAttribs(array('dojoType' => 'dijit.form.ValidationTextBox', 'class' => 'fullside', 'required' => true));
     $for_date = new Zend_Dojo_Form_Element_FilteringSelect('for_date');
     $for_date->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $dg = new Application_Model_DbTable_DbGlobal();
     $opt_month = $dg->getAllMonths();
     $for_date->setMultiOptions($opt_month);
     $for_date->setValue(date('m'));
     // $for_date->setValue($request->getParam('for_date'));
     $for_date_search = new Zend_Dojo_Form_Element_FilteringSelect('for_date_search');
     $for_date_search->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $dg = new Application_Model_DbTable_DbGlobal();
     $opt_month = $dg->getAllMonths();
     $for_date_search->setMultiOptions($opt_month);
     $for_date_search->setValue($request->getParam('for_date_search'));
     $_Date = new Zend_Dojo_Form_Element_DateTextBox('Date');
     $_Date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox', 'required' => true, 'class' => 'fullside'));
     $_Date->setValue(date('Y-m-d'));
     $_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"));
     $_stutas = new Zend_Dojo_Form_Element_FilteringSelect('Stutas');
     $_stutas->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $options = array(1 => "ប្រើប្រាស់", 2 => "មិនប្រើប្រាស់");
     $_stutas->setMultiOptions($options);
     $currency_type = new Zend_Dojo_Form_Element_FilteringSelect('currency_type');
     $currency_type->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside'));
     $options = array(1 => "រៀល", 2 => "ដុល្លារ", 3 => "បាត");
     $currency_type->setMultiOptions($options);
     $_Description = new Zend_Dojo_Form_Element_Textarea('Description');
     $_Description->setAttribs(array('dojoType' => 'dijit.form.SimpleTextarea', 'class' => 'fullside', 'style' => 'width:98%'));
     $total_amount = new Zend_Dojo_Form_Element_NumberTextBox('total_amount');
     $total_amount->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'class' => 'fullside', 'required' => true));
     $id = new Zend_Form_Element_Hidden("id");
     if ($data != null) {
         $account_name->setValue($data['account_name']);
         $total_amount->setValue($data['total_amount']);
         $currency_type->setValue($data['currency_type']);
         $for_date->setValue($data['fordate']);
         $_Description->setValue($data['disc']);
         $_Date->setValue($data['date']);
         $_stutas->setValue($data['status']);
         $id->setValue($data['id']);
     }
     $this->addElements(array($account_name, $_Date, $_stutas, $_Description, $total_amount, $_title, $_btn_search, $_status_search, $for_date_search, $currency_type, $for_date, $id));
     return $this;
 }
Ejemplo n.º 28
0
 public function testAction()
 {
     $start = '2014-01-01';
     $db = new Application_Model_DbTable_DbGlobal();
     $rs = $db->checkHolidayExist(1, $start);
     echo $rs;
     // 		print_r($rs);
     // 		exit();
 }
Ejemplo n.º 29
0
 public function partnerinformation($data = null)
 {
     $_db = new Application_Model_DbTable_DbGlobal();
     $id = new Zend_Form_Element_Hidden('id');
     /* Form Elements & Other Definitions Here ... */
     $request = Zend_Controller_Front::getInstance()->getRequest();
     /* Form Elements & Other Definitions Here ... */
     $accourn_number = new Zend_Dojo_Form_Element_TextBox('accourn_number');
     $accourn_number->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'readOnly' => true));
     $name_partner = new Zend_Dojo_Form_Element_FilteringSelect('name_partner');
     $name_partner->setAttribs(array('dojoType' => 'dijit.form.FilteringSelect', 'class' => 'fullside', 'Onchange' => 'getPartner()', 'Required' => true));
     $db = new Application_Model_DbTable_DbGlobal();
     $opt = $db->getAllPartner(null, 1);
     $name_partner->setMultiOptions($opt);
     $name_partner->setValue($request->getParam('name_partner'));
     $moneyinaccount = new Zend_Dojo_Form_Element_TextBox('moneyinaccount');
     $moneyinaccount->setAttribs(array('dojoType' => 'dijit.form.TextBox'));
     $account = new Zend_Dojo_Form_Element_NumberTextBox('account');
     $account->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox'));
     $box1 = new Zend_Dojo_Form_Element_NumberTextBox('box1');
     $box1->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox'));
     $box2 = new Zend_Dojo_Form_Element_NumberTextBox('box2');
     $box2->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox'));
     $box3 = new Zend_Dojo_Form_Element_DateTextBox('box3');
     $box3->setAttribs(array('dojoType' => 'dijit.form.DateTextBox'));
     $box4 = new Zend_Dojo_Form_Element_NumberTextBox('box4');
     $box4->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox'));
     $usa = new Zend_Dojo_Form_Element_NumberTextBox('usa');
     $usa->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'readOnly' => true));
     $bathe = new Zend_Dojo_Form_Element_NumberTextBox('bathe');
     $bathe->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'readOnly' => true));
     $reil = new Zend_Dojo_Form_Element_NumberTextBox('reil');
     $reil->setAttribs(array('dojoType' => 'dijit.form.NumberTextBox', 'readOnly' => true));
     $creat_date = new Zend_Dojo_Form_Element_DateTextBox('creat_date');
     $creat_date->setAttribs(array('dojoType' => 'dijit.form.DateTextBox'));
     $creat_date->setValue(date('Y-m-d'));
     $db_Deposite = new Partner_Model_DbTable_DbDeposite();
     $invoices_num = $db_Deposite->getAutonumber();
     $num_invoice = new Zend_Dojo_Form_Element_TextBox('num_invoice');
     $num_invoice->setAttribs(array('dojoType' => 'dijit.form.TextBox', 'readOnly' => true, 'style' => 'color:red'));
     $num_invoice->setValue($invoices_num);
     $id = new Zend_Form_Element_Hidden('id');
     if ($data != null) {
         $name_partner->setValue($data['partner_id']);
         $accourn_number->setValue($data['account_no']);
         $creat_date->setValue($data['date']);
         $moneyinaccount->setValue($data['note']);
         $num_invoice->setValue($data['invoice']);
         $id->setValue($data['id']);
         $usa->setValue($data['cash_dollar']);
         $reil->setValue($data['cash_riel']);
         $bathe->setValue($data['cash_bath']);
     }
     $this->addElements(array($accourn_number, $name_partner, $moneyinaccount, $account, $box1, $box2, $box3, $box4, $bathe, $usa, $creat_date, $reil, $id, $num_invoice));
     return $this;
 }
 public function updateSaleAgentAction()
 {
     $session_stock = new Zend_Session_Namespace('stock');
     $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0';
     $db = new Application_Model_DbTable_DbGlobal();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($data["submit_update"]) {
             $update_agent = new sales_Model_DbTable_DbSalesAgent();
             $update_agent->updateSalesAgent($data);
             $this->_redirect("sales/sale-agent/index");
         } else {
             $this->_redirect("sales/sale-agent/index");
         }
     }
     // show form with value
     $sql = "SELECT * FROM tb_sale_agent where agent_id=" . $id;
     $rows = $db->getGlobalDbRow($sql);
     $formAgent = new sales_Form_FrmStock(null);
     $formShowAgent = $formAgent->showSaleAgentForm($rows, $session_stock->stockID);
     Application_Model_Decorator::removeAllDecorator($formShowAgent);
     $this->view->form_agent = $formShowAgent;
     $formpopup = new Application_Form_FrmPopup(null);
     //for add location
     $formAdd = $formpopup->popuLocation(null);
     Application_Model_Decorator::removeAllDecorator($formAdd);
     $this->view->form_addstock = $formAdd;
 }