public ActionResult ServiceOrder(int id = 0)//ServiceEnquiryId is received here { try { if (id == 0) { TempData["error"] = "That was an invalid request. Please try again."; RedirectToAction("Index", "Home"); } FillDropDowns(); ServiceEnquiry model = new SaleOrderRepository().GetServiceEnquiryDetails(id, OrganizationId); model.SaleOrderRefNo = DatabaseCommonRepository.GetNextDocNo(42, OrganizationId); model.SaleOrderDate = DateTime.Today; model.isProjectBased = 1; model.isService = 1; model.IsConfirmed = 1; model.Items = new List <SaleOrderItem>(); model.Items.Add(new SaleOrderItem()); return(View("ServiceEnquiryProject", model)); } catch (InvalidOperationException) { TempData["error"] = "Requested data could not be found. Please try again."; } catch (Exception) { TempData["error"] = "Some error occurred. Please try again."; } return(RedirectToAction("PendingEnquiries", new { isProjectBased = 1 })); }
public ActionResult Save(int id = 0) { if (id != 0) { EmployeeDropdown(); string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(15, OrganizationId); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } return(View(new VehicleInPass { SaleOrderItemId = id, VehicleInPassDate = DateTime.Now, VehicleInPassNo = internalId })); } return(RedirectToAction("Index")); }
public ActionResult Create(IList <PendingPurchaseRequest> PendingPurchaseRequestItemsSelected) { FillDropdowns(); SupplyOrder supplyorder = new SupplyOrder(); supplyorder.SupplyOrderNo = DatabaseCommonRepository.GetNextDocNo(9, OrganizationId); SupplyOrderRepository rep = new SupplyOrderRepository(); if (PendingPurchaseRequestItemsSelected != null) { if (PendingPurchaseRequestItemsSelected.Count > 0) { List <int> selectedpurchaserequests = (from PendingPurchaseRequest p in PendingPurchaseRequestItemsSelected where p.Select select p.PurchaseRequestId).ToList <int>(); supplyorder.SupplyOrderItems = rep.GetPurchaseRequestItems(selectedpurchaserequests, OrganizationId); } } supplyorder.SupplyOrderDate = System.DateTime.Today; supplyorder.RequiredDate = System.DateTime.Today; supplyorder.CurrencyId = new CurrencyRepository().GetCurrencyFrmOrganization(OrganizationId).CurrencyId; return(View(supplyorder)); }
public ActionResult Save(int id = 0) { if (id != 0) { try { EmployeeDropdown(); List <PrintDescription> list = new List <PrintDescription>(); list.Add(new PrintDescription()); DeliveryChallan model = new DeliveryChallanRepository().GetDetailsFromJobCard(id, OrganizationId); if (model == null) { throw new NullReferenceException(); } model.JobCardId = id; model.DeliveryChallanRefNo = DatabaseCommonRepository.GetNextDocNo(18, OrganizationId); model.DeliveryChallanDate = DateTime.Now; model.TransportWarrantyExpiryDate = DateTime.Today.AddYears(1).AddDays(-1); model.ItemBatches = new DeliveryChallanRepository().GetSerialNos(id).ToList(); model.PrintDescriptions = list; return(View(model)); } catch (NullReferenceException) { TempData["error"] = "Could not find the requested Delivery Challan. Please try again."; } catch (Exception) { TempData["error"] = "Some error occurred. Please try again."; } } return(RedirectToAction("Index")); }
public ActionResult Create(int Id, string No, DateTime JcDate, string Customer, string VehicleModel) { try { FillEmployee(); JobCardQC objJCQC = new JobCardQC(); objJCQC = JobCardQCRepo.GetJobCardDetails(Id, OrganizationId); objJCQC.JobCardQCRefNo = DatabaseCommonRepository.GetNextDocNo(17, OrganizationId); objJCQC.CurrentDate = System.DateTime.Today; objJCQC.JobCardQCParams = JobCardQCParamRepo.GetJobCardQCParamList(); return(View(objJCQC)); } catch (Exception ex) { string ErrorMessage = ex.Message.ToString(); if (ex.InnerException != null) { if (ex.InnerException.Message != null) { ErrorMessage = ErrorMessage + ex.InnerException.Message.ToString(); } } ViewData["Error"] = ErrorMessage; return(View("ShowError")); } }
public ActionResult Create() { var internalid = DatabaseCommonRepository.GetNextDocNo(1, OrganizationId); DropDowns(); //FillWrkDesc(); FillVehicle(); FillRateSettings(); SalesQuotation salesquotation = new SalesQuotation(); salesquotation.isProjectBased = false; salesquotation.QuotationDate = System.DateTime.Today; salesquotation.QuotationRefNo = internalid; salesquotation.PredictedClosingDate = System.DateTime.Today; salesquotation.QuotationValidToDate = System.DateTime.Today; salesquotation.ExpectedDeliveryDate = System.DateTime.Today; salesquotation.CurrencyId = new CurrencyRepository().GetCurrencyFrmOrganization(OrganizationId).CurrencyId; salesquotation.SalesQuotationItems = new List <SalesQuotationItem>(); salesquotation.SalesQuotationItems.Add(new SalesQuotationItem()); salesquotation.SalesQuotationItems[0].Quantity = 1; salesquotation.SalesQuotationItems[0].UnitName = "Nos"; salesquotation.Materials = new List <SalesQuotationMaterial>(); salesquotation.Materials.Add(new SalesQuotationMaterial()); ViewBag.SubmitAction = "Save"; return(View("CreateTransportation", salesquotation)); }
public ActionResult CreateQuerySheet(string type) { FillDropdowns(); string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(5, OrganizationId); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } QuerySheet qs = new QuerySheet(); qs.Type = type; qs.QuerySheetDate = DateTime.Now; var repo = new QuerySheetRepository(); qs.QuerySheetItems = new List <QuerySheetItem>(); qs.QuerySheetItems.Add(new QuerySheetItem()); qs.QuerySheetItems[0].ProjectRoomUnits = new List <QuerySheetUnit>(); qs.QuerySheetItems[0].ProjectRoomUnits.Add(new QuerySheetUnit()); qs.QuerySheetItems[0].ProjectRoomDoors = new List <QuerySheetDoor>(); qs.QuerySheetItems[0].ProjectRoomDoors.Add(new QuerySheetDoor()); qs.QuerySheetRefNo = internalId; return(View(qs)); }
public ActionResult Complete(int id = 0) { if (id == 0) { return(RedirectToAction("Index", "Home")); } ProjectCompletion model = new ProjectCompletionRepository().GetProjectDetails(id, OrganizationId); model.SaleOrderId = id; model.ProjectCompletionDate = DateTime.Today; model.ProjectWarrantyExpiryDate = DateTime.Today.AddYears(1).AddDays(-1); model.ProjectCompletionRefNo = DatabaseCommonRepository.GetNextDocNo(30, OrganizationId); model.ItemBatches = new ProjectCompletionRepository().GetSerialNos(id).ToList <ItemBatch>(); return(View(model)); //return View(new ProjectCompletion //{ // SaleOrderId = id, // ProjectCompletionDate = DateTime.Today, // ProjectWarrantyExpiryDate = DateTime.Today.AddYears(1).AddDays(-1), // ProjectCompletionRefNo = DatabaseCommonRepository.GetNextDocNo(30, OrganizationId), // ProjectName = model.ProjectName, // Location = model.Location, // CustomerName = model.CustomerName, // ItemBatches = new ProjectCompletionRepository().GetSerialNos(id).ToList<ItemBatch>() //}); }
public ActionResult Create() { string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(23, OrganizationId); JobCardDropdown(); ItemDropdown(); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } List <ConsumptionItem> Items = new List <ConsumptionItem>(); Items.Add(new ConsumptionItem { SlNo = 1 }); return(View(new Consumption { ConsumptionItems = Items, ConsumptionDate = DateTime.Today, ConsumptionNo = internalId })); }
public ActionResult Create(int?SaleOrderId, int?saleorderitem) { ItemDropdown(); ExceptFGItemDropdown(); WorkShopRequestRepository repo = new WorkShopRequestRepository(); WorkShopRequest model = repo.GetSaleOrderForWorkshopRequest(SaleOrderId ?? 0); model.SaleOrderItemId = saleorderitem ?? 0; model.WorkDescription = repo.GetCombinedWorkDescriptionSaleOrderForWorkshopRequest(SaleOrderId ?? 0).WorkDescription; List <WorkShopRequestItem> WSList = new List <WorkShopRequestItem>(); if (model.isProjectBased == 1) { WSList = repo.GetWorkShopRequestDataForProject(saleorderitem ?? 0); } else { WSList = repo.GetWorkShopRequestData(SaleOrderId ?? 0, saleorderitem ?? 0); } model.Items = new List <WorkShopRequestItem>(); //model.Isused = true; foreach (var item in WSList) { model.Items.Add(new WorkShopRequestItem { PartNo = item.PartNo, ItemName = item.ItemName, Quantity = item.Quantity, UnitName = item.UnitName, ItemId = item.ItemId, ActualQuantity = item.Quantity }); } string internalId = ""; try { if (model.isProjectBased == 0) { internalId = DatabaseCommonRepository.GetNextDocNo(19, OrganizationId); } else { internalId = DatabaseCommonRepository.GetNextDocNo(31, OrganizationId); } } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } model.WorkShopRequestRefNo = internalId; model.WorkShopRequestDate = System.DateTime.Today; model.RequiredDate = System.DateTime.Today; return(View(model)); }
public ActionResult Create() { FillJobCard(); StockPointDropdown(); string internalid = DatabaseCommonRepository.GetNextDocNo(21, OrganizationId); return(View(new StockReturn { StockReturnDate = DateTime.Today, StockReturnRefNo = internalid })); }
public ActionResult Create() { FillDropdowns(); return(View(new StockTransfer { StockTransferDate = DateTime.Today, StockTransferRefNo = DatabaseCommonRepository.GetNextDocNo(29, OrganizationId), Items = TransferItemsGrid() })); }
public ActionResult Create(IList <PendingGRN> PendingGRNSelected) { FillAdditionDeduction(); FillCurrency(); PurchaseBill purchasebill = new PurchaseBill(); PurchaseBillRepository rep = new PurchaseBillRepository(); if (PendingGRNSelected != null) { if (PendingGRNSelected.Count > 0) { List <int> selectedgrn = (from PendingGRN p in PendingGRNSelected where p.Select select p.GRNId).ToList <int>(); purchasebill = rep.GetGRNHeadData(selectedgrn); purchasebill.Items = rep.GetGRNItems(selectedgrn); purchasebill.SupplyOrderNo = rep.GetSupplyOrderNos(selectedgrn).SupplyOrderNo; } } string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(32, OrganizationId); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } try { purchasebill.PurchaseBillRefNo = internalId; purchasebill.Supplier = PendingGRNSelected[0].SupplierName; purchasebill.SupplierId = PendingGRNSelected[0].SupplierId; purchasebill.PurchaseBillDate = System.DateTime.Today; purchasebill.PurchaseBillDueDate = rep.GetBillDueDate(PendingGRNSelected[0].SupplierId).PurchaseBillDueDate; purchasebill.CurrencyId = new SupplierRepository().GetSupplierCurrency(PendingGRNSelected[0].SupplierId).CurrencyId; //purchasebill.CurrencyId = new CurrencyRepository().GetCurrencyFrmOrganization(OrganizationId).CurrencyId; return(View(purchasebill)); } catch (Exception) { TempData["error"] = "Some required data was missing. Please try again."; return(RedirectToAction("Index")); } }
public ActionResult Create(int?WorkShopRequestId) { PurchaseRequestRepository repo = new PurchaseRequestRepository(); PurchaseRequest model = repo.GetPurchaseRequestDetails(WorkShopRequestId ?? 0); var PRList = repo.GetPurchaseRequestItem(WorkShopRequestId ?? 0); model.items = new List <PurchaseRequestItem>(); foreach (var item in PRList) { var pritem = new PurchaseRequestItem { PartNo = item.PartNo, ItemName = item.ItemName, Quantity = item.Quantity, UnitName = item.UnitName, ItemId = item.ItemId, MinLevel = item.MinLevel, WRRequestQty = item.WRRequestQty, CurrentStock = item.CurrentStock, WRIssueQty = item.WRIssueQty, TotalQty = item.TotalQty, InTransitQty = item.InTransitQty, PendingPRQty = item.PendingPRQty, ShortorExcess = item.ShortorExcess }; model.items.Add(pritem); } string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(8, OrganizationId); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } model.PurchaseRequestNo = internalId; model.PurchaseRequestDate = System.DateTime.Today; model.RequiredDate = System.DateTime.Today; model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); return(View(model)); }
public ActionResult Create(int Id) { JobCardRepository jcRepo = new JobCardRepository(); EmployeeRepository emRepo = new EmployeeRepository(); JobCard jc = jcRepo.GetDetailsById(Id, null); //FillTaks(jc.WorkDescriptionId); JobCardDailyActivity model = new JobCardDailyActivity(); if (jc.isProjectBased == 1) { model.JobCardDailyActivityRefNo = DatabaseCommonRepository.GetNextDocNo(38, OrganizationId); //FillTasks(); FillTasks(jc.isProjectBased); FillEmployees(); } else { model.JobCardDailyActivityRefNo = DatabaseCommonRepository.GetNextDocNo(27, OrganizationId); } model.CreatedDate = DateTime.Now; model.JobCardDailyActivityDate = DateTime.Now; model.isProjectBased = jc.isProjectBased; model.CustomerName = jc.CustomerName; if (model.isProjectBased == 0) { model.JobCardDailyActivityTask = new JobCardDailyActivityRepository().GetJobCardTasksForDailyActivity(Id, OrganizationId); } else { model.JobCardDailyActivityTask = new List <JobCardDailyActivityTask>(); model.JobCardDailyActivityTask.Add(new JobCardDailyActivityTask { TaskStartDate = model.JobCardDailyActivityDate, TaskEndDate = model.JobCardDailyActivityDate }); } //if (model.JobCardDailyActivityTask.Count > 0) //{ // foreach (var item in model.JobCardDailyActivityTask) // { // item.StartTime = "00:00"; item.EndTime = "00.00"; // } //} //model.JobCardDailyActivityTask = new List<JobCardDailyActivityTask>(); //model.JobCardDailyActivityTask.Add(new JobCardDailyActivityTask() { TaskStartDate = DateTime.Now, TaskEndDate = DateTime.Now}); Employee emp = emRepo.GetEmployee(jc.EmployeeId); model.EmployeeId = jc.EmployeeId; model.EmployeeName = emp.EmployeeName; model.JobCardNo = jc.JobCardNo; model.JobCardId = Id; ViewBag.isTxnPending = true; return(View(model)); }
public ActionResult Create() { FillDropdowns(); return(View(new SubAssembly { StockCreationDate = DateTime.Today, StockCreationRefNo = DatabaseCommonRepository.GetNextDocNo(26, OrganizationId), isSubAssembly = true, ConsumedItems = ConsumedItemsGrid(), FinishedGoods = FinishedGoodsGrid() })); }
public ActionResult ServiceEnquiryProject() { FillDropDowns(); return(View(new ServiceEnquiry { ServiceEnquiryRefNo = DatabaseCommonRepository.GetNextDocNo(41, OrganizationId), ServiceEnquiryDate = DateTime.Today, isProjectBased = 0, isService = 1, IsConfirmed = 0 })); }
public ActionResult Issuance(int id = 0) { string referenceNo = DatabaseCommonRepository.GetNextDocNo(24, OrganizationId); FillDropdowns(); if (id == 0) { return(RedirectToAction("Pending")); } return(View(new StoreIssue { WorkShopRequestId = id, StoreIssueDate = DateTime.Today, StoreIssueRefNo = referenceNo })); }
public ActionResult Create() { FillDropdowns(); var model = new StockCreation { StockCreationDate = DateTime.Today, StockCreationRefNo = DatabaseCommonRepository.GetNextDocNo(25, OrganizationId), ConsumedItems = ConsumedItemsGrid(), FinishedGoods = FinishedGoodsGrid() }; return(View(model)); }
public ActionResult CreateDirectMaterialRequest() { FillPartNo(); GetMaterials(); List <WorkShopRequestItem> list = new List <WorkShopRequestItem>(); list.Add(new WorkShopRequestItem()); return(View(new WorkShopRequest { Items = list, WorkShopRequestDate = DateTime.Today, WorkShopRequestRefNo = DatabaseCommonRepository.GetNextDocNo(37, OrganizationId) })); }
public ActionResult Create(int?Id, int?isProjectBased) //SaleOrderItemId is received here { try { FillEmployee(); JobCardRepository repo = new JobCardRepository(); SaleOrderRepository soRepo = new SaleOrderRepository(); isProjectBased = soRepo.IsProjectOrVehicle(Id ?? 0); JobCard model = repo.GetJobCardDetails(Id ?? 0, isProjectBased ?? 0); model.JobCardNo = DatabaseCommonRepository.GetNextDocNo( model.isService == 1 ? (isProjectBased ?? 0) == 1 ? 40 : 34 : (isProjectBased ?? 0) == 1 ? 39 : 16, OrganizationId); model.isProjectBased = isProjectBased ?? 0; model.JobCardTasks = new List <JobCardTask>(); model.JobCardTasks.Add(new JobCardTask() { TaskDate = DateTime.Now }); model.JobCardDate = DateTime.Now; model.RequiredDate = DateTime.Now; FillBay(model.isService); //FillAllTasks(); FillTasks(model.isProjectBased); //if (model.isService == 1) // FillTaks(model.WorkDescriptionId); //else // FillFreezerAndBoxTasks(Id); //FillTaks(model.WorkDescriptionId); //FillFreezerUnit(); //FillBox(); //FillVehicleRegNo(); return(View(model)); } catch (Exception ex) { string ErrorMessage = ex.Message.ToString(); if (ex.InnerException != null) { if (ex.InnerException.Message != null) { ErrorMessage = ErrorMessage + ex.InnerException.Message.ToString(); } } ViewData["Error"] = ErrorMessage; return(View("ShowError")); } }
public ActionResult PurchaseIndent() { FillPartNo(); GetMaterials(); List <DirectPurchaseRequestItem> list = new List <DirectPurchaseRequestItem>(); list.Add(new DirectPurchaseRequestItem()); return(View(new DirectPurchaseRequest { items = list, PurchaseRequestDate = DateTime.Today, RequiredDate = DateTime.Today, PurchaseRequestNo = DatabaseCommonRepository.GetNextDocNo(36, OrganizationId) })); }
public ActionResult Create() { FillStockPoint(); FIllEmployee(); FIllStockItems(0); FillPartNoInStock(0); //StockJournal StockJournal = new StockJournal(); string internalid = DatabaseCommonRepository.GetNextDocNo(22, OrganizationId); StockJournal StockJournalList = new StockJournal { StockJournelItems = new List <StockJournalItem>(), StockJournalRefno = internalid }; StockJournalList.StockJournelItems.Add(new StockJournalItem()); //StockJournal.StockJournalRefno = "SJ/" + internalid; return(View("Create", StockJournalList)); //return View(new StockJournal { StockJournalRefno = "SJ/" + internalid }); }
public ActionResult Create() { string internalId = ""; internalId = DatabaseCommonRepository.GetNextDocNo(14, OrganizationId); FillDropdowns(); ExpenseBill expense = new ExpenseBill(); expense.ExpenseDate = expense.ExpenseBillDate = expense.ExpenseBillDueDate = DateTime.Now; expense.ExpenseNo = internalId; expense.CurrencyId = new CurrencyRepository().GetCurrencyFrmOrganization(OrganizationId).CurrencyId; expense.ExpenseBillItem = new List <ExpenseBillItem>(); expense.deductions = new List <ExpenseBillItem>(); expense.ExpenseBillItem.Add(new ExpenseBillItem()); expense.deductions.Add(new ExpenseBillItem()); return(View(expense)); }
public ActionResult Create(int?SaleOrderId) { ProformaInvoiceRepository repo = new ProformaInvoiceRepository(); CurrencyRepository repo1 = new CurrencyRepository(); ProformaInvoice model = repo.GetSaleOrderForPorforma(SaleOrderId ?? 0); //model.SymbolName = repo1.GetCurrencyFrmOrganization(OrganizationId).SymbolName; var PIList = repo.GetPorformaInvoiceData(model.SaleOrderId); model.Items = new List <ProformaInvoiceItem>(); foreach (var item in PIList) { model.Items.Add(new ProformaInvoiceItem { WorkDescription = item.WorkDescription, VehicleModelName = item.VehicleModelName, Quantity = item.Quantity, UnitName = item.UnitName, Rate = item.Rate, Amount = item.Amount, Discount = item.Discount, SaleOrderItemId = item.SaleOrderItemId }); } string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(6, OrganizationId); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } model.ProformaInvoiceRefNo = internalId; model.ProformaInvoiceDate = DateTime.Now; model.PrintDescriptions = new ProformaInvoiceRepository().GetPrintDescriptions(SaleOrderId); if (model.PrintDescriptions == null || model.PrintDescriptions.Count == 0) { model.PrintDescriptions.Add(new PrintDescription()); } return(View(model)); }
public ActionResult CreateAfterSalesTrans(int id = 0)//DeliveryChallanId is received here { if (id == 0) { return(RedirectToAction("Index", "Home")); } var internalid = DatabaseCommonRepository.GetNextDocNo(28, OrganizationId); DropDowns(); FillWrkDescAfterSales(); FillVehicle(); FillUnit(); ItemDropdown(); FillRateSettings(); SalesQuotation salesquotation = new SalesQuotation(); salesquotation.DeliveryChallanId = id; salesquotation.isProjectBased = false; salesquotation.isAfterSales = true; salesquotation.QuotationDate = System.DateTime.Today; salesquotation.QuotationRefNo = internalid; salesquotation.PredictedClosingDate = System.DateTime.Today; salesquotation.QuotationValidToDate = System.DateTime.Today; salesquotation.ExpectedDeliveryDate = System.DateTime.Today; salesquotation.CurrencyId = new CurrencyRepository().GetCurrencyFrmOrganization(OrganizationId).CurrencyId; salesquotation.SalesQuotationItems = new List <SalesQuotationItem>(); salesquotation.SalesQuotationItems.Add(new SalesQuotationItem()); salesquotation.Materials = new List <SalesQuotationMaterial>(); salesquotation.Materials.Add(new SalesQuotationMaterial()); salesquotation.SalesQuotationItems[0].Quantity = 1; salesquotation.SalesQuotationItems[0].UnitName = "Nos"; ViewBag.SubmitAction = "Save"; salesquotation.isWarranty = new SalesQuotationRepository().isUnderWarranty(id, "Transport"); salesquotation.DeliveryChallanDetails = new DeliveryChallanRepository().GetDeliveryChallan(id); salesquotation.CustomerId = new CustomerRepository().GetCustomerFromWarranty(id, salesquotation.isProjectBased); return(View("Create", salesquotation)); }
public ActionResult Create(int isProjectBased) { string internalid = ""; JobCardDropdown(isProjectBased); if (isProjectBased == 0) { internalid = DatabaseCommonRepository.GetNextDocNo(20, OrganizationId); } else { internalid = DatabaseCommonRepository.GetNextDocNo(43, OrganizationId); } //return View(new Employee { EmployeeRefNo = "EMP/" + internalid }); return(View(new WorkShopRequest { WorkShopRequestDate = DateTime.Today, RequiredDate = DateTime.Today, WorkShopRequestRefNo = internalid, isProjectBased = isProjectBased })); }
public ActionResult CreateQuerySheetCosting(string type) { string internalId = ""; try { internalId = DatabaseCommonRepository.GetNextDocNo(5, OrganizationId); } catch (NullReferenceException nx) { TempData["success"] = ""; TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["success"] = ""; TempData["error"] = "Some error occurred. Please try again.|" + ex.Message; } QuerySheet qs = new QuerySheet(); qs.Type = type; qs.QuerySheetDate = DateTime.Now; var repo = new QuerySheetRepository(); qs.QuerySheetItems = new List <QuerySheetItem>(); qs.QuerySheetItems.Add(new QuerySheetItem()); var PCList = repo.GetProjectCostingParameter(); qs.Items = new List <ProjectCost>(); qs.QuerySheetRefNo = internalId; foreach (var item in PCList) { var pcitem = new ProjectCost { CostingId = item.CostingId, Description = item.Description, Remarks = item.Remarks, Amount = item.Amount }; qs.Items.Add(pcitem); } return(View("CreateQuerySheet", qs)); }
public ActionResult Create(IList <PendingForGRN> list) { try { GRN model = new GRN(); if (list.Count > 0) { List <int?> id; if (list[0].isDirectPurchase) //if direct purchase { id = (from PendingForGRN p in list where p.isChecked select p.DirectPurchaseRequestId).ToList(); if (id.Count > 0) { List <GRNAddition> Additions = new List <GRNAddition>(); Additions.Add(new GRNAddition()); List <GRNDeduction> Deductions = new List <GRNDeduction>(); Deductions.Add(new GRNDeduction()); model.isDirectPurchaseGRN = true; model.Items = new GRNRepository().GetDirectGRNItems(id); model.GRNDate = DateTime.Today; model.Additions = Additions; model.Deductions = Deductions; SupplierDropdown(); } else { throw new NullReferenceException("1No purchase requests were selected. Please select atleast one purchase request and try again."); } } else //if not direct purchase { var selectedlist = (from PendingForGRN p in list where p.isChecked select p).ToList(); //if (selectedlist.) if (selectedlist.Count > 0) { List <GRNAddition> Additions = new List <GRNAddition>(); Additions.Add(new GRNAddition()); List <GRNDeduction> Deductions = new List <GRNDeduction>(); Deductions.Add(new GRNDeduction()); model = new GRNRepository().GetGRNDetails(selectedlist[0].SupplierId); model.GRNDate = DateTime.Today; model.Items = new GRNRepository().GetGRNItem(selectedlist.Select(m => m.SupplyOrderId).ToList()); model.Additions = Additions; model.Deductions = Deductions; } else { throw new NullReferenceException("1No supply orders were selected. Please select atleast one supply order and try again."); } } } FillWarehouse(); FillCurrency(); FillAdditionDeduction(); FillEmployee(); model.GRNNo = DatabaseCommonRepository.GetNextDocNo(11, OrganizationId); return(View(model)); } catch (NullReferenceException nx) { if (nx.Message.StartsWith("1")) { TempData["error"] = nx.Message.Substring(1); } else { TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } } catch (SqlException sx) { TempData["error"] = "Some error occured while connecting to database. Please check your network connection and try again.|" + sx.Message; } catch (Exception ex) { TempData["error"] = "Some error occured. Please try again.|" + ex.Message; } TempData["success"] = ""; try { if (list[0].isDirectPurchase) { return(RedirectToAction("PendingDirectPurchase")); } return(RedirectToAction("PendingGrnWareHouse")); } catch (Exception) { return(RedirectToAction("Index", "Home")); } }
public ActionResult Create(List <SalesInvoiceItem> ObjSaleInvoiceItem) { ObjSaleInvoiceItem = ObjSaleInvoiceItem.Where(x => x.SelectStatus).Select(x => x).ToList(); SalesInvoice saleinvoice = new SalesInvoice(); SalesInvoiceRepository SalesInvoiceRepo = new SalesInvoiceRepository(); SalesInvoiceItemRepository SalesInvoiceItemRepo = new SalesInvoiceItemRepository(); if (ObjSaleInvoiceItem.Count > 0) { List <int> SelectedSaleOrderItemId = (from SalesInvoiceItem s in ObjSaleInvoiceItem where s.SelectStatus select s.SaleOrderItemId).ToList <int>(); saleinvoice = SalesInvoiceRepo.GetSelectedSalesInvoiceHD(ObjSaleInvoiceItem[0].SaleOrderId, ObjSaleInvoiceItem[0].invType); saleinvoice.InvoiceType = ObjSaleInvoiceItem[0].invType; string internalId = ""; if (saleinvoice.InvoiceType == "Inter") { internalId = DatabaseCommonRepository.GetNextDocNo(44, OrganizationId); } else { internalId = DatabaseCommonRepository.GetNextDocNo(7, OrganizationId); } saleinvoice.SalesInvoiceDate = System.DateTime.Today; saleinvoice.SalesInvoiceRefNo = internalId; saleinvoice.SaleInvoiceItems = SalesInvoiceItemRepo.GetSelectedSalesInvoiceDT(SelectedSaleOrderItemId, ObjSaleInvoiceItem[0].SaleOrderId); //SalesInvoiceRepository SalesInvoiceRepo = new SalesInvoiceRepository(); //SalesInvoice saleinvoice = SalesInvoiceRepo.GetSelectedSalesInvoiceHD(SelectedSaleOrderItemId); //int deliveryChallanId = new DeliveryChallanRepository().GetDeliveryChallanIdFromJobCardId() //saleinvoice.PrintDescriptions = new SalesInvoiceRepository().GetPrintDescriptions(SelectedSaleOrderItemId); saleinvoice.PrintDescriptions = new List <PrintDescription>(); var PrintDescriptionsFromDB = new SalesInvoiceRepository().GetPrintDescriptions(SelectedSaleOrderItemId); //combining same print descriptions foreach (var item in PrintDescriptionsFromDB) { if (!saleinvoice.PrintDescriptions.Select(x => x.Description.Trim()).Contains(item.Description.Trim())) { item.Quantity = PrintDescriptionsFromDB.Where(x => x.Description.Trim() == item.Description.Trim()).Count(); item.Amount = (item.Quantity ?? 0) * item.PriceEach; saleinvoice.PrintDescriptions.Add(item); } } // } if (saleinvoice.InvoiceType == "Inter") { saleinvoice.isProjectBased = 1; if (saleinvoice.PrintDescriptions == null || saleinvoice.PrintDescriptions.Count == 0) { saleinvoice.PrintDescriptions.Add(new PrintDescription()); } } else if (saleinvoice.InvoiceType == "Final") { saleinvoice.isProjectBased = 0; } return(View("Create", saleinvoice)); }