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

.net编程

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChargeDetailMaterial.aspx.cs" Inherits="Workflow_ChargeDetailMaterial" %>
  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. <base target="_self" />
  6. <link href="style/gridStyle.css" rel="stylesheet" />
  7.     <title>材料费用</title>
  8.     
  9.        <script type="text/javascript">
  10.          //小计
  11.         function  sum1()
  12.          {
  13.                var price= parseFloat(document.getElementById("TB_MarketPrice").value);  //默认为0
  14.                var number= parseFloat(document.getElementById("TB_Number").value);  //默认为1
  15.                
  16.                var BPrice = parseFloat(document.getElementById("TB_BudGetPrice").value);
  17.                var a= price * number;
  18.                var tcount = (price - BPrice) * number;
  19.           
  20. //              document.getElementById("TB_DifferencePriceSum").innerText=  cheng(a,2);
  21. //              document.getElementById("TB_count").innerText=cheng(tcount,2);
  22.               form1.TB_DifferencePriceSum.value =cheng(a,2);
  23.               form1.txtsum.value =cheng(a,2);
  24.               form1.TB_count.value = cheng(tcount,2);
  25.               form1.txtcount.value =cheng(tcount,2);
  26.               if( document.getElementById("TB_DifferencePriceSum").value=="NaN")
  27.                 document.getElementById("TB_DifferencePriceSum").innerText="空";
  28.          }
  29.           
  30.           //保留两位小数
  31.           function  cheng(num,n)  // num:被四舍五入的数字,n:要保留小数的位数  
  32.             {
  33.                 var  dd=1;   
  34.                 var  tempnum;   
  35.                 for(i=0;i<n;i++)   
  36.                 {   
  37.                    dd*=10;   
  38.                 }   
  39.                 tempnum=num*dd;   
  40.                 tempnum=Math.round(tempnum);
  41.                 return  tempnum/dd;
  42.               //  alert(tempnum/dd);
  43.             }
  44.           
  45.           //判断输入是否是数字
  46.             function checkNumber()
  47.             {
  48.                 if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==13)||(window.event.keyCode==46)||(window.event.keyCode==45)))
  49.                 {
  50.                       window.event.keyCode=0;
  51.                       alert("对不起,只能输入数字!");
  52.                 }
  53.             }
  54.              function  returnvalue()
  55.              {
  56.                 // alert("dfdf");
  57.                  var  txcount= document.getElementById("HjCount").value;
  58.                  window.returnValue=txcount;
  59.              }
  60.              
  61.              function DBLChange()
  62.          {
  63.             var nowEvenObj = event.srcElement;
  64.             if (nowEvenObj.type != undefined)
  65.             {
  66. //                alert(nowEvenObj.nodeName);
  67.                 if(nowEvenObj.nodeName == "INPUT")
  68.                 {
  69.                     form1.TxtSeacher.value=nowEvenObj.value;
  70. //                    alert(nowEvenObj.value);
  71.                 }
  72.             }
  73. //            alert(form1.RBL_Type.value);
  74. //            return false;
  75.          }
  76.          
  77.          function DListSearch()
  78.          {
  79.             var s=form1.TB_SearchContent.value;
  80.             s=s.replace(/^s+|s+$/g,"");
  81. //            alert(s);
  82.             if (s=="")
  83.             {
  84.                 alert("系统提示:请输入查询内容!");
  85.                 return false;
  86.             }
  87.             if (form1.TxtSeacher.value=="2")
  88.             {
  89.                 var NVale = window.showModalDialog("SelectMateril.aspx?StrE="+s,"","help=0;dialogWidth=450px;dialogHeight=370px;status=no;status=no;");
  90.                 if (NVale!=undefined) 
  91.                 {
  92.                    form1.TxtWZ.value = NVale;
  93.                    return true;
  94.                 }
  95.                 return false;
  96.             }
  97.          }
  98.          
  99.         function EnterTextBox()
  100.         {
  101.              if(event.keyCode == 13 && document.all["TB_SearchContent"].value != "")
  102.              {
  103.                  event.keyCode = 9;
  104.                  event.returnValue = false;
  105.                  document.all["IB_Search"].click();
  106.              }
  107.         }
  108.    function CheckNull()
  109.     {
  110.         //  var BudGetPrice=parseFloat(form1.TB_BudGetPrice.value);
  111.           var MarketPrice=parseFloat(form1.TB_MarketPrice.value);
  112.           var Number=parseFloat(form1.TB_Number.value);
  113.       
  114.         if (MarketPrice<=0 || Number<=0) 
  115.         {
  116.             alert("系统提示:单价或数量必需大于零!");
  117.             return false;
  118.         }
  119.     }
  120.    </script>
  121.        
  122. </head>
  123. <body onunload="returnvalue()">
  124.      <form id="form1" runat="server" style="font-size:12px;">
  125.      <table style="width:100%; font-size:12px;" border="0" cellpadding="0" cellspacing="0" >
  126.          <tr>
  127.             <td  align="left" style="width: 70px; font-weight: bold;">
  128.              查找类型:
  129.            </td>
  130.           <td align="left" style="width: 160px" >
  131.               <asp:RadioButtonList ID="RBL_Type" runat="server"  RepeatColumns="3">
  132.                   <asp:ListItem Text="物资代码" Value="1" Selected="True"></asp:ListItem>
  133.                   <asp:ListItem Text="规格型号" Value="2"></asp:ListItem>
  134.               </asp:RadioButtonList>
  135.           </td>
  136.          <td align="left" style="width: 250px">
  137.               &nbsp;
  138.               <asp:TextBox ID="TB_SearchContent" runat="server" style="width:250px"></asp:TextBox>
  139.               &nbsp;
  140.           </td>
  141.           <td align="left">
  142.              <asp:ImageButton ID="IB_Search"  ImageUrl="~/Workflow/image/Search.gif" ToolTip=" 查找"   runat="server" OnClientClick="javascript:return DListSearch();" OnClick="IB_Search_Click"   />
  143.               <%-- <asp:Button ID="Button1" runat="server" Text="新增"  OnClick="BT_Add_Click" />--%> &nbsp; &nbsp;
  144.                 <asp:ImageButton ID="IB_Add"  ImageUrl="~/Workflow/image/Add.jpg" ToolTip=" 新增"   runat="server" OnClick="IB_Add_Click"   />
  145.           </td>
  146.        </tr>
  147.     </table>
  148.     
  149.      <table width="100%" border="0" cellpadding="0" cellspacing="0" >
  150.        <tr>
  151.          <td colspan="7">
  152.          <div style="text-indent:2em;height:300px;overflow-x:hidden;overflow-y:auto; width:100%;text-align:left;">
  153.            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="MaterialID" BackColor="#CDCDCF" BorderWidth="0px"
  154.                CssClass="Grid"  SelectedRowStyle-CssClass="SelectedRow" RowStyle-CssClass="HeadingCellText" 
  155.        FooterStyle-CssClass="GridFooter"  ShowFooter="true" CellSpacing="1" CellPadding="0"
  156.                OnRowDataBound="GridView1_RowDataBound"  style="width:100%"
  157.                OnRowDeleting="GridView1_RowDeleting"  OnRowEditing="GridView1_RowEditing"  
  158.                AllowPaging="false" AllowSorting="false">
  159.                 
  160.                 <AlternatingRowStyle BackColor="#F0F0F0" />
  161. <RowStyle BackColor="#F9FAFC" CssClass="HeadingCellText" />
  162. <HeaderStyle BackColor="#DFDFDF" CssClass="GridHeader" />
  163.                 <Columns>
  164.                         <asp:BoundField DataField="MeterialName" HeaderText="材料名称">
  165.                         <ItemStyle Width="10%" />
  166.                         </asp:BoundField>
  167.                         <asp:BoundField DataField="MeterialSize" HeaderText="材料型号">
  168.                           <ItemStyle Width="15%" />
  169.                         </asp:BoundField>
  170.                         <asp:BoundField DataField="wz_id" HeaderText="物资代码">
  171.                           <ItemStyle Width="8%" />
  172.                         </asp:BoundField>
  173.                         <asp:BoundField DataField="UnitName" HeaderText="生产单位">
  174.                             <ItemStyle Width="10%" />
  175.                         </asp:BoundField>
  176.                         <asp:BoundField DataField="BudGetPrice" HeaderText="预算原价">
  177.                            <ItemStyle Width="8%" />
  178.                         </asp:BoundField>
  179.                          <asp:BoundField DataField="MarketPrice" HeaderText="市场价">
  180.                              <ItemStyle Width="8%" />
  181.                         </asp:BoundField>
  182.                          <asp:BoundField  DataField="Number" HeaderText="数量">
  183.                              <ItemStyle Width="4%" />
  184.                         </asp:BoundField>
  185.                          <asp:BoundField DataField="DifferencePrice" HeaderText="差价小计">
  186.                             <ItemStyle Width="8%" />
  187.                         </asp:BoundField>
  188.                          <asp:BoundField  DataField="DifferencePriceSum" HeaderText="实际总价">
  189.                               <ItemStyle Width="8%" />
  190.                         </asp:BoundField>
  191.                    
  192.                      <asp:TemplateField HeaderText="操作">
  193.                             <ItemTemplate>
  194.                                 <asp:ImageButton ID="IB_Edit" ToolTip="编辑" runat="server" CommandName="edit" ImageUrl="~/Images/s_edit.gif"/> &nbsp; &nbsp;
  195.                                 <asp:ImageButton ToolTip="删除" ID="IB_Del" runat="server" CommandName="Delete" ImageUrl="~/Images/s-del.gif"
  196.                                     OnClientClick='<%#"return confirm("确认删除此材料的费用记录吗?");" %>'/>
  197.                               
  198.                             </ItemTemplate>
  199.                            <%-- <HeaderStyle  HorizontalAlign="Center"  BorderWidth="0px"/>--%>
  200.                             <ItemStyle HorizontalAlign="Center"  Width="10%" BorderWidth="0px"/>
  201.                         </asp:TemplateField>
  202.                     
  203.                    </Columns>
  204.                  <FooterStyle CssClass="GridFooter" />
  205.        <PagerStyle CssClass="GridPage" />
  206.                <EmptyDataTemplate>
  207.                 <table width="100%" class="GridHeader">
  208.                  <tr  style="border-width:1px;height:16px" align="center" bgcolor="#DFDFDF">
  209.                    <td  style="border:1px solid #CCCCCC;width:10%">材料名称</td>
  210.                    <td  style="border:1px solid #CCCCCC;width:15%">材料型号</td>
  211.                    <td  style="border:1px solid #CCCCCC;width:8%">物资代码</td>
  212.                    <td  style="border:1px solid #CCCCCC;width:10%">生产单位</td>
  213.                    <td style="border:1px solid #CCCCCC;width:8%">预算原价</td>
  214.                    <td style="border:1px solid #CCCCCC;width:8%">市场价</td>
  215.                    <td  style="border:1px solid #CCCCCC;width:4%">数 量</td>
  216.                    <td style="border:1px solid #CCCCCC;width:8%">差价小计</td>
  217.                    <td style="border:1px solid #CCCCCC;width:8%">实际总价</td>
  218.                     <td  style="border:1px solid #CCCCCC; text-align:center;"> 操 作</td>
  219.                  </tr> 
  220.                </table>
  221.             </EmptyDataTemplate>
  222.             </asp:GridView>
  223.          </div>
  224.          </td>
  225.        
  226.        </tr>
  227.        </table>
  228.        
  229.        <asp:Panel ID="PanelAdd" runat="server"  Width="100%">
  230.           <table width="100%" border="0" cellpadding="0" cellspacing="0" >
  231.              
  232.               <tr  style="border-width:1px;height:16px" align="center" bgcolor="#DFDFDF">
  233.                    <td  style="border:1px solid #CCCCCC;width:10%">材料名称</td>
  234.                    <td  style="border:1px solid #CCCCCC;width:15%">材料型号</td>
  235.                    <td  style="border:1px solid #CCCCCC;width:8%">物资代码</td>
  236.                    <td  style="border:1px solid #CCCCCC;width:10%">生产单位</td>
  237.                    <td style="border:1px solid #CCCCCC;width:8%">预算原价</td>
  238.                    <td style="border:1px solid #CCCCCC;width:8%">市场价</td>
  239.                    <td  style="border:1px solid #CCCCCC;width:4%">数 量</td>
  240.                    <td style="border:1px solid #CCCCCC;width:8%">差价小计</td>
  241.                    <td style="border:1px solid #CCCCCC;width:8%">实际总价</td>
  242.                     <td  style="border:1px solid #CCCCCC; text-align:center;" colspan="2"> 操 作</td>
  243.                  </tr> 
  244.              
  245.              <tr>
  246.                 <td align="left" style="width:10%">
  247.                      <asp:DropDownList id="dListParent"  runat="server" Width="100%" AutoPostBack="True" OnSelectedIndexChanged="dListParent_SelectedIndexChanged"> </asp:DropDownList><%-- onchange="Go(this)"--%>
  248.                 </td>
  249.                 <td align="left" style="width:15%">
  250.                      <asp:DropDownList id="dListChild"   runat="server" Width="100%" AutoPostBack="True" OnSelectedIndexChanged="dListChild_SelectedIndexChanged"></asp:DropDownList>
  251.                 </td>
  252.                 <td align="left" style="width:8%">
  253.                       <asp:TextBox ID="TBWZ" runat="server" Width="100%" Enabled="false"></asp:TextBox>  
  254.                 </td>
  255.                 <td align="left" style="width:10%">
  256.                       <asp:TextBox ID="TB_UnitName" runat="server" Width="100%"></asp:TextBox>  
  257.                 </td>
  258.                 <td align="left" style="width:8%">
  259.                       <asp:TextBox ID="TB_BudGetPrice" Text="0" MaxLength="12" Enabled="false"   runat="server" Width="100%" ></asp:TextBox>  
  260.                 </td>
  261.                 <td align="left" style="width:8%">
  262.                       <asp:TextBox ID="TB_MarketPrice"  Text="0"  MaxLength="12" onkeypress="checkNumber()" onblur="sum1()" runat="server" Width="100%"></asp:TextBox>  
  263.                 </td>
  264.                 <td align="left" style="width:4%"> 
  265.                       <asp:TextBox ID="TB_Number" Text="1" onkeypress="checkNumber()"  onblur="sum1()"  runat="server" Width="100%" ></asp:TextBox>  
  266.                 </td>
  267.                  <td align="left" style="width:8%">
  268.                       <asp:TextBox ID="TB_count" Text="0" runat="server" Width="100%" Enabled="false"></asp:TextBox>  
  269.                 </td>
  270.                  <td align="left" style="width:9%"> 
  271.                       <asp:TextBox ID="TB_DifferencePriceSum" Text="0" runat="server" Width="92%" Enabled="false"></asp:TextBox>  
  272.                 </td>
  273.                 <td align="left">
  274.                    &nbsp;<asp:ImageButton ID="BT_Confirm" runat="server" ImageUrl="image/queding.gif" OnClick="BT_Confirm_Click" ValidationGroup="SaveButton" OnClientClick="return CheckNull();" style="width:80%"/>
  275.                 </td>
  276.                  <td>
  277.                      &nbsp;<asp:ImageButton   ID="BT_Cancel" runat="server" ImageUrl="image/quxiao.gif" OnClick="BT_Cancel_Click" style="width:80%" />
  278.                 </td>
  279.            </tr>
  280.          </table>
  281.  
  282.       </asp:Panel>
  283.       
  284.     <input type="hidden" id="equipmentid" name="equipmentid" runat="server"/>
  285.     <input type="hidden" id="status" name="status" runat="server"/>
  286.     <input type="hidden" id="HjCount" name="HjCount" value="0" runat="server"/>    <%--差价合计--%>
  287.     <input type="hidden" id="txtcount" name="txtcount" value="0" runat="server"/>
  288.     <input type="hidden" id="txtsum" name="txtsum" value="0" runat="server"/>
  289.     <input type="hidden" id="TxtSeacher" name="TxtSeacher" value="0" runat="server"/>
  290.     <input type="hidden" id="TxtWZ" name="TxtWZ" value="0" runat="server"/>
  291.     
  292.     </form>
  293. </body>
  294. </html>