<%@ Page Title="" Language="C#" MasterPageFile="~/CTWOrder/Pay.Master" AutoEventWireup="true" CodeBehind="MergePay.aspx.cs" Inherits="GxHub.Wms.Abroad.Web.CTWOrder.MergePay" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Scripts/bootstrap_3.3.7_css_bootstrap.min[1].css" rel="stylesheet" />
    <link href="../Scripts/bootstrap-select.min.css" rel="stylesheet" />
    <script src="../Scripts/jquery-3.3.1.js"></script>
    <script src="../Scripts/bootstrap_3.3.7_js_bootstrap.min.js"></script>
    <script src="../Scripts/bootstrap-select.min.js"></script>
    <script language="javascript">

        $(function () {

            $(".num").blur(function () {

                var sum = 0;
                $(".num").each(function () {

                    var amount = $(this).val().trim();
                    if (isNaN(amount)) {
                        alert("不能输入字母");
                        $(this).val(0);
                    }
                    else {
                        sum += changeTwoDecimal(parseFloat(amount));

                    }
                })
                sum = changeTwoDecimal(sum);
                $("#lbTotalAmount").text(sum);
                $("#hfTotalAmount").val(sum);
            })

        })
        function changeTwoDecimal(x) {
            var f_x = parseFloat(x);
            if (isNaN(f_x)) {
                alert('function:changeTwoDecimal->parameter error');
                return false;
            }
            var f_x = Math.round(x * 100) / 100;
            return f_x;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <yee:MessageBox ID="msg" runat="server">
    </yee:MessageBox>

    <yee:PageTitle ID="pgTitle" runat="server" Title="合并付款">
        <ShortCuts>
            <a href="AbroadReceiveList.aspx">返回列表</a>
        </ShortCuts>
    </yee:PageTitle>
    <asp:Repeater ID="rptList" runat="server" OnItemDataBound="rptList_ItemDataBound">
        <HeaderTemplate>
            <table cellpadding="0" cellspacing="0" border="0" class="table" id="table">
                <tr>

                    <td class="tbheader" width="100px">
                        <%=GetText("序号") %>
                    </td>
                    <td class="tbheader">
                        <%=GetText("签收日期") %>
                    </td>

                    <td class="tbheader">
                        <%=GetText("重量")%>(KG)
                    </td>
                    <td class="tbheader">
                        <%=GetText("体积") %>(m³)
                    </td>
                    <td class="tbheader">
                        <%=GetText("集包数") %>
                    </td>
                    <td class="tbheader">
                        <%=GetText("单据重量")%>(KG)
                    </td>
                    <td class="tbheader">
                        <%=GetText("单据体积") %>(m³)
                    </td>
                    <td class="tbheader">
                        <%=GetText("物流公司") %>
                    </td>
                    <td class="tbheader">
                        <%=GetText("国际物流费") %>
                    </td>
                    <td class="tbheader">
                        <%=GetText("送货费") %>
                    </td>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="tbrow" style="text-align: center">

                <td class="tbpost">
                    <asp:Literal ID="litNo" runat="server"></asp:Literal>
                    <asp:HiddenField ID="hfId" runat="server" Value=' <%# Eval("RecordId")%>' />
                </td>
                <td class="tbpost">
                    <%# Eval("ReceivedOn","{0:d}")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalWeight")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalVolume")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CollectCount")%>
                </td>
                <td class="tbpost">
                    <%# Eval("comTotalWeight")%>
                </td>
                <td class="tbpost">
                    <%# Eval("comTotalVolume")%>
                </td>
                <td class="tbpost">
                    <%# Eval("Company")%>
                </td>
                <td class="tbpost">
                    <asp:TextBox ID="txtCn2ThFreight" runat="server" Text='<%# Eval("CN2THFreightAmount")%>' CssClass="num"></asp:TextBox>
                </td>
                <td class="tbpost">
                    <asp:TextBox ID="txtFreight" runat="server" Text='<%# Eval("FreightAmount")%>' CssClass="num"></asp:TextBox>
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr class="tbrowalter">

                <td class="tbpost">
                    <asp:Literal ID="litNo" runat="server"></asp:Literal>
                    <asp:HiddenField ID="hfId" runat="server" Value=' <%# Eval("RecordId")%>' />
                </td>
                <td class="tbpost">
                    <%# Eval("ReceivedOn","{0:d}")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalWeight")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalVolume")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CollectCount")%>
                </td>
                <td class="tbpost">
                    <%# Eval("comTotalWeight")%>
                </td>
                <td class="tbpost">
                    <%# Eval("comTotalVolume")%>
                </td>
                <td class="tbpost">
                    <%# Eval("Company")%>
                </td>
                <td class="tbpost">
                    <asp:TextBox ID="txtCn2ThFreight" runat="server" Text='<%# Eval("CN2THFreightAmount")%>' CssClass="num"></asp:TextBox>
                </td>
                <td class="tbpost">
                    <asp:TextBox ID="txtFreight" runat="server" Text='<%# Eval("FreightAmount")%>' CssClass="num"></asp:TextBox>
                </td>
            </tr>
        </AlternatingItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>

    <table cellpadding="0" cellspacing="0" class="table" border="0">
        <tr>
            <td class="tbpostheader">
                <%=GetText("合计金额") %>：
            </td>
            <td class="tbpost">
                <asp:Label ID="lbTotalAmount" runat="server" ClientIDMode="Static"></asp:Label>
                <asp:HiddenField ID="hfTotalAmount" runat="server" ClientIDMode="Static" />
            </td>
        </tr>

        <tr>
            <td class="tbpostheader">
                <%=GetText("支付时间") %>
            </td>
            <td class="tbpost">
                <yee:DatePicker runat="server" ID="dtPayOn" />
            </td>
        </tr>
        <tr>
            <td class="tbpostheader">
                <%=GetText("支付账号") %>：
            </td>
            <td class="tbpost">
                <yee:PayAccountDropDownList runat="server" ID="payAccount" CardType="储蓄卡" OnSelectedIndexChanged="payAccount_SelectedIndexChanged" AutoPostBack="true" data-live-search="true" CssClass="selectpicker"></yee:PayAccountDropDownList>
            </td>
        </tr>
        <tr id="tr_rate" runat="server" visible="false">
            <td class="tbpostheader">
                <%=GetText("汇率") %>
            </td>
            <td class="tbpost">
                <asp:TextBox ID="txtRate" runat="server" Text="7.0"></asp:TextBox>
                RMB-><asp:Literal ID="litTarCode" runat="server" ></asp:Literal>
            </td>
        </tr>
        <tr>
            <td class="tbfooter"></td>
            <td class="tbfooter">
                <asp:Button ID="btSave" runat="server" CssClass="button" Text="提交" OnClick="btSave_Click" />
            </td>
        </tr>
    </table>
</asp:Content>