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

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>待支付国际运费
    </title>
    <script type="text/javascript">
        //使用checkbox当做全选反选
        function check_all_not() {
            var check = document.getElementById("checkboxAll").checked;
            //alert(check);
            if (check == true) {
                checkAll();
            }
            else {
                checkReverse();
            }
        }

        //选择
        function checkAll() {
            $(".check ").each(function () {
                var able = $(this).attr("disabled");
                if (able != 'disabled') {
                    $(this).attr("checked", true);
                }
            });
        }

        //反选
        function checkReverse() {
            $(".check ").each(function () {
                var able = $(this).attr("disabled");
                if (able != 'disabled') {
                    $(this).attr("checked", !($(this).attr("checked")));
                }
            });
        }

        function checkRemove() {
            $(".check ").each(function () {
                var able = $(this).attr("disabled");
                if (able != 'disabled') {
                    $(this).attr("checked", false);
                }
            });
        }

 //计算到账RMB金额
 function click_volume() {
  
      var rate = $('#txtRate').val();
      if(rate !== null && rate !== undefined && rate.trim() !== '' && !isNaN(parseFloat(rate))){
            var usdAmount = parseFloat($('#hfTotalUsdAmount').val());
            var rmbAmount = parseFloat($('#hfTotalRmbAmount').val()); 
            if(isNaN(usdAmount)){
                usdAmount = 0;
            }
            if(isNaN(rmbAmount)){
                rmbAmount = 0;
            }
                
            var amount = usdAmount + (rate * rmbAmount);
            $('#<%=txtTotalAmount.ClientID%>').val(amount.toFixed(2));
      }else{
            $('#<%=txtTotalAmount.ClientID%>').val(0.00);
      } 
     

 }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <yee:PageTitle ID="pgTitle" runat="server">
        <ShortCuts>
        </ShortCuts>
    </yee:PageTitle>
    <yee:MessageBox runat="server" ID="msg">
    </yee:MessageBox>
   

    <!--  查询及搜索未付款箱子信息 -->
    <div class="query">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="queryLeft"><%=GetText("国际单号") %>：</td>
                <td class="queryRigth">
                    <asp:TextBox ID="txtOrderNO" runat="server" style ="width:120px"></asp:TextBox>
                </td> 

                <td class="queryLeft">
                    <%=GetText("收货日期") %>：
                </td>
                <td class="queryRigth">
                    <yee:DatePicker ID="dpFrom" runat="server" IsRequired="true" />
                    - <yee:DatePicker ID="dpTo" runat="server" IsRequired="true" />
                </td>   

                <td class="queryLeft"> <%=GetText("每页条数") %>：</td>
                <td class="queryRigth">
                    <asp:TextBox ID="txtPageSize" runat="server" style ="width:50px"></asp:TextBox>
                </td>             
               
                 <td class="queryLeft"> <%=GetText("物流商") %>：
                 </td>
                 <td class="queryRigth">
                    
                     <asp:DropDownList ID="ddlCompanyId" runat="server">
                     </asp:DropDownList> 
                </td>
                 <td class="queryLeft">
                     <yee:Button ID="btnQuery" runat="server" CssClass="button" OnClick="btnQuery_Click" />
                 </td>
            </tr>
            <!--  <tr>
                 <td><%=GetText("付款状态") %>
                 </td>
                 <td colspan="2">
                     <asp:RadioButtonList ID="rblStatus" runat="server" RepeatDirection="Horizontal">
                         <asp:ListItem Value="0" Selected ="true" Text="未付款"></asp:ListItem>
                         <asp:ListItem Value="1" Text="已付款"></asp:ListItem>
                     </asp:RadioButtonList>
                 </td>                
            </tr> -->
        </table>
    </div>

    <div>
        <asp:Repeater ID="rptClaim" runat="server" OnItemDataBound="rptClaim_ItemDataBound">
            <HeaderTemplate>
                <table cellpadding="0" class="table" cellspacing="0" border="0" id="table1" style="margin-bottom: 0px;">
                    <tr>
                        <td class="tbheader" width="30px">
                            <input type="checkbox" id="checkboxAll" class="checkboxAll" onclick="check_all_not()" />
                        </td>
                        <td class="tbheader" align="center" width="100px">
                            <%=GetText("国际单号") %>
                        </td>
                        <td class="tbheader" align="center" width="200px">
                            <%=GetText("收货日期") %>
                        </td>
                        <td class="tbheader" align="center" width="100px">
                            <%=GetText("状态") %>
                        </td>
                        <td class="tbheader" align="center" width="100px">
                            <%=GetText("物流公司") %>
                        </td>
                        <td class="tbheader" align="center" width="100px">
                            <%=GetText("国际运费") %>
                        </td>
                        <td class="tbheader" align="center" width="100px">
                            <%=GetText("币种") %>
                        </td>
                        <td class="tbheader" align="center" width="100px">
                            <%=GetText("运输方式") %>
                        </td>
                       <!-- <td class="tbheader" align="center" width="100px">
                            <%=GetText("汇率") %>
                        </td> -->
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tbrow">
                    <td class="tbpost">
                        <input type="checkbox" id="cbItem" runat="server" class="check" />
                    </td>
                    <td class="tbpost">
                        <%# Eval("AbroadOrderNo")%>
                        <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("FeeID") %>' />
                    </td>
                    <td class="tbpost">
                        <%#Eval("ReceivedOn") %>
                    </td>
                    <td class="tbpost">
                       未付款
                    </td>
                    <td class="tbpost">
                        <%#Eval("TransportCompanyName") %>
                    </td>
                    <td class="tbpost">
                        <%# Eval("Credit")%>
                    </td>
                    <td class="tbpost">
                        <%# Eval("CurrencyCode")%>
                    </td>
                    <td class="tbpost">
                        <%# Eval("TransportTypeName")%>
                    </td>                 
                    <!--<td class="tbpost">
                       <asp:TextBox ID="txtTaxFee" runat="server" style = "width:70px"></asp:TextBox>
                    </td> -->
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr class="tbrowalter">
                    <td class="tbpost">
                        <input type="checkbox" id="cbItem" runat="server" class="check" />
                    </td>
                    <td class="tbpost">
                        <%# Eval("AbroadOrderNo")%>
                        <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("FeeID") %>' />
                    </td>
                    <td class="tbpost">
                        <%#Eval("ReceivedOn") %>
                    </td>
                    <td class="tbpost">
                       未付款
                    </td>                   
                    <td class="tbpost">
                        <%# Eval("TransportCompanyName")%>
                    </td>
                    <td class="tbpost">
                        <%# Eval("Credit")%>
                    </td>
                    <td class="tbpost">
                        <%# Eval("CurrencyCode")%>
                    </td>
                    <td class="tbpost">
                        <%# Eval("TransportTypeName")%>
                    </td>
                    <!--<td class="tbpost">
                      <asp:TextBox ID="txtTaxFee" runat="server" style = "width:70px"></asp:TextBox>
                    </td>-->
                </tr>
            </AlternatingItemTemplate>
            <FooterTemplate>
            </FooterTemplate>
        </asp:Repeater>
        <yee:Pager ID="Pager1" runat="server" PageSize = "10" PagerType="1" OnPageIndex_Changed="Pager1_PageIndex_Changed"
            PageIndex="0" />
    </div>
   

   <!-- <div class="subheader">
        <div class="title">
            <%=GetText("已选中行") %>
        </div>
        <div style="clear: both">
        </div>
    </div> -->

    <yee:PageTitle ID="pgTitleSelect" runat="server" Title = "选中行">
        <ShortCuts>
            <div style = "margin-top: 10px; text-align: right;">
                <yee:Button ID="btnPiAdd" runat="server" Text="批量添加" OnClick="btnBatchAdd_Click" />
            </div>
        </ShortCuts>
    </yee:PageTitle>

    <!-- 已添加的箱子列表，临时列表 -->
    <asp:Repeater ID="rptBoxList" runat="server" OnItemDataBound="rptBoxList_ItemDataBound" >
        <HeaderTemplate>
            <table cellpadding="0" class="table" cellspacing="0" border="0" id="table2" style = "margin-top: 0px;">
                <tr>
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("国际单号") %>
                    </td>
                    <td class="tbheader" align="center" width="200px">
                        <%=GetText("收货日期") %>
                    </td>
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("状态") %>
                    </td>
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("物流公司") %>
                    </td>
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("国际运费") %>
                    </td>
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("币种") %>
                    </td>
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("运输方式") %>
                    </td>
                <!--    <td class="tbheader" align="center" width="100px">
                        <%=GetText("汇率") %>
                    </td>   -->               
                    <td class="tbheader" align="center" width="100px">
                        <%=GetText("操作") %>
                    </td>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="tbrow">
                <td class="tbpost">
                    <%# Eval("AbroadOrderNo")%>
                    <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("FeeID") %>' />
                </td>
                <td class="tbpost">
                    <%#Eval("ReceivedOn") %>
                </td>
                <td class="tbpost">
                    未付款
                </td>
                <td class="tbpost">
                    <%# Eval("TransportCompanyName")%>
                </td>
                <td class="tbpost">
                    <%# Eval("Credit")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CurrencyCode")%>
                </td>
                <td class="tbpost">
                    <%#Eval("TransportTypeName") %>
                </td>
                <!--<td class="tbpost">
                    <%# Eval("TaxRate")%>
                </td> -->
                <td class="tbpost">
                    <asp:LinkButton ID="lbnRemove" runat="server" OnClick="lbnRemove_click"
                        CommandArgument='<%#Eval("FeeID") %>'><%=GetText("移除") %></asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr class="tbrowalter">
                <td class="tbpost">
                    <%# Eval("AbroadOrderNo")%>
                    <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("FeeID") %>' />
                </td>
                <td class="tbpost">
                    <%#Eval("ReceivedOn") %>
                </td>
                <td class="tbpost">
                    未付款
                </td>
                <td class="tbpost">
                    <%# Eval("TransportCompanyName")%>
                </td>
                <td class="tbpost">
                    <%# Eval("Credit")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CurrencyCode")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TransportTypeName")%>
                </td>
                <!-- <td class="tbpost">
                    <%# Eval("TaxRate")%>
                </td> -->
                <td class="tbpost">
                    <asp:LinkButton ID="lbnRemove" runat="server" OnClick="lbnRemove_click"
                        CommandArgument='<%#Eval("FeeID") %>'><%=GetText("移除") %>
                    </asp:LinkButton>
                </td>
            </tr>
        </AlternatingItemTemplate>
        <FooterTemplate>
        </FooterTemplate>
    </asp:Repeater>

    <!--<asp:HiddenField ID="hfFreightType" runat="server" />
    <asp:HiddenField ID="hfWarehouse" runat="server" /> -->
    <asp:HiddenField ID="hfTotalUsdAmount" runat="server"  clientidmode="static" />
    <asp:HiddenField ID="hfTotalRmbAmount" runat="server"  clientidmode="static" />

    <!-- 汇总信息 -->
    <table cellpadding="0" cellspacing="0" class="table">
        <tr>
           <td class="tbpostheader">
               <%=GetText("汇率(RMB=>USD)") %>
           </td>
           <td class="tbpost">
               <asp:TextBox ID="txtRate" runat="server" CssClass="count" ClientIDMode="Static" onchange="click_volume()"></asp:TextBox>
           </td>
        </tr>
        <tr>
            <td class="tbpostheader">
                <%=GetText("合计金额(USD)") %>
            </td>
            <td class="tbpost">
               <asp:TextBox ID="txtTotalAmount" runat="server" CssClass="count" ClientIDMode="Static"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="tbpostheader">
                <%=GetText("支付时间") %>
            </td>
            <td class="tbpost">
                <yee:DateTimePicker runat="server" ID="dtPayOn" />
            </td>
        </tr>
        <tr>
            <td class="tbpostheader">
                <%=GetText("支付账号(选择USD账号进行支付)") %>：
            </td>
            <td class="tbpost">
                <yee:PayAccountDropDownList runat="server" ID="payAccount" countries ="KH"  CardType="储蓄卡" AutoPostBack="true" data-live-search="true" CssClass="selectpicker"></yee:PayAccountDropDownList>
            </td>
        </tr>
        <tr>
            <td class="tbfooter"></td>
            <td class="tbfooter">
                <asp:Button ID="btSave" runat="server" CssClass="button" OnClick="btSave_Click" />
            </td>
        </tr>
    </table>
</asp:Content>