public static DataView GetStockCardByWarehouse(int storeId, int itemId, int? unitID, int fiscalYear, int physicalStoreTypeID,int manufactuerID)
        {
            var ld = new ListDictionary();
            ld.Add("@ItemID", itemId);
            ld.Add("@UnitID", unitID);
            ld.Add("@StoreID", storeId);
            ld.Add("@FiscalYear", fiscalYear);
            ld.Add("@Warehouse", physicalStoreTypeID);
            ld.Add("@Manufacturer",manufactuerID);

            Balance bal = new Balance();
            bal.LoadFromSql("[Rpt_StockCard]", ld, CommandType.StoredProcedure);

            bal.Rewind();
            decimal Balance = 0;
            while (!bal.EOF)
            {
                Balance += Convert.ToDecimal(bal.GetColumn("Balance"));
                bal.SetColumn("Balance", Balance);
                bal.MoveNext();
            }
            return bal.DefaultView;
        }
        public static DataView GetStockCardByDate(int storeId, int itemId, int? unitID, int physicalStoreTypeID, int manufactuerID, DateTime fromDate, DateTime toDate)
        {
            var ld = new ListDictionary();
            ld.Add("@ItemID", itemId);
            ld.Add("@UnitID", unitID);
            ld.Add("@StoreID", storeId);
            ld.Add("@fromdate", fromDate);
            ld.Add("@toDate", toDate);
            ld.Add("@Warehouse", physicalStoreTypeID);
            ld.Add("@Manufacturer", manufactuerID);
            Balance bal = new Balance();
            bal.LoadFromSql("[Rpt_StockCardByDate]", ld, CommandType.StoredProcedure);

            bal.Rewind();
            int Balance = 0;
            while (!bal.EOF)
            {
                Balance += Convert.ToInt32(bal.GetColumn("Balance"));
                bal.SetColumn("Balance", Balance);
                bal.MoveNext();
            }
            return bal.DefaultView;
        }
        /// <summary>
        /// Gets bin card by supplier
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="supplierId"></param>
        /// <returns></returns>
        public static DataView GetBinCard(int storeId, int itemId, int? unitID, int fiscalYear, int supplierId)
        {
            var ld = new ListDictionary();
            ld.Add("@ItemID", itemId);
            ld.Add("@UnitID", unitID);
            ld.Add("@StoreID", storeId);
            ld.Add("@FiscalYear", fiscalYear);
            ld.Add("@SupplierID", supplierId);

            Balance bal = new Balance();
            bal.LoadFromSql("Rpt_BinCardBySupplier", ld, CommandType.StoredProcedure);

            bal.Rewind();
            int Balance = 0;
            while (!bal.EOF)
            {
                Balance += Convert.ToInt32(bal.GetColumn("Balance"));
                bal.SetColumn("Balance", Balance);
                bal.MoveNext();
            }
            return bal.DefaultView;
        }
        /// <summary>
        /// Gets the soh for all items by ware house.
        /// </summary>
        /// <param name="storeId">The store id.</param>
        /// <param name="year">The year.</param>
        /// <param name="month">The month.</param>
        /// <param name="WarehouseID">The warehouse ID.</param>
        /// <returns></returns>
        public static DataTable GetSohForAllItemsByWareHouse(int storeId, int year, int month,int WarehouseID)
        {
            // this has to return the balance of all item as the name discribes
            // this is there fore working based on the stock on hand STORED procedure, if  the stored procedure for some reason threw an error

            Balance bal = new Balance();
            //HACK: Pagume
            //TO FIX: Date needs to be handled correctly
            if (month == 13)
            {
                year++;
                month = 1;
            }
            ListDictionary ld = new ListDictionary
                                    {
                                        {"@storeid", storeId},
                                        {"@WarehouseID", WarehouseID},
                                        {"@month", month},
                                        {"@year", year},
                                        {"@days", DateTime.DaysInMonth(year, month)}
                                    };

            bal.LoadFromSql("SOHByWarehouse", ld, CommandType.StoredProcedure);
            return bal.DataTable;
        }
        /// <summary>
        /// Gets stock on hand categoriezed by supplier
        /// </summary>
        /// <param name="storeId"></param>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <returns></returns>
        public static DataTable GetBalanceBySupplierId(int storeId, int year, int month)
        {
            // this has to return the balance of all item as the name discribes
            // this is there fore working based on the stock on hand STORED procedure, if  the stored procedure for some reason threw an error
            Balance bal = new Balance();
            ListDictionary ld = new ListDictionary();
            ld.Add("@storeid", storeId);
            ld.Add("@month", month);
            ld.Add("@year", year);
            ld.Add("@days", DateTime.DaysInMonth(year, month));

            bal.LoadFromSql("SOHBySupplier", ld, CommandType.StoredProcedure);
            return bal.DataTable;
        }