public function frmRetrunIn($data = null) { $request = Zend_Controller_Front::getInstance()->getRequest(); //$db=new Application_Model_DbTable_DbGlobal(); ////////////////////////////////////////////////////////Purchase*****///////////////////////////////////////////// //get sales or purchase id text $returnOutValue = $request->getParam('invoice_in'); $returnOutElement = new Zend_Form_Element_Text('invoice_in'); $returnOutElement->setValue($returnOutValue); $this->addElement($returnOutElement); $outValue = $request->getParam('invoice_out'); $returnInElement = new Zend_Form_Element_Text('invoice_out'); $returnInElement->setValue($outValue); $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); Application_Form_DateTimePicker::addDateField(array('search_start_date', 'search_end_date')); return $this; }
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; }
public function PurchaseOrder($data = null) { $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 customer_id, cust_name FROM tb_customer WHERE cust_name!="" AND is_active=1 '); $customerValue = $request->getParam('users'); $options = ""; $options = array('' => $tr->translate('Please_Select'), '-1' => $tr->translate('ADD_CUSTOMER_ORDER')); if (!empty($rs)) { foreach ($rs as $read) { $options[$read['customer_id']] = $read['cust_name']; } } $customerID = new Zend_Form_Element_Select('customer_id'); $customerID->setAttribs(array('id' => 'customer_id', 'Onchange' => 'getCustomerInfo()', 'class' => 'validate[required]')); $customerID->setMultiOptions($options); //$customerID->setattribs(array(id'=>'customer_id','onchange'=>'this.form.submit()',)); $customerID->setValue($customerValue); $this->addElement($customerID); $orderElement = new Zend_Form_Element_Text('order'); $orderElement->setAttribs(array('placeholder' => 'Optional')); $this->addElement($orderElement); $phoneElement = new Zend_Form_Element_Text('txt_phone'); $phoneElement->setAttribs(array('placeholder' => 'Enter Contact Number')); $this->addElement($phoneElement); $user = $this->GetuserInfo(); $options = ""; $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' AND status = 1 "; 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('id' => 'LocationId', 'Onchange' => 'AddLocation()', 'class' => 'validate[required]')); $locationID->setMultiOptions($options); $locationID->setValue($productValue); $this->addElement($locationID); $rowsmethodpay = $db->getGlobalDb('SELECT * FROM tb_paymentmethod'); if ($rowsmethodpay) { foreach ($rowsmethodpay as $readCategory) { $option_method[$readCategory['payment_typeId']] = $readCategory['payment_name']; } } $paymentmethodElement = new Zend_Form_Element_Select('payment_name'); $paymentmethodElement->setMultiOptions($option_method); $this->addElement($paymentmethodElement); $rowsPayment = $db->getGlobalDb('SELECT CurrencyId, Description,Symbol FROM tb_currency'); if ($rowsPayment) { foreach ($rowsPayment as $readPayment) { $options_curr[$readPayment['CurrencyId']] = $readPayment['Description'] . $readPayment['Symbol']; } } $currencyElement = new Zend_Form_Element_Select('currency'); $currencyElement->setMultiOptions($options_curr); $this->addElement($currencyElement); $descriptionElement = new Zend_Form_Element_Textarea('remark'); $this->addElement($descriptionElement); $remarkaddElement = new Zend_Form_Element_Textarea('remark_add'); $this->addElement($remarkaddElement); $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); $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', 'onChange' => 'doTotal()')); $this->addElement($discountValueElement); $discountRealElement = new Zend_Form_Element_Text('discount_real'); $discountRealElement->setAttribs(array('readonly' => 'readonly', 'class' => 'input100px')); $this->addElement($discountRealElement); $discountValueElement = new Zend_Form_Element_Text('discount_value'); $discountValueElement->setAttribs(array('class' => 'input100px', 'onChange' => 'doTotal()')); $this->addElement($discountValueElement); $paidRealElement = new Zend_Form_Element_Text('paid'); $paidRealElement->setAttribs(array('class' => 'input100px', 'onChange' => 'Total1()')); $this->addElement($paidRealElement); $remainlElement = new Zend_Form_Element_Text('remain'); $remainlElement->setAttribs(array('readonly' => 'readonly')); $this->addElement($remainlElement); $statusElement = new Zend_Form_Element_Select('status'); //$statusElement->setAttribs(array('readonly'=>'readonly',)); //$statusElement->setValue("Open"); $opt = array("" => $tr->translate('Please_Select'), 1 => $tr->translate("Qoute"), 2 => $tr->translate("Open"), 3 => $tr->translate("In Progress"), 5 => $tr->translate("Paid"), 6 => $tr->translate("Cancell")); $statusElement->setMultiOptions($opt); $this->addElement($statusElement); $statusquoteElement = new Zend_Form_Element_Text('quote'); $statusquoteElement->setAttribs(array('readonly' => 'readonly')); $statusquoteElement->setValue("Quote"); $this->addElement($statusquoteElement); $date = new Zend_Date(); $dateOrderElement = new Zend_Form_Element_Text('order_date'); $dateOrderElement->setAttribs(array('placeholder' => 'Click To Choose Date', 'class' => 'validate[required]')); $dateOrderElement->setValue($date->get('YYYY-MM-dd')); $this->addElement($dateOrderElement); $contactElement = new Zend_Form_Element_Text('contact'); $contactElement->setAttribs(array('placeholder' => 'Enter Contace Name')); $this->addElement($contactElement); $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); // $salesElement = new Zend_Form_Element_Text('sales_ref'); // $this->addElement($salesElement); // $rowsagent= $db->getGlobalDb('SELECT agent_id,name FROM tb_sale_agent ORDER BY agent_id DESC'); // $option_agent=array(''=>'Please Select','-1'=>'Add New Sale Agent'); // if($rowsagent) { // foreach($rowsagent as $read_agent) $option_agent[$read_agent['agent_id']]=$read_agent['name']; // } // $sales_agentElement = new Zend_Form_Element_Select('sales_ref'); // $sales_agentElement->setMultiOptions($option_agent); // $sales_agentElement->setAttribs(array('Onchange'=>'showAgentPopup()')); // $this->addElement($sales_agentElement); $option = ""; $sql = "SELECT agent_id,name FROM tb_sale_agent WHERE name!='' "; $option = array("" => $tr->translate("Please_Select"), "-1" => $tr->translate("Add_New_Sale_Agent")); if ($user["level"] == 1 or $user["level"] == 2) { //$option=array(""=>"Please Select","-1"=>"Add New Sale Agent"); } else { //$option=array(""=>"Please Select"); //$sql.=" AND agent_id =".$user["location_id"]; } $sql .= " ORDER BY agent_id DESC"; $rs = $db->getGlobalDb($sql); $agent_value = $request->getParam('sales_ref'); if (!empty($rs)) { foreach ($rs as $read) { $option[$read['agent_id']] = $read['name']; } } $sales_agentId = new Zend_Form_Element_Select('sales_ref'); $sales_agentId->setAttribs(array('class' => 'validate[required]', 'id' => 'sales_ref', 'Onchange' => 'showAgentPopup()')); $sales_agentId->setMultiOptions($option); $sales_agentId->setValue($agent_value); $this->addElement($sales_agentId); $reqDateElement = new Zend_Form_Element_Text('rs-date'); $this->addElement($reqDateElement); $remarkElement = new Zend_Form_Element_Textarea('remark'); $this->addElement($remarkElement); $type_tax1Element = new Zend_Form_Element_Text('type-tax1'); $this->addElement($type_tax1Element); $type_tax2Element = new Zend_Form_Element_Text('type-tax2'); $this->addElement($type_tax2Element); $totalElement = new Zend_Form_Element_Text('total'); $this->addElement($totalElement); $paidElement = new Zend_Form_Element_Text('paid'); $paidElement->setAttribs(array('onChange' => 'doRemain()')); $this->addElement($paidElement); $historyElement = new Zend_Form_Element_Text('history_id'); $this->addElement($historyElement); Application_Form_DateTimePicker::addDateField(array('order_date', 'offer_date', 'paid_date')); if ($data != null) { $idElement = new Zend_Form_Element_Hidden('id'); $this->addElement($idElement); $idElement->setValue($data["order_id"]); $oldlocationIdElement = new Zend_Form_Element_Hidden('old_location'); $this->addElement($oldlocationIdElement); $oldStatusElement = new Zend_Form_Element_Hidden('oldStatus'); $this->addElement($oldStatusElement); $customerID->setValue($data["customer_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"); } else { $statusElement->setValue("Cancel"); } //$idElement->setValue($data['id']); $oldStatusElement->setValue($data['status']); $sales_agentId->setValue($data['sales_ref']); $locationID->setvalue($data['LocationId']); $oldlocationIdElement->setvalue($data['LocationId']); $dateOrderElement->setValue($data["date_order"]); $orderElement->setAttribs(array("readonly" => "readonly")); $orderElement->setValue($data['order']); $paymentmethodElement->setValue($data['payment_method']); $currencyElement->setValue($data['currency_id']); $remarkElement->setValue($data["remark"]); $paidElement->setValue($data['paid']); $remainlElement->setvalue($data['balance']); $allTotalElement->setValue($data['all_total']); $discountValueElement->setValue($data['discount_value']); $netTotalElement->setValue($data['net_total']); } 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 productDetailReport($data = null) { $db = new Application_Model_DbTable_DbGlobal(); $request = Zend_Controller_Front::getInstance()->getRequest(); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $location = $data["LocationId"]; $brand = $data["branch_id"]; $category = $data["category_id"]; // $item = new report_Model_DbQuery(); // $rs = $item->getItem($data); // $a= count($rs); //print_r($rs);exit(); $rs = $db->getGlobalDb('SELECT pro_id, item_name,item_code FROM tb_product WHERE item_name!="" ORDER BY item_name '); $options = array('' => $tr->translate('Select_Products')); foreach ($rs as $read) { $options[$read['pro_id']] = $read['item_code'] . " " . $read['item_name']; } $pro_id = new Zend_Form_Element_Select('item'); $pro_id->setMultiOptions($options); $proValue = $request->getParam('item'); $pro_id->setAttribs(array('id' => 'item')); $pro_id->setValue($proValue); $this->addElement($pro_id); $reportTypeElement = new Zend_Form_Element_Select("report_type"); $opt = array("" => $tr->translate('REPORT_TYPE'), 1 => "All Report", 2 => "Purchase Report", 3 => "Sales Report", 4 => "Transfer Report", 5 => "Poduct Information Report", 6 => "Customize Report"); $reportTypeElement->setMultiOptions($opt); $reportTypeElement->setAttribs(array('onChange' => 'report()')); $reportTypeValue = $request->getParam('report_type'); $reportTypeElement->setValue($reportTypeValue); $this->addElement($reportTypeElement); $check = new Zend_Form_Element_MultiCheckbox("report_num"); $check->setAttribs(array("class" => "validate[required]")); $opt_check = array(1 => 'Purchase Report', 2 => 'Sales Report', 3 => 'Transfer Report', 4 => 'Poduct Information Report'); $check->setMultiOptions($opt_check); $check_value = $request->getParam("report_num"); $check->setValue($check_value); $this->addElement($check); $sql = 'SELECT DISTINCT Name,LocationId FROM tb_sublocation WHERE Name!="" AND status=1 '; $user = $this->GetuserInfo(); if ($user["level"] != 1 and $user["level"] != 2) { $sql .= " AND LocationId= " . $user["location_id"]; } $rs = $db->getGlobalDb($sql); $options = array('' => $tr->translate('Please_Select_Location')); $locationValue = $request->getParam('LocationId'); foreach ($rs as $read) { $options[$read['LocationId']] = $read['Name']; } $location_id = new Zend_Form_Element_Select('LocationId'); $location_id->setMultiOptions($options); $location_id->setAttribs(array('id' => 'LocationId', 'onchange' => 'getProductByLocation();')); $location_id->setValue($locationValue); $rs = $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category WHERE Name!="" ORDER BY CategoryId'); $options = array('' => $tr->translate('Please_Select')); $cateValue = $request->getParam('category_id'); foreach ($rs as $read) { $options[$read['CategoryId']] = $read['Name']; } $cate_element = new Zend_Form_Element_Select('category_id'); $cate_element->setMultiOptions($options); $cate_element->setAttribs(array('id' => 'category_id', 'onchange' => 'this.form.submit()')); $cate_element->setValue($cateValue); $this->addElement($cate_element); $rs = $db->getGlobalDb('SELECT branch_id, Name FROM tb_branch WHERE Name!="" ORDER BY branch_id '); $options = array('' => $tr->translate('Please_Select')); $branchValue = $request->getParam('branch_id'); foreach ($rs as $read) { $options[$read['branch_id']] = $read['Name']; } $branch_element = new Zend_Form_Element_Select('branch_id'); $branch_element->setMultiOptions($options); $branch_element->setAttribs(array('id' => 'branch_id', 'onchange' => 'getProductByBrand()')); $branch_element->setValue($branchValue); $this->addElement($branch_element); $date = new Zend_Date(); $startDate = new Zend_Form_Element_Text("start_date"); $startDatevalue = $request->getParam("start_date"); //$startDate->setAttribs(array("class"=>"validate[required]")); $startDate->setValue($startDatevalue); $endDate = new Zend_Form_Element_Text("end_date"); //$endDate->setValue($date->get("DD-MM-YY")); $endDatevalue = $request->getParam("end_date"); //$endDate->setAttribs(array("class"=>"validate[required]")); $endDate->setValue($endDatevalue); $this->addElements(array($startDate, $endDate, $location_id)); Application_Form_DateTimePicker::addDateField(array('start_date', 'end_date')); return $this; }
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 showItemForm($data = null) { $db = new Application_Model_DbTable_DbGlobal(); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $nameElement = new Zend_Form_Element_Text('name'); $nameElement->setAttribs(array('class' => 'validate[required]')); $this->addElement($nameElement); $codeElement = new Zend_Form_Element_Text('item_code'); $this->addElement($codeElement); $statusElement = new Zend_Form_Element_Select('status'); $statusElement->setMultiOptions(array(1 => $tr->translate("ACTIVE"), 2 => $tr->translate("INACTIVE"))); $this->addElement($statusElement); $saleStartdateElement = new Zend_Form_Element_Text('sale_startdate'); $this->addElement($saleStartdateElement); $saleEnddateElement = new Zend_Form_Element_Text('sale_enddate'); $this->addElement($saleEnddateElement); $rowsUnit = $db->getGlobalDb('SELECT id, name FROM rsmk_productunit'); $optionsUnit = array(); if ($rowsUnit) { foreach ($rowsUnit as $readUnit) { $optionsUnit[$readUnit['id']] = $readUnit['name']; } } $usageUnitElement = new Zend_Form_Element_Select('usage_unit'); $usageUnitElement->setAttribs(array('class' => 'validate[required]')); $usageUnitElement->setMultiOptions($optionsUnit); $this->addElement($usageUnitElement); $qtyPerUnitElement = new Zend_Form_Element_Text('qty_per_unit'); $qtyPerUnitElement->setAttribs(array('class' => 'validate[custom[number]]')); $this->addElement($qtyPerUnitElement); $unitPriceElement = new Zend_Form_Element_Text('unit_price'); $unitPriceElement->setAttribs(array('class' => 'validate[custom[number]]')); $this->addElement($unitPriceElement); $itemImageElement = new Zend_Form_Element_File('item_image'); if ($data == null) { $itemImageElement->setAttribs(array('class' => 'validate[required]')); } $this->addElement($itemImageElement); $descriptionElement = new Zend_Form_Element_Textarea('description'); $this->addElement($descriptionElement); // Select Element which get data from other Table $rows = $db->getGlobalDb('SELECT id, name FROM rsmk_product'); $options = array(); if ($rows) { foreach ($rows as $read) { $options[$read['id']] = $read['name']; } } $productElement = new Zend_Form_Element_Select('product_id'); $productElement->setMultiOptions($options); $this->addElement($productElement); // Select Element which get data from table category $rowsCategory = $db->getGlobalDb('SELECT CategoryId, Name FROM tb_category'); $optionsCategory = array(); if ($rowsCategory) { foreach ($rowsCategory as $readCategory) { $optionsCategory[$readCategory['CategoryId']] = $readCategory['Name']; } } $categoryElement = new Zend_Form_Element_Select('category'); $categoryElement->setMultiOptions($optionsCategory); $this->addElement($categoryElement); Application_Form_DateTimePicker::addDateField(array('sale_startdate', 'sale_enddate')); //set value when edit if ($data != null) { $idElement = new Zend_Form_Element_Hidden('pr'); $this->addElement($idElement); $idElement->setValue($data['pro_id']); $nameElement->setValue($data['name']); $codeElement->setValue($data['item_code']); $statusElement->setValue($data['status']); $saleStartdateElement->setValue($data['sale_startdate']); $saleEnddateElement->setValue($data['sale_enddate']); $usageUnitElement->setValue($data['usage_unit']); $qtyPerUnitElement->setValue($data['qty_per_unit']); $unitPriceElement->setValue($data['unit_price']); $itemImageElement->setValue($data['item_image']); $descriptionElement->setValue($data['description']); $productElement->setValue($data['product_id']); $categoryElement->setValue($data['category_id']); //$stockElement->setValue($data['stock_id']); } return $this; }
public function ReturnItemToCustomer($data = null) { $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $db = new Application_Model_DbTable_DbGlobal(); $user = $this->GetuserInfo(); $options = ""; $sql = "SELECT LocationId, Name FROM tb_sublocation WHERE Name!='' AND status=1 "; if ($user["level"] == 1 or $user["level"] == 2) { $options = array("1" => $tr->translate("Please_Select")); } 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('LocationId'); $locationID->setAttribs(array('id' => 'LocationId', 'class' => 'validate[required]')); $locationID->setMultiOptions($options); $this->addElement($locationID); $rs = $db->getGlobalDb('SELECT return_id, return_no FROM tb_return_customer_in WHERE return_no!=""'); $options = array("" => $tr->translate("Please_Select")); if (!empty($rs)) { foreach ($rs as $read) { $options[$read['return_id']] = $read['return_no']; } } $returnID = new Zend_Form_Element_Select('return_id'); $returnID->setAttribs(array('id' => 'return_id', 'class' => 'validate[required]', "Onchange" => "getReturnInfo()")); $returnID->setMultiOptions($options); $this->addElement($returnID); $InvoiceElement = new Zend_Form_Element_Text("invoice_no"); $InvoiceElement->setAttribs(array('placeholder' => 'Optional')); $this->addElement($InvoiceElement); $return_date = new Zend_Form_Element_Text("return_date"); $return_date->setAttribs(array('class' => 'validate[required]')); $date = new Zend_Date(); $return_date->setValue($date->get('YYYY-MM-dd')); $this->addElement($return_date); $paidElement = new Zend_Form_Element_Text('paid'); $paidElement->setAttribs(array('onblur' => 'doRemain()')); $this->addElement($paidElement); $descriptionElement = new Zend_Form_Element_Textarea('remark_return'); $this->addElement($descriptionElement); $remainlElement = new Zend_Form_Element_Text('balance'); $remainlElement->setAttribs(array('readonly' => 'readonly')); $this->addElement($remainlElement); $all_totalElement = new Zend_Form_Element_Text('all_total'); $all_totalElement->setAttribs(array('readonly' => 'readonly')); $this->addElement($all_totalElement); Application_Form_DateTimePicker::addDateField(array('return_date')); 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); }