ChargeDetailEq.aspx
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:17k
源码类别:

.net编程

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChargeDetailEq.aspx.cs" EnableEventValidation="false"  Inherits="Workflow_ChargeDetailEq" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5. <link href="style/gridStyle.css" rel="stylesheet" type="text/css" />
  6. <base target="_self" />
  7.     <title>设备费用</title>
  8.        <script type="text/javascript">
  9.           //jb函数会根据不同的浏览器初始化个xmlhttp对象
  10.           function jb()
  11.           {
  12.              var A=null; 
  13.                 try 
  14.                 { 
  15.                     A=new ActiveXObject("Msxml2.XMLHTTP"); 
  16.                  } 
  17.              catch(e)
  18.              { 
  19.                    try 
  20.                     { 
  21.                        A=new ActiveXObject("Microsoft.XMLHTTP"); 
  22.                     }
  23.               catch(oc)
  24.              { 
  25.                       A=null 
  26.                     } 
  27.                } 
  28.             if ( !A && typeof XMLHttpRequest != "undefined" ) 
  29.              { 
  30.                 A=new XMLHttpRequest() 
  31.               } 
  32.             return A 
  33.           }
  34.          
  35.           //下面Go函数是父列表框改变的时候调用,参数是选择的条目
  36.           function Go(obj)
  37.           {
  38.              //得到选择框的下拉列表的value
  39.             var svalue = obj.value;
  40.              //定义要处理数据的页面
  41.              var weburl = "ChargeDetailEqAdd.aspx?parent_id="+svalue;
  42.              //初始化个xmlhttp对象
  43.              var xmlhttp = jb();
  44.              //提交数据,第一个参数最好为get,第三个参数最好为true
  45.              xmlhttp.open("get",weburl,true);
  46.             // alert(xmlhttp.responseText);
  47.              //如果已经成功的返回了数据
  48.              xmlhttp.onreadystatechange=function()
  49.              {
  50.                if(xmlhttp.readyState==4)//4代表成功返回数据
  51.                 {
  52.                    var result = xmlhttp.responseText;//得到服务器返回的数据
  53.                    //先清空dListChild的所有下拉项
  54.                   document.getElementById("dListChild").length = 0;
  55.                    //给dListChild加个全部型号的,注意是Option不是option
  56.                  //  document.getElementById("dListChild").options.add(new Option("请选择","0"));
  57.                    if(result!="")//如果返回的数据不是空
  58.                    {//alert(result);
  59.                       //把收到的字符串按照,分割成数组
  60.                       var allArray = result.split(";");
  61.                      //循环这个数组,注意是从1开始,因为收到的字符串第一个字符是,号,所以分割后第一个数组为空
  62.                       for(var i=1;i<allArray.length;i++)
  63.                       {
  64.                          //在把这个字符串按照|分割成数组
  65.                         var thisArray = allArray[i].split("|");
  66.                          //为dListChild添加条目
  67.                          document.getElementById("dListChild").options.add(new Option(thisArray[1].toString(),thisArray[0].toString()));
  68.                          //alert(thisArray[0] + "==" +thisArray[1]);
  69.                       }
  70.                       //
  71.                    }
  72.                 }
  73.              }
  74.              //发送数据,请注意顺序和参数,参数一定为null或者""
  75.              xmlhttp.send(null);
  76.           }
  77.          //小计
  78.         function  sum1()
  79.          {
  80.            var price= parseFloat(document.getElementById("TB_Price").value);  //默认为0
  81.            var  number= parseFloat(document.getElementById("TB_Number").value);  //默认为1 
  82.            
  83.            var a= price * number;
  84.          
  85.            document.getElementById("TB_Count").innerText=  cheng(a,2);
  86.       
  87.           if( document.getElementById("TB_Count").value=="NaN")
  88.             document.getElementById("TB_Count").innerText="空";
  89.          }
  90.           
  91.           //保留两位小数
  92.           function  cheng(num,n)  // num:被四舍五入的数字,n:要保留小数的位数  
  93.             {
  94.                 var  dd=1;   
  95.                 var  tempnum;   
  96.                 for(i=0;i<n;i++)   
  97.                 {   
  98.                    dd*=10;   
  99.                 }   
  100.                 tempnum=num*dd;   
  101.                 tempnum=Math.round(tempnum);   
  102.               return  tempnum/dd;
  103.               //  alert(tempnum/dd);   
  104.             }
  105.           
  106.           //判断输入是否是数字
  107.           function checkNumber()
  108.             {
  109.                 if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==13)||(window.event.keyCode==46)||(window.event.keyCode==45)))
  110.                 {
  111.                       window.event.keyCode=0;
  112.                       alert("对不起,只能输入数字!");
  113.                 }
  114.             }
  115.          function  returnvalue()
  116.          {
  117.              var  txcount= document.getElementById("txtcount").value;  
  118.              window.returnValue=txcount;
  119.          }
  120.          function DListChange()
  121.          {
  122.             form1.TB_wz.value = form1.dListChild.value;
  123. //            alert(form1.dListChild.value);
  124.             return false;
  125.          }
  126.          function DBLChange()
  127.          {
  128.             var nowEvenObj = event.srcElement;
  129.             if (nowEvenObj.type != undefined)
  130.             {
  131. //                alert(nowEvenObj.nodeName);
  132.                 if(nowEvenObj.nodeName == "INPUT")
  133.                 {
  134.                     form1.TxtSeacher.value=nowEvenObj.value;
  135. //                    alert(nowEvenObj.value);
  136.                 }
  137.             }
  138. //            alert(form1.RBL_Type.value);
  139. //            return false;
  140.          }
  141.          function DListSearch()
  142.          {
  143.             var s=form1.TB_SearchContent.value;
  144.             s=s.replace(/^s+|s+$/g,"");
  145. //            alert(s);
  146.             if (s=="")
  147.             {
  148.                 alert("系统提示:请输入查询内容!");
  149.                 return false;
  150.             }
  151.             if (form1.TxtSeacher.value=="2")
  152.             {
  153.                 var NVale = window.showModalDialog("SelectMateril.aspx?StrE="+s,"","help=0;dialogWidth=450px;dialogHeight=370px;status=no;status=no;");
  154.                 if (NVale!=undefined) 
  155.                 {
  156.                    form1.TxtWZ.value = NVale;
  157.                  return true;
  158.                 }
  159.                 return false;
  160.             }
  161.          }
  162.          
  163.         function EnterTextBox()
  164.         {
  165.              if(event.keyCode == 13 && document.all["TB_SearchContent"].value != "")
  166.              {
  167.                  event.keyCode = 9;
  168.                  event.returnValue = false;
  169.                  document.all["IB_Search"].click();
  170.              }
  171.         }
  172.         
  173.     function CheckNull()
  174.     {
  175.         var price=parseFloat(form1.TB_Price.value);
  176.          var num=parseFloat(form1.TB_Number.value);
  177.         if (price <=0 || num<=0) 
  178.         {
  179.             alert("系统提示:单价或数量必需大于零!");
  180.             return false;
  181.         }
  182.     }
  183.         
  184.    </script>
  185. </head>
  186. <body onunload="returnvalue()">
  187.     <form id="form1" runat="server">
  188.       
  189.        <table style="width:100%; font-size:12px;" border="0" cellpadding="0" cellspacing="0" >
  190.          <tr>
  191.             <td  align="left" style="width: 70px; font-weight: bold;">
  192.              查找类型:
  193.            </td>
  194.           <td align="left" style="width: 160px" >
  195.               <asp:RadioButtonList ID="RBL_Type" runat="server"  RepeatColumns="3">
  196.                   <asp:ListItem Text="物资代码" Value="1" Selected="True"></asp:ListItem>
  197.                   <asp:ListItem Text="规格型号" Value="2"></asp:ListItem>
  198.               </asp:RadioButtonList>
  199.           </td>
  200.          <td align="left" style="width: 250px">
  201.               &nbsp;
  202.               <asp:TextBox ID="TB_SearchContent" runat="server" style="width:250px"></asp:TextBox>
  203.               &nbsp;
  204.           </td>
  205.           <td align="left">
  206.              <asp:ImageButton ID="IB_Search"  ImageUrl="~/Workflow/image/Search.gif" ToolTip=" 查找"   runat="server" OnClientClick="javascript:return DListSearch();" OnClick="IB_Search_Click"   />
  207.               <%-- <asp:Button ID="Button1" runat="server" Text="新增"  OnClick="BT_Add_Click" />--%> &nbsp; &nbsp;
  208.                 <asp:ImageButton ID="IB_Add"  ImageUrl="~/Workflow/image/Add.jpg" ToolTip=" 新增"   runat="server" OnClick="IB_Add_Click"   />
  209.           </td>
  210.        </tr>
  211.     </table>
  212.     
  213.   
  214.       <table style="width:100%" border="0" cellpadding="0" cellspacing="0" >
  215.          <tr>
  216.          <td colspan="7">
  217.          <div align="left" style="text-indent:2em;height:300px; overflow-x:hidden;overflow-y:auto; width:100%;">
  218.            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EquipmentID" BackColor="#CDCDCF" BorderWidth="0px"
  219.                CssClass="Grid"  SelectedRowStyle-CssClass="SelectedRow" RowStyle-CssClass="HeadingCellText" 
  220.        FooterStyle-CssClass="GridFooter"  ShowFooter="true" CellSpacing="1" CellPadding="0"
  221.                OnRowDataBound="GridView1_RowDataBound"  style="width:100%" 
  222.                OnRowDeleting="GridView1_RowDeleting"  OnRowEditing="GridView1_RowEditing"  
  223.                AllowPaging="false" AllowSorting="false">
  224.                            
  225.                            <AlternatingRowStyle BackColor="#F0F0F0" />
  226. <RowStyle BackColor="#F9FAFC" CssClass="HeadingCellText" />
  227. <HeaderStyle Height="25px" BackColor="#DFDFDF" CssClass="GridHeader" />
  228.                 <Columns>
  229.                         <asp:BoundField DataField="EquipmentName"  HeaderText="品 名">
  230.                            <HeaderStyle Width="12%"/>
  231.                         </asp:BoundField>
  232.                         <asp:BoundField DataField="EquipmentSize"  HeaderText="规格型号">
  233.                             <HeaderStyle Width="22%"/>
  234.                         </asp:BoundField>
  235.                         <asp:BoundField DataField="wz_id"  HeaderText="物资代码">
  236.                             <HeaderStyle Width="8%"/>
  237.                         </asp:BoundField>
  238.                         <asp:BoundField DataField="UnitName" HeaderText="制造厂家">
  239.                             <HeaderStyle Width="15%" />
  240.                         </asp:BoundField>
  241.                         <asp:BoundField DataField="Price" HeaderText="单 价">
  242.                             <HeaderStyle Width="8%"/>
  243.                         </asp:BoundField>
  244.                          <asp:BoundField DataField="Number" HeaderText="数 量">
  245.                             <HeaderStyle Width="4%"/>
  246.                         </asp:BoundField>
  247.                          <asp:BoundField  HeaderText=" 小 计">
  248.                             <HeaderStyle Width="12%"/>
  249.                         </asp:BoundField>
  250.                      
  251.                      <asp:TemplateField  HeaderText="操 作">
  252.                             <ItemTemplate>
  253.                                 <asp:ImageButton ID="IB_Edit" ToolTip="编辑" runat="server" CommandName="edit" ImageUrl="~/Images/s_edit.gif"/> &nbsp; &nbsp;
  254.                                 <asp:ImageButton ToolTip="删除" ID="IB_Del" runat="server" CommandName="Delete" ImageUrl="~/Images/s-del.gif"
  255.                                     OnClientClick='<%#"return confirm("确认删除品名为『"+Eval("EquipmentName")+"』物资代码为『"+Eval("wz_id")+"』费用的记录吗?");" %>'/>
  256.                               
  257.                             </ItemTemplate>
  258.                            <%-- <HeaderStyle  HorizontalAlign="Center"  BorderWidth="0px"/>--%>
  259.                             <ItemStyle HorizontalAlign="Center"  BorderWidth="0px"/>
  260.                         </asp:TemplateField>
  261.                     
  262.                    </Columns>
  263.                  <FooterStyle CssClass="GridFooter" />
  264.        <PagerStyle CssClass="GridPage" />
  265.                
  266.                <EmptyDataTemplate>
  267.                 <table width="100%" class="GridHeader">
  268.                  <tr  style="border-width:1px;height:25px" align="center" bgcolor="#DFDFDF">
  269.                    <td  style="border:1px solid #CCCCCC;width:12%"> 品 名 </td>
  270.                    <td  style="border:1px solid #CCCCCC;width:22%">  规格型号</td>
  271.                    <td  style="border:1px solid #CCCCCC;width:8%">  物资代码</td>
  272.                    <td  style="border:1px solid #CCCCCC;width:15%">  制造厂家</td>
  273.                    <td style="border:1px solid #CCCCCC;width:8%">  单 价</td>
  274.                    <td  style="border:1px solid #CCCCCC;width:4%">  数 量</td>
  275.                    <td style="border:1px solid #CCCCCC;width:12%">  小 计</td>
  276.                     <td  style="border:1px solid #CCCCCC; text-align:center;"> 操 作</td>
  277.                  </tr> 
  278.                </table>
  279.             
  280.             </EmptyDataTemplate>
  281.             
  282.             </asp:GridView>
  283.          </div>
  284.          </td>
  285.        
  286.        </tr>
  287.        </table>
  288.         <asp:Panel ID="PanelAdd" runat="server"  Width="100%">
  289.    
  290.           <table width="100%" border="0" cellpadding="0" cellspacing="0" >
  291.             
  292.             <tr  style="border-width:1px;height:16px" align="center" bgcolor="#DFDFDF">
  293.                    <td  style="border:1px solid #CCCCCC;width:12%"> 品 名 </td>
  294.                    <td  style="border:1px solid #CCCCCC;width:22%">  规格型号</td>
  295.                    <td  style="border:1px solid #CCCCCC;width:8%">  物资代码</td>
  296.                    <td  style="border:1px solid #CCCCCC;width:15%">  制造厂家</td>
  297.                    <td style="border:1px solid #CCCCCC;width:8%">  单 价</td>
  298.                    <td  style="border:1px solid #CCCCCC;width:4%">  数 量</td>
  299.                    <td style="border:1px solid #CCCCCC;width:12%">  小 计</td>
  300.                     <td  style="border:1px solid #CCCCCC; text-align:center;" colspan="2"> 操 作</td>
  301.                  </tr> 
  302.             
  303.              <tr>
  304.                 <td align="left" style="width:12%"> 
  305.                      <asp:DropDownList id="dListParent"  runat="server" Width="100%" AutoPostBack="True" OnSelectedIndexChanged="dListParent_SelectedIndexChanged"> </asp:DropDownList><%-- onchange="Go(this)"--%>
  306.                 </td>
  307.                 <td align="left" style="width:22%">
  308.                      <asp:DropDownList id="dListChild" runat="server" Width="100%"></asp:DropDownList>
  309.                 </td>
  310.                 <td align="left"style="width:8%">
  311.                       <asp:TextBox ID="TB_wz" runat="server" Width="100%" Enabled="false"></asp:TextBox>  
  312.                 </td>
  313.                 <td align="left" style="width:15%"> 
  314.                       <asp:TextBox ID="TB_UnitName" runat="server" Width="100%"></asp:TextBox>  
  315.                 </td>
  316.                 <td align="left" style="width:8%">
  317.                       <asp:TextBox ID="TB_Price" Text="0" MaxLength="12" onkeypress="checkNumber()"  onblur="sum1()"  runat="server" style="width:100%" ></asp:TextBox>  
  318.                 </td>
  319.                 <td align="left" style="width:4%">
  320.                       <asp:TextBox ID="TB_Number"  Text="1"  MaxLength="12" onkeypress="checkNumber()"    onblur="sum1()" runat="server" style="width:100%"></asp:TextBox>  
  321.                 </td>
  322.                 <td align="left" style="width:12%">
  323.                       <asp:TextBox ID="TB_Count" Text="0" runat="server" style="width:95%" Enabled="false"></asp:TextBox>  
  324.                 </td>
  325.                 <td align="left">
  326.                    &nbsp;&nbsp;<asp:ImageButton ID="BT_Confirm" runat="server" ImageUrl="image/queding.gif" style="width:80%" OnClick="BT_Confirm_Click"   OnClientClick="return CheckNull();"  ValidationGroup="SaveButton"/>
  327.                    </td>
  328.                    <td><asp:ImageButton   ID="BT_Cancel" runat="server" style="width:80%" ImageUrl="image/quxiao.gif" OnClick="BT_Cancel_Click" />
  329.                 </td>
  330.            </tr>
  331.            
  332.            
  333.            
  334.          </table>
  335.  
  336.       </asp:Panel>
  337.             <input type="hidden" id="Txt_Count" name="Txt_Count"   runat="server"/>
  338.             <input type="hidden" id="equipmentid" name="equipmentid"   runat="server"/>
  339.             <input type="hidden" id="status" name="status"   runat="server"/>
  340.             <input type="hidden" id="txtcount" name="txtcount"   value="0" runat="server"/>
  341.             <input type="hidden" id="TxtSeacher" name="TxtSeacher"   value="0" runat="server"/>
  342.             <input type="hidden" id="TxtWZ" name="TxtWZ"   value="0" runat="server"/>
  343.     </form>
  344. </body>
  345. </html>