Ejemplo n.º 1
0
 public function actionMakescheme()
 {
     $edit = 0;
     $params['sid'] = Yii::app()->request->getParam('sid');
     if (Yii::app()->request->isAjaxRequest) {
         $buy = InquiryService::getnulllists();
         $params['searchtype'] = Yii::app()->request->getParam('searchtype');
         $params['keyword'] = Yii::app()->request->getParam('keyword');
         $params['Make'] = Yii::app()->request->getParam('make');
         $params['Car'] = Yii::app()->request->getParam('car');
         $params['Year'] = Yii::app()->request->getParam('year');
         $params['Model'] = Yii::app()->request->getParam('model');
         $params['page'] = Yii::app()->request->getParam('page');
         $params['partslevel'] = Yii::app()->request->getParam('partslevel');
     } else {
         $organparams['organID'] = $params['sid'];
         $organparams['identity'] = 3;
         $service = QuotationService::getorganinfo($organparams);
         $organID = Yii::app()->user->getOrganID();
         $organparams['organID'] = $organID;
         $organparams['identity'] = 2;
         $dealer = QuotationService::getorganinfo($organparams);
         //是否编辑
         $editparams['schid'] = Yii::app()->request->getParam('schid');
         $editparams['quoid'] = Yii::app()->request->getParam('quoid');
         if ($editparams['schid'] && $editparams['quoid']) {
             //获取方案信息
             $schres = QuotationService::getschemedetails($editparams);
             $buy = $schres['buylist'];
             $edit = 1;
         } else {
             if ($editparams['schid'] == null && $editparams['quoid']) {
                 //查看已添加方案个数
                 $par['quoid'] = $editparams['quoid'];
                 $quo = QuotationService::getschemecount($par);
                 $dealer['Title'] = $quo['Title'];
                 $dealer['QuoSn'] = $quo['QuoSn'];
                 $edit = 2;
             }
             $buy = InquiryService::getnulllists();
         }
     }
     //获取商品列表
     $goodslist = QuotationService::getgoods($params);
     if (Yii::app()->request->isAjaxRequest) {
         $this->render('makescheme', array('goodslist' => $goodslist, 'buy' => $buy));
     } else {
         //获取经销商最小交易金额
         $minturnover = QuotationService::getminturnover($organID);
         $this->render('makescheme', array('service' => $service, 'goodslist' => $goodslist, 'buy' => $buy, 'dealer' => $dealer, 'edit' => $edit, 'schinfo' => $schres['schinfo'], 'minturnover' => $minturnover));
     }
 }
Ejemplo n.º 2
0
 public function actionMakescheme()
 {
     $inqid = Yii::app()->request->getParam('inqid');
     //获取询价单发送方id
     $params['sid'] = InquiryService::getinq_sid($inqid);
     $edit = 0;
     if (Yii::app()->request->isAjaxRequest) {
         $buy = InquiryService::getnulllists();
         $params['searchtype'] = Yii::app()->request->getParam('searchtype');
         $params['keyword'] = Yii::app()->request->getParam('keyword');
         $params['standcode'] = Yii::app()->request->getParam('standcode');
         $params['Make'] = Yii::app()->request->getParam('make');
         $params['Car'] = Yii::app()->request->getParam('car');
         $params['Year'] = Yii::app()->request->getParam('year');
         $params['Model'] = Yii::app()->request->getParam('model');
         $params['page'] = Yii::app()->request->getParam('page');
         if ($params['Make'] && $params['standcode']) {
             $params['rows'] = 5;
         }
         $params['partslevel'] = Yii::app()->request->getParam('partslevel');
     } else {
         $this->pageTitle = Yii::app()->name . ' - 报价单 -选择商品';
         $inqres = InquiryService::getinqinfo($inqid);
         if ($inqres['baseinfo']['Make']) {
             $params['Make'] = $inqres['baseinfo']['Make'];
             $params['Car'] = $inqres['baseinfo']['Car'];
             $params['Year'] = $inqres['baseinfo']['Year'];
             $params['Model'] = $inqres['baseinfo']['Model'];
         }
         //获取经销商信息
         $organID = Yii::app()->user->getOrganID();
         $organparams['organID'] = $organID;
         $organparams['identity'] = 2;
         $dealer = QuotationService::getorganinfo($organparams);
         //是否编辑
         $editparams['schid'] = Yii::app()->request->getParam('schid');
         $getquoid['type'] = 2;
         $getquoid['inqid'] = $inqid;
         $editparams['quoid'] = InquiryService::ifsendquo($getquoid);
         if ($editparams['schid']) {
             //获取方案信息
             $schres = QuotationService::getschemedetails($editparams);
             $buy = $schres['buylist'];
             $edit = 1;
         } else {
             if ($editparams['schid'] == null && $editparams['quoid']) {
                 //查看已添加方案个数
                 $quo = QuotationService::getschemecount(array('quoid' => $editparams['quoid']));
                 $dealer['Title'] = $quo['Title'];
                 $dealer['QuoSn'] = $quo['QuoSn'];
                 $edit = 2;
             }
             $buy = InquiryService::getnulllists();
         }
     }
     //获取商品列表
     $goodslist = QuotationService::getgoods($params);
     if (Yii::app()->request->isAjaxRequest) {
         $this->render('makescheme', array('goodslist' => $goodslist, 'buy' => $buy));
     } else {
         //获取经销商最小交易金额
         $minturnover = QuotationService::getminturnover($organID);
         $this->render('makescheme', array('service' => $service, 'goodslist' => $goodslist, 'buy' => $buy, 'dealer' => $dealer, 'edit' => $edit, 'schinfo' => $schres['schinfo'], 'inqres' => $inqres, 'minturnover' => $minturnover));
     }
 }