private void loadPrintData()
 {
     SA34_Team9_StationeryStoreInventorySystem.Reports.SSISReports.RequisitionReport RR =
        new RequisitionReport();
     RR.SetDataSource((DataTable)Session["PrintData"]);
     PrintReportViewer.ReportSource = RR;
 }
        public ActionResult ShowReqReport()
        {
            RequisitionReport reqReport = Session["reqReport"] as RequisitionReport;

            if (reqReport.CategoryList == null)
            {
                reqReport.CategoryList = db.Categories.Select(c => c.CategoryId).ToList();
            }

            if (reqReport.DepartmentList == null)
            {
                reqReport.DepartmentList = db.Departments.Select(d => d.DepartmentID).ToList();
            }

            ViewBag.report = reqReport;
            reportService.GetRequisitionData(reqReport, out string[] categories, out ReportByTimeSeries[] timeDt,
        public ActionResult ShowReport()
        {
            RequisitionReport report = Session["report"] as RequisitionReport;

            if (report.CategoryList == null)
            {
                report.CategoryList = db.Categories.Select(c => c.CategoryId).ToList();
            }

            List <int> departmentList = new List <int>
            {
                headService.FindDepID()
            };

            report.DepartmentList = departmentList;
            ViewBag.report        = report;
            reportService.GetRequisitionData(report, out string[] categories, out ReportByTimeSeries[] timeDt,
        public void GetRequisitionData(RequisitionReport reqReport, out string[] categories, out ReportByTimeSeries[] timeDt,
                                       out string[] departments, out ReportByCategory[] catDt)
        {
            List <int> catId     = reqReport.CategoryList;
            List <int> depId     = reqReport.DepartmentList;
            DateTime   startDate = Convert.ToDateTime(reqReport.StartDate);
            DateTime   endDate   = Convert.ToDateTime(reqReport.EndDate);

            var data = db.RequisitionDetails
                       .Where(r => r.Requisition.RequisitionDate >= startDate &&
                              r.Requisition.RequisitionDate < endDate &&
                              catId.Contains(r.Item.CategoryID) && depId.Contains(r.Requisition.Employee.DepartmentID));
            var timeSeriesData = data
                                 .GroupBy(r => new ReportByTimeSeriesKey
            {
                Month    = SqlFunctions.DatePart("month", r.Requisition.RequisitionDate),
                Year     = SqlFunctions.DateName("year", r.Requisition.RequisitionDate),
                Category = r.Item.Category.CategoryName
            })
                                 .Select(r => new ReportByTimeSeries {
                Key = r.Key, Quantity = r.Sum(b => b.Quantity)
            }).ToList();
            var catData = data
                          .GroupBy(r => new ReportByCategoryKey
            {
                Department = r.Requisition.Employee.Department.DepartmentName,
                Category   = r.Item.Category.CategoryName
            })
                          .Select(r => new ReportByCategory {
                Key = r.Key, Quantity = r.Sum(b => b.Quantity)
            }).ToList();

            //categories = db.Categories.Where(c => catId.Contains(c.CategoryId)).Select(c => c.CategoryName).Distinct().ToArray();
            categories  = timeSeriesData.Select(r => r.Key.Category).Distinct().ToArray();
            timeDt      = timeSeriesData.ToArray();
            departments = catData.Select(r => r.Key.Department.ToString()).Distinct().ToArray();
            catDt       = catData.ToArray();
        }
 public ActionResult ViewReport(RequisitionReport reqReport)
 {
     Session["report"] = reqReport;
     return(Json(true, JsonRequestBehavior.AllowGet));
 }
Exemple #6
0
 private void loadPrintData()
 {
     SA34_Team9_StationeryStoreInventorySystem.Reports.SSISReports.RequisitionReport RR =
         new RequisitionReport();
     RR.SetDataSource((DataTable)Session["PrintData"]);
     PrintReportViewer.ReportSource = RR;
 }