Fee.aspx
上传用户:cha0314
上传日期:2014-03-02
资源大小:12522k
文件大小:13k
源码类别:

C#编程

开发平台:

C#

  1. <%@ Import namespace="System"%>
  2. <%@ Import namespace="System.Data"  %>
  3. <%@ Import namespace="System.Data.SqlClient"  %>
  4. <%@ Import namespace="UDS.Components"  %>
  5. <%@ Page language="c#" Codebehind="Fee.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.CM.Stat.Fee" %>
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  7. <HTML>
  8. <HEAD>
  9. <title>Fee</title>
  10. <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
  11. <meta content="C#" name="CODE_LANGUAGE">
  12. <meta content="JavaScript" name="vs_defaultClientScript">
  13. <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  14. <LINK href="../../../Css/BasicLayout.css" type="text/css" rel="stylesheet">
  15. <script language="JavaScript" src="../../../Css/meizzDate.js"></script>
  16. <script language="javascript">
  17. function fillstring(str)
  18. {
  19. if(str.length==1)
  20. {
  21. str = "0" + str; 
  22. }
  23. return(str);
  24. }
  25. function quickseldate(type)
  26. {
  27. var begintime,endtime;
  28. var oneminute = 60*1000;
  29. var onehour   = 60*oneminute;
  30. var oneday    = 24*onehour;
  31. var oneweek   = 7*oneday;
  32. var todayDate = new Date();
  33. var date = todayDate.getDate();
  34. var month= todayDate.getMonth() +1;
  35. var year= todayDate.getYear();
  36. var day = todayDate.getDay();
  37. if(navigator.appName == "Netscape")
  38. {
  39. year = 1900 + year;
  40. }
  41. //-->
  42. if(type=="day")
  43. {
  44. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  45. endtime = begintime;
  46. }
  47. else if(type=="week")
  48. {
  49. var daytoMon = day-1;
  50. if(day==0) 
  51. daytoMon = 6;
  52. todayDate.setTime(todayDate.getTime()-daytoMon*oneday);
  53. date = todayDate.getDate();
  54. month= todayDate.getMonth() +1;
  55. year= todayDate.getYear();
  56. day = todayDate.getDay();
  57. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  58. todayDate.setTime(todayDate.getTime()+6*oneday);
  59. date = todayDate.getDate();
  60. month= todayDate.getMonth() +1;
  61. year= todayDate.getYear();
  62. endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  63. }
  64. else if(type=="month")
  65. {
  66. var dateto1 = date-1;
  67. todayDate.setTime(todayDate.getTime()-dateto1*oneday);
  68. date = todayDate.getDate();
  69. month= todayDate.getMonth() +1;
  70. year= todayDate.getYear();
  71. day = todayDate.getDay();
  72. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  73. todayDate.setMonth(month);
  74. todayDate.setTime(todayDate.getTime()-oneday);
  75. date = todayDate.getDate();
  76. month= todayDate.getMonth() +1;
  77. year= todayDate.getYear();
  78. endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  79. }
  80. document.getElementById("tbx_begintime").value = begintime;
  81. document.getElementById("tbx_endtime").value = endtime;
  82. }
  83. </script>
  84. <script language="C#" runat="server">
  85. private string GetLinkMan(DataRow[] row)
  86. {
  87. if(row.Length!=0)
  88. {
  89. return(row[0]["Name"].ToString());
  90. }
  91. else
  92. return ("");
  93. }
  94. private string GetCurStatus(string curstatus)
  95. {
  96. switch(curstatus.Split(',')[0].ToString())
  97. {
  98. case "trace":
  99. return ("跟踪");
  100. break;
  101. case "boot":
  102. return ("启动");
  103. break;
  104. case "commend":
  105. return ("产品推荐");
  106. break;
  107. case "requirement":
  108. return ("需求定义");
  109. break;
  110. case "submit":
  111. return ("方案提交");
  112. break;
  113. case "negotiate":
  114. return ("商务谈判");
  115. break;
  116. case "actualize":
  117. return ("项目实施");
  118. break;
  119. case "traceservice":
  120. return ("跟踪服务");
  121. break;
  122. case "last":
  123. return ("收尾款");
  124. break;
  125. }
  126. return("");
  127. }
  128. private string GetAddMan(DataRow[] row)
  129. {
  130. if(row.Length!=0)
  131. {
  132. return(row[0]["realname"].ToString());
  133. }
  134. else
  135. return ("");
  136. }
  137. private int GetFee(DataRow[] row)
  138. {
  139. int fee = 0;
  140. if(row.Length!=0)
  141. {
  142. foreach(DataRow datarow in row)
  143. {
  144. fee += Int32.Parse(datarow["fee"].ToString());
  145. }
  146. totalfee += fee;
  147. return(fee);
  148. }
  149. else
  150. return(0);
  151. }
  152. private string GetTravel(int sellmanid,DateTime begintime,DateTime endtime)
  153. {
  154. UDS.Components.CM cm = new UDS.Components.CM();
  155. return(cm.GetTravelFeeBySellmanID(sellmanid,begintime,endtime).ToString());
  156. }
  157. private string GetFood(int sellmanid,DateTime begintime,DateTime endtime)
  158. {
  159. UDS.Components.CM cm = new UDS.Components.CM();
  160. return(cm.GetFoodFeeBySellmanID(sellmanid,begintime,endtime).ToString());
  161. }
  162. private string GetGift(int sellmanid,DateTime begintime,DateTime endtime)
  163. {
  164. UDS.Components.CM cm = new UDS.Components.CM();
  165. return(cm.GetGiftFeeBySellmanID(sellmanid,begintime,endtime).ToString());
  166. }
  167. private string GetOuter(int sellmanid,DateTime begintime,DateTime endtime)
  168. {
  169. UDS.Components.CM cm = new UDS.Components.CM();
  170. return(cm.GetOuterFeeBySellmanID(sellmanid,begintime,endtime).ToString());
  171. }
  172. private string GetContactTimes(int sellmanid,DateTime begintime,DateTime endtime)
  173. {
  174. UDS.Components.CM cm = new UDS.Components.CM();
  175. SqlDataReader dr = cm.GetContactBySellmanID(sellmanid,begintime,endtime);
  176. DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
  177. return(dt.Rows.Count.ToString());
  178. }
  179. private string GetContactedClient(int sellmanid,DateTime begintime,DateTime endtime)
  180. {
  181. UDS.Components.CM cm = new UDS.Components.CM();
  182. SqlDataReader dr = cm.GetContactedClientBySellmanID(sellmanid,begintime,endtime);
  183. DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
  184. return(dt.Rows.Count.ToString());
  185. }
  186. </script>
  187. </HEAD>
  188. <body MS_POSITIONING="GridLayout">
  189. <form id="Fee" method="post" runat="server">
  190. <FONT face="宋体">
  191. <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="1">
  192. <TR>
  193. <TD align="right"><asp:dropdownlist id="ddl_order" runat="server">
  194. <asp:ListItem Value="client">按客户发生费用总量排列</asp:ListItem>
  195. <asp:ListItem Value="sellman">按销售人员费用总量排列</asp:ListItem>
  196. </asp:dropdownlist></TD>
  197. </TR>
  198. <TR>
  199. <TD>开始时间
  200. <asp:textbox id="tbx_begintime" onfocus="setday(this);" runat="server" ReadOnly="True"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" ErrorMessage="*" Display="Dynamic" ControlToValidate="tbx_begintime"></asp:requiredfieldvalidator>结束时间
  201. <asp:textbox id="tbx_endtime" onfocus="setday(this);" runat="server" ReadOnly="True"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="tbx_endtime"></asp:requiredfieldvalidator><asp:radiobutton id="rbtn_thisweek" onclick="quickseldate('week');" runat="server" GroupName="quickselect"
  202. Text="本周"></asp:radiobutton><asp:radiobutton id="rbtn_thismonth" onclick="quickseldate('month');" runat="server" GroupName="quickselect"
  203. Text="本月"></asp:radiobutton><asp:button id="btn_OK" runat="server" Text="确定"></asp:button></TD>
  204. </TR>
  205. <TR>
  206. <TD>共
  207. <asp:literal id="ltl_Client" runat="server"></asp:literal>位客户,共发生费用
  208. <asp:literal id="ltl_Fee" runat="server"></asp:literal>元</TD>
  209. </TR>
  210. <TR>
  211. <TD><asp:datagrid id="dgrd_clientfee" runat="server" AllowPaging="True" AutoGenerateColumns="False"
  212. Width="100%" CellPadding="3" BorderWidth="1px" BorderColor="#93BEE2">
  213. <AlternatingItemStyle BackColor="#E8F4FF"></AlternatingItemStyle>
  214. <ItemStyle Font-Size="X-Small"></ItemStyle>
  215. <HeaderStyle ForeColor="White" BackColor="#337FB2"></HeaderStyle>
  216. <Columns>
  217. <asp:BoundColumn DataField="ID" SortExpression="ID" HeaderText="编号"></asp:BoundColumn>
  218. <asp:TemplateColumn SortExpression="NAME" HeaderText="客户名称">
  219. <ItemTemplate>
  220. <asp:HyperLink id=Hyperlink1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>' Target="_blank" NavigateUrl='<%# "../Client.aspx?ClientID="+DataBinder.Eval(Container,"DataItem.ID")%>'>
  221. </asp:HyperLink>
  222. </ItemTemplate>
  223. </asp:TemplateColumn>
  224. <asp:TemplateColumn HeaderText="联系人">
  225. <ItemTemplate>
  226. <A>
  227. <%# GetLinkMan(((DataRowView)Container.DataItem).Row.GetChildRows("ClientLinkman_Staff")) %>
  228. </A>
  229. </ItemTemplate>
  230. </asp:TemplateColumn>
  231. <asp:TemplateColumn HeaderText="接触次数">
  232. <ItemTemplate>
  233. <asp:Label runat="server" Text='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("Client_Contact").Length %>'>
  234. </asp:Label>
  235. </ItemTemplate>
  236. </asp:TemplateColumn>
  237. <asp:TemplateColumn HeaderText="发生费用">
  238. <ItemTemplate>
  239. <asp:Label runat="server" Text='<%# GetFee(((DataRowView)Container.DataItem).Row.GetChildRows("Client_Contact")).ToString() %>'>
  240. </asp:Label>
  241. </ItemTemplate>
  242. </asp:TemplateColumn>
  243. <asp:TemplateColumn HeaderText="接触状态">
  244. <ItemTemplate>
  245. <asp:HyperLink id=Hyperlink3 runat="server" Target=_blank Text='<%# GetCurStatus(DataBinder.Eval(Container,"DataItem.Curstatus").ToString()) %>' NavigateUrl='<%# "../ClientContact.aspx?ClientID="+DataBinder.Eval(Container,"DataItem.ID")%>' NAME="Hyperlink2">
  246. </asp:HyperLink>
  247. </ItemTemplate>
  248. </asp:TemplateColumn>
  249. <asp:TemplateColumn HeaderText="添加人">
  250. <ItemTemplate>
  251. <asp:Label runat="server" Text='<%# GetAddMan(((DataRowView)Container.DataItem).Row.GetChildRows("ClientAddMan_Staff")) %>' ID="Label1">
  252. </asp:Label>
  253. </ItemTemplate>
  254. </asp:TemplateColumn>
  255. </Columns>
  256. <PagerStyle NextPageText="上一页" HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
  257. </asp:datagrid><asp:datagrid id="dgrd_sellmanfee" runat="server" AllowPaging="True" AutoGenerateColumns="False"
  258. Width="100%" Visible="False" CellPadding="3" BorderWidth="1px" BorderColor="#93BEE2">
  259. <AlternatingItemStyle BackColor="#E8F4FF"></AlternatingItemStyle>
  260. <ItemStyle Font-Size="X-Small"></ItemStyle>
  261. <HeaderStyle ForeColor="White" BackColor="#337FB2"></HeaderStyle>
  262. <Columns>
  263. <asp:TemplateColumn HeaderText="销售人员">
  264. <ItemTemplate>
  265. <%# ((DataRowView)Container.DataItem).Row.GetChildRows("StaffID_RealName")[0]["realname"].ToString() %>
  266. </ItemTemplate>
  267. </asp:TemplateColumn>
  268. <asp:TemplateColumn HeaderText="发生费用">
  269. <ItemTemplate>
  270. <%# ((DataRowView)Container.DataItem)["Fee"].ToString()%>
  271. </ItemTemplate>
  272. </asp:TemplateColumn>
  273. <asp:TemplateColumn HeaderText="差旅">
  274. <ItemTemplate>
  275. <%#  GetTravel(Int32.Parse(((DataRowView)Container.DataItem)["sellmanid"].ToString()),begintime,endtime)%>
  276. </ItemTemplate>
  277. </asp:TemplateColumn>
  278. <asp:TemplateColumn HeaderText="餐饮">
  279. <ItemTemplate>
  280. <%#  GetFood(Int32.Parse(((DataRowView)Container.DataItem)["sellmanid"].ToString()),begintime,endtime)%>
  281. </ItemTemplate>
  282. </asp:TemplateColumn>
  283. <asp:TemplateColumn HeaderText="礼品">
  284. <ItemTemplate>
  285. <%#  GetGift(Int32.Parse(((DataRowView)Container.DataItem)["sellmanid"].ToString()),begintime,endtime)%>
  286. </ItemTemplate>
  287. </asp:TemplateColumn>
  288. <asp:TemplateColumn HeaderText="公关">
  289. <ItemTemplate>
  290. <%#  GetOuter(Int32.Parse(((DataRowView)Container.DataItem)["sellmanid"].ToString()),begintime,endtime)%>
  291. </ItemTemplate>
  292. </asp:TemplateColumn>
  293. <asp:TemplateColumn HeaderText="接触次数">
  294. <ItemTemplate>
  295. <%#  GetContactTimes(Int32.Parse(((DataRowView)Container.DataItem)["sellmanid"].ToString()),begintime,endtime)%>
  296. </ItemTemplate>
  297. </asp:TemplateColumn>
  298. <asp:TemplateColumn HeaderText="接触客户数量">
  299. <ItemTemplate>
  300. <%#  GetContactedClient(Int32.Parse(((DataRowView)Container.DataItem)["sellmanid"].ToString()),begintime,endtime)%>
  301. </ItemTemplate>
  302. </asp:TemplateColumn>
  303. </Columns>
  304. <PagerStyle Mode="NumericPages" HorizontalAlign="Right"></PagerStyle>
  305. </asp:datagrid></TD>
  306. </TR>
  307. <TR>
  308. <TD align="center">&nbsp;</TD>
  309. </TR>
  310. </TABLE>
  311. </FONT>
  312. </form>
  313. </body>
  314. </HTML>