Example #1
0
        void OutputSumInfo(WebBrowser webBrowser1, SumInfo info)
        {
            int nColCount = 6;

            if (string.IsNullOrEmpty(info.TotalPrice1) == false)
            {
                nColCount = 8;
            }

            StringBuilder text = new StringBuilder();

            text.Append("\r\n<table class='sum'>\r\n\t<tr class='seller'>");
            text.Append("<td colspan='" + nColCount + "'>"
                        + (string.IsNullOrEmpty(info.Seller) ? "[空]" : HttpUtility.HtmlEncode(info.Seller))
                        + "</td>\r\n\t</tr>");

            text.Append("\r\n\t<tr class='amount'>");

            text.Append("\r\n\t\t<td class='name'>种</td>");
            text.Append("<td class='value'>" + info.BiblioCount + "</td>");
            text.Append("\r\n\t\t<td class='name'>册</td>");
            text.Append("<td class='value'>" + info.CopyCount + "</td>");
            text.Append("\r\n\t\t<td class='name'>总金额</td>");
            text.Append("<td class='value'>" + info.TotalPrice + "</td>");

            if (string.IsNullOrEmpty(info.TotalPrice1) == false)
            {
                text.Append("\r\n\t\t<td class='name'>总金额(汇率计算后)</td>");
                text.Append("<td class='value'>" + info.TotalPrice1 + "</td>");
            }

            text.Append("\r\n\t</tr>\r\n</table>\r\n");

            AppendHtml(webBrowser1, text.ToString(), false);
        }
Example #2
0
        public SumInfo GetSumInfo(List <RateItem> rate_table)
        {
            List <string> totalprices = new List <string>();

            SumInfo info = new SumInfo();

            info.Seller = this.Seller;
            foreach (OrderListItem item in _items)
            {
                info.BiblioCount++;
                info.CopyCount += item.Copy;
                totalprices.Add(item.TotalPrice);
            }

            if (totalprices.Count > 1)
            {
                string        strError   = "";
                List <string> sum_prices = null;
                int           nRet       = PriceUtil.TotalPrice(totalprices,
                                                                out sum_prices,
                                                                out strError);
                if (nRet == -1)
                {
                    info.TotalPrice = strError;
                }
                else
                {
                    // Debug.Assert(sum_prices.Count == 1, "");
                    // info.TotalPrice = sum_prices[0];
                    info.TotalPrice = PriceUtil.JoinPriceString(sum_prices);
                }
            }
            else if (totalprices.Count == 1)
            {
                info.TotalPrice = totalprices[0];
            }

            // 计算汇率
            if (rate_table != null && string.IsNullOrEmpty(info.TotalPrice) == false)
            {
                try
                {
                    string strRatePrice = RateItem.RatePrices(
                        rate_table,
                        info.TotalPrice);
                    info.TotalPrice1 = strRatePrice;
                    if (info.TotalPrice == info.TotalPrice1)
                    {
                        info.TotalPrice1 = "";
                    }
                }
                catch (Exception ex)
                {
                    info.TotalPrice1 = ex.Message;
                }
            }

            return(info);
        }
Example #3
0
        public void FillInWebBrowser(WebBrowser webBrowser,
                                     List <RateItem> rate_table)
        {
            OutputBegin(webBrowser);

            SumInfo info = GetSumInfo(rate_table);

            OutputSumInfo(webBrowser, info);

            int nStart = 0;

            foreach (OrderListItem item in _items)
            {
                OutputLine(webBrowser, item, ref nStart);
            }
            OutputEnd(webBrowser);
        }