示例#1
0
文件: Goods.php 项目: zwq/unpei
 /**
  * 商品编号接口
  */
 public static function GetGoodsByGoodsNo($goodsno, $manufacturer_ID)
 {
     try {
         //$userID=Yii::app()->user->id;
         //$dealerID=Dealer::model()->find('userID=:userID',array(':userID'=>$userID));
         //$grade=MakeEmpowerDealer::model()->find('up_userID=:up_userID and dealer_id=:dealer_id',array(':up_userID'=>$manufacturer_ID,':dealer_id'=>$dealerID->id));
         //	  $sql=" select distinct a.id as goodsID,a.oe as OE, a.brand as brand ,a.NewVersion as verion_name,b.goodsno as goodsno,b.name as goodsname,b.price as makretprice,"
         //		."b.price".$grade->grade." as goodsprice,"
         //		." (select f.code  from tbl_parts_level f where b.parts_level=f.id) as parts_level,"
         //		." (select e.cp_name from tbl_goods_standard e where e.id=d.standard_id) as cp_name,"
         //		." (select c.name from tbl_goods_category c where c.id=a.category_id and a.manufacturer_id=c.manufacturer_id) as category"
         //		//." (select n.car from tbl_goods_vehicle m,tbl_vehicle n where m.Goods_ID='$goodsID' and n.VehicleID in (m.VehicleID)) as car"
         //		."  from tbl_goods a ,tbl_goods_version b,tbl_goods_template d,tbl_vehicle n"
         //		.'  where a.id=b.goods_id and a.NewVersion=b.version_name'
         //		."  and b.templet_id=d.id"
         //		."  and a.manufacturer_id=b.manufacturer_id"
         //		."  and a.ISdelete='N' and a.IsSale='Y'  "
         //		."  and a.manufacturer_id=$manufacturer_ID "
         //		."  and a.id=$goodsID"
         //		."  group by a.id order by a.id desc";
         //$sql=" select distinct a.id as goodsID ,a.oe as OE,a.brand as brand,a.NewVersion as verion_name,b.goodsno as goodsno,b.name as goodsname,b.price as marketprice,"
         //		."b.price".$grade->grade." as goodsprice,"
         //		." (select distinct f.code  from tbl_parts_level f where b.parts_level=f.id) as parts_level,"
         //		." (select distinct e.cp_name from tbl_goods_standard e where e.id=d.standard_id) as cp_name,"
         //		." (select distinct c.name from tbl_goods_category c where c.id=a.category_id and a.manufacturer_id=c.manufacturer_id) as category"
         //		."  from tbl_goods a ,tbl_goods_version b,tbl_goods_category c,tbl_goods_template d,tbl_goods_standard e,tbl_parts_level f,tbl_goods_values g"
         //		.'  where a.id=b.goods_id and a.NewVersion=b.version_name'
         //		."  and b.parts_level=f.id"
         //		."  and b.templet_id=d.id"
         //		."  and e.id=d.standard_id"
         //		."  and a.category_id=c.id"
         //		."  and b.values_id = g.id"
         //		."  and a.manufacturer_id=b.manufacturer_id"
         //		."  and a.ISdelete='N' and a.IsSale='Y'"
         //		."  and a.manufacturer_id='$manufacturer_ID' ";
         //		$sql.="  and b.goodsno='{$goodsno}'";
         //		$sql.="  group by a.id order by a.id desc";
         //授权品牌
         $organID = Commonmodel::getOrganID();
         $brands = MakePromitBrand::model()->find('DealerID=' . $organID . ' and OrganID=' . $manufacturer_ID);
         $sql2 = "select distinct a.id as goodsID ,b.goods_category as category_id,b.goods_oe as OE,b.goods_brand as brand,b.organID,\n                \t\t \t    a.NewVersion as verion_name,b.goods_no as goodsno,b.goods_name as goodsname,\n                                b.benchmarking_brand,b.benchmarking_sn,a.create_time,d.Price," . " b.inventory as inventory,b.senddays,b.description,a.IsSale,b.standard_id" . " from  tbl_make_goods a ,tbl_make_goods_version b ,tbl_make_goods_vehicle c,tbl_make_price_relation d" . '  where a.id=b.goods_id and a.NewVersion=b.version_name' . "  and a.ISdelete='0' and b.ISdelete=0" . "  and a.organID='{$manufacturer_ID}' and b.goods_no='{$goodsno}'";
         $identity = Commonmodel::getIdentity(Yii::app()->user->id);
         if ($identity['identity'] == 2 && $brands['CustomerType']) {
             $sql2 .= " and d.TypeID= {$brands['CustomerType']} and d.GoodsID=a.id and d.Price is not null and a.IsSale=0";
         }
         $result = Yii::app()->db->createCommand($sql2)->queryRow();
         if ($result) {
             //查询品牌名称
             $brandmodel = MakeGoodsBrand::model()->findByPK($result['brand']);
             $result['brand'] = $brandmodel['BrandName'];
             //商品销售价
             if ($result['Price']) {
                 $result['goodsprice'] = $result['Price'];
             }
             //$result['goodsprice']=sprintf("%.2f", $result['salesprice'] * $ratio / 100);
         }
         return $result;
     } catch (CDbException $e) {
         throw CDbException($e);
     }
 }
示例#2
0
文件: DealerGoods.php 项目: zwq/unpei
 public static function getContactprice($dealerID, $seriveID)
 {
     $criteria = new CDbCriteria();
     $criteria->select = "cooperationtype";
     $OrganID = Commonmodel::getOrganID();
     $Identity = Commonmodel::getIdentity($OrganID);
     //判断当前登录用户角色类别(修理厂/经销商)
     if ($Identity['identity'] == 3) {
         //修理厂角色登录
         $criteria->addCondition("t.user_id = {$dealerID}", "AND");
         //经销商ID
         $criteria->addCondition("t.contact_user_id = {$OrganID}", "AND");
         //当前登录的修理厂ID
         $criteria->addCondition("t.Status=0", 'AND');
     } elseif ($Identity['identity'] == 2) {
         //经销商角色登录
         $criteria->addCondition("t.user_id = {$OrganID}", "AND");
         //当前登录的经销商ID
         //  $criteria->addCondition("t.contact_user_id =$seriveID", "AND");
         $criteria->addCondition("t.contact_user_id = :seriveID", 'AND');
         $criteria->addCondition("t.Status=0", 'AND');
         $criteria->params[':seriveID'] = $seriveID;
         //修理厂ID(询价对象ID)
     }
     $contact = BusinessContacts::model()->find($criteria);
     if ($contact) {
         $model = PriceManage::model()->find(array("condition" => "OrganID = {$dealerID} AND CooperationType = '{$contact['cooperationtype']}'"));
     }
     return $model;
 }
示例#3
0
文件: index.php 项目: zwq/unpei
        //                        }
        //                    }
        //                });
        //            }
        //        });
		
    })
</script>
<script>
    $(function(){
        //alert(Yii_theme_baseUrl);
       <?php 
$organID = Commonmodel::getOrganID();
?>
        <?php 
$identity = Commonmodel::getIdentity($organID);
?>
        var fileClass =  <?php 
echo Commonmodel::getOrganID();
?>
;
        var identity=<?php 
echo $identity['identity'];
?>
;
        $("#file_upload").uploadify({
            'auto'	: true,
            'queueId'	: 'some_file+queue',
            'swf'	: Yii_theme_baseUrl + '/js/uploadify/uploadify.swf',
          //  'uploader'	: Yii_baseUrl + '/dealer/marketing/uploadify2',
            'uploader'	: Yii_baseUrl + '/upload/uploadify',