private void UpdateQuantityAndPhysicalStores()
        {
            var dataTable = gridPutAwayNonPalletized.DataSource as DataTable;
            decimal currentBonusInvQty = 0;
            string currentGuiParam = "";
            var orginalGuidCurrentInvQty = new Dictionary<string, decimal>();

            if (dataTable != null)
                foreach (DataRow drow in dataTable.Rows)
                {
                    if (drow["IsDamaged"] != DBNull.Value && Convert.ToBoolean(drow["IsDamaged"])) continue;
                    var dr = _dtRecGrid.Select(String.Format("GUID = '{0}'", Convert.ToString(drow["GUID"])))[0];

                    bool currentRowIsOrginal = (dr["Copy"].ToString() == "Orginal" || dr["Copy"] == DBNull.Value);
                    currentGuiParam = currentRowIsOrginal ? "GUID" : "Copy";

                    if (drow["PutAwayLocation"] != DBNull.Value)
                    {
                        var plocation = new PalletLocation();
                        plocation.LoadByPrimaryKey(Convert.ToInt32(drow["PutAwayLocation"]));
                        dr["Store"] = (plocation.PhysicalStoreID);
                    }
                    if (drow["Palletized Quantity"] != DBNull.Value)
                    {
                        dr["Pack Qty"] = drow["Palletized Quantity"];

                        bool hasBonus = !srm && dr["InvoicedQty"] != DBNull.Value &&
                                        (Convert.ToDecimal(dr["InvoicedQty"]) < Convert.ToDecimal(drow["Pack Qty"]));

                        if (hasBonus && !orginalGuidCurrentInvQty.Any())
                            GetCurrentBonusInvQty(out orginalGuidCurrentInvQty);
                        if (!hasBonus)
                        {
                            dr["InvoicedQty"] = (currentRowIsOrginal)
                                ? Convert.ToDecimal(dr["Pack Qty"]) +
                                  HasShortageQty(dr["GUID"].ToString())
                                : Convert.ToDecimal(dr["Pack Qty"]);
                        }
                        else
                        {

                            currentBonusInvQty = orginalGuidCurrentInvQty[dr[currentGuiParam].ToString()];

                            if (Convert.ToDecimal(dr["Pack Qty"]) >= currentBonusInvQty && currentBonusInvQty >= 0)
                            {
                                dr["InvoicedQty"] = currentBonusInvQty;
                                orginalGuidCurrentInvQty[dr[currentGuiParam].ToString()] -=
                                    Convert.ToDecimal(dr["Pack Qty"]);

                            }
                            else
                            {
                                if (currentBonusInvQty <= 0)
                                    dr["InvoicedQty"] = 0;
                                else
                                {
                                    dr["InvoicedQty"] = (currentBonusInvQty >= Convert.ToDecimal(dr["Pack Qty"]))
                                        ? Convert.ToDecimal(dr["Pack Qty"])
                                        : currentBonusInvQty;
                                    orginalGuidCurrentInvQty[dr[currentGuiParam].ToString()] -=
                                        Convert.ToDecimal(dr["Pack Qty"]);
                                }
                            }
                        }
                    }
                }
        }