<%@ Page Language="C#" AutoEventWireup="false" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Controls" Assembly="Hishop.Web.Controls" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Management" Assembly="Hishop.Web.Management" %>
<%@ Register TagPrefix="UI" Namespace="ASPNET.WebControls" Assembly="ASPNET.WebControls" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Validator" Assembly="Hishop.Web.Validator" %>
<%@ Import Namespace="Hishop.SystemServices" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<!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" />
    <Hishop:PageTitle ID="PageTitle1" runat="server" />
     <link rel="stylesheet" href="../css/EditOrder.css" type="text/css" />
    <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>
    <script type="text/javascript">
        function Quantity(q) {
            var quantity = q.value;
            
            if (isNaN(quantity) || quantity == "") {
                alert("请填写正确的数量");
                q.value = 1;
            }
            if (quantity.length > 5){
                alert("填写的购买数量不能超过99999!");
                q.value = 1;
            }
            if ((quantity + 0) <= 0) {
                alert("商品数量不能为0或者负数");
                q.value = 1;
            }
       }
    
       function GetOrderTotal(obj){
            var nochangePrice = document.getElementById("EditOrder_litNochangePrcie").innerHTML;
            var freight = document.getElementById("EditOrder_txtAdjustedFreight").value;
            var charge = document.getElementById("EditOrder_txtAdjustedPayCharge").value;
            var discount = document.getElementById("EditOrder_txtAdjustedDiscount").value;
            
            if (isNaN(obj.value))
            {
                return;
            }
            
            document.getElementById("EditOrder_litOrderTotal").innerHTML = "￥" + (parseFloat(nochangePrice) + parseFloat(freight) + parseFloat(charge) + parseFloat(discount));
       }
</script>
</head>
<body>
      <form id="form1" runat="server">
        <div>
        <Hishop:EditOrder ID="EditOrder" runat="server" >
            <SkinTemplate>
            <asp:Panel runat="server" ID="plOrderNoPay">
            <div class="D_main_top">
                 <table border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td style="padding-left:1px" class="spanB"><nobr><asp:Literal ID="lblOpen" Text="<%$Resources:OrderDetails,IDS_FormField_OrderNumber%>" runat="server"></asp:Literal>：</nobr></td>
                        <td style="padding-left:1px"><asp:Literal ID="litOrderId" runat="server"></asp:Literal></td>
                        <td style="padding-left:1px"><span class="spanB"><nobr><asp:Literal ID="Literal6" Text="<%$Resources:OrderDetails,IDS_FormField_OrderPrice%>" runat="server"></asp:Literal>：</span></nobr></td>
                        <td class="spanC" style="padding-left:1px"><Hishop:FormatedMoneyLabelForAdmin ID="litOrderPrice" runat="server" /></td>
                        <td style="padding-left:1px" class="spanB"><nobr><asp:Literal ID="Literal16" Text="<%$Resources:OrderDetails,IDS_FormField_OrderStatus%>" runat="server"></asp:Literal>：</nobr></td>
                        <td style="padding-left:1px">
                            <Hishop:ActivityStatusLabel ID="lblOrderActivityStatus" runat="server" />
                        <Hishop:PaymentStatusLabel ID="lblOrderPaymentStatus" runat="server" />
                        <Hishop:ShippingStatusLabel ID="lblOrderShippingStatus" runat="server" />
                        <Hishop:RefundStatusLabel ID="lblOrderRefundStatus" runat="server" />
                        </td>
                        <td style="padding-left:1px"><span class="spanB"><nobr><asp:Literal ID="Literal7" Text="<%$Resources:OrderDetails,IDS_FormField_OrderDate%>" runat="server"></asp:Literal>：</span></nobr></td>
                        <td style="padding-left:1px"><Hishop:FormatedTimeLabel ID="litDateTime" ShopTime="true" runat="server" /></td>
                        <td style="padding-left:1px"><span class="spanB"><nobr>所属会员：</nobr></td>
                        <td style="padding-left:1px"><asp:Literal ID="litUserName" runat="server"></asp:Literal><asp:Literal ID="litRankName" runat="server"></asp:Literal></td>
                      </tr>
                    </table>
            </div>
<!-- 操作提示 -->
        <table width="960px" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="32" class="mod_order_topline_bg"><h1 class="mod_order_top_title">修改订单</h1><span style="display:none"><asp:Label ID="lblOrderPrice" runat="server"></asp:Label></span></td>
          </tr>
          <tr><td style="border-left:1px #fed6bc solid;border-right:1px #fed6bc solid;border-bottom:1px #fed6bc solid; padding:5px 5px 20px 5px;">
        <Hishop:StatusMessage id="Status" runat="server" Visible="False" />
        <div class="grdHeaderStyle">
            <ul>
                <li class="userGroupCheckAll">
                    <asp:LinkButton ID="Button2" runat="server" OnClientClick="CheckClickAll();return false;"
                        Text="<%$ Resources:Resources, IDS_Label_CheckAll %>" />
                </li>
                <li class="spirtLines">|</li>
                <li class="userGroupReverseCheck">
                    <asp:LinkButton ID="CheckReverse" runat="server" OnClientClick="CheckReverse();return false;"
                        Text="<%$ Resources:Resources, IDS_Label_CheckReverse %>" />
                </li>        
                <li class="spirtLines">|</li>
                <li class="userGroupDelCheck">
                    <Hishop:DeleteImageLinkButton ID="btnDelete" runat="server" Text="<%$ Resources:Resources, IDS_Button_DeleteCheck %>" /></li>
            </ul>
        </div>
        
            <div class="grdGroupListLi">
                <Hishop:CustomGridView runat="server" ID="grdProducts" CssClass="GridNoBorder" Width="100%" AllowSorting="true" ShowOrderIcons="true" 
                    GridLines="None" DataKeyNames="ItemId" RowStyle-CssClass="grdrow" HeaderStyle-CssClass="GridViewHeaderStyle" AutoGenerateColumns="false" ForeColor="#333333">
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <HeaderStyle BackColor="#EEF8FF" Height="25" CssClass="GridViewHeaderStyle" Font-Bold="True" ForeColor="#314E9F" />
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <Hishop:CheckBoxColumn ReadOnly="true" />
                        <asp:TemplateField>
                            <itemtemplate>
                                 <Hishop:Common_Link_Product ID="Common_Link_Product1" runat="server" Target="_blank">
                                    <Hishop:Common_ProductThumbnail ID="Common_ProductThumbnail1" Width="60px" Height="60px" runat="server" DataField="ThumbnailsUrl"/>
                                 </Hishop:Common_Link_Product>  
                            </itemtemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="货号">
                            <itemtemplate>
                                <asp:Literal ID="litSKU" runat="server" Text='<%# Eval("sku") %>'></asp:Literal>
                            </itemtemplate>
                        </asp:TemplateField>
                        <asp:TemplateField  HeaderText="<%$ Resources:ManageOrderProduct, IDS_Header_Name %>">
                            <itemtemplate>                             
                               <Hishop:ProductNavigationDetails ID="productNavigationDetails1" ProductName='<%# Eval("ItemDescription") %>' ProductId='<%# Eval("ProductId") %>' runat="server" />
                               <%# Eval("ItemAttribute")%>
                               <%# Eval("Remark")%>
                            </itemtemplate>
                        </asp:TemplateField> 
                        <asp:TemplateField  HeaderText="购买数量" ItemStyle-Width="150px">
                            <itemtemplate>                             
                                <asp:Literal ID="Literal9" runat="server" Text='<%# Eval("Quantity") %>'></asp:Literal>
                            </itemtemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="txtQuantity" runat="server" Text='<%# Eval("Quantity") %>' onkeyup="Quantity(this)" Width="30px"></asp:TextBox>
                                <asp:LinkButton ID="lkbUpdate" Width="30" CssClass="SmallCommonTextButton" runat="server" CommandName="Update" Text="<%$ Resources:Resources, IDS_Button_Update %>" ValidationGroup="Update"></asp:LinkButton>
                                <asp:LinkButton ID="lkbCancel" Width="30" CssClass="SmallCommonTextButton" runat="server" CommandName="Cancel" Text="<% $Resources:Resources, IDS_Button_Cancel %>"></asp:LinkButton>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField  HeaderText="<%$Resources:OrderDetails,IDS_Field_ProductPrice%>">
                            <itemtemplate>                             
                               <Hishop:FormatedMoneyLabelForAdmin ID="lblAmount" runat="server" Money='<%# Eval("ItemListPrice") %>' />
                            </itemtemplate>
                        </asp:TemplateField>     
                        <asp:TemplateField  HeaderText="发货数量">
                            <itemtemplate><div style="display:none;">
                                <asp:Literal ID="litQuantity" runat="server" Text='<%# Eval("Quantity") %>'></asp:Literal></div>                       
                                <asp:Literal ID="litShipmentQuantity" runat="server" Text='<%# Eval("ShipmentQuantity") %>'></asp:Literal>
                            </itemtemplate>
                        </asp:TemplateField>
                         <asp:TemplateField  HeaderText="<%$Resources:OrderDetails,IDS_Field_XiaoJi%>">
                            <itemtemplate>                             
                               <Hishop:FormatedMoneyLabelForAdmin ID="FormatedMoneyLabelForAdmin2"  runat="server" Money='<%# (decimal)Eval("ItemAdjustedPrice")*(int)Eval("Quantity") %>'/>
                            </itemtemplate>
                        </asp:TemplateField>    
                        <asp:TemplateField HeaderText="<%$ Resources:Resources, IDS_Header_Options %>">
                            <ItemTemplate>
                                 <asp:LinkButton ID="lkbEdit" runat="server" CssClass="SmallCommonTextButton" CommandName="Edit" Text="<%$ Resources:Resources, IDS_Button_Edit%>"></asp:LinkButton>
                                 <Hishop:DeleteImageLinkButton ID="lkbDelete" CssClass="SmallCommonTextButton" runat="server" CommandName="Delete"  Text="<%$ Resources:Resources, IDS_Button_Delete %>" />
                            </ItemTemplate>
                        </asp:TemplateField> 
                    </Columns>
                </Hishop:CustomGridView>
            </div>
        
        <div class="grdHeaderStyle" style="margin-top:10px;">
            <ul>
                <li class="addProductTmpt">
                    <asp:Literal ID="lblUserGroupTitle" Text='添加订单商品' runat="server"></asp:Literal>
                </li>
            </ul>
        </div>
        <table style="width: 100%;" cellspacing="0" cellpadding="0" class="formTableList" id="addItemsTable" runat="server">
            <tr>
                <td class="leftTD">商品货号：</td>
                <td class="rightTD">
                    <asp:TextBox ID="txtSKU" runat="server" ></asp:TextBox>
                </td>
                <td class="rightTD">
                    <div id="txtSKUTip" runat="server"></div>
                     <Hishop:ValidateTarget ID="ValidateTarget1" ValidateGroup="validateProduct" ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtSKU" Description="商品的SKU长度必须在 1-100 个字符之间" Nullable="false">
                        <Validators>
                            <Hishop:InputStringClientValidator ErrorMessage="商品的SKU长度必须在 1-100 个字符之间" LowerBound="1" UpperBound="100" />
                        </Validators>
                    </Hishop:ValidateTarget>		            
                </td>
            </tr>
            <tr>
                <td class="leftTD">商品数量：</td>
                <td class="rightTD">
                    <asp:TextBox ID="txtQuantity" runat="server"></asp:TextBox>
                </td>
                <td class="rightTD">
                    <div id="txtQuantityTip" runat="server"></div>
                    <Hishop:ValidateTarget ID="ValidateTarget2" ValidateGroup="validateProduct" ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtQuantity" Description="订单商品的购买数量" Nullable="false">
                        <Validators>
                             <Hishop:InputNumberClientValidator ErrorMessage="<%$ Resources:ProductView, IDS_FormField_MustMember %>" />
                             <Hishop:NumberRangeClientValidator ErrorMessage="<%$ Resources:ProductView, IDS_FormField_MustMinMax %>"  MinValue="0" MaxValue="9999999" />
                        </Validators>
                    </Hishop:ValidateTarget>		            
                </td>
            </tr>
            <tr>
                <td class="bottonLeftTD">&nbsp;</td>
                <td class="rightTD">
                    <asp:Button ID="btnSubmit" runat="server" Text="<%$ Resources:Resources, IDS_Button_Add%>"  OnClientClick="return PageIsValid('validateProduct')"  CssClass="inp_L1"/>
                    <asp:Button ID="btnCancel" Text="<%$ Resources:Resources, IDS_Button_Cancel%>" CssClass="inp_L1" runat="server" />
                </td>
                <td class="rightTD">&nbsp;</td>
            </tr>
        </table>
        
        <div class="grdHeaderStyle" style="margin-top:10px;">
            <ul>
                <li class="addProductTmpt">
                    <asp:Literal ID="Literal1" Text='修改订单价格' runat="server"></asp:Literal>
                </li>
            </ul>
        </div>
        <table style="width: 100%;" cellspacing="0" cellpadding="0" class="formTableList" id="Table1" runat="server">
            <tr>
                <td class="leftTD">新邮费：</td>
                <td class="rightTD"><asp:TextBox ID="txtAdjustedFreight" runat="server" onblur="GetOrderTotal(this)" /></td>   
                <td class="rightTD">
                    <div id="txtAdjustedFreightTip" runat="server"></div>
                    <Hishop:ValidateTarget ID="validatAdjustedFreight" ValidateGroup="validateAmount"  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">新支付手续费：</td>
                <td class="rightTD"><asp:TextBox ID="txtAdjustedPayCharge" runat="server" onblur="GetOrderTotal(this)" /></td>
                <td class="rightTD">
                    <div id="txtAdjustedPayChargeTip" runat="server"></div>
                    <Hishop:ValidateTarget ID="validatAdjustedPayCharge" ValidateGroup="validateAmount" 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">新的订单折扣：</td>
                <td class="rightTD"><asp:TextBox ID="txtAdjustedDiscount" runat="server" onblur="GetOrderTotal(this)" /></td>
                <td class="rightTD">
                    <div id="txtAdjustedDiscountTip" runat="server"></div>
                    <Hishop:ValidateTarget ID="validatAdjustedDiscount" ValidateGroup="validateAmount" 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">订单应付总金额：</td>
                <td class="rightTD"><div runat="server" style="display:none" ID="litNochangePrcie"></div><div runat="server" runat="server" ID="litOrderTotal"></div></td>
            </tr>
            <tr style="height:50px">
                <td class="bottonLeftTD">&nbsp;</td>
                <td class="rightTD">
                    <asp:Button ID="btnUpdateOrderAmount"  runat="server" Text="修改"  OnClientClick="return PageIsValid('validateAmount')"  CssClass="inp_L1"/>                         
                </td>
                <td class="rightTD">&nbsp;</td>
            </tr>    
        </table>

        </td>
        </tr>
        </table>
        </asp:Panel>
        <asp:Panel runat="server" ID="plOrderPay">
            <div align="center">
                <div style="width: 50%;margin-top: 64px;margin-bottom: 64px;background-color: #ffffff;">
	                <h4 style="text-align: left;font-family: Tahoma, Arial, Helvetica;font-size: 140%;font-weight: bold;background-color: #e2eecd;color: #698d73;padding: 2px;padding-left: 8px;margin: 0px;border-style: solid;border-width: 1px;border-color: #cccccc;">
	                    <asp:label ID="Label1" Text="操作错误" runat="server"/>
	                </h4>
	                <div style="font-family: Tahoma, Arial, Helvetica;font-size: 100%;color: #000000;padding: 8px;padding-bottom: 16px;text-align: left;border-style: solid;border-width: 1px;border-top-width: 0px;border-color: #cccccc;">
	                    <div>
	                        <asp:Literal runat="server" ID="litMessage" Text="已经付款订单的商品不能修改" />
	                    </div>
	                </div>
                </div>
            </div>
        </asp:Panel>
            </SkinTemplate>
            </Hishop:EditOrder>
        </div>
        <br />
        <div class="botCopyInfo"><hr style="width:500px;" /><Hishop:SiteCopyright ID="SiteCopyright1" runat="server" /></div>
        <br />
        <Hishop:ValidatorContainer runat="server" ID="ValidatorContainer" />
    </form>
</body>
</html>
