Ejemplo n.º 1
0
    private void RefreshGrid()
    {
        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodGraphicDrop.SelectedValue);

        ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);

        decimal           revenue       = 0;
        int               sumQuantity   = 0;
        decimal           sumTax        = 0;
        decimal           sumShipping   = 0;
        SaleReportBuilder reportBuilder = new SaleReportBuilder();
        DataTable         table         = reportBuilder.GetReportData(
            period,
            _startOrderDate,
            _endOrderDate,
            StoreID
            );

        foreach (DataRow row in table.Rows)
        {
            revenue     += Convert.ToDecimal(row["Total"]);
            sumQuantity += Convert.ToInt32(row["Quantity"]);
            sumTax      += Convert.ToDecimal(row["TotalTax"]);
            sumShipping += Convert.ToDecimal(row["TotalShippingCost"]);
        }

        uxRevenueValueLabel.Text  = revenue.ToString("F", CultureInfo.InvariantCulture);
        uxQuantityValueLabel.Text = sumQuantity.ToString("F", CultureInfo.InvariantCulture);
        uxTaxValueLabel.Text      = sumTax.ToString("F", CultureInfo.InvariantCulture);
        uxShippingValueLabel.Text = sumShipping.ToString("F", CultureInfo.InvariantCulture);
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
        DateTime startOrderDate;
        DateTime endOrderDate;

        if (Period == PeriodType.Custom)
        {
            startOrderDate = Convert.ToDateTime(StartDate);
            endOrderDate   = Convert.ToDateTime(EndDate);
        }
        else
        {
            ReportFilterUtilities.GetOrderDateRange(Period, out startOrderDate, out endOrderDate);
        }

        SetUpChart(chart, startOrderDate, endOrderDate);

        double    maxRange = 0;
        DataTable table    = CreateDataAndLabel(startOrderDate, endOrderDate);

        if (table.Rows.Count < 1)
        {
            maxRange = InitialMaxYAxisRange;
        }
        else
        {
            foreach (DataRow row in table.Rows)
            {
                double val = ConvertUtilities.ToDouble(row[_value]);

                if (val > maxRange)
                {
                    maxRange = val;
                    if (val < InitialMaxYAxisRange)
                    {
                        maxRange = InitialMaxYAxisRange;
                    }
                }
            }
        }

        chart.AddElement(CreateLine(_data1));

        SetChartStyle(chart);

        SetRangeScale(chart, (int)maxRange);

        SetYLengend(chart, _yLegend);

        SetXLengend(chart, _xLegend);

        SetXAxis(chart, _label1);

        Response.Clear();
        //Response.CacheControl = "no-cache";
        Response.Write(chart.ToString());
        Response.End();
    }
Ejemplo n.º 3
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }
        int totalItems;

        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue);

        if (period == PeriodType.Custom)
        {
            string errorMessage;
            if (VerifyCustomInput(out errorMessage))
            {
                LoadCustomInput();
            }
            else
            {
                uxMessage.DisplayError(errorMessage);
                uxMessage1.Visible = false;
                return;
            }
        }
        else
        {
            ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);
        }

        BestSellingReportBuilder bestSellingReportBuilder = new BestSellingReportBuilder();
        DataTable table = bestSellingReportBuilder.GetBestSellingReportData(
            GridHelper.GetFullSortText(),
            StoreContext.Culture.CultureID,
            period,
            ReportFilterUtilities.ConvertToBestSellReportType(uxReportDrop.SelectedValue),
            uxNumberItemsDrop.SelectedItem.ToString(),
            StoreContext.CurrentStore.StoreID,
            _startOrderDate,
            _endOrderDate,
            uxPagingControl.StartIndex,
            uxPagingControl.EndIndex,
            out totalItems);

        if (table.Rows.Count > 0)
        {
            uxTitleLabel.Visible = true;
            setTitle();
        }
        else
        {
            uxTitleLabel.Visible = false;
        }

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        uxGrid.DataSource             = table;
        uxGrid.DataBind();
        setCustomDateDisplay();
    }
Ejemplo n.º 4
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }
        int totalItems;

        _errorFlag = false;

        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue);

        if (period == PeriodType.Custom)
        {
            string errorMessage;
            if (VerifyCustomInput(out errorMessage))
            {
                LoadCustomInput();
            }
            else
            {
                uxMessage.DisplayError(errorMessage);
                uxMessage1.Visible = false;
                _errorFlag         = true;
                return;
            }
        }
        else
        {
            ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);
        }

        PaymentReportBuilder paymentReportBuilder = new PaymentReportBuilder();

        DataTable table = paymentReportBuilder.GetPaymentReportData(
            GridHelper.GetFullSortText(),
            period,
            _startOrderDate,
            _endOrderDate,
            uxPagingControl.StartIndex,
            uxPagingControl.EndIndex,
            out totalItems);

        if (table.Rows.Count == 0)
        {
            uxDisplayChart.Style.Add("Display", "none");
        }
        else
        {
            uxDisplayChart.Style.Add("Display", "");
        }

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        uxGrid.DataSource             = table;
        uxGrid.DataBind();
        setCustomDateDisplay();
    }
Ejemplo n.º 5
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }

        int totalItems;

        _errorFlag = false;

        PeriodType period = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue);

        ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);

        SaleReportBuilder reportBuilder = new SaleReportBuilder();
        DataTable         table         = reportBuilder.GetReportData(
            GridHelper.GetFullSortText(),
            period,
            _startOrderDate,
            _endOrderDate,
            uxPagingControl.StartIndex,
            uxPagingControl.EndIndex,
            StoreID,
            out totalItems);

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        uxGrid.DataSource             = table;
        uxGrid.DataBind();

        decimal revenue     = 0;
        int     sumQuantity = 0;
        decimal sumTax      = 0;
        decimal sumShipping = 0;

        foreach (DataRow row in table.Rows)
        {
            revenue     += Convert.ToDecimal(row["Total"]);
            sumQuantity += Convert.ToInt32(row["Quantity"]);
            sumTax      += Convert.ToDecimal(row["TotalTax"]);
            sumShipping += Convert.ToDecimal(row["TotalShippingCost"]);
        }
        uxRevenueValueLabel.Text  = revenue.ToString("F", CultureInfo.InvariantCulture);
        uxQuantityValueLabel.Text = sumQuantity.ToString("F", CultureInfo.InvariantCulture);
        uxTaxValueLabel.Text      = sumTax.ToString("F", CultureInfo.InvariantCulture);
        uxShippingValueLabel.Text = sumShipping.ToString("F", CultureInfo.InvariantCulture);
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
        OpenFlashChart.Pie            pie   = new OpenFlashChart.Pie();

        if (Period == PeriodType.Custom)
        {
            _startOrderDate = Convert.ToDateTime(StartDate);
            _endOrderDate   = Convert.ToDateTime(EndDate);
        }
        else
        {
            ReportFilterUtilities.GetOrderDateRange(Period, out _startOrderDate, out _endOrderDate);
        }

        ShippingReportBuilder shippingReportBuilder = new ShippingReportBuilder();
        DataTable             table = shippingReportBuilder.GetShippingReportData(
            Period,
            _startOrderDate,
            _endOrderDate);

        for (int i = 0; i < table.Rows.Count; i++)
        {
            string shippingMethod;
            if (String.IsNullOrEmpty(table.Rows[i]["ShippingMethod"].ToString()))
            {
                shippingMethod = "Non-shipping Order";
            }
            else
            {
                shippingMethod = table.Rows[i]["ShippingMethod"].ToString();
            }
            _values.Add(new PieValue(Convert.ToDouble(table.Rows[i]["SumShippingMethod"]), shippingMethod));
        }

        SetUpChart(chart);

        SetUpPie(pie);

        chart.AddElement(pie);

        Response.Clear();
        //Response.CacheControl = "no-cache";
        Response.Write(chart.ToString());
        Response.End();
    }
Ejemplo n.º 7
0
    private void RefreshGrid()
    {
        if (!MainContext.IsPostBack)
        {
            uxPagingControl.ItemsPerPages = AdminConfig.OrderItemsPerPage;
        }
        int totalItems;

        _errorFlag = false;

        PeriodType         period             = ReportFilterUtilities.ConvertToPeriodType(uxPeriodDrop.SelectedValue);
        CustomerReportType customerReportType = ReportFilterUtilities.ConvertToCustomerReportType(uxReportDrop.SelectedValue);

        if (period == PeriodType.Custom)
        {
            string errorMessage;
            if (VerifyCustomInput(out errorMessage))
            {
                LoadCustomInput();
            }
            else
            {
                uxMessage.DisplayError(errorMessage);
                uxMessage1.Visible = false;
                _errorFlag         = true;
                return;
            }
        }
        else
        {
            ReportFilterUtilities.GetOrderDateRange(period, out _startOrderDate, out _endOrderDate);
        }


        CustomerReportBuilder customerReportBuilder = new CustomerReportBuilder();

        if (customerReportType != CustomerReportType.UserRegistration)
        {
            _table = customerReportBuilder.GetTopCustomerReportData(
                GridHelper1.GetFullSortText(),
                period,
                customerReportType,
                uxNumberItemsDrop.SelectedItem.ToString(),
                _startOrderDate,
                _endOrderDate,
                uxPagingControl.StartIndex,
                uxPagingControl.EndIndex,
                out totalItems);

            uxTopCustomerGrid.DataSource = _table;
            uxTopCustomerGrid.DataBind();
            uxTopCustomerGrid.Visible = true;
            uxGrid.Visible            = false;
            uxPadding.Visible         = false;

            if (_table.Rows.Count > 0)
            {
                uxTitleLabel.Visible = true;
                setTitle();
            }
            else
            {
                uxTitleLabel.Visible = false;
            }
        }
        else
        {
            _table = customerReportBuilder.GetCustomerReportData(
                GridHelper.GetFullSortText(),
                period,
                _startOrderDate,
                _endOrderDate,
                uxPagingControl.StartIndex,
                uxPagingControl.EndIndex,
                out totalItems);

            uxGrid.DataSource = _table;
            uxGrid.DataBind();
            uxGrid.Visible            = true;
            uxTopCustomerGrid.Visible = false;
            uxPadding.Visible         = true;
            uxTitleLabel.Visible      = false;
        }

        uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages);
        setCustomDateDisplay();
    }