Esempio n. 1
0
        public void GenerateAutomaticInventory()
        {
            var ethDate = new EthiopianDate.EthiopianDate();

            if (InventoryRequired(false))
            {
                Stores stores = new Stores();
                stores.GetActiveStores();
                while (!stores.EOF) //This needs to be done for each store
                {
                    if (!DoesBalanceExist(ethDate.Year, stores.ID, true))
                    //If Inventory information hasn't already been filled for this store
                    {
                        var itm = new Items();

                        //bereket
                        //itm.ExcludeNeverReceivedItemsNoCategory(stores.ID);
                        itm.ExcludeNeverReceivedItemsNoCategoryOptimized(stores.ID, ethDate.Year);
                        while (!itm.EOF) //For each time
                        {
                            var yearEnd = new YearEnd();
                            var balance = new Balance();

                            yearEnd.LoadByItemIDStoreAndYear(itm.ID, stores.ID, ethDate.Year, true);

                            if (yearEnd.RowCount > 0)
                            {
                                return;
                            }

                            //YearEnd.PurgeAutomaticallyEnteredInventory(itm.ID, stores.ID, ethDate.Year);
                            yearEnd.AddNew();
                            yearEnd.ItemID  = itm.ID;
                            yearEnd.StoreID = stores.ID;
                            yearEnd.Year    = ethDate.Year;

                            //bereket
                            //yearEnd.EBalance = balance.GetSOH(itm.ID, stores.ID, 10, ethDate.Year);
                            yearEnd.EBalance             = balance.GetSOHOptimized(itm.ID, stores.ID, 10, ethDate.Year);
                            yearEnd.PhysicalInventory    = yearEnd.EBalance;
                            yearEnd.AutomaticallyEntered = true;
                            yearEnd.UnitID = 0;
                            yearEnd.Save();
                            itm.MoveNext();
                        }
                    }
                    stores.MoveNext();
                }
            }
        }
        public void GenerateAutomaticInventory()
        {
            var ethDate = new EthiopianDate.EthiopianDate();
            if (InventoryRequired(false))
            {
                Stores stores = new Stores();
                stores.GetActiveStores();
                while (!stores.EOF) //This needs to be done for each store
                {
                  if (!DoesBalanceExist(ethDate.Year, stores.ID, true))
                        //If Inventory information hasn't already been filled for this store
                    {
                        var itm = new Items();

                      //bereket
                      //itm.ExcludeNeverReceivedItemsNoCategory(stores.ID);
                        itm.ExcludeNeverReceivedItemsNoCategoryOptimized(stores.ID, ethDate.Year);
                        while (!itm.EOF) //For each time
                        {
                            var yearEnd = new YearEnd();
                            var balance = new Balance();

                            yearEnd.LoadByItemIDStoreAndYear(itm.ID, stores.ID, ethDate.Year, true);

                            if (yearEnd.RowCount > 0)
                            {
                                return;
                            }

                            //YearEnd.PurgeAutomaticallyEnteredInventory(itm.ID, stores.ID, ethDate.Year);
                            yearEnd.AddNew();
                            yearEnd.ItemID = itm.ID;
                            yearEnd.StoreID = stores.ID;
                            yearEnd.Year = ethDate.Year;

                            //bereket
                            //yearEnd.EBalance = balance.GetSOH(itm.ID, stores.ID, 10, ethDate.Year);
                            yearEnd.EBalance = balance.GetSOHOptimized(itm.ID, stores.ID, 10, ethDate.Year);
                            yearEnd.PhysicalInventory = yearEnd.EBalance;
                            yearEnd.AutomaticallyEntered = true;
                            yearEnd.UnitID = 0;
                            yearEnd.Save();
                            itm.MoveNext();
                        }
                    }
                    stores.MoveNext();
                }

            }
        }