Ejemplo n.º 1
0
        private void Initialize()
        {
            List <ListItem <int> > stateList = new List <ListItem <int> >();

            DateTimeUtil.DateTimePicker_SetDateTimePicker(dateTimePicker_Start, dateTimePicker_End);

            CommonGlobalUtil.SetTime(skinComboBox_Time);
            this.pagePara  = new GuideAchievementSummarysPara();
            this.pagePara2 = new GuideAchievementsPara();
            this.dataGridView1.DataSource = null;
            this.dataGridView2.DataSource = null;
            //  skinLabel4.Visible = !IsPos;
            this.tabControl1.SelectedTab = tabPage1;
            skinComboBoxShopID.Initialize(false, CommonGlobalCache.IsGeneralStoreRetail != "1");
            skinSplitContainer1.Panel2Collapsed = true;
        }
Ejemplo n.º 2
0
        private void SearchDetailList(String guideID)
        {
            this.skinSplitContainer1.Panel2Collapsed = false;
            try
            {
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                this.pagePara2 = new GuideAchievementsPara()
                {
                    ShopID           = null,
                    IsMonth          = isMonth,
                    StartDate        = startDate,
                    EndDate          = endDate,
                    GuideID          = guideID,
                    IsOnlyShowNoZero = this.skinCheckBox_IsOnlyShowNoZero.Checked,
                    //IsGetGeneralStore = CommonGlobalCache.IsGeneralStoreRetail == "1",
                };

                List <GuideDayAchievement> listPage = CommonGlobalCache.ServerProxy.GetGuideAchievements(this.pagePara2);
                // this.BindingSource(dataGridView2, listPage);
                this.dataGridViewPagingSumCtrl1.BindingDataSource <GuideDayAchievement>(DataGridViewUtil.ToDataTable <GuideDayAchievement>(listPage), dataGridViewTextBoxColumn1);

                this.tabPage2.Invalidate();
                zedGraphControl1.Invalidate();
                CreateChart(zedGraphControl1, pagePara2, listPage);
                //  pictureBox1.Image = GetImage(pagePara2,listPage);
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
            finally
            {
                UnLockPage();
            }
        }
Ejemplo n.º 3
0
        private void CreateChart(ZedGraphControl zgc, GuideAchievementsPara pagePara, List <GuideDayAchievement> list)
        {
            GraphPane myPane = zgc.GraphPane;

            myPane.CurveList.Clear();
            myPane.GraphItemList.Clear();
            zgc.AxisChange();
            zgc.Refresh();


            //   zgc.AxisChange();

            // Set the titles and axis labels
            myPane.Title       = "导购业绩";
            myPane.XAxis.Title = "时间";
            myPane.YAxis.Title = "销售额";

            // Make up some random data points
            //   string[] labels = { "Panther", "Lion", "Cheetah", "Cougar", "Tiger", "Leopard" };


            String[] labels = null;
            double[] points = null;
            if (pagePara.IsMonth)
            {
                labels = new string[12];
                points = new double[12];
                for (int i = 0; i <= 11; i++)
                {
                    labels[i] = (i + 1).ToString();
                    GuideDayAchievement achievement = list.Find(t => Int32.Parse(t.ReportDate.ToString().Substring(4, 2)) == (i + 1));
                    if (achievement != null)
                    {
                        points[i] = decimal.ToDouble(achievement.MoneyOfSale);
                    }
                }
            }
            else
            {
                //获取月份对应的数量
                if (list != null && list.Count > 0)
                {
                    GuideDayAchievement achievement = list[0];
                    int days = TimeHelper.GetReportMonthMaxDay(achievement.ReportDate);
                    labels = new string[days];
                    points = new double[days];
                    for (int i = 0; i < days; i++)
                    {
                        labels[i]   = (i + 1).ToString();
                        achievement = list.Find(t => Int32.Parse(t.ReportDate.ToString().Substring(6, 2)) == (i + 1));
                        if (achievement != null)
                        {
                            points[i] = decimal.ToDouble(achievement.MoneyOfSale);
                        }
                    }
                }
            }



            //y轴
            //double[] y = new double[11];
            //decimal maxAccount = 0;
            //foreach (var item in list)
            //{
            //    if (maxAccount < item.MoneyOfSale)
            //    {
            //        maxAccount = item.MoneyOfSale;
            //    }
            //}

            //int step = decimal.ToInt32(Math.Round(maxAccount / 1100) * 100);

            //for (int j = 10; j >= 0; j--)
            //{
            //    y[j] = step * j;
            //}


            // Generate a red bar with "Curve 1" in the legend
            BarItem myBar = myPane.AddBar("销售总额", null, points, Color.Blue);

            myBar.Bar.Fill = new Fill(Color.Blue, Color.White, Color.Blue);

            //// Generate a blue bar with "Curve 2" in the legend
            //myBar = myPane.AddBar("Curve 2", null, y2, Color.Blue);
            //myBar.Bar.Fill = new Fill(Color.Blue, Color.White, Color.Blue);

            //// Generate a green bar with "Curve 3" in the legend
            //myBar = myPane.AddBar("Curve 3", null, y3, Color.Green);
            //myBar.Bar.Fill = new Fill(Color.Green, Color.White, Color.Green);

            //// Generate a black line with "Curve 4" in the legend
            //LineItem myCurve = myPane.AddCurve("Curve 4",
            //     null, y4, Color.Black, SymbolType.Circle);
            //myCurve.Line.Fill = new Fill(Color.White, Color.LightSkyBlue, -45F);

            // Fix up the curve attributes a little
            //myCurve.Symbol.Size = 8.0F;
            //myCurve.Symbol.Fill = new Fill(Color.White);
            //myCurve.Line.Width = 2.0F;

            // Draw the X tics between the labels instead of at the labels
            myPane.XAxis.IsTicsBetweenLabels = true;

            // Set the XAxis labels
            myPane.XAxis.TextLabels = labels;

            // Set the XAxis to Text type
            myPane.XAxis.Type = AxisType.Text;

            // Fill the axis area with a gradient
            myPane.AxisFill = new Fill(Color.White,
                                       Color.FromArgb(255, 255, 166), 90F);
            // Fill the pane area with a solid color
            myPane.PaneFill = new Fill(Color.FromArgb(250, 250, 255));

            zgc.AxisChange();
            zgc.Invalidate();
            this.tabPage2.Invalidate();
            this.Invalidate();
        }