<%@ page language="C#" autoeventwireup="true" inherits="Admin_IndentionProjectEdit, App_Web_qxuvifui" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!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>新增项目</title>
         <link href="../CSS/All.css" rel="stylesheet" type="text/css" />
         <script src="../JS/jquery.min.js" type="text/javascript"></script>
         <script src="../JS/Calendar.js" type="text/javascript"></script>
         
    <style>
        .division th {
        background:none repeat scroll 0 0 #E2E8EB;
        border-right:1px solid #CCCCCC;
        font-size:10pt;
        text-align:center;
        font-weight:500;
        width:140px;

        }
        .division {
            background:none repeat scroll 0 0 #FFFFFF;
            border-color:#CCCCCC #BEC6CE #BEC6CE #CCCCCC;
            border-style:solid;
            border-width:1px 2px 2px 1px;
            line-height:150%;
            padding:5px;
            white-space:normal;
            margin:5;
       }
       .division td, .division th{
            border-color:#FFFFFF #DBE2E7 #DDDDDD #FFFFFF;
            border-left:1px solid #FFFFFF;
            border-right:1px solid #DBE2E7;
            border-style:solid;
            border-width:1px;

       }
       h5{
        margin:0;
        padding:5px;
        background-color:#E2E8EB;
        font-size:11pt;
       }
       .division .font1{
        font-weight: bold;
        color: #696969
       }
     
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div >

    <h5>项目需求客户</h5>
       <div class="division">
                <table id="selectCust" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <th>
                            客户：</th>
                        <td>
                            &nbsp;<asp:DropDownList ID="ddlSelectCust" runat="server" Width="153px">
                            </asp:DropDownList></td>
                    </tr>
                    </table>
   
        </div>
        <h5>项目信息</h5>
            <div class="division">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <th>
                            意向项目名(*)：</th>
                        <td>
                    <asp:TextBox ID="txtPName" runat="server"></asp:TextBox>
                    </td>
                    </tr>
                    <tr>
                        <th style="height: 30px">
                            预算金额：</th>
                        <td style="height: 30px">
                    <asp:TextBox ID="txtAmount" runat="server"></asp:TextBox>元</td>
                    </tr>
                    <tr>
                        <th>
                            商品类型：</th>
                        <td>
                            <span class="notice_inline ">
                    <asp:DropDownList ID="ddlPClass" runat="server" Width="155px">
                    </asp:DropDownList></span></td>
                    </tr>
                </table>
            </div>
            <h5>项目相关信息</h5>
            <div class="division">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <th>
                            销售机会：</th>
                        <td>
                            <asp:DropDownList ID="ddlSaleLeads" runat="server" Width="154px">
                            </asp:DropDownList></td>
                    </tr>
                    <tr>
                        <th>
                            联系人：</th>
                        <td>
                    <asp:TextBox ID="txtLinkMan" runat="server" MaxLength="255"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <th style="height: 30px">
                            联系人职位：</th>
                        <td style="height: 30px">
                    <asp:TextBox ID="txtLinkManPost" runat="server" MaxLength="255"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            其他联系人：</th>
                        <td>
                            <em><font color="red">
                    <asp:TextBox ID="txtOthers" runat="server" MaxLength="255"></asp:TextBox></font></em></td>
                    </tr>
                    <tr>
                        <th>
                            备注：</th>
                        <td>
                            <asp:TextBox ID="txtBeizhu" runat="server" Height="50px" TextMode="MultiLine" Width="441px"></asp:TextBox></td>
                    </tr>
                </table>
            </div>
                <div style="width:100%; background-color: lightgrey;" align="center">
      
                    <asp:Button id="btnSubmit" runat="server"  OnClientClick="return CheckInsert();" Text="保存并返回" CssClass="btn" Width="167px" OnClick="btnSubmit_Click"></asp:Button>
                    <asp:Button ID="btnBack" runat="server" CssClass="btn" OnClick="btnback_Click"
                    OnClientClick="返回" Text="返回" Width="125px" />
              </div>
                
                <h5>
                   跟单信息</h5>
            <div class="division">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <th>
                            跟单时间：</th>
                        <td>
                            <asp:TextBox ID="txtOrderSupervisor" runat="server" onclick="showDateSelect(this)"></asp:TextBox>
                            <asp:Button ID="btnOSSave" runat="server" Text="保存" CssClass="btn" OnClick="btnOSSave_Click"  OnClientClick="return checkOs()"/>
                            <input id="btnCancalEdit" type="button" value="取消编辑"  style="display:none" onclick="cancalEdit()"/></td>
                    </tr>
                    <tr>
                        <th>
                            备注：</th>
                        <td>
                            <asp:TextBox ID="txtOSbz" runat="server" Height="50px" TextMode="MultiLine" Width="441px"></asp:TextBox></td>
                    </tr>
                    <tr>
                    
                        <td colspan="2">
                            <asp:GridView ID="OrderSuperView" runat="server" AutoGenerateColumns="False" DataKeyNames="CID"
                                 EmptyDataText="没有可显示的数据记录。">
                                <Columns>
                                    <asp:TemplateField HeaderText="选择">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="CBSelect" runat="server" />
                                        </ItemTemplate>
                                        <ItemStyle  Width="30px" />
                                        <HeaderStyle  Width="30px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                             <a href="#" onclick="editOs(this,'<%#Eval("Beizhu") %>','<%#Eval("CID") %>')" >编辑</a>
                                        </ItemTemplate>
                                             <ItemStyle  Width="30px" />
                                        <HeaderStyle  Width="30px" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="IDate" HeaderText="跟单时间" SortExpression="IDate" DataFormatString="{0:yyyy-MM-dd}" >
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Beizhu" HeaderText="备注" SortExpression="Beizhu" >
                                    </asp:BoundField>
                                </Columns>
                                <HeaderStyle  Font-Bold="True"  />
                            </asp:GridView>
                            <asp:Button ID="btnDeleteSBAll" runat="server" Text="删除选中" OnClick="btnDeleteSBAll_Click" />
                            <br />
                            <webdiyer:aspnetpager id="PagerButtom" runat="server" alwaysshow="True" cssclass="paginator"
                                currentpagebuttonclass="cpb" custominfohtml=""
                                firstpagetext="首页" lastpagetext="尾页" layouttype="Table" nextpagetext="下一页" numericbuttoncount="4"
                                onpagechanged="Pager_PageChanged" prevpagetext="上一页" showcustominfosection="Left"
                                showpageindexbox="Always" Width="400px"></webdiyer:aspnetpager>
                        </td>
                    </tr>
                </table>
            </div>

            
        </div>
        

        <asp:HiddenField ID="hfIsInsetCust" runat="server" Value="0" />
        &nbsp;&nbsp;
        <div  onclick="$(this).hide()" id="cuePanel" style="z-index: 101; position: absolute; 
           border:1px solid #E6594E; background-color: #FCEAE8;  padding:7px; display:none;
            color:#E6594E;">
            <span id="operCue"></span>
        </div>
        <asp:HiddenField ID="hfCurrentEditID" runat="server" Value="-1" />

    </form>
    

<script type="text/javascript" > 


function editOs(obj,beizhu,cid){
    
    $("#txtOrderSupervisor").val($(obj).parent().next().text());
    $("#txtOSbz").val(beizhu);
    $("#btnOSSave").val("保存编辑");
    $("#hfCurrentEditID").val(cid);
    
    $("#btnCancalEdit").show();
}
 
function cancalEdit(){
     $("#btnCancalEdit").hide();
     $("#hfCurrentEditID").val(-1);
       $("#txtOrderSupervisor").val("");
        $("#btnOSSave").val("保存");
    $("#txtOSbz").val("");
}
function isInt(sText){
      var reg =/^\d*$/;
      return sText.match(reg);
}



function showDateSelect(txt){ 
            new Calendar('<%=DateTime.Now.Year-10 %>', '<%=DateTime.Now.Year+10%>', 0,'yyyy-MM-dd').show(txt);
}
function cue(obj,txt){
       var Y = obj.offset().top;
       var X = obj.offset().left;
       var p = $("#cuePanel");

       p.css("top",Y);
       p.css("left",X);
       $("#operCue").text(txt);
       p .show();
}
function isEmpty(obj){
     var input= $("#"+obj+"");
     if($.trim(input.val())==""){
            input.get(0).focus();
            cue(input,"请填写！");
            return true;
     }
     return false;
}
function isIValid(obj){
    var input= $("#"+obj+"");
    if(!isInt($.trim(input.val()))){
        input.get(0).focus();
        cue(input,"输入无效！");return true;
    }
    return false;
}
function CheckInsert(){
    if($('#hfIsInsetCust').val()=="1"){
        if(isEmpty("txtCustName"))return false;
    }else{
        var cn =$("#ddlSelectCust option:selected");
        if(cn.eq(0).val()=="0"){
           $("#ddlSelectCust").get(0).focus();
           cue(cn,"请选择！");return false;
        }
    }
    if(isEmpty("txtPName"))return false;
    if(isIValid("txtAmount"))return false;
    return true;
}
function checkOs()
{
    if(isEmpty("txtOrderSupervisor"))return false;
    return true;
}
</script>
</body>
</html>
