<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="prelend.aspx.cs" Inherits="Web.sb.show.prelend" %>

<!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 id="Head1" runat="server">
    <title>OA标题页</title>
    <link href="../../css/css.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/css/popcalendar.js"></script>

</head>
<body>
    <form id="fom" runat="server">
        <div id ="main-c-03-right" >
            <table cellpadding="0"; cellspacing ="0"; style =" width :100%;background-image: url('../../css/images/right_top.png'); background-repeat :repeat-x" >
                <tr>
         <td class  ="main-c-03-right02-top">
                	   <!--这里添加页面标题 -->
                      	设备预借
                      	</td>

                </tr>
            </table>
            <div id="main-c-03-right02-main">
                  <div style ="text-align :left ">   <asp:Label ID="lbMessage" runat="server" ForeColor="Red"></asp:Label></div>  


<!--栏目开始 -->
        <div class ="lanmubiaoti "> 库存查询 </div>
        <table style="width:100%;">
                    <tr><td>   <div style="float :left">设备类别:  <asp:DropDownList ID="ddlCategories" runat="server"> </asp:DropDownList>
                 设备名称： <asp:TextBox ID="tbDevicename" runat="server" Width="120px"></asp:TextBox>
                    <asp:Button ID="tbSub" runat="server" Text="查询库存" onclick="tbSub_Click" />
                                           </div>
<div style="float :right;">
    <asp:LinkButton ID="lbtPrelend" runat="server" OnClick="lbtPrelend_Click">查看预借</asp:LinkButton></div>

                        </td></tr>
                </table>

        <div runat ="server" id="divstorage"> 
           
                
                        <!--这里添加内容 -->
                        <asp:GridView ID="GridView1" runat="server" 
                      onrowdatabound="GridView1_RowDataBound" Width="100%" 
                BorderWidth="1px" CssClass="gv" AutoGenerateColumns="False" 
                            onselectedindexchanging="GridView1_SelectedIndexChanging" 
                      onrowcreated="GridView1_RowCreated" >
            <RowStyle BorderWidth="1px" CssClass="gvrow" />
  <Columns>
                                                      <asp:TemplateField> 
               <HeaderTemplate>  <asp:CheckBox ID="CheckBox2" Text ="全选" runat="server" AutoPostBack="True" 
                OnCheckedChanged="CheckBox2_CheckedChanged"  />    </HeaderTemplate>        
               <ItemTemplate><asp:CheckBox ID="CheckBox1" runat="server" /></ItemTemplate>               
               </asp:TemplateField>
                    <asp:BoundField DataField="id" HeaderText="序号" ReadOnly="True" />

                    <asp:TemplateField HeaderText="设备名称" ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Select" Text='<%# Bind("devicename") %>'></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

                    <asp:BoundField DataField="devicenumber" HeaderText="设备编号" ReadOnly="True" />
                    <asp:BoundField DataField="categories" HeaderText="类别" ReadOnly="True" />
                    <asp:BoundField DataField="type" HeaderText="型号" ReadOnly="True" />
                                                      <asp:TemplateField HeaderText="库存数量">
                                                         
                                                          <ItemTemplate>
                                                              <asp:Label ID="Label1" runat="server" Text='<%# Bind("actualinventory") %>'></asp:Label>
                                                               <asp:Label ID="Label4" runat="server" Text='<%# Bind("unit") %>'></asp:Label>
                                                          </ItemTemplate>
                                                      </asp:TemplateField>

                </Columns>
            <HeaderStyle BorderWidth="1px" CssClass="gvhead" />
        </asp:GridView>
            <div runat ="server" id="divout">
       <div style ="text-align :left; margin-bottom :18px ">批量预借：数量：<asp:TextBox ID="tbProlendshuliang" 
                          runat="server" Width="43px"></asp:TextBox>&nbsp; 借用说明：<asp:TextBox 
                          ID="tbProlendshuoming" runat="server" Width="319px"></asp:TextBox>
                      &nbsp; 计划归还时间：<asp:TextBox ID="tbProlendshijian" runat="server" onclick="popUpCalendar(this,this,'yyyy-mm-dd')"></asp:TextBox>
&nbsp;    <asp:Button ID="btAllprelend" runat="server" 
                Text="提交" onclick="btAllprelend_Click" ValidationGroup="tijiao" />    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                            ControlToValidate="tbProlendshuliang" Display="Dynamic" ErrorMessage="数量不能为空！" 
                            ValidationGroup="tijiao" ForeColor="Red"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator13" 
                            runat="server" ControlToValidate="tbProlendshuliang" Display="Dynamic" 
                            ErrorMessage="请输入大于0的整数。" ValidationExpression="^\+?[1-9][0-9]*$" 
                            ValidationGroup="tijiao" ForeColor="Red"></asp:RegularExpressionValidator></div>
                <div style ="text-align :left; margin-bottom :18px ">
                    说明：可以点击设备名称查看设备详情，并预借设备，也可以在上表中勾选批量预借。
                    </div> </div>
     </div>   

        <div runat ="server" id="divshowprelend" visible ="false" > 
            <div class =" lanmubiaoti ">  预借设备列表</div>
            <!--这里添加内容 -->
    
			<asp:GridView ID="GridView2" runat="server" onrowdatabound="GridView1_RowDataBound" Width="100%" 
                BorderWidth="1px" CssClass="gv" AutoGenerateColumns="False" 
                            onrowcancelingedit="GridView2_RowCancelingEdit" 
                            onrowdeleting="GridView2_RowDeleting" onrowediting="GridView2_RowEditing" 
                            onrowupdating="GridView2_RowUpdating" 
                      onselectedindexchanging="GridView2_SelectedIndexChanging" >
            <RowStyle BorderWidth="1px" CssClass="gvrow" />
                  <Columns>
                    <asp:BoundField DataField="lenddate" HeaderText="预借时间" ReadOnly="True" />
                    <asp:BoundField DataField="devicenumber" HeaderText="设备编号" ReadOnly="True" />
                                        <asp:TemplateField HeaderText="设备名称" ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Select" Text='<%# Bind("devicename") %>'></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                    <asp:BoundField DataField="type" HeaderText="型号" ReadOnly="True" />
                    <asp:BoundField DataField="configuration" HeaderText="详细配置" ReadOnly="True" />
                    <asp:BoundField DataField="unit" HeaderText="计量单位" ReadOnly="True" />
                    <asp:TemplateField HeaderText="借用数量">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("lendnumber") %>' 
                                Width="40px"></asp:TextBox>
                              <asp:Label ID="Label1" runat="server" Text='<%# Bind("unit") %>'></asp:Label>
                            库存:<asp:Label ID="Label2" runat="server" Text='<%#Bind("sumactualinventory") %>'></asp:Label>
                              <asp:Label ID="Label5" runat="server" Text='<%# Bind("unit") %>'></asp:Label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="数量不能为空"  ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="请输入大于0的整数"  ForeColor="Red"
                                ValidationExpression="^\+?[1-9][0-9]*$"></asp:RegularExpressionValidator>
                            <asp:RangeValidator ID="RangeValidator1" runat="server"  ForeColor="Red"
                                ControlToValidate="TextBox1" ErrorMessage="请输入合适的数量" 
                                MaximumValue='<%# Bind("sumactualinventory") %>' MinimumValue="<%# 0 %>" 
                                Display="Dynamic" Type="Integer"></asp:RangeValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("lendnumber") %>'></asp:Label>
                              <asp:Label ID="Label6" runat="server" Text='<%# Bind("unit") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="借用说明">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("lendnote") %>' 
                                Width="200px"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                                ControlToValidate="TextBox2" Display="Dynamic" ErrorMessage="不能超过100个字" 
                                Font-Size="Small" ValidationExpression="^[^%&gt;&lt;&amp;=]{0,100}$"></asp:RegularExpressionValidator>
                            &nbsp;
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("lendnote") %>'></asp:Label>
                            &nbsp;
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="计划归还时间">
                        <EditItemTemplate>
                          &nbsp; <asp:TextBox ID="TextBox3" runat="server" Width="130px" Text='<%# Bind("plansreturndate") %>' onclick="popUpCalendar(this,this,'yyyy-mm-dd')"></asp:TextBox> 
                          &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                ControlToValidate="TextBox3" Display="Dynamic" ErrorMessage="归还时间不能为空。"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                           &nbsp; <asp:Label ID="Label3" runat="server" Text='<%# Bind("plansreturndate") %>'></asp:Label>&nbsp;
                        </ItemTemplate>
                    </asp:TemplateField>
                      <asp:CommandField EditText="修改" HeaderText="修改" ShowEditButton="True" />
                      <asp:CommandField HeaderText="删除" ShowDeleteButton="True" DeleteText ="删除" />

                    
                </Columns>
            <HeaderStyle BorderWidth="1px" CssClass="gvhead" />
        </asp:GridView>
		</div>          
<!--栏目结束 -->

<!--栏目开始 -->
              <asp:Panel ID="Panel3" runat="server" Visible="False">
              <div class ="lanmubiaoti "> 设备详情</div>
                
                        <!--这里添加内容 -->
                                    <table border = "1" class ="table" cellpadding ="0" cellspacing ="0">
                  <tr>
                  <td class =" tabletd_center  " style ="width :80px; height :30px"> 设备编号</td>
                  <td class =" tabletd_center  " style ="width :200px" >                  
                       <asp:Label ID="lbDevicenumber" runat="server"></asp:Label>
                       &nbsp;</td>
                  <td class =" tabletd_center  " style ="width :80px">名称 </td>
                  <td class =" tabletd_center  " style ="width :200px">                  
                      <asp:Label ID="lbDevicename" runat="server"></asp:Label>&nbsp;
                      </td>
                      <td class=" tabletd_center  " style ="width :360px" rowspan="4">
                        <table >
                      <tr>
                      <td class ="img_s">
                         <asp:ImageButton ID="imgBt" runat="server" OnClick="imgBt_Click"  Visible ="false" />      </td></tr></table>
                        </td>

                  </tr>
                  <tr>
                      <td class=" tabletd_center  " style="width :80px; height :30px"">
                          类别</td>
                      <td class=" tabletd_center  ">
                          <asp:Label ID="lbCategories" runat="server"></asp:Label>&nbsp;
                      </td>
                      <td class=" tabletd_center  " style="width :80px">
                          序列号</td>
                      <td class=" tabletd_center  ">
                          <asp:Label ID="lbSn" runat="server"></asp:Label>&nbsp;
                      </td>
                  </tr>
                  <tr>
                      <td class=" tabletd_center  " style="width :80px; height :30px ">
                          数量 
                      </td>
                      <td class=" tabletd_center  ">
                          <asp:Label ID="lbInitialinventory" runat="server"></asp:Label>
                          <asp:Label ID="lbUnit" runat="server"></asp:Label>&nbsp; &nbsp;
                      </td>
                      <td class=" tabletd_center  " style="width :80px">
                          型号</td>
                      <td class=" tabletd_center  ">
                         
                          <asp:Label ID="lbType" runat="server"></asp:Label> &nbsp;
                      </td>
                  </tr>
                  <tr>
                      <td class=" tabletd_center  " style="width :80px">
                          详细配置 
                      </td>
                      <td class=" tabletd_center  " colspan="3" style ="height :150px">
                          <asp:Label ID="lbConfiguration" runat="server"></asp:Label>&nbsp;
                      </td>
                  </tr>

                  

</table>

            <table style =" width :970px;" ><tr>
            <td style ="text-align :left ">
                <asp:Button ID="btPreLend" runat="server" onclick="btPreLend_Click" Text="预借" />
                <asp:Button ID="btDel" runat="server" Text="取消预借" onclick="btDel_Click" />
                </td>
            <td style ="text-align:right "> 
            <asp:Button ID="back" runat="server" onclick="back_Click" Text="返回" />  </td></tr></table>  
         <table border="0" cellpadding="4" cellspacing="1"  style ="width :100% ; text-align :right ">
        <tr><td  id ="Td1" runat ="server" style ="text-align :right ;  padding-right  :5px"></td></tr>
        </table> 
          </asp:Panel>               
<!--栏目结束 -->
                </div>
            </div>
        </form>
    </body>
</html>