<%@ Page Language="C#" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Management" Assembly="Hishop.Web.Management" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Controls" Assembly="Hishop.Web.Controls" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Validator" Assembly="Hishop.Web.Validator" %>
<%@ Import Namespace="Hishop.SystemServices" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <Hishop:HeadContainer ID="HeadContainer1" runat="server" />
    <link rel="stylesheet" href="../../utility/validate/pagevalidator.css" type="text/css" />
    <link rel="stylesheet" href="../css/Hishopv5.css" type="text/css" />
    <script type="text/javascript" src="../../utility/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../../utility/validate/pagevalidator.js"></script>
    <script type="text/javascript" src="../js/Hishopv5.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <Hishop:EditOrder ID="EditOrder" runat="server" >
                <SkinTemplate>
                <Hishop:StatusMessage id="Status" runat="server" Visible="False" />
<!--订单的商品（自选配置列表）-->
<div class="grdHeaderStyle" style="cursor: pointer;">
    <ul>
        <li class="addProductTmpt" style="float: left;">
            <asp:Literal ID="litOrderItem" runat="server" Text="<%$Resources:OrderDetails,IDS_Label_OrderAmount%>"></asp:Literal>
        </li>
        <li style="float: left; padding-left: 20px;"><strong>
            <asp:Literal ID="lblOpen" Text="<%$Resources:OrderDetails,IDS_FormField_OrderNumber%>"
                runat="server"></asp:Literal>：</strong><asp:Literal ID="litOrderId" runat="server"></asp:Literal>
        </li>
        <li style="float: left; padding-left: 20px;"><strong>
            <asp:Literal ID="Literal6" Text="<%$Resources:OrderDetails,IDS_FormField_OrderStatus%>" runat="server"></asp:Literal>：</strong> 
            <Hishop:ActivityStatusLabel ID="lblOrderActivityStatus" runat="server" />
            <Hishop:PaymentStatusLabel ID="lblOrderPaymentStatus" runat="server" />
            <Hishop:ShippingStatusLabel ID="lblOrderShippingStatus" runat="server" />
            <Hishop:RefundStatusLabel ID="lblOrderRefundStatus" runat="server" />
        </li>
        <li style="float: left; padding-left: 20px;"><strong>
            <asp:Literal ID="Literal7" Text="<%$Resources:OrderDetails,IDS_FormField_OrderPrice%>"
                runat="server"></asp:Literal>：</strong><Hishop:FormatedMoneyLabelForAdmin ID="litOrderPrice"
                    runat="server" />
        </li>
        <li style="float: left; padding-left: 20px;"><strong>
            <asp:Literal ID="Literal8" Text="<%$Resources:OrderDetails,IDS_FormField_OrderDate%>"
                runat="server"></asp:Literal>：</strong><Hishop:FormatedTimeLabel ID="litDateTime"
                    runat="server" />
        </li>
    </ul>
</div>
<div class="grdGroupListLi" style="margin-bottom: 12px; text-align: left; padding-left: 10px;">
    <asp:DataList ID="dlstOrderItems" runat="server" Width="98%" DataKeyField="ItemId">
                <HeaderTemplate>
                    <table class="GridViewStyle" id="GridViewTable" cellspacing="0" border="0" style="border-collapse: collapse;"
                        width="100%">
                        <tr class="GridViewHeaderStyle">
                           <th>
                                <span>
                                    <asp:Literal ID="litProcuct" runat="server"></asp:Literal></span>
                            </th>
                             <th>
                                <span>
                                    <asp:Literal ID="lblProductPoints" runat="server" Text="货号"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="Literal18" runat="server" Text="<%$ Resources:OrderDetails,IDS_Header_Product %>"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="litProductQuantity" runat="server" Text="商品单价"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="litAmount" runat="server" Text="赠送积分"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="litPoints" runat="server" Text="购买数量"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="litShipQuantity" runat="server" Text="<%$ Resources:OrderDetails,IDS_Header_ShipQuantity %>"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="litAllAmount" runat="server" Text="小计"></asp:Literal></span>
                            </th>
                            <th>
                                <span>
                                    <asp:Literal ID="litRemark" runat="server" Text="<%$ Resources:OrderDetails,IDS_Header_Remartk %>"></asp:Literal></span>
                            </th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                       <td style="border-bottom: solid 1px #DDDDDD;width:15%;">
                            <Hishop:Common_Link_Product ID="Common_Link_Product1" runat="server">
                                <Hishop:Common_ProductThumbnail ID="Common_ProductThumbnail1" runat="server" DataField="ThumbnailsUrl"/>
                            </Hishop:Common_Link_Product>

                        </td>
                         <td style="border-bottom: solid 1px #DDDDDD;width:10%;">
                            <asp:Literal ID="Literal5" runat="server" Text='<%# Eval("sku") %>'></asp:Literal>

                        </td>
                         <td style="border-bottom: solid 1px #DDDDDD;width:18%;text-align:left;" >
                            
                            <span style="word-break:break-all;"><Hishop:ProductNavigationDetails ID="productNavigationDetails1" ProductName='<%# Eval("ItemDescription") %>'
                                ProductId='<%# Eval("ProductId") %>' runat="server" />
                            <span>

                            <asp:GridView ID="grdOrderItemValues" runat="server" AutoGenerateColumns="false"
                                GridLines="None" Width="100%" ShowHeader="false"
                                DataSource='<%# DataBinder.Eval(Container.DataItem, "LookupListItems") %>'>
                                <Columns>
                                    <asp:TemplateField >
                                        <ItemTemplate>
                                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("ListDescription") %>'/>：
                                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("ItemDescription") %>'/>
                                                <span style="color:red;">(<Hishop:FormatedMoneyLabelForAdmin ID="FormatedMoneyLabelForAdmin1" runat="server" Money='<%# Eval("AdjustedPrice") %>'/>)</span>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>

                        </td>
                        <td style="border-bottom: solid 1px #DDDDDD;">
                            <Hishop:FormatedMoneyLabelForAdmin ID="lblAmount" runat="server" Money='<%# Eval("ItemAdjustedPrice") %>' />
                        </td>
                        <td style="border-bottom: solid 1px #DDDDDD;">
                            <asp:Literal ID="lblProductPoints" runat="server" Text='<%# Eval("Points") %>'></asp:Literal>
                        </td>
                        <td style="border-bottom: solid 1px #DDDDDD;">
                            <asp:Literal ID="lblProductQuantity" runat="server" Text='<%# Eval("Quantity") %>'></asp:Literal>
                        </td>
                        <td style="border-bottom: solid 1px #DDDDDD;">
                            <asp:Literal ID="lblShipQuantity" runat="server" Text='<%# Eval("ShipmentQuantity") %>'></asp:Literal>
                            
                        </td>
                        <td style="border-bottom: solid 1px #DDDDDD;">
                            <Hishop:FormatedMoneyLabelForAdmin ID="FormatedMoneyLabelForAdmin2"  runat="server" Money='<%# (decimal)Eval("ItemAdjustedPrice")*(int)Eval("Quantity") %>'/>
                        </td>
                        <td style="border-bottom: solid 1px #DDDDDD; padding-right: 10px;">
                            <asp:Literal ID="lblRemark" runat="server" Text='<%# Eval("Remark") %>'></asp:Literal>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
            </asp:DataList>
</div>
<!--收货地址列表-->
<div class="grdHeaderStyle" style="cursor:pointer;">
    <ul>
        <li class="addProductTmpt">
        <asp:Literal ID="litShippingAddress" Text='<%$Resources:OrderDetails,IDS_Literal_ShippingAddress %>' runat="server"></asp:Literal>
        </li>
    </ul>
</div>
<table style="width: 100%;margin-bottom:12px;" cellspacing="0" cellpadding="0" class="formTableList" id="addItemsTable">
    <tr>
        <td class="leftTD" style="height:25px;"><asp:Literal ID="litShipTo" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_ShipTo%>"/></td>
         <td class="rightTD"><asp:Label ID="lblShipTo" runat="server" /></td>
         <td class="leftTD"><asp:Literal ID="litZipcode" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_ZipCode%>" /></td>
         <td class="rightTD"><asp:Label ID="lblZipcode" runat="server" /></td>
         <td class="leftTD" style="height:25px;"><asp:Literal ID="litTellPhone" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_TelPhone%>"/></td>
         <td class="rightTD"><asp:Label ID="lblTellPhone" runat="server" /></td>
         <td class="leftTD"><asp:Literal ID="litPhone" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_CellPhone%>" /></td>
         <td class="rightTD"><asp:Label ID="lblPhone" runat="server" /></td>
    </tr>
    <tr>
         <td class="leftTD" style="height:25px;"><asp:Literal ID="litAddress" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_Address%>"/></td>
         <td class="rightTD" colspan="3"><asp:Label ID="lblRegion" runat="server" /><asp:Label ID="lblAddress" runat="server"/></td>
        <td class="leftTD" style="height:25px;"><asp:Literal ID="litPaymentType" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_PaymentType%>"/>：</td>
        <td class="rightTD"><asp:Label ID="lblPaymentType" runat="server" /></td>        
        <td class="leftTD" style="height:25px;"><asp:Literal ID="litModeName" runat="server" Text="<%$Resources:OrderDetails, IDS_DataField_ModeName%>" />：</td>
        <td class="rightTD"><asp:Label ID="lblModeName" runat="server" /></td>
    </tr>
</table>

<!--修改订单价格-->
<div class="grdHeaderStyle" style="cursor:pointer;">
    <ul>
        <li class="addProductTmpt">
        <asp:Literal ID="Literal1" Text='<%$Resources:EditOrder,IDS_Literal_EditOrderPrice %>' runat="server"></asp:Literal>
        <span style="display:none"><asp:Label ID="lblOrderPrice" runat="server"></asp:Label></span>
        </li>
    </ul>
</div>
<table style="width: 100%;margin-bottom:12px;" cellspacing="0" cellpadding="0" class="formTableList" id="Table2">
    <tr>
        <td class="leftTD"><asp:Literal ID="Literal2" runat="server" Text="<%$Resources:EditOrder, IDS_DataField_AdjustedFreight%>"/></td>
        <td class="rightTD"><asp:TextBox ID="txtAdjustedFreight" runat="server" onfocus="getOldValue(this)" onblur="setAmount(this)" /></td>   
        <td class="rightTD">
            <div id="txtAdjustedFreightTip" runat="server"></div>
                <Hishop:ValidateTarget ID="validatAdjustedFreight"  ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtAdjustedFreight" 
                            Description="<%$ Resources:EditOrder, IDS_help_AdjustedFreight%>" Nullable="true">
                            <Validators>
                                <Hishop:InputMoneyClientValidator ErrorMessage="<%$ Resources:EditOrder, IDS_help_AdjustedFreight%>" />
                                <Hishop:MoneyRangeClientValidator ErrorMessage="<%$ Resources:EditOrder, IDS_help_AdjustedFreight%>" MinValue="0"  />
                            </Validators>
                </Hishop:ValidateTarget> 
        </td>     
    </tr>
    
    <tr>
        <td class="leftTD"><asp:Literal ID="Literal3" runat="server" Text="<%$Resources:EditOrder, IDS_DataField_AdjustedPayCharge%>" /></td>
        <td class="rightTD"><asp:TextBox ID="txtAdjustedPayCharge" runat="server" onfocus="getOldValue(this)" onblur="setAmount(this)" /></td>
        <td class="rightTD">
            <div id="txtAdjustedPayChargeTip" runat="server"></div>
                <Hishop:ValidateTarget ID="validatAdjustedPayCharge"  ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtAdjustedPayCharge" 
                            Description="<%$ Resources:EditOrder, IDS_help_AdjustedPayChargeTip%>" Nullable="true">
                            <Validators>
                                <Hishop:InputMoneyClientValidator ErrorMessage="<%$ Resources:EditOrder, IDS_help_AdjustedPayChargeTip%>" />
                            </Validators>
                </Hishop:ValidateTarget> 
        </td>     
    </tr>
    <tr>
        <td class="leftTD"><asp:Literal ID="Literal4" runat="server" Text="<%$Resources:EditOrder, IDS_DataField_AdjustedDiscount%>" /></td>
        <td class="rightTD"><asp:TextBox ID="txtAdjustedDiscount" runat="server" onfocus="getOldValue(this)" onblur="setAmount(this)" /></td>
        <td class="rightTD">
            <div id="txtAdjustedDiscountTip" runat="server"></div>
                <Hishop:ValidateTarget ID="validatAdjustedDiscount"  ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtAdjustedDiscount" 
                            Description="<%$ Resources:EditOrder, IDS_help_AdjustedDiscount%>" Nullable="true">
                            <Validators>
                                <Hishop:InputMoneyClientValidator ErrorMessage="<%$ Resources:EditOrder, IDS_help_AdjustedDiscount%>" />
                            </Validators>
                </Hishop:ValidateTarget> 
        </td>     
    </tr>
    <tr>
        <td class="leftTD"><asp:Literal ID="Literal5" runat="server" Text="<%$Resources:EditOrder, IDS_DataField_OrderAmount%>" /></td>
        <td class="rightTD"><div runat="server" id="htmlAmount" ></div></td>
    </tr>
    <tr>
        <td class="bottonLeftTD">&nbsp;</td>
        <td class="rightTD">
            <asp:Button ID="btnUpdateOrderAmount"  runat="server" Text="<%$ Resources:EditOrder, IDS_Button_EditOrder %>"  OnClientClick="return PageIsValid()"  CssClass="inp_L1"/>                        
        </td>
        <td class="rightTD">&nbsp;</td>
    </tr>
</table>
<script type="text/javascript">
	var isIE = !!document.all;
	function errorEventTable(tableObject)
	{			
		if (isIE)
		{
			var nextNodeObject = tableObject.parentNode.parentNode.nextSibling;
		}
		else
		{
			var nextNodeObject = tableObject.parentNode.parentNode.nextSibling.nextSibling;
		}
		(nextNodeObject.style.display == "none")?nextNodeObject.style.display = "":nextNodeObject.style.display = "none";
		(nextNodeObject.style.display == "none")?tableObject.src = '<%= Globals.ApplicationPath + "/utility/pics/plus.gif" %>':tableObject.src ='<%= Globals.ApplicationPath + "/utility/pics/minus.gif" %>';
	}
    var oldValue = "0"; 
    function getOldValue(obj)
    {
       oldValue = obj.value;
       return oldValue;
    }
    function setFloatTwo(str)
    {
        var restr;
        var n = str.indexOf(".");
        if (n == -1)
        {
            restr = str + ".00";
        }
        else
        {
            if (str.substring(0,(n+2)) == "")
            {
                restr = str.substring(0,(n+2)) + "0";
            }
            else
            {
                restr = restr = str.substring(0,(n+3));
            }
        }
        return restr;
    }
	function setAmount(obj)
    {
        var allPrice = document.getElementById("EditOrder_htmlAmount").innerHTML;
        var freight = document.getElementById("EditOrder_txtAdjustedFreight").value;
        var charge = document.getElementById("EditOrder_txtAdjustedPayCharge").value;
        var discount = document.getElementById("EditOrder_txtAdjustedDiscount").value;
        var price = document.getElementById("EditOrder_lblOrderPrice").innerHTML;
        if (isNaN(obj.value))
        {
            document.getElementById("EditOrder_htmlAmount").innerHTML = allPrice;
        }
        else
        {
            var sbol = allPrice.substring(0,1);
            var all = parseFloat(allPrice.substring(1));
            
            if (obj.id == "EditOrder_txtAdjustedFreight")
            {
                if (parseFloat(freight) < 0)
                {
                    obj.value = oldValue;
                    document.getElementById("EditOrder_htmlAmount").innerHTML = allPrice;
                }
                else
                {
                    var change = parseFloat(freight) - parseFloat(oldValue);
                    document.getElementById("EditOrder_htmlAmount").innerHTML = setFloatTwo(sbol + (all + change));
                }
            }
            if (obj.id == "EditOrder_txtAdjustedPayCharge")
            {
                if (parseFloat(charge) < 0)
                {
                    obj.value = oldValue;
                    document.getElementById("EditOrder_htmlAmount").innerHTML = allPrice;
                }
                else
                {
                    var change = parseFloat(charge) - parseFloat(oldValue);
                    document.getElementById("EditOrder_htmlAmount").innerHTML = setFloatTwo(sbol + (all + change));
                }
            }
            if (obj.id == "EditOrder_txtAdjustedDiscount")
            {
                document.getElementById("EditOrder_htmlAmount").innerHTML = setFloatTwo(sbol + (parseFloat(price) + parseFloat(freight) + parseFloat(charge) + parseFloat(obj.value)));
            }
        }
    }
</script>

                </SkinTemplate>            
            </Hishop:EditOrder>
            
        </div>
        <Hishop:ValidatorContainer runat="server"  ID="ValidatorContainer" />
    </form>
</body>
</html>