//[Authorize(Roles = "Admin,Client,Employee")] public ActionResult Index(string Status, string Id, string InvoiceTo, string InvoiceNumber, bool data = false, string UserAction = "Add") { ViewBag.Result = "Failed"; if (data == true) { ViewBag.Result = "Succeeded"; } string UserId = User.Identity.GetUserId(); var UserDetail = generic.GetUserDetail(User.Identity.GetUserId()); ViewData["UserProfile"] = generic.GetUserDetail(UserId); ViewData["EmpDetails"] = emsMgr.GetEmployeeBasicDetails(UserId).FirstOrDefault(); ViewData["CompanyLogo"] = cmsMgr.GetCompanyLogo(UserDetail.SubscriberId).FirstOrDefault(); var plandetail = admin.GetUserplanDetails(UserDetail.SubscriberId).Where(c => c.AddOnId == 3).FirstOrDefault(); ViewData["plandetail"] = plandetail; ViewData["JOItems"] = cmsMgr.GetJobOrderItems(Id).AsEnumerable(); ViewData["ItemType"] = (from i in db.ItemTypeMasters.Where(i => i.CorporateId == UserDetail.SubscriberId) select i).AsEnumerable(); ViewData["InvItems"] = cmsMgr.GetInvoiceItems(InvoiceNumber).AsEnumerable(); ViewData["InvTaxs"] = admin.GetInvoiceTaxes(InvoiceNumber).AsEnumerable(); ViewData["TaxType"] = admin.GetTaxMaster().AsEnumerable(); ViewData["ItemDuration"] = Global.GetDuration(); ViewBag.UserAction = UserAction; if (UserAction == "Edit") { var Invoice = admin.GetInvoiceDetails(UserId, InvoiceNumber); ViewBag.InvoiceDate = Invoice.InvoiceDate; ViewBag.Currency = Invoice.Currency; ViewBag.InvoiceNumber = InvoiceNumber; ViewBag.InvoiceTo = Invoice.InvoiceTo; ViewBag.ReferenceId = Invoice.ReferenceId; ViewBag.NetAmount = Invoice.NetAmount; ViewBag.AdditionalCost = Invoice.AdditionalCost; ViewBag.Deductions = Invoice.Deductions; ViewData["Content"] = (from i in db.InVoiceAttachment.Where(i => i.ReferenceId == Invoice.ReferenceId) select i).FirstOrDefault(); PopulateCurrency(Invoice.Currency); return(View(Invoice)); } else { ViewBag.InvoiceTo = InvoiceTo; ViewBag.ReferenceId = Id; ViewBag.InvoiceDate = DateTime.Now.Date; ViewBag.AdditionalCost = 0; ViewBag.Deductions = 0; PopulateCurrency(); } return(View()); }