Ejemplo n.º 1
0
        // 科目================================================================
        public ActionResult Subject(string Bno)
        {
            List <Bugdalist2> gamers = new GetBudgetModel().getCrlist2(Bno);

            ViewBag.h = gamers;

            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Items(string Puid, String Bugda)
        {
            List <Itemslist> gamers = new GetBudgetModel().getItems(Puid);

            ViewBag.h     = gamers;
            ViewBag.k     = Puid;
            ViewBag.Bugda = Bugda;
            //ViewBag.Guid = Guid.NewGuid();

            return(View());
        }
Ejemplo n.º 3
0
        public JsonResult AjaxGetTeams(string Puid)
        {
            List <Member> gamers1 = new GetBudgetModel().getList2(Puid);

            return(Json(gamers1, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public ActionResult Signoff(string Bno, string isPost = "0")
        {
            //string account = "0001";
            //string account = Session["account"].ToString();

            // 判斷帳號
            List <Mlist02> Check = new GetBudgetModel().CheckAccount(Session["account"].ToString(), Bno);

            //var gamers = db.Step_Signoff(Session["account"].ToString(), Bno);

            // 取現在關卡
            string LEV = "1.00";
            string 當關人 = "";


            if (Check[1].LEV == 2 && Check[1].sctrl == "Y")
            {
                LEV = Check[2].LEV.ToString();
                當關人 = Check[0].第三關.ToString();
            }
            else if (Check[0].LEV == 1 && Check[0].sctrl == "Y")
            {
                LEV = Check[1].LEV.ToString();
                當關人 = Check[0].第二關.ToString();
            }
            else if (Check[2].LEV == 3 && Check[2].sctrl == "Y")
            {
                LEV = "4.00";
                當關人 = "";
            }
            else
            {
                當關人 = Check[0].第一關.ToString();
            }


            string SCTRL = "";

            // 判斷account============================
            if (當關人.Contains(";"))
            {
                // 當關有複數的人
                int      i      = 0;
                string[] sArray = 當關人.Split(';');
                foreach (string AA in sArray)
                {
                    if (!string.IsNullOrEmpty(AA))
                    {
                        if (AA == Session["account"].ToString())
                        {
                            i++;
                        }
                    }
                }
                if (i == 0)
                {
                    SCTRL = "N";
                }
            }
            else
            {
                if (當關人 != Session["account"].ToString())
                {
                    SCTRL = "N";
                }
            }

            List <Mlist03> Check1 = new List <Mlist03>();

            Check1.Add(new Mlist03()
            {
                單號 = Bno, LEV = Check[0].LEV.ToString(), 簽核人 = Check[0].第一關.ToString()
            });
            Check1.Add(new Mlist03()
            {
                單號 = Bno, LEV = Check[1].LEV.ToString(), 簽核人 = Check[0].第二關.ToString()
            });
            Check1.Add(new Mlist03()
            {
                單號 = Bno, LEV = Check[2].LEV.ToString(), 簽核人 = Check[0].第三關.ToString()
            });


            ViewBag.h      = SCTRL;
            ViewBag.t      = Check1;
            ViewBag.LEV    = LEV;
            ViewBag.單號     = Bno;
            ViewBag.isPost = isPost;
            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult Create(string Dept, string Month)
        {
            Budget_t     BudgetNo = new Budget_t();
            Budget_Bugda Budget2  = new Budget_Bugda();

            if (String.IsNullOrEmpty(Dept.Trim()))
            {
                ModelState.AddModelError("Dept", $"Dept is empty.");
                return(View());
            }
            // 判斷部門
            else if (new Models.GetBudgetModel().Dept(Dept) == 0)
            {
                ModelState.AddModelError("Dept", $"The {Dept} is wrong format.");
                return(View());
            }

            // 判斷日期
            if (String.IsNullOrEmpty(Month.Trim()))
            {
                ModelState.AddModelError("Month", $"Month is empty.");
                return(View());
            }
            else if (Month.Length != 4 ||
                     (Month.Substring(0, 2) != DateTime.Now.ToString("yyyy").Substring(2, 2) &&
                      Month.Substring(0, 2) != DateTime.Now.AddMonths(1).ToString("yyyy").Substring(2, 2)))
            {
                ModelState.AddModelError("Month", $"The {Month} is wrong format.");
                return(View());
            }

            // 判斷這部門的這個月是否已建立
            if (new Models.GetBudgetModel().Check(Dept, Month) > 0)
            {
                ModelState.AddModelError("Dept", $"had created in{Month}.");
                return(View());
            }

            string Bno = new GetBudgetModel().Bno();
            Guid   uid = Guid.NewGuid();

            BudgetNo.Bno   = Bno;
            BudgetNo.Month = Month;
            BudgetNo.Dept  = Dept;
            BudgetNo.Uid   = uid;
            BudgetNo.Total = 0;
            BudgetNo.Sctrl = "N";
            BudgetNo.Lev   = 1;

            List <Bugdalist> gamers = new GetBudgetModel().getCrlist(Dept, Month);

            if (ModelState.IsValid)
            {
                // create 主list
                new GetBudgetModel().Create(BudgetNo);

                // create 明細list
                foreach (var item in gamers)
                {
                    Budget2.Bugda = item.Bugda;
                    Budget2.Total = item.Total;
                    Budget2.Puid  = uid;
                    Budget2.Uid   = Guid.NewGuid();

                    new GetBudgetModel().Create(Budget2);
                }

                // Insert Step
                db.Step_Insert(Bno, "預算系統", "部門預算", Session["account"].ToString());
            }
            return(RedirectToAction("Subject", "Home", new { Bno }));
        }