Пример #1
0
        private void FormDyhptl_Load(object sender, EventArgs e)
        {
            int firstyear = 0;
            int endyear = 0;

            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;

            IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            if (li.Count != 0)
            {
                firstyear = li[0].StartYear;
                endyear = li[0].EndYear;
            }

            Ps_Calc pcs = new Ps_Calc();
            pcs.Forecast = type;
            pcs.ForecastID = forecastReport.ID;
            list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);
            if (list1.Count>0)
            {
                spinEdit1.Value = (decimal)list1[0].Value1;
            }
        }
Пример #2
0
        private void barButtonItem26_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.Nodes.Count == 0)
            {
                MessageBox.Show("�����ݣ����ܲ�����");
                return;
            }
            if (barButtonItem26.Caption == "��ʼ��ȡ��ʷ����")
            {
                barButtonItem26.Caption = "������ȡ��ʷ����";
                firstyear = "0";
                endyear = "0";
                selectdral = false;
                this.simpleButton2.Enabled = false;
                this.barButtonItem17.Enabled = false;
                //this.simpleButton4.Enabled = false;

                treeList1.OptionsSelection.MultiSelect = true;
                treeList1.OptionsBehavior.Editable = false;
                treeList1.Refresh();
            }
            else if (barButtonItem26.Caption == "������ȡ��ʷ����")
            {
                barButtonItem26.Caption = "��ʼ��ȡ��ʷ����";
                selectdral = true;
                this.simpleButton2.Enabled = true;
                this.barButtonItem17.Enabled = true;
                //this.simpleButton4.Enabled = true;
                if (firstyear != "Title")
                {
                    Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
                    pfs.ID = Guid.NewGuid().ToString();
                    pfs.Forecast = type;
                    pfs.ForecastID = forecastReport.ID;
                    pfs.StartYear = int.Parse(firstyear.Replace("y", ""));
                    pfs.EndYear = int.Parse(endyear.Replace("y", ""));

                    IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

                    if (li.Count == 0)
                        Services.BaseService.Create<Ps_Forecast_Setup>(pfs);
                    else
                        Services.BaseService.Update("UpdatePs_Forecast_SetupByForecast", pfs);
                }

                treeList1.OptionsSelection.MultiSelect = false;
                treeList1.OptionsBehavior.Editable = true;
            }
        }
Пример #3
0
        //������ʷ���
        private void SetHistoryYear()
        {
            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.ID = Guid.NewGuid().ToString();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;
            pfs.StartYear = forecastReport.StartYear;
            pfs.EndYear = forecastReport.EndYear;

            IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);
            if (li.Count == 0)
                Services.BaseService.Create<Ps_Forecast_Setup>(pfs);
            else
                Services.BaseService.Update("UpdatePs_Forecast_SetupByForecast", pfs);

            IList<Ps_Forecast_Setup> li2 = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            if (li2.Count != 0)
            {
                firstyear = li2[0].StartYear.ToString();
                endyear = li2[0].EndYear.ToString();

            }
        }
Пример #4
0
        private void Form8Forecast_Load(object sender, EventArgs e)
        {
            HideToolBarButton();
            //chart1.Series.Clear();
            //Show();
            Application.DoEvents();
            //this.Cursor = Cursors.WaitCursor;
            //treeList1.BeginUpdate();
            LoadData();
            //treeList1.EndUpdate();
            RefreshChart();
            //this.Cursor = Cursors.Default;

            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;
            pfs.StartYear = int.Parse(firstyear.Replace("y", ""));
            pfs.EndYear = int.Parse(endyear.Replace("y", ""));

            IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            if (li.Count != 0)
            {
                if ((li[0].StartYear >= forecastReport.StartYear && forecastReport.EndYear >= li[0].EndYear))
                {
                    firstyear = li[0].StartYear.ToString();
                    endyear = li[0].EndYear.ToString();
                }
                else
                {
                    endyear = "0";
                    firstyear = "0";
                }
            }
        }
Пример #5
0
        private void FormForecastCalc4_Load(object sender, EventArgs e)
        {
            #region ������չʵ��

            Ps_YearRange py = new Ps_YearRange();
            py.Col4 = "������չʵ������";
            py.Col5 = Itop.Client.MIS.ProgUID;

            IList<Ps_YearRange> li2 = Services.BaseService.GetList<Ps_YearRange>("SelectPs_YearRangeByCol5andCol4", py);
            if (li2.Count > 0)
            {
                firstyear1 = li2[0].StartYear;
                endyear1 = li2[0].FinishYear;
            }
            //�¾�������
            //Ps_History psp_Type = new Ps_History();
            //psp_Type.Forecast = 5;
            //psp_Type.Col4 = Itop.Client.MIS.ProgUID;
            //IList<Ps_History> listTypes = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type);
            //DataTable dataTable = Itop.Common.DataConverter.ToDataTable((IList)listTypes, typeof(Ps_History));
            //DataRow[] rows1 = dataTable.Select("Title like 'ȫ����GDP%'");

            Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
            psp_Type.ForecastID = forecastReport.ID;
            psp_Type.Forecast = type;
            IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);

            dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(Ps_Forecast_Math));
            DataRow[] rows1 = dataTable.Select("Title like 'ȫ����GDP%'");

            DataRow[] rows4 = dataTable.Select("Title like 'ȫ����õ���%'");

            //�µ�������
            //Ps_History psp_Type2 = new Ps_History();
            //psp_Type2.Forecast = 6;
            //psp_Type2.Col4 = Itop.Client.MIS.ProgUID;
            //IList<Ps_History> listTypes2 = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type2);
            //DataTable dataTable2 = Itop.Common.DataConverter.ToDataTable((IList)listTypes2, typeof(Ps_History));
            //DataRow[] rows4 = dataTable2.Select("Title like 'ȫ����õ���%'");

            if (rows1.Length == 0 )
            {
                MessageBox.Show("ȱ�١�ȫ����GDP�����ݣ�");
                this.Close();
                return;
            }

            if (rows4.Length==0)
            {
                MessageBox.Show("����������ȱ�١�ȫ����õ��������ݣ�");
                this.Close();
                return;
            }

            #endregion

            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;

            IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            if (li.Count != 0)
            {
                firstyear = li[0].StartYear;
                endyear = li[0].EndYear;
            }

            Ps_Calc pcs = new Ps_Calc();
            pcs.Forecast = type;
            pcs.ForecastID = forecastReport.ID;
            list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);

            HideToolBarButton();

            dt = new DataTable();
            dt.Columns.Add("ID");
            dt.Columns.Add("Name");

            newrow1 = dt.NewRow();
            newrow1["ID"] = "ID";
            newrow1["Name"] = "����ϵ��";
            //newrow2 = dt.NewRow();
            //newrow2["Name"] = "GDP������";

            for (int i = firstyear; i <= forecastReport.YcEndYear; i++)
            {
                dt.Columns.Add(i.ToString(), typeof(double));
                DevExpress.XtraVerticalGrid.Rows.EditorRow editorRow = new DevExpress.XtraVerticalGrid.Rows.EditorRow();
                editorRow.Properties.FieldName = i.ToString().Trim();
                editorRow.Properties.Caption =i.ToString().Trim();
                editorRow.Height = 20;
                editorRow.Properties.RowEdit = this.repositoryItemCalcEdit4;
                this.vGridControl2.Rows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { editorRow });

                double s1 = 0;
                double s2 = 0;
                double s3 = 0;
                double s4 = 0;
                double s5 = 0;
                double s6 = 0;
                double s7 = 0;
                try { s1 = Convert.ToDouble(rows1[0]["y" + i]); }
                catch { }
                try { s2 = Convert.ToDouble(rows1[0]["y" + (i-1)]); }
                catch { }

                try { s3 = Convert.ToDouble(rows4[0]["y" + i]); }
                catch { }
                try { s4 = Convert.ToDouble(rows4[0]["y" + (i - 1)]); }
                catch { }

                if (s2 != 0)
                    s5 = (s1 - s2) / s2;

                if (s4 != 0)
                    s6 = (s3 - s4) / s4;

                if (s5 != 0)
                    s7 = s6 / s5;

                newrow1[i.ToString()] = Math.Round(s7,3);
                //newrow2[i.ToString()] =Math.Round( s5,3);

                if (i>=forecastReport.YcStartYear)
                {
                    foreach (Ps_Calc pcs2 in list1)
                    {
                        if (i == pcs2.Year)
                        {
                            newrow1[i.ToString()] = Math.Round(pcs2.Value1, 3);
                        }
                    }

                }

            }
            dt.Rows.Add(newrow1);
            //dt.Rows.Add(newrow2);
             //       gridControl1.DataSource = dt;

            vGridControl2.DataSource = dt;
        }
Пример #6
0
        private void FormForecastCalcTX_Load(object sender, EventArgs e)
        {
            #region ������չʵ��

            ArrayList al = new ArrayList();
            IList<Base_Data> li1 = Common.Services.BaseService.GetStrongList<Base_Data>();
            foreach (Base_Data bd in li1)
                al.Add(bd.Title);

            Ps_History psp_Type1 = new Ps_History();
            psp_Type1.Forecast = 1;
            psp_Type1.Col4 = Itop.Client.MIS.ProgUID;
            IList<Ps_History> listTypes1 = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type1);

            for (int c = 0; c < al.Count; c++)
            {
                bool bl = true;
                foreach (Ps_History ph in listTypes1)
                {
                    if (al[c].ToString() == ph.Title)
                        bl = false;
                }
                if (bl)
                {
                    Ps_History pf = new Ps_History();
                    pf.ID = Guid.NewGuid().ToString() + "|" + Itop.Client.MIS.ProgUID;
                    pf.Forecast = 1;
                    pf.ForecastID = "1";
                    pf.Title = al[c].ToString();
                    pf.Col4 = Itop.Client.MIS.ProgUID;
                    Services.BaseService.Create<Ps_History>(pf);
                    listTypes1.Add(pf);
                }
            }

            Ps_YearRange py = new Ps_YearRange();
            py.Col4 = "������չʵ��";
            py.Col5 = Itop.Client.MIS.ProgUID;

            IList<Ps_YearRange> li2 = Services.BaseService.GetList<Ps_YearRange>("SelectPs_YearRangeByCol5andCol4", py);
            if (li2.Count > 0)
            {
                firstyear1 = li2[0].StartYear;
                endyear1 = li2[0].FinishYear;
            }

            Ps_History psp_Type = new Ps_History();
            psp_Type.Forecast = 1;
            psp_Type.Col4 = Itop.Client.MIS.ProgUID;
            IList<Ps_History> listTypes = Common.Services.BaseService.GetList<Ps_History>("SelectPs_HistoryByForecast", psp_Type);
            DataTable dataTable = Itop.Common.DataConverter.ToDataTable((IList)listTypes, typeof(Ps_History));
            DataRow[] rows1 = dataTable.Select("Title='ȫ����GDP����Ԫ��'");
            DataRow[] rows4 = dataTable.Select("Title='ȫ����õ�������kWh��'");

            #endregion

            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;

            //IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            //if (li.Count != 0)
            //{
            //    firstyear = li[0].StartYear;
            //    endyear = li[0].EndYear;
            //}

            Ps_Calc pcs = new Ps_Calc();
            pcs.Forecast = type;
            pcs.ForecastID = forecastReport.ID;
            list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);

            HideToolBarButton();

            dt = new DataTable();
            dt.Columns.Add("ID");
            dt.Columns.Add("Name");

            newrow1 = dt.NewRow();
            newrow1["ID"] = "ID";
            newrow1["Name"] = "����ϵ��";
            newrow2 = dt.NewRow();
            newrow2["Name"] = "GDP������";

            for (int i = firstyear; i <= forecastReport.EndYear; i++)
            {
                dt.Columns.Add(i.ToString(), typeof(double));
                DevExpress.XtraVerticalGrid.Rows.EditorRow editorRow = new DevExpress.XtraVerticalGrid.Rows.EditorRow();
                editorRow.Properties.FieldName = i.ToString().Trim();
                editorRow.Properties.Caption =i.ToString().Trim();
                editorRow.Height = 20;
                editorRow.Properties.RowEdit = this.repositoryItemCalcEdit4;
                this.vGridControl2.Rows.AddRange(new DevExpress.XtraVerticalGrid.Rows.BaseRow[] { editorRow });

                double s1 = 0;
                double s2 = 0;
                double s3 = 0;
                double s4 = 0;
                double s5 = 0;
                double s6 = 0;
                double s7 = 0;
                try { s1 = Convert.ToDouble(rows1[0]["y" + i]); }
                catch { }
                try { s2 = Convert.ToDouble(rows1[0]["y" + (i-1)]); }
                catch { }

                try { s3 = Convert.ToDouble(rows4[0]["y" + i]); }
                catch { }
                try { s4 = Convert.ToDouble(rows4[0]["y" + (i - 1)]); }
                catch { }

                if (s2 != 0)
                    s5 = (s1 - s2) / s2;

                if (s4 != 0)
                    s6 = (s3 - s4) / s4;

                if (s5 != 0)
                    s7 = s6 / s5;

                newrow1[i.ToString()] = Math.Round(s7,3);
                newrow2[i.ToString()] =Math.Round( s5,3);

                foreach (Ps_Calc pcs2 in list1)
                {
                    if (i == pcs2.Year)
                    {
                        newrow1[i.ToString()] = Math.Round(pcs2.Value1,3);
                        newrow2[i.ToString()] = Math.Round(pcs2.Value2,3);

                    }
                }

            }
            dt.Rows.Add(newrow1);
            dt.Rows.Add(newrow2);

            vGridControl2.DataSource = dt;
        }
Пример #7
0
        private void FormForecast9_Load(object sender, EventArgs e)
        {
            HideToolBarButton();
            //chart1.Series.Clear();
            //Show();
            Application.DoEvents();
            //this.Cursor = Cursors.WaitCursor;
            //treeList1.BeginUpdate();
               // InitData1();
            LoadData();
            //treeList1.EndUpdate();
            RefreshChart();
            //this.Cursor = Cursors.Default;

            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;
            pfs.StartYear = int.Parse(firstyear.Replace("y", ""));
            pfs.EndYear = int.Parse(endyear.Replace("y", ""));

            IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            if (li.Count != 0)
            {
                if ((li[0].StartYear >= forecastReport.StartYear && forecastReport.EndYear >= li[0].EndYear))
                {
                    firstyear = li[0].StartYear.ToString();
                    endyear= li[0].EndYear.ToString();
                }
                else
                {
                    endyear = "0";
                    firstyear = "0";
                }

                }

             //Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
             //pfs.Forecast = type;
             //pfs.ForecastID = forecastReport.ID;
             //pfs.StartYear = int.Parse(firstyear.Replace("y", ""));
             //pfs.EndYear = int.Parse(endyear.Replace("y", ""));

             //IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

             //if (li.Count != 0)
             //{
             //   firstyear=li[0].StartYear.ToString();
             //   endyear=li[0].EndYear.ToString();
             //}
             ha.Clear();
            //Ps_Calc pcs = new Ps_Calc();
            //pcs.Forecast = type;
            //pcs.ForecastID = forecastReport.ID;
               // IList<Ps_Calc> list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);
             IList<Ps_Calc> list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByWhere", "  Forecast = '" + type + "' and ForecastID = '" + forecastReport.ID + "'and  Value2 != '0' and Value3 != '0' and  Value4 != '0' and Value5 != '0' and (Col4 != '') order by Value2");

            foreach (Ps_Calc pcs2 in list1)
            {
                ha.Add(ha.Count, pcs2.CalcID + "@" + pcs2.Value4 + "-" + pcs2.Value5 + "@" + pcs2.Value2 + "-" + pcs2.Value3
                    +"@"+ pcs2.Col4);

            }
            //foreach (Ps_Calc pcs2 in list1)
            //{

            //    if ("�������ʷ�" == pcs2.CalcID)
            //    {
            //        if (pcs2.Value1 > 0)
            //        {
            //            if (!ha.ContainsKey("�������ʷ�"))
            //                ha.Add("�������ʷ�", pcs2.Value2 + "@" + pcs2.Value3);
            //        }
            //    }
            //    else
            //    if ("����ϵ����" == pcs2.CalcID)
            //    {
            //        if (pcs2.Value1 > 0)
            //        {
            //            if (!ha.ContainsKey("����ϵ����"))
            //                ha.Add("����ϵ����", pcs2.Value2 + "@" + pcs2.Value3);
            //        }

            //    }
            //    else
            //        if ("ָ��ƽ����" == pcs2.CalcID)
            //        {
            //            if (pcs2.Value1 > 0)
            //            {
            //                if (!ha.ContainsKey("ָ��ƽ����"))
            //                    ha.Add("ָ��ƽ����", pcs2.Value2 + "@" + pcs2.Value3);
            //            }
            //        }
            //        else
            //            if ("��ɫģ�ͷ�" == pcs2.CalcID)
            //            {
            //                if (pcs2.Value1 > 0)
            //                {
            //                    if (!ha.ContainsKey("��ɫģ�ͷ�"))
            //                        ha.Add("��ɫģ�ͷ�", pcs2.Value2 + "@" + pcs2.Value3);
            //                }
            //            }
            //            else
            //                if ("ר��ָ����" == pcs2.CalcID)
            //                {
            //                    if (pcs2.Value1 > 0)
            //                    {
            //                        if (!ha.ContainsKey("ר��ָ����"))
            //                            ha.Add("ר��ָ����", pcs2.Value2 + "@" + pcs2.Value3);
            //                    }
            //                }
            //                else
            //                    if ("���Ʒ�" == pcs2.CalcID)
            //                    {
            //                        if (pcs2.Value1 > 0)
            //                        {
            //                            if (!ha.ContainsKey("���Ʒ�"))
            //                                ha.Add("���Ʒ�", pcs2.Value2 + "@" + pcs2.Value3);
            //                        }
            //                    }
            //                    else
            //                        if ("��ط�" == pcs2.CalcID)
            //                        {
            //                            if (pcs2.Value1 > 0)
            //                            {
            //                                if (!ha.ContainsKey("��ط�"))
            //                                    ha.Add("��ط�", pcs2.Value2 + "@" + pcs2.Value3);
            //                            }
            //                        }
            //                        else
            //                            if ("�˹������編" == pcs2.CalcID)
            //                            {
            //                                if (pcs2.Value1 > 0)
            //                                {
            //                                    if (!ha.ContainsKey("�˹������編"))
            //                                        ha.Add("�˹������編", pcs2.Value2 + "@" + pcs2.Value3);
            //                                }
            //                            }

            //}
            if (ha.Count < 1)
            {
                simpleButton2.Enabled = false;

            }
            else
            {
               // JS();
                //JS2();
                CalcPredictedValue();
            }
        }
Пример #8
0
        private void FormForecast9_Load(object sender, EventArgs e)
        {
            HideToolBarButton();
            //chart1.Series.Clear();
            //Show();
            Application.DoEvents();
            //this.Cursor = Cursors.WaitCursor;
            //treeList1.BeginUpdate();
               // InitData1();
            LoadData();
            //treeList1.EndUpdate();
            RefreshChart();
            //this.Cursor = Cursors.Default;

            Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
            pfs.Forecast = type;
            pfs.ForecastID = forecastReport.ID;
            pfs.StartYear = int.Parse(firstyear.Replace("y", ""));
            pfs.EndYear = int.Parse(endyear.Replace("y", ""));

            IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

            SetHistoryYear();

             IList<Ps_Calc> list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByWhere", "  Forecast = '" + type + "' and ForecastID = '" + forecastReport.ID + "'and  Value2 != '0' and Value3 != '0' and  Value4 != '0' and Value5 != '0' and (Col4 != '') order by Value2");

            foreach (Ps_Calc pcs2 in list1)
            {
                ha.Add(ha.Count, pcs2.CalcID + "@" + pcs2.Value4 + "-" + pcs2.Value5 + "@" + pcs2.Value2 + "-" + pcs2.Value3
                    +"@"+ pcs2.Col4);

            }

            if (ha.Count < 1)
            {
                simpleButton2.Enabled = false;

            }
            else
            {
                CalcPredictedValue();
            }
        }
Пример #9
0
        private void FormForecast10_Load(object sender, EventArgs e)
        {
            HideToolBarButton();
             ////chart1.Series.Clear();
             ////Show();
             Application.DoEvents();
             //this.Cursor = Cursors.WaitCursor;
             //gridView1.BeginUpdate();

             Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();
             psp_Type.ForecastID = forecastReport.ID;
             psp_Type.Forecast = type;
             Common.Services.BaseService.Update("DeletePs_Forecast_MathForecastIDAndForecast", psp_Type);
             psp_Type.Forecast = 0;
             IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type);
             foreach (Ps_Forecast_Math psp_Typetemp in listTypes)
             {
                 psp_Type = new Ps_Forecast_Math();
                 psp_Type = psp_Typetemp;
                 psp_Type.ID = psp_Type.ID+"|10";
                 psp_Type.Forecast = type;
                 psp_Type.ParentID = psp_Type.ParentID + "|10";
                 Common.Services.BaseService.Create<Ps_Forecast_Math>(psp_Type);
             }
             LoadData();
             //gridView1.EndUpdate();
             RefreshChart();
             this.Cursor = Cursors.Default;

             Ps_Forecast_Setup pfs = new Ps_Forecast_Setup();
             pfs.Forecast = type;
             pfs.ForecastID = forecastReport.ID;
             pfs.StartYear = int.Parse(firstyear.Replace("y", ""));
             pfs.EndYear = int.Parse(endyear.Replace("y", ""));

             IList<Ps_Forecast_Setup> li = Services.BaseService.GetList<Ps_Forecast_Setup>("SelectPs_Forecast_SetupByForecast", pfs);

             if (li.Count != 0)
             {
                firstyear=li[0].StartYear.ToString();
                endyear=li[0].EndYear.ToString();
             }
             ha.Clear();
            Ps_Calc pcs = new Ps_Calc();
            pcs.Forecast = type;
            pcs.ForecastID = forecastReport.ID;
            IList<Ps_Calc> list1 = Services.BaseService.GetList<Ps_Calc>("SelectPs_CalcByForecast", pcs);
            foreach (Ps_Calc pcs2 in list1)
            {

                if ("�������ʷ�" == pcs2.CalcID)
                {
                    if (pcs2.Value1 > 0)
                    {
                        if (!ha.ContainsKey("�������ʷ�"))
                            ha.Add("�������ʷ�", pcs2.Value2);
                    }
                }
                else
                if ("����ϵ����" == pcs2.CalcID)
                {
                    if (pcs2.Value1 > 0)
                    {
                        if (!ha.ContainsKey("����ϵ����"))
                        ha.Add("����ϵ����", pcs2.Value2);
                    }

                }
                else
                    if ("ָ��ƽ����" == pcs2.CalcID)
                    {
                        if (pcs2.Value1 > 0)
                        {
                            if (!ha.ContainsKey("ָ��ƽ����"))
                                ha.Add("ָ��ƽ����", pcs2.Value2);
                        }
                    }
                    else
                        if ("��ɫģ�ͷ�" == pcs2.CalcID)
                        {
                            if (pcs2.Value1 > 0)
                            {
                                if (!ha.ContainsKey("��ɫģ�ͷ�"))
                                    ha.Add("��ɫģ�ͷ�", pcs2.Value2);
                            }
                        }
                        else
                            if ("ר��ָ����" == pcs2.CalcID)
                            {
                                if (pcs2.Value1 > 0)
                                {
                                    if (!ha.ContainsKey("ר��ָ����"))
                                        ha.Add("ר��ָ����", pcs2.Value2);
                                }
                            }
                            else
                                if ("���Ʒ�" == pcs2.CalcID)
                                {
                                    if (pcs2.Value1 > 0)
                                    {
                                        if (!ha.ContainsKey("���Ʒ�"))
                                            ha.Add("���Ʒ�", pcs2.Value2);
                                    }
                                }
                                else
                                    if ("��ط�" == pcs2.CalcID)
                                    {
                                        if (pcs2.Value1 > 0)
                                        {
                                            if (!ha.ContainsKey("��ط�"))
                                                ha.Add("��ط�", pcs2.Value2);
                                        }
                                    }
                                    else
                                        if ("�˹������編" == pcs2.CalcID)
                                        {
                                            if (pcs2.Value1 > 0)
                                            {
                                                if (!ha.ContainsKey("�˹������編"))
                                                    ha.Add("�˹������編", pcs2.Value2);
                                            }
                                        }

            }
            if (ha.Count < 1)
            {
                simpleButton2.Enabled = false;

            }
            else
            {
                JS();
            }
        }