public PurchaseQuotationViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) { this.regionManager = regionManager; this.eventAggregator = eventAggregator; Mouse.OverrideCursor = Cursors.Wait; ConvertToPOCommand = new RelayCommand(ConvertToPurchaseOrder, CanConvertToPO); ConvertToPICommand = new RelayCommand(ConvertToPurchaseInvoice, CanConvertToPI); SaveCommand = new RelayCommand(SavePurchaseQuotation, CanSave); SupplierSelectionChangedCommand = new RelayCommand(OnSupplierChange); NewPQCommand = new RelayCommand(OnNewPQ); DuplicateCommand = new RelayCommand(OnDuplicatePQ, CanDuplicate); IncludeTaxCheckedCommand = new RelayCommand(OnIncludeTax); ExcludeTaxCheckedCommand = new RelayCommand(OnExcludeTax); DeleteCommand = new RelayCommand(OnDeletePQ, CanDeletePQ); NavigateToClientCommand = new RelayCommand(NavigatetoSupplier, CanNavigate); PurchaseQuotationEntity = new PurchaseQuotationEntity(); PQDetailsEntity = new ObservableCollection <DataGridViewModel>(); int minHeight = 300; int headerRows = 339;//180+40+30+10; var height = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 85; bool validHeight = int.TryParse(height.ToString(), out minHeight); this.PQFormGridHeight = minHeight; #region getting Options details GetOptionsData(); #endregion AllFieldsEnabled = true; AllFieldsReadonly = false; this.QuotationDate = DateTime.Now.Date; LoadSupplierBackground(); //ProductList = pandsRepository.GetAllPandS().OrderBy(e => e.PSName); //ProductAndServices = new ObservableCollection<PandSDetailsModel>(ProductList); ProductList = pandsRepository.GetPandSComboList(); ProductAndServices = new ObservableCollection <PandSListModel>(ProductList).OrderBy(x => x.PSName).ToObservable(); if (!String.IsNullOrEmpty(SharedValues.NewClick)) { if (SharedValues.NewClick != "New") { SupplierEnabled = false; GetPurchaseQuotation(SharedValues.NewClick); } else if (SharedValues.NewClick == "New") { SupplierEnabled = true; GetNewPQ(); } } Mouse.OverrideCursor = null; }
/// <summary> /// This method is used to get new PQ /// </summary> public void GetNewPQ() { IsNew = true; ID = 0; SelectedSupplierID = 0; BillToAddress = string.Empty; ShipToAddress = string.Empty; ValidForDays = 0; QuotationNo = GenerateNewQuotationNo(); TermsAndConditions = TandC; QuotationDate = DateTime.Now.Date; TotalBeforeTax = 0; TotalTax = 0; TotalAfterTax = 0; TotalBeforeTaxStr = Convert.ToString(0); TotalTaxStr = Convert.ToString(0); TotalAfterTaxStr = Convert.ToString(0); PQErrors = string.Empty; AllFieldsEnabled = true; SupplierEnabled = true; AllFieldsReadonly = false; PurchaseQuotationEntity = new PurchaseQuotationEntity(); PQDetailsEntity.Clear(); LstSuppliers = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList(); ProductAndServices = ProductAndServices.OrderBy(x => x.PSName).Where(x => x.IsInActive == "N").ToObservable(); // PQDetailsEntity = new ObservableCollection<DataGridViewModel>(); var row = new DataGridViewModel(ProductList.Where(x => x.IsInActive == "N").ToList()); //row.PQQty = 1; //row.PQDiscount = 0; //row.GSTRateStr = Convert.ToString(TaxRate) + "%"; //row.GSTRate = TaxRate; PQDetailsEntity.Add(row); OnPropertyChanged("PQDetailsEntity"); var lstOptions = pandsRepository.GetOptionDetails(); bool?tax = lstOptions.ShowAmountIncGST; if (tax == true) { ExcludingTax = false; IncludingTax = true; } else { IncludingTax = false; ExcludingTax = true; } }
public PurchaseQuotationForm GetDataIntoModel() { PurchaseQuotationForm PQForm = new PurchaseQuotationForm(); PQForm.QuotationDetails = new List <PurchaseQuotationDetailEntity>(); PurchaseQuotationEntity model = new PurchaseQuotationEntity(); model.QuotationNo = this.QuotationNo; model.QuotationDate = this.QuotationDate; model.TotalBeforeTax = this.TotalBeforeTax; model.TotalTax = this.TotalTax; model.TotalAfterTax = this.TotalAfterTax; model.ValidForDays = this.ValidForDays; model.SupplierID = this.SelectedSupplierID; model.TermsAndConditions = this.TermsAndConditions; if (ExcludingTax == true) { model.ExcIncGST = false; } else { model.ExcIncGST = true; } PQForm.Quotation = model; foreach (var item in PQDetailsEntity) { PurchaseQuotationDetailEntity pqEntity = new PurchaseQuotationDetailEntity(); pqEntity.PQNo = Convert.ToString(item.SelectedPSID); pqEntity.PandSCode = item.PandSCode; pqEntity.PandSName = item.PandSName; pqEntity.PQQty = item.PQQty; pqEntity.PQPrice = item.PQPrice; pqEntity.PQDiscount = item.PQDiscount; pqEntity.GSTRate = item.GSTRate; pqEntity.GSTRateStr = Convert.ToString(item.GSTRate) + "%"; pqEntity.PQAmount = item.PQAmount; if (item.SelectedPSID != null && Convert.ToInt32(item.SelectedPSID) > 0) { PQForm.QuotationDetails.Add(pqEntity); } } return(PQForm); }