// // 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"); }
public ActionResult Index() { ViewData["ddl_location"] = new SelectList(new DALLocation().PopulateData(), "Loc_Id", "Loc_Title", ""); ViewData["ddl_Bank"] = new SelectList(new DALBank().PopulateData(), "Bank_Id", "Bank_Title", ""); var ChartOfAccounts = new DALChartOfAccount().GetChartOfAccountForDropDown(1, "''"); SETUP_ChartOfAccount SelectChartOfAccount = new SETUP_ChartOfAccount(); SelectChartOfAccount.ChrtAcc_Id = "0"; SelectChartOfAccount.ChrtAcc_Title = ""; ChartOfAccounts.Insert(0, SelectChartOfAccount); ViewData["ddl_AccountCode"] = new SelectList(ChartOfAccounts, "ChrtAcc_Id", "ChrtAcc_Title", ""); return View("BankAccount"); }
public ActionResult SaveRecord(string ps_OldCode, string ps_NewCode) { DALChartOfAccount objDalChartOfAccount = new DALChartOfAccount(); Int32 li_ReturnValue = 0; try { li_ReturnValue = objDalChartOfAccount.ReplaceOldCode_WithNewCode(ps_OldCode, ps_NewCode); ViewData["SaveResult"] = li_ReturnValue; return PartialView("GridData"); } catch { return PartialView("GridData"); } }
public string SaveRecord(IEnumerable<string> dataString) { String[] Row = dataString.Last().Split('║'); string ps_Id = Row[0]; string ps_Code = Row[1]; string ps_Title = Row[2]; int pi_Level = Row[3] != null ? Convert.ToInt32(Row[3]) : 0; int pi_BudgetLevel = Row[4] != null ? Convert.ToInt32(Row[4]) : 0; int pi_Active = Row[5] != null ? Convert.ToInt32(Row[5]) : 0; int pi_Type = Row[6] != null ? Convert.ToInt32(Row[6]) : 0; string ps_Nature = Row[7]; string ps_AccountNature = Row[8]; string ps_CodeBeforeEdit = Row[9]; string ps_TitleBeforeEdit = Row[10]; SETUP_ChartOfAccount lrow_ChartOfAccount = new SETUP_ChartOfAccount(); String ls_Action = "Edit", IsAuditTrail = "", ls_UserId = ""; String[] ls_Lable = new String[6], ls_Data = new String[6]; Int32 li_ReturnValue = 0; try { if (String.IsNullOrEmpty(ps_Id)) { if (DALCommon.AutoCodeGeneration("SETUP_ChartOfAccount") == 1) { ps_Id = DALCommon.GetMaximumCode("SETUP_ChartOfAccount"); ls_Action = "Add"; } } if (!String.IsNullOrEmpty(ps_Id)) { lrow_ChartOfAccount.ChrtAcc_Id = ps_Id; lrow_ChartOfAccount.ChrtAcc_Code = ps_Code.Replace("-", "").Replace("_", ""); string[] AccCodeArr = ps_Code.Replace("_", "").Split('-'); string AccountCodeForDisplay = ""; foreach (string code in AccCodeArr) { AccountCodeForDisplay += (!string.IsNullOrEmpty(AccountCodeForDisplay) ? (!string.IsNullOrEmpty(code) ? "-" + code : code) : code); } lrow_ChartOfAccount.ChrtAcc_CodeDisplay = AccountCodeForDisplay.Trim(); lrow_ChartOfAccount.ChrtAcc_Title = ps_Title; lrow_ChartOfAccount.ChrtAcc_Level = pi_Level; lrow_ChartOfAccount.ChrtAcc_BudgetLevel = pi_BudgetLevel; lrow_ChartOfAccount.ChrtAcc_Type = pi_Type; lrow_ChartOfAccount.Natr_Id = ps_Nature; lrow_ChartOfAccount.ChrtAcc_Active = 1; var ChartOfAccountCode = objDalChartOfAccount.GetAllRecords().Where(c => c.ChrtAcc_Code.Equals(lrow_ChartOfAccount.ChrtAcc_Code) && c.ChrtAcc_Id != lrow_ChartOfAccount.ChrtAcc_Id ).ToList(); var ChartOfAccountTitle = objDalChartOfAccount.GetAllRecords().Where(c => c.ChrtAcc_Title.Trim().ToLower().Equals(lrow_ChartOfAccount.ChrtAcc_Title.Trim().ToLower()) && c.ChrtAcc_Id != lrow_ChartOfAccount.ChrtAcc_Id ).ToList(); if ((ls_Action == "Add" || ls_Action == "Edit" ) && ( ChartOfAccountCode != null && ChartOfAccountCode.Count > 0)) { ViewData["SaveResult"] = -1; } //else if (ls_Action == "Edit" && ps_Code.Replace("-", "").Replace("_", "") != ps_CodeBeforeEdit.Replace("-", "").Replace("_", "") && ChartOfAccountCode != null && ChartOfAccountCode.Count > 0) //{ // ViewData["SaveResult"] = -1; //} else if ((ls_Action == "Add" || ls_Action == "Edit" ) && (ChartOfAccountTitle != null && ChartOfAccountTitle.Count > 0)) { ViewData["SaveResult"] = -2; } //else if (ls_Action == "Edit" && ps_Title != ps_TitleBeforeEdit && ChartOfAccountTitle != null && ChartOfAccountTitle.Count > 0) //{ // ViewData["SaveResult"] = -2; //} else { li_ReturnValue = objDalChartOfAccount.SaveRecord(lrow_ChartOfAccount); ViewData["SaveResult"] = li_ReturnValue; IsAuditTrail = System.Configuration.ConfigurationManager.AppSettings.GetValues("IsAuditTrail")[0]; // Save Audit Log if (li_ReturnValue > 0 && IsAuditTrail == "1") { DALAuditLog objAuditLog = new DALAuditLog(); ls_UserId = ((SECURITY_User)Session["user"]).User_Id; ls_Lable[0] = "Code"; ls_Lable[1] = "Title"; ls_Lable[2] = "Level"; ls_Lable[3] = "Budget Level"; ls_Lable[4] = "Type"; ls_Lable[5] = "Nature"; ls_Data[0] = AccountCodeForDisplay; ls_Data[1] = ps_Title; ls_Data[2] = pi_Level.ToString(); ls_Data[3] = pi_BudgetLevel.ToString(); ls_Data[4] = pi_Type.ToString(); ls_Data[5] = ps_Nature; objAuditLog.SaveRecord(10, ls_UserId, ls_Action, ls_Lable, ls_Data); } } } string[] rList = new string[1]; rList[0] = ""; rList[0] += "<style type='text/css'>"; rList[0] += "select"; rList[0] += "{"; rList[0] += "background: none;"; rList[0] += "width: auto;"; rList[0] += "padding: 0;"; rList[0] += "margin: 0;"; rList[0] += "border-radius: 0px;"; rList[0] += "}"; rList[0] += "input[type='text']"; rList[0] += "{"; rList[0] += "margin-bottom: 0;"; rList[0] += "}"; rList[0] += "</style>"; rList[0] += "<table id='ChartOfAccountGrid' class='data display datatable'>"; rList[0] += "<thead>"; rList[0] += "<tr>"; rList[0] += "<th style='width: 5%; display: none;'>"; rList[0] += "Sr No."; rList[0] += "</th>"; rList[0] += "<th style='width: 6%;'>"; rList[0] += "Action"; rList[0] += "</th>"; rList[0] += "<th style='width: 20%;'>"; rList[0] += "Code"; rList[0] += "</th>"; rList[0] += "<th style='width: 23%;'>"; rList[0] += "Title"; rList[0] += "</th>"; rList[0] += "<th style='width: 10%;'>"; rList[0] += "Level"; rList[0] += "</th>"; rList[0] += "<th style='width: 12%;'>"; rList[0] += "Budget Level"; rList[0] += "</th>"; rList[0] += "<th style='width: 12%;'>"; rList[0] += "Type"; rList[0] += "</th>"; rList[0] += "<th style='width: 12%;'>"; rList[0] += "Nature"; rList[0] += "</th>"; rList[0] += "</tr>"; rList[0] += "</thead>"; rList[0] += "<tbody>"; var lList_Data = new SCMSDataLayer.DALChartOfAccount().GetAllRecords(); var IList_AccountNature = new SCMSDataLayer.DALAccountNature().GetAllRecords(); var IList_Nature = new SCMSDataLayer.DALNature().GetAllRecords(); if (lList_Data != null && lList_Data.Count > 0) { int count = 0; foreach (SCMSDataLayer.DB.SETUP_ChartOfAccount lRow_Data in lList_Data) { string tempValue = ""; string Title = lRow_Data.ChrtAcc_Title.Replace("'", "'"); for (int index = 0; index < lRow_Data.ChrtAcc_Code.Length; index++) { if (index == 2 || index == 5 || index == 9 || index == 14 || index == 19 || index == 24) { tempValue += "-" + lRow_Data.ChrtAcc_Code[index]; } else { tempValue += lRow_Data.ChrtAcc_Code[index]; } } lRow_Data.ChrtAcc_Code = tempValue; count++; rList[0] += "<tr class='odd' style='line-height: 15px;'>"; rList[0] += "<td style='display: none;'>"; rList[0] += count; rList[0] += "</td>"; rList[0] += "<td>"; rList[0] += " <div onclick=\"javascript:return EditRecord('" + lRow_Data.ChrtAcc_Id + "', '" + lRow_Data.ChrtAcc_Code + "')\" "; rList[0] += " style='width: 22px; padding-right: 5px; float: left; cursor: pointer;'>"; rList[0] += "<img alt='Edit' src='../../img/edit.png' style='width: 22px; vertical-align: middle' />"; rList[0] += "</div>"; rList[0] += "<div onclick=\"javascript:return DeleteRecord('" + lRow_Data.ChrtAcc_Id + "')\" style='width: 22px;"; rList[0] += "float: left; cursor: pointer;'>"; rList[0] += "<img alt='Delete' src='../../img/delete.png' style='width: 22px; vertical-align: middle' />"; rList[0] += "</div>"; rList[0] += "</td>"; rList[0] += "<td id='txt_Code" + lRow_Data.ChrtAcc_Id + "' style='vertical-align: middle;'>"; if (lRow_Data.ChrtAcc_Level == 2) { lRow_Data.ChrtAcc_Code = " " + lRow_Data.ChrtAcc_Code; } else if (lRow_Data.ChrtAcc_Level == 3) { lRow_Data.ChrtAcc_Code = " " + lRow_Data.ChrtAcc_Code; } else if (lRow_Data.ChrtAcc_Level == 4) { lRow_Data.ChrtAcc_Code = " " + lRow_Data.ChrtAcc_Code; } else if (lRow_Data.ChrtAcc_Level == 5) { lRow_Data.ChrtAcc_Code = " " + lRow_Data.ChrtAcc_Code; } else if (lRow_Data.ChrtAcc_Level == 6) { lRow_Data.ChrtAcc_Code = " " + lRow_Data.ChrtAcc_Code; } rList[0] += lRow_Data.ChrtAcc_Code; rList[0] += "</td>"; rList[0] += "<td id='txt_Title" + lRow_Data.ChrtAcc_Id + "' style='vertical-align: middle;'>"; if (lRow_Data.ChrtAcc_Level == 2) { lRow_Data.ChrtAcc_Title = " " + lRow_Data.ChrtAcc_Title; } else if (lRow_Data.ChrtAcc_Level == 3) { lRow_Data.ChrtAcc_Title = " " + lRow_Data.ChrtAcc_Title; } else if (lRow_Data.ChrtAcc_Level == 4) { lRow_Data.ChrtAcc_Title = " " + lRow_Data.ChrtAcc_Title; } else if (lRow_Data.ChrtAcc_Level == 5) { lRow_Data.ChrtAcc_Title = " " + lRow_Data.ChrtAcc_Title; } else if (lRow_Data.ChrtAcc_Level == 6) { lRow_Data.ChrtAcc_Title = " " + lRow_Data.ChrtAcc_Title; } rList[0] += Title; rList[0] += "</td>"; rList[0] += "<td id='txt_AccountLevel" + lRow_Data.ChrtAcc_Id + "' style='vertical-align: middle;'>"; rList[0] += lRow_Data.ChrtAcc_Level; rList[0] += "<input type='hidden' id='ChrtAcc_Level" + lRow_Data.ChrtAcc_Id + "' value='" + lRow_Data.ChrtAcc_Level + "' />"; rList[0] += "</td>"; rList[0] += "<td id='txt_AccountBudgetLevel'" + lRow_Data.ChrtAcc_Id + "' style='vertical-align: middle;'>"; rList[0] += lRow_Data.ChrtAcc_BudgetLevel; rList[0] += "<input type='hidden' id='ChrtAcc_BudgetLevel" + lRow_Data.ChrtAcc_Id + "' value='" + lRow_Data.ChrtAcc_BudgetLevel + "' />"; rList[0] += "</td>"; rList[0] += "<td id='txt_AccountType" + lRow_Data.ChrtAcc_Id + "' style='vertical-align: middle;'>"; if (lRow_Data.ChrtAcc_Type == 1) { rList[0] += "Group"; } else { rList[0] += "Detail"; } rList[0] += "<input type='hidden' id='ChrtAcc_Type" + lRow_Data.ChrtAcc_Id + "' value='" + lRow_Data.ChrtAcc_Type + "' />"; rList[0] += "</td>"; rList[0] += "<td id='txt_NatureId" + lRow_Data.ChrtAcc_Id + "' style='vertical-align: middle;'>"; String Nature = IList_Nature.Where(c => c.Natr_Id.Equals(lRow_Data.Natr_Id)).SingleOrDefault().Natr_Title; if (Nature == "None") { Nature = ""; } rList[0] += Nature; rList[0] += "<input type='hidden' id='Natr_Id" + lRow_Data.ChrtAcc_Id + "' value='" + lRow_Data.Natr_Id + "' />"; rList[0] += "</td>"; rList[0] += "</tr>"; } } rList[0] += "</tbody>"; rList[0] += "</table>"; rList[0] += "<input type='hidden' id='SaveResult' value='" + ViewData["SaveResult"] + "' />"; System.Web.Script.Serialization.JavaScriptSerializer se = new System.Web.Script.Serialization.JavaScriptSerializer(); string result = se.Serialize(rList); return result; } catch { return ""; } }
//public ActionResult BudgetEntry(String BudgetId) //{ // DALBudgetEntry objDalBudgetEntry = new DALBudgetEntry(); // var BudgetTypes = new DALBudgetType().PopulateData(); // //var Locations = new DALLocation().PopulateData(); // //var Budget = new DALBudgetEntry().GetAllMasterRecords(); // ViewData["ddl_BudgetType"] = new SelectList(BudgetTypes, "BgdtType_Id", "BgdtType_Title", ""); // ViewData["ddl_Year"] = new SelectList(BudgetTypes, "BgdtType_Id", "BgdtType_Title", ""); // //var ChartOfAccounts = new DALChartOfAccount().GetChartOfAccountForDropDown(); // //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(BudgetId)) // //{ // // SetBudgetEntryToEdit(BudgetId); // //} // //else // //{ // // ViewData["BudgetCode"] = "[Auto]"; // // ViewData["CurrentDate"] = DateTime.Now.ToString("MM/dd/yyyy"); // //} // //Session.Remove("BudgetTypeForBudgetEntry"); // //Session.Remove("LocationIdForBudgetEntry"); // return View("Budget"); //} public String NewBudgetDetailEntryRow(int RowNo, String AccountCode, String Narration, String Debit, String Credit) { if (AccountCode == null || AccountCode == "undefined") { AccountCode = "0"; } if (Narration == null || Narration == "undefined") { Narration = ""; } if (Debit == null || Debit == "undefined" || Debit == "0.000000") { Debit = ""; } else { Debit = Math.Round(Convert.ToDecimal(Debit), 2).ToString(); } if (Credit == null || Credit == "undefined" || Credit == "0.000000") { Credit = ""; } else { Credit = Math.Round(Convert.ToDecimal(Credit), 2).ToString(); } var ChartOfAccounts = new DALChartOfAccount().GetChartOfAccountForDropDown(1,"''"); String Response = ""; // Response += "<div id='DetailRow" + RowNo.ToString() + "' style='float: left; width: auto;'>"; Response += "<div class='CustomCell' style='width: 250px; height: 30px;'>"; Response += "<select id='ddl_Account" + RowNo.ToString() + "' name='ddl_Account" + RowNo.ToString() + "' style='width:250px;'><option value='0'></option>"; foreach (SETUP_ChartOfAccount row in ChartOfAccounts) { if (row.ChrtAcc_Id == AccountCode) { Response += "<option value='" + row.ChrtAcc_Id + "' selected='selected'>" + row.ChrtAcc_Title + "</option>"; } else { Response += "<option value='" + row.ChrtAcc_Id + "'>" + row.ChrtAcc_Title + "</option>"; } } Response += "</select>"; Response += "</div>"; Response += "<div class='CustomCell' style='width: 565px; height: 30px;'>"; Response += "<input type='text' class='CustomText' style='width: 545px;' id='txt_Details" + RowNo.ToString() + "' name='txt_Details'"; Response += "maxlength='200' value='" + Narration + "' />"; Response += "</div>"; Response += "<div class='CustomCell' style='width: 118px; height: 30px;'>"; Response += "<input type='text' class='CustomText' style='width: 100px;' id='txt_Debit" + RowNo.ToString() + "' name='txt_Debit'"; if (Credit != "") { Response += "maxlength='50' onblur='SetTotals(this.id)' disabled='disabled' />"; } else { Response += "maxlength='50' value='" + Debit + "' onblur='SetTotals(this.id)' />"; } Response += "</div>"; Response += "<div class='CustomCell' style='width: 118px; height: 30px;'>"; Response += "<input type='text' class='CustomText' style='width: 100px;' id='txt_Credit" + RowNo.ToString() + "' name='txt_Credit'"; if (Debit != "") { Response += "maxlength='50' onblur='SetTotals(this.id)' disabled='disabled' />"; } else { Response += "maxlength='50' value='" + Credit + "' onblur='SetTotals(this.id)' />"; } Response += "</div>"; // Response += "</div>"; return Response; }
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); }
public ActionResult VoucherEntry(String VoucherId) { DALVoucherEntry objDalVoucherEntry = new DALVoucherEntry(); var VoucherTypes = new DALVoucherType().GetAllData(); var Locations = new DALLocation().PopulateData(); var Voucher = new DALVoucherEntry().GetAllMasterRecords(); ViewData["ddl_VoucherType"] = new SelectList(VoucherTypes, "VchrType_Id", "VchrType_Title", Session["VoucherTypeForVoucherEntry"]); var ChartOfAccounts = new DALChartOfAccount().GetChartOfAccountForDropDown(1, "''"); 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; 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 DALVoucherTypeNarration().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["LocationIdForVoucherEntry"]); if (!String.IsNullOrEmpty(VoucherId)) { SetVoucherEntryToEdit(VoucherId); } else { ViewData["VoucherCode"] = "[Auto]"; ViewData["CurrentDate"] = DateTime.Now.ToString("MM/dd/yyyy"); } Session.Remove("VoucherTypeForVoucherEntry"); Session.Remove("LocationIdForVoucherEntry"); return View(); }