Example #1
0
        // GET: ProductionTarget
        public ActionResult Dashboard()
        {
            int[]    year       = KPIData.getCurrentTarget();
            double[] production = new double[year.Count()];
            int[]    farmer     = new int[year.Count()];
            int[]    trees      = new int[year.Count()];
            int      counter    = 0;

            foreach (int item in year)
            {
                double tempProduction = 0;
                int    tempFarmer     = 0;
                int    tempTrees      = 0;

                List <KPI> kpi = db.KPIs.Where(x => x.Year == item).ToList();
                foreach (var kpiItem in kpi)
                {
                    tempProduction = tempProduction + kpiItem.Production;
                    tempFarmer     = tempFarmer + (kpiItem.Male + kpiItem.Female);
                    tempTrees      = tempTrees + kpiItem.NoOfTrees;
                }

                production[counter] = (tempProduction * .001);
                farmer[counter]     = tempFarmer;
                trees[counter]      = tempTrees;
                counter++;
            }
            ViewBag.Production_array = production;
            ViewBag.Farmers_array    = farmer;
            ViewBag.Trees_array      = trees;
            ViewBag.Year_array       = year;
            return(View(db.KPIs.ToList()));
        }
Example #2
0
        public ActionResult Dashboard()
        {
            int[] year = KPIData.getCurrentTarget();

            int[] Hectar                  = new int[year.Count()];
            int[] Variety                 = new int[year.Count()];
            int[] VolumeMarket            = new int[year.Count()];
            int[] VolumeInternational     = new int[year.Count()];
            int[] VolumeSoldMarket        = new int[year.Count()];
            int[] VolumeSoldInternational = new int[year.Count()];
            int[] Male   = new int[year.Count()];
            int[] Female = new int[year.Count()];
            int[] MunicipalitiesEngaged = new int[year.Count()];
            int[] NumberOfNurseries     = new int[year.Count()];
            int[] NoOfPostharvest       = new int[year.Count()];
            int[] IncomeGenerated       = new int[year.Count()];
            int[] SMEs                    = new int[year.Count()];
            int[] JobsCreated             = new int[year.Count()];
            int[] NoOfFundingAssistance   = new int[year.Count()];
            int[] NoOfFundingInstitutions = new int[year.Count()];
            int[] NoOfPoliciReforms       = new int[year.Count()];
            int[] DA                        = new int[year.Count()];
            int[] DENR_NGP                  = new int[year.Count()];
            int[] PCA_Kaanib                = new int[year.Count()];
            int[] DAR                       = new int[year.Count()];
            int[] Trainings                 = new int[year.Count()];
            int[] FarmesrsTrained           = new int[year.Count()];
            int[] IECMaterials              = new int[year.Count()];
            int[] LinkagesLocal             = new int[year.Count()];
            int[] LinkagesInternational     = new int[year.Count()];
            int[] DiseasesManagement        = new int[year.Count()];
            int[] GoodAgriculturalPractices = new int[year.Count()];
            int[] CacaoFarmsCertified       = new int[year.Count()];
            int[] NurseriesAccredited       = new int[year.Count()];
            int[] ModelFarms                = new int[year.Count()];
            int[] ResearchWorkDeveloped     = new int[year.Count()];


            List <KPI> _kpiList    = db.KPIs.ToList();
            int        counter     = 0;
            List <KPI> NEW_kpiList = new List <KPI>();

            foreach (int item in year)
            {
                int TempHectar = 0;

                int TempVolumeMarket            = 0;
                int TempVolumeInternational     = 0;
                int TempVolumeSoldMarket        = 0;
                int TempVolumeSoldInternational = 0;
                int TempMale   = 0;
                int TempFemale = 0;
                int TempMunicipalitiesEngaged = 0;
                int TempNumberOfNurseries     = 0;
                int TempNoOfPostharvest       = 0;
                int TempIncomeGenerated       = 0;
                int TempSMEs                    = 0;
                int TempJobsCreated             = 0;
                int TempNoOfFundingAssistance   = 0;
                int TempNoOfFundingInstitutions = 0;
                int TempNoOfPoliciReforms       = 0;
                int TempDA         = 0;
                int TempDENR_NGP   = 0;
                int TempPCA_Kaanib = 0;
                int TempDAR        = 0;


                int TempTrainings                 = 0;
                int TempFarmesrsTrained           = 0;
                int TempIECMaterials              = 0;
                int TempLinkagesLocal             = 0;
                int TempLinkagesInternational     = 0;
                int TempDiseasesManagement        = 0;
                int TempGoodAgriculturalPractices = 0;
                int TempCacaoFarmsCertified       = 0;
                int TempNurseriesAccredited       = 0;
                int TempModelFarms                = 0;
                int TempResearchWorkDeveloped     = 0;


                List <KPI> kpi = _kpiList.Where(x => x.Year == item).ToList();
                foreach (var TempKpi in kpi)
                {
                    TempHectar += TempKpi.Hectar;


                    int TVM = TempKpi.VolumeMarket + TempKpi.VolumeInternational;
                    TempVolumeMarket += TVM;
                    //TempVolumeInternational += TempKpi.VolumeInternational;
                    int TVS = TempKpi.VolumeSoldMarket + TempKpi.VolumeSoldInternational;
                    TempVolumeSoldMarket += TVS;
                    //TempVolumeSoldInternational += TempKpi.VolumeSoldInternational;
                    int TM = TempKpi.Male + TempKpi.Female;
                    TempMale += TM;
                    //TempFemale += TempKpi.Female;
                    TempMunicipalitiesEngaged += TempKpi.MunicipalitiesEngaged;
                    TempNumberOfNurseries     += TempKpi.NumberOfNurseries;
                    TempNoOfPostharvest       += TempKpi.NoOfPostharvest;
                    TempIncomeGenerated       += TempKpi.IncomeGenerated;
                    TempSMEs                    += TempKpi.SMEs;
                    TempJobsCreated             += TempKpi.JobsCreated;
                    TempNoOfFundingAssistance   += TempKpi.NoOfFundingAssistance;
                    TempNoOfFundingInstitutions += TempKpi.NoOfFundingInstitutions;
                    TempNoOfPoliciReforms       += TempKpi.NoOfPoliciReforms;
                    int TDA = TempKpi.DA + TempKpi.DENR_NGP + TempKpi.PCA_Kaanib + TempKpi.DAR;
                    TempDA += TDA;
                    //TempDENR_NGP += TempKpi.DENR_NGP;
                    //TempPCA_Kaanib += TempKpi.PCA_Kaanib;
                    //TempDAR += TempKpi.DAR;

                    TempTrainings       += TempKpi.Trainings;
                    TempFarmesrsTrained += TempKpi.FarmesrsTrained;
                    TempIECMaterials    += TempKpi.IECMaterials;
                    int TLL = TempKpi.LinkagesLocal + TempKpi.LinkagesInternational;
                    TempLinkagesLocal += TLL;
                    //TempLinkagesInternational += TempKpi.LinkagesInternational;
                    TempDiseasesManagement        += TempKpi.DiseasesManagement;
                    TempGoodAgriculturalPractices += TempKpi.GoodAgriculturalPractices;
                    TempCacaoFarmsCertified       += TempKpi.CacaoFarmsCertified;
                    TempNurseriesAccredited       += TempKpi.NurseriesAccredited;
                    TempModelFarms            += TempKpi.ModelFarms;
                    TempResearchWorkDeveloped += TempKpi.ResearchWorkDeveloped;
                }

                Hectar[counter] = TempHectar;

                VolumeMarket[counter]            = TempVolumeMarket;
                VolumeInternational[counter]     = TempVolumeInternational;
                VolumeSoldMarket[counter]        = TempVolumeSoldMarket;
                VolumeSoldInternational[counter] = TempVolumeSoldInternational;
                Male[counter]   = TempMale;
                Female[counter] = TempFemale;
                MunicipalitiesEngaged[counter] = TempMunicipalitiesEngaged;
                NumberOfNurseries[counter]     = TempNumberOfNurseries;
                NoOfPostharvest[counter]       = TempNoOfPostharvest;
                IncomeGenerated[counter]       = TempIncomeGenerated;
                SMEs[counter]                    = TempSMEs;
                JobsCreated[counter]             = TempJobsCreated;
                NoOfFundingAssistance[counter]   = TempNoOfFundingAssistance;
                NoOfFundingInstitutions[counter] = TempNoOfFundingInstitutions;
                NoOfPoliciReforms[counter]       = TempNoOfPoliciReforms;
                DA[counter]                        = TempDA;
                DENR_NGP[counter]                  = TempDENR_NGP;
                PCA_Kaanib[counter]                = TempPCA_Kaanib;
                DAR[counter]                       = TempDAR;
                Trainings[counter]                 = TempTrainings;
                FarmesrsTrained[counter]           = TempFarmesrsTrained;
                IECMaterials[counter]              = TempIECMaterials;
                LinkagesLocal[counter]             = TempLinkagesLocal;
                LinkagesInternational[counter]     = TempLinkagesInternational;
                DiseasesManagement[counter]        = TempDiseasesManagement;
                GoodAgriculturalPractices[counter] = TempGoodAgriculturalPractices;
                CacaoFarmsCertified[counter]       = TempCacaoFarmsCertified;
                NurseriesAccredited[counter]       = TempNurseriesAccredited;
                ModelFarms[counter]                = TempModelFarms;
                ResearchWorkDeveloped[counter]     = TempResearchWorkDeveloped;
                counter++;
            }

            ViewBag.Year_array = year;;

            ViewBag.Hectar_Array = Hectar;

            ViewBag.VolumeMarket_Array            = VolumeMarket;
            ViewBag.VolumeInternational_Array     = VolumeInternational;
            ViewBag.VolumeSoldMarket_Array        = VolumeSoldMarket;
            ViewBag.VolumeSoldInternational_Array = VolumeSoldInternational;
            ViewBag.Male_Array   = Male;
            ViewBag.Female_Array = Female;
            ViewBag.MunicipalitiesEngaged_Array = MunicipalitiesEngaged;
            ViewBag.NumberOfNurseries_Array     = NumberOfNurseries;
            ViewBag.NoOfPostharvest_Array       = NoOfPostharvest;
            ViewBag.IncomeGenerated_Array       = IncomeGenerated;
            ViewBag.SMEs_Array                    = SMEs;
            ViewBag.JobsCreated_Array             = JobsCreated;
            ViewBag.NoOfFundingAssistance_Array   = NoOfFundingAssistance;
            ViewBag.NoOfFundingInstitutions_Array = NoOfFundingInstitutions;
            ViewBag.NoOfPoliciReforms_Array       = NoOfPoliciReforms;
            ViewBag.DA_Array                        = DA;
            ViewBag.DENR_NGP_Array                  = DENR_NGP;
            ViewBag.PCA_Kaanib_Array                = PCA_Kaanib;
            ViewBag.DAR_Array                       = DAR;
            ViewBag.Trainings_Array                 = Trainings;
            ViewBag.FarmesrsTrained_Array           = FarmesrsTrained;
            ViewBag.IECMaterials_Array              = IECMaterials;
            ViewBag.LinkagesLocal_Array             = LinkagesLocal;
            ViewBag.LinkagesInternational_Array     = LinkagesInternational;
            ViewBag.DiseasesManagement_Array        = DiseasesManagement;
            ViewBag.GoodAgriculturalPractices_Array = GoodAgriculturalPractices;
            ViewBag.CacaoFarmsCertified_Array       = CacaoFarmsCertified;
            ViewBag.NurseriesAccredited_Array       = NurseriesAccredited;
            ViewBag.ModelFarms_Array                = ModelFarms;
            ViewBag.ResearchWorkDeveloped_Array     = ResearchWorkDeveloped;

            return(View(db.KPIs.ToList()));
        }