Exemplo n.º 1
0
 public function actionViewquo()
 {
     $quoID = Yii::app()->request->getParam('quoID');
     $result = QuotationService::getschemelists(array('quoid' => $quoID, 'type' => 2));
     $schinfo = $result['schinfo'];
     $quoinfo = $result['quoinfo'];
     $organparams['organID'] = $quoinfo['ServiceID'];
     $organparams['identity'] = 3;
     $organparams['quoid'] = $quoID;
     $service = QuotationService::getorganinfo($organparams);
     $organparams['organID'] = $quoinfo['DealerID'];
     $organparams['identity'] = 2;
     $dealer = QuotationService::getorganinfo($organparams);
     $this->render('quodetails', array('service' => $service, 'schinfo' => $schinfo, 'dealer' => $dealer, 'quoinfo' => $quoinfo));
 }
Exemplo n.º 2
0
 public static function remindService($params)
 {
     $service = ' select OrganName,Phone from jpd_organ where ID=' . $params['OrganID'];
     $serviceres = Yii::app()->jpdb->createCommand($service)->queryRow();
     $scheme = 'SELECT SchID FROM `pap_quotation_scheme` where QuoID=' . $params['quoID'];
     $schemeres = Yii::app()->papdb->createCommand($scheme)->queryRow();
     //获取支付方式折扣率
     $discount = PapOrderDiscount::model()->find('OrderType=:OrderType', array(':OrderType' => 2));
     if ($discount) {
         if ($params['Payment'] == 1) {
             $factdiscount = $discount['OrderAlipay'] ? $discount['OrderAlipay'] : 100;
         } else {
             if ($params['Payment'] == 2) {
                 $factdiscount = $discount['OrderLogis'] ? $discount['OrderLogis'] : 100;
             }
         }
     } else {
         $factdiscount = 100;
     }
     $totalprices = self::Getsumprices($schemeres['SchID'], $factdiscount, trim($params['DealerID'], ','));
     $msg = '尊敬的' . $serviceres['OrganName'] . '客户,您的报价单方案已生成,总计' . $totalprices . '元。回复 ' . $params['checkSN'] . 'Y 确认、' . $params['checkSN'] . 'N 拒绝。详情:';
     $dealerinfo = QuotationService::getorganinfo(array('organID' => trim($params['DealerID'], ','), 'identity' => 2));
     //收货地址
     $addressql = ' select  ContactName,State,City,District,Address from jpd_receive_address where ID=' . $params['AddressID'];
     $address = Yii::app()->jpdb->createCommand($addressql)->queryRow();
     $address['site'] = Area::getaddress($address['State'], $address['City'], $address['District']) . $address['Address'];
     //获取报价单商品
     $goodssql = ' SELECT GoodsID,Num from pap_quotation_goods where SchID=' . $schemeres['SchID'];
     $goodses = Yii::app()->papdb->createCommand($goodssql)->queryAll();
     foreach ($goodses as $g) {
         $sql = ' select Name from pap_goods where ID=' . $g['GoodsID'];
         $gres = Yii::app()->papdb->createCommand($sql)->queryRow();
         $msg .= $gres['Name'] . ',' . $g['Num'] . '个;';
     }
     $msg .= '收货地址:' . $address['site'] . ';收货人:' . $address['ContactName'] . '。若有疑问请联系经销商:' . $dealerinfo['OrganName'] . ',电话:' . $dealerinfo['Phone'] . '。';
     $res = F::sendSMS(array('msg' => $msg, 'phone' => $serviceres['Phone']));
     if ($res['code'] == 0) {
         //发送成功,添加报价单短信确认数据
         $time = $_SERVER['REQUEST_TIME'];
         $insertsql = ' insert into pap_quotation_confirm (QuoID,DealerID,ServiceID,CreateTime) values(' . $params['quoID'] . $params['DealerID'] . $params['OrganID'] . ',' . $time . ')';
         $count = Yii::app()->papdb->createCommand($insertsql)->execute();
     }
     return $res;
 }
Exemplo n.º 3
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));
     }
 }