示例#1
1
 public function init()
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     //user typefilter
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('All');
     $usertype = $request->getParam('user_type_filter');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_filter = new Zend_Form_Element_Select('user_type_filter');
     $user_type_filter->setMultiOptions($options);
     $user_type_filter->setAttribs(array('id' => 'user_type_filter', 'class' => 'validate[required]', 'onchange' => 'this.form.submit()'));
     $user_type_filter->setValue($usertype);
     $this->addElement($user_type_filter);
     //uer title
     $user_title = new Zend_Form_Element_Select("title");
     $user_title->setMultiOptions(array("Mr" => "Mr", "Ms" => "Ms"));
     $this->addElement($user_title);
     //user full name
     $user_fullname = new Zend_Form_Element_Text("fullname");
     $user_fullname->setAttribs(array('id' => 'fullname', 'class' => 'validate[required]'));
     $this->addElement($user_fullname);
     //user name
     $user_name = new Zend_Form_Element_Text('username');
     $user_name->setAttribs(array('id' => 'username', 'class' => 'validate[required]'));
     $this->addElement($user_name);
     //email
     $email = new Zend_Form_Element_Text('email');
     $email->setAttribs(array('id' => 'email', 'class' => 'validate[required]'));
     $this->addElement($email);
     //password
     $password = new Zend_Form_Element_Password('password');
     $password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
     $this->addElement($password);
     //confirm password
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required]'));
     $this->addElement($confirm_password);
     //user type
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('' => $tr->translate('Please_Select'));
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_id = new Zend_Form_Element_Select('user_type_id');
     $user_type_id->setMultiOptions($options);
     $user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'validate[required]'));
     $this->addElement($user_type_id);
     //location
     $rs = $db->getGlobalDb('SELECT LocationId, Name FROM tb_sublocation WHERE Name!="" AND status=1 ORDER BY LocationId DESC');
     $option = array("1" => $tr->translate("Please_Select"), "-1" => $tr->translate("Add_New_Location"));
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $option[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('LocationId');
     $locationID->setMultiOptions($option);
     $locationID->setattribs(array('id' => 'LocationId', 'Onchange' => 'AddLocation()', 'class' => 'demo-code-language'));
     $this->addElement($locationID);
 }
 public function FrmSearchFromCustomer()
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     $nameValue = $request->getParam('order');
     $nameElement = new Zend_Form_Element_Text('order');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     $returninValue = $request->getParam('return_in');
     $returninElement = new Zend_Form_Element_Text('return_in');
     $returninElement->setValue($returninValue);
     $this->addElement($returninElement);
     $startDateValue = $request->getParam('search_start_date');
     $startDateElement = new Zend_Form_Element_Text('search_start_date');
     $startDateElement->setValue($startDateValue);
     $this->addElement($startDateElement);
     $endDateValue = $request->getParam('search_end_date');
     $endDateElement = new Zend_Form_Element_Text('search_end_date');
     $endDateElement->setValue($endDateValue);
     $this->addElement($endDateElement);
     $rowCustomers = $db->getGlobalDb('SELECT customer_id, cust_name FROM tb_customer WHERE cust_name!="" AND is_active=1 ORDER BY customer_id DESC');
     $agentValue = $request->getParam('customer_id');
     $options = array('' => $tr->translate('Please_Select_Customer'));
     if (!empty($rowCustomers)) {
         foreach ($rowCustomers as $rowCustomer) {
             $options[$rowCustomer['customer_id']] = $rowCustomer['cust_name'];
         }
     }
     $customer_id = new Zend_Form_Element_Select('customer_id');
     $customer_id->setMultiOptions($options);
     $customer_id->setattribs(array('id' => 'customer_id', 'class' => 'validate[required]'));
     $customer_id->setValue($agentValue);
     $this->addElement($customer_id);
     Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
     return $this;
 }
示例#3
0
 public function popupSaleAgent($data = null)
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $db = new Application_Model_DbTable_DbGlobal();
     $agent_Element = new Zend_Form_Element_Text('agent_name');
     $agent_Element->setAttribs(array('placeholder' => 'Enter Agent Name', 'class' => 'validate[required]'));
     $this->addElement($agent_Element);
     $contact_Element = new Zend_Form_Element_Text('contact_phone');
     $contact_Element->setAttribs(array('placeholder' => 'Contact Phone', 'class' => 'validate[required]'));
     $this->addElement($contact_Element);
     $position_Element = new Zend_Form_Element_Text('positon');
     $position_Element->setAttribs(array('placeholder' => 'Enter Positon'));
     $this->addElement($position_Element);
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' ";
     $user = $this->GetuserInfo();
     if ($user["level"] != 1 and $user["level"] != 2) {
         $sql .= " AND LocationId = " . $user["location_id"];
     }
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     //$productValue = $request->getParam('LocationId');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('brand_name');
     $locationID->setAttribs(array('class' => 'validate[required]'));
     $locationID->setMultiOptions($options);
     $locationID->setattribs(array('id' => 'brand_name'));
     $this->addElement($locationID);
     $address_Element = new Zend_Form_Element_Textarea('desc_agent');
     $address_Element->setAttribs(array('placeholder' => 'Description Here'));
     $this->addElement($address_Element);
     return $this;
 }
示例#4
0
 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     //user typefilter
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('All');
     $usertype = $request->getParam('user_type_filter');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_filter = new Zend_Form_Element_Select('user_type_filter');
     $user_type_filter->setMultiOptions($options);
     $user_type_filter->setAttribs(array('id' => 'user_type_filter', 'class' => 'validate[required]', 'onchange' => 'this.form.submit()'));
     $user_type_filter->setValue($usertype);
     $this->addElement($user_type_filter);
     //uer title
     $user_title = new Zend_Form_Element_Select("title");
     $user_title->setMultiOptions(array("Mr" => "Mr", "Ms" => "Ms"));
     $this->addElement($user_title);
     //user full name
     $user_fullname = new Zend_Form_Element_Text("name");
     $user_fullname->setAttribs(array('id' => 'name', 'class' => 'validate[required]'));
     $this->addElement($user_fullname);
     //user cso
     /*$user_cso = new Zend_Form_Element_Select("cso_id");
      	$user_cso->setMultiOptions($db->getOptionCSO());
      	$user_cso->setAttribs(array(
      		'id'=>'cso_id',
      		'class'=>'validate[required]',
      	));
      	$this->addElement($user_cso);*/
     //Select CSO
     $rs = $db->getGlobalDb('SELECT id, name_en FROM fi_cso');
     $options = array('' => 'Please select');
     foreach ($rs as $read) {
         $options[$read['id']] = $read['name_en'];
     }
     $cso_id = new Zend_Form_Element_Select('cso_id');
     $cso_id->setMultiOptions($options);
     $cso_id->setattribs(array('class' => 'validate[required]'));
     $this->addElement($cso_id);
     //user name
     $user_name = new Zend_Form_Element_Text('username');
     $user_name->setAttribs(array('id' => 'username', 'class' => 'validate[required]'));
     $this->addElement($user_name);
     //email
     $email = new Zend_Form_Element_Text('email');
     $email->setAttribs(array('id' => 'email', 'class' => 'validate[required]'));
     $this->addElement($email);
     //password
     $password = new Zend_Form_Element_Password('password');
     $password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
     $this->addElement($password);
     //confirm password
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required]'));
     $this->addElement($confirm_password);
     //user type
     $sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
     $rs = $db->getGlobalDb($sql);
     $options = array('' => 'Please select');
     foreach ($rs as $read) {
         $options[$read['user_type_id']] = $read['user_type'];
     }
     $user_type_id = new Zend_Form_Element_Select('user_type_id');
     $user_type_id->setMultiOptions($options);
     $user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'validate[required]'));
     $this->addElement($user_type_id);
 }
示例#5
0
 public function productOrder($data = null)
 {
     //Application_Form_FrmLanguages::getCurrentlanguage();
     $user_info = new Application_Model_DbTable_DbGetUserInfo();
     $result = $user_info->getUserInfo();
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     $paymentElement = new Zend_Form_Element_Submit('payment');
     $paymentElement->setAttribs(array('Phone' => 'Phone'));
     $this->addElement($paymentElement);
     $rs = $db->getGlobalDb('SELECT vendor_id, v_name FROM tb_vendor WHERE v_name!="" ORDER BY vendor_id DESC');
     $customerValue = $request->getParam('vendor_id');
     $options = array('' => $tr->translate('Please_Select'), '-1' => $tr->translate('Add_New_Vendor'));
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['vendor_id']] = $read['v_name'];
         }
     }
     $vendor_id = new Zend_Form_Element_Select('v_name');
     $vendor_id->setAttribs(array('class' => 'validate[required]', 'Onchange' => 'getCustomerInfo()'));
     $vendor_id->setMultiOptions($options);
     //$customerID->setattribs(array(id'=>'customer_id','onchange'=>'this.form.submit()',));
     $vendor_id->setValue($customerValue);
     $this->addElement($vendor_id);
     //     	$rowsCategory= $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category ORDER BY CategoryId DESC ');
     //     	$options = "";
     //     	if($result["level"]==1 OR $result["level"]==2){
     //     		$options = array("1"=>"Defaul Catogory","-1"=>"Add New Category");
     //     	}
     //     	if($rowsCategory) {
     //     		foreach($rowsCategory as $readCategory) $options[$readCategory['CategoryId']]=$readCategory['Name'];
     //     	}
     //     	$categoryElement = new Zend_Form_Element_Select('category');
     //     	$categoryElement->setAttribs(array('class' => 'validate[required] demo-code-language',"Onchange"=>"showPopupCategory()"));
     //     	$categoryElement->setMultiOptions($options);
     //     	$this->addElement($categoryElement);
     $roder_element = new Zend_Form_Element_Text("txt_order");
     $roder_element->setAttribs(array('placeholder' => 'Optional', "onblur" => "CheckPOInvoice();"));
     $this->addElement($roder_element);
     $contactElement = new Zend_Form_Element_Text('contact');
     $contactElement->setAttribs(array('placeholder' => 'Enter Contact Name'));
     $this->addElement($contactElement);
     $orderElement = new Zend_Form_Element_Text('order');
     $orderElement->setAttribs(array('placeholder' => 'Enter Order'));
     $this->addElement($orderElement);
     $phoneElement = new Zend_Form_Element_Text('txt_phone');
     $phoneElement->setAttribs(array('placeholder' => 'Enter Phone Number'));
     $this->addElement($phoneElement);
     //     	$option_loc = 'SELECT LocationId, Name FROM tb_sublocation WHERE Name!="" ';
     //     	if($result['level']!=1 || $result['level']!=2){//if this isn't super user or inventory manager
     //     		$option_loc .= " AND LocationId = ".$result['location_id'];//select only this user location
     //     	}
     //     	$option_loc .= ' ORDER BY LocationId DESC';
     //     	$rs=$db->getGlobalDb($option_loc);
     //     	$productValue = $request->getParam('LocationId');
     //     	$option =array();
     //     	if($result['level']==1 || $result['level']==2){//if this is super user
     //    			$option =array("1"=>"Defaul Location","-1"=>"Add New Location");
     //     	}
     //     	if(!empty($rs)) foreach($rs as $read) $option[$read['LocationId']]=$read['Name'];
     //     	$locationID=new Zend_Form_Element_Select('LocationId');
     //     	$locationID->setMultiOptions($option);
     //     	$locationID->setattribs(array('id'=>'LocationId',
     //     			'Onchange'=>'AddLocation()',
     //     			'class'=>'demo-code-language'
     //     			));
     //     	$locationID->setValue($productValue);
     //     	$this->addElement($locationID);
     $user = $this->GetuserInfo();
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' ";
     if ($user["level"] == 1 or $user["level"] == 2) {
         $options = array("1" => $tr->translate("Please_Select"), "-1" => $tr->translate("ADD_NEW_LOCATION"));
     } else {
         $sql .= " AND LocationId = " . $user["location_id"];
     }
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     $productValue = $request->getParam('LocationId');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('LocationId');
     $locationID->setAttribs(array('class' => 'validate[required]'));
     $locationID->setMultiOptions($options);
     $locationID->setattribs(array('id' => 'LocationId', 'Onchange' => 'AddLocation()'));
     $locationID->setValue($productValue);
     $this->addElement($locationID);
     $rowspayment = $db->getGlobalDb('SELECT * FROM tb_paymentmethod');
     if ($rowspayment) {
         foreach ($rowspayment as $readCategory) {
             $options_cg[$readCategory['payment_typeId']] = $readCategory['payment_name'];
         }
     }
     $paymentmethodElement = new Zend_Form_Element_Select('payment_name');
     $paymentmethodElement->setMultiOptions($options_cg);
     $this->addElement($paymentmethodElement);
     $rowsPayment = $db->getGlobalDb('SELECT CurrencyId, Description,Symbol FROM tb_currency');
     if ($rowsPayment) {
         foreach ($rowsPayment as $readPayment) {
             $options_cur[$readPayment['CurrencyId']] = $readPayment['Description'] . $readPayment['Symbol'];
         }
     }
     $currencyElement = new Zend_Form_Element_Select('currency');
     $currencyElement->setAttribs(array('class' => 'demo-code-language'));
     $currencyElement->setMultiOptions($options_cur);
     $this->addElement($currencyElement);
     $descriptionElement = new Zend_Form_Element_Textarea('remark');
     $this->addElement($descriptionElement);
     $remarkaddElement = new Zend_Form_Element_Textarea('remark_add');
     $this->addElement($remarkaddElement);
     $vendoraddElement = new Zend_Form_Element_Textarea('vendor_address');
     $vendoraddElement->setAttribs(array('placeholder' => 'Enter Vendor Address'));
     $this->addElement($vendoraddElement);
     $allTotalElement = new Zend_Form_Element_Text('all_total');
     $allTotalElement->setAttribs(array('readonly' => 'readonly'));
     $this->addElement($allTotalElement);
     $discountTypeElement = new Zend_Form_Element_Radio('discount_type');
     $discountTypeElement->setMultiOptions(array(1 => '%', 2 => 'Fix Value'));
     $discountTypeElement->setAttribs(array('checked' => 'checked'));
     $discountTypeElement->setAttribs(array('onChange' => 'doTotal()'));
     $this->addElement($discountTypeElement);
     //     	$isFreeTypeElement = new Zend_Form_Element_Checkbox('pricefree_');
     //     	//$isFreeTypeElement->setMultiOptions(array(1=>'%',2=>'Fix Value'));
     //     	$isFreeTypeElement->options(array('setCheckedValue'=>1,'setUncheckedValue'=>0));
     //     	$isFreeTypeElement->setAttribs(array('onChange'=>'getPriceFree()',));
     //     	$this->addElement($isFreeTypeElement);
     $netTotalElement = new Zend_Form_Element_Text('net_total');
     $netTotalElement->setAttribs(array('readonly' => 'readonly'));
     $this->addElement($netTotalElement);
     $discountValueElement = new Zend_Form_Element_Text('discount_value');
     $discountValueElement->setAttribs(array('class' => 'input100px', 'onblur' => 'doTotal()'));
     $this->addElement($discountValueElement);
     $discountRealElement = new Zend_Form_Element_Text('discount_real');
     $discountRealElement->setAttribs(array('readonly' => 'readonly', 'class' => 'input100px'));
     $this->addElement($discountRealElement);
     $globalRealElement = new Zend_Form_Element_Hidden('global_disc');
     $this->addElement($globalRealElement);
     $discountValueElement = new Zend_Form_Element_Text('discount_value');
     $discountValueElement->setAttribs(array('class' => 'input100px', 'onblur' => 'doTotal()'));
     $this->addElement($discountValueElement);
     $dis_valueElement = new Zend_Form_Element_Text('dis_value');
     $dis_valueElement->setAttribs(array('placeholder' => 'Discount Value'));
     $dis_valueElement->setAttribs(array('onblur' => 'doTotal()'));
     $this->addElement($dis_valueElement);
     $totalAmountElement = new Zend_Form_Element_Text('totalAmoun');
     $totalAmountElement->setAttribs(array('readonly' => 'readonly'));
     $this->addElement($totalAmountElement);
     $remainlElement = new Zend_Form_Element_Text('remain');
     //$remainlElement->setAttribs(array('readonly'=>'readonly',));
     $this->addElement($remainlElement);
     $balancelElement = new Zend_Form_Element_Text('balance');
     //$remainlElement->setAttribs(array('readonly'=>'readonly',));
     $this->addElement($balancelElement);
     $statusElement = new Zend_Form_Element_Select('status');
     $opt_status = array("" => "Please Select status", 2 => 'Open', 3 => 'In Progress', 4 => 'Paid', 5 => "Recieved", 6 => 'Cancel');
     $statusElement->setAttribs(array('class' => 'validate[required]', 'onchange' => 'calculatePrice();'));
     $statusElement->setMultiOptions($opt_status);
     //     	$statusElement->setAttribs(array('1'=>'Active',));
     //     	$statusElement->setValue("Open");
     $this->addElement($statusElement);
     $date_inElement = new Zend_Form_Element_Text('date_in');
     $date = new Zend_Date();
     $date_inElement->setAttribs(array('class' => 'validate[required]'));
     $date_inElement->setValue($date->get('YYYY-MM-dd'));
     $this->addElement($date_inElement);
     $dateOrderElement = new Zend_Form_Element_Text('order_date');
     $dateOrderElement->setAttribs(array('class' => 'validate[required]', 'placeholder' => 'Click to Choose Date'));
     $dateOrderElement->setValue($date->get('YYYY-MM-dd'));
     $this->addElement($dateOrderElement);
     $addressElement = new Zend_Form_Element_Text('address');
     $this->addElement($addressElement);
     $termElement = new Zend_Form_Element_Text('term');
     $termElement->setAttribs(array('class' => 'validate[required]'));
     $this->addElement($termElement);
     //     	$branchElement = new Zend_Form_Element_Text('branch');
     //     	$branchElement->setAttribs(array('class'=>'validate[required]',));
     //     	$this->addElement($branchElement);
     $orderidElement = new Zend_Form_Element_Text('orderid');
     $this->addElement($orderidElement);
     //     	$dateElement = new Zend_Form_Element_Text('date');
     //     	$this->addElement($dateElement);
     $dateElement = new Zend_Form_Element_Text('date');
     $this->addElement($dateElement);
     $paid_date = new Zend_Form_Element_Text("paid_date_payment");
     $paid_date->setAttribs(array('class' => 'validate[required]'));
     $paid_date->setValue($date->get('YYYY-MM-dd'));
     $this->addElement($paid_date);
     //     	$receive_dateElement = new Zend_Form_Element_Text('recive_date');
     //     	$this->addElement($receive_dateElement);
     //     	$reqDateElement = new Zend_Form_Element_Text('rs-date');
     //     	$this->addElement($reqDateElement);
     $remarkElement = new Zend_Form_Element_Textarea('remark');
     $this->addElement($remarkElement);
     $totalElement = new Zend_Form_Element_Text('total');
     $this->addElement($totalElement);
     $paidElement = new Zend_Form_Element_Text('paid');
     $paidElement->setAttribs(array('class' => 'custom[number]', 'Onblur' => 'doRemain()'));
     $this->addElement($paidElement);
     $history_idElement = new Zend_Form_Element_Hidden('history_id');
     $this->addElement($history_idElement);
     $history_date_idElement = new Zend_Form_Element_Hidden('old_history_date');
     $this->addElement($history_date_idElement);
     //$abcElement->setValue($value);
     Application_Form_DateTimePicker::addDateField(array('order_date', 'date_in', 'offer_date', 'receiv_date', 'paid_date_payment'));
     if ($data != null) {
         $idElement = new Zend_Form_Element_Text('id');
         $this->addElement($idElement);
         $history_idElement->setValue($data["history_id"]);
         $history_date_idElement->setValue($data["date"]);
         $recieve_id = new Zend_Form_Element_Hidden("recieve_id");
         $this->addElement($recieve_id);
         $recieve_id->setValue($data["recieve_id"]);
         $oldlocationIdElement = new Zend_Form_Element_Text('old_location');
         $this->addElement($oldlocationIdElement);
         $idElement->setValue($data["order_id"]);
         $date_inElement->setValue($data["date_in"]);
         $oldStatusElement = new Zend_Form_Element_Hidden('oldStatus');
         $this->addElement($oldStatusElement);
         $vendor_id->setValue($data["vendor_id"]);
         $contactElement->setValue($data['contact_name']);
         $phoneElement->setValue($data['phone']);
         $remarkaddElement->setValue($data['add_name']);
         if ($data["status"] == 1) {
             $statusElement->setValue("Quote");
         } elseif ($data["status"] == 2) {
             $statusElement->setValue("Open");
         } elseif ($data["status"] == 3) {
             $statusElement->setValue("In Progress");
         } elseif ($data["status"] == 4) {
             $statusElement->setValue("Paid");
         } elseif ($data["status"] == 5) {
             $statusElement->setValue("Recieved");
         } else {
             $statusElement->setValue("Cancel");
         }
         //$idElement->setValue($data['id']);
         $statusElement->setValue($data["status"]);
         $oldStatusElement->setValue($data['status']);
         $locationID->setvalue($data['LocationId']);
         $oldlocationIdElement->setvalue($data['LocationId']);
         $dateOrderElement->setValue($data["date_order"]);
         $roder_element->setValue($data['order']);
         $roder_element->setAttribs(array('readonly' => 'readonly'));
         $paymentmethodElement->setValue($data['payment_method']);
         $currencyElement->setValue($data['currency_id']);
         $remarkElement->setValue($data["remark"]);
         $paidElement->setValue($data['paid']);
         $totalAmountElement->setValue($data["all_total"]);
         //$remainlElement->setvalue($data['balance']);
         $allTotalElement->setValue($data['all_total']);
         $discountValueElement->setValue($data['discount_value']);
         $netTotalElement->setValue($data['net_total']);
         $balancelElement->setValue($data["balance"]);
         $globalRealElement->setValue($data["discount_real"]);
     } else {
         $discountTypeElement->setValue(1);
     }
     return $this;
 }
 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     /////////////Filter stock/////////////////
     $nameValue = $request->getParam('s_name');
     $nameElement = new Zend_Form_Element_Text('s_name');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     /////////////Date of lost item		/////////////////
     $startDateValue = $request->getParam('search_start_date');
     $startDateElement = new Zend_Form_Element_Text('search_start_date');
     $startDateElement->setValue($startDateValue);
     $this->addElement($startDateElement);
     $endDateValue = $request->getParam('search_end_date');
     $endDateElement = new Zend_Form_Element_Text('search_end_date');
     $endDateElement->setValue($endDateValue);
     $this->addElement($endDateElement);
     /////////////	Search subject in Lost Item		/////////////////
     $subjectValue = $request->getParam('subject');
     $subjectElement = new Zend_Form_Element_Text('subject');
     $subjectElement->setValue($subjectValue);
     $this->addElement($subjectElement);
     //Product Name
     $rs = $db->getGlobalDb('SELECT pro_id,item_name FROM tb_product');
     $productValue = $request->getParam('pro_id');
     $options = array('' => 'Please Select Product');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['pro_id']] = $read['item_name'];
         }
     }
     $product_id = new Zend_Form_Element_Select('pro_id');
     $product_id->setMultiOptions($options);
     $product_id->setattribs(array('id' => 'pro_id', 'onchange' => 'this.form.submit()'));
     $product_id->setValue($productValue);
     $this->addElement($product_id);
     //location
     $rs = $db->getGlobalDb('SELECT LocationId,Name FROM tb_sublocation ');
     $productValue = $request->getParam('LocationId');
     $options = array('' => 'Please Select Product');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $product_id = new Zend_Form_Element_Select('LocationId');
     $product_id->setMultiOptions($options);
     $product_id->setattribs(array('id' => 'LocationId', 'onchange' => 'this.form.submit()'));
     $product_id->setValue($productValue);
     $this->addElement($product_id);
     //Vendor of purchase
     if (!empty($session_stock->stockID)) {
         $session_stock = new Zend_Session_Namespace('stock');
         $rs = $db->getGlobalDb('SELECT id, name FROM rsmk_stock WHERE id!=' . $session_stock->stockID);
         $providerValue = $request->getParam('stock_sale_id');
         $optionsProvider = array('' => 'Please Select Product');
         if (!empty($rs)) {
             foreach ($rs as $read) {
                 $optionsProvider[$read['id']] = $read['name'];
             }
         }
         $provider = new Zend_Form_Element_Select('stock_sale_id');
         $provider->setMultiOptions($optionsProvider);
         $provider->setattribs(array('id' => 'stock_sale_id', 'onchange' => 'this.form.submit()'));
         $provider->setValue($providerValue);
         $this->addElement($provider);
     }
     //status of purchase
     $statusValue = $request->getParam('status');
     $optionsStatus = array('' => 'Please Select', 1 => 'Created', 2 => 'Approve', 3 => 'Deliver', 4 => 'Cancel', 5 => 'Recieve Shipping');
     $status = new Zend_Form_Element_Select('status');
     $status->setMultiOptions($optionsStatus);
     $status->setattribs(array('id' => 'status', 'onchange' => 'this.form.submit()'));
     $status->setValue($statusValue);
     $this->addElement($status);
     //Sale Agent
     $rowAgents = $db->getGlobalDb('SELECT id, name FROM rsmk_sale_agent');
     $agentValue = $request->getParam('sale_agent_id');
     $options = array('' => 'Please Select Sale Agent');
     if (!empty($rowAgents)) {
         foreach ($rowAgents as $rowAgent) {
             $options[$rowAgent['id']] = $rowAgent['name'];
         }
     }
     $agent_id = new Zend_Form_Element_Select('sale_agent_id');
     $agent_id->setMultiOptions($options);
     $agent_id->setattribs(array('id' => 'sale_agent_id', 'onchange' => 'this.form.submit()'));
     $agent_id->setValue($agentValue);
     $this->addElement($agent_id);
     //status of purchase
     $statusCOValue = $request->getParam('status');
     $optionsCOStatus = array('' => 'Please Select', 1 => 'Request', 2 => 'Offer', 3 => 'Reject', 4 => 'Debt', 5 => 'Paid');
     $statusCO = new Zend_Form_Element_Select('status');
     $statusCO->setMultiOptions($optionsCOStatus);
     $statusCO->setattribs(array('id' => 'status', 'onchange' => 'this.form.submit()'));
     $statusCO->setValue($statusCOValue);
     $this->addElement($statusCO);
     Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
 }
 public function transferItem($data = null)
 {
     $db = new Application_Model_DbTable_DbGlobal();
     // $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $invoiceElement = new Zend_Form_Element_Text('invoce_num');
     $invoiceElement->setAttribs(array('class' => 'validate[required]'));
     $this->addElement($invoiceElement);
     $date = new Zend_Date();
     $transfer_dateElement = new Zend_Form_Element_Text('transfer_date');
     $transfer_dateElement->setValue($date->get('YYYY-MM-dd'));
     $transfer_dateElement->setAttribs(array('class' => 'validate[required]'));
     $this->addElement($transfer_dateElement);
     $remark_element = new Zend_Form_Element_Textarea("remark_transfer");
     $this->addElement($remark_element);
     $user = $this->GetuserInfo();
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!=''  ";
     if ($user["level"] == 1 or $user["level"] == 2) {
         $options = array("1" => "Defaul Location", "-1" => "Add New Location");
     } else {
         $sql .= " AND LocationId = " . $user["location_id"];
     }
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $locationID = new Zend_Form_Element_Select('from_location');
     $locationID->setAttribs(array('class' => 'validate[required]'));
     $locationID->setMultiOptions($options);
     $locationID->setattribs(array('id' => 'from_location', 'Onchange' => 'AddLocation()'));
     $this->addElement($locationID);
     ////////////////////////////////////
     $options = "";
     $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' ";
     $sql .= " ORDER BY LocationId DESC";
     $rs = $db->getGlobalDb($sql);
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['LocationId']] = $read['Name'];
         }
     }
     $to_locationID = new Zend_Form_Element_Select('to_location');
     $to_locationID->setAttribs(array('class' => 'validate[required]'));
     $to_locationID->setMultiOptions($options);
     $to_locationID->setattribs(array('id' => 'to_location'));
     $this->addElement($to_locationID);
     Application_Form_DateTimePicker::addDateField(array('transfer_date'));
     //set value when edit
     if ($data != null) {
         $idElement = new Zend_Form_Element_Hidden('transfer_id');
         $idElement->setValue($data["transfer_id"]);
         $this->addElement($idElement);
         $fromElement = new Zend_Form_Element_Hidden('old_from_location');
         $fromElement->setValue($data["from_location"]);
         $this->addElement($fromElement);
         $toElement = new Zend_Form_Element_Hidden('old_to_location');
         $toElement->setValue($data["to_location"]);
         $this->addElement($toElement);
         $invoiceElement->setValue($data["invoice_num"]);
         $invoiceElement->setAttribs(array("readonly" => "readonly"));
         $transfer_dateElement->setValue($data["transfer_date"]);
         $remark_element->setValue($data["remark"]);
         $locationID->setValue($data["from_location"]);
         $to_locationID->setValue($data["to_location"]);
     }
     return $this;
 }
 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $db = new Application_Model_DbTable_DbGlobal();
     ////////////////////////////////////////////////////////Purchase*****/////////////////////////////////////////////
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     //get sales or purchase id text
     $nameValue = $request->getParam('order');
     $nameElement = new Zend_Form_Element_Text('order');
     $nameElement->setValue($nameValue);
     $this->addElement($nameElement);
     //get phone text
     $phoneElement = new Zend_Form_Element_Text('phone');
     $this->addElement($phoneElement);
     $rs = $db->getGlobalDb('SELECT vendor_id, v_name FROM tb_vendor WHERE v_name!="" AND is_active=1 ');
     $options = array($tr->translate('Please_Select'));
     $vendorValue = $request->getParam('vendor_name');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['vendor_id']] = $read['v_name'];
         }
     }
     $vendor_element = new Zend_Form_Element_Select('vendor_name');
     $vendor_element->setMultiOptions($options);
     $vendor_element->setAttribs(array('id' => 'vendor_id'));
     $vendor_element->setValue($vendorValue);
     $this->addElement($vendor_element);
     $rs = $db->getGlobalDb('SELECT agent_id, name FROM tb_sale_agent WHERE name!="" ORDER BY agent_id DESC');
     $options = array($tr->translate('Please_Select'));
     $agentValue = $request->getParam('sale_agent_id');
     if (!empty($rs)) {
         foreach ($rs as $read) {
             $options[$read['agent_id']] = $read['name'];
         }
     }
     $sale_agent = new Zend_Form_Element_Select('sale_agent_id');
     $sale_agent->setMultiOptions($options);
     $sale_agent->setAttribs(array('id' => 'sale_agent_id', 'class' => 'validate[required]'));
     $sale_agent->setValue($agentValue);
     $this->addElement($sale_agent);
     /////////////Date of lost item		/////////////////
     $startDateValue = $request->getParam('search_start_date');
     $endDateValue = $request->getParam('search_end_date');
     if ($endDateValue == "") {
         $endDateValue = date("Y-m-d");
         $startDateValue = date("Y-m-d");
     }
     $startDateElement = new Zend_Form_Element_Text('search_start_date');
     $startDateElement->setValue($startDateValue);
     $this->addElement($startDateElement);
     $endDateElement = new Zend_Form_Element_Text('search_end_date');
     $endDateElement->setValue($endDateValue);
     $this->addElement($endDateElement);
     //status of purchase or sales
     // 		$statusValue = $request->getParam('status');
     // 		$optionsStatus=array(''=>'Please Select',1=>'Quote',2=>'Open',3=>'In Progress',4=>'Invoice',5=>'Paid',6=>"Cancel");
     // 		$status=new Zend_Form_Element_Select('status');
     // 		$status->setMultiOptions($optionsStatus);
     // 		$status->setattribs(array(
     // 				'id'=>'status',
     // 			//	'onchange'=>'this.form.submit()',
     // 		));
     // 		$status->setValue($statusValue);
     // 		$this->addElement($status);
     $rs = $db->getGlobalDb('SELECT DISTINCT Name,LocationId FROM tb_sublocation WHERE Name!="" AND status=1 ');
     $options = array($tr->translate('Please_Select'));
     $locationValue = $request->getParam('LocationId');
     foreach ($rs as $read) {
         $options[$read['LocationId']] = $read['Name'];
     }
     $location_id = new Zend_Form_Element_Select('LocationId');
     $location_id->setMultiOptions($options);
     $location_id->setAttribs(array('id' => 'LocationId', 'onchange' => 'this.form.submit()'));
     $location_id->setValue($locationValue);
     $this->addElement($location_id);
     ////////////////////////////////////////////////*******////////////////////////////////
     //Customer
     $rowCustomers = $db->getGlobalDb('SELECT customer_id, cust_name FROM tb_customer WHERE cust_name!="" AND is_active=1 ORDER BY customer_id DESC');
     $agentValue = $request->getParam('customer_id');
     $optionsCUS = array($tr->translate('Please_Select_Customer'));
     if (!empty($rowCustomers)) {
         foreach ($rowCustomers as $rowCustomer) {
             $optionsCUS[$rowCustomer['customer_id']] = $rowCustomer['cust_name'];
         }
     }
     $customer_id = new Zend_Form_Element_Select('customer_id');
     $customer_id->setMultiOptions($optionsCUS);
     $customer_id->setattribs(array('id' => 'customer_id', 'class' => 'validate[required]'));
     $customer_id->setValue($agentValue);
     $this->addElement($customer_id);
     //status of purchase
     $statusCOValue = 4;
     $statusCOValue = $request->getParam('status');
     $optionsCOStatus = array('' => $tr->translate('ALL'), 2 => $tr->translate('OPEN'), 3 => $tr->translate('IN_PROGRESS'), 4 => $tr->translate('PAID'), 5 => $tr->translate('RECEIVED'), 6 => $tr->translate('MENU_CANCEL'));
     $statusCO = new Zend_Form_Element_Select('status');
     $statusCO->setMultiOptions($optionsCOStatus);
     $statusCO->setattribs(array('id' => 'status'));
     if ($statusCOValue == "") {
         //$statusCOValue=4;
     }
     $statusCO->setValue($statusCOValue);
     $this->addElement($statusCO);
     Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date'));
     //vendor customer search  //////////////////////////////////////////////////////////
     $getnameValue = $request->getParam('name');
     $nameElement = new Zend_Form_Element_Text('name');
     $nameElement->setValue($getnameValue);
     $this->addElement($nameElement);
     $getcontactValue = $request->getParam('Contact');
     $contactElement = new Zend_Form_Element_Text('Contact');
     $contactElement->setValue($getcontactValue);
     $this->addElement($contactElement);
     $getphoneValue = $request->getParam('phone');
     $phoneElement = new Zend_Form_Element_Text('phone');
     $phoneElement->setValue($getphoneValue);
     $this->addElement($phoneElement);
     $getemailValue = $request->getParam('email');
     $emailElement = new Zend_Form_Element_Text("email");
     $emailElement->setValue($getemailValue);
     $this->addElement($emailElement);
     $addValue = $request->getParam('address');
     $addressElement = new Zend_Form_Element_Text("address");
     $addressElement->setValue($addValue);
     $this->addElement($addressElement);
     // 		$websiteElement = new Zend_Form_Element_Text("website");
     // 		$this->addElement($websiteElement);
     // 		$rowCustomers=$db->getGlobalDb('SELECT customer_id, cust_name FROM tb_customer');
     // 		$agentValue = $request->getParam('customer_id');
     // 		$options=array(''=>'Please Select Customer');
     // 		if(!empty($rowCustomers)) foreach($rowCustomers as $rowCustomer) $options[$rowCustomer['customer_id']]=$rowCustomer['cust_name'];
     // 		$customer_id=new Zend_Form_Element_Select('customer_id');
     // 		$customer_id->setMultiOptions($options);
     // 		$customer_id->setattribs(array(
     // 				'id'=>'customer_id',
     // 				'class'=>'demo-code-language',
     // 				//'onchange'=>'this.form.submit()',
     // 		));
     // 		$customer_id->setValue($agentValue);
     // 		$this->addElement($customer_id);
     // 		$rs=$db->getGlobalDb('SELECT CurrencyId,Description FROM tb_currency');
     // 		$options=array('Please Select');
     // 		$currency_value = $request->getParam('currency_id');
     // 		foreach($rs as $read) $options[$read['CurrencyId']]=$read['Description'];
     // 		$currency_id=new Zend_Form_Element_Select('currency_id');
     // 		$currency_id->setMultiOptions($options);
     // 		$currency_id->setAttribs(array(
     // 				'id'=>'CurrencyId',
     // 				//'onchange'=>'this.form.submit()',
     // 				'class'=>'demo-code-language',
     // 		));
     // 		$currency_id->setValue($currency_value);
     // 		$this->addElement($currency_id);
 }