备份:DpMap一期修改

来源:互联网 发布:mac 应用快捷键 编辑:程序博客网 时间:2024/05/17 07:16

备份:DpMap一期修改

 

sendRequest.js

  1. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. /////ShopProductSales.aspx  modify by elifefly 2008.8.21
  3. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4.   
  5. function ReqShopProductSales() 
  6. {
  7.   var s = "storename=" + $("storename").value            //门店名称
  8.           + "&retailername=" + $("retailername").value   //隶属连锁商
  9.           + "&starttime=" + $("sBegin_sBegin").value     //上报时间 起   //sBegin_sBegin对应页面中cBegin这个标签
  10.           + "&endtime=" + $("sEnd_sEnd").value           //上报日期 止   //sEnd_sEnd对应页面中sEnd这个标签
  11.           + "&corpid=" + $("CorpId").value;              //企业ID,CorpId    /////CorpId add by elifefly 2008.9.7//////// 
  12.    
  13.   var url = "./shopProductSales.ashx?" + s; 
  14.   
  15.   url = encodeURI(url);///////////////////////对url中文参数处理/////// add by elifefly 2008.8.22/////////////
  16.   
  17.   
  18.   xhrSendRequest.open("post",url,false);   
  19.   xhrSendRequest.setRequestHeader("Content-Length",url.length); 
  20.   xhrSendRequest.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
  21.   xhrSendRequest.onreadystatechange = showShopProductSalesGeoPoints;   //调用showShopProductSalesGeoPoints()
  22.   xhrSendRequest.send();
  23. }
  24. function showShopProductSalesGeoPoints() //在地图上显示从服务端返回的地理数据
  25.    if (xhrSendRequest.readyState==4 || xhrSendRequest.readyState=="complete")
  26.     { 
  27.         
  28.          
  29.     var points = [];
  30.     var items = null;
  31.     
  32.     try
  33.     {
  34.      items = eval("(" + xhrSendRequest.responseText + ")");
  35.     }
  36.     catch(ex)
  37.     {  
  38.         alert("没有你要找的门店!");
  39.         
  40.     }
  41.     
  42.     
  43.     var marker = null;//标注点符号
  44.     var point = null;//地理点
  45.     
  46.     var storename = null;//标注点名称
  47.     var salescount = null;//产品销量
  48.     var avgprice = null;
  49.     var sumprice = null;
  50.     
  51.     
  52.     
  53.     
  54.     if(!items) return;
  55.     
  56.     map.clearOverLays();
  57.     
  58.     for   (i=0;   i<(items.length);   i++)
  59.     {
  60.     var node = items[i];
  61.     
  62.     if(!node) continue;
  63.    
  64.     point = new LTPoint(parseInt(node.Longitude),parseInt(node.Latitude));//根据读取的经度和纬度创建一个地理点坐标--标注点
  65.   
  66.     points.push(point);  //入栈,把标注点装入points = []数组,因为标注点有多个
  67.     
  68.     
  69.      ////////////////////////获取节点 add by elifefly 2008.8.21///////////////////////////////////////
  70.     
  71.     storename = node.storeName;   //获取节点
  72.     salescount = node.sumDistrib;
  73.     avgprice = node.avgPrice;
  74.     sumprice = node.sumPrice;
  75.     ////////////////////////获取节点 add by elifefly 2008.8.21///////////////////////////////////////
  76.     
  77.     
  78.     //设置点的样式,高,宽
  79.     var ptIcon = new LTIcon();
  80.     ptIcon.setWidth( 32 );
  81.     ptIcon.setHeight( 32 );
  82.     
  83.   
  84.     
  85.     marker = new LTMarker(point,ptIcon);  //标注点根据标注点图标的大小选择性的显示出来,避免标注点过于密集
  86.     ptIcon.setImageUrl( "./icons/s/red.gif" ); /////设置默认门店标注点图标/////// add by elifefly 2008.8.21/////////////
  87.    
  88.     var text = new LTMapText( marker );  //创建一个文本标注对象,该对象显示在指定的地理位置或标注处
  89.     
  90.      
  91.      if($("checkNumInfo").checked == true)
  92.     {
  93.     
  94.         text.setLabel( "<div style=background:#809FFF;><span style=font-size:14px; font-color:#FFFFFF;><strong>" + storename + "</strong></span><br/><span style=font-size:12px; font-color:#FFFFFF;>产品销量:" + salescount +" 平均单价:"+ avgprice +" 零售总额:"+ sumprice +"</span><br/></div>"); 
  95.    
  96.         map.addOverLay( text );  //指定的座标出显示文本,对地图进行拖放等操作,文本将始终保持在该坐标处
  97.         
  98.     }
  99.     
  100.      map.addOverLay(marker);  //在标记的图标上显示一个信息浮窗,该信息浮窗箭头指向该标记; 
  101.      
  102.     }
  103.     
  104.     var c = new LTSmallMapControl();  //显示地图最小工具栏
  105.     map.addControl(c);
  106.     
  107.     map.setCenterAtLatLng(point);  //将地图的中心点直接变换到指定的地理坐标,不执行滑动过程
  108.     //map.zoomTo(9);                 //将视图切换到指定的缩放等级9,中心点坐标不变   
  109.     map.getBestMap(points);    //////////////////////////地图会自动的选择最佳视图(缩放等级和中心点坐标),以显示数组之中的所有点
  110.     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  111.     }
  112.     }

shopProductSales.js

  1. ////////shopProductSales.js add by elifefly 2008.8.22////////////////////////////
  2. /////////shopProductSales.js 用于ShopProductSales.aspx页面地图初始化所有门店标注点////////////////////////////
  3. var map;//地图对象
  4. var editMark;//当前正在编辑的标注
  5. var defaultCenter = new LTPoint(10671030,3310736);//默认的地图中心
  6. var defalutMapLevel = 13; //默认的地图级别
  7. var markCollection;
  8. var markOper;
  9. var currentTool;
  10. var defaultTool;
  11. var markerTool;
  12. var iconsWin;
  13. //地图初始化
  14. function onLoad()
  15. {
  16.     map = new LTMaps("mapDiv");      //////mapDiv是页面标签/////LTMaps("mapDiv")函数使用指定的mapDiv层创建一个地图对象
  17.     map.centerAndZoom(defaultCenter,defalutMapLevel);    /////创建默认地图,使用默认的中心位置的经纬度和“缩放级别”
  18.     map.addControl(new LTStandMapControl());   ////为地图添加标准导航控件 
  19.     
  20.     
  21.     ////////////////////////////////生成标记管理类 LTMarkerCollection(map) add by elifefly 2008.8.16////////////////////////////
  22.     //markCollection =new LTMarkerCollection(map);/////////////////////////////////////////////////////////////////////////////
  23.     //markOper = new MarkerOper(map);/////////////////////////////////////////////////////////////////////////////
  24.     
  25.     map.handleKeyboard();//启用键盘
  26.     map.handleMouseScroll();//启用鼠标滚轮功能支持,参数true代表使用鼠标指向点位置不变模式
  27.     
  28.     initTools();  //////初始化工具栏
  29.     initMarkerOper();
  30.     ///////////////////////initIcons()函数有问题,待改进
  31.     ///initIcons();///////绑定各种彩色标注图标//////////////////////////////////////////////////////////////////////
  32.     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33.     initMapDivSize();      ////加载地图的层大小值
  34.     
  35.    
  36.     
  37.     ////////// RequestAllStoreMark() add by elifefly 2008.8.22//////////////////////////////////////////////////////////////////////////////////////
  38.     //////////////加载所有已经标注的门店标注点/////////////
  39.   //  RequestAllStoreMark();
  40.   
  41.    
  42.    
  43.     
  44. }   
  45. //地图的层大小
  46. function initMapDivSize()
  47. {
  48.     document.getElementById("mapDiv").style.height  = window.screen.availHeight * 0.75;
  49.     
  50. }
  51. //获取下拉框中的选择值
  52. function getSelectedValue(id)
  53. {
  54.     var selectControl = $(id);
  55.     return selectControl.options(selectControl.selectedIndex).innerHTML;
  56. }
  57. //根据id获取要素
  58. function $(id)
  59. {
  60.     return document.getElementById(id);
  61. }
  62. function CreateXMLDom()
  63. {
  64.     if(window.ActiveXObject)
  65.     {
  66.         var arrSignatures = ["MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0",
  67.                              "MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","Microsoft.XMLDom"];
  68.                              
  69.         for (var i = 0; i < arrSignatures.length;i++)
  70.         {
  71.             try
  72.             {
  73.                 var oXmlDom = new ActiveXObject(arrSignatures[i]);
  74.                 return oXmlDom;
  75.             }
  76.             catch(oError){}
  77.         }
  78.         
  79.         throw new Error("MSXML is not installed on your system");
  80.       }
  81.       else if(document.implementation && document.implementation.cereateDocument)
  82.       {
  83.         var oXmlDom = document.implementation.createDocument("","",null);
  84.         return oXmlDom;
  85.       }
  86.       else
  87.       {
  88.         throw new Error("Your browser doesn't support an XML DOM object");
  89.       }   
  90.       
  91.  }
  92. function RequestAllStoreMark() //显示所有标注点
  93. {
  94. //////////////////////var s 无条件查询/////// add by elifefly 2008.8.22/////////////
  95.   var s = "storename="         //门店名称
  96.           + "&retailername="   //隶属连锁商
  97.           + "&starttime="      //上报时间 起   //sBegin_sBegin对应页面中cBegin这个标签
  98.           + "&endtime="        //上报日期 止   //sEnd_sEnd对应页面中sEnd这个标签
  99.   
  100.   var url = "./shopProductSales.ashx?" + s; 
  101.   
  102.   url = encodeURI(url);///////////////////////对url中文参数处理/////// add by elifefly 2008.8.22/////////////
  103.   
  104.   xhrSendRequest.open("post",url,false);   
  105.   xhrSendRequest.setRequestHeader("Content-Length",url.length); 
  106.   xhrSendRequest.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
  107.   xhrSendRequest.onreadystatechange = showShopProductSalesGeoPoints;   //调用showShopProductSalesGeoPoints()
  108.   xhrSendRequest.send();
  109.   
  110. }

shopProductSales.ashx

  1. <%@ WebHandler Language="C#" Class="shopProductSales" %>
  2. using System;
  3. using System.Web;
  4. using System.Data;
  5. /// <summary>
  6. /// 右侧查询条件
  7. /// </summary>
  8. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. /////ShopProductSales.aspx门店-产品销售的查询
  10. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  11. public class shopProductSales : IHttpHandler {
  12.     
  13.     public void ProcessRequest (HttpContext context) 
  14.     {
  15.         context.Response.ContentType = "text/plain";
  16.   
  17.         
  18.         string storeName = context.Request.QueryString["storename"];           //门店名称
  19.         string retailerName = context.Request.QueryString["retailername"];     //隶属连锁商
  20.         string startTime = context.Request.QueryString["starttime"];           //上报时间 起
  21.         string endTime = context.Request.QueryString["endtime"];               //上报日期 止
  22.         string corpId = context.Request.QueryString["corpid"];                 //企业ID,CorpId    /////CorpId add by elifefly 2008.9.7//////// 
  23.         string result = this.GetshopProductSales(storeName, retailerName, startTime, endTime, corpId); //调用GetshopProductSales
  24.        
  25.         
  26.         context.Response.Clear();  //清空服务器端为此会话开辟的输出缓存
  27.         context.Response.Write(result);//将结果写入到服务器端为此会话开辟的输出缓存中
  28.        
  29.         context.Response.Flush();
  30.         context.Response.Close();//将服务器端为此会话开辟的输出缓存中的信息传送到客户端
  31.     }
  32.     private string GetshopProductSales(string storeName, string retailerName, string startTime, string endTime, string corpId)
  33.     {
  34.         ////////start////////判断参数是否为空,如果为空,则相应的条件置空///////add by elifefly 2008.8.21/////////////
  35.         string storenamesql = " ";
  36.         string retailernamesql = " ";
  37.         string starttimesql = " ";
  38.         string endtimesql = " ";
  39.         //storenamesql 门店名称
  40.         if (storeName !=string.Empty)
  41.         {
  42.             storenamesql = " StoreName like '%" + storeName + "%' and";
  43.            
  44.         }
  45.         // retailernamesql 隶属连锁商
  46.         if (retailerName !=string.Empty)
  47.         {
  48.             retailernamesql = " RetailerName like '%" + retailerName + "%' and";
  49.         }
  50.         //starttimesql 上报时间 起
  51.         if (startTime != string.Empty)
  52.         {
  53.             starttimesql = " convert(varchar(10),RecvTime,120) >='" + startTime + "' and";
  54.         }
  55.         //endtimesql 上报日期 止
  56.         if (endTime !=string.Empty)
  57.         {
  58.             endtimesql = " convert(varchar(10),recvtime,120)<'" + endTime + "' and";
  59.         }
  60.         ////////end////////判断参数是否为空,如果为空,则相应的条件置空///////add by elifefly 2008.8.21/////////////
  61.         string sql = "select distinct StoreName, Longitude ,Latitude, sum(Distribution) as sumDistrib, convert(numeric(15,2),isnull(sum(Price*Distribution)/sum(Distribution),0)) as avgPrice,isnull(sum(Price*Distribution),0) as sumPrice"
  62.                      + " from V_Map  where"
  63.                      + starttimesql       // + " convert(varchar(10),RecvTime,120)>='2008-08-18'"    
  64.                      + endtimesql         //+ " and convert(varchar(10),recvtime,120) < '2008-08-19'"
  65.                      + storenamesql       // + " and StoreName like '%广州%'"
  66.                      + retailernamesql    //+ " and RetailerName like '%gome%'"
  67.                      + " Longitude is not null and Latitude is not null"
  68.                      + " and CorpId ='" + corpId + "' "                  //////企业Id add by elifefly 2008.9.7//////
  69.                      + " group by StoreName,Longitude,Latitude ";
  70.         System.Data.DataTable dtResult = Utils.Instance.GetDataFromSqlServerr(sql);
  71.      
  72.         
  73.         string result = "[";
  74.         
  75.         foreach(System.Data.DataRow dr in dtResult.Rows)
  76.         {
  77.             result += "{";
  78.             result += string.Format("storeName:'{0}',Longitude:'{1}',Latitude:'{2}',sumDistrib:'{3}',avgPrice:'{4}',sumPrice:'{5}'", dr["StoreName"].ToString(), dr["Longitude"].ToString(), dr["Latitude"].ToString(), dr["sumDistrib"].ToString(), dr["avgPrice"].ToString(), dr["sumPrice"].ToString());
  79.     
  80.             result += "},";
  81.             
  82.             
  83.         }
  84.         
  85.         if (result.Length > 1)
  86.         {
  87.             result = result.Remove(result.Length - 1);
  88.         }
  89.         result += "]";
  90.         /////////start//////如果result返回结果为空,则不返回任何值///////////add by elifefly 2008.8.22/////
  91.         if (result == "[]")
  92.         {
  93.             return "";
  94.         }
  95.         else
  96.         {
  97.             return result;
  98.         }
  99.         ////////end///////如果result返回结果为空,则不返回任何值///////////add by elifefly 2008.8.22/////
  100.        
  101.     }
  102.     public bool IsReusable
  103.     {
  104.         get
  105.         {
  106.             return false;
  107.         }
  108.     }
  109. }

ShopProductSales.aspx

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShopProductSales.aspx.cs" Inherits="Webroot_DPCS_51ditu_ProductSales" %>
  2. <%@ Register TagPrefix="cc1" Namespace="Myvas.Web.UI.WebControls" Assembly="Myvas.Web.UI.WebControls" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head id="Head1" runat="server">
  6.     <title>门  店 - 产品销售</title>
  7. <link rel="stylesheet" type="text/css" href="StyleSheet.css" />
  8.     <script language="javascript" src="http://api.51ditu.com/js/maps.js" type="text/jscript"></script>
  9.     <script language="javascript" src="http://api.51ditu.com/js/ajax.js" type="text/jscript"></script>   
  10.     <script language="javascript" src="./js/tools.js" type="text/jscript"></script>
  11.    <script language="javascript" src="./js/shopProductSales.js" type="text/jscript"></script>
  12.    <script language="javascript" src="./js/postdata.js" type="text/jscript"></script>
  13.     <script language="javascript" src="./js/marker.js" type="text/jscript"></script>
  14.     <script language="javascript" src="./js/getdata.js" type="text/jscript"></script>
  15.     <script language="javascript" src="./js/business.js" type="text/jscript"></script>
  16.     <script language="javascript" src="./js/sendRequest.js" type="text/jscript"></script>
  17. </head>
  18. <body onload="onLoad()">
  19.     <form id="form1" runat="server">
  20.     <div>
  21.    <div class="headInfo" style="left: 0px; top: 0px"><div class="MapName">门  店 - 产品销售</div><div class="helpTitle" style="width:auto;"><a href="#">帮 助</a></div></div>
  22.     <div id="toolsDiv" class="Tools" ></div>       
  23.      <div id="bzDiv" class="selSection">
  24.      <div class="rightSelectionHead" ><div class="SelectionTitle">查询条件</div></div>
  25.      <div class="bzContont" style="left: 2px; top: 0px; width:194px; height:520px;">    <br /> 
  26.      <span style="margin-left:10px; font-family:黑体; font-size:14px; color:#7B8DBD; margin-top:10px;">门店选择</span>
  27.      <table style="margin-top:5px; margin-left:20px;"><tr><td>
  28.      <span style="font-size:14px;">门店名称 </span><input id="storename" name="storename" size="12" style="margin-left:11px;" /></td></tr>
  29.      <tr><td style="height: 42px"><span style="font-size:14px;">隶属连锁商 </span><input id="retailername" name="retailername" size="12" style="margin-left:11px;" /></td>
  30.      </tr>
  31.      </table>
  32.      <br/>
  33.          <span style="margin-left:10px; font-family:黑体; font-size:14px; color:#7B8DBD; margin-top:10px;">数据时间范围<br />
  34.          </span> <table style="margin-top: 30px; margin-left: 20px">
  35.              <tr>
  36.                  <td style="width: 116px">
  37.                      <div class="dateTitle">
  38.                          上报时间 起</div>
  39.                  </td>
  40.              </tr>
  41.              <tr>
  42.                  <td style="width: 116px; height: 12px">
  43.                      <cc1:DateTimeSelector ID="sBegin" runat="server" DateStyle="yyyy-MM-dd" SitePath="../../DateTimeSelector/"
  44.                          Width="127px" />
  45.           <div class="dateTitle">上报日期 止</div><cc1:DateTimeSelector ID="sEnd" runat="server" DateStyle="yyyy-MM-dd" SitePath="../../DateTimeSelector/"
  46.              Width="129px" />
  47.                  </td>
  48.              </tr>
  49.          </table>
  50.          <br />
  51.           <div class="inputTitle"><input type="checkbox" id="checkNumInfo" name="checkNumInfo" tabindex="0" value="on"  onclick="ReqShopProductSales()" />  出现数据框</div>
  52.          <div id="btnQuery" style="margin-top:30px; margin-left:70px;">
  53.          <input id="btnViewPOI" type="button" value="查  询" onclick="ReqShopProductSales()" /></div>
  54.    </div><asp:HiddenField ID="CorpId" runat="server" /><!-- CorpId add by elifefly 2008.9.7 -->
  55.    </div>
  56.    <div id="mapDiv" class="map"></div>
  57.      </div>
  58. </form>
  59. </body>
  60. </html>

ShopProductSales.aspx.cs

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class Webroot_DPCS_51ditu_ProductSales : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.         if (!IsPostBack)  //为上报时间 起---添加默认日期(昨天日期)
  16.         {
  17.             this.sBegin.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
  18.             this.sEnd.Text = DateTime.Now.ToString("yyy-MM-dd");
  19.             this.CorpId.Value = Session["CorpId"].ToString();  /////CorpId add by elifefly 2008.9.7////////
  20.         }
  21.         
  22.        
  23.     }
  24. }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 唯品金融没还款怎么办 金点原子锁打不开了怎么办 87彩店注册不了怎么办 微店如果不退款怎么办 微信上微商被骗怎么办 微商代理不做了怎么办 微店拒收不退款怎么办 在微商买东西被骗怎么办 云集买家买东西不退款怎么办 微信红包密码忘记了怎么办 微信购物不退货怎么办 微信隐私设置无法添加怎么办 微信支付被限额怎么办 微信发现没有购物怎么办 微信转账钱被骗怎么办 玩连环夺宝输了好多钱怎么办 厘米秀换不了装怎么办 社保只缴纳两年怎么办 502盖子粘到手上怎么办 口红粘在盖子上怎么办 玫瑰手杖永久错过了怎么办 手指沾到502胶水怎么办 我退款了货到了怎么办 世纪天成账号被盗什么也没绑怎么办 韩国电话卡不想用怎么办2018 汽车没有年检交警抓到怎么办 ios软件未受信任怎么办 淘宝开店被管理了怎么办 微店网络异常025怎么办 商家给买家返款转错了怎么办 淘宝号限制下单怎么办 淘宝退货单号填错了怎么办 淘宝买家申请退款不退货怎么办 不支持7天无理由怎么办 淘宝上不给退货怎么办 网购衣服买小了怎么办 淘宝上全球购买到假货怎么办 京东全球购税费怎么办 代购被海关税了怎么办 网上买猫被骗了怎么办 苏宁账号被冻结怎么办