<%@ 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("水电、通讯设备租赁", "");

            CountTotalPrice("Wat");
            CountTotalPrice("Ele");
            CountTotalPrice("Com");

//            if ($("#BoothType").val() == "光地" && $("#Insurance").val() == "0") {
//                alert("您即将进入保险信息页面，详情请阅读网页内相关内容。");
//                window.location.href = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/InsuranceBook";
//                return;
//            }


        });

        function Save() {
            SetOrderStr("Wat");
            SetOrderStr("Ele");
            SetOrderStr("Com");

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

            $("#f1").submit();
        }
        function SetOrderStr(type) {
            var orderStr = "";
            $("div[id='" + type + "'] 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 + ";";
                }
            });
            $("#" + type + "OrderStr").val(orderStr);
        }

        var regNum = /^\d+$/;
        var regPrice = /^\d+(\.\d+)?$/;
        function CountTotalPrice(type) {
            $("div[id='" + type + "'] 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;
            $("div[id='" + type + "'] td[total]").each(function () {
                var totalPrice = $(this).html();
                if (regPrice.test(totalPrice)) {
                    allTotalPrice += parseFloat(totalPrice);
                }
            });
            $("div[id='" + type + "'] 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">
                        主场搭建代收费用。<br />
                        截止日期过后，此项服务一般不再受理。若受理，租赁费将加收30％。<br />
                        开展前两周的订单租赁费将加收50%的附加费。<br />
                        现场租赁，租赁费将加收50％。未列出的项目将另行报价。<br />
                        所有租赁的项目不得调换或自行交换。<br />
                        所有取消的预定，将不予退款。<br />
                        <br />
                        下面所列的单价是指从搭建开始的整个展会期间，您需支付的费用
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td align="left">
                        <strong>电和电力设备：</strong>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <div id="Ele">
                            <table width="100%" border="0" cellpadding="1" cellspacing="0">
                                <tr>
                                    <td class="td01" width="20%" align="center">名称</td>
                                    <%--<td class="td01" width="15%" align="center">规格</td>
                                    <td class="td01" width="10%" align="center">单位</td>--%>
                                    <td class="td01" width="10%" align="center">单价（RMB）</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>
                                </tr>
                            <% 
                                System.Data.DataTable dtEle = ViewData["DataTableEle"] as System.Data.DataTable;
                                if (dtEle.Rows.Count > 0)
                                {
                                    foreach (System.Data.DataRow drEle in dtEle.Rows)
                                    {
                            %>
                                <tr>
                                    <td class="td03" align="left"><%=Server.HtmlEncode(drEle["SrjName"].ToString())%></td>
                                    <%--<td class="td03" align="center"><%=Server.HtmlEncode(drEle["SrjScale"].ToString())%></td>
                                    <td class="td03" align="center"><%=Server.HtmlEncode(drEle["SrjUnit"].ToString())%></td>--%>
                                    <td class="td03" align="center"><%=Server.HtmlEncode(drEle["SrjSalePrice"].ToString())%></td>
                                    <%--<td class="td03" align="center"><%=Server.HtmlEncode(drEle["SrjIntro"].ToString())%></td>--%>
                                    <td class="td03" align="center">
                                        <input type="text" class="text" id="Num<%=drEle["SrjID"] %>" name="Num<%=drEle["SrjID"] %>" price="<%=drEle["SrjSalePrice"] %>" value="<%=Server.HtmlEncode(drEle["OddTotalNum"].ToString()) %>" style="text-align:center; line-height:14px; width:50px; height:14px" onkeyup="CountTotalPrice('Ele')" />
                                    </td>
                                    <td class="td03" align="center" total="total"></td>
                                </tr>
                            <%            
                                    }
                            %>
                                <tr>
                                    <td class="td03" align="center" colspan="1">费用合计：</td>
                                    <td class="td03" align="center" colspan="3" alltotal="alltotal"></td>
                                </tr>
                            <%
                                }
                                else
                                { 
                            %>
                                <tr>
                                    <td colspan="4" class="td03" align="center" valign="middle" height="40" width="100%">暂无信息</td>
                                </tr>
                            <%      
                                } 
                            %>
                                <tr>
                                    <td align="left" colspan="4">
                                        <table border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="left">注意：</td>
                                                <td align="left">安全起见，我们不允许标准展台的展商自带电力或照明设备。</td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr><td>&nbsp;</td></tr>
                            </table>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <strong>通讯设备：</strong>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div id="Com">
                            <table width="100%" border="0" cellpadding="1" cellspacing="0">
                                <tr>
                                    <td class="td01" width="20%" align="center">名称</td>
                                    <%--<td class="td01" width="15%" align="center">规格</td>
                                    <td class="td01" width="10%" align="center">单位</td>--%>
                                    <td class="td01" width="10%" align="center">单价（RMB）</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>
                                </tr>
                            <% 
                                System.Data.DataTable dtCom = ViewData["DataTableCom"] as System.Data.DataTable;
                                if (dtCom.Rows.Count > 0)
                                {
                                    foreach (System.Data.DataRow drCom in dtCom.Rows)
                                    {
                            %>
                                <tr>
                                    <td class="td03" align="left"><%=Server.HtmlEncode(drCom["SrjName"].ToString())%></td>
                                    <%--<td class="td03" align="center"><%=Server.HtmlEncode(drCom["SrjScale"].ToString())%></td>
                                    <td class="td03" align="center"><%=Server.HtmlEncode(drCom["SrjUnit"].ToString())%></td>--%>
                                    <td class="td03" align="center"><%=Server.HtmlEncode(drCom["SrjSalePrice"].ToString())%></td>
                                    <%--<td class="td03" align="center"><%=Server.HtmlEncode(drCom["SrjIntro"].ToString())%></td>--%>
                                    <td class="td03" align="center">
                                        <input type="text" class="text" id="Num<%=drCom["SrjID"] %>" name="Num<%=drCom["SrjID"] %>" price="<%=drCom["SrjSalePrice"] %>" value="<%=Server.HtmlEncode(drCom["OddTotalNum"].ToString()) %>" style="text-align:center; line-height:14px; width:50px; height:14px" onkeyup="CountTotalPrice('Com')" />
                                    </td>
                                    <td class="td03" align="center" total="total"></td>
                                </tr>
                            <%            
                                    }
                            %>
                                <tr>
                                    <td class="td03" align="center" colspan="1">费用合计：</td>
                                    <td class="td03" align="center" colspan="3" alltotal="alltotal"></td>
                                </tr>
                            <%
                                }
                                else
                                { 
                            %>
                                <tr>
                                    <td colspan="4" class="td03" align="center" valign="middle" height="40" width="100%">暂无信息</td>
                                </tr>
                            <%      
                                } 
                            %>
                                <tr><td>&nbsp;</td></tr>
                            </table>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <strong>展台用水、用气：</strong>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div id="Wat">
                            <table width="100%" border="0" cellpadding="1" cellspacing="0">
                                <tr>
                                    <td class="td01" width="20%" align="center">名称</td>
                                    <%--<td class="td01" width="15%" align="center">规格</td>
                                    <td class="td01" width="10%" align="center">单位</td>--%>
                                    <td class="td01" width="10%" align="center">单价（RMB）</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>
                                </tr>
                            <% 
                                System.Data.DataTable dtWat = ViewData["DataTableWat"] as System.Data.DataTable;
                                if (dtWat.Rows.Count > 0)
                                {
                                    foreach (System.Data.DataRow drWat in dtWat.Rows)
                                    {
                            %>
                                <tr>
                                    <td class="td03" align="left"><%=Server.HtmlEncode(drWat["SrjName"].ToString())%></td>
                                    <%--<td class="td03" align="center"><%=Server.HtmlEncode(drWat["SrjScale"].ToString())%></td>
                                    <td class="td03" align="center"><%=Server.HtmlEncode(drWat["SrjUnit"].ToString())%></td>--%>
                                    <td class="td03" align="center"><%=Server.HtmlEncode(drWat["SrjSalePrice"].ToString())%></td>
                                    <%--<td class="td03" align="center"><%=Server.HtmlEncode(drWat["SrjIntro"].ToString())%></td>--%>
                                    <td class="td03" align="center">
                                        <input type="text" class="text" id="Num<%=drWat["SrjID"] %>" name="Num<%=drWat["SrjID"] %>" price="<%=drWat["SrjSalePrice"] %>" value="<%=Server.HtmlEncode(drWat["OddTotalNum"].ToString()) %>" style="text-align:center; line-height:14px; width:50px; height:14px" onkeyup="CountTotalPrice('Wat')" />
                                    </td>
                                    <td class="td03" align="center" total="total"></td>
                                </tr>
                            <%            
                                    }
                            %>
                                <tr>
                                    <td class="td03" align="center" colspan="1">费用合计：</td>
                                    <td class="td03" align="center" colspan="3" alltotal="alltotal"></td>
                                </tr>
                            <%
                                }
                                else
                                { 
                            %>
                                <tr>
                                    <td colspan="4" class="td03" align="center" valign="middle" height="40" width="100%">暂无信息</td>
                                </tr>
                            <%      
                                } 
                            %>
                                <tr><td>&nbsp;</td></tr>
                            </table>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="right" colspan="7">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td><div class="button" onclick="Save()">提交</div></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="hidden" id="WatOrderStr" name="WatOrderStr" />
                        <input type="hidden" id="EleOrderStr" name="EleOrderStr" />
                        <input type="hidden" id="ComOrderStr" name="ComOrderStr" />
                        <input type="hidden" id="BoothType" name="BoothType" value="<%=ViewData["BoothType"] %>" />
                        <input type="hidden" id="Insurance" name="Insurance" value="<%=ViewData["Insurance"] %>" />

                    </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>
