<%@ page language="C#" autoeventwireup="true" inherits="general_Contract_BorCon_check, CrmCommand" %>

<!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">
    <title>无标题页</title>
    <script language=javascript >
    var str="qwertyuiopasdfghjklmnbvcxz1234567890" 
   function getRandomNum(lbound, ubound) 
   { 
        return (Math.floor(Math.random() * (ubound - lbound)) + lbound); 
    } 

    function addCon()
    {
      var beg =document.getElementById("TxtConBeg").value;
      var conStr="";
     var count= document.getElementById("DrpNum").value;
     for(var i=0;i<count;i++)
     {
      var s=str.split(""); 
      var t=""; 

       for (var j=0;j<7;j++){ 
            t+=s[getRandomNum(1,36)]; 
         } 
         
         var n = parseInt(document.getElementById("HidBeg").value)+i+1; 
         if(n<10)
         {
            t ="0"+ n;
         }
         else
         {
           t = n;
         }
         if(i==0)
         {
           conStr+=beg+t+"#";
         }
         else
         {
         conStr+="\r"+beg+t+"#";
         }
        

     }
        document.getElementById("TextAreaCon").value = conStr;
        document.getElementById("Hid").value = conStr;
    }
    function set()
    {
        document.getElementById("Hid").value = document.getElementById("TextAreaCon").value;
    }
   function check()
		{
            var constr=  document.getElementById("TextAreaCon").value ;
            if(constr != "")
            {
               var names= constr.split("#");
             
			   var count= document.getElementById("DrpNum").length;
			 
			   var n = names.length-1;
			   if(names.length-1 > count)
			   {
			      alert('借出合同数不能大于申请数!');
			      return false;
			   }
				return confirm('你确定借出['+n+']份合同?');	
		    }
		    else
		    {
			    return confirm('你确定不借出合同?');	
			}
			  
		}
    
    </script>
</head>
<body>
    <form id="Form1" runat="server">
      
     
      
<table style="width: 550px" cellspacing="1" bgcolor="black" align="center">
	<tr>
		<td class="TableData" style="width: 128px">申请人: </td>
		<td class="TableData" >
        <asp:Label  ID="LblApplyUser"  runat="server"></asp:Label></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">申请合同数:</td>
		<td class="TableData"><font color="red"><asp:Label  ID="LblNum"  runat="server"></asp:Label>份</font></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">申请合同说明:</td>
		<td class="TableData">
		<asp:TextBox  ID="LblRemark" CssClass="BigInput" runat="server" Height="80px" TextMode="MultiLine" Width="300px"  ReadOnly="True" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">申请日期: </td>
		<td class="TableData"><asp:Label  ID="LblApplyDate"  runat="server"></asp:Label></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">同意借出合同数: </td>
		<td class="TableData"><asp:DropDownList ID="DrpNum" runat="server">
        </asp:DropDownList></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">合同号生成规则:</td>
		<td class="TableData"><asp:TextBox ID="TxtConBeg" runat="server"></asp:TextBox><input id="Button1" class="BigButton" type="button" value="生成合同编号" onclick="addCon()" /></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">合同编号列表:</td>
		<td class="TableData">
		<textarea id="TextAreaCon" onchange="set();" style="border: 1px solid #C0C0C0; width: 300px; height: 80px;" name="S1" ></textarea>(以"#"为分隔符)</td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">审批人: &nbsp;</td>
		<td class="TableData">
   <asp:Label  ID="LblAgrUser"  runat="server"></asp:Label></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">审批日期:</td>
		<td class="TableData">
       <asp:Label  ID="LblAgrDate"  runat="server"></asp:Label></td>
	</tr>
	<tr>
		<td class="TableData" style="width: 128px">审批备注 :&nbsp;</td>
		<td class="TableData">
		<asp:TextBox  ID="LblARemark" CssClass="BigInput" runat="server" Height="80px" TextMode="MultiLine" Width="300px" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" ></asp:TextBox></td>
	</tr>
	<tr>
		<td colspan="2" align="center" class="TableData">                        <asp:Button ID="ButAdd" class="BigButton" runat="server" Text="提交审核" OnClientClick="return check()" OnClick="ButAdd_Click" />
					</td>
	</tr>
</table>
             <input id="Hid" runat="server"  type="hidden" />
        <input id="HidBeg" runat="server"  type="hidden" />

      <INPUT id="Hidden1" type="hidden" name="hid" runat="server">
    </form>
</body>

</html>
