Dynamicweb 8 Documentation
GetDoublePriceFormatted Method
Example 

The price.
The currency.
if set to true show with formatted symbol.
Gets the double price formatted.
Syntax
'Declaration
 
Public Shared Function GetDoublePriceFormatted( _ 
   ByVal Price As Double, _ 
   ByVal Curr As Currency, _ 
   ByVal showFormatted As Boolean _ 
) As String
public static string GetDoublePriceFormatted( 
   double Price,
   Currency Curr,
   bool showFormatted 
)

Parameters

Price
The price.
Curr
The currency.
showFormatted
if set to true show with formatted symbol.
Example
class MyPage : System.Web.UI.Page
{
    private string SQLGlobal(DateTime DateFrom, DateTime DateTo, string Currency, string Shop)
    {
        string SQL = "FROM EcomOrders ";
        SQL += "INNER JOIN EcomOrderStates ON EcomOrderStates.OrderStateID = EcomOrders.OrderStateID ";
        SQL += "WHERE EcomOrderStates.OrderStateDontUseInstatistics = " + Database.SqlBool(false) + " ";
        SQL += "AND EcomOrders.OrderComplete = " + Database.SqlBool(true) + " ";
        SQL += "AND EcomOrders.OrderDeleted = " + Database.SqlBool(false) + " ";
        SQL += "AND EcomOrders.OrderDate Between " + Database.SqlDate(DateFrom) + " AND " + Database.SqlDate(DateTo) + " ";
        if (Currency == Dynamicweb.eCommerce.Common.Application.DefaultCurrency.Code)
        {
            SQL += "AND (EcomOrders.OrderCurrencyCode IS NULL OR EcomOrders.OrderCurrencyCode = '' OR EcomOrders.OrderCurrencyCode = '" + Currency + "') ";
        }
        else
        {
            SQL += "AND EcomOrders.OrderCurrencyCode = '" + Currency + "' ";
        }
        if (!string.IsNullOrEmpty(Shop))
        {
            SQL += "AND EcomOrders.OrderShopID = '" + Shop + "' ";
        }

        return SQL;
    }

    public Hashtable Info(DateTime DateFrom, DateTime DateTo, string Currency, string Shop)
    {
        Hashtable Infos = new Hashtable();

        int orderCnt = Base.ChkNumber(Database.ExecuteScalar("SELECT count(*) " + SQLGlobal(DateFrom, DateTo, Currency, Shop), "Ecom.mdb"));
        long periodDays = Math.Abs(DateTime.Compare(DateFrom, DateTo));
        double totalProfit = Base.ChkDouble(Database.ExecuteScalar("SELECT SUM(EcomOrders.OrderPriceWithoutVAT) " + SQLGlobal(DateFrom, DateTo, Currency, Shop), "Ecom.mdb"));
        double averageOrderDay = Base.ChkDouble((orderCnt / periodDays));
        double averageProfitDay = Base.ChkDouble((totalProfit / periodDays));
        double highestOrder = Base.ChkDouble(Database.ExecuteScalar("SELECT MAX(EcomOrders.OrderPriceWithoutVAT) " + SQLGlobal(DateFrom, DateTo, Currency, Shop), "Ecom.mdb"));

        int highestOrderCntDay = 0;
        IDataReader dr1 = Database.CreateDataReader("SELECT COUNT(EcomOrders.OrderID) as max " + SQLGlobal(DateFrom, DateTo, Currency, Shop) + " GROUP BY CONVERT(CHAR(11), EcomOrders.OrderDate, 102)", "Ecom.mdb");
        while (dr1.Read())
        {
            if (Base.ChkNumber(dr1["max"]) > highestOrderCntDay)
            {
                highestOrderCntDay = Base.ChkNumber(dr1["max"]);
            }
        }
        dr1.Close();
        dr1.Dispose();

        double highestProfitDay = 0;
        IDataReader dr2 = Database.CreateDataReader("SELECT SUM(EcomOrders.OrderPriceWithoutVAT) as sum " + SQLGlobal(DateFrom, DateTo, Currency, Shop) + " GROUP BY CONVERT(CHAR(11), EcomOrders.OrderDate, 102)", "Ecom.mdb");
        while (dr2.Read())
        {
            if (Base.ChkDouble(dr2["sum"]) > highestProfitDay)
            {
                highestProfitDay = Base.ChkDouble(dr2["sum"]);
            }
        }
        dr2.Close();
        dr2.Dispose();

        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Antal ordre i periode"), orderCnt);
        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Antal dage i periode"), periodDays);
        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Total omsætning"), Dynamicweb.eCommerce.Prices.Price.GetDoublePriceFormatted(totalProfit, Dynamicweb.eCommerce.Common.Application.DefaultCurrency, true));
        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Gennemsnit ordre pr. dag"), averageOrderDay);
        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Gennemsnit omsætning pr. dag"), Dynamicweb.eCommerce.Prices.Price.GetDoublePriceFormatted(averageProfitDay, Dynamicweb.eCommerce.Common.Application.DefaultCurrency, true));
        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Største ordre i periode"), Dynamicweb.eCommerce.Prices.Price.GetDoublePriceFormatted(highestOrder, Dynamicweb.eCommerce.Common.Application.DefaultCurrency, true));

        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Højeste antal ordre pr. dag"), highestOrderCntDay);
        Infos.Add(Dynamicweb.Backend.Translate.JsTranslate("Højeste omsætning pr. dag"), Dynamicweb.eCommerce.Prices.Price.GetDoublePriceFormatted(highestProfitDay, Dynamicweb.eCommerce.Common.Application.DefaultCurrency, true));

        return Infos;
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Price Class
Price Members

Send Feedback