ChargeDetailEq.aspx
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:17k
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChargeDetailEq.aspx.cs" EnableEventValidation="false" Inherits="Workflow_ChargeDetailEq" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <link href="style/gridStyle.css" rel="stylesheet" type="text/css" />
- <base target="_self" />
- <title>设备费用</title>
- <script type="text/javascript">
- //jb函数会根据不同的浏览器初始化个xmlhttp对象
- function jb()
- {
- var A=null;
- try
- {
- A=new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch(e)
- {
- try
- {
- A=new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch(oc)
- {
- A=null
- }
- }
- if ( !A && typeof XMLHttpRequest != "undefined" )
- {
- A=new XMLHttpRequest()
- }
- return A
- }
-
- //下面Go函数是父列表框改变的时候调用,参数是选择的条目
- function Go(obj)
- {
- //得到选择框的下拉列表的value
- var svalue = obj.value;
- //定义要处理数据的页面
- var weburl = "ChargeDetailEqAdd.aspx?parent_id="+svalue;
- //初始化个xmlhttp对象
- var xmlhttp = jb();
- //提交数据,第一个参数最好为get,第三个参数最好为true
- xmlhttp.open("get",weburl,true);
- // alert(xmlhttp.responseText);
- //如果已经成功的返回了数据
- xmlhttp.onreadystatechange=function()
- {
- if(xmlhttp.readyState==4)//4代表成功返回数据
- {
- var result = xmlhttp.responseText;//得到服务器返回的数据
- //先清空dListChild的所有下拉项
- document.getElementById("dListChild").length = 0;
- //给dListChild加个全部型号的,注意是Option不是option
- // document.getElementById("dListChild").options.add(new Option("请选择","0"));
- if(result!="")//如果返回的数据不是空
- {//alert(result);
- //把收到的字符串按照,分割成数组
- var allArray = result.split(";");
- //循环这个数组,注意是从1开始,因为收到的字符串第一个字符是,号,所以分割后第一个数组为空
- for(var i=1;i<allArray.length;i++)
- {
- //在把这个字符串按照|分割成数组
- var thisArray = allArray[i].split("|");
- //为dListChild添加条目
- document.getElementById("dListChild").options.add(new Option(thisArray[1].toString(),thisArray[0].toString()));
- //alert(thisArray[0] + "==" +thisArray[1]);
- }
- //
- }
- }
- }
- //发送数据,请注意顺序和参数,参数一定为null或者""
- xmlhttp.send(null);
- }
- //小计
- function sum1()
- {
- var price= parseFloat(document.getElementById("TB_Price").value); //默认为0
- var number= parseFloat(document.getElementById("TB_Number").value); //默认为1
-
- var a= price * number;
-
- document.getElementById("TB_Count").innerText= cheng(a,2);
-
- if( document.getElementById("TB_Count").value=="NaN")
- document.getElementById("TB_Count").innerText="空";
- }
-
- //保留两位小数
- function cheng(num,n) // num:被四舍五入的数字,n:要保留小数的位数
- {
- var dd=1;
- var tempnum;
- for(i=0;i<n;i++)
- {
- dd*=10;
- }
- tempnum=num*dd;
- tempnum=Math.round(tempnum);
- return tempnum/dd;
- // alert(tempnum/dd);
- }
-
- //判断输入是否是数字
- function checkNumber()
- {
- if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==13)||(window.event.keyCode==46)||(window.event.keyCode==45)))
- {
- window.event.keyCode=0;
- alert("对不起,只能输入数字!");
- }
- }
- function returnvalue()
- {
- var txcount= document.getElementById("txtcount").value;
- window.returnValue=txcount;
- }
- function DListChange()
- {
- form1.TB_wz.value = form1.dListChild.value;
- // alert(form1.dListChild.value);
- return false;
- }
- function DBLChange()
- {
- var nowEvenObj = event.srcElement;
- if (nowEvenObj.type != undefined)
- {
- // alert(nowEvenObj.nodeName);
- if(nowEvenObj.nodeName == "INPUT")
- {
- form1.TxtSeacher.value=nowEvenObj.value;
- // alert(nowEvenObj.value);
- }
- }
- // alert(form1.RBL_Type.value);
- // return false;
- }
- function DListSearch()
- {
- var s=form1.TB_SearchContent.value;
- s=s.replace(/^s+|s+$/g,"");
- // alert(s);
- if (s=="")
- {
- alert("系统提示:请输入查询内容!");
- return false;
- }
- if (form1.TxtSeacher.value=="2")
- {
- var NVale = window.showModalDialog("SelectMateril.aspx?StrE="+s,"","help=0;dialogWidth=450px;dialogHeight=370px;status=no;status=no;");
- if (NVale!=undefined)
- {
- form1.TxtWZ.value = NVale;
- return true;
- }
- return false;
- }
- }
-
- function EnterTextBox()
- {
- if(event.keyCode == 13 && document.all["TB_SearchContent"].value != "")
- {
- event.keyCode = 9;
- event.returnValue = false;
- document.all["IB_Search"].click();
- }
- }
-
- function CheckNull()
- {
- var price=parseFloat(form1.TB_Price.value);
- var num=parseFloat(form1.TB_Number.value);
- if (price <=0 || num<=0)
- {
- alert("系统提示:单价或数量必需大于零!");
- return false;
- }
- }
-
- </script>
- </head>
- <body onunload="returnvalue()">
- <form id="form1" runat="server">
-
- <table style="width:100%; font-size:12px;" border="0" cellpadding="0" cellspacing="0" >
- <tr>
- <td align="left" style="width: 70px; font-weight: bold;">
- 查找类型:
- </td>
- <td align="left" style="width: 160px" >
- <asp:RadioButtonList ID="RBL_Type" runat="server" RepeatColumns="3">
- <asp:ListItem Text="物资代码" Value="1" Selected="True"></asp:ListItem>
- <asp:ListItem Text="规格型号" Value="2"></asp:ListItem>
- </asp:RadioButtonList>
- </td>
- <td align="left" style="width: 250px">
-
- <asp:TextBox ID="TB_SearchContent" runat="server" style="width:250px"></asp:TextBox>
-
- </td>
- <td align="left">
- <asp:ImageButton ID="IB_Search" ImageUrl="~/Workflow/image/Search.gif" ToolTip=" 查找" runat="server" OnClientClick="javascript:return DListSearch();" OnClick="IB_Search_Click" />
- <%-- <asp:Button ID="Button1" runat="server" Text="新增" OnClick="BT_Add_Click" />--%>
- <asp:ImageButton ID="IB_Add" ImageUrl="~/Workflow/image/Add.jpg" ToolTip=" 新增" runat="server" OnClick="IB_Add_Click" />
- </td>
- </tr>
- </table>
-
-
- <table style="width:100%" border="0" cellpadding="0" cellspacing="0" >
- <tr>
- <td colspan="7">
- <div align="left" style="text-indent:2em;height:300px; overflow-x:hidden;overflow-y:auto; width:100%;">
- <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EquipmentID" BackColor="#CDCDCF" BorderWidth="0px"
- CssClass="Grid" SelectedRowStyle-CssClass="SelectedRow" RowStyle-CssClass="HeadingCellText"
- FooterStyle-CssClass="GridFooter" ShowFooter="true" CellSpacing="1" CellPadding="0"
- OnRowDataBound="GridView1_RowDataBound" style="width:100%"
- OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing"
- AllowPaging="false" AllowSorting="false">
-
- <AlternatingRowStyle BackColor="#F0F0F0" />
- <RowStyle BackColor="#F9FAFC" CssClass="HeadingCellText" />
- <HeaderStyle Height="25px" BackColor="#DFDFDF" CssClass="GridHeader" />
-
- <Columns>
- <asp:BoundField DataField="EquipmentName" HeaderText="品 名">
- <HeaderStyle Width="12%"/>
- </asp:BoundField>
- <asp:BoundField DataField="EquipmentSize" HeaderText="规格型号">
- <HeaderStyle Width="22%"/>
- </asp:BoundField>
- <asp:BoundField DataField="wz_id" HeaderText="物资代码">
- <HeaderStyle Width="8%"/>
- </asp:BoundField>
- <asp:BoundField DataField="UnitName" HeaderText="制造厂家">
- <HeaderStyle Width="15%" />
- </asp:BoundField>
- <asp:BoundField DataField="Price" HeaderText="单 价">
- <HeaderStyle Width="8%"/>
- </asp:BoundField>
- <asp:BoundField DataField="Number" HeaderText="数 量">
- <HeaderStyle Width="4%"/>
- </asp:BoundField>
- <asp:BoundField HeaderText=" 小 计">
- <HeaderStyle Width="12%"/>
- </asp:BoundField>
-
- <asp:TemplateField HeaderText="操 作">
- <ItemTemplate>
- <asp:ImageButton ID="IB_Edit" ToolTip="编辑" runat="server" CommandName="edit" ImageUrl="~/Images/s_edit.gif"/>
- <asp:ImageButton ToolTip="删除" ID="IB_Del" runat="server" CommandName="Delete" ImageUrl="~/Images/s-del.gif"
- OnClientClick='<%#"return confirm("确认删除品名为『"+Eval("EquipmentName")+"』物资代码为『"+Eval("wz_id")+"』费用的记录吗?");" %>'/>
-
- </ItemTemplate>
- <%-- <HeaderStyle HorizontalAlign="Center" BorderWidth="0px"/>--%>
- <ItemStyle HorizontalAlign="Center" BorderWidth="0px"/>
- </asp:TemplateField>
-
- </Columns>
- <FooterStyle CssClass="GridFooter" />
- <PagerStyle CssClass="GridPage" />
-
- <EmptyDataTemplate>
- <table width="100%" class="GridHeader">
- <tr style="border-width:1px;height:25px" align="center" bgcolor="#DFDFDF">
- <td style="border:1px solid #CCCCCC;width:12%"> 品 名 </td>
- <td style="border:1px solid #CCCCCC;width:22%"> 规格型号</td>
- <td style="border:1px solid #CCCCCC;width:8%"> 物资代码</td>
- <td style="border:1px solid #CCCCCC;width:15%"> 制造厂家</td>
- <td style="border:1px solid #CCCCCC;width:8%"> 单 价</td>
- <td style="border:1px solid #CCCCCC;width:4%"> 数 量</td>
- <td style="border:1px solid #CCCCCC;width:12%"> 小 计</td>
- <td style="border:1px solid #CCCCCC; text-align:center;"> 操 作</td>
- </tr>
- </table>
-
- </EmptyDataTemplate>
-
- </asp:GridView>
- </div>
- </td>
-
- </tr>
- </table>
- <asp:Panel ID="PanelAdd" runat="server" Width="100%">
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0" >
-
- <tr style="border-width:1px;height:16px" align="center" bgcolor="#DFDFDF">
- <td style="border:1px solid #CCCCCC;width:12%"> 品 名 </td>
- <td style="border:1px solid #CCCCCC;width:22%"> 规格型号</td>
- <td style="border:1px solid #CCCCCC;width:8%"> 物资代码</td>
- <td style="border:1px solid #CCCCCC;width:15%"> 制造厂家</td>
- <td style="border:1px solid #CCCCCC;width:8%"> 单 价</td>
- <td style="border:1px solid #CCCCCC;width:4%"> 数 量</td>
- <td style="border:1px solid #CCCCCC;width:12%"> 小 计</td>
- <td style="border:1px solid #CCCCCC; text-align:center;" colspan="2"> 操 作</td>
- </tr>
-
- <tr>
- <td align="left" style="width:12%">
- <asp:DropDownList id="dListParent" runat="server" Width="100%" AutoPostBack="True" OnSelectedIndexChanged="dListParent_SelectedIndexChanged"> </asp:DropDownList><%-- onchange="Go(this)"--%>
- </td>
- <td align="left" style="width:22%">
- <asp:DropDownList id="dListChild" runat="server" Width="100%"></asp:DropDownList>
- </td>
- <td align="left"style="width:8%">
- <asp:TextBox ID="TB_wz" runat="server" Width="100%" Enabled="false"></asp:TextBox>
- </td>
- <td align="left" style="width:15%">
- <asp:TextBox ID="TB_UnitName" runat="server" Width="100%"></asp:TextBox>
- </td>
- <td align="left" style="width:8%">
- <asp:TextBox ID="TB_Price" Text="0" MaxLength="12" onkeypress="checkNumber()" onblur="sum1()" runat="server" style="width:100%" ></asp:TextBox>
- </td>
- <td align="left" style="width:4%">
- <asp:TextBox ID="TB_Number" Text="1" MaxLength="12" onkeypress="checkNumber()" onblur="sum1()" runat="server" style="width:100%"></asp:TextBox>
- </td>
- <td align="left" style="width:12%">
- <asp:TextBox ID="TB_Count" Text="0" runat="server" style="width:95%" Enabled="false"></asp:TextBox>
- </td>
- <td align="left">
- <asp:ImageButton ID="BT_Confirm" runat="server" ImageUrl="image/queding.gif" style="width:80%" OnClick="BT_Confirm_Click" OnClientClick="return CheckNull();" ValidationGroup="SaveButton"/>
- </td>
- <td><asp:ImageButton ID="BT_Cancel" runat="server" style="width:80%" ImageUrl="image/quxiao.gif" OnClick="BT_Cancel_Click" />
- </td>
- </tr>
-
-
-
- </table>
-
- </asp:Panel>
- <input type="hidden" id="Txt_Count" name="Txt_Count" runat="server"/>
- <input type="hidden" id="equipmentid" name="equipmentid" runat="server"/>
- <input type="hidden" id="status" name="status" runat="server"/>
- <input type="hidden" id="txtcount" name="txtcount" value="0" runat="server"/>
- <input type="hidden" id="TxtSeacher" name="TxtSeacher" value="0" runat="server"/>
- <input type="hidden" id="TxtWZ" name="TxtWZ" value="0" runat="server"/>
- </form>
- </body>
- </html>