<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ExhibitorMaster.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(function () {
            selectMenu("2014宠物新风尚新品推广方案", "");

            CountTotalPrice();
        });

        function Save() {
            var orderStr = "";
            $("input[type='text'][name^='Num']").each(function () {
                var num = $(this).val().replace(/[^\d]/g, '');
                var price = $(this).attr("price");
                if ($.trim(num) != "" && $.trim(num) != "0") {
                    var totalPrice = parseInt(num) * parseFloat(price);
                    var id = $(this).attr("name").substring(3);
                    orderStr += id + ":" + num + ":" + totalPrice + ";";
                }
            });
            $("#OrderStr").val(orderStr);

            MsgTip.show({ ico: 'loading', during: 0, msg: '正在处理请求，请稍等...' });

            $("#f1").submit();
        }

        function ChangePackage(StrTitle,value)
        {
            if (StrTitle.indexOf("C") > -1 && parseInt(value) >= 0) {
                $("input[id^='Num']").each(function () {
                    $(this).val($(this).val().replace(/[^\d]/g, ''));
                    var num = $(this).val();
                    var Title = $(this).attr("title");

                    if (Title.indexOf("B") > -1) {
                        $(this).val("");
                    }
                });
            }

            if (StrTitle.indexOf("B") > -1 && parseInt(value) >= 0) {
                $("input[id^='Num']").each(function () {
                    $(this).val($(this).val().replace(/[^\d]/g, ''));
                    var num = $(this).val();
                    var Title = $(this).attr("title");

                    if (Title.indexOf("C") > -1) {
                        $(this).val("");
                    }
                });
            }

        }


        var regNum = /^\d+$/;
        var regPrice = /^\d+(\.\d+)?$/;
        function CountTotalPrice() {
            $("input[id^='Num']").each(function () {
                $(this).val($(this).val().replace(/[^\d]/g, ''));
                var num = $(this).val();
                var price = $(this).attr("price");

                var total = 0;
                if (regNum.test(num) && regPrice.test(price)) {
                    total += parseInt(num) * parseFloat(price);
                }
                $(this).parent().parent().find("td[total]").html(total);
            });

            var allTotalPrice = 0;
            $("td[total]").each(function () {
                var totalPrice = $(this).html();
                if (regPrice.test(totalPrice)) {
                    allTotalPrice += parseFloat(totalPrice);
                }
            });
            $("td[alltotal]").html(allTotalPrice);
        }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <center>
            <form id="f1" action="" method="post">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td align="right">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="left" style="width:80px;">截止日期：</td>
                                <td align="left" style="width:80px;"><%=ViewData["EndDate"] %></td>
                                <td align="left" style="width:80px;">提交日期：</td>
                                <td align="left" style="width:80px;"><%=ViewData["SubDate"] %></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td align="left">
                        参展企业除了在展出面积，展位装修方面下重金，如何更好令自己成为PFA整场焦点？新品是你聚集现场人流，促使展位脱颖而出最终达成贸易合作的推广利器。PFA2014 特别推出宠物新风尚- 新品推广组合方案，为您达成这一切。详情请联络主办方。
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td align="left" style="line-height:30px">
                        <a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/DataFile/ExhSettingFiles/<%=Session["ExhID"] %>/PFA2014 InnovAction Campaign.pps" target="_blank">下载PFA2014 InnovAction宠物新风尚（新品推广活动）详细方案</a><br />

                        <a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/DataFile/ExhSettingFiles/<%=Session["ExhID"] %>/PFA2014 InnovAction申请表.pdf" target="_blank">PFA2014 InnovAction申请表</a>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td align="left">
                        <strong>2014宠物新风尚新品推广方案：</strong>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <table width="100%" border="0" cellpadding="1" cellspacing="0">
                            <tr>
                                <td class="td01" width="20%" align="center">宣传项目</td>
                                
                                <td class="td01" width="25%" align="center">包含服务 </td>
                                <%--<td class="td01" width="10%" align="center">单位</td>--%>
                                <td class="td01" width="10%" align="center">价格 元/展期</td>
                                <td class="td01" width="10%" align="center">数量</td>
                                <td class="td01" width="10%" align="center">小计</td>
                            </tr>
                        <% 
                            System.Data.DataTable dt = ViewData["DataTable"] as System.Data.DataTable;
                            if (dt.Rows.Count > 0)
                            {
                                foreach (System.Data.DataRow dr in dt.Rows)
                                {
                                    string scale = dr["SrjScale"].ToString().Trim();
                                    string price = "";
                                    string disabled = "";
                                    if (dr["SrjSalePrice"].ToString() == "0.00")
                                    {
                                        price = "免费";
                                        disabled = "disabled";
                                    }
                                    else
                                    {
                                        price = dr["SrjSalePrice"].ToString(); 
                                    }
                                    
                        %>
                            <tr>
                                <td class="td03" align="left"><%=Server.HtmlEncode(dr["SrjName"].ToString()) %></td>
                                
                                <td class="td03" align="left">&nbsp;<%=Server.HtmlEncode(dr["SrjIntro"].ToString()).Replace("&lt;", "<").Replace("&gt;", ">")%></td>
                                <%--<td class="td03" align="center">&nbsp;<%=Server.HtmlEncode(dr["SrjUnit"].ToString())%></td>--%>
                                <% if (scale != "联系我们")
                                   { %>
                                <td class="td03" align="center"><%=price%></td>
                                <td class="td03" align="center">
                                    <input type="text" class="text" id="Num<%=dr["SrjID"] %>" <%=disabled %> name="Num<%=dr["SrjID"] %>" price="<%=dr["SrjSalePrice"] %>" value="<%=Server.HtmlEncode(dr["OddTotalNum"].ToString()) %>" style="text-align:center; line-height:14px; width:50px; height:14px" onkeyup="ChangePackage(this.title,this.value);CountTotalPrice();" title="<%=Server.HtmlEncode(dr["SrjName"].ToString()) %>" />
                                </td>
                                <td class="td03" align="center" total="total"></td>
                                <% }
                                   else
                                   { %>
                                <td class="td03" align="center">-</td>
                                <td class="td03" align="center">-</td>
                                <td class="td03" align="center">-</td>
                                <% } %>
                            </tr>
                        <%            
                                }
                        %>
                            <tr>
                                <td class="td03" align="center" colspan="1">费用合计:</td>
                                <td class="td03" align="center" colspan="4" alltotal="alltotal"></td>
                            </tr>
                            <tr><td colspan="6">&nbsp;</td></tr>
                            <tr>
                                <td align="right" colspan="5">
                                    <table border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td><div class="button" onclick="Save()">提交</div></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        <%
                            }
                            else
                            { 
                        %>
                            <tr>
                                <td colspan="5" class="td03" align="center" valign="middle" height="40" width="100%">暂无信息</td>
                            </tr>
                        <%      
                            } 
                        %>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="hidden" id="OrderStr" name="OrderStr" />
                    </td>
                </tr>
            </table>
            <script type="text/javascript">
                $(function () {
                    var message = $("#Message").val();
                    if (message != "") {
                        showMsg(message);
                    }
                });
            </script>
            <input type="hidden" id="Message" name="Message" value="<%=ViewData["Message"] %>" />
            </form>
        </center>
    </div>
</asp:Content>