示例#1
0
        public ActionResult PrintPartialViewToPdf(ViewModels.PrintReportViewModel form)
        {
            if (form.reportFrom.CompareTo(form.reportTo) > 0 || form.reportFrom.CompareTo(DateTime.Now) > 0 || form.reportTo.CompareTo(DateTime.Now) > 0)
            {
                return(RedirectToAction("Index"));
            }

            var currentUser = Database.Session.Query <Models.User>().FirstOrDefault(u => u.Username == HttpContext.User.Identity.Name);
            var toDate      = form.reportTo;

            toDate = toDate.AddSeconds(86399);

            ViewModels.PrintReportViewModel rapor = new ViewModels.PrintReportViewModel();

            rapor.allSales = Database.Session.Query <Models.Sales>()
                             .Where(s => s.belongsToUser.Id == currentUser.Id)
                             .Where(s => s.date.CompareTo(form.reportFrom) >= 0)
                             .Where(s => s.date.CompareTo(toDate) <= 0);

            rapor.currUser   = currentUser;
            rapor.reportFrom = form.reportFrom;
            rapor.reportTo   = form.reportTo;
            var report = new PartialViewAsPdf("~/Views/Shared/_PrintReport.cshtml", rapor);

            return(report);
        }
示例#2
0
        public ActionResult Index()
        {
            var currentUser = Database.Session.Query <Models.User>().FirstOrDefault(u => u.Username == HttpContext.User.Identity.Name);

            ViewModels.PrintReportViewModel sales = new ViewModels.PrintReportViewModel();
            sales.allSales = Database.Session.Query <Models.Sales>()
                             .Where(s => s.belongsToUser.Id == currentUser.Id);
            sales.currUser = currentUser;
            return(View(sales));
        }
        public ActionResult Index()
        {
            var currentUser = Database.Session.Query <Models.User>().FirstOrDefault(u => u.Username == HttpContext.User.Identity.Name);

            ViewModels.PrintReportViewModel customer = new ViewModels.PrintReportViewModel();
            customer.allIncomings = Database.Session.Query <Models.Incomings>().Where(i => i.Users.Id == currentUser.Id);
            customer.allOutGoings = Database.Session.Query <Models.Outgoings>().Where(i => i.Users.Id == currentUser.Id);
            customer.currUser     = currentUser;
            return(View(customer));
        }
        public ActionResult PrintPartialViewToPdf(ViewModels.PrintReportViewModel form)
        {
            if (form.reportFrom.CompareTo(form.reportTo) > 0 || form.reportFrom.CompareTo(DateTime.Now) > 0 || form.reportTo.CompareTo(DateTime.Now) > 0)
            {
                return(RedirectToAction("Index"));  // Rapor aralığının kontrollerini yapıyoruz ki geçersiz aralıklar için rapor hazırlanamasın.
            }
            var currentUser = Database.Session.Query <Models.User>().FirstOrDefault(u => u.Username == HttpContext.User.Identity.Name);

            ViewModels.PrintReportViewModel customer = new ViewModels.PrintReportViewModel();
            customer.allIncomings = Database.Session.Query <Models.Incomings>()
                                    .Where(i => i.Users.Id == currentUser.Id && i.Date.CompareTo(form.reportFrom) >= 0 && i.Date.CompareTo(form.reportTo) <= 0);
            customer.allOutGoings = Database.Session.Query <Models.Outgoings>()
                                    .Where(i => i.Users.Id == currentUser.Id && i.Date.CompareTo(form.reportFrom) >= 0 && i.Date.CompareTo(form.reportTo) <= 0);
            customer.currUser   = currentUser;
            customer.reportFrom = form.reportFrom;
            customer.reportTo   = form.reportTo;
            var report = new PartialViewAsPdf("~/Views/Shared/_PrintReport.cshtml", customer);

            return(report);
        }