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

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" src="../lodop/LodopFuncs.js"></script>
    <object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0"
        height="0">
        <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0" pluginspage="../lodop/install_lodop.exe"></embed>
    </object>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <yee:PageTitle ID="pgTitle" runat="server" Title="批量放货">
    </yee:PageTitle>
    <yee:MessageBox ID="msg" runat="server"></yee:MessageBox>
    <div class="query">
        <td>
            <%=GetText("仓储中心") %>：
        </td>
        <td>
            <yee:UserWarehousesDropDownList ID="UserWarehousesDropDownList" runat="server" WarehouseType="海外仓储">
            </yee:UserWarehousesDropDownList>
        </td>
        <td>
            <%=GetText("流水号") %>：
        </td>
        <td>
            <asp:TextBox runat="server" ID="txtSerialNo"></asp:TextBox>
        </td>

        <td>
            <asp:Button runat="server" ID="btnScan" OnClick="btnScan_Click" Text="扫描" CssClass="button"></asp:Button>
        </td>
    </div>
    <asp:Repeater runat="server" ID="rptBoxList" OnItemDataBound="rptBoxList_ItemDataBound">
        <HeaderTemplate>
            <table cellpadding="0" cellspacing="0" class="table">
                <tr>

                    <td class="tbheader" style="width: 15px">序号</td>
                    <td class="tbheader" style="width: 100px">箱子流水号</td>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="tbrow">

                <td class="tbpost">
                    <asp:Literal ID="litSort" runat="server"></asp:Literal>
                    <asp:HiddenField ID="hfBoxId" runat="server" Value='<%#Eval("BoxId") %>' />
                </td>
                <td class="tbpost">
                    <asp:Label ID="labBoxNo" runat="server" Text='<%# Eval("BoxSerialNo") %> '></asp:Label>
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr class="tbrowalter">

                <td class="tbpost">
                    <asp:Literal ID="litSort" runat="server"></asp:Literal>
                    <asp:HiddenField ID="hfBoxId" runat="server" Value='<%#Eval("BoxId") %>' />
                </td>
                <td class="tbpost">
                    <asp:Label ID="labBoxNo" runat="server" Text='<%# Eval("BoxSerialNo") %> '></asp:Label>
                </td>
            </tr>
        </AlternatingItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>

    <yee:Button ID="btnRelease" runat="server" CssClass="button" Text="批量放货" OnClick="btnRelease_Click" />
    <script language="javascript" type="text/javascript">
        var LODOP; //声明为全局变量

        function loda_huo_preview() {
            var id = $("#hfBoxIds").val();

            $.get("../Ajax/GetBoxDetails.ashx", { id: id }, function (data) {
                CreateNormalFormPageByLoda(data);
                //LODOP.PRINT_DESIGN();
                LODOP.PREVIEW();
                //LODOP.PRINT();
            });
        }

        function loda_huo_print(id) {

            $.get("../Ajax/GetBoxDetails.ashx", { id: id }, function (data) {
                CreateNormalFormPageByLoda(data);

                LODOP.PRINT();
            });
        }

        function CreateNormalFormPageByLoda(data) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));

            var arr = eval(data);
            var len = parseInt(arr.length);
            var orderNo = "";
            var customer = "";
            var name = "";
            var warehouse = "";
            var stockouton = "";
            var stockoutname = "";
            var language = $("#hfLanguage").val();//语言版本

            var boxTitle = "箱子号";
            var codeTitle = "提货码";
            var typeTitle = "运输类型";
            var volumeTitle = "体积";
            var freightTitle = "运费";
            var customerTitle = "客户签名处";
            var adminTitle = "操作员";
            var stockTitle = "提货时间";
            var nameTitle = "客户名称";
            var customerCodeTitle = "客户代号";
            var boxInfoTitle = "箱子信息";
            if (language != "CN") {
                boxTitle = "Box number";
                codeTitle = "Code";
                typeTitle = "Type";
                volumeTitle = "Volume";
                freightTitle = "Freight";
                customerTitle = "Customer signature";
                adminTitle = "Operator";
                stockTitle = "Pickup time";
                nameTitle = "Customer Name";
                customerCodeTitle = "CustomerCode";
                boxInfoTitle = "Box information";
            }

            //PMingLiU  SimSun
            var htmlstr = "<table style=\"font-size:12px;text-align:center;font-family:SimSun;font-weight:100\"><tr><td >" + boxTitle + "</td><td >" + codeTitle + "&nbsp;</td><td >" + typeTitle + "</td></tr>";
            htmlstr += "<tr><td colspan=\"3\">（" + volumeTitle + " &nbsp;&nbsp;&nbsp;&nbsp;" + freightTitle + "）</td></tr>";
            for (var i = 0; i < len; i++) {
                htmlstr += "<tr><td >" + arr[i].Serail + "&nbsp;" + arr[i].StorageCode + "</td><td >" + arr[i].VerificationCode + "</td><td >" + arr[i].FreightType + "</td></tr>";
                htmlstr += "<tr><td colspan=\"3\">（" + arr[i].PostalCode + "&nbsp;&nbsp;&nbsp;&nbsp;" + arr[i].CN2THFreightAmount + "）</td></tr>";

                if (customer == "") {
                    customer = arr[i].CustomerCode;
                }
                if (name == "") {
                    name = arr[i].CustomerName;
                }

                if (stockouton == "") {
                    stockouton = arr[i].PrintStockOutOn;
                }
                if (stockoutname == "") {
                    stockoutname = arr[i].VerificationByName;
                }
            }
            htmlstr += "</table>";

            LODOP.PRINT_INITA(-5, -5, 197, 667, "");
            LODOP.SET_PRINT_PAGESIZE(3, 520, 0, "CreateCustomPage");
            LODOP.ADD_PRINT_HTM("101.49mm", "3.604%", "55.01mm", "744.798%", htmlstr);
            LODOP.ADD_PRINT_TEXT(20, 28, 144, 25, customerTitle);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(92, 56, 75, 20, adminTitle);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(111, 25, 137, 20, stockoutname);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(65, 21, 165, 29, "_ _ _ _ _ _ _ _ _ _");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(137, 42, 100, 20, stockTitle);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(163, 20, 154, 20, stockouton);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(184, 15, 165, 29, "  _ _ _ _ _ _ _ _ _ \n");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(219, 43, 100, 20, nameTitle);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(241, 21, 140, 25, name);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(266, 45, 100, 20, customerCodeTitle);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(286, 47, 97, 25, customer);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(339, 27, 133, 35, boxInfoTitle);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT(308, 16, 161, 25, "  _ _ _ _ _ _ _ _ _ \n");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINTER_INDEXA("outPrinterAB58GK");
        };
    </script>
</asp:Content>