📄 printorder.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Components;
using PowerEasy.Enumerations;
using PowerEasy.ExtendedControls;
using PowerEasy.Model.Shop;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using System;
using System.Drawing;
using System.Text;
using System.Web.UI.WebControls;
public class PrintOrder : AdminPage
{
protected ExtendedButton BtnPrint;
protected ExtendedButton BtnShowButton;
protected Label LblAddress;
protected Label LblAgentName;
protected Label LblBeginDate;
protected Label LblClientName;
protected Label LblContacterName;
protected Label LblDeliverStatus;
protected Label LblDeliverType;
protected Label LblEmail;
protected Label LblInputTime;
protected Label LblInvoiceContent;
protected Label LblInvoiced;
protected Label LblMobile;
protected Label LblMoneyTotal;
protected Label LblNeedInvoice;
protected Label LblOrderNum;
protected Label LblPaymentType;
protected Label LblPhone;
protected Label LblRemark;
protected Label LblStatus;
protected Label LblUserName;
protected Label LblZipCode;
protected string m_MoneyReceipt = "";
protected decimal m_SubTotal;
protected StringBuilder m_SumInfo;
protected decimal m_TotalMoney;
protected int m_TotalPresentExp;
protected decimal m_TotalPresentMoney;
protected int m_TotalPresentPoint;
protected Repeater RptOrderItem;
protected void BtnShowButton_Click(object sender, EventArgs e)
{
BasePage.ResponseRedirect("OrderManage.aspx?OrderID=" + BasePage.RequestInt32("OrderID").ToString());
}
protected void BuildSumInfo()
{
int orderId = BasePage.RequestInt32("OrderID");
if (orderId != 0)
{
OrderInfo orderById = Order.GetOrderById(orderId);
if (orderById.IsNull)
{
AdminPage.WriteErrMsg("<li>OrderID不存在!</li>", "OrderList.aspx");
}
else
{
this.DataBind(orderById);
this.RptOrderItem.DataSource = OrderItem.GetInfoListByOrderId(orderId);
this.RptOrderItem.DataBind();
}
this.m_SumInfo = new StringBuilder();
this.m_SumInfo.Append(" 运费:");
this.m_SumInfo.Append(orderById.ChargeDeliver.ToString("N2"));
this.m_SumInfo.Append("元 ");
string str = "";
this.m_TotalMoney = this.m_SubTotal;
str = ("实际金额:" + this.m_TotalMoney.ToString("N2")) + " + " + orderById.ChargeDeliver.ToString("N2") + "";
this.m_TotalMoney += orderById.ChargeDeliver;
str = str + "=" + this.m_TotalMoney.ToString("N2") + "元";
this.m_SumInfo.Append("<br/>");
this.m_SumInfo.Append(str);
this.m_SumInfo.Append("<br/>");
this.m_SumInfo.Append("返还 <font color='red'>");
this.m_SumInfo.Append((orderById.PresentMoney + this.m_TotalPresentMoney).ToString("N2"));
this.m_SumInfo.Append("</font>");
this.m_SumInfo.Append(" 元现金券,赠送 <font color='red'>");
this.m_SumInfo.Append((orderById.PresentExp + this.m_TotalPresentExp).ToString());
this.m_SumInfo.Append("</font>");
this.m_SumInfo.Append(" 点积分,赠送 <font color='red'>");
this.m_SumInfo.Append((orderById.PresentPoint + this.m_TotalPresentPoint).ToString());
this.m_SumInfo.Append("</font>");
this.m_SumInfo.Append(SiteConfig.UserConfig.PointUnit + SiteConfig.UserConfig.PointName);
if (orderById.MoneyReceipt < orderById.MoneyTotal)
{
this.m_MoneyReceipt = "<font color=red>" + orderById.MoneyReceipt.ToString("N2") + "</font>";
this.m_MoneyReceipt = this.m_MoneyReceipt + "<font color=blue> 尚欠款:¥" + ((orderById.MoneyTotal - orderById.MoneyReceipt)).ToString("N2") + "</font>";
}
else
{
this.m_MoneyReceipt = "<font color=red>" + orderById.MoneyReceipt.ToString("N2") + "</font>";
}
}
else
{
AdminPage.WriteErrMsg("<li>请指定OrderID!</li>", "OrderList.aspx");
}
}
protected void DataBind(OrderInfo info)
{
this.LblOrderNum.Text = info.OrderNum;
this.LblUserName.Text = info.UserName;
this.LblAgentName.Text = info.AgentName;
this.LblClientName.Text = info.ClientName;
if (info.NeedInvoice)
{
this.LblNeedInvoice.Text = "√";
}
else
{
this.LblNeedInvoice.Text = "\x00d7";
this.LblNeedInvoice.ForeColor = Color.FromArgb(0xff0000);
}
if (info.Invoiced)
{
this.LblInvoiced.Text = "√";
}
else
{
this.LblInvoiced.Text = "\x00d7";
this.LblInvoiced.ForeColor = Color.FromArgb(0xff0000);
}
this.LblStatus.Text = BasePage.EnumToHtml<OrderStatus>(info.Status);
switch (Order.GetPayStatus(info))
{
case PayStatus.WaitForPay:
this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.WaitForPay);
break;
case PayStatus.ReceivedEarnest:
this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.ReceivedEarnest);
break;
case PayStatus.Payoff:
this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.Payoff);
break;
}
this.LblDeliverStatus.Text = BasePage.EnumToHtml<DeliverStatus>(info.DeliverStatus);
if (info.NeedInvoice)
{
this.LblInvoiceContent.Text = info.InvoiceContent;
}
this.LblRemark.Text = info.Remark;
this.LblBeginDate.Text = info.BeginDate.ToString("yyyy-MM-dd");
this.LblInputTime.Text = Convert.ToString(info.InputTime);
this.LblContacterName.Text = info.ContacterName;
this.LblAddress.Text = info.Address;
this.LblZipCode.Text = info.ZipCode;
this.LblMobile.Text = info.Mobile;
this.LblPhone.Text = info.Phone;
this.LblEmail.Text = info.Email;
this.LblPaymentType.Text = PaymentType.GetPaymentTypeById(info.PaymentType).TypeName;
this.LblDeliverType.Text = DeliverType.GetDeliverTypeById(info.DeliverType).TypeName;
}
protected string GetProductName(string productName, int saleType)
{
string str = "";
switch (saleType)
{
case 1:
str = "";
break;
case 2:
str = " (换购)";
break;
case 3:
str = " (赠送)";
break;
case 4:
str = " (批发)";
break;
}
return (productName + str);
}
protected void Page_Load(object sender, EventArgs e)
{
this.BuildSumInfo();
}
protected void RptOrderItem_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
OrderItemInfo dataItem = (OrderItemInfo) e.Item.DataItem;
Literal literal = e.Item.FindControl("LtrServiceTerm") as Literal;
literal.Text = dataItem.ServiceTerm.ToString() + BasePage.EnumToHtml<ServiceTermUnit>(dataItem.ServiceTermUnit);
if (!string.IsNullOrEmpty(dataItem.Remark))
{
((HyperLink) e.Item.FindControl("LnkItemRemark")).Text = "查看";
((HyperLink) e.Item.FindControl("LnkItemRemark")).ToolTip = dataItem.Remark;
}
this.m_SubTotal += dataItem.Amount * dataItem.TruePrice;
this.m_TotalPresentExp += dataItem.Amount * dataItem.PresentExp;
this.m_TotalPresentMoney += dataItem.Amount * dataItem.PresentMoney;
this.m_TotalPresentPoint += dataItem.Amount * dataItem.PresentPoint;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -