<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="True" Inherits="Kesion.NET.WebSite.Admin.Content.ShowBox" Codebehind="ShowBox.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="System.Data" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
 <%
     string action = KSCMS.S("action");
     switch (action)
     {
         case "collectbox":  
 %>
<div style='padding:3px'>带http://开头的远程图片地址,每行一张图片地址:<br/>
<textarea id='collecthttp' style='width:95%;height:150px' class='textbox'></textarea>
</div>
 <%
     break;
         case "selecttp":
            %>
            <br />
           <script>
               dialogType=1;
           </script>
            <div style='padding:3px'><strong>小图地址:</strong><input type='text' size='30' class='textbox' name='x1' id='x1'> <input type='button' onclick="SelectFiles('x1',<%=Utils.StrToInt(KSCMS.S("channelID"),0) %>);" value='选择小图' class='button'/>
            <br/><strong>大图地址:</strong><input type='text' class='textbox'  size='30' name='x2' id='x2'> <input type='button' onclick="SelectFiles('x2',<%=Utils.StrToInt(KSCMS.S("channelID"),0) %>);" value='选择大图' class='button'/>
            <br/><strong>简要介绍:</strong><input type='text' class='textbox'  size='30' name='x3' id='x3'></div>
            <%break;
                case "grouponeorder":
                    %>

         <div style="padding:2px;font-size:14px;line-height:25px;">
               <%
                   string orderId = Utils.ChkSQL(KSCMS.S("orderId"));
                if (string.IsNullOrEmpty(orderId)) KSCMS.Die("error");
                //KSCMS.Die(KSCMS.S("orderId"));
                using (DataTable dt = DataFactory.GetDataTable("select top 1 * From KS_ProGroupOneOrder Where orderid='" + orderId + "'"))
                {
                    if (dt.Rows.Count <= 0)
                    {
                        KSCMS.Die("error!");
                    }
                    else
                    {
                        dr = dt.Rows[0];
                     
                    }
                }
                  
                   int statusCode = Utils.StrToInt(KSCMS.S("statuscode"));
                   StringBuilder dsb = new StringBuilder();
                  
                   {
                       dsb.Append(@"<strong><font color=""#ff6600"">该订单已发货，发货信息如下：</font></strong><br/>");
                       using (DataTable ddt = DataFactory.GetDataTable("Select Top 1 a.HandlerName,a.DeliverDate,ExpressNumber,b.CorpName From KS_ProLogDeliver A inner Join KS_ProDeliveryCorp b ON A.ExpressCorpId=B.CorpId Where a.DeliverType=1 And A.OrderID='" + dr["OrderID"].ToString() + "'"))
                       {
                           if (ddt.Rows.Count > 0)
                           {
                               DataRow dddr = ddt.Rows[0];
                               dsb.Append(@"发货日期：" + dddr["DeliverDate"].ToString() + "，物流公司：" + dddr["CorpName"].ToString() + @"，物流单号：<span style=""color:red"">" + dddr["ExpressNumber"].ToString() + "</span>，经手人：" + dddr["HandlerName"].ToString());
                           }

                       }

                       KSCMS.W(dsb.ToString());
                                    %>
                                  <div>
                                   <strong>快递查询: </strong><br />
                                  <%
                                      string detail = Kesion.APPCode.ExpressAPI.GetLogByOrderID(dr["orderid"].ToString());
                                      Response.Write(detail);
                                     %>
                                  </div>
                                    <%
                                        }
                                    
                                      
            %></div>
         <%        break;
              case "order":
             %>
                 <div style="padding:2px;font-size:14px;line-height:25px;">
               <%
            
                        statusCode = Utils.StrToInt(KSCMS.S("statuscode"));
                        dsb = new StringBuilder();
                        int logdeliverid = Utils.StrToInt(KSCMS.S("logdeliverid"));
                        string sql = string.Empty;
                        if (logdeliverid != 0)
                        {
                            sql = " and A.id=" + logdeliverid;
                        }
                        switch (statusCode)
                        {
                            case 7:
                               
                                    using (DataTable ddt = DataFactory.GetDataTable("Select Top 1 a.HandlerName,a.DeliverDate,ExpressNumber,b.CorpName From KS_ProLogDeliver A inner Join KS_ProDeliveryCorp b ON A.ExpressCorpId=B.CorpId Where  A.OrderID='" + dr["OrderID"].ToString() + "'"+sql+""))
                                    {
                                        if (ddt.Rows.Count > 0)
                                        {
                                            DataRow dddr = ddt.Rows[0];
                                            dsb.Append(@"物流公司：" + dddr["CorpName"].ToString() + @"，物流单号：<span style=""color:red"">" + dddr["ExpressNumber"].ToString() + "</span>");
                                        }

                                    }
                                   
                                    KSCMS.W(dsb.ToString());

                                    string detail1 = Kesion.APPCode.ExpressAPI.GetLogByOrderID(dr["orderid"].ToString(), logdeliverid);
                                      Response.Write("<div><strong>快递查询: </strong><br />"+detail1+"</div>");
                                break;
                                case 10: //重新换货的发货信息
                                //if (dr["DeliverStatus"].ToString().Equals("1"))
                                {
                                    dsb.Append(@"<strong><font color=""#ff6600"">该订单已发货，发货信息如下：</font></strong><br/>");
                                    using (DataTable ddt = DataFactory.GetDataTable("Select Top 1 a.HandlerName,a.DeliverDate,ExpressNumber,b.CorpName From KS_ProLogDeliver A inner Join KS_ProDeliveryCorp b ON A.ExpressCorpId=B.CorpId Where a.DeliverType=10 And A.OrderID='" + dr["OrderID"].ToString() + "'"+sql+""))
                                    {
                                        if (ddt.Rows.Count > 0)
                                        {
                                            DataRow dddr = ddt.Rows[0];
                                            dsb.Append(@"发货日期：" + dddr["DeliverDate"].ToString() + "，物流公司：" + dddr["CorpName"].ToString() + @"，物流单号：<span style=""color:red"">" + dddr["ExpressNumber"].ToString() + "</span>，经手人：" + dddr["HandlerName"].ToString());
                                        }

                                    }
                                   
                                    KSCMS.W(dsb.ToString());
                                    %>
                                  <div>
                                   <strong>重新换货的发货快递查询: </strong><br />
                                  <%
                                    string detail = Kesion.APPCode.ExpressAPI.GetLogByOrderID(dr["orderid"].ToString(),logdeliverid);
                                      Response.Write(detail);
                                     %>
                                  </div>
                                    <%
                                }
                                break; 
                                
                                
                            case 3: //发货信息
                                //if (dr["DeliverStatus"].ToString().Equals("1"))
                                {
                                    dsb.Append(@"<strong><font color=""#ff6600"">该订单已发货，发货信息如下：</font></strong><br/>");
                                    using (DataTable ddt = DataFactory.GetDataTable("Select Top 1 a.HandlerName,a.DeliverDate,ExpressNumber,b.CorpName From KS_ProLogDeliver A inner Join KS_ProDeliveryCorp b ON A.ExpressCorpId=B.CorpId Where a.DeliverType=1 And A.OrderID='" + dr["OrderID"].ToString() + "'"+sql+""))
                                    {
                                        if (ddt.Rows.Count > 0)
                                        {
                                            DataRow dddr = ddt.Rows[0];
                                            dsb.Append(@"发货日期：" + dddr["DeliverDate"].ToString() + "，物流公司：" + dddr["CorpName"].ToString() + @"，物流单号：<span style=""color:red"">" + dddr["ExpressNumber"].ToString() + "</span>，经手人：" + dddr["HandlerName"].ToString());
                                        }

                                    }
                                   
                                    KSCMS.W(dsb.ToString());
                                    %>
                                  <div>
                                   <strong>快递查询: </strong><br />
                                  <%
                                    string detail = Kesion.APPCode.ExpressAPI.GetLogByOrderID(dr["orderid"].ToString(), logdeliverid);
                                      Response.Write(detail);
                                     %>
                                  </div>
                                    <%
                                }
                                break;
                              case 4: //团购凭单消费记录
                                
                                if (Utils.StrToInt(dr["OrderType"].ToString())==1 && dr["ConsumptionMode"].ToString().Equals("0") )
                                {
                                   %> <asp:Repeater ID="Repeater1" runat="server" >
                                          <HeaderTemplate>
                                            <table class="border" cellSpacing=1 cellPadding=2 width="99%" align="center" border=0>
                                                <tr align="center" class="Title">
        	                                    <td align="center">消费时间</td>
                                               <td  align="center">订单号</td>
        	                                    <td  align="center">手机号</td>
        	                                    <td align="center">录入</td>
                                                <td align="center" width="110">消费次数</td>
	                                            <td align="center">备注</td>
                                              </tr>

                                          </HeaderTemplate>
                                           <ItemTemplate>
                                           <tr class="tdbg">
                                              <td class="Ctd" align="center"><%# Eval("Adddate") %> </td>
                                              <td class="Ctd" align="center"><%# Eval("orderid") %></td>
                                              <td class="Ctd">
                                              <%# Eval("mobile") %>
                                              </td>
                                              <td class="Ctd" align="center"><%# Eval("username") %></td>
                                              <td class="Ctd" align="center"><%# Eval("times") %>次
                                              </td>
             
                                              <td class="Ctd" style="width:180px;word-break:break-all">
                                              <%# Eval("Remark") %>
                                              </td>
                                           </tr>     
                                           </ItemTemplate>

                                         <FooterTemplate>
                                             <tr class="tdbg" style="display:<%# bool.Parse((Repeater1.Items.Count==0).ToString())?"":"none"%>">
                                                <td class="splittd" style="text-align:center" colspan="7">
                                                  还没有消费明细记录!
                                                </td>
                                               </tr> 
                                            </table>
                                        </FooterTemplate>
                                    </asp:Repeater>
                     <%
                                    
                                }else{
                                    dsb.Append(@"<strong><font color=""#ff6600"">该订单已签收，物流信息如下：</font></strong><br/>");
                                    using (DataTable ddt = DataFactory.GetDataTable("Select Top 1 a.HandlerName,a.DeliverDate,ExpressNumber,b.CorpName From KS_ProLogDeliver A inner Join KS_ProDeliveryCorp b ON A.ExpressCorpId=B.CorpId Where a.DeliverType=1 And A.OrderID='" + dr["OrderID"].ToString() + "'"))
                                    {
                                        if (ddt.Rows.Count > 0)
                                        {
                                            DataRow dddr = ddt.Rows[0];
                                            dsb.Append(@"发货日期：" + dddr["DeliverDate"].ToString() + "，物流公司：" + dddr["CorpName"].ToString() + @"，物流单号：<span style=""color:red"">" + dddr["ExpressNumber"].ToString() + "</span>，经手人：" + dddr["HandlerName"].ToString());
                                        }

                                    }
                                   
                                    KSCMS.W(dsb.ToString());
                                    %>
                                  <div>
                                   <strong>快递查询: </strong><br />
                                  <%
                                    string detail = Kesion.APPCode.ExpressAPI.GetLogByOrderID(dr["orderid"].ToString(), logdeliverid);
                                      Response.Write(detail);
                                     %>
                                  </div>
                                    <%
                                }
                                break;
                            case 6:  //发票信息
                                if (dr["Invoiced"].ToString().Equals("1"))
                                {
                                    dsb.Append(@"<br/><div style=""margin:30px""><strong><font color=""#ff6600"">该订单发票已开出，发票信息如下：</font></strong><br/>");
                                    using (DataTable ddt = DataFactory.GetDataTable("Select Top 1 HandlerName,InvoiceType,InvoiceNum,InvoiceTitle,InvoiceContent,InvoiceDate,MoneyTotal From KS_ProLogInvoice Where OrderID='" + dr["OrderID"].ToString() + "'"))
                                    {
                                        if (ddt.Rows.Count > 0)
                                        {
                                            DataRow dddr = ddt.Rows[0];
                                            dsb.Append(@"开票日期：" + dddr["InvoiceDate"].ToString() + "，发票类型：" + dddr["InvoiceType"].ToString() + "，发票抬头：" + dddr["InvoiceTitle"].ToString() + @"，发票内容：" + dddr["InvoiceContent"].ToString() + ",开票金额：" + Utils.StrToFloat(dddr["MoneyTotal"].ToString()).ToString("F2") + @" 元，发票号码：<span style=""color:red"">" + dddr["InvoiceNum"].ToString() + "</span>，经手人：" + dddr["HandlerName"].ToString());
                                        }

                                    }
                                    dsb.AppendLine("</div>");
                                    KSCMS.W(dsb.ToString());
                                }
                   
                                break;
                        }
                   
              break;
            %></div>
<%
     } %>
</asp:Content>