예제 #1
0
        public void GetNewCountAndAdjustStock(object param)
        {
            this.StockCountNo       = "SC-" + casRepository.GetLatestStockCountNo();
            IsIncreaseDecreaseStock = true;
            IsStockDamaged          = false;
            IsStockTake             = false;
            IsNew             = true;
            AdjustedAmountStr = Convert.ToString(0);
            if (PSDetailsEntity != null)
            {
                if (PSDetailsEntity.Count > 0)
                {
                    PSDetailsEntity.Clear();
                    // var row = new CollectAmountDataGridViewModel();
                    //  PQDetailsEntity.Add(row);
                    OnPropertyChanged("PSDetailsEntity");
                }
            }
            var row = new DataGridViewModel(ProductList);

            //row.CountQty = 0;
            PSDetailsEntity.Add(row);
            OnPropertyChanged("PSDetailsEntity");
            Lst = PSDetailsEntity;
        }
예제 #2
0
        public void GetCountAndAdjustStock(string scNo)
        {
            // Mouse.OverrideCursor = Cursors.Wait;
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData = purchaseRepository.GetOptionSettings();
            CountAndAdjustStockForm pqf = casRepository.GetCountAndAdjustStock(scNo);

            this.StockCountNo = pqf.CountAndAdjustStock.StockCountNo;
            DateTime Dateinstr = (DateTime)pqf.CountAndAdjustStock.StockDate;

            this.StockDateStr = Dateinstr.ToString(oData.DateFormat);

            if (pqf.CountAndAdjustStock.Type == Convert.ToInt16(Stock_Type.IncreaseDecreaseStock))
            {
                IsIncreaseDecreaseStock = true;
                IsStockDamaged          = false;
                IsStockTake             = false;
                SharedValues.StockType  = Convert.ToInt16(Stock_Type.IncreaseDecreaseStock);
            }
            else if (pqf.CountAndAdjustStock.Type == Convert.ToInt16(Stock_Type.StockDamaged))
            {
                IsIncreaseDecreaseStock = false;
                IsStockDamaged          = true;
                IsStockTake             = false;
                SharedValues.StockType  = Convert.ToInt16(Stock_Type.StockDamaged);
            }
            else if (pqf.CountAndAdjustStock.Type == Convert.ToInt16(Stock_Type.StockTake))
            {
                IsIncreaseDecreaseStock = false;
                IsStockDamaged          = false;
                IsStockTake             = true;
                SharedValues.StockType  = Convert.ToInt16(Stock_Type.StockTake);
            }

            this.PSDetailsEntity = new ObservableCollection <DataGridViewModel>();
            foreach (var item in pqf.CountAndAdjustStockDetails)
            {
                DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                pqEntity.SelectedPSID = item.PSID;
                pqEntity.PandSCode    = item.PandSCode;
                pqEntity.PandSName    = item.PandSName;
                pqEntity.SystemQty    = item.SystemQty;
                pqEntity.CountQty     = item.CountQty;
                pqEntity.Difference   = item.Difference;

                pqEntity.AvgCost   = Convert.ToString(item.AverageCost);
                pqEntity.Amount    = item.Amount;
                pqEntity.AmountStr = item.AmountStr;

                PSDetailsEntity.Add(pqEntity);
            }
        }
예제 #3
0
        public void GetCountAndAdjustStock(string scNo)
        {
            // Mouse.OverrideCursor = Cursors.Wait;
            CountAndAdjustStockForm pqf = casRepository.GetCountAndAdjustStock(scNo);

            this.StockCountNo = pqf.CountAndAdjustStock.StockCountNo;
            this.StockDate    = pqf.CountAndAdjustStock.StockDate;

            if (pqf.CountAndAdjustStock.Type == Convert.ToInt16(Stock_Type.IncreaseDecreaseStock))
            {
                IsIncreaseDecreaseStock = true;
                IsStockDamaged          = false;
                IsStockTake             = false;
            }
            else if (pqf.CountAndAdjustStock.Type == Convert.ToInt16(Stock_Type.StockDamaged))
            {
                IsIncreaseDecreaseStock = false;
                IsStockDamaged          = true;
                IsStockTake             = false;
            }
            else if (pqf.CountAndAdjustStock.Type == Convert.ToInt16(Stock_Type.StockTake))
            {
                IsIncreaseDecreaseStock = false;
                IsStockDamaged          = false;
                IsStockTake             = true;
            }

            this.PSDetailsEntity = new ObservableCollection <DataGridViewModel>();
            foreach (var item in pqf.CountAndAdjustStockDetails)
            {
                DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                pqEntity.SelectedPSID = item.PSID;
                pqEntity.PandSCode    = item.PandSCode;
                pqEntity.PandSName    = item.PandSName;
                pqEntity.SystemQty    = item.SystemQty;
                pqEntity.CountQty     = item.CountQty;
                pqEntity.Difference   = item.Difference;

                pqEntity.AvgCost   = Convert.ToString(item.AverageCost);
                pqEntity.Amount    = item.Amount;
                pqEntity.AmountStr = item.AmountStr;

                PSDetailsEntity.Add(pqEntity);
            }
        }
예제 #4
0
        public int ManageDuplicatePandS()
        {
            int rowFocusindex = -1;

            ShowAllCount = PSDetailsEntity.Where(e => e.SelectedPSID != 0).Count();
            lst          = new ObservableCollection <DataGridViewModel>();
            lst          = PSDetailsEntity;

            var query = lst.GroupBy(x => x.SelectedPSID)
                        .Where(g => g.Count() > 1)
                        .ToList();

            if (query.Count > 0 && PSDetailsEntity.Count > 1)
            {
                var     obj1           = query[0].ElementAt(0);
                var     obj2           = query[0].ElementAt(1);
                int?    qty            = 1;
                decimal?productAmount2 = 0;
                // decimal? discountP2 = 0;
                qty            = query[0].ElementAt(0).CountQty + query[0].ElementAt(1).CountQty;
                productAmount2 = Convert.ToDecimal(query[0].ElementAt(1).Amount);
                // discountP2 = query[0].ElementAt(1).PQDiscount;

                var index1 = lst.IndexOf(query[0].ElementAt(0));
                var index2 = lst.IndexOf(query[0].ElementAt(1));

                if (productAmount2 != null)
                {
                    obj1.CountQty  = qty;
                    obj1.AmountStr = Convert.ToString(productAmount2);
                    // obj1.PQDiscount = discountP2;
                    PSDetailsEntity[index1] = obj1;
                    var row = new DataGridViewModel(ProductList);
                    //row.CountQty = 0;

                    PSDetailsEntity[index2] = row;
                    rowFocusindex           = index2;
                }


                OnPropertyChanged("PSDetailsEntity");
                Lst = PSDetailsEntity;
            }
            else
            {
                int count = PSDetailsEntity.Count(x => x.SelectedPSID == 0);
                if (count == 0)
                {
                    var row = new DataGridViewModel(ProductList);
                    // row.CountQty = 0;
                    //   row.GSTRate = TaxRate;

                    PSDetailsEntity.Add(row);
                    OnPropertyChanged("PSDetailsEntity");
                    Lst           = PSDetailsEntity;
                    rowFocusindex = -1;
                }
                else
                {
                    var emptyRow = lst.Where(y => y.SelectedPSID == 0).FirstOrDefault();
                    rowFocusindex = PSDetailsEntity.IndexOf(emptyRow);
                }
            }
            AdjustedAmountStr = Convert.ToString(PSDetailsEntity.Sum(e => e.Amount));
            return(rowFocusindex);
        }