Пример #1
0
 public ActionResult ReceiptsReport(ReceiptsViewModel viewModel)
 {
     ViewBag.Program          = viewModel.ProgramId == null ? "All" : _programService.GetAllProgram().Where(c => c.ProgramID == viewModel.ProgramId).Select(c => c.Name).Single();
     ViewBag.CommodityTypes   = viewModel.CommodityTypeId == 0 ? "All" : _commodityTypeService.GetAllCommodityType().Where(c => c.CommodityTypeID == viewModel.CommodityTypeId).Select(c => c.Name).Single();
     ViewBag.CommoditySources = viewModel.CommoditySourceId == 0 ? "All" : _commoditySourceService.GetAllCommoditySource().Where(c => c.CommoditySourceID == viewModel.CommoditySourceId).Select(c => c.Name).Single();
     return(PartialView());
 }
Пример #2
0
 public ActionResult ReceiveReportViewerExportTo(ReceiptsViewModel receiptsViewModel)
 {
     //Cats.Web.Hub.Reports.MasterReportBound rep = GetReceiveReport(receiptsViewModel);
     Cats.Web.Hub.Reports.MasterReportBound rep = GetReceiveReportByBudgetYear(receiptsViewModel);
     //TODO:Install DevexpressV11 return DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(rep);
     return(View());
 }
Пример #3
0
        public ActionResult CreateReceipts(ReceiptsViewModel receiptsviewmodel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var appid = db.CustomerApplicationForms.AsNoTracking().Where(c => c.CustomerID == receiptsviewmodel.CustomerRefID).Select(a => a.ApplicationID).FirstOrDefault();

                    Receipts receipts = Mapper.Map <Receipts>(receiptsviewmodel);
                    receipts.ApplicationRefID = appid;
                    db.Receipts.Add(receipts);
                    db.SaveChanges();

                    return(RedirectToAction("ShowReceipts", "Admin", new { applicationid = receipts.ReceiptID }));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
                return(View());
            }
        }
Пример #4
0
        public MasterReportBound GetReceiveReportByBudgetYear(ReceiptsViewModel receiptsViewModel)
        {
            List <DRMFSS.BLL.ViewModels.Report.Data.ReceiveReportMain> reports = new List <ReceiveReportMain>();

            DRMFSS.BLL.ViewModels.Report.Data.ReceiveReportMain receivereport = new BLL.ViewModels.Report.Data.ReceiveReportMain();
            BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            receivereport.receiveReports = _transactionService.GetReceiveReport(user.DefaultHub.HubID, receiptsViewModel);//new List<BLL.ViewModels.Report.Data.ReceiveReport>();
            receivereport.PreparedBy     = user.GetFullName();
            receivereport.HubName        = user.DefaultHub.HubNameWithOwner;
            receivereport.ReportDate     = System.DateTime.Now;
            receivereport.ReportCode     = DateTime.Now.ToString();
            receivereport.ReportName     = "ReceiveReport";
            receivereport.ReportTitle    = "Receive Report";
            reports.Add(receivereport);


            DRMFSS.Web.Reports.ReceiveReportByBudgetYear rpt = new Web.Reports.ReceiveReportByBudgetYear()
            {
                DataSource = receivereport.receiveReports
            };
            MasterReportBound report = new MasterReportBound()
            {
                Name = "Receive Report - " + DateTime.Now.ToShortDateString(), DataSource = reports
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Пример #5
0
        /// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(ReceiptsViewModel model)
        {
            var entity = model.ToEntity();

            this._ReceiptssRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
Пример #6
0
        public void CanReceiptsReport()
        {
            //ACT
            //TODO: Seed data into ReceiptsViewModel before proceding with testing
            var viewModel  = new ReceiptsViewModel {
            };
            var viewResult = _stockManagementController.ReceiptsReport(viewModel) as ViewResult;

            //ASSERT
            Assert.NotNull(viewResult);
            Assert.IsInstanceOf <IEnumerable <Program> >(viewResult.ViewBag.Program);
            Assert.IsInstanceOf <IEnumerable <CommodityType> >(viewResult.ViewBag.CommodityTypes);
            Assert.IsInstanceOf <IEnumerable <CommoditySource> >(viewResult.ViewBag.CommoditySources);
        }
Пример #7
0
        public ActionResult CustomerReceipts()
        {
            ReceiptsViewModel receiptsviewmodel = new ReceiptsViewModel();
            DateTime          utcTime           = DateTime.UtcNow;

            string zoneID = "India Standard Time";

            TimeZoneInfo myZone       = TimeZoneInfo.FindSystemTimeZoneById(zoneID);
            DateTime     custDateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, myZone);

            //receiptsviewmodel.ChequeDate = custDateTime;
            receiptsviewmodel.CreationDate = custDateTime;
            return(View(receiptsviewmodel));
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Receipts()
        {
            var user = _userProfileService.GetUser(User.Identity.Name);
            var commoditySourceViewModels = _commoditySourceService.GetAllCommoditySourceForReport();
            var portViewModels            = _receiveService.GetALlPorts();
            var codesViewModels           = ConstantsService.GetAllCodes();
            var commodityTypeViewModels   = _commodityTypeService.GetAllCommodityTypeForReprot();
            var programViewModels         = _programService.GetAllProgramsForReport();
            var storeViewModel            = _hubService.GetAllStoreByUser(user);
            var viewModel = new ReceiptsViewModel(codesViewModels, commodityTypeViewModels, programViewModels,
                                                  storeViewModel, commoditySourceViewModels, portViewModels);

            return(View(viewModel));
        }
Пример #9
0
        /// <summary>
        /// Throw an exception if name is exist.
        /// </summary>
        /// <param name="model">Receipts view model</param>
        public void ThrowExceptionIfExist(ReceiptsViewModel model)
        {
            ConditionFilter <Receipts, long> condition = new ConditionFilter <Receipts, long>
            {
                Query = (entity =>
                         entity.Name == model.Name &&
                         entity.Id != model.Id)
            };
            var existEntity = this._ReceiptssRepository.Get(condition).FirstOrDefault();

            if (existEntity != null)
            {
                throw new ItemAlreadyExistException();
            }
        }
Пример #10
0
        /// <summary>
        /// Update an entity.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReceiptsViewModel Update(ReceiptsViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();

            entity = this._ReceiptssRepository.Update(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return(model);
        }
Пример #11
0
        public ActionResult Receive()
        {
            MasterReportBound report = GetReceiveReportByBudgetYear(new ReceiptsViewModel());
            UserProfile       user   = _userProfileService.GetUser(User.Identity.Name);

            var commoditySources = _commoditySourceService.GetAllCommoditySourceForReport();
            var ports            = _receiveService.GetALlPorts();
            var codes            = ConstantsService.GetAllCodes();
            var commodityTypes   = _commodityTypeService.GetAllCommodityTypeForReprot();
            var programs         = _programService.GetAllProgramsForReport();
            var stores           = _hubService.GetAllStoreByUser(user);
            var viewModel        = new ReceiptsViewModel(codes, commodityTypes, programs, stores, commoditySources, ports);

            ViewBag.Filters = viewModel;
            return(View(report));
        }
Пример #12
0
        public IActionResult ListVetsGameReceipts()
        {
            var receiptsViewModel = new ReceiptsViewModel()
            {
                Receipts = _context.Receipt
                           .Include(r => r.Game)
                           .Include(r => r.Game.HD1)
                           .Include(r => r.Game.HD2)
                           .Include(r => r.Game.LD1)
                           .Include(r => r.Game.LD2)
                           .Include(r => r.Game.HomeTeam)
                           .Include(r => r.Game.AwayTeam)
                           .Include(r => r.Game.Arena)
                           .Include(r => r.Game.GameCategory)
                           .Include(r => r.ReceiptStatus)
                           .Include(r => r.ReceiptType)
                           .Include(r => r.ReceiptCategory).Where(r => r.Game.GameCategoryId == 11).ToList()
            };

            return(View(receiptsViewModel));
        }
        public IHttpResponse Index()
        {
            var user = this.db.Users.FirstOrDefault(u => u.Username == this.User.Username);

            if (user == null)
            {
                return(this.BadRequestError("Invalid user"));
            }

            var receipts = this.db.Receipts
                           .Where(u => u.Recipient.Username == user.Username)
                           .ToList();

            var receiptViewModels = new List <ReceiptViewModel>();

            foreach (var receipt in receipts)
            {
                var fee = (decimal)receipt.Package.Weight * (decimal)2.67;

                var receiptViewModel = new ReceiptViewModel
                {
                    Id        = receipt.Id,
                    IssuedOn  = receipt.IssuedOn.ToShortDateString(),
                    Recipient = receipt.Recipient.Username,
                    Fee       = fee
                };

                receiptViewModels.Add(receiptViewModel);
            }

            var recieptsViewModel = new ReceiptsViewModel
            {
                Receipts = receiptViewModels
            };

            return(this.View(recieptsViewModel));
        }
        public HttpResponse Index()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            var viewModel = new ReceiptsViewModel();

            var receipts = this.receiptService
                           .GetAll(this.User)
                           .Select(r => new ReceiptViewModel
            {
                Id            = r.Id,
                Fee           = r.Fee,
                IssuedOn      = r.IssuedOn,
                RecipientName = r.Recipient.Username
            })
                           .ToList();

            viewModel.Receipts = receipts;

            return(this.View(viewModel));
        }
Пример #15
0
        public ActionResult Receive()
        {
            MasterReportBound report = GetReceiveReportByBudgetYear(new ReceiptsViewModel());
            UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            var commoditySources = _commoditySourceService.GetAllCommoditySourceForReport();
               var ports = _receiveService.GetALlPorts();
               var codes =ConstantsService.GetAllCodes();
            var commodityTypes =  _commodityTypeService.GetAllCommodityTypeForReprot();
               var programs = _programService.GetAllProgramsForReport();
            var stores = _hubService.GetAllStoreByUser(user);
            var viewModel = new ReceiptsViewModel(codes,commodityTypes,programs,stores,commoditySources,ports);
            ViewBag.Filters = viewModel;
            return View(report);
        }
Пример #16
0
        public MasterReportBound GetReceiveReportByBudgetYear(ReceiptsViewModel receiptsViewModel)
        {
            List<Cats.Models.Hub.ViewModels.Report.Data.ReceiveReportMain> reports = new List<ReceiveReportMain>();
            Cats.Models.Hub.ViewModels.Report.Data.ReceiveReportMain receivereport = new ReceiveReportMain();
            UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            receivereport.receiveReports = _transactionService.GetReceiveReport(user.DefaultHub.HubID, receiptsViewModel);//new List<ViewModels.Report.Data.ReceiveReport>();
            receivereport.PreparedBy = user.GetFullName();
            receivereport.HubName = user.DefaultHub.HubNameWithOwner;
            receivereport.ReportDate = System.DateTime.Now;
            receivereport.ReportCode = DateTime.Now.ToString();
            receivereport.ReportName = "ReceiveReport";
            receivereport.ReportTitle = "Receive Report";
            reports.Add(receivereport);

            Cats.Web.Hub.Reports.ReceiveReportByBudgetYear rpt = new ReceiveReportByBudgetYear() { DataSource = receivereport.receiveReports };
            MasterReportBound report = new MasterReportBound() { Name = "Receive Report - " + DateTime.Now.ToShortDateString(), DataSource = reports };
            report.rptSubReport.ReportSource = rpt;
            return report;
        }
Пример #17
0
 public ActionResult ReceivePartial(ReceiptsViewModel receiptsViewModel)
 {
     MasterReportBound report = GetReceiveReportByBudgetYear(receiptsViewModel);
     return PartialView("ReceivePartial", report);
 }
Пример #18
0
        public ReceiptsPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new ReceiptsViewModel();
        }
Пример #19
0
 public ActionResult ReceiveReportViewerExportTo(ReceiptsViewModel receiptsViewModel)
 {
     //DRMFSS.Web.Reports.MasterReportBound rep = GetReceiveReport(receiptsViewModel);
     DRMFSS.Web.Reports.MasterReportBound rep = GetReceiveReportByBudgetYear(receiptsViewModel);
     return(DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(rep));
 }
Пример #20
0
 public ActionResult ReceiveReportViewerExportTo(ReceiptsViewModel receiptsViewModel)
 {
     //Cats.Web.Hub.Reports.MasterReportBound rep = GetReceiveReport(receiptsViewModel);
     Cats.Web.Hub.Reports.MasterReportBound rep = GetReceiveReportByBudgetYear(receiptsViewModel);
     //TODO:Install DevexpressV11 return DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(rep);
     return View();
 }
Пример #21
0
        public ActionResult ReceivePartial(ReceiptsViewModel receiptsViewModel)
        {
            MasterReportBound report = GetReceiveReportByBudgetYear(receiptsViewModel);

            return(PartialView("ReceivePartial", report));
        }