public SupplyOfferAddViewModel()
 {
     _currentWindow      = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
     _categoriesDialog   = new CategoriesShowDialog();
     Clients             = new ObservableCollection <Client>(_clientServ.GetClients());
     NewSupplyOffer.Date = DateTime.Now;
 }
 public SupplyOfferUpdateViewModel()
 {
     _currentWindow         = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
     _categoriesDialog      = new CategoriesShowDialog();
     _supplyOfferCategories = new ObservableCollection <SupplyOfferCategoryVM>(_supplyOfferCategoryServ.GetSupplyOfferCategories(ID));
     Clients = new ObservableCollection <Client>(_clientServ.GetClients());
     _selectedSupplyOffer = _supplyOfferServ.GetSupplyOffer(ID);
 }
 public SupplyAddViewModel()
 {
     _currentWindow       = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
     _categoriesDialog    = new CategoriesShowDialog();
     _categoryDialog      = new SupplyCategoryInfromationDialog();
     Clients              = new ObservableCollection <Client>(_clientServ.GetClients());
     NewSupply.Date       = DateTime.Now;
     PlacesSuggestions    = _supplyFutureServ.GetPlacesSuggetions();
     NewSupplyFuture.Date = DateTime.Now;
 }
 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));
 }
        public SupplyUpdateViewModel()
        {
            _safeServ           = new SafeServices();
            _supplyServ         = new SupplyServices();
            _categoryServ       = new CategoryServices();
            _clientAccountServ  = new ClientAccountServices();
            _supplyCategoryServ = new SupplyCategoryServices();
            _categoriesDialog   = new CategoriesShowDialog();

            _currentWindow    = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
            _supplyCategories = new ObservableCollection <SupplyCategoryVM>(_supplyCategoryServ.GetSupplyCategoriesVM(ID));
            _selectedSupply   = _supplyServ.GetSupply(ID);
        }
Example #7
0
 public SupplyUpdateViewModel()
 {
     _currentWindow        = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
     _categoriesDialog     = new CategoriesShowDialog();
     _categoryDialog       = new SupplyCategoryInfromationDialog();
     _supplyCategories     = new ObservableCollection <SupplyCategoryVM>(_supplyCategoryServ.GetSupplyCategoriesVM(ID));
     _selectedSupply       = _supplyServ.GetSupply(ID);
     _selectedSupplyFuture = _supplyFutureServ.GetSupplyFuture(ID);
     if (SelectedSupplyFuture == null)
     {
         SelectedSupplyFuture      = new SupplyFuture();
         SelectedSupplyFuture.Date = DateTime.Now;
     }
     PlacesSuggestions = _supplyFutureServ.GetPlacesSuggetions();
 }
Example #8
0
        public SupplyOfferConvertViewModel()
        {
            _currentWindow       = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
            _categoriesDialog    = new CategoriesShowDialog();
            _categoryDialog      = new SupplyCategoryInfromationDialog();
            Clients              = new ObservableCollection <Client>(_clientServ.GetClients());
            NewSupply.Date       = DateTime.Now;
            PlacesSuggestions    = _supplyFutureServ.GetPlacesSuggetions();
            NewSupplyFuture.Date = DateTime.Now;

            var supplyOffer = _supplyOfferServ.GetSupplyOffer(ID);

            NewSupply.ClientID = supplyOffer.ClientID;

            var supplyOfferCategories = _supplyOfferCategoryServ.GetSupplyOfferCategories(ID);

            foreach (var item in supplyOfferCategories)
            {
                var cat = _categoryServ.GetCategory(item.CategoryID);
                _supplyCategories.Add(new SupplyCategoryVM
                {
                    Category           = item.Category,
                    CategoryID         = item.CategoryID,
                    Company            = item.Company,
                    Discount           = item.Discount,
                    DiscountValue      = item.DiscountValue,
                    DiscountValueTotal = item.DiscountValueTotal,
                    Price                  = cat.Price,
                    Qty                    = item.Qty,
                    Cost                   = cat.Cost,
                    CostTotal              = item.CostTotal,
                    CostAfterDiscount      = item.CostAfterDiscount,
                    CostAfterTax           = item.CostAfterTax,
                    CostTotalAfterDiscount = item.CostTotalAfterDiscount,
                    CostTotalAfterTax      = item.CostTotalAfterTax,
                    Tax                    = item.Tax,
                    TaxValue               = item.TaxValue,
                    TaxValueTotal          = item.TaxValueTotal
                });
            }
            NewSupply.Cost          = SupplyCategories.Sum(s => s.CostTotal);
            NewSupply.CostAfterTax  = SupplyCategories.Sum(s => s.CostTotalAfterTax);
            NewSupply.TotalDiscount = SupplyCategories.Sum(s => s.DiscountValueTotal);
            NewSupply.OldDebt       = _clientAccountServ.GetClientAccount(supplyOffer.Client.ID) + supplyOffer.Client.AccountStart;
        }
Example #9
0
        public SupplyAddViewModel()
        {
            _safeServ           = new SafeServices();
            _supplyServ         = new SupplyServices();
            _clientServ         = new ClientServices();
            _categoryServ       = new CategoryServices();
            _clientAccountServ  = new ClientAccountServices();
            _supplyCategoryServ = new SupplyCategoryServices();
            _categoriesDialog   = new CategoriesShowDialog();
            _supplyCategories   = new ObservableCollection <SupplyCategoryVM>();
            _newSupply          = new Supply();

            _key           = "";
            _isFocused     = true;
            _currentWindow = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault();
            Clients        = new ObservableCollection <Client>(_clientServ.GetClients());
            NewSupply.Date = DateTime.Now;
        }
Example #10
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));
        }
Example #12
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         = "تقرير الفاتورة";
        }