public ActionResult Create()
        {
            MoveOrderModel model = SessionHelper.MoveOrder;

            if (model == null)
            {
                model = new MoveOrderModel
                {
                    SOBId         = SessionHelper.SOBId,
                    DateRequired  = DateTime.Now,
                    MoveOrderDate = DateTime.Now,
                    MoveOrderNo   = "New"
                };
                model.CompanyId = AuthenticationHelper.CompanyId.Value;
                ViewBag.SOBName = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

                SessionHelper.MoveOrder = model;
                if (SessionHelper.MoveOrder.MoveOrderDetail == null)
                {
                    SessionHelper.MoveOrder.MoveOrderDetail = new List <MoveOrderDetailModel>();
                }
            }

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Edit(SetOfBookModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Id > 0)
                {
                    string result = SetOfBookHelper.Update(model);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    if (SetOfBookHelper.GetSetOfBookByName(model.Name) == null)
                    {
                        string result = SetOfBookHelper.Insert(model);
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("Error", "Set of Book Already exists.");
                    }
                }
            }

            return(View(model));
        }
Beispiel #3
0
        public ActionResult Create()
        {
            MiscellaneousTransactionModel model = SessionHelper.MiscellaneousTransaction;

            if (model == null)
            {
                model = new MiscellaneousTransactionModel();
                model = new MiscellaneousTransactionModel
                {
                    SOBId           = SessionHelper.SOBId,
                    CodeCombination = getCodeCombinationList(SessionHelper.SOBId),
                    CompanyId       = AuthenticationHelper.CompanyId.Value,
                    TransactionDate = DateTime.Now
                };
                model.CodeCombinationId     = model.CodeCombination != null && model.CodeCombination.Count > 0 ? Convert.ToInt64(model.CodeCombination.FirstOrDefault().Value) : 0;
                model.CodeCombinationString = model.CodeCombination != null && model.CodeCombination.Count > 0 ? model.CodeCombination.FirstOrDefault().Text : "";
                ViewBag.SOBName             = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

                SessionHelper.MiscellaneousTransaction = model;
                if (SessionHelper.MiscellaneousTransaction.MiscellaneousTransactionDetail == null)
                {
                    SessionHelper.MiscellaneousTransaction.MiscellaneousTransactionDetail = new List <MiscellaneousTransactionDetailModel>();
                }
            }
            else
            {
                model.CodeCombination = getCodeCombinationList(SessionHelper.SOBId);
            }

            return(View(model));
        }
Beispiel #4
0
        public JsonResult Save(UserSetofBookModel model)
        {
            UserSetofBookModel defaultSOB = UserSetofBookHelper.GetDefaultSOB();

            if (defaultSOB != null)
            {
                model.Id = defaultSOB.Id;
            }

            //Remove all transaction's session that depends on SOB..
            SessionHelper.JV                       = null;
            SessionHelper.Invoice                  = null;
            SessionHelper.PayableInvoice           = null;
            SessionHelper.Payment                  = null;
            SessionHelper.Order                    = null;
            SessionHelper.MiscellaneousTransaction = null;
            SessionHelper.Locator                  = null;
            SessionHelper.Receipts                 = null;
            SessionHelper.Bank                     = null;
            SessionHelper.BankAccount              = null;
            SessionHelper.Calendar                 = null;
            SessionHelper.Item                     = null;
            SessionHelper.Remittance               = null;
            SessionHelper.Tax                      = null;
            SessionHelper.Shipment                 = null;

            model.UserId    = AuthenticationHelper.UserId;
            model.CompanyId = AuthenticationHelper.CompanyId.Value;

            SessionHelper.SOBId   = model.SOBId;
            SessionHelper.SOBName = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

            return(Json(UserSetofBookHelper.Save(model)));
        }
Beispiel #5
0
        public ActionResult Index()
        {
            if (TempData["LastURL"] == null)
            {
                TempData["LastURL"] = Request.UrlReferrer.AbsolutePath;
            }

            UserSetofBookModel model = new UserSetofBookModel();

            //if(SessionHelper.SOBId != null && SessionHelper.SOBId != 0)
            if (SessionHelper.SOBId != 0)
            {
                model = UserSetofBookHelper.GetDefaultSOB();
                if (model != null)
                {
                    model.SetofBooks = SetOfBookHelper.GetSetOfBookList();
                    return(PartialView("_Create", model));
                }
            }
            model = new UserSetofBookModel
            {
                SetofBooks = SetOfBookHelper.GetSetOfBookList(),
                CompanyId  = AuthenticationHelper.CompanyId.Value,
                SOBId      = SessionHelper.SOBId,
                UserId     = AuthenticationHelper.UserId
            };

            return(PartialView("_Create", model));
        }
Beispiel #6
0
        public ActionResult Index(string message = "")
        {
            ViewBag.ErrorMessage = message;
            SetOfBookListModel model = new SetOfBookListModel();

            model.SetOfBooks = SetOfBookHelper.GetSetOfBooks();
            return(View(model));
        }
Beispiel #7
0
        public ActionResult Edit(string id)
        {
            if (!AccountValueHelper.CheckAccountValue(id))
            {
                throw new Exception("Edit Error", new Exception {
                    Source = "Values having code combinitions cannot be edited"
                });
            }
            AccountValueViewModel model = AccountValueHelper.GetAccountValue(id);

            model.SetOfBook = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;
            model.ValueChar = AccountHelper.GetSegmentCharacters(model.Segment, AccountHelper.GetAccountBySOBId(SessionHelper.SOBId.ToString()));

            return(View(model));
        }
Beispiel #8
0
        public ActionResult Create(string segment)
        {
            AccountValueViewModel model = new AccountValueViewModel();
            Account account             = AccountHelper.GetAccountBySOBId(SessionHelper.SOBId.ToString());

            if (account != null)
            {
                model.ChartId               = account.Id;
                model.SetOfBook             = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;
                model.Segment               = segment;
                SessionHelper.SelectedValue = segment;
                model.ValueChar             = AccountHelper.GetSegmentCharacters(segment, account);
                return(View("Edit", model));
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Create()
        {
            ItemModel model = SessionHelper.Item;

            if (model == null)
            {
                model = new ItemModel
                {
                    SOBId = SessionHelper.SOBId
                };
                if (model.COGSCodeCombination == null)
                {
                    model.COGSCodeCombination = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value)
                                                .Select(x => new SelectListItem
                    {
                        Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                        Value = x.Id.ToString()
                    }).ToList();
                    model.COGSCodeCombinationId = model.COGSCodeCombination.Any() ?
                                                  Convert.ToInt32(model.COGSCodeCombination.First().Value) : 0;
                }

                if (model.SalesCodeCombination == null)
                {
                    model.SalesCodeCombination = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value)
                                                 .Select(x => new SelectListItem
                    {
                        Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                        Value = x.Id.ToString()
                    }).ToList();
                    model.SalesCodeCombinationId = model.SalesCodeCombination.Any() ?
                                                   Convert.ToInt32(model.SalesCodeCombination.First().Value) : 0;
                }
                model.CompanyId = AuthenticationHelper.CompanyId.Value;
                ViewBag.SOBName = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

                SessionHelper.Item = model;
                if (SessionHelper.Item.ItemWarehouses == null)
                {
                    SessionHelper.Item.ItemWarehouses = new List <ItemWarehouseModel>();
                }
            }

            return(View(model));
        }
Beispiel #10
0
        public ActionResult Create()
        {
            LocatorModel model = SessionHelper.Locator;

            if (model == null)
            {
                model = new LocatorModel
                {
                    SOBId = SessionHelper.SOBId
                };
                ViewBag.SOBName = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

                SessionHelper.Locator = model;
                if (SessionHelper.Locator.LocatorWarehouses == null)
                {
                    SessionHelper.Locator.LocatorWarehouses = new List <LocatorWarehouseModel>();
                }
            }

            model.CompanyId = AuthenticationHelper.CompanyId.Value;

            return(View(model));
        }
Beispiel #11
0
        public ActionResult Index()
        {
            if (AuthenticationHelper.UserRole == UserRoles.SuperAdmin.ToString())
            {
                return(RedirectToAction("Index", "Company"));
            }

            SessionHelper.SOBId   = UserSetofBookHelper.GetDefaultSOB() == null ? 0 : UserSetofBookHelper.GetDefaultSOB().SOBId;
            SessionHelper.SOBName = SessionHelper.SOBId == 0? "Click here to select Set of Book": SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;
            return(View());
        }
Beispiel #12
0
 public ActionResult Delete(string id)
 {
     SetOfBookHelper.Delete(id);
     return(RedirectToAction("Index"));
 }
Beispiel #13
0
 public ActionResult Edit(string id)
 {
     ViewBag.Title = "Edit Book";
     return(View(SetOfBookHelper.GetSetOfBook(id)));
 }
Beispiel #14
0
 public ActionResult SetOfBookPartial()
 {
     return(PartialView("_List", SetOfBookHelper.GetSetOfBooks()));
 }