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

<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="ptTitle" runat="server">
        <ShortCuts>
            <a href="GetAbroadStockOutCardRecordList.aspx" title="返回装车列表">返回装车列表</a>
        </ShortCuts>
    </yee:PageTitle>
    <yee:MessageBox ID="msg" runat="server">
    </yee:MessageBox> 
    <div class="query">
        <table cellpadding="0" cellspacing="0" border="0" class="table">
            <tr>
                <td class="tbpostheader">
                    <%=GetText("仓库") %>
                </td>
                <td class="tbpost">
                    <yee:UserWarehousesDropDownList runat="server" WarehouseType="海外仓储" ID="ddlWare"></yee:UserWarehousesDropDownList>
                </td>
            </tr>

            <tr>
                <td class="tbpostheader">
                    <%=GetText("配送单号") %>
                </td>
                <td class="tbpost">
                    <asp:TextBox ID="txtOrderNo" runat="server" Font-Size="XX-Large"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tbpostheader"></td>
                <td class="tbpost">
                    <asp:Button ID="btnLoadCar" runat="server" CssClass="button" OnClick="btnLoadCar_Click" />
                </td>
            </tr>
        </table>
    </div>

    <asp:Repeater ID="rptList" runat="server" OnItemDataBound="rptList_ItemDataBound" OnItemCommand="rptList_ItemCommand">
        <HeaderTemplate>
            <table cellpadding="0" class="table" cellspacing="0" border="0">
                <tr>
                    <td class="tbheader" width="50px">
                        <%=GetText("序号") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("配送单号") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("状态") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("拣货时间") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("拣货员") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("装车时间") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("派送时间") %>
                    </td>
                    <td class="tbheader" width="200px">
                        <%=GetText("操作") %>
                    </td>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="tbrow">
                <td class="tbpost">
                    <%#Eval("number") %>
                </td>
                <td class="tbpost">
                    <%#Eval("OrderNo") %>
                </td>
                <td class="tbpost">
                    <%#Eval("StatuName") %>
                </td>
                <td class="tbpost">
                    <%#Eval("OperationTime") %>
                </td>
                <td class="tbpost">
                    <%#Eval("OperationByName") %>
                </td>
                <td class="tbpost">
                    <%#Eval("LoadCarTime") %>
                </td>
                <td class="tbpost">
                    <%#Eval("ReleaseTime") %>
                </td>
                <td class="tbpost">
                    <asp:LinkButton ID="lbnDetail" runat="server" CommandArgument='<%#Eval("TransnationalId") %>' CommandName="detail" Text="配送详情"></asp:LinkButton>
                    <asp:LinkButton ID="lbnRemove" runat="server" CommandArgument='<%#Eval("TransnationalId") %>' CommandName="remove" Text="移除"></asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>

        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater> 
         
    <div id="div_print" style="display: none">
        <asp:Repeater ID="rptPrint" runat="server">
            <HeaderTemplate>
                <table cellpadding="0" class="table" cellspacing="0" border="0">
                    <tr>
                        <td class="tbheader" width="20px">លេខ
                        </td>
                        <td class="tbheader">លេខដឹកញ្ជូន
                        </td>
                        <td class="tbheader" style="width: 30px">អត្តលេខ
                           អតិថិជន
                        </td>
                        <td class="tbheader">ឈ្មោះអ
                           តិថិជន
                        </td>
                        <td class="tbheader">លេខទូរសព្ទ័
                        </td>
                        <td class="tbheader" colspan="2">តំបន់
                        </td>
                        <td class="tbheader" style="width: 450px">អាសយដ្ឋាន
                        </td>
                        <td class="tbheader" width="50px">សម្គាល់
                        </td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tbrow">
                    <td class="tbpost">
                        <%#Eval("number") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("OrderNo") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("CustomerCode") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("ReceiverName") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("Mobile") %>
                    </td>
                    <td class="tbpost" style="width: 50px">
                        <%#Eval("DistrictName") %>
                    </td>
                    <td class="tbpost" style="width: 50px">
                        <%#Eval("DistritCnName") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("Address") %>
                    </td>
                    <td class="tbpost"></td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr class="tbrowalter">
                    <td class="tbpost">
                        <%#Eval("number") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("OrderNo") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("CustomerCode") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("ReceiverName") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("Mobile") %>
                    </td>
                    <td class="tbpost" style="width: 50px">
                        <%#Eval("DistrictName") %>
                    </td>
                    <td class="tbpost" style="width: 50px">
                        <%#Eval("DistritCnName") %>
                    </td>
                    <td class="tbpost">
                        <%#Eval("Address") %>
                    </td>
                    <td class="tbpost"></td>
                </tr>
            </AlternatingItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
    </div>
    <asp:HiddenField ID="hfRecordId" runat="server" ClientIDMode="Static" />
    <asp:HiddenField ID="hfDate" runat="server" ClientIDMode="Static" />

    <asp:Button ID="btnPrint" runat="server" CssClass="button" OnClick="btnPrint_Click" />
    <asp:Button ID="btnA4Print" runat="server" CssClass="button" OnClick="btnA4Print_Click" Text="A4打印" />

    <asp:Button ID="btnExport" runat="server" CssClass="button" OnClick="btnExport_Click" Text="导出Excel" />
    <script language="javascript" type="text/javascript">
        var LODOP; //声明为全局变量

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

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

            });
        }

        function loda_huo_print(id) {
            var id = $("#hfRecordId").val();

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

            });
        }

        function CreateNormalFormPageList(data) {

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

            var arrList = eval(data);
            var listLen = parseInt(arrList.length);
            for (var j = 0; j < listLen; j++) {
                var arr = eval(arrList[j]);

                var orderNo = arr.OrderNo;
                var customer = arr.CustomerName;
                var code = arr.CustomerCode;
                var Mobile = arr.Mobile;
                var Address = arr.Address;
                LODOP.SET_PRINT_PAGESIZE(3, 520, 0, "CreateCustomPage");
                LODOP.ADD_PRINT_BARCODE(11, 17, 129, 245, "128Auto", orderNo);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 11);
                LODOP.SET_PRINT_STYLEA(0, "Angle", -90);
                LODOP.ADD_PRINT_TEXT(257, 8, 125, 25, "Code：" + code);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 11);
                LODOP.ADD_PRINT_TEXT(241, 9, 140, 20, "Tel：" + Mobile);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
                LODOP.ADD_PRINT_TEXT(279, 8, 148, 86, Address);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 14);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(220, 10, 176, 20, orderNo);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 14);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.PRINT();
            }

            return true;

        };

        function CreateOneFormPage(orderno,createdate,printdate) {

                    LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));
                    LODOP.PRINT_INIT("打印控件");
                    LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4");
                    LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1);
                    var strStyle = "<style> table,td,th {border:solid 1px black;border-collapse: collapse} table{width:100%}</style>"
                    LODOP.ADD_PRINT_TABLE(110, "2%", "97%", 450, strStyle + document.getElementById("div_print").innerHTML);
                    LODOP.SET_PRINT_STYLEA(0, "TableHeightScope", 1);
                    LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
                    LODOP.ADD_PRINT_TEXT(8,25,953,42,"配送单："+orderno);
                    LODOP.SET_PRINT_STYLEA(0,"FontSize",24);
                    LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                    LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                    LODOP.ADD_PRINT_TEXT("95%",653,135,20,"第#页/共&页");
                    LODOP.SET_PRINT_STYLEA(0,"ItemType",2);
                    LODOP.SET_PRINT_STYLEA(0,"Horient",1);
                    LODOP.ADD_PRINT_TEXT(59,225,260,25,"装车时间： "+createdate);
                    LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                    LODOP.ADD_PRINT_TEXT(82,224,262,25,"打印时间： "+printdate);
                    LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                    LODOP.ADD_PRINT_TEXT(58,531,257,40,"派件员：");
                    LODOP.SET_PRINT_STYLEA(0,"FontSize",11);

                    //LODOP.SET_PRINTER_INDEXA("PrinterHPA4")
                    //LODOP.PRINT_DESIGN();
                    //LODOP.PREVIEW();
                    LODOP.PRINT();
                };
    </script>
</asp:Content>