Exemple #1
0
        public JsonResult ExpenseEdit(TRN_EXPENSE_DET exp_det)
        {
            decimal?USER_NO  = Session["sess_USER_NO"] as decimal?;
            decimal?LOGON_NO = Session["sess_LOGON_NO"] as decimal?;

            db.TRN_EXPENSE_DET_DO_APPROVE(exp_det.EXP_DET_NO, 1, USER_NO, LOGON_NO, null, null,
                                          exp_det.APPROVE_EXP_TYPE_NO, exp_det.APPROVE_EXP_AMT);

            return(Json(new { msg = "success" }));
        }
Exemple #2
0
 public ActionResult Edit(TRN_EXPENSE trn_expense)
 {
     if (ModelState.IsValid)
     {
         db.TRN_EXPENSE_UPDATE(trn_expense.EXP_NO, decimal.Parse(Session["sess_USER_NO"].ToString()),
                               decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now,
                               null, 1, trn_expense.USER_NO, trn_expense.AGENT_USER_NO, trn_expense.TRN_EXP_DATE,
                               trn_expense.APPROVE_TYPE_NO, trn_expense.APPROVE_TIME, trn_expense.APPROVE_USER_NO,
                               trn_expense.APPROVE_LOGON_NO, trn_expense.REASON_NO, trn_expense.REAMRKS,
                               trn_expense.IS_TRN_LOCKED, trn_expense.IS_LOCK_BY_SYSTEM,
                               trn_expense.TRN_LOCK_DATE, trn_expense.TRN_LOCK_USER_NO,
                               trn_expense.TRN_LOCK_LOGON_NO, trn_expense.IS_MANUAL_ENTRY, trn_expense.OFFLINE_EXP_NO);
         List <string> lstTmp = new List <string>();
         foreach (string curSession in Session)
         {
             if (curSession.Contains("ExpenseEntry"))
             {
                 lstTmp.Add(curSession);
                 temp_TRN_EXPENSE_DET temp_sess_det = (temp_TRN_EXPENSE_DET)Session[curSession];
                 if (!temp_sess_det.set_deleted)
                 {
                     TRN_EXPENSE_DET dt = db.TRN_EXPENSE_DET.Where(s => s.EXP_DET_NO == temp_sess_det.editID).FirstOrDefault();
                     if (dt != null)
                     {
                         db.TRN_EXPENSE_DET_UPDATE(Convert.ToDecimal(temp_sess_det.editID), decimal.Parse(Session["sess_USER_NO"].ToString()),
                                                   decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now, null, 1,
                                                   trn_expense.EXP_NO, temp_sess_det.exp_type, temp_sess_det.amount, dt.APPROVE_EXP_TYPE_NO,
                                                   dt.APPROVE_EXP_AMT, dt.APPROVE_TYPE_NO, dt.APPROVE_TIME, dt.APPROVE_USER_NO, dt.APPROVE_LOGON_NO,
                                                   dt.REASON_NO, dt.REAMRKS, dt.OFFLINE_EXP_NO, dt.OFFLINE_EXP_DET_NO, dt.LAT_VAL, dt.LON_VAL, temp_sess_det.vendor,
                                                   temp_sess_det.comments);
                     }
                     else
                     {
                         db.TRN_EXPENSE_DET_INSERT(decimal.Parse(Session["sess_USER_NO"].ToString()),
                                                   decimal.Parse(Session["sess_LOGON_NO"].ToString()),
                                                   DateTime.Now, null, 1, trn_expense.EXP_NO, temp_sess_det.exp_type, temp_sess_det.amount,
                                                   null, null, null, null, temp_sess_det.vendor, temp_sess_det.comments);
                     }
                 }
                 else
                 {
                     TRN_EXPENSE_DET dt = db.TRN_EXPENSE_DET.Where(s => s.EXP_DET_NO == temp_sess_det.editID).FirstOrDefault();
                     db.TRN_EXPENSE_DET_DELETE(dt.EXP_DET_NO, decimal.Parse(Session["sess_USER_NO"].ToString()),
                                               decimal.Parse(Session["sess_LOGON_NO"].ToString()));
                 }
             }
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.APPROVE_TYPE_NO = new SelectList(db.GEN_APPROVE_TYPE, "APPROVE_TYPE_NO", "APPROVE_TYPE", trn_expense.APPROVE_TYPE_NO);
     ViewBag.USER_NO         = new SelectList(db.SEC_USERS, "USER_NO", "LAST_ACTION", trn_expense.USER_NO);
     ViewBag.FY_NO           = new SelectList(db.SET_FISCAL_YEAR, "FY_NO", "LAST_ACTION", trn_expense.FY_NO);
     ViewBag.REASON_NO       = new SelectList(db.SET_REASON, "REASON_NO", "LAST_ACTION", trn_expense.REASON_NO);
     return(View(trn_expense));
 }