示例#1
0
        public List <ProductCurrentStockProvider> GetAll()
        {
            var dataAccess = new ProductCurrentStockDataAccess();

            try
            {
                var     pcsReportList = new List <ProductCurrentStockProvider>();
                var     dt            = dataAccess.GetAll(this);
                decimal totalQuantity = 0;
                bool    first         = true;
                if (dt != null)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        var productCurrentStockProvider = new ProductCurrentStockProvider
                        {
                            FromDate          = FromDate,
                            Todate            = Todate,
                            DeliveryChallanNo = row["DeliveryChallanNo"].ToString(),

                            TransactionDate   = row["TransactionDate"].ToString(),
                            BatchNo           = row["BatchNo"].ToString(),
                            ProductID         = int.Parse(row["ProductID"].ToString()),
                            ProductName       = row["ProductName"].ToString(),
                            SupplierName      = row["SupplierName"].ToString(),
                            StockInQunatity   = decimal.Parse(row["StockInQunatity"].ToString()),
                            StockOutQuantity  = decimal.Parse(row["StockOutQuantity"].ToString()),
                            BrokenOrDamageQty = decimal.Parse(row["BrokenOrDamageQty"].ToString()),
                            OtherOutQty       = decimal.Parse(row["OtherOutQty"].ToString()),
                            OtherReceive      = decimal.Parse(row["OtherReceive"].ToString()),
                            ClosingQuantity   = decimal.Parse(row["ClosingQuantity"].ToString())
                        };
                        if (first)
                        {
                            productCurrentStockProvider.Unit = (row["Unit"].ToString());

                            productCurrentStockProvider.OpeningQuantity = decimal.Parse(row["OpeningQuantity"].ToString());
                            productCurrentStockProvider.ClosingQuantity = decimal.Parse(row["OpeningQuantity"].ToString());
                            totalQuantity = decimal.Parse(row["OpeningQuantity"].ToString());
                            first         = false;
                        }
                        else
                        {
                            productCurrentStockProvider.OpeningQuantity = totalQuantity;

                            totalQuantity = productCurrentStockProvider.OpeningQuantity + productCurrentStockProvider.ClosingQuantity;
                            productCurrentStockProvider.ClosingQuantity = totalQuantity;
                        }
                        pcsReportList.Add(productCurrentStockProvider);
                    }
                }
                return(pcsReportList);
            }
            catch (Exception exp)
            {
                throw new Exception(exp.Message);
            }
        }
示例#2
0
        public DataTable GetDivisionAndItemwise()
        {
            var dataAccess = new ProductCurrentStockDataAccess();

            return(dataAccess.GetDivisionAndItemwise(this));
        }