Exemplo n.º 1
0
 public function actionIndex()
 {
     //
     $companyId = Yii::app()->request->getParam('companyId', '0');
     $typeId = Yii::app()->request->getParam('typeId', '0');
     $siteTypes = SiteClass::getTypes($this->companyId);
     if (empty($siteTypes)) {
         $typeId = 'tempsite';
     }
     if ($typeId != 'tempsite') {
         $typeKeys = array_keys($siteTypes);
         $typeId = array_search($typeId, $typeKeys) ? $typeId : $typeKeys[0];
     }
     $criteria = new CDbCriteria();
     $criteria->condition = 't.delete_flag=0 and t.dpid=' . $companyId;
     $criteria->order = ' pid,lid ';
     $categories = ProductCategory::model()->findAll($criteria);
     //                var_dump($categories);exit;
     $criteriaps = new CDbCriteria();
     $criteriaps->condition = 't.delete_flag=0 and t.dpid=' . $companyId;
     $criteriaps->with = "productsetdetail";
     $criteriaps->order = ' t.lid asc ';
     $productSets = ProductSet::model()->findAll($criteriaps);
     $setprice = array();
     foreach ($productSets as $productSet) {
         $sqlsetsum = "select sum(price * number) as tprice from nb_product_set_detail where dpid=" . $companyId . " and set_id=" . $productSet->lid . " and is_select=1 and delete_flag=0";
         $nowval = Yii::app()->db->createCommand($sqlsetsum)->queryScalar();
         $setprice[$productSet->lid] = empty($nowval) ? "0.00" : $nowval;
     }
     //var_dump($setprice);exit;
     $criteriap = new CDbCriteria();
     $criteriap->condition = 'delete_flag=0 and t.dpid=' . $companyId;
     // and is_show=1
     $criteriap->order = ' t.category_id asc,t.lid asc ';
     $products = Product::model()->findAll($criteriap);
     //var_dump($products);exit;
     $productidnameArr = array();
     foreach ($products as $product) {
         $productidnameArr[$product->lid] = $product->product_name;
     }
     //var_dump($productidnameArr);exit;
     $this->render('indexall', array('siteTypes' => $siteTypes, 'typeId' => $typeId, "categories" => $categories, "productSets" => $productSets, 'setprice' => $setprice, "products" => $products, "pn" => $productidnameArr));
 }
Exemplo n.º 2
0
 public function actionOpSite()
 {
     $typeId = Yii::app()->request->getParam('typeId');
     $compayId = Yii::app()->request->getParam('companyId');
     $stypeId = Yii::app()->request->getParam('stypeId', '0');
     $sistemp = Yii::app()->request->getParam('sistemp', '0');
     $ssid = Yii::app()->request->getParam('ssid', '0');
     $op = Yii::app()->request->getParam('op', '0');
     $title = yii::t('app', '请选择餐桌');
     $criteria = new CDbCriteria();
     $models = array();
     if ($op == 'switch') {
         if ($sistemp == '0') {
             $siteTypes = SiteClass::getTypes($this->companyId);
             $title = yii::t('app', '被换餐桌:') . $siteTypes[$stypeId];
             $modelsite = Site::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $ssid, ':dpid' => $this->companyId));
             $title = $title . '-->' . $modelsite->serial . '(' . $modelsite->site_level . ')' . yii::t('app', '::请选择目标餐桌');
         } else {
             $title = yii::t('app', '被换餐桌:临时台/排队-->') . $ssid % 1000 . yii::t('app', '::请选择目标餐桌');
         }
     } elseif ($op == 'union') {
         if ($sistemp == '0') {
             $siteTypes = SiteClass::getTypes($this->companyId);
             $title = yii::t('app', '被并餐桌:') . $siteTypes[$stypeId];
             $modelsite = Site::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $ssid, ':dpid' => $this->companyId));
             $title = $title . '-->' . $modelsite->serial . '(' . $modelsite->site_level . ')' . yii::t('app', '::请选择目标餐桌');
         } else {
             $title = yii::t('app', '被并餐桌:临时台/排队-->') . $ssid % 1000 . yii::t('app', '::请选择目标餐桌');
         }
     }
     //		$this->renderPartial('indexsite',array(
     //				'typeId' => $typeId,
     //                                'title' => $title,
     //                                'ssid' => $ssid,
     //                                'sistemp' => $sistemp,
     //                                'stypeId'=>$stypeId,
     //                                'op'=>$op
     //		));
     //直接Yii::app()->end(title,);
     //或者直接在页面上设置op等。
 }