Esempio n. 1
0
        public List <ProductDetail> GetProductByDate(string fromDate, string toDate, int ProductId, int StockTransactionId)
        {
            DBSite site = new DBSite();
            List <ProductDetail> product_detail_list = new List <ProductDetail>();

            if (fromDate == null)
            {
                fromDate = "2013/09/01";
            }
            if (toDate == null)
            {
                toDate = "2014/09/01";
            }


            DateTime fDt = DateTime.Parse(fromDate);
            DateTime tDt = DateTime.Parse(toDate);

            DataTable dt = site.Execute_sp_productLedger(ProductId, StockTransactionId, -1, fDt, tDt, Util_BLL.User.UserId, 2012);

            DataRow row = null;

            ProductDetail product;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                product = new ProductDetail();

                row = dt.Rows[i];

                product.ProductLedgerId = util.CheckNullInt(row["ProductLedgerNumber"]);
                product.ProductId       = util.CheckNullInt(row["ProductId"]);
                product.ProductName     = row["ProductName"].ToString();


                product.LocationName = util.CheckNull(row["Location"]);


                product.AccountName = util.CheckNull(row["AccountName"]);

                product.sold_qty   = util.CheckNullDouble(row["credit"]);
                product.bought_qty = util.CheckNullDouble(row["debit"]);

                product.openingBalance = util.CheckNullDouble(row["openingBalance"]);
                product.closingBalance = util.CheckNullDouble(row["runningBalance"]);


                //666

                DateTime date = Convert.ToDateTime(row["BillDate"]);
                product.MovementDate      = date.ToShortDateString();
                product.TransactionTypeId = util.CheckNullInt(row["SourceId"]);
                product.TransactionName   = util.CheckNull(row["TransactionName"]);
                product.Narration         = util.CheckNull(row["Particulars"]);


                product_detail_list.Add(product);
            }


            return(product_detail_list);
        }