示例#1
0
        // GET: Reports
        public ActionResult Tonnage()
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login", true);
            }

            finalDEURList = (List <TonnageByActivity>)Session["DEURList"];
            if (finalDEURList == null)
            {
                finalDEURList = GenerateDEURList(1);
            }
            Tonnage curRunOfMineReport = GenerateRunOfMineReport(finalDEURList, System.DateTime.Now, false);

            if (curRunOfMineReport == null)
            {
                return(RedirectToAction("NoData", "Home"));
            }

            DateTime tempLatestDate   = Convert.ToDateTime(curRunOfMineReport.DateDaily);
            string   LatestReportDate = curRunOfMineReport.DateMonthly + "/" + tempLatestDate.Day + "/" + curRunOfMineReport.DateYearly;

            ViewBag.ReportDate = "Report for " + LatestReportDate;

            Session["ReportDate"] = LatestReportDate;
            Session["DEURList"]   = finalDEURList;
            return(View(curRunOfMineReport));
        }
示例#2
0
        public ActionResult Tonnage(DateTime?chosenDate)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login", true);
            }

            if (chosenDate == null)
            {
                return(RedirectToAction("NoData", "Home"));
            }

            finalDEURList = (List <TonnageByActivity>)Session["DEURList"];
            Tonnage curRunOfMineReport = GenerateRunOfMineReport(finalDEURList, Convert.ToDateTime(chosenDate), true);

            if (curRunOfMineReport == null)
            {
                return(RedirectToAction("NoData", "Home"));
            }

            ViewBag.ReportDate = "Report for " + Convert.ToDateTime(chosenDate).ToString("MM/dd/yyyy");
            return(View(curRunOfMineReport));
        }
示例#3
0
 public int CompareTo(Schip schip)
 {
     if (!ReferenceEquals(schip, null))
     {
         int compareteTo = Naam.CompareTo(schip.Naam);
         if (compareteTo == 0)
         {
             compareteTo = Tonnage.CompareTo(schip.Tonnage);
         }
         if (compareteTo == 0)
         {
             compareteTo = Breedte.CompareTo(schip.Breedte);
         }
         if (compareteTo == 0)
         {
             compareteTo = Lengte.CompareTo(schip.Lengte);
         }
         return(compareteTo);
     }
     else
     {
         return(+1);
     }
 }
示例#4
0
 public override int GetHashCode()
 {
     return(ObligationType.GetHashCode() ^ WeeeCategory.GetHashCode() ^ Tonnage.GetHashCode());
 }
        public Tonnage GenerateRunOfMineReport(List <TonnageByActivity> DEURList, DateTime chosenDate, bool applyDate)
        {
            if (DEURList.Count == 0)
            {
                return(null);
            }

            List <TonnageByActivity> tonnageList     = new List <TonnageByActivity>();
            List <TonnageByActivity> tempTonnageList = new List <TonnageByActivity>();

            tonnageList = DEURList.Where(s => s.TonnageAmount > 0).OrderByDescending(s => s.MaterialDateOfEntry).ToList();
            if (applyDate)
            {
                tonnageList = DEURList.Where(s => s.MaterialDateOfEntry <= chosenDate).OrderByDescending(s => s.MaterialDateOfEntry).ToList();
            }
            if (tonnageList.Count == 0)
            {
                return(null);
            }

            DateTime?latestDate = tonnageList[0].MaterialDateOfEntry;

            if (applyDate)
            {
                latestDate = chosenDate;
            }

            #region variables initialization
            decimal yearToDateTonnageAmount      = 0;
            decimal monthlyTonnageAmount         = 0;
            decimal oneMonthBeforeTonnageAmount  = 0;
            decimal twoMonthsBeforeTonnageAmount = 0;
            decimal dailyTonnageAmount           = 0;
            decimal saproliteTonnage             = 0;
            decimal limoniteTonnage         = 0;
            decimal wasteTonnage            = 0;
            decimal monthlySaproliteTonnage = 0;
            decimal monthlyLimoniteTonnage  = 0;
            decimal monthlyWasteTonnage     = 0;
            decimal yearlySaproliteTonnage  = 0;
            decimal yearlyLimoniteTonnage   = 0;
            decimal yearlyWasteTonnage      = 0;
            string  dailyDate   = "";
            string  monthlyDate = "";
            string  yearlyDate  = "";
            #endregion

            #region variable assignment
            //get year-to-date tonnage from January 1 - December 31 of the latest year available
            tempTonnageList = tonnageList.Where(s => s.MaterialDateOfEntry.Value.Year == latestDate.Value.Year).ToList();
            if (tempTonnageList.Count() > 0)
            {
                yearToDateTonnageAmount = tempTonnageList.Select(s => s.TonnageAmount).Sum();
                yearlyDate = tempTonnageList[0].MaterialDateOfEntry.Value.Year.ToString();
            }
            //get montly tonnage based on the latest month available
            tempTonnageList = tonnageList.Where(s => s.MaterialDateOfEntry.Value.Month == latestDate.Value.Month).ToList();
            if (tempTonnageList.Count() > 0)
            {
                monthlyTonnageAmount = tempTonnageList.Select(s => s.TonnageAmount).Sum();
                monthlyDate          = tempTonnageList[0].MaterialDateOfEntry.Value.Month.ToString();

                tempTonnageList = tonnageList.Where(s => s.MaterialDateOfEntry.Value.Month == (latestDate.Value.Month - 1)).ToList();
                if (tempTonnageList.Count() > 0)
                {
                    oneMonthBeforeTonnageAmount = tempTonnageList.Select(s => s.TonnageAmount).Sum();
                }

                tempTonnageList = tonnageList.Where(s => s.MaterialDateOfEntry.Value.Month == (latestDate.Value.Month - 2)).ToList();
                if (tempTonnageList.Count() > 0)
                {
                    twoMonthsBeforeTonnageAmount = tempTonnageList.Select(s => s.TonnageAmount).Sum();
                }
            }
            //get daily tonnage based on the latest date available
            tempTonnageList = tonnageList.Where(s => s.MaterialDateOfEntry == latestDate).ToList();
            if (tempTonnageList.Count() > 0)
            {
                dailyTonnageAmount = tempTonnageList.Select(s => s.TonnageAmount).Sum();
                dailyDate          = tempTonnageList[0].MaterialDateOfEntry.Value.ToShortDateString();
                System.Diagnostics.Debug.WriteLine("Latest Date: " + dailyDate + " Daily Tonnage Amount: " + dailyTonnageAmount);
            }

            //get DAILY, MONTHLY, YEARLY data based on material type: sapro, limo, waste
            tempTonnageList = tonnageList.Where(s => s.MaterialName.ToUpper() == "SAPROLITE" || s.MaterialName.ToUpper() == "SAPRO" || s.MaterialName.ToUpper() == "SHIPPABLE SAPRO").ToList();
            if (tempTonnageList.Count() > 0)
            {
                yearlySaproliteTonnage  = tempTonnageList.Where(s => s.MaterialDateOfEntry.Value.Year.ToString() == yearlyDate).Select(s => s.TonnageAmount).Sum();
                monthlySaproliteTonnage = tempTonnageList.Where(s => s.MaterialDateOfEntry.Value.Month.ToString() == monthlyDate && s.MaterialDateOfEntry.Value.Year.ToString() == yearlyDate).Select(s => s.TonnageAmount).Sum();
                saproliteTonnage        = tempTonnageList.Where(s => s.MaterialDateOfEntry == latestDate).Select(s => s.TonnageAmount).Sum();
            }
            tempTonnageList = tonnageList.Where(s => s.MaterialName.ToUpper() == "LIMONITE" || s.MaterialName.ToUpper() == "LIMO" || s.MaterialName.ToUpper() == "SHIPPABLE LIMO").ToList();
            if (tempTonnageList.Count() > 0)
            {
                yearlyLimoniteTonnage  = tempTonnageList.Where(s => s.MaterialDateOfEntry.Value.Year.ToString() == yearlyDate).Select(s => s.TonnageAmount).Sum();
                monthlyLimoniteTonnage = tempTonnageList.Where(s => s.MaterialDateOfEntry.Value.Month.ToString() == monthlyDate && s.MaterialDateOfEntry.Value.Year.ToString() == yearlyDate).Select(s => s.TonnageAmount).Sum();
                limoniteTonnage        = tempTonnageList.Where(s => s.MaterialDateOfEntry == latestDate).Select(s => s.TonnageAmount).Sum();
            }
            tempTonnageList = tonnageList.Where(s => s.MaterialName.ToUpper() == "BOULDERS" || s.MaterialName.ToUpper() == "CRUSHED BOULDERS" || s.MaterialName.ToUpper() == "LIMO WASTE" || s.MaterialName.Trim().ToUpper() == "SAPRO WASTE" || s.MaterialName.Trim().ToUpper() == "TOPSOIL").ToList();
            if (tempTonnageList.Count() > 0)
            {
                yearlyWasteTonnage  = tempTonnageList.Where(s => s.MaterialDateOfEntry.Value.Year.ToString() == yearlyDate).Select(s => s.TonnageAmount).Sum();
                monthlyWasteTonnage = tempTonnageList.Where(s => s.MaterialDateOfEntry.Value.Month.ToString() == monthlyDate && s.MaterialDateOfEntry.Value.Year.ToString() == yearlyDate).Select(s => s.TonnageAmount).Sum();
                wasteTonnage        = tempTonnageList.Where(s => s.MaterialDateOfEntry == latestDate).Select(s => s.TonnageAmount).Sum();
            }
            #endregion

            #region variable assignment to model
            Tonnage finalTonnage = new Tonnage();
            finalTonnage.TonnageDaily           = dailyTonnageAmount;
            finalTonnage.TonnageYearly          = yearToDateTonnageAmount;
            finalTonnage.TonnageMonthly         = monthlyTonnageAmount;
            finalTonnage.TonnageOneMonthBefore  = oneMonthBeforeTonnageAmount;
            finalTonnage.TonnageTwoMonthsBefore = twoMonthsBeforeTonnageAmount;

            finalTonnage.DailyTonnageSaprolite = saproliteTonnage;
            finalTonnage.DailyTonnageLimonite  = limoniteTonnage;
            finalTonnage.DailyTonnageWaste     = wasteTonnage;
            finalTonnage.DateDaily             = dailyDate;

            finalTonnage.MonthlyTonnageSaprolite = monthlySaproliteTonnage;
            finalTonnage.MonthlyTonnageLimonite  = monthlyLimoniteTonnage;
            finalTonnage.MonthlyTonnageWaste     = monthlyWasteTonnage;
            finalTonnage.DateMonthly             = monthlyDate;
            //finalTonnage.DateOneMonthBefore = (Convert.ToInt32(monthlyDate) - 1).ToString();
            //finalTonnage.DateTwoMonthsBefore = (Convert.ToInt32(monthlyDate) - 2).ToString();

            finalTonnage.YearlyTonnageSaprolite = yearlySaproliteTonnage;
            finalTonnage.YearlyTonnageLimonite  = yearlyLimoniteTonnage;
            finalTonnage.YearlyTonnageWaste     = yearlyWasteTonnage;
            finalTonnage.DateYearly             = yearlyDate;
            #endregion

            return(finalTonnage);
        }
示例#6
0
 public override int GetHashCode()
 {
     return(Naam.GetHashCode() ^ Tonnage.GetHashCode() ^ Breedte.GetHashCode() ^ Lengte.GetHashCode());
 }