public ActionResult StatusUpdate(int Id) { FillCustomer(); FillCurrency(); FillCommissionAgent(); FillWrkDesc(); FillVehicle(); FillUnit(); FillQuerySheet(); FillEmployee(); FillSalesQuotationStatus(); var repo = new SalesQuotationRepository(); var sorepo = new SaleOrderRepository(); SalesQuotation salesquotation = repo.GetSalesQuotation(Id); salesquotation.CustomerAddress = sorepo.GetCusomerAddressByKey(salesquotation.CustomerId); salesquotation.SalesQuotationItems = repo.GetSalesQuotationItems(Id); ViewBag.SubmitAction = "StatusUpdate"; return(View("StatusUpdate", salesquotation)); }
public ActionResult Cancel(int Id) { SalesQuotationRepository repo = new SalesQuotationRepository(); int CancelStatus = repo.GetUserApprovalCancelStatus(UserID); int result = new SalesQuotationRepository().Cancel(Id, CancelStatus); if (result == 1) { TempData["success"] = "Cancelled Successfully!"; return(RedirectToAction("Index")); } else { if (result == 0) { TempData["error"] = "Sorry!! You don't have Permission to Delete this Quotation"; TempData["QuotationRefNo"] = null; } else { TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["QuotationRefNo"] = null; } return(RedirectToAction("Index")); } }
public ActionResult Edit(SalesQuotation model) { ViewBag.Title = "Edit"; model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); var repo = new SalesQuotationRepository(); try { if (model.isProjectBased) { new SalesQuotationRepository().UpdateProjectSalesQuotation(model); } else { new SalesQuotationRepository().UpdateSalesQuotation(model); } TempData["success"] = "Updated Successfully (" + model.QuotationRefNo + ")"; return(RedirectToAction("PreviousList", new { ProjectBased = Convert.ToInt32(model.isProjectBased), AfterSales = Convert.ToInt32(model.isAfterSales) })); } catch (Exception) { TempData["error"] = "Some error occurred. Please try again."; } return(RedirectToAction("PreviousList", new { ProjectBased = Convert.ToInt32(model.isProjectBased), AfterSales = Convert.ToInt32(model.isAfterSales) })); }
public ActionResult CreateAfterSalesProject(SalesQuotation model) { model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); SalesQuotation result = new SalesQuotationRepository().InsertSalesQuotation(model); if (result.SalesQuotationId > 0) { TempData["Success"] = "Added Successfully!"; TempData["QuotationRefNo"] = result.QuotationRefNo; return(RedirectToAction("CreateAfterSalesProject")); } else { TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["SaleOrderRefNo"] = null; DropDowns(); FillWrkDescAfterSales(); FillVehicle(); FillQuerySheet(); FillUnit(); ItemDropdown(); return(View("Create", model)); } }
public ActionResult GetRoomDetailsFromQuerySheet(int querySheetId) { FillUnitDoorUnit(); SalesQuotation model = new SalesQuotationRepository().GetRoomDetailsFromQuerySheet(querySheetId); return(PartialView("_ProjectRooms", model)); }
public void FillSalesQuotationStatus() { var repo = new SalesQuotationRepository(); var list = repo.FillSalesQuotationStatus(); ViewBag.SalesQuotationStatuslist = new SelectList(list, "Id", "Name"); }
public ActionResult Approve(SalesQuotation model) { var repo = new SalesQuotationRepository(); model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); //repo.ApproveSalesQuotation(model); //if (model.isProjectBased == 0) //{ // TempData["Success"] = "Approved Successfully!"; // TempData["QuotationRefNo"] = model.QuotationRefNo; // return RedirectToAction("ListSalesQuotations", new { ProjectBased = 0 }); //} try { new SalesQuotationRepository().ApproveSalesQuotation(model); TempData["Success"] = "Approved Successfully (" + model.QuotationRefNo + ")"; return(RedirectToAction("ListSalesQuotations", new { ProjectBased = Convert.ToInt32(model.isProjectBased), AfterSales = Convert.ToInt32(model.isAfterSales) })); } catch (Exception) { TempData["error"] = "Some error occurred. Please try again."; } return(RedirectToAction("ListSalesQuotations", new { ProjectBased = Convert.ToInt32(model.isProjectBased), AfterSales = Convert.ToInt32(model.isAfterSales) })); }
public ActionResult Approve(int SalesQuotationId) { DropDowns(); FillVehicle(); FillQuerySheetInQuot(); FillUnit(); FillRateSettings(); ItemDropdown(); FillUnitDoorUnit(); var repo = new SalesQuotationRepository(); var sorepo = new SaleOrderRepository(); SalesQuotation salesquotation = repo.GetSalesQuotation(SalesQuotationId); //salesquotation.SalesQuotationItems[0].UnitName = "Nos"; if (!salesquotation.isProjectBased && !salesquotation.isAfterSales) { FillWrkDesc(); } else if (salesquotation.isProjectBased && !salesquotation.isAfterSales) { FillWrkDescForProject(); } else if (salesquotation.isAfterSales) { FillWrkDescAfterSales(); if (salesquotation.isProjectBased) { salesquotation.ProjectCompleionDetails = new ProjectCompletionRepository().GetProjectCompletion(salesquotation.ProjectCompletionId); } else { salesquotation.DeliveryChallanDetails = new DeliveryChallanRepository().GetDeliveryChallan(salesquotation.DeliveryChallanId); } } salesquotation.CustomerAddress = sorepo.GetCusomerAddressByKey(salesquotation.CustomerId); salesquotation.SalesQuotationItems = repo.GetSalesQuotationItems(SalesQuotationId); salesquotation.Materials = repo.GetSalesQuotationMaterials(SalesQuotationId); //salesquotation.VehicleModelId = salesquotation.SalesQuotationItems[0].VehicleModelId; //FillUnitDoorUnit(); //salesquotation.ProjectRooms = new SaleOrderRepository().GetRoomDetailsFromQuotation(SalesQuotationId); ViewBag.SubmitAction = "Approve"; if (salesquotation.isProjectBased) { return(View("Create", salesquotation)); } else { salesquotation.VehicleModelId = salesquotation.SalesQuotationItems[0].VehicleModelId; } return(View("CreateTransportation", salesquotation)); }
public ActionResult ListSalesQuotations(int ProjectBased, int AfterSales) { //QuotationApprovalRepository appRepo = new QuotationApprovalRepository(); //QuotationApprovalAmountSettings amt = appRepo.GetUserApprovalAmountSettings(UserID); //ViewBag.AmountFrom = amt.AmountFrom; //ViewBag.AmountTo = amt.AmountTo; var repo = new SalesQuotationRepository(); List <SalesQuotation> salesquotations = repo.GetSalesQuotationApproveList(ProjectBased, AfterSales, OrganizationId); return(View(salesquotations)); }
//else if (model.isProjectBased == 1) //{ // TempData["Success"] = "Approved Successfully!"; // TempData["QuotationRefNo"] = model.QuotationRefNo; // return RedirectToAction("ListSalesQuotations", new { ProjectBased = 1 }); //} //else if (model.isProjectBased == 2) //{ // TempData["Success"] = "Approved Successfully!"; // TempData["QuotationRefNo"] = model.QuotationRefNo; // return RedirectToAction("ListSalesQuotations", new { ProjectBased = 2 }); //} //else //{ // return View(); //} //} #region Revise Quotation public ActionResult Revise(int Id) { DropDowns(); var repo = new SalesQuotationRepository(); var sorepo = new SaleOrderRepository(); SalesQuotation salesquotation = repo.GetSalesQuotation(Id); if (salesquotation.isAfterSales) { FillWrkDescAfterSales(); ItemDropdown(); } else if (salesquotation.isProjectBased) { FillWrkDescForProject(); ItemDropdown(); } else { FillWrkDesc(); } salesquotation.CustomerAddress = sorepo.GetCusomerAddressByKey(salesquotation.CustomerId); salesquotation.ParentId = salesquotation.SalesQuotationId; salesquotation.IsQuotationApproved = false; if (salesquotation.GrantParentId == null || salesquotation.GrantParentId == 0) { salesquotation.GrantParentId = salesquotation.ParentId; } salesquotation.SalesQuotationItems = repo.GetSalesQuotationItems(Id); try { //each workdescription will have the same vehicle model id salesquotation.VehicleModelId = salesquotation.SalesQuotationItems[0].VehicleModelId; } catch { } salesquotation.Materials = repo.GetSalesQuotationMaterials(Id); if (salesquotation.Materials == null || salesquotation.Materials.Count == 0) { salesquotation.Materials.Add(new SalesQuotationMaterial()); } ViewBag.SubmitAction = "Revise"; return(View(salesquotation)); }
public ActionResult DeleteSQ(string isProjectBased, string isAfterSales, int id = 0) { try { if (id == 0) { return(RedirectToAction("Index", "Home")); } string ref_no = new SalesQuotationRepository().DeleteSalesQuotation(id, isAfterSales); TempData["success"] = "Deleted Successfully (" + ref_no + ")"; return(RedirectToAction("PreviousList", new { ProjectBased = Convert.ToInt32(bool.Parse(isProjectBased)), AfterSales = Convert.ToInt32(bool.Parse(isAfterSales)) })); } catch (Exception) { TempData["error"] = "Some error occured while deleting. Please try again."; return(RedirectToAction("Edit", new { id = id })); } }
public ActionResult Revise(SalesQuotation model) { bool isProjectBased = model.isProjectBased; if (!ModelState.IsValid) { //To Debug Errors var errors = ModelState .Where(x => x.Value.Errors.Count > 0) .Select(x => new { x.Key, x.Value.Errors }) .ToArray(); //End FillCustomer(); FillCurrency(); FillCommissionAgent(); FillWrkDesc(); FillQuerySheet(); FillVehicle(); FillUnit(); FillEmployee(); FillSalesQuotationStatus(); return(View(model)); } else { model.CreatedBy = UserID.ToString(); model.CreatedDate = DateTime.Today; model.OrganizationId = OrganizationId; SalesQuotation result = new SalesQuotationRepository().ReviseSalesQuotation(model); TempData["success"] = "Quotation revised succcessfully. Reference No. is " + model.QuotationRefNo; if (!isProjectBased) { return(RedirectToAction("Index")); } else { return(RedirectToAction("ProjectIndex")); } } }
public ActionResult CreateAfterSalesTrans(SalesQuotation model) { if (!ModelState.IsValid) { var allErrors = ModelState.Values.SelectMany(v => v.Errors); DropDowns(); FillWrkDescAfterSales(); FillVehicle(); FillUnit(); FillRateSettings(); return(View(model)); } model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); SalesQuotation result = new SalesQuotationRepository().InsertSalesQuotation(model); if (result.SalesQuotationId > 0) { TempData["Success"] = "Added Successfully!"; TempData["QuotationRefNo"] = result.QuotationRefNo; return(RedirectToAction("CreateAfterSalesTrans")); } else { TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["SaleOrderRefNo"] = null; DropDowns(); FillWrkDescAfterSales(); FillVehicle(); FillUnit(); return(View("CreateAfterSalesTrans", model)); } }
public ActionResult CreateProject(SalesQuotation model) { model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); SalesQuotation result = new SalesQuotationRepository().InsertProjectQuotation(model); if (result.SalesQuotationId > 0) { TempData["Success"] = "Saved Successfully. Reference No. is " + model.QuotationRefNo; return(RedirectToAction("CreateProject")); } else { TempData["error"] = "Some error occurred. Please try again."; DropDowns(); FillWrkDescForProject(); FillVehicle(); FillQuerySheet(); FillUnit(); return(View("Create", model)); } }
public ActionResult PrintBussinessReport(string MonthName, int?Month, string YearName, int?Year) { ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Reports"), "BussinessReport.rpt")); DataSet ds = new DataSet(); ds.Tables.Add("Head"); ds.Tables.Add("Items"); //-------HEAD ds.Tables["Head"].Columns.Add("Month"); ds.Tables["Head"].Columns.Add("Year"); ds.Tables["Head"].Columns.Add("OrganizationName"); ds.Tables["Head"].Columns.Add("Image1"); //-------DT ds.Tables["Items"].Columns.Add("QuotRef"); ds.Tables["Items"].Columns.Add("Date"); ds.Tables["Items"].Columns.Add("Customer"); ds.Tables["Items"].Columns.Add("Lead"); ds.Tables["Items"].Columns.Add("Descr"); ds.Tables["Items"].Columns.Add("Status"); ds.Tables["Items"].Columns.Add("GrandTot"); ds.Tables["Items"].Columns.Add("RevisionNo"); ds.Tables["Items"].Columns.Add("Reason"); OrganizationRepository repo = new OrganizationRepository(); var Head = repo.GetOrganization(OrganizationId); DataRow dr = ds.Tables["Head"].NewRow(); dr["Month"] = MonthName; dr["Year"] = YearName; dr["OrganizationName"] = Head.OrganizationName; dr["Image1"] = Server.MapPath("~/App_images/") + Head.Image1; ds.Tables["Head"].Rows.Add(dr); SalesQuotationRepository repo1 = new SalesQuotationRepository(); var Items = repo1.GetSalesQuotaationListPrint(Month ?? DateTime.Today.Month, Year ?? DateTime.Today.Year); foreach (var item in Items) { var pritem = new SalesQuotationList { QuotationRefNo = item.QuotationRefNo, QuotationDate = item.QuotationDate, CustomerName = item.CustomerName, EmployeeName = item.EmployeeName, GrandTotal = item.GrandTotal, RevisionNo = item.RevisionNo, RevisionReason = item.RevisionReason, Status = item.Status, Description = item.Description }; DataRow dri = ds.Tables["Items"].NewRow(); dri["QuotRef"] = item.QuotationRefNo; dri["Date"] = item.QuotationDate.ToString("dd/MMM/yyyy"); dri["Customer"] = item.CustomerName; dri["Lead"] = item.EmployeeName; dri["Descr"] = item.Description; dri["Status"] = item.Status; dri["GrandTot"] = item.GrandTotal; dri["RevisionNo"] = item.RevisionNo; dri["Reason"] = item.RevisionReason; ds.Tables["Items"].Rows.Add(dri); } ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "BussinessReport.xml"), XmlWriteMode.WriteSchema); rd.SetDataSource(ds); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", String.Format("BussinessReport.pdf"))); } catch (Exception ex) { throw; } }
public ActionResult Edit(int id = 0) { if (id == 0) { return(RedirectToAction("Index", "Home")); } DropDowns(); ItemDropdown(); FillVehicle(); //FillQuerySheetInQuot(); FillUnit(); FillRateSettings(); FillUnitDoorUnit(); var repo = new SalesQuotationRepository(); var sorepo = new SaleOrderRepository(); SalesQuotation salesquotation = repo.GetSalesQuotation(id); if (!salesquotation.isProjectBased && !salesquotation.isAfterSales) { FillWrkDesc(); } else if (salesquotation.isProjectBased && !salesquotation.isAfterSales) { FillWrkDescForProject(); } else if (salesquotation.isAfterSales) { FillWrkDescAfterSales(); if (salesquotation.isProjectBased) { salesquotation.ProjectCompleionDetails = new ProjectCompletionRepository().GetProjectCompletion(salesquotation.ProjectCompletionId); } else { salesquotation.DeliveryChallanDetails = new DeliveryChallanRepository().GetDeliveryChallan(salesquotation.DeliveryChallanId); } } salesquotation.CustomerAddress = sorepo.GetCusomerAddressByKey(salesquotation.CustomerId); salesquotation.SalesQuotationItems = repo.GetSalesQuotationItems(id); try { //each workdescription will have the same vehicle model id salesquotation.VehicleModelId = salesquotation.SalesQuotationItems[0].VehicleModelId; } catch { } salesquotation.Materials = repo.GetSalesQuotationMaterials(id); #region getting quotation room, unit and door details if (salesquotation.isProjectBased) { salesquotation.ProjectRooms = new SaleOrderRepository().GetRoomDetailsFromQuotation(id); } #endregion if (salesquotation.Materials == null || salesquotation.Materials.Count == 0) { salesquotation.Materials.Add(new SalesQuotationMaterial()); } if (!salesquotation.isProjectBased) { return(View("EditTransportation", salesquotation)); } FillQuerySheetIncludingCurrent(salesquotation.QuerySheetId, OrganizationId); return(View("Edit", salesquotation)); }
public ActionResult Print(int Id) { ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Reports"), "SalesQuotation.rpt")); DataSet ds = new DataSet(); ds.Tables.Add("Head"); ds.Tables.Add("Items"); //-------HEAD ds.Tables["Head"].Columns.Add("QuotationRefNo"); ds.Tables["Head"].Columns.Add("QuotationDate"); ds.Tables["Head"].Columns.Add("CustomerName"); ds.Tables["Head"].Columns.Add("CustomerAddress"); ds.Tables["Head"].Columns.Add("ContactPerson"); ds.Tables["Head"].Columns.Add("SalesExecutive"); ds.Tables["Head"].Columns.Add("PredictedClosingDate"); ds.Tables["Head"].Columns.Add("QuotationValidToDate"); ds.Tables["Head"].Columns.Add("ExpectedDeliveryDate"); ds.Tables["Head"].Columns.Add("Remarks"); ds.Tables["Head"].Columns.Add("PaymentTerms"); ds.Tables["Head"].Columns.Add("SalesQuotationStatusName"); ds.Tables["Head"].Columns.Add("QuotationStage"); ds.Tables["Head"].Columns.Add("Competitors"); ds.Tables["Head"].Columns.Add("DiscountRemarks"); ds.Tables["Head"].Columns.Add("Discount"); ds.Tables["Head"].Columns.Add("DoorNo"); ds.Tables["Head"].Columns.Add("Street"); ds.Tables["Head"].Columns.Add("State"); ds.Tables["Head"].Columns.Add("CountryName"); ds.Tables["Head"].Columns.Add("Zip"); ds.Tables["Head"].Columns.Add("Fax"); ds.Tables["Head"].Columns.Add("Email"); ds.Tables["Head"].Columns.Add("Phone"); ds.Tables["Head"].Columns.Add("CurrencyName"); ds.Tables["Head"].Columns.Add("OrganizationName"); ds.Tables["Head"].Columns.Add("Designation"); ds.Tables["Head"].Columns.Add("Image1"); ds.Tables["Head"].Columns.Add("UserName"); // ds.Tables["Head"].Columns.Add("EmpDesignation"); ds.Tables["Head"].Columns.Add("Sign"); //-------DT ds.Tables["Items"].Columns.Add("WorkDescr"); ds.Tables["Items"].Columns.Add("Quantity"); ds.Tables["Items"].Columns.Add("Rate"); ds.Tables["Items"].Columns.Add("UOM"); ds.Tables["Items"].Columns.Add("Discount"); ds.Tables["Items"].Columns.Add("Amount"); ds.Tables["Items"].Columns.Add("TotalAmount"); ds.Tables["Items"].Columns.Add("WorkDescription"); SalesQuotationRepository repo = new SalesQuotationRepository(); var Head = repo.GetSalesQuotationHD(Id, OrganizationId); DataRow dr = ds.Tables["Head"].NewRow(); dr["QuotationRefNo"] = Head.QuotationRefNo; dr["QuotationDate"] = Head.QuotationDate.ToString("dd-MMM-yyyy"); dr["CustomerName"] = Head.CustomerName; dr["CustomerAddress"] = Head.CustomerAddress; dr["ContactPerson"] = Head.ContactPerson; dr["SalesExecutive"] = Head.SalesExecutiveName; dr["PredictedClosingDate"] = Head.PredictedClosingDate; dr["QuotationValidToDate"] = Head.QuotationValidToDate.ToString("dd-MMM-yyyy"); dr["ExpectedDeliveryDate"] = Head.ExpectedDeliveryDate; dr["Remarks"] = Head.Remarks; dr["PaymentTerms"] = Head.PaymentTerms; dr["SalesQuotationStatusName"] = Head.SalesQuotationStatusName; dr["QuotationStage"] = Head.QuotationStage; dr["Competitors"] = Head.Competitors; dr["DiscountRemarks"] = Head.DiscountRemarks; dr["Discount"] = Head.Discount; dr["DoorNo"] = Head.DoorNo; dr["Street"] = Head.Street; dr["State"] = Head.State; dr["CountryName"] = Head.CountryName; dr["Zip"] = Head.Zip; dr["Fax"] = Head.Fax; dr["Email"] = Head.Email; dr["Phone"] = Head.Phone; dr["CurrencyName"] = Head.CurrencyName; dr["OrganizationName"] = Head.OrganizationName; dr["Designation"] = Head.DesignationName; dr["Image1"] = Server.MapPath("~/App_images/") + Head.Image1; dr["UserName"] = Head.EmpNmae; //dr["EmpDesignation"] = Head.EmpDesignation; dr["Sign"] = Server.MapPath("~/App_images/") + Head.ApprovedUsersig; ds.Tables["Head"].Rows.Add(dr); SalesQuotationRepository repo1 = new SalesQuotationRepository(); var Items = repo1.GetSalesQuotationItemsPrint(Id); foreach (var item in Items) { var pritem = new SalesQuotationItem { WorkDescr = item.WorkDescr, Quantity = item.Quantity, Rate = item.Rate, UnitName = item.UnitName, Discount = item.Discount, Amount = item.Amount, WorkDescription = item.WorkDescription, TotalAmount = item.TotalAmount }; DataRow dri = ds.Tables["Items"].NewRow(); dri["WorkDescr"] = pritem.WorkDescr; dri["Quantity"] = pritem.Quantity; dri["Rate"] = pritem.Rate; dri["Discount"] = pritem.Discount; dri["Amount"] = pritem.Amount; dri["UOM"] = pritem.UnitName; dri["WorkDescription"] = pritem.WorkDescription; dri["TotalAmount"] = pritem.TotalAmount; ds.Tables["Items"].Rows.Add(dri); } ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "SalesQuotation.xml"), XmlWriteMode.WriteSchema); rd.SetDataSource(ds); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/ms-word", String.Format("SalesQuotation{0}.doc", Id.ToString()))); } catch (Exception ex) { throw; } }
public ActionResult LoadQuickView() { if (Session["user"] == null) { return(RedirectToAction("LogOff", "Account")); } QuickView view = new QuickView(); view.PendingDirectPurchaseRequests = true; view.PendingTransQuotations = true; view.PendingProjectQuotations = true; view.PendingSupplyOrders = true; view.PendingWorkshopRequests = true; view.PendingProjectSaleOrdersForJobCard = true; view.PendingTransSaleOrdersForJobCard = true; view.MaterialStockBelowMinLevel = true; view.PendingVechicleInpass = true; view.PendingWRForStoreIssue = true; view.PendingJobcardQC = true; view.PendingMaterialReqPRS = true; if (view.PendingProjectQuotations) { SalesQuotationRepository repo = new SalesQuotationRepository(); var res = repo.GetSalesQuotationApproveList(1, 0, OrganizationId); view.NoOfProjectQuotations = res.Count; } if (view.PendingTransQuotations) { SalesQuotationRepository repo = new SalesQuotationRepository(); var res = repo.GetSalesQuotationApproveList(0, 0, OrganizationId); view.NoOfTransQuotations = res.Count; } if (view.PendingSupplyOrders) { var repo = new GRNRepository(); var res = repo.GetGRNPendingList(0); view.NoOfSupplyOrders = res.Count(); } if (view.PendingDirectPurchaseRequests) { var res = new DirectPurchaseRepository().GetUnApprovedRequests(UserID); view.NoOfPurchaseRequests = res.Count; } if (view.PendingWorkshopRequests) { var rep = new SaleOrderRepository(); var slist = rep.GetSaleOrdersPendingWorkshopRequest(OrganizationId, 0); view.NoOfWorkShopRequests = slist.Count; } if (view.PendingProjectSaleOrdersForJobCard) { var list = new JobCardRepository().GetPendingSO(1, OrganizationId, 0); view.NoOfProjectSaleOrdersForJobCard = list.Count(); } if (view.PendingTransSaleOrdersForJobCard) { var list = new JobCardRepository().GetPendingSO(0, OrganizationId, 0); view.NoOfTransSaleOrdersForJobCard = list.Count(); } if (view.MaterialStockBelowMinLevel) { var list = new ItemRepository().GetCriticalMaterialsBelowMinStock(OrganizationId); view.NoOfMaterialStockBelowMinLevel = list.Count(); //view.NoOfMaterialStockBelowMinLevel = new ItemRepository().GetCriticalMaterialsBelowMinStock(OrganizationId); } if (view.PendingVechicleInpass) { var list = new VehicleInPassRepository().PendingVehicleInpassforAlert(OrganizationId); view.NoOfVechicleInpass = list.Count(); } if (view.PendingWRForStoreIssue) { var list = new WorkShopRequestRepository().PendingWorkshopRequests("", "", "", ""); view.NoOfWRForStoreIssue = list.Count(); } if (view.PendingJobcardQC) { var list = new DeliveryChallanRepository().PendingDelivery(OrganizationId); view.NoOfJobcardQC = list.Count(); } if (view.PendingMaterialReqPRS) { var list = new PurchaseRequestRepository().GetWorkShopRequestPending(OrganizationId, 0, "", "all"); view.NoOfPendingMaterialReqPRS = list.Count(); } IEnumerable <ERPAlerts> Alerts; if (Session["alertpermissions"] == null) { UserRepository repo = new UserRepository(); Alerts = repo.GetAlerts(UserID); Session["alertpermissions"] = Alerts; } else { Alerts = (IEnumerable <ERPAlerts>)Session["alertpermissions"]; Session["alertpermissions"] = Alerts; } AlertPermission alertpermission = new AlertPermission(); foreach (var item in Alerts) { if (item.HasPermission == 1) { switch (item.AlertId) { case 1: alertpermission.ProjectQuotApproval = true; break; case 2: alertpermission.TransportQuotApproval = true; break; case 3: alertpermission.PendingSupplyOrdForGrn = true; break; case 4: alertpermission.DirectPurchaseReqDorApproval = true; break; case 5: alertpermission.PendingSOForWorkshopReq = true; break; //case 6: // alertpermission.PendingProjectSaleOrdersForJobCard = true; // break; //case 7: // alertpermission.PendingTransSaleOrdersForJobCard = true; // break; case 6: alertpermission.MaterialStockBelowMinLevel = true; break; case 7: alertpermission.PendingVechicleInpass = true; break; case 8: alertpermission.PendingWRForStoreIssue = true; break; case 9: alertpermission.PendingJobcardQC = true; break; case 10: alertpermission.PendingMaterialReqPRS = true; break; default: break; } } } ViewBag.AlertPermissions = alertpermission; return(PartialView("_QuickView", view)); }