示例#1
0
        //
        // GET: /Budget/
        public ActionResult Index(string p_BudgetId)
        {
            //DALBudgetEntry objDalBudgetEntry = new DALBudgetEntry();

            var lst_BudgetTypes = new DALBudgetType().PopulateData();
            var lst_Years = new DALCalendar().GetAllRecords();
            var lst_Locations = new DALLocation().PopulateData();
            var lst_ChartOfAccounts = new DALChartOfAccount().GetChartOfAccountForDropDown(1,"''");

            ViewData["ddl_BudgetType"] = new SelectList(lst_BudgetTypes, "BgdtType_Id", "BgdtType_Title", "");
            ViewData["ddl_Year"] = new SelectList(lst_Years, "Cldr_Id", "Cldr_Title", "");
            ViewData["ddl_Location"] = new SelectList(lst_Locations, "Loc_Id", "Loc_Title", "");
            ViewData["ddl_Account"] = new SelectList(lst_ChartOfAccounts, "ChrtAcc_Id", "ChrtAcc_Title", "");

            //string ChartOfAccountCodes = "";
            //foreach (SETUP_ChartOfAccount COA in ChartOfAccounts)
            //{
            //    if (ChartOfAccountCodes.Length > 0)
            //    {
            //        ChartOfAccountCodes += "," + COA.ChrtAcc_Id + ":" + COA.ChrtAcc_Title;
            //    }
            //    {
            //        ChartOfAccountCodes += COA.ChrtAcc_Id + ":" + COA.ChrtAcc_Title;
            //    }
            //}
            //ViewData["ChartOfAccountCodesWithTitles"] = ChartOfAccountCodes;
            //SETUP_ChartOfAccount SelectChartOfAccount = new SETUP_ChartOfAccount();
            //SelectChartOfAccount.ChrtAcc_Id = "0";
            //SelectChartOfAccount.ChrtAcc_Code = "";
            //ChartOfAccounts.Insert(0, SelectChartOfAccount);
            //ViewData["ChartOfAccounts"] = ChartOfAccounts;
            //ViewData["ddl_Account"] = new SelectList(ChartOfAccounts, "ChrtAcc_Id", "ChrtAcc_Title", "");
            ////var NarrationList = new DALBudgetTypeNarration().GetAllData().ToList();
            ////string[] nList = new string[NarrationList.Count];
            ////if (NarrationList != null && NarrationList.Count > 0)
            ////{
            ////    for (int index = 0; index < NarrationList.Count; index++)
            ////    {
            ////        nList[index] = NarrationList[index].VchrTypeNarr_Title;
            ////    }
            ////    System.Web.Script.Serialization.JavaScriptSerializer se = new System.Web.Script.Serialization.JavaScriptSerializer();
            ////    ViewData["Narrations"] = se.Serialize(nList);
            ////}
            //ViewData["ddl_Location"] = new SelectList(Locations, "Loc_Id", "Loc_Title", Session["LocationIdForBudgetEntry"]);
            if (!String.IsNullOrEmpty(p_BudgetId))
            {
                EditBudget(p_BudgetId);
            }
            else
            {
                ViewData["BudgetCode"] = "[Auto]";
                ViewData["CurrentDate"] = DateTime.Now.ToString("MM/dd/yyyy");
            }

            //Session.Remove("BudgetTypeForBudgetEntry");
            //Session.Remove("LocationIdForBudgetEntry");
            return View("Budget");
        }
示例#2
0
        public ActionResult Index(string p_BudgetId)
        {
            string ls_Nature = "'Expense', 'Assets'";
            var lst_BudgetTypes = new DALBudgetType().PopulateData();
            var lst_Years = new DALCalendar().GetAllRecords();
            var lst_Locations = new DALLocation().PopulateData();
            var ChartOfAccounts = new DALChartOfAccount().GetChartOfAccountForDropDown(0, ls_Nature);
            string ChartOfAccountCodes = "";

            foreach (SETUP_ChartOfAccount COA in ChartOfAccounts)
            {
                if (ChartOfAccountCodes.Length > 0)
                {
                    ChartOfAccountCodes += "|" + COA.ChrtAcc_Id + ":" + COA.ChrtAcc_Title;
                }
                else
                {
                    ChartOfAccountCodes += COA.ChrtAcc_Id + ":" + COA.ChrtAcc_Title;
                }
            }
            ViewData["ChartOfAccountCodesWithTitles"] = ChartOfAccountCodes;

            SCMS.Models.BudgetMaster modelBudget = new SCMS.Models.BudgetMaster();
            modelBudget.ListBudgetDetail = new List<SCMS.Models.BudgetDetail>();

            if (!string.IsNullOrEmpty(p_BudgetId))
            {
                GL_BgdtMaster budget = new SCMSDataLayer.DALBudgetEntry().GetAllMasterRecords().Where(c => c.BgdtMas_Id.Equals(p_BudgetId)).SingleOrDefault();
                modelBudget.MasterId = budget.BgdtMas_Id;
                modelBudget.Code = budget.BgdtMas_Code;
                modelBudget.Date = Convert.ToDateTime(budget.BgdtMas_Date).ToString("MM/dd/yyyy");
                modelBudget.Status = budget.BgdtMas_Status;
                modelBudget.Remarks = budget.BgdtMas_Remarks;
                modelBudget.BudgetType = budget.BgdtType_Id;
                modelBudget.Location = budget.Loc_Id;
                modelBudget.CalendarYear = budget.Cldr_Id;
                List<GL_BgdtDetail> budgetDetailList = new DALBudgetEntry().GetAllDetailRecords().Where(c => c.BgdtMas_Id.Equals(p_BudgetId)).ToList();

                foreach (GL_BgdtDetail dbBudgetDetail in budgetDetailList)
                {
                    SCMS.Models.BudgetDetail budgetDetailRow = new SCMS.Models.BudgetDetail();
                    budgetDetailRow.MasterId = dbBudgetDetail.BgdtMas_Id;
                    budgetDetailRow.DetailId = dbBudgetDetail.BgdtDet_Id;
                    budgetDetailRow.Month1 = dbBudgetDetail.BgdtDet_Month1;
                    budgetDetailRow.Month2 = dbBudgetDetail.BgdtDet_Month2;
                    budgetDetailRow.Month3 = dbBudgetDetail.BgdtDet_Month3;
                    budgetDetailRow.Month4 = dbBudgetDetail.BgdtDet_Month4;
                    budgetDetailRow.Month5 = dbBudgetDetail.BgdtDet_Month5;
                    budgetDetailRow.Month6 = dbBudgetDetail.BgdtDet_Month6;
                    budgetDetailRow.Month7 = dbBudgetDetail.BgdtDet_Month7;
                    budgetDetailRow.Month8 = dbBudgetDetail.BgdtDet_Month8;
                    budgetDetailRow.Month9 = dbBudgetDetail.BgdtDet_Month9;
                    budgetDetailRow.Month10 = dbBudgetDetail.BgdtDet_Month10;
                    budgetDetailRow.Month11 = dbBudgetDetail.BgdtDet_Month11;
                    budgetDetailRow.Month12 = dbBudgetDetail.BgdtDet_Month12;
                    budgetDetailRow.TotalAmount = dbBudgetDetail.BgdtDet_TotalAmount;
                    budgetDetailRow.Account = dbBudgetDetail.ChrtAcc_Id;

                    modelBudget.ListBudgetDetail.Add(budgetDetailRow);
                }
            }
            else
            {
                modelBudget.Date = DateTime.Now.ToString("MM/dd/yyyy");
                modelBudget.Code = "[Auto]";
                SCMS.Models.BudgetDetail detail = new SCMS.Models.BudgetDetail();
                modelBudget.ListBudgetDetail.Add(detail);
            }

            ViewData["BudgetType"] = new SelectList(lst_BudgetTypes, "BgdtType_Id", "BgdtType_Title", modelBudget.BudgetType);
            ViewData["CalendarYear"] = new SelectList(lst_Years, "Cldr_Id", "Cldr_Title", modelBudget.CalendarYear);
            ViewData["Location"] = new SelectList(lst_Locations, "Loc_Id", "Loc_Title", modelBudget.Location);
            ViewData["ddl_Account"] = ChartOfAccounts;

            return View("Budget", modelBudget);
        }