Пример #1
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));
        }
        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));
        }
Пример #3
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)));
        }
Пример #4
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));
        }
Пример #5
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"));
        }
Пример #6
0
        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));
        }
Пример #7
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));
        }
Пример #8
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());
        }
Пример #9
0
 public ActionResult Edit(string id)
 {
     ViewBag.Title = "Edit Book";
     return(View(SetOfBookHelper.GetSetOfBook(id)));
 }