public SaleAddViewModel()
 {
     _currentWindow    = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
     _categoriesDialog = new CategoriesShowDialog();
     _categoryDialog   = new SaleCategoryInfromationDialog();
     Clients           = new ObservableCollection <Client>(_clientServ.GetClients());
     Salespersons      = new ObservableCollection <Salesperson>(_salespersonServ.GetSalespersons());
     NewSale.Date      = DateTime.Now;
     Report            = "تقرير الفاتورة";
     currencies.Add(new CurrencyInfo(CurrencyInfo.Currencies.Egypt));
 }
 public SaleUpdateViewModel()
 {
     _currentWindow    = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
     _categoriesDialog = new CategoriesShowDialog();
     _categoryDialog   = new SaleCategoryInfromationDialog();
     Salespersons      = new ObservableCollection <Salesperson>(_salespersonServ.GetSalespersons());
     _selectedSale     = _saleServ.GetSale(ID);
     _saleCategories   = new ObservableCollection <SaleCategoryVM>(_saleCategoryServ.GetSaleCategoriesVM(ID));
     Report            = "تقرير الفاتورة";
     currencies.Add(new CurrencyInfo(CurrencyInfo.Currencies.Egypt));
 }
Exemple #3
0
        public SaleUpdateViewModel()
        {
            _safeServ          = new SafeServices();
            _saleServ          = new SaleServices();
            _clientServ        = new ClientServices();
            _categoryServ      = new CategoryServices();
            _salespersonServ   = new SalespersonServices();
            _saleCategoryServ  = new SaleCategoryServices();
            _clientAccountServ = new ClientAccountServices();
            _categoriesDialog  = new CategoriesShowDialog();
            _currentWindow     = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();

            _key            = "";
            _isFocused      = true;
            _selectedSale   = _saleServ.GetSale(ID);
            Salespersons    = new ObservableCollection <Salesperson>(_salespersonServ.GetSalespersons());
            _saleCategories = new ObservableCollection <SaleCategoryVM>(_saleCategoryServ.GetSaleCategoriesVM(ID));
            Report          = "تقرير الفاتورة";
        }
        public SaleOfferConvertViewModel()
        {
            _currentWindow    = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
            _categoriesDialog = new CategoriesShowDialog();
            _categoryDialog   = new SaleCategoryInfromationDialog();
            Clients           = new ObservableCollection <Client>(_clientServ.GetClients());
            Salespersons      = new ObservableCollection <Salesperson>(_salespersonServ.GetSalespersons());
            NewSale.Date      = DateTime.Now;
            var saleOffer = _saleOfferServ.GetSaleOffer(ID);

            NewSale.ClientID = saleOffer.ClientID;

            var saleOfferCategories = _saleOfferCategoryServ.GetSaleOfferCategories(ID);

            foreach (var item in saleOfferCategories)
            {
                var cat = _categoryServ.GetCategory(item.CategoryID);
                _saleCategories.Add(new SaleCategoryVM
                {
                    Category           = item.Category,
                    CategoryID         = item.CategoryID,
                    Company            = item.Company,
                    Discount           = item.Discount,
                    DiscountValue      = item.DiscountValue,
                    DiscountValueTotal = item.DiscountValueTotal,
                    Price = item.Price,
                    PriceAfterDiscount      = item.PriceAfterDiscount,
                    PriceTotal              = item.PriceTotal,
                    PriceTotalAfterDiscount = item.PriceTotalAfterDiscount,
                    Qty       = item.Qty,
                    Cost      = cat.Cost,
                    CostTotal = cat.Cost * item.Qty
                });
            }
            NewSale.Cost = SaleCategories.Sum(s => s.CostTotal);
            NewSale.PriceAfterDiscount = SaleCategories.Sum(s => s.PriceTotalAfterDiscount);
            NewSale.Price   = SaleCategories.Sum(s => s.PriceTotal);
            NewSale.OldDebt = _clientAccountServ.GetClientAccount(saleOffer.Client.ID) + saleOffer.Client.AccountStart;
            Report          = "تقرير الفاتورة";
            currencies.Add(new CurrencyInfo(CurrencyInfo.Currencies.Egypt));
        }
Exemple #5
0
        public SaleAddViewModel()
        {
            _safeServ          = new SafeServices();
            _saleServ          = new SaleServices();
            _clientServ        = new ClientServices();
            _categoryServ      = new CategoryServices();
            _salespersonServ   = new SalespersonServices();
            _saleCategoryServ  = new SaleCategoryServices();
            _clientAccountServ = new ClientAccountServices();
            _newSale           = new Sale();
            _categoriesDialog  = new CategoriesShowDialog();
            _saleCategories    = new ObservableCollection <SaleCategoryVM>();

            _key           = "";
            _isFocused     = true;
            _currentWindow = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
            Clients        = new ObservableCollection <Client>(_clientServ.GetClients());
            Salespersons   = new ObservableCollection <Salesperson>(_salespersonServ.GetSalespersons());
            NewSale.Date   = DateTime.Now;
            Report         = "تقرير الفاتورة";
        }