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 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 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 SalesQuotationsListviewDetail(SalesQuotation item) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); // App.orderLineList = item.order_line; Cus.Text = item.customer; CD.Text = item.DateOrder; PT.Text = item.payment_term; SP.Text = item.sales_person; ST.Text = item.sales_team; CR.Text = item.customer_reference; FP.Text = item.fiscal_position; saleoder_id = item.id; orderListview.ItemsSource = item.order_line; var backImgRecognizer = new TapGestureRecognizer(); backImgRecognizer.Tapped += async(s, e) => { // handle the tap var currentpage = new LoadingAlert(); await PopupNavigation.PushAsync(currentpage); Application.Current.MainPage = new MasterPage(new CrmTabbedPage()); // orderListview.ItemsSource = null; Loadingalertcall(); }; backImg.GestureRecognizers.Add(backImgRecognizer); }
public bool AddNewQuotation(SalesQuotation Quotation, IList <SalesQuotationItems> QuotationItemList, ref string ErrorMessage) { ErrorMessage = string.Empty; try { salesquotationContext.SalesQuotation.Add(Quotation); salesquotationContext.SaveChanges(); int currentId = Quotation.Sales_Qtn_Id; for (int i = 0; i < QuotationItemList.Count; i++) { QuotationItemList[i].BaseDocLink = "N"; QuotationItemList[i].Sales_Qtn_Id = currentId; } salesquotationContext.SalesQuotationItem.AddRange(QuotationItemList); salesquotationContext.SaveChanges(); return(true); } catch (Exception ex) { ExceptionHandler.LogException(ex); ErrorMessage = ex.Message; return(false); } }
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 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 GetRoomDetailsFromQuotation(int salesQuotationId) { FillUnitDoorUnit(); SalesQuotation model = new SalesQuotation(); model.ProjectRooms = new SaleOrderRepository().GetRoomDetailsFromQuotation(salesQuotationId); return(PartialView("_ProjectRooms", model)); }
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 bool UpdateQuotationorder(SalesQuotation Quotation, IList <SalesQuotationItems> QuotationItemList, ref string ErrorMessage) { ErrorMessage = string.Empty; try { ordercontext.Entry(Quotation).State = EntityState.Modified; ordercontext.SaveChanges(); foreach (var model1 in QuotationItemList) { if (model1.IsDummy == 1) { ordercontext.Entry(model1).State = EntityState.Deleted; ordercontext.SaveChanges(); } else { if (model1.Sales_QtnItems_Id == 0) { model1.Sales_Qtn_Id = Quotation.Sales_Qtn_Id; ordercontext.salesquotationitem.Add(model1); ordercontext.SaveChanges(); } else { ordercontext1.salesquotationitem.Attach(model1); ordercontext1.Entry(model1).State = EntityState.Modified; //goodscontext.SaveChanges(); } ordercontext1.SaveChanges(); } } return(true); } //catch (Exception ex) //{ // ExceptionHandler.LogException(ex); // ErrorMessage = ex.Message; // return false; //} catch (DbEntityValidationException dbEx) { var errorList = new List <string>(); foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { errorList.Add(String.Format("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage)); } } return(false); } }
//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 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 bool UpdateQuotation(SalesQuotation Quotation, IList <SalesQuotationItems> QuotationItemList, ref string ErrorMessage) { ErrorMessage = string.Empty; try { salesquotationContext.Entry(Quotation).State = EntityState.Modified; salesquotationContext.SaveChanges(); foreach (var model in QuotationItemList) { if (model.IsDummy == 1) { salesquotationContext.Entry(model).State = EntityState.Deleted; salesquotationContext.SaveChanges(); } else { if (model.Sales_QtnItems_Id == 0) { model.Sales_Qtn_Id = Quotation.Sales_Qtn_Id; model.BaseDocLink = "N"; salesquotationContext.SalesQuotationItem.Add(model); salesquotationContext.SaveChanges(); } else { salesquotationContext.Entry(model).State = EntityState.Modified; salesquotationContext.SaveChanges(); } } } return(true); } catch (Exception ex) { ExceptionHandler.LogException(ex); ErrorMessage = ex.Message; return(false); } }
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 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 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)); } }
/// <summary> /// This method is used to add or edit purchase quotation /// </summary> /// <param name="quotationData"></param> /// <returns></returns> public int AddUpdateQuotation(SalesQuotationForm quotationData) { int autoId = 0; //Add purchase quotation SalesQuotation obj = new SalesQuotation(); obj.ID = quotationData.Quotation.ID; obj.Cus_Id = quotationData.Quotation.CustomerID; obj.Salesman = quotationData.Quotation.SalesmanID; obj.SQ_Conv_to_SO = quotationData.Quotation.SQ_Conv_to_SO; obj.SQ_Conv_to_SI = quotationData.Quotation.SQ_Conv_to_SI; obj.SQ_Date = quotationData.Quotation.QuotationDate; obj.SQ_GST_Amt = Convert.ToDecimal(quotationData.Quotation.TotalTax); obj.SQ_No = quotationData.Quotation.QuotationNo; obj.SQ_TandC = quotationData.Quotation.TermsAndConditions; obj.SQ_Tot_aft_Tax = Convert.ToDecimal(quotationData.Quotation.TotalAfterTax); obj.SQ_Tot_bef_Tax = Convert.ToDecimal(quotationData.Quotation.TotalBeforeTax); obj.SQ_Valid_for = quotationData.Quotation.ValidForDays; obj.Exc_Inc_GST = quotationData.Quotation.ExcIncGST; obj.IsDeleted = false; try { using (SDNSalesDBEntities entities = new SDNSalesDBEntities()) { if (entities.SalesQuotations.AsNoTracking().FirstOrDefault(x => x.ID == quotationData.Quotation.ID) == null) { //obj.CreatedBy = quotationData.SQModel.CreatedBy; obj.CreatedDate = DateTime.Now; entities.SalesQuotations.Add(obj); entities.SaveChanges(); autoId = obj.ID; } else { // obj.ModifiedBy = quotationData.SQModel.ModifiedBy; obj.ModifiedDate = DateTime.Now; entities.Entry(obj).State = EntityState.Modified; autoId = entities.SaveChanges(); } if (autoId > 0) { SalesQuotationDetail SQDetails; if (quotationData.QuotationDetails != null) { foreach (SalesQuotationDetailEntity SQDetailEntity in quotationData.QuotationDetails) { SQDetails = new SalesQuotationDetail(); SQDetails.SQ_ID = autoId; SQDetails.SQ_No = SQDetailEntity.SQNo; SQDetails.PandS_Code = SQDetailEntity.PandSCode; SQDetails.PandS_Name = SQDetailEntity.PandSName; SQDetails.SQ_Amount = SQDetailEntity.SQAmount; SQDetails.SQ_Discount = SQDetailEntity.SQDiscount; SQDetails.SQ_No = SQDetailEntity.SQNo; SQDetails.SQ_Price = Convert.ToDecimal(SQDetailEntity.SQPrice); SQDetails.SQ_Qty = SQDetailEntity.SQQty; SQDetails.GST_Code = SQDetailEntity.GSTCode; SQDetails.GST_Rate = SQDetailEntity.GSTRate; if (entities.SalesQuotationDetails.AsNoTracking().FirstOrDefault(x => x.ID == SQDetailEntity.ID) == null) { entities.SalesQuotationDetails.Add(SQDetails); entities.SaveChanges(); } else { entities.Entry(SQDetails).State = EntityState.Modified; entities.SaveChanges(); } } } } } return(autoId); } catch (Exception ex) { throw ex; } }
public SalesQuotationsListviewDetail(SalesQuotation item) { InitializeComponent(); // NavigationPage.SetHasNavigationBar(this, false); // App.orderLineList = item.order_line; obj = item; Cus.Text = item.customer; CD.Text = item.DateOrder; PT.Text = item.payment_term; CG.Text = item.commission_group; SP.Text = item.sales_person; ST.Text = item.sales_team; CR.Text = item.customer_reference; FP.Text = item.fiscal_position; saleoder_id = item.id; userlocation.Text = App.user_location_string; final_listview = item.order_line; orderListview.ItemsSource = item.order_line; orderListview.HeightRequest = item.order_line.Count * 50; var sq_editRecognizer = new TapGestureRecognizer(); sq_editRecognizer.Tapped += async(s, e) => { // handle the tap // noedit_layout.IsVisible = false; // List<CRMLead> crmLeadData = Controller.InstanceCreation().crmLeadData(); sq_editbtn.IsVisible = false; updatebtn.IsVisible = false; savebtn_layout.IsVisible = true; editbtn_clicked = true; cus_edit.IsVisible = true; con_dateedit.IsVisible = true; ptpicker_edit.IsVisible = true; commissionpicker_edit.IsVisible = true; sales_teamedit.IsVisible = true; sales_personsedit.IsVisible = true; cr_edit.IsVisible = true; fp_edit.IsVisible = true; is_edit.IsVisible = true; cus_noedit.IsVisible = false; con_datenoedit.IsVisible = false; ptpicker_noedit.IsVisible = false; commissionpicker_noedit.IsVisible = false; sales_teamnoedit.IsVisible = false; sales_personsnoedit.IsVisible = false; cr_noedit.IsVisible = false; fp_noedit.IsVisible = false; is_noedit.IsVisible = false; salesteam_picker.ItemsSource = App.salesteam.Select(x => x.Value).ToList(); salesteam_picker.SelectedItem = item.sales_team; salesperson_picker.ItemsSource = App.salespersons.Select(x => x.Value).ToList(); salesperson_picker.SelectedItem = item.sales_person; cuspicker1.ItemsSource = cuspicker1.ItemsSource = App.cusdict.Select(x => x.Value).ToList(); cuspicker1.SelectedItem = item.customer; DateTime enteredDate = DateTime.Parse(item.DateOrder); cd_Picker.Date = enteredDate; ptpicker.ItemsSource = App.paytermList.Select(x => x.name).ToList(); ptpicker.SelectedItem = item.payment_term; comgroup_picker.ItemsSource = App.commisiongroupList.Select(x => x.name).ToList(); comgroup_picker.SelectedItem = item.commission_group; orderLineGrid_ol.IsVisible = false; addbtn_orderline.IsVisible = true; if (tap2_clicked == true) { addbtn_orderline.IsVisible = false; } }; sq_editbtn.GestureRecognizers.Add(sq_editRecognizer); var addbtn_orderlineRecognizer = new TapGestureRecognizer(); addbtn_orderlineRecognizer.Tapped += (s, e) => { orderLineGrid_ol.IsVisible = true; addbtn_orderline.IsVisible = false; savebtn_layout.IsVisible = true; updatebtn.IsVisible = false; searchprod_ol.Text = ""; orderline_des_ol.Text = ""; up_ol.Text = ""; oqty_ol.Text = ""; add_new_orderline = true; }; Add_OrderLineBtn.GestureRecognizers.Add(addbtn_orderlineRecognizer); }
/// <summary> /// This method is used to convert the Sales quotation to order /// </summary> /// <param name="quotationData"></param> /// <returns></returns> public int ConvertToSalesOrder(SalesQuotationForm quotationData) { int autoId = 0; //Add purchase quotation SalesOrder obj = new SalesOrder(); //obj.ID = quotationData.Quotation.ID; obj.Cus_Id = quotationData.Quotation.CustomerID; obj.SO_Date = quotationData.Quotation.QuotationDate; obj.SO_Del_Date = DateTime.Now; obj.SO_GST_Amt = Convert.ToDecimal(quotationData.Quotation.TotalTax); obj.SO_No = "SO-" + (GetLastOrderNo() + 1); obj.SO_TandC = quotationData.Quotation.TermsAndConditions; obj.SO_Tot_aft_Tax = Convert.ToDecimal(quotationData.Quotation.TotalAfterTax); obj.SO_Tot_bef_Tax = Convert.ToDecimal(quotationData.Quotation.TotalBeforeTax); obj.Salesman = quotationData.Quotation.SalesmanID; obj.Exc_Inc_GST = quotationData.Quotation.ExcIncGST; obj.IsDeleted = false; try { using (SASEntitiesEDM entities = new SASEntitiesEDM()) { if (entities.SalesOrders.AsNoTracking().FirstOrDefault(x => x.ID == quotationData.Quotation.ID) == null) { //obj.CreatedBy = quotationData.SQModel.CreatedBy; obj.CreatedDate = DateTime.Now; entities.SalesOrders.Add(obj); entities.SaveChanges(); autoId = obj.ID; } else { // obj.ModifiedBy = quotationData.SQModel.ModifiedBy; obj.ModifiedDate = DateTime.Now; entities.Entry(obj).State = EntityState.Modified; autoId = entities.SaveChanges(); } if (autoId > 0) { SalesOrderDetail SQDetails; if (quotationData.QuotationDetails != null) { foreach (SalesQuotationDetailEntity SQDetailEntity in quotationData.QuotationDetails) { SQDetails = new SalesOrderDetail(); SQDetails.SO_ID = autoId; SQDetails.SO_No = SQDetailEntity.SQNo; SQDetails.PandS_Code = SQDetailEntity.PandSCode; SQDetails.PandS_Name = SQDetailEntity.PandSName; SQDetails.SO_Amount = SQDetailEntity.SQAmount; SQDetails.SO_Discount = SQDetailEntity.SQDiscount; SQDetails.SO_No = SQDetailEntity.SQNo; SQDetails.SO_Price = Convert.ToDecimal(SQDetailEntity.SQPrice); SQDetails.SO_Qty = SQDetailEntity.SQQty; SQDetails.GST_Code = SQDetailEntity.GSTCode; SQDetails.GST_Rate = SQDetailEntity.GSTRate; if (entities.SalesOrderDetails.AsNoTracking().FirstOrDefault(x => x.ID == SQDetailEntity.ID) == null) { entities.SalesOrderDetails.Add(SQDetails); entities.SaveChanges(); } else { entities.Entry(SQDetails).State = EntityState.Modified; entities.SaveChanges(); } } } SalesQuotation objQ = entities.SalesQuotations.Where(e => e.SQ_No == quotationData.Quotation.QuotationNo ).SingleOrDefault(); if (objQ != null) { objQ.SQ_Conv_to_SO = true; objQ.Conv_to_No = obj.SO_No; objQ.ModifiedDate = DateTime.Now; entities.SaveChanges(); } } } return(autoId); } catch (Exception ex) { throw ex; } }
public int UpdationQuotation(SalesQuotationForm quotationData) { try { using (SASEntitiesEDM entities = new SASEntitiesEDM()) { SalesQuotation obj = entities.SalesQuotations.Where(e => e.SQ_No == quotationData.Quotation.QuotationNo ).SingleOrDefault(); if (obj != null) { //obj.ID = quotationData.Quotation.ID; obj.Cus_Id = quotationData.Quotation.CustomerID; // obj.SQ_Conv_to_SO = quotationData.Quotation.SQ_Conv_to_SO; // obj.SQ_Conv_to_SI = quotationData.Quotation.SQ_Conv_to_SI; obj.SQ_Date = Convert.ToDateTime(quotationData.Quotation.QuotationDateStr); obj.SQ_GST_Amt = Convert.ToDecimal(quotationData.Quotation.TotalTax); obj.SQ_No = quotationData.Quotation.QuotationNo; obj.SQ_TandC = quotationData.Quotation.TermsAndConditions; obj.Salesman = quotationData.Quotation.SalesmanID; obj.SQ_Tot_aft_Tax = Convert.ToDecimal(quotationData.Quotation.TotalAfterTax); obj.SQ_Tot_bef_Tax = Convert.ToDecimal(quotationData.Quotation.TotalBeforeTax); obj.SQ_Valid_for = quotationData.Quotation.ValidForDays; obj.Exc_Inc_GST = quotationData.Quotation.ExcIncGST; obj.ModifiedDate = DateTime.Now; entities.SaveChanges(); } var objSales = entities.SalesQuotationDetails.Where (e => e.SQ_ID == obj.ID).ToList(); if (objSales != null) { foreach (var item in objSales) { entities.SalesQuotationDetails.Remove(item); entities.SaveChanges(); } } SalesQuotationDetail SQDetails; if (quotationData.QuotationDetails != null) { foreach (SalesQuotationDetailEntity SQDetailEntity in quotationData.QuotationDetails) { SQDetails = new SalesQuotationDetail(); SQDetails.SQ_ID = obj.ID; SQDetails.SQ_No = SQDetailEntity.SQNo; SQDetails.PandS_Code = SQDetailEntity.PandSCode; SQDetails.PandS_Name = SQDetailEntity.PandSName; SQDetails.SQ_Amount = SQDetailEntity.SQAmount; SQDetails.SQ_Discount = SQDetailEntity.SQDiscount; SQDetails.SQ_No = SQDetailEntity.SQNo; SQDetails.SQ_Price = Convert.ToDecimal(SQDetailEntity.SQPrice); SQDetails.SQ_Qty = SQDetailEntity.SQQty; SQDetails.GST_Code = SQDetailEntity.GSTCode; SQDetails.GST_Rate = SQDetailEntity.GSTRate; entities.SalesQuotationDetails.Add(SQDetails); entities.SaveChanges(); } } return(obj.ID); } } catch (Exception ex) { throw ex; } }
public SalesQuotationsListviewDetail(SalesQuotation item) { InitializeComponent(); // NavigationPage.SetHasNavigationBar(this, false); // App.orderLineList = item.order_line; obj = item; Cus.Text = item.customer; CD.Text = item.DateOrder; PT.Text = item.payment_term; CG.Text = item.commission_group; SP.Text = item.sales_person; ST.Text = item.sales_team; CR.Text = item.customer_reference; FP.Text = item.fiscal_position; saleoder_id = item.id; userlocation.Text = App.user_location_string; final_listview = item.order_line; orderListview.ItemsSource = item.order_line; // tax_listview.ItemsSource = item.order_line; orderListview.HeightRequest = item.order_line.Count * 35; var sq_editRecognizer = new TapGestureRecognizer(); sq_editRecognizer.Tapped += async(s, e) => { // handle the tap // noedit_layout.IsVisible = false; // List<CRMLead> crmLeadData = Controller.InstanceCreation().crmLeadData(); try { String res = Controller.InstanceCreation().SaleOrderConfirm("sale.order", "confirm_sale_quotation", saleoder_id); } catch { int j = 0; } if (App.NetAvailable == false) { await DisplayAlert("Alert", "Need Internet Connection", "Ok"); } else { sq_editbtn.IsVisible = false; updatebtn.IsVisible = false; savebtn_layout.IsVisible = true; editbtn_clicked = true; cus_edit.IsVisible = true; con_dateedit.IsVisible = true; ptpicker_edit.IsVisible = true; commissionpicker_edit.IsVisible = true; sales_teamedit.IsVisible = true; sales_personsedit.IsVisible = true; cr_edit.IsVisible = true; fp_edit.IsVisible = true; is_edit.IsVisible = true; cus_noedit.IsVisible = false; con_datenoedit.IsVisible = false; ptpicker_noedit.IsVisible = false; commissionpicker_noedit.IsVisible = false; sales_teamnoedit.IsVisible = false; sales_personsnoedit.IsVisible = false; cr_noedit.IsVisible = false; fp_noedit.IsVisible = false; is_noedit.IsVisible = false; try { salesteam_picker.ItemsSource = App.salesteam.Select(x => x.Value).ToList(); salesteam_picker.SelectedItem = item.sales_team; salesperson_picker.ItemsSource = App.salespersons.Select(x => x.Value).ToList(); salesperson_picker.SelectedItem = item.sales_person; cuspicker1.ItemsSource = cuspicker1.ItemsSource = App.cusdict.Select(x => x.Value).ToList(); cuspicker1.SelectedItem = item.customer; } catch { await DisplayAlert("Alert-1", "Please Try Again", "Ok"); } try { DateTime enteredDate = DateTime.Parse(item.DateOrder); cd_Picker.Date = enteredDate; } catch { // await DisplayAlert("Alert-2", "Please Try Again","Ok"); String enteredDate = DateTime.Now.ToString("yyyy-MM-dd"); DateTime dt = DateTime.Parse(enteredDate); cd_Picker.Date = dt; // cd_Picker.Date= cd_Picker.Date; } try { ptpicker.ItemsSource = App.paytermList.Select(x => x.name).ToList(); ptpicker.SelectedItem = item.payment_term; comgroup_picker.ItemsSource = App.commisiongroupList.Select(x => x.name).ToList(); comgroup_picker.SelectedItem = item.commission_group; } catch { await DisplayAlert("Alert-3", "Please Try Again", "Ok"); } orderLineGrid_ol.IsVisible = false; discount_grid_ol.IsVisible = false; taxlistviewGrid_ol.IsVisible = false; addbtn_orderline.IsVisible = true; if (tap2_clicked == true) { addbtn_orderline.IsVisible = false; } } }; sq_editbtn.GestureRecognizers.Add(sq_editRecognizer); var addbtn_orderlineRecognizer = new TapGestureRecognizer(); addbtn_orderlineRecognizer.Tapped += (s, e) => { orderLineGrid_ol.IsVisible = true; discount_grid_ol.IsVisible = true; taxlistviewGrid_ol.IsVisible = true; addbtn_orderline.IsVisible = false; savebtn_layout.IsVisible = true; updatebtn.IsVisible = false; searchprod_ol.Text = ""; orderline_des_ol.Text = ""; up_ol.Text = ""; oqty_ol.Text = ""; add_new_orderline = true; taxlistviewGrid_ol.BackgroundColor = Color.FromHex("#F0EEEF"); taxStackLayout_ol.BackgroundColor = Color.FromHex("#F0EEEF"); taxListView_ol.BackgroundColor = Color.FromHex("#F0EEEF"); taxlistviewGrid_ol.Padding = new Thickness(15, 0, 0, 0); taxStackLayout_ol.Padding = new Thickness(15, 0, 0, 0); }; Add_OrderLineBtn.GestureRecognizers.Add(addbtn_orderlineRecognizer); var Addtax_lineImgRecognizer = new TapGestureRecognizer(); Addtax_lineImgRecognizer.Tapped += (s, e) => { // addtaxGrid.IsVisible = true; Addtax_line.IsVisible = false; Navigation.PushPopupAsync(new TaxSelectionPage()); }; Addtax_line.GestureRecognizers.Add(Addtax_lineImgRecognizer); var Addtax_lineImgRecognizer_ol = new TapGestureRecognizer(); Addtax_lineImgRecognizer_ol.Tapped += (s, e) => { // addtaxGrid.IsVisible = true; Addtax_line.IsVisible = false; Navigation.PushPopupAsync(new TaxSelectionPage("tax_new")); }; Addtax_line_ol.GestureRecognizers.Add(Addtax_lineImgRecognizer_ol); }
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)); }