public function getProductPriceCodeLookup() { $code = Subproductprice::model()->findAll(); $code = CHtml::listData($code, 'code', 'code'); return $code; }
public function renderPOSTypeDashboard() { if($this->isSales()) { $this->redirect( Yii::app()->createUrl('order/' . Helper::CONST_posclient) ); }else { $customerduemodel = new Person; $customerduemodel->unsetAttributes(); $productpricemodel = new Subproductprice; $productpricemodel->unsetAttributes(); $orderproductmodel = new Orderproduct; $orderproductmodel->unsetAttributes(); $this->render( $this->getView('index','index'), array( 'customerduemodel' => $customerduemodel, 'productpricemodel' => $productpricemodel, 'orderproductmodel' => $orderproductmodel, ) ); } }
public function actionGetAllProducts() { $json = new CArJSON; $criteria=new CDbCriteria; $criteria->order='id asc'; $criteria->addCondition('parent_id = 0 and status=1'); $catwithproducts = Category::model()->findAll($criteria); $prdcondition = array('condition'=>'t.status = 1 AND product.status = 1'); $products = Subproductprice::model()->with('product') ->findAll($prdcondition); $prdcondition_non_mngd = array('condition'=>'t.status = 1 AND product.status = 1 AND t.dontsyncwithstock = 1'); $non_mngd_products = Productprice::model()->with('product') ->findAll($prdcondition_non_mngd); if(!empty($catwithproducts) && !empty($products) ) { //$relations = array(array('categories'=>array(array('products'=>array('taxrate'))))); $relations = array(array('categories'=>array('subproductprices'))); $attributes = array( 'root' => array(),//null,//array of attribute names 'categories' => array(), 'subproductprices' => $this->prdcolumns, ); $isarray = true; $iskeybasedarray = true; $sec_cat_products = $json->toJSON($catwithproducts, $relations, $attributes, $isarray, $iskeybasedarray); $relations = array(); $attributes = array( 'root' => $this->prdcolumns, ); $isarray = true; $iskeybasedarray = true; $non_mngd_products = $json->toJSON($non_mngd_products, $relations, $attributes, $isarray, $iskeybasedarray); $relations = array(); $attributes = array( 'root' => array('value','label'), ); $isarray = true; $iskeybasedarray = false; $allproducts_short = $json->toJSON($products, $relations, $attributes, $isarray, $iskeybasedarray); $customercondition = array(); $customers = $this->getAllPeopleNoRestriction(Helper::CONST_Customer); $allcustomers = CHtml::listData($customers, 'id', 'name'); $dfltcustomerid = $this->getPersonByName(Helper::CONST_Walk_in_Customer); $data = array( //Helper::CONST_prdskuToIdMap => $prdskuToIdMap, Helper::CONST_allproducts_short => $allproducts_short, Helper::CONST_non_mngd_products => $non_mngd_products, Helper::CONST_sec_cat_products => $sec_cat_products, Helper::CONST_allcustomers => $allcustomers, Helper::CONST_default_customer_id => $dfltcustomerid ); $rtnCode = Helper::CONST_Error_None; $message = Helper::CONST_POS_Masters; } else { $data = array( Helper::CONST_allproducts_short => array(), Helper::CONST_non_mngd_products => array(), Helper::CONST_sec_cat_products => array(), Helper::CONST_allcustomers => array(), Helper::CONST_default_customer_id => -1 ); $rtnCode = Helper::CONST_Error_None; $message = Helper::CONST_NotFound_Message; } // $edata = $this->getJsonOfData($rtnCode, $data, $message); // $this->writeToCookie(Helper::CONST_sec_cat_products, $edata); $this->returnJsonResponse($rtnCode, $data, $message); }
/** GET SUB PRODUCT LIST TO VIEW IN DATA TABLE ********************/ public function actionViewProductPrices($id) { $model = new Subproductprice( 'search' ); $model->unsetAttributes(); // clear any default values if ( isset( $_GET['Subproductprice'] ) ) $model->attributes = $_GET['Subproductprice']; $model->product_id = $id; $this->render( 'admin', array( 'model' => $model, ) ); }
public function actionAdjsearch() { $model=new Subproductprice('search'); $model->unsetAttributes(); // clear any default values if(isset($_GET['Subproductprice'])) $model->attributes=$_GET['Subproductprice']; $this->render('Adjsearch',array( 'model'=>$model, )); }
public function actionGetSubProductlist(){ $postedData = $this->getPostedData(); $productdata = Product::model()->findByPk( $postedData['productId'] ); if(count($productdata) > 0) { $criteria = new CDbCriteria; $condition = 'product_id='.$postedData['productId']; $criteria->condition = $condition; $productprice = Subproductprice::model()->findAll($criteria); } $json = new CArJSON; $relations = array(); $attributes = array( 'root' => array() ); $isarray = true; $product = $json->toJSON($productdata, $relations, $attributes, $isarray); $relations = array(); $attributes = array( 'root' => array() ); $isarray = true; $productprice = $json->toJSON($productprice, $relations, $attributes, $isarray); $rtnCode = Helper::CONST_Error_None; $message = Helper::CONST_NotFound_Message; $criteria = new CDbCriteria; $criteria->select = array('id','taxname'); $taxrates = Taxrate::model()->findAll($criteria); $json = new CArJSON; $relations = array(); $attributes = array( 'root' => array() ); $isarray = true; $taxrates = $json->toJSON($taxrates, $relations, $attributes, $isarray); $data = array( //Helper::CONST_prdskuToIdMap => $prdskuToIdMap, Helper::CONST_allproducts_short => $product, Helper::CONST_sec_cat_products => $productprice,'tax'=>$taxrates); $this->returnJsonResponse($rtnCode, $data, $message); }
public function actionAdjsearch() { $id=$_GET['id']; $model=Subproductprice::model()->findByPk($id); $this->render('Adjsearch',array( 'model'=>$model, )); }
public function actionStockInventory() { $model = new Subproductprice( 'stockinventory' ); $model->unsetAttributes(); if ( isset( $_GET['Subproductprice'] ) ) $model->attributes = $_GET['Subproductprice']; if(!empty( $_GET['actionid'] ) && $_GET['actionid'] == Helper::CONST_PDF) { $html = $this->renderPartial( Helper::CONST_stockInventory, array( 'model' => $model, ),true ); $this->writeToPdf( $html ); } else { $this->render( Helper::CONST_stockInventory, array( 'model' => $model, ) ); } }