예제 #1
0
파일: RefundDao.cs 프로젝트: zwkjgs/XKD
        public bool InsertOrderRefund(RefundInfo refundInfo)
        {
            bool         result      = false;
            LineItemDao  lineItemDao = new LineItemDao();
            LineItemInfo returnMoneyByOrderIDAndProductID = lineItemDao.GetReturnMoneyByOrderIDAndProductID(refundInfo.OrderId, refundInfo.SkuId, refundInfo.OrderItemID);

            if (returnMoneyByOrderIDAndProductID != null)
            {
                decimal num = returnMoneyByOrderIDAndProductID.GetSubTotal() - returnMoneyByOrderIDAndProductID.DiscountAverage - returnMoneyByOrderIDAndProductID.ItemAdjustedCommssion;
                if (num < 0m)
                {
                    num = 0m;
                }
                System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("insert into Hishop_OrderReturns(OrderId,ApplyForTime,Comments,HandleStatus,Account,RefundMoney,RefundType,ProductId,UserId,AuditTime,SkuId,OrderItemID) values(@OrderId,@ApplyForTime,@Comments,@HandleStatus,@Account,@RefundMoney,@RefundType,@ProductId,@UserId,@AuditTime,@SkuId,@OrderItemID)");
                this.database.AddInParameter(sqlStringCommand, "OrderId", System.Data.DbType.String, refundInfo.OrderId);
                this.database.AddInParameter(sqlStringCommand, "ApplyForTime", System.Data.DbType.DateTime, refundInfo.ApplyForTime);
                this.database.AddInParameter(sqlStringCommand, "Comments", System.Data.DbType.String, refundInfo.Comments);
                this.database.AddInParameter(sqlStringCommand, "HandleStatus", System.Data.DbType.Int32, (int)refundInfo.HandleStatus);
                this.database.AddInParameter(sqlStringCommand, "Account", System.Data.DbType.String, refundInfo.Account);
                this.database.AddInParameter(sqlStringCommand, "RefundMoney", System.Data.DbType.Decimal, num);
                this.database.AddInParameter(sqlStringCommand, "RefundType", System.Data.DbType.Int32, refundInfo.RefundType);
                this.database.AddInParameter(sqlStringCommand, "ProductId", System.Data.DbType.Int32, refundInfo.ProductId);
                this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.Int32, refundInfo.UserId);
                this.database.AddInParameter(sqlStringCommand, "AuditTime", System.Data.DbType.String, refundInfo.AuditTime);
                this.database.AddInParameter(sqlStringCommand, "SkuId", System.Data.DbType.String, refundInfo.SkuId);
                this.database.AddInParameter(sqlStringCommand, "OrderItemID", System.Data.DbType.Int32, refundInfo.OrderItemID);
                result = (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
            }
            return(result);
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(new char[] { ',' });

            if (!string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                foreach (OrderInfo info in this.GetPrintData(orderIds))
                {
                    HtmlGenericControl child = new HtmlGenericControl("div");
                    child.Attributes["class"] = "order print";
                    StringBuilder builder = new StringBuilder("");
                    builder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3 style=\"font-weight: normal\">{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>生成时间: </span>{1}</li><li><span>订单编号: </span>{2}</li></ul><br class=\"clear\" /></div>", info.ShipTo, info.OrderDate.ToString("yyyy-MM-dd HH:mm"), info.OrderId);
                    builder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th>单价</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = info.LineItems;
                    if (lineItems != null)
                    {
                        foreach (string str2 in lineItems.Keys)
                        {
                            LineItemInfo info2 = lineItems[str2];
                            builder.AppendFormat("<tr><td>{0}</td>", info2.SKU);
                            builder.AppendFormat("<td>{0}</td>", info2.ItemDescription);
                            builder.AppendFormat("<td>{0}</td>", info2.SKUContent);
                            builder.AppendFormat("<td>{0}</td>", info2.ShipmentQuantity);
                            builder.AppendFormat("<td>{0}</td>", Math.Round(info2.ItemListPrice, 2));
                            builder.AppendFormat("<td>{0}</td></tr>", Math.Round(info2.GetSubTotal(), 2));
                        }
                    }
                    builder.AppendFormat("</tbody></table><ul class=\"price\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", Math.Round(info.GetAmount(), 2), Math.Round(info.AdjustedFreight, 2));
                    decimal reducedPromotionAmount = info.ReducedPromotionAmount;
                    if (reducedPromotionAmount > 0M)
                    {
                        builder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", Math.Round(reducedPromotionAmount, 2));
                    }
                    decimal payCharge = info.PayCharge;
                    if (payCharge > 0M)
                    {
                        builder.AppendFormat("<li><span>支付手续费:</span>{0}</li>", Math.Round(payCharge, 2));
                    }
                    if (!string.IsNullOrEmpty(info.CouponCode))
                    {
                        decimal couponValue = info.CouponValue;
                        if (couponValue > 0M)
                        {
                            builder.AppendFormat("<li><span>优惠券:</span>{0}</li>", Math.Round(couponValue, 2));
                        }
                    }
                    decimal adjustedDiscount = info.AdjustedDiscount;
                    if (adjustedDiscount > 0M)
                    {
                        builder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", Math.Round(adjustedDiscount, 2));
                    }
                    else
                    {
                        builder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", Math.Round(-adjustedDiscount, 2));
                    }
                    builder.AppendFormat("<li><span>实付金额:</span>{0}</li></ul><br class=\"clear\" /><br><br>", Math.Round(info.GetTotal(), 2));
                    child.InnerHtml = builder.ToString();
                    this.divContent.Controls.AddAt(0, child);
                }
            }
        }
예제 #3
0
        public static bool InsertCalculationCommission(string orderid)
        {
            OrderInfo        orderInfo          = GetOrderInfo(orderid);
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(orderInfo.ReferralUserId);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                LineItemInfo info3       = new LineItemInfo();
                DataView     defaultView = CategoryBrowser.GetAllCategories().DefaultView;
                string       str2        = null;
                string       str3        = null;
                string       str4        = null;
                decimal      subTotal    = 0M;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    string key = pair.Key;
                    info3 = pair.Value;
                    DataTable productCategories = ProductBrowser.GetProductCategories(info3.ProductId);
                    if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                    {
                        defaultView.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                        str2 = defaultView[0]["FirstCommission"].ToString();
                        str3 = defaultView[0]["SecondCommission"].ToString();
                        str4 = defaultView[0]["ThirdCommission"].ToString();
                        if ((!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str3)) && !string.IsNullOrEmpty(str4))
                        {
                            ArrayList referralBlanceList = new ArrayList();
                            ArrayList userIdList         = new ArrayList();
                            ArrayList ordersTotalList    = new ArrayList();
                            subTotal = info3.GetSubTotal();
                            if (string.IsNullOrEmpty(userIdDistributors.ReferralPath))
                            {
                                referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                userIdList.Add(orderInfo.ReferralUserId);
                                ordersTotalList.Add(subTotal);
                            }
                            else
                            {
                                string[] strArray = userIdDistributors.ReferralPath.Split(new char[] { '|' });
                                if (strArray.Length == 1)
                                {
                                    referralBlanceList.Add((decimal.Parse(str3) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[0]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(orderInfo.ReferralUserId);
                                    ordersTotalList.Add(subTotal);
                                }
                                if (strArray.Length == 2)
                                {
                                    referralBlanceList.Add((decimal.Parse(str2) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[0]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str3) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(strArray[1]);
                                    ordersTotalList.Add(subTotal);
                                    referralBlanceList.Add((decimal.Parse(str4) / 100M) * info3.GetSubTotal());
                                    userIdList.Add(orderInfo.ReferralUserId);
                                    ordersTotalList.Add(subTotal);
                                }
                            }
                            flag = InsertCalculationCommission(userIdList, referralBlanceList, orderInfo.OrderId, ordersTotalList, orderInfo.UserId.ToString());
                        }
                    }
                }
            }
            return(flag);
        }
예제 #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(new char[]
            {
                ','
            });

            if (string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                return;
            }
            foreach (OrderInfo current in this.GetPrintData(orderIds))
            {
                System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                htmlGenericControl.Attributes["class"] = "order print";
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("");
                stringBuilder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3 style=\"font-weight: normal\">{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>生成时间: </span>{1}</li><li><span>发货单号: </span>{2}</li></ul><br class=\"clear\" /></div>", current.ShipTo, current.OrderDate.ToString("yyyy-MM-dd HH:mm"), current.OrderId);
                stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th style=\"display:none\">单价</th><th style=\"display:none\">总价</th></tr></thead><tbody>");
                System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = current.LineItems;
                if (lineItems != null)
                {
                    foreach (string current2 in lineItems.Keys)
                    {
                        LineItemInfo lineItemInfo = lineItems[current2];
                        stringBuilder.AppendFormat("<tr><td>{0}</td>", lineItemInfo.SKU);
                        stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ItemDescription);
                        stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.SKUContent);
                        stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ShipmentQuantity);
                        stringBuilder.AppendFormat("<td style=\"display:none\">{0}</td>", System.Math.Round(lineItemInfo.ItemListPrice, 2));
                        stringBuilder.AppendFormat("<td style=\"display:none\">{0}</td></tr>", System.Math.Round(lineItemInfo.GetSubTotal(), 2));
                    }
                }
                string value = "";
                System.Collections.Generic.IList <OrderGiftInfo> gifts = current.Gifts;
                if (gifts != null && gifts.Count > 0)
                {
                    OrderGiftInfo orderGiftInfo = gifts[0];
                    value = string.Format("<li><span>赠送礼品:</span>{0},数量:{1}</li>", orderGiftInfo.GiftName, orderGiftInfo.Quantity);
                }
                stringBuilder.AppendFormat("</tbody></table><ul class=\"price\" style=\"display:none\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", System.Math.Round(current.GetAmount(), 2), System.Math.Round(current.AdjustedFreight, 2));
                decimal reducedPromotionAmount = current.ReducedPromotionAmount;
                if (reducedPromotionAmount > 0m)
                {
                    stringBuilder.AppendFormat("<li style=\"display:none\"><span>优惠金额:</span>{0}</li>", System.Math.Round(reducedPromotionAmount, 2));
                }
                decimal payCharge = current.PayCharge;
                if (payCharge > 0m)
                {
                    stringBuilder.AppendFormat("<li style=\"display:none\"><span>支付手续费:</span>{0}</li>", System.Math.Round(payCharge, 2));
                }
                if (!string.IsNullOrEmpty(current.CouponCode))
                {
                    decimal couponValue = current.CouponValue;
                    if (couponValue > 0m)
                    {
                        stringBuilder.AppendFormat("<li style=\"display:none\"><span>优惠券:</span>{0}</li>", System.Math.Round(couponValue, 2));
                    }
                }
                decimal adjustedDiscount = current.AdjustedDiscount;
                if (adjustedDiscount > 0m)
                {
                    stringBuilder.AppendFormat("<li style=\"display:none\"><span>管理员手工打折:</span>{0}</li>", System.Math.Round(adjustedDiscount, 2));
                }
                stringBuilder.Append(value);
                stringBuilder.AppendFormat("<li style=\"display:none\"><span>实付金额:</span>{0}</li></ul><br class=\"clear\" /><br><br>", System.Math.Round(current.GetTotal(), 2));
                htmlGenericControl.InnerHtml = stringBuilder.ToString();
                this.divContent.Controls.AddAt(0, htmlGenericControl);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request["OrderIds"].Trim(new char[] { ',' });

            if (!string.IsNullOrEmpty(str))
            {
                foreach (OrderInfo info in (from a in this.GetPrintData(str)
                                            orderby string.Concat(new object[] { a.ShipTo, a.RegionId, a.ExpressCompanyAbb, a.Address, a.CellPhone }) descending
                                            select a).ToList <OrderInfo>())
                {
                    HtmlGenericControl child = new HtmlGenericControl("div");
                    child.Attributes["class"] = "order print";
                    child.Attributes["style"] = "padding-bottom:60px;padding-top:40px;";
                    StringBuilder builder = new StringBuilder("");
                    builder.AppendFormat("<div class=\"info clear\"><ul class=\"sub-info\"><li><span>订单号: </span>{2}</li><li><span>成交时间: </span>{1}</li><li><span>收货人姓名: </span>{0}</li></ul></div>", info.ShipTo, (info.FinishDate.HasValue ? DateTime.Parse(info.FinishDate.ToString()) : info.OrderDate).ToString("yyyy-MM-dd HH:mm:ss"), info.OrderId);
                    builder.Append("<table><col class=\"col-1\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>商品信息</th><th>商品编码</th><th>单价</th><th>数量</th><th>小计</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = info.LineItems;
                    if (lineItems != null)
                    {
                        int num = 0;
                        foreach (string str2 in lineItems.Keys)
                        {
                            LineItemInfo info2 = lineItems[str2];
                            string       sKU   = string.Empty;
                            if (info2.OrderItemsStatus == OrderStatus.Returned)
                            {
                                sKU = "(已退货,金额¥" + info2.ReturnMoney.ToString("F2") + ")";
                            }
                            else if (info2.OrderItemsStatus == OrderStatus.Refunded)
                            {
                                sKU = "(已退款,金额¥" + info2.ReturnMoney.ToString("F2") + ")";
                            }
                            builder.AppendFormat("<tr><td>{0}</td>", info2.ItemDescription + sKU + (string.IsNullOrEmpty(info2.SKUContent) ? "" : ("<br>" + info2.SKUContent)));
                            sKU = info2.SKU;
                            if (string.IsNullOrEmpty(sKU))
                            {
                                ProductInfo productDetails = ProductHelper.GetProductDetails(info2.ProductId);
                                if (productDetails != null)
                                {
                                    sKU = productDetails.ProductCode;
                                }
                            }
                            if (string.IsNullOrEmpty(sKU))
                            {
                                sKU = "-";
                            }
                            builder.AppendFormat("<td style='text-align:center;'>{0}</td>", sKU);
                            builder.AppendFormat("<td>¥{0}</td>", Math.Round(info2.ItemListPrice, 2));
                            builder.AppendFormat("<td style='padding-left:15px;'>{0}</td>", info2.ShipmentQuantity);
                            builder.AppendFormat("<td style='border-left:1px solid #858585;'>¥{0}</td>", Math.Round((decimal)(info2.GetSubTotal() - info2.DiscountAverage), 2));
                            if (num == 0)
                            {
                                string        str4     = string.Empty;
                                StringBuilder builder2 = new StringBuilder();
                                if (!string.IsNullOrEmpty(info.ActivitiesName))
                                {
                                    builder2.Append("<p>" + info.ActivitiesName + ":¥" + info.DiscountAmount.ToString("F2") + "</p>");
                                }
                                if (!string.IsNullOrEmpty(info.ReducedPromotionName))
                                {
                                    builder2.Append("<p>" + info.ReducedPromotionName + ":¥" + info.ReducedPromotionAmount.ToString("F2") + "</p>");
                                }
                                if (!string.IsNullOrEmpty(info.CouponName))
                                {
                                    builder2.Append("<p>" + info.CouponName + ":¥" + info.CouponAmount.ToString("F2") + "</p>");
                                }
                                if (!string.IsNullOrEmpty(info.RedPagerActivityName))
                                {
                                    builder2.Append("<p>" + info.RedPagerActivityName + ":¥" + info.RedPagerAmount.ToString("F2") + "</p>");
                                }
                                if (info.PointToCash > 0M)
                                {
                                    builder2.Append("<p>积分抵现:¥" + info.PointToCash.ToString("F2") + "</p>");
                                }
                                decimal adjustCommssion = info.GetAdjustCommssion();
                                if (adjustCommssion > 0M)
                                {
                                    builder2.Append("<p>管理员调价优惠:¥" + adjustCommssion.ToString("F2") + "</p>");
                                }
                                else if (adjustCommssion < 0M)
                                {
                                    builder2.Append("<p>管理员调价增加:¥" + adjustCommssion.ToString("F2").Trim(new char[] { '-' }) + "</p>");
                                }
                                str4 = builder2.ToString();
                                builder.AppendFormat("<td rowspan='{0}' colspan='1' style='border-left:1px solid #858585;'>{1}</td>", lineItems.Keys.Count, string.Format("<p><strong>¥{0}</strong></p>" + str4 + "<p>含运费¥{1}</p><p></p>", info.GetTotal().ToString("F2"), info.AdjustedFreight.ToString("F2")));
                            }
                            builder.Append("</tr>");
                            num++;
                        }
                    }
                    builder.Append("</tbody></table>");
                    child.InnerHtml = builder.ToString();
                    this.divContent.Controls.AddAt(0, child);
                }
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(',');

            if (!string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                foreach (OrderInfo printDatum in this.GetPrintData(orderIds))
                {
                    HtmlGenericControl htmlGenericControl = new HtmlGenericControl("div");
                    htmlGenericControl.Attributes["class"] = "order1 print";
                    StringBuilder stringBuilder = new StringBuilder("");
                    stringBuilder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3>{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>手机号码: </span>{3}</li><li><span>生成时间: </span>{1}</li><li><span>订单编号: </span>{2}</li></ul><br class=\"clear\" /></div>", printDatum.ShipTo.ToNullString(), printDatum.OrderDate.ToString("yyyy-MM-dd HH:mm"), printDatum.OrderId, printDatum.CellPhone);
                    stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th nowrap=\"nowrap\">单价</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = printDatum.LineItems;
                    if (lineItems != null)
                    {
                        foreach (string key in lineItems.Keys)
                        {
                            LineItemInfo lineItemInfo = lineItems[key];
                            if (lineItemInfo.Status != LineItemStatus.Refunded && lineItemInfo.Status != LineItemStatus.Returned)
                            {
                                stringBuilder.AppendFormat("<tr><td nowrap=\"nowrap\">{0}</td>", lineItemInfo.SKU);
                                stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ItemDescription);
                                stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.SKUContent);
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", lineItemInfo.ShipmentQuantity);
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", Math.Round(lineItemInfo.ItemListPrice, 2));
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td></tr>", Math.Round(lineItemInfo.GetSubTotal(), 2));
                            }
                        }
                    }
                    stringBuilder.Append("</tbody></table>");
                    string value = "";
                    IList <OrderGiftInfo> gifts = printDatum.Gifts;
                    if (gifts != null && gifts.Count > 0)
                    {
                        OrderGiftInfo orderGiftInfo = gifts[0];
                        stringBuilder.Append("<p style=\"text-align:left;\"><b>&nbsp;</b></p>");
                        stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><thead><tr><th>礼品名称</th><th>成本价</th><th>数量</th><th>类型</th></tr></thead><tbody>");
                        foreach (OrderGiftInfo gift in printDatum.Gifts)
                        {
                            stringBuilder.AppendFormat("<tr><td nowrap=\"nowrap\">{0}</td>", gift.GiftName);
                            stringBuilder.AppendFormat("<td>{0}</td>", gift.CostPrice.F2ToString("f2"));
                            stringBuilder.AppendFormat("<td>{0}</td>", gift.Quantity);
                            stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", (gift.PromoteType == 5) ? "商品促销" : ((gift.PromoteType == 15) ? "订单促销" : "积分兑换"));
                        }
                        stringBuilder.Append("</tbody></table>");
                    }
                    stringBuilder.AppendFormat("<ul class=\"price\"><li><span>收货地址: </span>{0}</li><li><span>送货上门时间: </span>{1}</li></ul>", printDatum.ShippingRegion + printDatum.Address, printDatum.ShipToDate);
                    stringBuilder.AppendFormat("<br class=\"clear\" /><ul class=\"price\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", Math.Round(printDatum.GetAmount(false), 2), Math.Round(printDatum.AdjustedFreight, 2));
                    decimal reducedPromotionAmount = printDatum.ReducedPromotionAmount;
                    if (reducedPromotionAmount > decimal.Zero)
                    {
                        stringBuilder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", Math.Round(reducedPromotionAmount, 2));
                    }
                    if (!string.IsNullOrEmpty(printDatum.CouponCode))
                    {
                        decimal couponValue = printDatum.CouponValue;
                        if (couponValue > decimal.Zero)
                        {
                            stringBuilder.AppendFormat("<li><span>优惠券:</span>{0}</li>", Math.Round(couponValue, 2));
                        }
                    }
                    decimal adjustedDiscount = printDatum.AdjustedDiscount;
                    if (adjustedDiscount > decimal.Zero)
                    {
                        stringBuilder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", Math.Round(adjustedDiscount, 2));
                    }
                    else
                    {
                        stringBuilder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", Math.Round(-adjustedDiscount, 2));
                    }
                    stringBuilder.Append(value);
                    stringBuilder.AppendFormat("<li><span>实付金额:</span>{0}</li>", Math.Round(printDatum.GetTotal(false), 2));
                    stringBuilder.AppendFormat("<li><span>支付方式:</span>{0}</li></ul>", printDatum.PaymentType);
                    stringBuilder.AppendFormat("<br class=\"clear\" /><ul class=\"price\"><li><span>备注: </span>{0}</li></ul><br class=\"clear\" /><br><br>", printDatum.Remark);
                    htmlGenericControl.InnerHtml = stringBuilder.ToString();
                    this.divContent.Controls.AddAt(0, htmlGenericControl);
                }
            }
        }
예제 #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(new char[]
            {
                ','
            });

            if (!string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                foreach (OrderInfo info in this.GetPrintData(orderIds))
                {
                    System.Web.UI.HtmlControls.HtmlGenericControl child = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                    child.Attributes["class"] = "order print";
                    System.Text.StringBuilder builder = new System.Text.StringBuilder("");

                    switch (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AutoShipping)
                    {
                    case true:    /*
                                   * Hidistro.Entities.Members.DistributorsInfo currentDistributor = Hidistro.SaleSystem.Vshop.DistributorsBrower.GetCurrentDistributors(info.ReferralUserId);
                                   * divContent.Attributes.Add("style", "width:300px;text-align: center;margin:0 auto;");
                                   * builder.AppendFormat("<div class=\"info\" style=\"font-size:14px\"><div class=\"prime-info\" style=\"margin-right: 10px;\"></div><ul class=\"sub-info\"><li style=\"text-align:center;width:100%\"><h3>{0}</h3></li><li><span>下单时间: </span>{1}</li><li><span>订单编号: </span>{2}</li><li><span>客户: </span>{3}<br/><span style=\"margin-left: 10px;\">电话: </span>{5}</li><li><span>地址: </span>{4}</li></ul><br class=\"clear\" /></div><div style=\"border-bottom:1px dashed #000; margin-bottom:10px\"></div>", currentDistributor != null ? currentDistributor.StoreName : "总店", info.OrderDate.ToString("yyyy-MM-dd HH:mm"), info.OrderId, info.Username, info.Address, info.CellPhone);
                                   * builder.Append("<table style=\"width:100%;background:#fff;font-size:14px\"><thead><tr><th style=\"width:40%;background:#fff;border:none\">菜名</th><th style=\"background:#fff;border:none\">数量</th><th style=\"background:#fff;border:none\">价格</th></tr></thead><tbody>");
                                   *            System.Collections.Generic.Dictionary<string, LineItemInfo> lineItems1 = info.LineItems;
                                   *            if (lineItems1 != null)
                                   *            {
                                   *                    foreach (string str2 in lineItems1.Keys)
                                   *                    {
                                   *                            LineItemInfo info2 = lineItems1[str2];
                                   *                            builder.AppendFormat("<td>{0}</td>", info2.ItemDescription);
                                   *                            builder.AppendFormat("<td>{0}</td>", info2.ShipmentQuantity);
                                   *                            builder.AppendFormat("<td>{0}</td></tr>", System.Math.Round(info2.GetSubTotal(), 2));
                                   *                    }
                                   *            }
                                   *
                                   * builder.AppendFormat("</tbody></table><div style=\"border-bottom:1px dashed #000; margin-top:10px\"></div><ul class=\"price\" style=\"margin-right:10px;\"><li style=\"text-align:right;width:100%;font-size:14px\">小计: ¥{0}</li>", System.Math.Round(info.GetAmount(), 2));
                                   *            decimal reducedPromotionAmount1 = info.ReducedPromotionAmount;
                                   *            if (reducedPromotionAmount1 > 0m)
                                   *            {
                                   *                    builder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", System.Math.Round(reducedPromotionAmount1, 2));
                                   *            }
                                   *            decimal payCharge1 = info.PayCharge;
                                   *            if (payCharge1 > 0m)
                                   *            {
                                   *                    builder.AppendFormat("<li><span>支付手续费:</span>{0}</li>", System.Math.Round(payCharge1, 2));
                                   *            }
                                   *            if (!string.IsNullOrEmpty(info.CouponCode))
                                   *            {
                                   *                    decimal couponValue = info.CouponValue;
                                   *                    if (couponValue > 0m)
                                   *                    {
                                   *                            builder.AppendFormat("<li><span>优惠券:</span>{0}</li>", System.Math.Round(couponValue, 2));
                                   *                    }
                                   *            }
                                   * builder.AppendFormat("<li style=\"text-align:center;width:100%;font-size:14px;\"><h4>谢谢惠顾!</h4></li><br>");
                                   * //decimal adjustedDiscount1 = info.AdjustedDiscount;
                                   * //if (adjustedDiscount1 > 0m)
                                   * //{
                                   * //    builder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", System.Math.Round(adjustedDiscount1, 2));
                                   * //}
                                   * //else
                                   * //{
                                   * //    builder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", System.Math.Round(-adjustedDiscount1, 2));
                                   * //}
                                   * //builder.AppendFormat("<li><span>实付金额:</span>{0}</li></ul><br class=\"clear\" /><br><br>", System.Math.Round(info.GetTotal(), 2));
                                   */

                        Hidistro.Entities.Members.DistributorsInfo currentDistributor = Hidistro.SaleSystem.Vshop.DistributorsBrower.GetCurrentDistributors(info.ReferralUserId);
                        builder.Append("<div style='width:270px;margin:0 auto;padding:10px;' >");
                        builder.AppendFormat("<div style='font-size:14px;width:100%;text-align:center'><img src='/Templates/vshop/common/images/login_logo2.png' /><h3>SALES MEMO</h3><div style='text-align:left;padding-bottom:5px;'><span>消费门店: </span>{0}</div><div style='text-align:left;padding-bottom:5px;'><span>下单时间: </span>{1}</div><div style='text-align:left;padding-bottom:5px;'><span>订单编号: </span>{2}</div><div style='text-align:left;padding-bottom:5px;'><span>消费客户: </span>{3}</div><div><span style=\"margin-left: 10px;\">电话: </span>{5}</div><div><span>地址: </span>{4}</div> </div><div style='border-bottom:1px dashed #000; margin:10px 0'></div>", currentDistributor != null ? currentDistributor.StoreName : "总店", info.OrderDate.ToString("yyyy-MM-dd HH:mm"), info.OrderId, info.Username, info.Address, info.CellPhone);
                        builder.Append("<table style='width:100%;background:#fff;font-size:14px'><thead><tr><th style='width:60%;background:#fff;border:none;text-align:left;'>菜名</th><th style='background:#fff;border:none'>数量</th><th style='background:#fff;border:none;text-align:right;'>价格</th></tr></thead><tbody>");
                        System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems1 = info.LineItems;
                        if (lineItems1 != null)
                        {
                            foreach (string str2 in lineItems1.Keys)
                            {
                                LineItemInfo info2 = lineItems1[str2];
                                builder.AppendFormat("<td>{0}</td>", info2.ItemDescription);
                                builder.AppendFormat("<td style='text-align:center;'>{0}</td>", info2.ShipmentQuantity);
                                builder.AppendFormat("<td style='text-align:right;'>{0}</td></tr>", System.Math.Round(info2.GetSubShowTotal(), 2));
                            }
                        }
                        builder.AppendFormat("</tbody></table><div style='border-bottom:1px dashed #000; margin:10px 0;'></div>");

                        decimal reducedPromotionAmount1 = info.ReducedPromotionAmount;
                        if (reducedPromotionAmount1 > 0m)
                        {
                            builder.AppendFormat("<div><span>优惠金额:</span>{0}</div>", System.Math.Round(reducedPromotionAmount1, 2));
                        }
                        decimal payCharge1 = info.PayCharge;
                        if (payCharge1 > 0m)
                        {
                            builder.AppendFormat("<div><span>支付手续费:</span>{0}</div>", System.Math.Round(payCharge1, 2));
                        }
                        if (!string.IsNullOrEmpty(info.CouponCode))
                        {
                            decimal couponValue = info.CouponValue;
                            if (couponValue > 0m)
                            {
                                builder.AppendFormat("<div><span>优惠抵扣: </span>¥{0}</div>", System.Math.Round(couponValue, 2));
                            }
                        }
                        //计算买一送一减免
                        decimal giveBuyPrice = 0m;
                        foreach (LineItemInfo itemInfo in info.LineItems.Values)
                        {
                            if (itemInfo.GiveQuantity > 0)
                            {
                                giveBuyPrice += itemInfo.GiveQuantity * itemInfo.ItemAdjustedPrice;
                            }
                        }
                        if (giveBuyPrice > 0m)
                        {
                            builder.AppendFormat("<div style='font-size:14px;margin:5px 0;'><span>买一赠一: </span>¥{0}</div>", System.Math.Round(giveBuyPrice, 2));
                        }
                        //应收
                        builder.AppendFormat("<div style='text-align:left;width:100%;font-size:26px'><span style='font-size:26px'>应收: </span>¥{0}</div>", System.Math.Round(info.GetAmount() - info.CouponValue, 2));
                        builder.AppendFormat("<div style='text-align:center;width:100%;font-size:14px;font-weight:bold;margin-top:30px;'>谢谢光临!Thank you for coming</div><div style='text-align:center;width:100%;font-size:12px;'>广东爽爽挝啡快饮有限公司</div>");
                        builder.Append("</div>");
                        break;

                    default:
                        divContent.Style.Value = "width:700px;text-align: center;margin:0 auto;";
                        builder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3 style=\"font-weight: normal\">{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>生成时间: </span>{1}</li><li><span>订单编号: </span>{2}</li></ul><br class=\"clear\" /></div>", info.ShipTo, info.OrderDate.ToString("yyyy-MM-dd HH:mm"), info.OrderId);
                        builder.Append("<table class=\"tb\"><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr ><th class=\"th1\">货号</th><th class=\"th1\">商品名称</th><th class=\"th1\">规格</th><th class=\"th1\">数量</th><th class=\"th1\">单价</th><th class=\"th1\">总价</th></tr></thead><tbody>");
                        System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = info.LineItems;
                        if (lineItems != null)
                        {
                            foreach (string str2 in lineItems.Keys)
                            {
                                LineItemInfo info2 = lineItems[str2];
                                builder.AppendFormat("<tr ><td class=\"td1\">{0}</td>", info2.SKU);
                                builder.AppendFormat("<td class=\"td1\">{0}</td>", info2.ItemDescription);
                                builder.AppendFormat("<td class=\"td1\">{0}</td>", info2.SKUContent);
                                builder.AppendFormat("<td class=\"td1\">{0}</td>", info2.ShipmentQuantity);
                                builder.AppendFormat("<td class=\"td1\">{0}</td>", System.Math.Round(info2.ItemListPrice, 2));
                                builder.AppendFormat("<td class=\"td1\">{0}</td></tr>", System.Math.Round(info2.GetSubTotal(), 2));
                            }
                        }
                        builder.AppendFormat("</tbody></table><ul class=\"price\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", System.Math.Round(info.GetAmount(), 2), System.Math.Round(info.AdjustedFreight, 2));
                        decimal reducedPromotionAmount = info.ReducedPromotionAmount;
                        if (reducedPromotionAmount > 0m)
                        {
                            builder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", System.Math.Round(reducedPromotionAmount, 2));
                        }
                        decimal payCharge = info.PayCharge;
                        if (payCharge > 0m)
                        {
                            builder.AppendFormat("<li><span>支付手续费:</span>{0}</li>", System.Math.Round(payCharge, 2));
                        }
                        if (!string.IsNullOrEmpty(info.CouponCode))
                        {
                            decimal couponValue = info.CouponValue;
                            if (couponValue > 0m)
                            {
                                builder.AppendFormat("<li><span>优惠券:</span>{0}</li>", System.Math.Round(couponValue, 2));
                            }
                        }
                        decimal adjustedDiscount = info.AdjustedDiscount;
                        if (adjustedDiscount > 0m)
                        {
                            builder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", System.Math.Round(adjustedDiscount, 2));
                        }
                        else
                        {
                            builder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", System.Math.Round(-adjustedDiscount, 2));
                        }
                        builder.AppendFormat("<li><span>实付金额:</span>{0}</li></ul><br class=\"clear\" /><br><br>", System.Math.Round(info.GetTotal(), 2));
                        break;
                    }

                    child.InnerHtml = builder.ToString();
                    this.divContent.Controls.AddAt(0, child);
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 满减活动等打折活动
        /// </summary>
        /// <param name="order"></param>
        /// <param name="ActivitiesId"></param>
        /// <param name="ActivitiesName"></param>
        /// <returns></returns>
        public void getDiscountTotal(System.Web.HttpContext context)
        {
            ShoppingCartInfo shoppingCart;

            shoppingCart = ShoppingCartProcessor.GetShoppingCart(ManagerHelper.GetCurrentManager().UserId);
            OrderInfo order = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCart, false, false, false);

            if (null == order)
            {
                context.Response.Write("{\"success\":false,\"discount\":\"" + 0 + "\"}");
                return;
            }

            decimal      num          = new decimal(0);
            decimal      num1         = new decimal(0);
            decimal      num2         = new decimal(0);
            LineItemInfo lineItemInfo = new LineItemInfo();

            System.Data.DataTable type = ProductBrowser.GetType();
            for (int i = 0; i < type.Rows.Count; i++)
            {
                string  str      = "";
                string  str1     = "";
                decimal subTotal = new decimal(0);
                foreach (KeyValuePair <string, LineItemInfo> lineItem in order.LineItems)
                {
                    lineItemInfo = lineItem.Value;
                    if (string.IsNullOrEmpty(lineItemInfo.MainCategoryPath))
                    {
                        continue;
                    }
                    int    num3             = int.Parse(type.Rows[i]["ActivitiesType"].ToString());
                    string mainCategoryPath = lineItemInfo.MainCategoryPath;
                    char[] chrArray         = new char[] { '|' };
                    if (num3 == int.Parse(mainCategoryPath.Split(chrArray)[0].ToString()))
                    {
                        subTotal = subTotal + lineItemInfo.GetSubTotal();
                    }
                    if (int.Parse(type.Rows[i]["ActivitiesType"].ToString()) != 0)
                    {
                        continue;
                    }
                    subTotal = subTotal + lineItemInfo.GetSubTotal();
                }
                if (subTotal != new decimal(0))
                {
                    //获取所有活动列表
                    System.Data.DataTable allFull = ProductBrowser.GetAllFull(int.Parse(type.Rows[i]["ActivitiesType"].ToString()));



                    if (allFull.Rows.Count > 0)//如果存在活动时进入
                    {
                        //2017-2 如果活动实体类包含了门店id,那么该活动仅对当前门店生效,

                        int currentOrderStoreId    = Convert.ToInt32(context.Request["storeid"]); //当前订单的门店id
                        int currentActivityStoreId = 0;                                           //当前活动的门店id
                        int num0 = 0;

                        int num4 = 0;
                        while (true)
                        {
                            if (num4 >= allFull.Rows.Count)
                            {
                                break;
                            }

                            else if (subTotal >= decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString()))
                            {
                                num1 = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["MeetMoney"].ToString());
                                num  = decimal.Parse(allFull.Rows[allFull.Rows.Count - 1]["ReductionMoney"].ToString());
                                currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0)?Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]):num0;
                                str  = string.Concat(allFull.Rows[allFull.Rows.Count - 1]["ActivitiesId"].ToString(), ",");
                                str1 = string.Concat(allFull.Rows[allFull.Rows.Count - 1]["ActivitiesName"].ToString(), ",");
                                break;
                            }
                            else if (subTotal <= decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString()))
                            {
                                num1 = decimal.Parse(allFull.Rows[0]["MeetMoney"].ToString());
                                num  = num + decimal.Parse(allFull.Rows[0]["ReductionMoney"].ToString());
                                currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0) ? Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]) : num0;
                                str  = string.Concat(allFull.Rows[0]["ActivitiesId"].ToString(), ",");
                                str1 = string.Concat(allFull.Rows[0]["ActivitiesName"].ToString(), ",");
                                break;
                            }
                            else
                            {
                                if (subTotal >= decimal.Parse(allFull.Rows[num4]["MeetMoney"].ToString()))
                                {
                                    num1 = decimal.Parse(allFull.Rows[num4]["MeetMoney"].ToString());
                                    num  = decimal.Parse(allFull.Rows[num4]["ReductionMoney"].ToString());
                                    currentActivityStoreId = int.TryParse(allFull.Rows[allFull.Rows.Count - 1]["storeid"].ToString(), out num0) ? Convert.ToInt32(allFull.Rows[allFull.Rows.Count - 1]["storeid"]) : num0;
                                    str  = string.Concat(allFull.Rows[num4]["ActivitiesId"].ToString(), ",");
                                    str1 = string.Concat(allFull.Rows[num4]["ActivitiesName"].ToString(), ",");
                                }
                                num4++;
                            }
                        }
                        if (subTotal >= num1)
                        {
                            //如果当前门店id不等于当前活动门店id,返回0元,活动id与活动名为null
                            if (currentOrderStoreId != 0 && currentOrderStoreId != currentActivityStoreId)
                            {
                                context.Response.Write("{\"success\":false,\"discount\":\"" + 0 + "\"}");
                                return;
                            }

                            num2 = num2 + num;
                            foreach (KeyValuePair <string, LineItemInfo> keyValuePair in order.LineItems)
                            {
                                LineItemInfo value = keyValuePair.Value;
                                if (string.IsNullOrEmpty(value.MainCategoryPath))
                                {
                                    continue;
                                }
                                int    num5 = int.Parse(type.Rows[i]["ActivitiesType"].ToString());
                                string mainCategoryPath1 = value.MainCategoryPath;
                                char[] chrArray1         = new char[] { '|' };
                                if (num5 != int.Parse(mainCategoryPath1.Split(chrArray1)[0].ToString()) && int.Parse(type.Rows[i]["ActivitiesType"].ToString()) != 0)
                                {
                                    continue;
                                }
                                value.PromotionName = str1.Substring(0, str1.Length - 1);
                                value.PromotionId   = int.Parse(str.Substring(0, str.Length - 1));
                            }
                        }
                    }
                }
            }
            context.Response.Write("{\"success\":true,\"discount\":\"" + num2.ToString("F0") + "\"}");
            return;
        }
예제 #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request["OrderIds"].Trim(new char[]
            {
                ','
            });

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            System.Collections.Generic.List <OrderInfo> printData = this.GetPrintData(text);
            System.Collections.Generic.List <OrderInfo> list      = (from a in printData
                                                                     orderby string.Concat(new object[]
            {
                a.ShipTo,
                a.RegionId,
                a.ExpressCompanyAbb,
                a.Address,
                a.CellPhone
            }) descending
                                                                     select a).ToList <OrderInfo>();
            foreach (OrderInfo current in list)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                htmlGenericControl.Attributes["class"] = "order print";
                htmlGenericControl.Attributes["style"] = "padding-bottom:60px;padding-top:40px;";
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("");
                System.DateTime           dateTime      = current.FinishDate.HasValue ? System.DateTime.Parse(current.FinishDate.ToString()) : current.OrderDate;
                stringBuilder.AppendFormat("<div class=\"info clear\"><ul class=\"sub-info\"><li><span>订单号: </span>{2}</li><li><span>成交时间: </span>{1}</li><li><span>收货人姓名: </span>{0}</li></ul></div>", current.ShipTo, dateTime.ToString("yyyy-MM-dd HH:mm:ss"), current.OrderId);
                stringBuilder.Append("<table><col class=\"col-1\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>商品信息</th><th>商品编码</th><th>单价</th><th>数量</th><th>小计</th><th>总价</th></tr></thead><tbody>");
                System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = current.LineItems;
                if (lineItems != null)
                {
                    int num = 0;
                    foreach (string current2 in lineItems.Keys)
                    {
                        LineItemInfo lineItemInfo = lineItems[current2];
                        string       text2        = string.Empty;
                        if (lineItemInfo.OrderItemsStatus == OrderStatus.Returned)
                        {
                            text2 = "(已退货,金额¥" + lineItemInfo.ReturnMoney.ToString("F2") + ")";
                        }
                        else if (lineItemInfo.OrderItemsStatus == OrderStatus.Refunded)
                        {
                            text2 = "(已退款,金额¥" + lineItemInfo.ReturnMoney.ToString("F2") + ")";
                        }
                        stringBuilder.AppendFormat("<tr><td>{0}</td>", lineItemInfo.ItemDescription + text2 + (string.IsNullOrEmpty(lineItemInfo.SKUContent) ? "" : ("<br>" + lineItemInfo.SKUContent)));
                        text2 = lineItemInfo.SKU;
                        if (string.IsNullOrEmpty(text2))
                        {
                            ProductInfo productDetails = ProductHelper.GetProductDetails(lineItemInfo.ProductId);
                            if (productDetails != null)
                            {
                                text2 = productDetails.ProductCode;
                            }
                        }
                        if (string.IsNullOrEmpty(text2))
                        {
                            text2 = "-";
                        }
                        stringBuilder.AppendFormat("<td style='text-align:center;'>{0}</td>", text2);
                        stringBuilder.AppendFormat("<td>¥{0}</td>", System.Math.Round(lineItemInfo.ItemListPrice, 2));
                        stringBuilder.AppendFormat("<td style='padding-left:15px;'>{0}</td>", lineItemInfo.ShipmentQuantity);
                        stringBuilder.AppendFormat("<td style='border-left:1px solid #858585;'>¥{0}</td>", System.Math.Round(lineItemInfo.GetSubTotal() - lineItemInfo.DiscountAverage, 2));
                        if (num == 0)
                        {
                            string str = string.Empty;
                            System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                            if (!string.IsNullOrEmpty(current.ActivitiesName))
                            {
                                stringBuilder2.Append(string.Concat(new string[]
                                {
                                    "<p>",
                                    current.ActivitiesName,
                                    ":¥",
                                    current.DiscountAmount.ToString("F2"),
                                    "</p>"
                                }));
                            }
                            if (!string.IsNullOrEmpty(current.ReducedPromotionName))
                            {
                                stringBuilder2.Append(string.Concat(new string[]
                                {
                                    "<p>",
                                    current.ReducedPromotionName,
                                    ":¥",
                                    current.ReducedPromotionAmount.ToString("F2"),
                                    "</p>"
                                }));
                            }
                            if (!string.IsNullOrEmpty(current.CouponName))
                            {
                                stringBuilder2.Append(string.Concat(new string[]
                                {
                                    "<p>",
                                    current.CouponName,
                                    ":¥",
                                    current.CouponAmount.ToString("F2"),
                                    "</p>"
                                }));
                            }
                            if (!string.IsNullOrEmpty(current.RedPagerActivityName))
                            {
                                stringBuilder2.Append(string.Concat(new string[]
                                {
                                    "<p>",
                                    current.RedPagerActivityName,
                                    ":¥",
                                    current.RedPagerAmount.ToString("F2"),
                                    "</p>"
                                }));
                            }
                            if (current.PointToCash > 0m)
                            {
                                stringBuilder2.Append("<p>积分抵现:¥" + current.PointToCash.ToString("F2") + "</p>");
                            }
                            decimal adjustCommssion = current.GetAdjustCommssion();
                            if (adjustCommssion > 0m)
                            {
                                stringBuilder2.Append("<p>管理员调价优惠:¥" + adjustCommssion.ToString("F2") + "</p>");
                            }
                            else if (adjustCommssion < 0m)
                            {
                                stringBuilder2.Append("<p>管理员调价增加:¥" + adjustCommssion.ToString("F2").Trim(new char[]
                                {
                                    '-'
                                }) + "</p>");
                            }
                            str = stringBuilder2.ToString();
                            stringBuilder.AppendFormat("<td rowspan='{0}' colspan='1' style='border-left:1px solid #858585;'>{1}</td>", lineItems.Keys.Count, string.Format("<p><strong>¥{0}</strong></p>" + str + "<p>含运费¥{1}</p><p></p>", current.GetTotal().ToString("F2"), current.AdjustedFreight.ToString("F2")));
                        }
                        stringBuilder.Append("</tr>");
                        num++;
                    }
                }
                stringBuilder.Append("</tbody></table>");
                htmlGenericControl.InnerHtml = stringBuilder.ToString();
                this.divContent.Controls.AddAt(0, htmlGenericControl);
            }
        }
예제 #10
0
        public static OrderInfo GetCalculadtionCommission(OrderInfo order)
        {
            DistributorsDao     dao             = new DistributorsDao();
            DistributorGradeDao dao2            = new DistributorGradeDao();
            DistributorsInfo    distributorInfo = dao.GetDistributorInfo(order.ReferralUserId);

            if (distributorInfo != null)
            {
                decimal  num         = 0M;
                decimal  num2        = 0M;
                decimal  num3        = 0M;
                DataView defaultView = dao2.GetAllDistributorGrade().DefaultView;
                if (distributorInfo.DistriGradeId.ToString() != "0")
                {
                    defaultView.RowFilter = " GradeId=" + distributorInfo.DistriGradeId;
                    if (defaultView.Count > 0)
                    {
                        num = decimal.Parse(defaultView[0]["FirstCommissionRise"].ToString());
                    }
                }
                if (!string.IsNullOrEmpty(distributorInfo.ReferralPath) && (distributorInfo.ReferralPath != "0"))
                {
                    string[] strArray = distributorInfo.ReferralPath.Split(new char[] { '|' });
                    if (strArray.Length == 1)
                    {
                        DistributorsInfo info2 = dao.GetDistributorInfo(int.Parse(strArray[0]));
                        if (info2.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info2.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num2 = decimal.Parse(defaultView[0]["SecondCommissionRise"].ToString());
                            }
                        }
                    }
                    else
                    {
                        DistributorsInfo info3 = dao.GetDistributorInfo(int.Parse(strArray[1]));
                        if (info3.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info3.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num2 = decimal.Parse(defaultView[0]["SecondCommissionRise"].ToString());
                            }
                        }
                        DistributorsInfo info4 = dao.GetDistributorInfo(int.Parse(strArray[0]));
                        if (info4.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info4.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num3 = decimal.Parse(defaultView[0]["ThirdCommissionRise"].ToString());
                            }
                        }
                    }
                }
                Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                LineItemInfo info5 = new LineItemInfo();
                DataView     view2 = new CategoryDao().GetCategories(order.wid).DefaultView;
                string       str   = null;
                string       str2  = null;
                string       str3  = null;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    info5 = pair.Value;
                    if (info5.Type == 0)
                    {
                        info5.ItemsCommission       = num;
                        info5.SecondItemsCommission = num2;
                        info5.ThirdItemsCommission  = num3;
                        decimal num4 = (info5.GetSubTotal() - info5.DiscountAverage) - info5.ItemAdjustedCommssion;
                        if (num4 > 0M)
                        {
                            if (info5.IsSetCommission)
                            {
                                info5.ItemsCommission       = ((info5.FirstCommission + num) / 100M) * num4;
                                info5.SecondItemsCommission = ((info5.SecondCommission + num2) / 100M) * num4;
                                info5.ThirdItemsCommission  = ((info5.ThirdCommission + num3) / 100M) * num4;
                            }
                            else
                            {
                                DataTable productCategories = new ProductDao().GetProductCategories(info5.ProductId);
                                if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                                {
                                    view2.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                                    str             = view2[0]["FirstCommission"].ToString();
                                    str2            = view2[0]["SecondCommission"].ToString();
                                    str3            = view2[0]["ThirdCommission"].ToString();
                                    if ((!string.IsNullOrEmpty(str) && !string.IsNullOrEmpty(str2)) && !string.IsNullOrEmpty(str3))
                                    {
                                        info5.ItemsCommission       = ((decimal.Parse(str) + num) / 100M) * num4;
                                        info5.SecondItemsCommission = ((decimal.Parse(str2) + num2) / 100M) * num4;
                                        info5.ThirdItemsCommission  = ((decimal.Parse(str3) + num3) / 100M) * num4;
                                    }
                                }
                            }
                        }
                        else
                        {
                            info5.ItemsCommission       = 0M;
                            info5.SecondItemsCommission = 0M;
                            info5.ThirdItemsCommission  = 0M;
                        }
                        if (!string.IsNullOrEmpty(distributorInfo.ReferralPath) && (distributorInfo.ReferralPath != "0"))
                        {
                            if (distributorInfo.ReferralPath.Split(new char[] { '|' }).Length == 1)
                            {
                                info5.ThirdItemsCommission = 0M;
                            }
                        }
                        else
                        {
                            info5.SecondItemsCommission = 0M;
                            info5.ThirdItemsCommission  = 0M;
                        }
                    }
                }
            }
            return(order);
        }
예제 #11
0
        public static bool UpdateCalculationCommission(OrderInfo order)
        {
            DistributorsInfo userIdDistributors = GetUserIdDistributors(order.ReferralUserId);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                LineItemInfo info2       = new LineItemInfo();
                DataView     defaultView = CategoryBrowser.GetAllCategories().DefaultView;
                string       str2        = null;
                string       str3        = null;
                string       str4        = null;
                decimal      subTotal    = 0M;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    string key = pair.Key;
                    info2 = pair.Value;
                    DataTable productCategories = ProductBrowser.GetProductCategories(info2.ProductId);
                    if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                    {
                        defaultView.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                        str2 = defaultView[0]["FirstCommission"].ToString();
                        str3 = defaultView[0]["SecondCommission"].ToString();
                        str4 = defaultView[0]["ThirdCommission"].ToString();

                        //计算分销 一口价 减 成本价 乘以 佣金比例
                        if ((!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str3)) && !string.IsNullOrEmpty(str4))
                        {
                            ArrayList referralBlanceList = new ArrayList();
                            ArrayList userIdList         = new ArrayList();
                            ArrayList ordersTotalList    = new ArrayList();
                            subTotal = info2.GetSubTotal();

                            //三级分店
                            referralBlanceList.Add((decimal.Parse(str2.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                            userIdList.Add(order.ReferralUserId);
                            ordersTotalList.Add(subTotal);

                            if (userIdDistributors.ParentUserId > 0)
                            {
                                referralBlanceList.Add((decimal.Parse(str3.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                                userIdList.Add(userIdDistributors.ParentUserId);
                                ordersTotalList.Add(subTotal);

                                if (userIdDistributors.ReferralUserId2 > 0)
                                {
                                    referralBlanceList.Add((decimal.Parse(str4.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                                    userIdList.Add(userIdDistributors.ReferralUserId2);
                                    ordersTotalList.Add(subTotal);
                                }
                            }

                            flag = new DistributorsDao().UpdateCalculationCommission(userIdList, referralBlanceList, order.OrderId, ordersTotalList, order.UserId.ToString());
                        }
                    }
                }
                flag = new DistributorsDao().UpdateDistributorsOrderNum(order.ReferralUserId.ToString(), order.GetTotal().ToString());
                RemoveDistributorCache(userIdDistributors.UserId);
            }
            return(flag);
        }
예제 #12
0
        protected override void AttachChildControls()
        {
            this.litstorename = (Literal)this.FindControl("litstorename");
            string startDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
            string endDate   = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";


            string  modeName                = "本店";
            int     userid                  = 0;
            int     couponCount             = 0;
            decimal couponTotalPrice        = 0m;//优惠券总价
            int     giveCount               = 0;
            int     halfCount               = 0;
            decimal halfPrice               = 0m; //第二杯半价总价
            decimal givePrice               = 0m; //买一送一总价
            int     orderCount              = 0;  //订单总数
            int     givequantity            = 0;  //商品总数
            decimal orderTotalPrice         = 0m; //订单总价
            int     pcOrderCount            = 0;  //店内订单总数
            decimal pcOrderTotalPrice       = 0m; //店内订单总价
            int     mobileOrderCount        = 0;  //移动端订单总数
            int     microPayOrderCount      = 0;  //店内微信扫码支付总数
            decimal microPayOrderTotalPrice = 0m; //店内微信扫码支付总价
            decimal mobileOrderTotalPrice   = 0m; //移动端订单总价
            decimal totalPriceGot           = 0m; //实收总价

            string backJson = string.Empty;

            try
            {
                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                //ManagerInfo currentManager = ManagerHelper.GetCurrentManager();

                int    sendId    = ManagerHelper.getSenderIdByClientUserId(currentMember.UserId);
                int    senderId  = 0;
                string storeName = "";
                if (sendId != 0)
                {
                    senderId  = sendId;
                    storeName = ManagerHelper.getPcOrderStorenameBySender(sendId); //DistributorsBrower.GetUserIdDistributors(DistributorsBrower.GetSenderDistributorId(senderId.ToString())).StoreName;
                }
                else
                {
                    return;
                }
                userid = currentMember.UserId;
                IList <string> orderIds = OrderHelper.GetTodayOrders(startDate, endDate, senderId, storeName, userid, modeName); //将今天的orderid拆分成数组
                string         rrr      = "";
                foreach (string a in orderIds)
                {
                    rrr += a + ",";
                }
                DataTable dtProducts = OrderHelper.GetTodayProducts(startDate, endDate, senderId, storeName, userid, modeName);//将今天的所有卖出的商品存在DataTable里,下面循环会往里面填值
                dtProducts.PrimaryKey = new DataColumn[] { dtProducts.Columns["ProductId"] };

                System.Text.StringBuilder builder = new System.Text.StringBuilder("");
                //头部,开始时间,结束时间,制单时间
                builder.Append("<div style='width:270px;margin:0 auto;padding:10px;overflow:hidden' >");
                builder.AppendFormat("<div style='font-size:14px;width:100%;text-align:center'><h3>门店统计日结报表</h3><div style='text-align:left;padding-bottom:5px;'><span>开始时间: </span>{0}</div><div style='text-align:left;padding-bottom:5px;'><span>结束时间: </span>{1}</div><div style='text-align:left;padding-bottom:5px;'><span>制单时间: </span>{2}</div></div><div style='border-bottom:1px dashed #000; margin:10px 0'></div>", startDate.ToString(), endDate.ToString(), DateTime.Now.ToString());
                //列表table
                builder.Append("<table style='width:100%;font-size:14px'><thead><tr><th style='width:40%;border:none;text-align:left;'>项目</th><th style='border:none;width:30%;'>数量</th><th style='border:none;text-align:right;'>价格</th></tr></thead><tbody>");
                foreach (string orderId in orderIds)
                {
                    OrderQuery query = new OrderQuery
                    {
                        OrderId = orderId,
                    };
                    OrderInfo order   = OrderHelper.GetOrderInfo(orderId);
                    int       SendOut = 0;
                    if (order.ManagerRemark != null)
                    {
                        SendOut = order.ManagerRemark.IndexOf("退单");
                    }
                    if (order.ManagerRemark == null || SendOut < 0)
                    {
                        System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems1 = order.LineItems;
                        IList <OrderGiftInfo> giftItems = order.Gifts;
                        //统计优惠券总价
                        if (!string.IsNullOrEmpty(order.CouponCode))
                        {
                            couponCount++;
                            couponTotalPrice += System.Math.Round(order.CouponValue);
                        }
                        //统计堂食总价和数量
                        if ((order.Username == "[堂食用户]" || order.Username == "[匿名用户]" || order.Username == "[活动用户]") && order.RealModeName != "微信扫码支付")
                        {
                            pcOrderCount++;
                            pcOrderTotalPrice += order.GetTotal();//实际消费(减去了买一送一和优惠券的金额)
                            totalPriceGot     += order.GetTotal();
                        }
                        //统计移动端的总价和数量
                        if (order.Username != "[堂食用户]" && order.Username != "[匿名用户]" && order.Username != "[活动用户]")
                        {
                            mobileOrderCount++;
                            mobileOrderTotalPrice += order.GetTotal();
                        }
                        //统计店内微信扫码支付总价和数量
                        if ((order.Username == "[堂食用户]" || order.Username == "[匿名用户]" || order.Username == "[活动用户]") && order.RealModeName == "微信扫码支付")
                        {
                            microPayOrderCount++;
                            microPayOrderTotalPrice += order.GetTotal();
                        }
                        //订单数量和总价统计
                        orderCount++;
                        orderTotalPrice += order.GetShowAmount();

                        if (lineItems1 != null)
                        {
                            foreach (string str2 in lineItems1.Keys)
                            {
                                LineItemInfo info2 = lineItems1[str2];
                                //统计商品总数量
                                givequantity += info2.Quantity;
                                //统计买一送一赠送总价
                                giveCount += info2.GiveQuantity;
                                if (info2.GiveQuantity > 0)
                                {
                                    givePrice += (info2.GetSubShowTotal() - info2.GetSubTotal());//计算出买一送一的价格
                                }
                                //统计第二杯半价数量
                                halfCount += info2.HalfPriceQuantity;
                                if (info2.HalfPriceQuantity > 0)
                                {
                                    halfPrice += (info2.GetSubShowTotal() - info2.GetSubTotal());//计算出第二杯半价的价格
                                }

                                //查找商品表,根据productid来刷新相应的商品的数量和金额
                                DataRow drProduct = dtProducts.Rows.Find(info2.ProductId);
                                if (drProduct != null)
                                {
                                    drProduct["quantity"] = Convert.ToInt32(drProduct["quantity"]) + info2.Quantity;
                                    drProduct["Price"]    = Convert.ToDecimal(drProduct["Price"]) + info2.GetSubShowTotal();
                                }
                            }
                        }
                        if (giftItems.Count > 0)
                        {
                            foreach (OrderGiftInfo giftInfo in giftItems)
                            {
                                builder.AppendFormat("<td>{0}</td>", giftInfo.GiftName + "(礼品)");
                                builder.AppendFormat("<td style='text-align:center;'>{0}</td>", giftInfo.Quantity);
                                builder.AppendFormat("<td style='text-align:right;'>{0}</td></tr>", giftInfo.costPoint.ToString() + "积分");
                            }
                        }
                    }
                }
                foreach (DataRow row in dtProducts.Rows)
                {
                    builder.AppendFormat("<td>{0}</td>", row["ProductName"].ToString());
                    builder.AppendFormat("<td style='text-align:center;'>{0}</td>", row["quantity"].ToString());
                    builder.AppendFormat("<td style='text-align:right;'>{0}</td></tr>", Convert.ToDecimal(row["price"]).ToString("F2"));
                }

                builder.AppendFormat("</tbody></table><div style='border-bottom:1px dashed #000; margin:10px 0;'></div>");
                //底部
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>订单总数:</span>{0}</div>", orderCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>杯杯总计:</span>{0}</div>", givequantity);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>实收金额:</span>{0}</div>", Convert.ToDouble(totalPriceGot));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>消费金额:</span>{0}</div>", Convert.ToDouble(orderTotalPrice));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>微信订单:</span>{0}</div>", mobileOrderCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>微信消费:</span>{0}</div>", Convert.ToDouble(mobileOrderTotalPrice));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>店内订单:</span>{0}</div>", pcOrderCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>店内消费:</span>{0}</div>", Convert.ToDouble(pcOrderTotalPrice));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>扫码支付订单:</span>{0}</div>", microPayOrderCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>扫码支付消费:</span>{0}</div>", Convert.ToDouble(microPayOrderTotalPrice));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>买送数量:</span>{0}</div>", giveCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>买送减免:</span>{0}</div>", Convert.ToDouble(givePrice));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>半价数量:</span>{0}</div>", halfCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>半价减免:</span>{0}</div>", Convert.ToDouble(halfPrice));
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;padding-bottom:3px;'><span>优惠券数量:</span>{0}</div>", couponCount);
                builder.AppendFormat("<div style='width:50%;float:left;font-size:14px;text-align:right;padding-bottom:3px;'><span>优惠券减免:</span>{0}</div>", Convert.ToDouble(couponTotalPrice));
                builder.Append("</div>");
                litstorename.Text = builder.ToString();
            }
            catch (Exception ex)
            {
                string backjson = string.Format("\"success\":true,\"errmsg\":\"{0}\"", ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string orderIds = base.Request["orderIds"].Trim(',');

            if (!string.IsNullOrEmpty(base.Request["orderIds"]))
            {
                foreach (OrderInfo printDatum in this.GetPrintData(orderIds))
                {
                    HtmlGenericControl htmlGenericControl = new HtmlGenericControl("div");
                    htmlGenericControl.Attributes["class"] = "order1 print";
                    StringBuilder stringBuilder = new StringBuilder("");
                    stringBuilder.AppendFormat("<div class=\"info\"><div class=\"prime-info\" style=\"margin-right: 20px;\"><p><span><h3>{0}</h3></span></p></div><ul class=\"sub-info\"><li><span>手机号码: </span>{3}</li><li><span>生成时间: </span>{1}</li><li><span>订单编号: </span>{2}</li></ul><br class=\"clear\" /></div>", printDatum.ShipTo.ToNullString(), printDatum.OrderDate.ToString("yyyy-MM-dd HH:mm"), printDatum.OrderId, printDatum.CellPhone);
                    stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>货号</th><th>商品名称</th><th>规格</th><th>数量</th><th nowrap=\"nowrap\">单价</th><th>总价</th></tr></thead><tbody>");
                    Dictionary <string, LineItemInfo> lineItems = printDatum.LineItems;
                    if (lineItems != null)
                    {
                        foreach (string key in lineItems.Keys)
                        {
                            LineItemInfo lineItemInfo = lineItems[key];
                            if (lineItemInfo.Status != LineItemStatus.Refunded && lineItemInfo.Status != LineItemStatus.Returned)
                            {
                                stringBuilder.AppendFormat("<tr><td nowrap=\"nowrap\">{0}</td>", lineItemInfo.SKU);
                                stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.ItemDescription);
                                stringBuilder.AppendFormat("<td>{0}</td>", lineItemInfo.SKUContent);
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", lineItemInfo.ShipmentQuantity);
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", Math.Round(lineItemInfo.ItemListPrice, 2));
                                stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td></tr>", Math.Round(lineItemInfo.GetSubTotal(), 2));
                            }
                        }
                    }
                    stringBuilder.Append("</tbody></table>");
                    string value = "";
                    IList <OrderGiftInfo> gifts = printDatum.Gifts;
                    if (gifts != null && gifts.Count > 0)
                    {
                        OrderGiftInfo orderGiftInfo = gifts[0];
                        stringBuilder.Append("<p style=\"text-align:left;\"><b>&nbsp;</b></p>");
                        stringBuilder.Append("<table><col class=\"col-0\" /><col class=\"col-1\" /><col class=\"col-2\" /><col class=\"col-3\" /><thead><tr><th>礼品名称</th><th>市场参考价</th><th>数量</th><th>类型</th></tr></thead><tbody>");
                        foreach (OrderGiftInfo gift in printDatum.Gifts)
                        {
                            stringBuilder.AppendFormat("<tr><td nowrap=\"nowrap\">{0}</td>", gift.GiftName);
                            stringBuilder.AppendFormat("<td>{0}</td>", gift.CostPrice.F2ToString("f2"));
                            stringBuilder.AppendFormat("<td>{0}</td>", gift.Quantity);
                            stringBuilder.AppendFormat("<td nowrap=\"nowrap\">{0}</td>", (gift.PromoteType == 5) ? "商品促销" : ((gift.PromoteType == 15) ? "订单促销" : "积分兑换"));
                        }
                        stringBuilder.Append("</tbody></table>");
                    }
                    stringBuilder.AppendFormat("<ul class=\"price\">");
                    if (!string.IsNullOrEmpty(printDatum.InvoiceTitle))
                    {
                        stringBuilder.AppendFormat("<li><span>发票抬头:</span>{0}</li>", printDatum.InvoiceTitle);
                        if (printDatum.InvoiceType == InvoiceType.Enterprise)
                        {
                            stringBuilder.AppendFormat("<li><span>企业纳税人识别号:</span>{0}</li>", printDatum.InvoiceTaxpayerNumber);
                        }
                    }
                    stringBuilder.AppendFormat("<li><span>收货地址: </span>{0}</li><li><span>送货上门时间: </span>{1}</li></ul>", printDatum.ShippingRegion + printDatum.Address, printDatum.ShipToDate);
                    stringBuilder.AppendFormat("<br class=\"clear\" /><ul class=\"price\"><li><span>商品总价: </span>{0}</li><li><span>运费: </span>{1}</li>", Math.Round(printDatum.GetAmount(false), 2), Math.Round(printDatum.AdjustedFreight, 2));
                    decimal reducedPromotionAmount = printDatum.ReducedPromotionAmount;
                    if (reducedPromotionAmount > decimal.Zero)
                    {
                        stringBuilder.AppendFormat("<li><span>优惠金额:</span>{0}</li>", Math.Round(reducedPromotionAmount, 2));
                    }
                    if (!string.IsNullOrEmpty(printDatum.CouponCode))
                    {
                        decimal couponValue = printDatum.CouponValue;
                        if (couponValue > decimal.Zero)
                        {
                            stringBuilder.AppendFormat("<li><span>优惠券:</span>{0}</li>", Math.Round(couponValue, 2));
                        }
                    }
                    decimal adjustedDiscount = printDatum.AdjustedDiscount;
                    if (adjustedDiscount > decimal.Zero)
                    {
                        stringBuilder.AppendFormat("<li><span>管理员手工加价:</span>{0}</li>", Math.Round(adjustedDiscount, 2));
                    }
                    else
                    {
                        stringBuilder.AppendFormat("<li><span>管理员手工减价:</span>{0}</li>", Math.Round(-adjustedDiscount, 2));
                    }
                    stringBuilder.Append(value);
                    stringBuilder.AppendFormat("<li><span>实付金额:</span>{0}</li>", Math.Round(printDatum.GetTotal(false), 2));
                    stringBuilder.AppendFormat("<li><span>支付方式:</span>{0}</li></ul>", printDatum.PaymentType);
                    if (HiContext.Current.SiteSettings.IsOpenCertification && printDatum.IsincludeCrossBorderGoods && printDatum.OrderStatus != OrderStatus.WaitBuyerPay)
                    {
                        StringBuilder stringBuilder2 = new StringBuilder();
                        if (!string.IsNullOrWhiteSpace(printDatum.IDNumber) || !string.IsNullOrWhiteSpace(printDatum.IDImage1) || !string.IsNullOrWhiteSpace(printDatum.IDImage2))
                        {
                            stringBuilder2.AppendFormat("<li><span class=\"txtright\"> 收货人:</span>{0}</li>", printDatum.ShipTo);
                        }
                        if (!string.IsNullOrWhiteSpace(printDatum.IDNumber))
                        {
                            stringBuilder2.AppendFormat("<li><span>身份证号:</span>{0}</li>", HiCryptographer.Decrypt(printDatum.IDNumber));
                        }
                        if (HiContext.Current.SiteSettings.CertificationModel == 2 && ((!string.IsNullOrWhiteSpace(printDatum.IDImage1) && this.IsImageUrlExists(printDatum.IDImage1)) || (!string.IsNullOrWhiteSpace(printDatum.IDImage2) && this.IsImageUrlExists(printDatum.IDImage2))))
                        {
                            stringBuilder2.AppendFormat("<li><span>身份证照:</span><div>");
                            if (!string.IsNullOrWhiteSpace(printDatum.IDImage1))
                            {
                                stringBuilder2.AppendFormat("<img src='{0}' runat ='server' alt='证件照正面' clientidmode='Static'/>", printDatum.IDImage1);
                            }
                            if (!string.IsNullOrWhiteSpace(printDatum.IDImage2))
                            {
                                stringBuilder2.AppendFormat("<img src='{0}' runat ='server' alt='证件照反面' clientidmode ='Static'/>", printDatum.IDImage2);
                            }
                            stringBuilder2.AppendFormat("{0}", stringBuilder2.ToString().Contains("img") ? "</div></li>" : "");
                        }
                        if (stringBuilder2.ToString() != string.Empty)
                        {
                            stringBuilder2.AppendFormat("</ul>");
                            stringBuilder2.Insert(0, "<br class=\"clear\" /><ul class=\"idInfo\">");
                            stringBuilder.Append(stringBuilder2.ToString());
                        }
                    }
                    stringBuilder.AppendFormat("<br class=\"clear\" /><ul class=\"price\"><li><span>备注: </span>{0}</li></ul><br class=\"clear\" /><br><br>", printDatum.Remark);
                    htmlGenericControl.InnerHtml = stringBuilder.ToString();
                    this.divContent.Controls.AddAt(0, htmlGenericControl);
                }
            }
        }