<%@ page language="C#" autoeventwireup="true" inherits="general_Contract_Contract_ReNew, CrmCommand" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register TagPrefix="C1WebGrid" Namespace="C1.Web.C1WebGrid" Assembly="C1.Web.C1WebGrid.2" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>续费合同</title>
    <base target=_self></base>
     <script  src="../../Javascript/Trim.js" type="text/javascript">
    </script>
     <script src="../../Javascript/canlendar.js" type="text/javascript"></script>
    <script src="../../Javascript/CheckALL.js" type="text/javascript"></script>
    <script src="../../Javascript/formCheck.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
    function RLtrim()
    {
    
      var ClientName=document.getElementById("TxtClientName").value;
      var ClientContact=document.getElementById("TxtClientContact").value;
      var TxtCheckInData=document.getElementById("TxtCheckInData").value;
      var TxtClientComTel=document.getElementById("TxtClientComTel").value;
      var DropContractNum=document.getElementById("DropContractNum");
      var index=DropContractNum.selectedIndex;
      var ContractNum=DropContractNum.options[index].value;
       var count = parseInt(document.getElementById("Hid").value);
       for(var i=1;i<count+1;i++)
       {
            var temp = i;
            if(i<10)
            {
              temp = "0"+temp;
            }
           var nid= "C1WebGrid1_ctl"+temp+"_TxtSinglePrice";
            var num="C1WebGrid1_ctl"+temp+"_TxtProNum";
            if(!isMath(TrimStr(document.getElementById(nid).value)))
    	    {
    	         
    	           alert('您输入的单价必须是数字!'); 
    	           return false;
    	    }
    	    if(!isMath(TrimStr(document.getElementById(num).value)))
    	    {
    	         alert('您输入的数量必须是数字!'); 
    	         return false;
    	    }
      }
      if(ContractNum=="q")
      {
        alert('请您选择合同编号!');
        return false;
      }
      else if(!Trim(ClientName))
      {
        alert('客户名称不能为空!');
        return false;
      }
      else if(!Trim(ClientContact))
      {
        alert('客户联系人不能为空!');
        return false;
        
      }
      else if(!Trim(TxtCheckInData))
      {
        alert("签约日期不能为空!")
        return false;
      }
      else if(!Trim(TxtClientComTel))
      {
        alert('公司联系电话不能为空!');
        return false;
      }
      else if(!ChkOk('form1','item'))
      {
       return false;
      }
      else
      {
         return true;
      }
    }
   function getPin(sid)
   {
  
        var nid= "C1WebGrid1_ctl"+sid+"_TxtSinglePrice";
       var pid ="C1WebGrid1_ctl"+sid+"_"+"TxtTotalPrice";
       var num="C1WebGrid1_ctl"+sid+"_"+"TxtProNum";
       var DropContractNum=document.getElementById("DropPeriod");
       var index=DropContractNum.selectedIndex;
       var ContractNum=DropContractNum.options[index].value;
       var nums=document.getElementById(num).value;
        if(!isMath(TrimStr(document.getElementById(nid).value)))
    	{
    	   
    	   
    	   //document.getElementById(pid).value ="";
    	}
    	else if(!isMath(TrimStr(document.getElementById(pid).value)))
    	{
    	  //document.getElementById(pid).value ="";
    	   
    	}
    	else 
    	{
          var total=parseFloat(document.getElementById(nid).value)*parseInt(ContractNum)*parseInt(nums);
          document.getElementById(pid).value=total;
        
        }
   }
   function setPin()
   {
    if(document.getElementById("Hid").value != "")
    {
       var count = parseInt(document.getElementById("Hid").value);
       for(var i=1;i<count+1;i++)
       {
            var temp = i;
            if(i<10)
            {
              temp = "0"+temp;
            }
            var nid= "C1WebGrid1_ctl"+temp+"_TxtSinglePrice";
            var pid ="C1WebGrid1_ctl"+temp+"_"+"TxtTotalPrice";
           var num="C1WebGrid1_ctl"+temp+"_"+"TxtProNum";
              var DropContractNum=document.getElementById("DropPeriod");
            var index=DropContractNum.selectedIndex;
   
               var nums=document.getElementById(num).value;
               var ContractNum=DropContractNum.options[index].value;
            var total=parseFloat(document.getElementById(nid).value)*parseInt(ContractNum)*parseInt(nums);
          document.getElementById(pid).value=total;
       } 
    }
   }
    </script>
    
</head>
<body class ="bodycolor" leftmargin="0" topmargin="0">
    <form id="form1" runat="server">
   <div id="First">
        &nbsp;<table align="left" cellpadding="5" cellspacing="0" class="small" style="border-right: #000000 1px groove;
            border-top: #000000 1px groove; border-left: #000000 1px groove; width: 800px;
            border-bottom: #000000 1px groove">
            <tr>
                <td colspan="2" style="height: 75px">
                    <fieldset name="Group1">
                        <legend class="style1">
基本信息</legend>
                        <table cellpadding="0" cellspacing="0" style="width: 100%; height: 65px">
                            <tr>
                                <td style="width: 98px">
                                    合同类型:</td>
                                <td colspan="2">
                                    <asp:Label ID="LblType" runat="server" Text="Label"></asp:Label>
               
           						</td>
                            </tr>
                            <tr>
                                <td style="width: 98px; height: 22px;">
                                    合同编号:</td>
                                <td colspan="2" style="height: 22px">
                                    <asp:DropDownList ID="DropContractNum" runat="server">
                                    </asp:DropDownList></td>
                            </tr>
                            <tr>
                                <td style="width: 98px">
                                    签约日期:</td>
                                <td colspan="2">
                                    <table style="width: 100%" cellspacing="0" cellpadding="0">
										<tr>
											<td style="width: 97px">
                                    <input id="TxtCheckInData" runat="server" style="border: 1px solid #C0C0C0; width: 100px" type="text" readonly="readonly" /></td>
											<td><img
                                        onclick='popUpCalendar(document.getElementById("TxtCheckInData"), document.getElementById("TxtCheckInData"), "yyyy-mm-dd")'
                                        src="../../App_Themes/Green/images/Calendar.gif" /></td>
										</tr>
									</table>
								</td>
                            </tr>
                            <tr>
                                <td style="width: 98px; height: 22px;">
            付款方式:</td>
                                <td style="width: 287px; height: 22px;">
                                    <asp:DropDownList ID="DropPayMethod" runat="server" CssClass="BigInput">
                                        <asp:ListItem>现金</asp:ListItem>
                                        <asp:ListItem>支票</asp:ListItem>
                                        <asp:ListItem>贷记凭证</asp:ListItem>
                                        <asp:ListItem>电汇</asp:ListItem>
                                        <asp:ListItem>汇票</asp:ListItem>
                                        <asp:ListItem>信用卡</asp:ListItem>
                                        <asp:ListItem>网上支付</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td style="width: 438px; height: 22px">
                                 
                                    合同续费期限:<asp:DropDownList onchange="setPin();" ID="DropPeriod"  runat="server">
                                        <asp:ListItem>1</asp:ListItem>
                                        <asp:ListItem>2</asp:ListItem>
                                        <asp:ListItem>3</asp:ListItem>
                                        <asp:ListItem>4</asp:ListItem>
                                        <asp:ListItem>5</asp:ListItem>
                                        <asp:ListItem>6</asp:ListItem>
                                        <asp:ListItem>7</asp:ListItem>
                                        <asp:ListItem>8</asp:ListItem>
                                        <asp:ListItem>9</asp:ListItem>
                                        <asp:ListItem>10</asp:ListItem>
                                    </asp:DropDownList>年</td>
                            </tr>
                        </table>
                    </fieldset>
                    </td>
            </tr>
            <tr>
                <td style="width: 404px; height: 145px" valign="top">
                    <fieldset name="Group1">
                        <legend class="style1">买方(乙方)</legend>
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width: 72px">
                                    公司名称</td>
                                <td>
                                    <asp:TextBox ID="TxtClientName" runat="server" CssClass="BigInput" Width="307px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    公司地址</td>
                                <td>
                                    <asp:TextBox ID="TxtAddr" runat="server" CssClass="BigInput" Width="307px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    联系电话</td>
                                <td>
                                    <asp:TextBox ID="TxtClientComTel" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    公司传真</td>
                                <td>
                                    <asp:TextBox ID="TxtClientFax" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    联系人</td>
                                <td>
                                    <asp:TextBox ID="TxtClientContact" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    签约人</td>
                                <td>
                                    <asp:TextBox ID="TxtBuyCheckPeo" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    联系手机</td>
                                <td>
                                    <asp:TextBox ID="TxtClientMobile" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </fieldset>
                    </td>
                <td style="height: 145px; width: 413px;" valign="top">
                    <fieldset name="Group1">
                        <legend class="style1">卖方(甲方)</legend>
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width: 72px">
                                    公司名称</td>
                                <td>
                                    <asp:TextBox ID="TxtMyComName" runat="server" CssClass="BigInput" Width="307px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    公司地址</td>
                                <td>
                                    <asp:TextBox ID="TxtMyAddr0" runat="server" CssClass="BigInput" Width="307px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    联系电话</td>
                                <td>
                                    <asp:TextBox ID="TxtMyTel" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    公司传真</td>
                                <td>
                                    <asp:TextBox ID="MyClientFax0" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    联系人</td>
                                <td>
                                    <asp:TextBox ID="TxtMyPeople" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    签约人</td>
                                <td>
                                    <asp:TextBox ID="TxtMyCheckIn" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    联系手机</td>
                                <td>
                                    <asp:TextBox ID="TxtMyMobile" runat="server" CssClass="BigInput" Width="174px"></asp:TextBox></td>
                            </tr>
                        </table>
                    </fieldset>
                    </td>
            </tr>
            <tr>
            <td colspan=2>
            <fieldset align="left" style="width: 787px">
               <legend>请选择需要续费的合同产品 </legend>
                                          <table style="width: 100%" cellspacing="0" cellpadding="10">
											<tr>
												<td align="center">
                                          <C1WebGrid:C1WebGrid ID="C1WebGrid1" runat="server"
                               AutoGenerateColumns="False" 
                               DataKeyField="Contract_ID"                                                               SkinID="gridviewSkin" Width="750px" OnItemDataBound="C1WebGrid1_ItemDataBound">
                               <Columns>
                                   <C1WebGrid:C1TemplateColumn >
                                       <HeaderTemplate>
                                           <input id="all" onclick="CheckAll('form1','item','all')" type="checkbox" value="全选" /></HeaderTemplate>
                                       <ItemTemplate>
                                           <input id="item" runat="server" type="checkbox" value='<%#Eval("Contract_ID") %>' /><itemstyle
                                               horizontalalign="Center" width="20px" wrap="True" /></ItemTemplate>
                                   </C1WebGrid:C1TemplateColumn>
                                   <C1WebGrid:C1BoundColumn DataField="Contract_ID" HeaderText="序号" SortExpression="Contract_ID"
                                       Visible="False">
                                   </C1WebGrid:C1BoundColumn>
                                   <C1WebGrid:C1TemplateColumn HeaderText="产品名称" SortExpression="Product_Name">
                                       <ItemTemplate>
                                           <%#Eval("Product_Name")%>
                                       </ItemTemplate>
                                   </C1WebGrid:C1TemplateColumn>
                                  
                                     <C1WebGrid:C1TemplateColumn HeaderText="产品数量" SortExpression="Product_Num">
                                       <ItemTemplate>
                                           <asp:TextBox ID="TxtProNum"   CssClass="BigInput"  runat="server" Text=<%#Eval("Product_Num")%> Width="20px"></asp:TextBox>
                                       </ItemTemplate>
                                   </C1WebGrid:C1TemplateColumn>
                                    <C1WebGrid:C1TemplateColumn HeaderText="产品单价" SortExpression="Product_SinglePrice">
                                       <ItemTemplate>
                                           <asp:TextBox ID="TxtSinglePrice"  CssClass="BigInput"  runat="server" Text=<%#Eval("Product_SinglePrice")%> Width="30px"></asp:TextBox>
                                       </ItemTemplate>
                                   </C1WebGrid:C1TemplateColumn>
                                   <C1WebGrid:C1TemplateColumn HeaderText="产品总价" SortExpression="Product_TotalPrice">
                                       <ItemTemplate>
                                           <asp:TextBox ID="TxtTotalPrice" ReadOnly=true  CssClass="BigInput"  runat="server" Text=<%#Eval("Product_TotalPrice")%> Width="40px"></asp:TextBox>
                                       </ItemTemplate>
                                   </C1WebGrid:C1TemplateColumn>
                               					</Columns>
                           </C1WebGrid:C1WebGrid>
                 
           										</td>
											</tr>
				</table>
                 
           </fieldset>
            </td>
            </tr>
            <tr>
                <td colspan="2">
                    <fieldset name="Group1">
                        <legend class="style1">附加及其他</legend>
                        <table cellpadding="0" cellspacing="0" style="width: 100%">
                            <tr>
                                <td style="width: 72px">
                                    付款日期</td>
                                <td>
                                    <table style="width: 100%" cellspacing="0" cellpadding="0">
										<tr>
											<td style="width: 104px">
                                    <input id="TxtCPaydata" runat="server" style="border: 1px solid #C0C0C0; width: 100px" type="text" readonly="readonly" /></td>
											<td><img onclick='popUpCalendar(document.getElementById("TxtCPaydata"), document.getElementById("TxtCPaydata"), "yyyy-mm-dd")'
                                        src="../../App_Themes/Green/images/Calendar.gif" /></td>
										</tr>
									</table>
								</td>
                                
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    发票</td>
                                <td>
                                    <asp:DropDownList ID="DropCIsBill" runat="server" CssClass="BigInput">
                                        <asp:ListItem Value="0">有</asp:ListItem>
                                        <asp:ListItem Value="1">无</asp:ListItem>
                                    </asp:DropDownList></td>
                               
                            </tr>
                            <tr>
                                <td style="width: 72px">
                                    其他说明</td>
                                <td>
                                    <asp:TextBox ID="TxtCremark" runat="server" Height="145px" TextMode="MultiLine"
                                        Width="532px" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
                                
                            </tr>
                          
                        </table>
                    </fieldset>
                
                    </td>
            </tr>
            <tr>
                <td align="center" colspan="2" style="height: 12px">
                   <asp:Button ID="Button2" runat="server" CssClass="SmallButton" OnClick="Button2_Click"
                               OnClientClick="return RLtrim()" Text="确认无误" />
                   
                </td>
            </tr>
        </table>
        <br />
    
      </div>
        <input id="Hid"  runat="server"  type="hidden" />
    </form>
</body>
</html>
