private ItemOrder MapItemOrder(DbDataReader dr)
        {
            ItemOrder itemOrder = new ItemOrder();

            itemOrder.OrderId     = NullHandler.GetString(dr["OrderId"]);
            itemOrder.SrId        = NullHandler.GetString(dr["SrId"]);
            itemOrder.MarketId    = NullHandler.GetString(dr["MarketId"]);
            itemOrder.OrderDate   = NullHandler.GetDateTime(dr["Date"]);
            itemOrder.OrderCount  = NullHandler.GetInt32(dr["OrderCount"]);
            itemOrder.ReturnCount = NullHandler.GetInt32(dr["ReturnCount"]);
            itemOrder.DamageCount = NullHandler.GetInt32(dr["DamagedCount"]);
            itemOrder.SellsCount  = NullHandler.GetInt32(dr["SoldCount"]);


            itemOrder.CompanyId   = NullHandler.GetString(dr["CompanyId"]);
            itemOrder.ItemId      = NullHandler.GetString(dr["ItemId"]);
            itemOrder.ItemName    = NullHandler.GetString(dr["ItemName"]);
            itemOrder.CountPerBox = NullHandler.GetInt32(dr["CountPerBox"]);
            itemOrder.Price       = NullHandler.GetDouble(dr["Price"]);
            itemOrder.TotalPrice  = Math.Round(itemOrder.Price * itemOrder.SellsCount, 2);

            itemOrder.StockId                  = NullHandler.GetString(dr["StockId"]);
            itemOrder.CurrentStockTotal        = NullHandler.GetInt32(dr["TotalStock"]);
            itemOrder.CurrentDamagedStockTotal = NullHandler.GetInt32(dr["DamagedStock"]);
            itemOrder.ChalanNo                 = NullHandler.GetString(dr["ChalanNo"]);
            itemOrder.StockEntryDate           = NullHandler.GetDateTime(dr["StockEntryDate"]);

            itemOrder.CalculateBoxesFromTotalStock();
            itemOrder.CalculateOrdersInBox();

            return(itemOrder);
        }
        private ItemOrder MapItemOrderTemplate(DbDataReader dr)
        {
            ItemOrder itemOrderTemplate = new ItemOrder();

            itemOrderTemplate.OrderId   = string.Empty;
            itemOrderTemplate.SrId      = string.Empty;
            itemOrderTemplate.MarketId  = string.Empty;
            itemOrderTemplate.OrderDate = DateTime.Now;

            itemOrderTemplate.OrderCount      = 0;
            itemOrderTemplate.OrderBoxCount   = 0;
            itemOrderTemplate.OrderExtraCount = 0;

            itemOrderTemplate.ReturnCount      = 0;
            itemOrderTemplate.ReturnBoxCount   = 0;
            itemOrderTemplate.ReturnExtraCount = 0;

            itemOrderTemplate.DamageCount      = 0;
            itemOrderTemplate.DamageBoxCount   = 0;
            itemOrderTemplate.DamageExtraCount = 0;

            itemOrderTemplate.SellsCount      = 0;
            itemOrderTemplate.SellsBoxCount   = 0;
            itemOrderTemplate.SellsExtraCount = 0;


            itemOrderTemplate.CompanyId   = NullHandler.GetString(dr["CompanyId"]);
            itemOrderTemplate.ItemId      = NullHandler.GetString(dr["ItemId"]);
            itemOrderTemplate.ItemName    = NullHandler.GetString(dr["ItemName"]);
            itemOrderTemplate.CountPerBox = NullHandler.GetInt32(dr["CountPerBox"]);
            itemOrderTemplate.Price       = NullHandler.GetDouble(dr["Price"]);

            itemOrderTemplate.StockId                  = NullHandler.GetString(dr["StockId"]);
            itemOrderTemplate.CurrentStockTotal        = NullHandler.GetInt32(dr["TotalStock"]);
            itemOrderTemplate.CurrentDamagedStockTotal = NullHandler.GetInt32(dr["DamagedStock"]);
            itemOrderTemplate.ChalanNo                 = NullHandler.GetString(dr["ChalanNo"]);
            itemOrderTemplate.StockEntryDate           = NullHandler.GetDateTime(dr["StockEntryDate"]);

            itemOrderTemplate.CalculateBoxesFromTotalStock();
            //itemOrderTemplate.CalculateOrdersInBox();
            return(itemOrderTemplate);
        }