public static DataTable GetAllFreeNonBulk()
 {
     string query = String.Format("select (st.Prefix + ' ' + pl.Label) as PalletLocationName  , * from PalletLocation pl join StorageType st on pl.StorageTypeID = st.ID where StorageTypeID <> {0} and StorageTypeID <> {1} and pl.PalletID is null", StorageType.BulkStore,StorageType.PickFace);
     PalletLocation pl = new PalletLocation();
     pl.LoadFromRawSql(query);
     return pl.DataTable;
 }
        private void btnRelocatePallet_Click(object sender, EventArgs e)
        {
            //Get the chosen pallet Location
            BLL.PalletLocation palletLocation = new BLL.PalletLocation();
            palletLocation.LoadByPrimaryKey(Convert.ToInt16(lkAvailablePalletLocation.EditValue));

            //Get the chosen misplaced receivepallet entry
            DataRow dr = grdViewMisplacedItems.GetFocusedDataRow();
            int     receivePalletID = Convert.ToInt32(dr["ID"]);

            BLL.ReceivePallet rp = new BLL.ReceivePallet();
            rp.LoadByPrimaryKey(receivePalletID);
            if (palletLocation.IsColumnNull("PalletID"))
            {
                palletLocation.PalletID = rp.PalletID;
                palletLocation.Save();
            }
            else
            {
                rp.PalletID = palletLocation.PalletID;
                rp.Save();
            }

            int storeID = Convert.ToInt16(lkStoreLocation.EditValue);

            LoadMisplacedItems(storeID);

            XtraMessageBox.Show("Placed!!");
        }
 public static DataTable GetAll()
 {
     PalletLocation pl = new PalletLocation();
     String query = String.Format("select (st.Prefix + ' ' + pl.Label) as PalletLocationName  , * from PalletLocation pl join StorageType st on pl.StorageTypeID = st.ID");
     pl.LoadFromRawSql(query);
     return pl.DataTable;
 }
        private void btnReturn_Click(object sender, EventArgs e)
        {
            //TODO: finish updating the changed locations
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            if (gridGRVs.DataSource == null)
                return;
            transaction.BeginTransaction();
            try
            {
                PalletLocation pl = new PalletLocation();
                BLL.ReceiveDoc recDoc = new ReceiveDoc();
                recDoc.LoadByReceiptID(ReceiptID);
                recDoc.ConfirmGRNFPrinted(null);
                BLL.Receipt receiptStatus = new BLL.Receipt();
                receiptStatus.LoadByPrimaryKey(ReceiptID);
                receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change");

                transaction.CommitTransaction();
                this.LogActivity("Return-For-Costing", ReceiptID);
                XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);

            }
            catch (Exception exp)
            {
                transaction.RollbackTransaction();
                throw exp;
            }
            PutAwayListsLoad(null, null);
        }
        private void BindFormContents()
        {
            if (!BLL.Settings.IsCenter)
            {

                lkAccount.SetupActivityEditor().SetDefaultActivity();
            }
            else
            {
                colLocation.Visible = false;
                layoutAccount.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            //Warehouse
            lkWarehouse.Properties.DataSource = BLL.Warehouse.GetWarehouseWithCluster(CurrentContext.UserId);

            PalletLocation pl = new PalletLocation();
            lkPalletLocations.DataSource = PalletLocation.GetAll();

            if (currentMode == Modes.QuantityConfirmation)
            {
                gridReceives.DataSource = pl.GetReceivesForQtyConfirmation(CurrentContext.UserId);
                if (CurrentContext.LoggedInUser.UserType == UserType.Constants.STORE)
                {
                    btnConfirm.Enabled = false;
                }
            }
        }
예제 #6
0
        private void OnQueryPopup(object sender, CancelEventArgs e)
        {
            PalletLocation pl     = new PalletLocation();
            LookUpEdit     lke    = (LookUpEdit)gridDetailView.ActiveEditor;
            int            itemID = Convert.ToInt32(gridDetailView.GetFocusedDataRow()["ItemID"]);

            lke.Properties.DataSource = PalletLocation.GetAllFreeFor(itemID);
        }
        private void BindQuarantine()
        {
            PalletLocation pl = new PalletLocation();
            DataTable dtbl = pl.GetQuaranteenItems();

            dtbl.Columns.Add("WriteOff", typeof(int));
            dtbl.Columns.Add("ReLocate", typeof(int));
            dtbl.Columns.Add("Reason", typeof(int));
            dtbl.Columns.Add("NewPalletLocation", typeof (int));
            gridQuaranteen.DataSource = dtbl;
        }
 /// <summary>
 /// Gets the utilization.
 /// </summary>
 /// <param name="storageTypeID">The storage type ID.</param>
 /// <returns></returns>
 public DataTable GetUtilization(int storageTypeID)
 {
     string query = HCMIS.Repository.Queries.Shelf.SelectGetUtilization(storageTypeID);
     this.LoadFromRawSql(query);
     PalletLocation pl = new PalletLocation();
     while (!this.EOF)
     {
         this.DataRow["Value"] =  pl.CountUtilized(this.ID);
         this.MoveNext();
     }
     return this.DataTable;
 }
 /// <summary>
 /// Get dtail items for Pick face
 /// </summary>
 /// <param name="pickfaceId"></param>
 /// <param name="palletLocationId"></param>
 /// <returns></returns>
 public DataTable GetDetailItemsFor(int pickfaceId, int palletLocationId)
 {
     this.FlushData();
     PalletLocation pl = new PalletLocation();
     pl.LoadByPrimaryKey(palletLocationId);
     if (!pl.IsColumnNull("PalletID"))
     {
         string query = HCMIS.Repository.Queries.PickFace.SelectGetDetailItemsFor(pl.PalletID);
         this.LoadFromRawSql(query);
     }
     return this.DataTable;
 }
        private void BindFormContents()
        {
            PalletLocation pl = new PalletLocation();
            lkPalletLocations.DataSource = PalletLocation.GetAll();

            if (currentMode == Modes.GRVPrinting)
            {

                gridReceives.DataSource = pl.GetReceivesForGRVPrinting(CurrentContext.UserId, 1);

            }
        }
 public static DataTable GetAllFreeFor(int itemID)
 {
     string query = String.Format("select (st.Prefix + ' ' + pl.Label) as PalletLocationName  , * from PalletLocation pl join StorageType st on pl.StorageTypeID = st.ID join ItemPrefferedLocation ipl on ipl.PalletLocationID = pl.ID where ipl.ItemID = {0} and pl.PalletID is null", itemID);
     PalletLocation pl = new PalletLocation();
     pl.LoadFromRawSql(query);
     if (pl.RowCount == 0)
     {
         Items itm = new Items();
         itm.LoadByPrimaryKey(itemID);
         return PalletLocation.GetAllFree(itm.StorageTypeID.ToString());
     }
     return pl.DataTable;
 }
        private void BindFormContents()
        {
            PalletLocation pl = new PalletLocation();
            lkPalletLocations.DataSource = PalletLocation.GetAll();

             if (currentMode == Modes.DeliveryNotePrinting)
            {

                gridReceives.DataSource = pl.GetReceivesForGRVPrinting(CurrentContext.UserId, 3);
                colLocation.Visible = false;
                colInsurance.Visible = false;
                colMargin.Visible = false;
            }
        }
 private void BindFormContents()
 {
     var pl = new PalletLocation();
     lkPalletLocations.DataSource = PalletLocation.GetAll();
     if (currentMode == Modes.GRVConfirmation)
     {
         gridReceives.DataSource = pl.GetReceivesForGRVConfirmation(CurrentContext.UserId);
         colLocation.Visible = false;
         colInsurance.Visible = false;
         colMargin.Visible = false;
         lcReprint.Visibility = LayoutVisibility.Always;
         lcRequestVoid.Visibility = LayoutVisibility.Always;
         lcVoid.Visibility = LayoutVisibility.Always;
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (cmbColumn.SelectedValue != null && cmbRow.SelectedValue != null)
            {
                // TODO: add the saving logic here.
                PalletLocation pl = new PalletLocation();
                pl.LoadPalletLocationFor(cmbRack.SelectedValue.ToString(), cmbColumn.SelectedValue.ToString(), cmbRow.SelectedValue.ToString());
                //Console.WriteLine(cmbRack.SelectedValue);
                //Console.WriteLine(cmbColumn.SelectedValue);
                //pl.LoadPreferredLocationsFor(itemId);
                //lstPreferredPalletLocation.DataSource = pl.DefaultView;
                (lstPreferredPalletLocation.DataSource as DataView).Table.Merge(pl.DefaultView.Table, true, MissingSchemaAction.Add);

            }
            grpPalletLocation.Visible = false;
        }
        public void LoadPalletLocation(int palletId,int shlefId=0)
        {
            _pl = new BLL.PalletLocation();
            _pl.loadByPalletID(palletId);

            txtPalletLocation.Text = _pl.FullName;
            lblStorageType.Text = _pl.FullName;

            _rpl = new BLL.ReceivePallet();
            gridMovement.DataSource = _rpl.GetPalletLocationReadyForMovement( palletId );

            _itm = new BLL.Item();
            _itm.LoadByPrimaryKey(Convert.ToInt32(_rpl.GetColumn("ItemID")));
            txtItemName.Text = _itm.FullItemName;
            lblItemName.Text = _itm.FullItemName;

            lkFreePalletLocations.Properties.DataSource = BLL.PalletLocation.GetAllFreeFor(_itm.ID, shlefId);
        }
        public static PickListDetail GeneratePickListDetail(decimal pack, double? unitPrice, int receiveDocId, int manufacturerId,
                                                             int receivePalletId, int qtyPerPack, int activityId, int unitId,
                                                             int itemId, int picklistId, int palletId, string expireDate,
                                                             string batchNumber)
        {
            PalletLocation plocation = new PalletLocation();
            PickListDetail pkDetail = new PickListDetail();
            pkDetail.AddNew();
            pkDetail.PickListID = picklistId;
            pkDetail.ItemID = itemId;
            PalletLocation palletLocation = new PalletLocation();
            palletLocation.loadByPalletID(palletId);
            pkDetail.PalletLocationID = palletLocation.ID;
            pkDetail.BatchNumber = batchNumber;
            if (expireDate != "")
                pkDetail.ExpireDate = DateTime.Parse(expireDate);

            pkDetail.StoreID = activityId;
            pkDetail.UnitID = unitId;
            pkDetail.ReceiveDocID = receiveDocId;
            if (unitPrice != null)
            {
                pkDetail.Cost = Convert.ToDouble(pack) * Math.Round(unitPrice.Value, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);
                pkDetail.UnitPrice = Math.Round(unitPrice.Value, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);
            }
            pkDetail.Packs = pack;
            pkDetail.QtyPerPack = qtyPerPack;
            pkDetail.QuantityInBU = pack * qtyPerPack;
            pkDetail.StoreID = activityId;
            pkDetail.ReceivePalletID = receivePalletId;
            pkDetail.ManufacturerID = manufacturerId;
            pkDetail.BoxLevel = 0;
            pkDetail.DeliveryNote = true;

            plocation.LoadByPrimaryKey(pkDetail.PalletLocationID);
            pkDetail.PhysicalStoreID = plocation.PhysicalStoreID;
            pkDetail.Save();
            return pkDetail;
        }
예제 #17
0
        private void BindFormContents()
        {
            if (!BLL.Settings.IsCenter)
            {
                lkAccount.SetupActivityEditor().SetDefaultActivity();
            }
            else
            {
                colLocation.Visible      = false;
                layoutAccount.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            //Warehouse
            lkWarehouse.Properties.DataSource = BLL.Warehouse.GetWarehouseWithCluster(CurrentContext.UserId);

            PalletLocation pl = new PalletLocation();

            lkPalletLocations.DataSource = PalletLocation.GetAll();

            gridReceives.DataSource = pl.GetDraftReceives(CurrentContext.UserId);
            if (BLL.Settings.UseNewUserManagement)
            {
                if (this.HasPermission("Cancel"))
                {
                    lcCancelReceive.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                }

                if (this.HasPermission("Confirm"))
                {
                    layoutConfirm.Visibility = LayoutVisibility.Always;
                }
            }
            else
            {
                lcCancelReceive.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutConfirm.Visibility   = LayoutVisibility.Always;
            }
        }
        private void BindFormContents()
        {
            if (!BLL.Settings.IsCenter)
            {

                lkAccount.SetupActivityEditor().SetDefaultActivity();

            }
            else
            {
                colLocation.Visible = false;
                layoutAccount.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            //Warehouse
            lkWarehouse.Properties.DataSource = BLL.Warehouse.GetWarehouseWithCluster(CurrentContext.UserId);

            PalletLocation pl = new PalletLocation();
            lkPalletLocations.DataSource = PalletLocation.GetAll();

            gridReceives.DataSource = pl.GetDraftReceives(CurrentContext.UserId);
            if (BLL.Settings.UseNewUserManagement)
            {
                if (this.HasPermission("Cancel"))
                {
                    lcCancelReceive.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                }

                if (this.HasPermission("Confirm"))
                {
                    layoutConfirm.Visibility = LayoutVisibility.Always;
                }
            }else
            {
                lcCancelReceive.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutConfirm.Visibility = LayoutVisibility.Always;
            }
        }
        private void OnReplenishClicked(object sender, EventArgs e)
        {
            PalletLocation pl = new PalletLocation();
            PickFace pf = new PickFace();
            DataRow dr = gridPickFaceStockLevelView.GetFocusedDataRow();
            DataRow dr2 = gridReplenishmentChoiceView.GetFocusedDataRow();
            if (dr2 != null)
            {
                // check if the replenishment is from allowed location.
                //
                if (!Convert.ToBoolean(dr2["CanReplenish"]))
                {
                    XtraMessageBox.Show("Please choose replenishment from the first to expire items", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                pl.LoadByPrimaryKey(_palletLocationID);
                pf.LoadByPrimaryKey(_pickFaceID);
                if (pf.IsColumnNull("Balance"))
                {
                    pf.Balance = 0;
                }

                if (pl.IsColumnNull("PalletID"))
                {
                    Pallet pallet = new Pallet();
                    pallet.AddNew();
                    pallet.StorageTypeID = Convert.ToInt32(StorageType.PickFace);
                    pallet.Save();
                    pl.PalletID = pallet.ID;
                    pl.Save();
                }

                ReceivePallet rp = new ReceivePallet();
                ReceivePallet rp2 = new ReceivePallet();
                ReceiveDoc rd = new ReceiveDoc();
                rp.LoadByPrimaryKey(Convert.ToInt32(dr2["ReceivePalletID"]));
                rp2.AddNew();
                rp2.IsOriginalReceive = false;
                rp2.PalletID = pl.PalletID;
                rp2.ReceiveID = rp.ReceiveID;
                rp2.BoxSize = rp.BoxSize;

                // calculate the new balance
                BLL.ItemManufacturer im = new BLL.ItemManufacturer();
                im.LoadIMbyLevel(_designatedItemID, Convert.ToInt32(dr2["ManufacturerID"]),Convert.ToInt32(dr2["BoxSize"]));
                if (rp.IsColumnNull("ReservedStock"))
                {
                    rp.ReservedStock = 0;
                }
                //if (rp.Balance - rp.ReservedStock < im.QuantityInBasicUnit )
                //{
                //    XtraMessageBox.Show("You cannot replenish the pick face from this location because the items are reserved for Issue. Please replenish from another receive.","Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                //    return;
                //}
                BLL.ItemManufacturer imff = new BLL.ItemManufacturer();
                imff.LoadOuterBoxForItemManufacturer(im.ItemID,im.ManufacturerID);
                if (imff.PackageLevel > im.PackageLevel && rp.Balance < imff.QuantityInBasicUnit)
                {
                    rp2.Balance = rp.Balance;
                }
                else if (rp.Balance - rp.ReservedStock > im.QuantityInBasicUnit)
                {
                    rp2.ReceivedQuantity = rp2.Balance = im.QuantityInBasicUnit;
                }
                else
                {
                    rp2.Balance = rp.Balance;
                }
                rp2.ReservedStock = 0;
                rp.Balance -= rp2.Balance;
                if (rp.IsColumnNull("ReceivedQuantity"))
                {
                    rp.ReceivedQuantity = rp.Balance + rp2.Balance;
                }
                rp.ReceivedQuantity -= rp2.Balance;
                rp.Save();
                rp2.Save();
                pl.Confirmed = false;
                pl.Save();
                pf.Balance += Convert.ToInt32(rp2.Balance);
                pf.Save();
                PalletLocation pl2 = new PalletLocation();
                pl2.LoadLocationForPallet(rp.PalletID);
                rd.LoadByPrimaryKey(rp2.ReceiveID);
                // Now update the screen accordingly.
                dr["Balance"] = pf.Balance;// Convert.ToInt32(dr["Balance"]) + rp2.Balance;

                InternalTransfer it = new InternalTransfer();

                it.AddNew();
                it.ItemID = _designatedItemID;
                it.BoxLevel = im.PackageLevel;
                it.ExpireDate = rd.ExpDate;
                it.BatchNumber = rd.BatchNo;
                it.ManufacturerID = im.ManufacturerID;
                it.FromPalletLocationID = pl2.ID;
                it.ToPalletLocationID = _palletLocationID;
                it.IssuedDate = DateTimeHelper.ServerDateTime;
                it.QtyPerPack = im.QuantityInBasicUnit;
                it.Packs = 1;
                it.ReceiveDocID = rp.ReceiveID;
                it.QuantityInBU = it.Packs * it.QtyPerPack;
                it.Type = "PickFace";
                it.Status = 0;
                it.Save();

                BindPickFaceDetailAndReplenismehmnent();
                XtraMessageBox.Show("Your Pick Face is updated, please print the replenishment list and confirm the stock movement", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 private void gridView5_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     DataRow dr = gridView5.GetFocusedDataRow();
     if (dr != null)
     {
         // go show the source view
         PalletLocation pl = new PalletLocation();
         gridSources.DataSource = pl.GetLocationForItems(Convert.ToInt32(dr["ID"]));
         gridView3_RowClick(null, null);
     }
 }
 private void gridView3_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     PalletLocation pl = new PalletLocation();
     DataRow dr = gridView3.GetFocusedDataRow();
     if (dr != null)
     {
         DataRow dr2 = gridView5.GetFocusedDataRow();
         int excludePalletLocationID = Convert.ToInt32(dr["ID"]);
         int itemID = Convert.ToInt32(dr2["ID"]);
         gridDestination.DataSource = pl.GetLocationForItemsExclude(itemID, excludePalletLocationID);
     }
 }
        private void gridView2_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            DataRow dr = gridItemMovementView.GetDataRow(e.RowHandle);
            int index = (e.Column.Caption == "") ? 1 : Convert.ToInt32(e.Column.Caption) - 1;

            if (dr[String.Format("Pallet{0}", index)] != DBNull.Value)
            {
                e.DisplayText = dr["Pallet" + index].ToString();
            }
            else
            {
                e.DisplayText = dr[String.Format("Pallet{0}", index)].ToString();
            }
            Rectangle box = e.Bounds;
            string balanceField = string.Format("ItemID{0}", index);
            if (dr.IsNull(String.Format("PercentageUsed{0}", index)))
            {
                box.Width = 0;
            }
            else
            {
                int width = Convert.ToInt32(Convert.ToDouble(box.Width) * Convert.ToDouble(dr[String.Format("PercentageUsed{0}", index)]) / 100);
                if (width > box.Width)
                {
                    width = box.Width;
                }
                box.Width = width;
            }

            if (box.Width > 0)
            {
                Brush b = new SolidBrush(Color.FromArgb(51, 153, 255));
                e.Graphics.FillRectangle(b, box);
                box.X += box.Width;
                box.Width = e.Bounds.Width - box.Width;
                b = new SolidBrush(Color.FromArgb(173, 216, 239));
                e.Graphics.FillRectangle(b, box);
            }
            else if (box.Width == 0 && dr[balanceField] != DBNull.Value && Convert.ToInt32(dr[balanceField]) > 0)
            {
                // this is when we are not sure abou the volume of the items
                Brush b = new SolidBrush(Color.FromArgb(173, 216, 239));
                e.Graphics.FillRectangle(b, e.Bounds);
            }

            if ((gridItemMovementView.FocusedValue != null && e.CellValue != DBNull.Value &&
                e.CellValue is int && Convert.ToInt32(e.CellValue) > 0 &&
                gridItemMovementView.FocusedValue != DBNull.Value &&
                gridItemMovementView.FocusedValue is int &&
                Convert.ToInt32(gridItemMovementView.FocusedValue) > 0) || (gridItemMovementView.FocusedValue == null) && Convert.ToInt32(e.CellValue) > 0)
            {
                var pl = new PalletLocation();
                pl.LoadByPrimaryKey(Convert.ToInt32(e.CellValue));
                 if (pl.RowCount > 0 && !pl.IsColumnNull("PalletID") && e.Column.Name != "colRow")
                {
                    Brush b = new SolidBrush(Color.FromArgb(173, 200, 0));
                    e.Graphics.FillRectangle(b, e.Bounds);
                }
            }
            e.Handled = false;
        }
 private void BtnMovePalletClick(object sender, EventArgs e)
 {
     DataRow dr = gridPalletMovementView.GetFocusedDataRow();
     if (dr != null)
     {
         PalletLocation pl = new PalletLocation();
         pl.LoadByPrimaryKey(Convert.ToInt32(dr["FromID"]));
         PalletLocation pl2 = new PalletLocation();
         pl2.LoadByPrimaryKey(Convert.ToInt32(dr["ToID"]));
         if (pl2.IsColumnNull("PalletID"))
         {
             pl2.PalletID = pl.PalletID;
             pl.SetColumnNull("PalletID");
             pl2.Save();
             pl.Save();
             XtraMessageBox.Show("The pallet Movement is confirmed!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         BindPalletMovement();
     }
 }
        private void btnConsolidate_Click(object sender, EventArgs e)
        {
            DataRow dr = gridView4.GetFocusedDataRow();
            if (dr != null)
            {
                if (DialogResult.Yes == XtraMessageBox.Show("Are you sure you want to consolidate the two pallets? you will not be able to undo this change.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    DataRow dr2 = gridView3.GetFocusedDataRow();
                    PalletLocation pl = new PalletLocation();
                    pl.LoadByPrimaryKey( Convert.ToInt32(dr2["ID"]) );

                    int sourcePalletID = pl.PalletID;
                    pl.LoadByPrimaryKey(Convert.ToInt32(dr["ID"]));
                    int destinationPalletID = pl.PalletID;

                    ReceivePallet rp = new ReceivePallet();
                    rp.Consolidate(sourcePalletID, destinationPalletID);
                    pl.LoadByPrimaryKey(Convert.ToInt32(dr2["ID"]));
                    pl.SetColumnNull("PalletID");
                    pl.Save();
                    XtraMessageBox.Show("Items Consolidated.", "Items Consolidated");

                    gridView5_RowClick(null, null);
                }
            }
        }
예제 #25
0
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            PalletLocation pl = new PalletLocation();

            if (e != null && e.PrevFocusedRowHandle < -1)
            {
                return;
            }

            try
            {
                DataRow dr = gridReceiveView.GetFocusedDataRow();

                if (dr == null)
                {
                    return;
                }

                ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
                BLL.Receipt receiptDoc = new BLL.Receipt();
                receiptDoc.LoadByPrimaryKey(ReceiptID);

                DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF();


                if (GRNFDetail.Rows.Count > 0)
                {
                    //var store = new Store();
                    //store.
                    BLL.PO order = new BLL.PO();
                    //var Mode = new Mode();
                    //Mode.LoadByPrimaryKey(order.ModeID);
                    //lblMode.Text = Mode.TypeName;
                    HeaderSection.Text = GRNFDetail.Rows[0]["PONumber"].ToString();


                    lblRecieveStatus.Text     = dr["recieveStatus"].ToString();
                    lblReceiptNo.Text         = dr["ReceiptNo"].ToString();
                    lblRecievedBy.Text        = dr["ReceivedBy"].ToString();
                    lblRecievedDate.Text      = Convert.ToDateTime(dr["Date"]).ToShortDateString();
                    lblReciveType.Text        = (dr["ReceiveType"]).ToString();
                    lblWayBill.Text           = (dr["WayBillNo"]).ToString() != "" ? dr["WayBillNo"].ToString() : "-";
                    lblTransferVoucherNo.Text = (dr["transferNo"]).ToString() != "" ? dr["transferNo"].ToString() : "-";

                    var warehouse = new BLL.Warehouse();
                    warehouse.LoadByPrimaryKey(receiptDoc.WarehouseID);
                    lblWarehouse.Text = warehouse.Name;
                    lblSupplier.Text  = dr["Supplier"].ToString();

                    var cluster = new BLL.Cluster();
                    cluster.LoadByPrimaryKey(warehouse.ClusterID);
                    lblCluster.Text = cluster.Name;



                    lblDocType.Text = "";

                    lblPoType.Text = dr["POType"].ToString();
                    //var ps = new BLL.PhysicalStore();
                    //ps.LoadByPrimaryKey(order.p);
                    //lblStore.Text = ps.Name;


                    txtOrderNo.EditValue = GRNFDetail.Rows[0]["PONumber"];
                    lblPoNumber.Text     = GRNFDetail.Rows[0]["PONumber"].ToString();

                    lblInvoiceNumber.Text = receiptDoc.STVOrInvoiceNo;

                    lblInsurancePolicy.Text = receiptDoc.InsurancePolicyNo != ""?receiptDoc.InsurancePolicyNo : "-";

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(Convert.ToInt32(GRNFDetail.Rows[0]["ActivityID"]));

                    txtActivity.EditValue = activity.FullActivityName;
                    lblActivity.Text      = activity.Name;

                    lblSubAccount.Text = activity.SubAccountName;
                    lblMode.Text       = activity.ModeName;
                    lblAccount.Text    = activity.AccountName;

                    gridDetails.DataSource = GRNFDetail;
                }

                if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID))
                {
                    gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
                }
            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }
        private void repositoryItemButtonEdit1_Click(object sender, EventArgs e)
        {
            if (BLL.Settings.UseNewUserManagement && !this.HasPermission("Move-Commodities"))
            {
                return;
            }

            PalletLocation pl = new PalletLocation();
            if (gridItemMovementView.FocusedValue != null && prev != gridItemMovementView.FocusedValue)
            {
                prev = gridItemMovementView.FocusedValue;
                pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));

                PalletLocation pll = new PalletLocation();
                pll.LoadByPrimaryKey(selectedPalletLocationID);

                if (pll.RowCount > 0)
                {
                    if (!pll.IsColumnNull("PalletID") && pl.IsColumnNull("PalletID"))
                    {
                        if(pll.StorageTypeID.ToString() == StorageType.PickFace)
                        {
                            XtraMessageBox.Show(
                                "You cannot use Internal Movements to move Pick Face Locations. Please use the customize drug list screen.","Error",MessageBoxButtons.OK,MessageBoxIcon.Stop);
                        }
                        else if(XtraMessageBox.Show("Are you sure you want to move pallet?","Confirmation",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes){
                            //TODO: implement the moving logic here.
                            if (PalletLocation.Move(pll.ID, pl.ID))
                            {
                                lkRackID2_EditValueChanged( new object(), new EventArgs() );
                                gridItemMovementView.RefreshRow( gridItemMovementView.FocusedRowHandle );
                                gridItemDetailByLocation.Refresh();
                            }
                        }
                    }
                }
                selectedPalletLocationID = Convert.ToInt32(gridItemMovementView.FocusedValue);
            }
        }
        /// <summary>
        /// Moves the specified pick list ID.
        /// </summary>
        /// <param name="PickListID">The pick list ID.</param>
        public static void Move(int PickListID)
        {
            DataView       dv = GetTransferReportForStore();
            PalletLocation pl = new PalletLocation();

            foreach (DataRowView dr in dv)
            {
                int amount           = Convert.ToInt32(dr["packs"]);
                int palletLocationID = Convert.ToInt32(dr["PalletLocationID"]);

                ReceivePallet rp   = new ReceivePallet();
                ReceiveDoc    rdoc = new ReceiveDoc();

                rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"]));
                rdoc.LoadByPrimaryKey(rp.ReceiveID);
                amount *= rdoc.QtyPerPack;

                int qPalletLocationID = PalletLocation.GetTransferPalletLocation(Convert.ToInt32(dr["PhysicalStoreID"]));
                pl.LoadByPrimaryKey(qPalletLocationID);
                if (pl.IsColumnNull("PalletID"))
                {
                    Pallet p = new Pallet();
                    p.AddNew();
                    p.StorageTypeID = Convert.ToInt32(StorageType.Quaranteen);
                    p.Save();
                    pl.PalletID = p.ID;
                    pl.Save();
                }


                ReceivePallet rp2 = new ReceivePallet();
                ReceiveDoc    rd  = new ReceiveDoc();


                rd.LoadByPrimaryKey(rp.ReceiveID);
                rp2.AddNew();

                rp2.PalletID  = pl.PalletID;
                rp2.ReceiveID = rp.ReceiveID;


                // calculate the new balance
                BLL.ItemManufacturer im = new BLL.ItemManufacturer();
                //im.LoadDefaultReceiving(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]));
                if (dr["BoxLevel"] == DBNull.Value)
                {
                    dr["BoxLevel"] = 0;
                }
                im.LoadIMbyLevel(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]), Convert.ToInt32(dr["BoxLevel"]));
                int packqty = (amount / im.QuantityInBasicUnit);
                rp2.ReservedStock = 0;
                rp.ReservedStock -= amount;
                BLL.ReceivePallet.MoveBalance(rp, rp2, amount);
                //rp2.Balance = amount;
                //rp.Balance -= rp2.Balance;

                //rp.Save();
                //rp2.Save();

                pl.Confirmed = false;
                pl.Save();
                if (rp.Balance == 0)
                {
                    PalletLocation.GarbageCollection();
                }
            }
        }
예제 #28
0
        /// <summary>
        /// Saves the pallet locations in shelf.
        /// </summary>
        /// <param name="rows">The rows.</param>
        /// <param name="cols">The cols.</param>
        public void SavePalletLocationsInShelf(int rows, int cols)
        {
            // preserve the id of this shelf
            int            id  = this.ID;
            ShelfRowColumn src = new ShelfRowColumn();

            // check if the existing rows are null;
            if (this.IsColumnNull("Rows"))
            {
                this.Rows = 0;
            }
            if (this.IsColumnNull("Columns"))
            {
                this.Columns = 0;
            }
            this.Save();
            bool isColumnsChanged = (this.Columns != cols);
            bool isRowsChanged    = (this.Rows != rows);

            PalletLocation pl = new PalletLocation();

            // Fix the row and columns if there are any new additions
            for (int i = this.Columns; i < cols; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Column";
                src.Index   = i;
                src.Label   = (i + 1).ToString();
                src.Save();
            }
            for (int i = this.Rows; i < rows; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Row";
                src.Index   = i;
                src.Label   = getChar(i).ToString();
                src.Save();
            }

            if (rows > this.Rows)
            {
                for (int i = this.Rows; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        pl.AddNew();
                        pl.Column        = j;
                        pl.Row           = i;
                        pl.StorageTypeID = this.ShelfStorageType;
                        pl.ShelfID       = id;
                        pl.LoadLabel();
                        pl.IsFullSize      = true;
                        pl.IsExtended      = false;
                        pl.IsEnabled       = true;
                        pl.Width           = this.Width;
                        pl.Height          = 1;
                        pl.Length          = 1;
                        pl.AvailableVolume = 0;
                        pl.UsedVolume      = 0;
                        pl.Save();
                    }
                }
            }
            else if (rows < this.Rows)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteSavePalletLocationsInShelf(rows, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteShelfRowColumnSavePalletLocationsInShelf(rows, id));
            }
            // if we have lost it for //rows < this.Rows
            this.LoadByPrimaryKey(id);

            if (cols > this.Columns)
            {
                for (int i = this.Columns; i < cols; i++)
                {
                    for (int j = 0; j < this.Rows; j++)
                    {
                        {
                            pl.AddNew();
                            pl.Column        = i;
                            pl.Row           = j;
                            pl.StorageTypeID = this.ShelfStorageType;
                            pl.ShelfID       = id;
                            pl.LoadLabel();
                            pl.IsFullSize      = true;
                            pl.IsExtended      = false;
                            pl.IsEnabled       = true;
                            pl.Width           = this.Width;
                            pl.Height          = 1;
                            pl.Length          = 1;
                            pl.AvailableVolume = 0;
                            pl.UsedVolume      = 0;
                            pl.Save();
                        }
                    }
                }
            }
            else if (cols < this.Columns)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeletePalletLocationSavePalletLocationsInShelf(cols, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteFromShelfRowColumnSavePalletLocationsInShelf(cols, id));
            }
            this.FlushData();
            this.LoadByPrimaryKey(id);
            this.Rows    = rows;
            this.Columns = cols;
            this.Save();

            if (isColumnsChanged)
            {
                FixLengthOfPalletLocations();
            }
            if (isRowsChanged)
            {
                FixHeightOfPalletLocations();
            }
            // make the approprait entry in the pick list locations
            if (this.ShelfStorageType.ToString() == StorageType.PickFace)
            {
                PickFace.FixPickFaceEntries();
            }

            FixVolume();

            //Find all Shelf pallet locations
            Shelf shelf = new Shelf();

            shelf.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.SelectSavePalletLocationsInShelf(id));
            while (!shelf.EOF)
            {
                PalletLocation plc = new PalletLocation();
                plc.LoadByPrimaryKey(shelf.ID);
                plc.Label = string.Format("{0}-{1}-{2}", this.ShelfCode, plc.Column + 1, getChar(plc.Row));
                plc.Save();
                shelf.MoveNext();
            }
        }
        private void ReturnToStoreForQuantityEdit()
        {
            //TODO: finish updating the changed locations
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            transaction.BeginTransaction();
            try
            {
                PalletLocation pl = new PalletLocation();
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();
                //           pl.ConfirmAllReceived(reference);
                if (gridDetailView.DataSource == null)
                    return;

                foreach (DataRowView drv in gridDetailView.DataSource as DataView)
                {
                    int PalletLocationID = Convert.ToInt32(drv["PalletLocationID"]);
                    int ProposedPalletLocationID = Convert.ToInt32(drv["ProposedPalletLocationID"]);
                    int PalletID = Convert.ToInt32(drv["PalletID"]);
                    int receiveID = Convert.ToInt32(drv["ReceiveID"]);

                    if (PalletLocationID != ProposedPalletLocationID)
                    {
                        pl.LoadByPrimaryKey(PalletLocationID);
                        if (pl.IsColumnNull("PalletID"))
                        {
                            pl.Confirmed = false;
                            pl.Save();
                        }
                    }
                    else
                    {
                        pl.LoadByPrimaryKey(PalletLocationID);
                        pl.Confirmed = false;
                        pl.Save();
                    }
                }

                BLL.ReceiveDoc recDoc = new ReceiveDoc();
                recDoc.LoadByReferenceNo(reference);
                recDoc.SetStatusAsReceived(null);
                transaction.CommitTransaction();
                XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                BindFormContents();

            }
            catch (Exception exp)
            {
                transaction.RollbackTransaction();
                XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void BindPalletMovement()
 {
     PalletLocation pl = new PalletLocation();
     DataView dv = pl.RecommendPalletMovments();
     gridPalletMovement.DataSource = dv;
 }
 private void splitMenu_Opening(object sender, CancelEventArgs e)
 {
     if (gridItemMovementView.FocusedValue != null && gridItemMovementView.FocusedValue != DBNull.Value &&
         Convert.ToInt32(gridItemMovementView.FocusedValue) > 0)
     {
         var pl = new PalletLocation();
         prev = gridItemMovementView.FocusedValue;
         pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));
         if (pl.IsColumnNull("PalletID"))
         {
             e.Cancel = true;
         }
     }
 }
        private void repositoryItemButtonEdit1_DoubleClick(object sender, EventArgs e)
        {
            Pallet pallet = new Pallet();
            PalletLocation pl = new PalletLocation();
            if (gridItemMovementView.FocusedValue != null )
            {
                prev = gridItemMovementView.FocusedValue;
                pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));
                if (!pl.IsColumnNull("PalletID"))
                {
                    pallet.GetAllItemsInPallet(pl.PalletID);
                    gridControl2.DataSource = pallet.DefaultView;
                    pallet.GetAllItemsInPalletSKUTotal(pl.PalletID);
                    Label l = new Label();
                    l.Dock = DockStyle.Bottom;

                    XtraForm f = new XtraForm();
                    //gridControl2.Parent = null;
                    f.ShowInTaskbar = false;
                    f.Width = gridControl2.Width;
                    if (pallet.RowCount > 0 && !pallet.IsColumnNull("Total"))
                    {

                        l.Text = string.Format("Total SKU: {0}", pallet.GetColumn("Total").ToString());
                    }
                    else
                    {
                        l.Text = "Total SKU: 0";
                    }
                    f.Controls.Add(l);

                    pallet.LoadByPrimaryKey(pl.PalletID);
                    if (!pallet.IsColumnNull("PalletNo"))
                    {
                        f.Text = String.Format("Pallet Number: {0}", pallet.PalletNo);

                    }
                    f.Controls.Add(gridControl2);

                    f.StartPosition = FormStartPosition.CenterScreen;
                    f.ShowDialog();
                }
            }
        }
예제 #33
0
파일: Shelf.cs 프로젝트: HCMISFE/FE
        public void SavePalletLocationsInShelf(int rows, int cols)
        {
            // preserve the id of this shelf
            int            id  = this.ID;
            ShelfRowColumn src = new ShelfRowColumn();

            // check if the existing rows are null;
            if (this.IsColumnNull("Rows"))
            {
                this.Rows = 0;
            }
            if (this.IsColumnNull("Columns"))
            {
                this.Columns = 0;
            }
            this.Save();
            bool isColumnsChanged = (this.Columns != cols);
            bool isRowsChanged    = (this.Rows != rows);

            PalletLocation pl = new PalletLocation();

            // Fix the row and columns if there are any new additions
            for (int i = this.Columns; i < cols; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Column";
                src.Index   = i;
                src.Label   = (i + 1).ToString();
                src.Save();
            }
            for (int i = this.Rows; i < rows; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Row";
                src.Index   = i;
                src.Label   = ArrOfChars[i];
                src.Save();
            }

            if (rows > this.Rows)
            {
                for (int i = this.Rows; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        pl.AddNew();
                        pl.Column        = j;
                        pl.Row           = i;
                        pl.StorageTypeID = this.ShelfStorageType;
                        pl.ShelfID       = id;
                        pl.LoadLabel();
                        pl.IsEnabled = true;
                        pl.Save();
                    }
                }
            }
            else if (rows < this.Rows)
            {
                this.LoadFromRawSql(String.Format("delete from PalletLocation where ShelfID = {0} and [Row] >= {1}", id, rows));
                this.LoadFromRawSql(String.Format("delete from ShelfRowColumn where ShelfID = {0} and [Index] >= {1} and Type = 'Row'", id, rows));
            }
            // if we have lost it for //rows < this.Rows
            this.LoadByPrimaryKey(id);

            if (cols > this.Columns)
            {
                for (int i = this.Columns; i < cols; i++)
                {
                    for (int j = 0; j < this.Rows; j++)
                    {
                        {
                            pl.AddNew();
                            pl.Column        = i;
                            pl.Row           = j;
                            pl.StorageTypeID = this.ShelfStorageType;
                            pl.ShelfID       = id;
                            pl.LoadLabel();
                            pl.IsEnabled = true;
                            pl.Save();
                        }
                    }
                }
            }
            else if (cols < this.Columns)
            {
                this.LoadFromRawSql(String.Format("delete from PalletLocation where ShelfID = {0} and [Column] >= {1}", id, cols));
                this.LoadFromRawSql(String.Format("delete from ShelfRowColumn where ShelfID = {0} and [Index] >= {1} and Type = 'Column'", id, cols));
            }
            this.FlushData();
            this.LoadByPrimaryKey(id);
            this.Rows    = rows;
            this.Columns = cols;
            this.Save();

            if (isColumnsChanged)
            {
                FixLengthOfPalletLocations();
            }
            if (isRowsChanged)
            {
                FixHeightOfPalletLocations();
            }
            // make the approprait entry in the pick list locations
            if (this.ShelfStorageType.ToString() == StorageType.PickFace)
            {
                PickFace.FixPickFaceEntries();
            }
        }
        private void tsmSplit_Click(object sender, EventArgs e)
        {
            var pl = new PalletLocation();
            prev = gridItemMovementView.FocusedValue;
            if (gridItemMovementView.FocusedValue != null && prev != DBNull.Value && Convert.ToInt32(gridItemMovementView.FocusedValue)>0)
            {
                pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));
                if (prev != DBNull.Value && !pl.IsColumnNull("PalletID"))
                {
                    var sp = new SplitPallet();
                    sp.LoadPalletLocation(pl.PalletID, (int) lkRackID2.EditValue);
                    sp.ShowDialog();
                    lkRackID2_EditValueChanged(new object(), new EventArgs());

                }
            }
        }
        private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            PalletLocation pl = new PalletLocation();
            try
            {
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();
                lblGRVNo.Text = reference;
                ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);
                ds = new DataSet();
                DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID);
                    dvMaster.TableName = "Master";
                    ds.Tables.Add(dvMaster);
                    gridDetails.DataSource = ds.Tables[dvMaster.TableName];

                int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]);
                try
                {
                    StoreID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["StoreID"]);

                     Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["SupplierID"]);
                }
                catch
                {

                }

            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            int warehouseID = Convert.ToInt32(lkWarehouse.EditValue);

            receiveDoc.Rewind();
            var po = new BLL.PO();
            var receiptInvoice = new BLL.ReceiptInvoice();

            while (!receiveDoc.EOF)
            {
                //Handle the PO.
                //int receiptID;
                if (po.RowCount == 0 || po.StoreID != receiveDoc.StoreID)
                {
                    Supplier supplier = new Supplier();
                    po = BLL.PO.CreatePOforStandard(OrderType.CONSTANTS.STANDARD_ORDER, receiveDoc.StoreID,
                                                    supplier.GetHubHomeOfficeSupplierID(), "",CurrentContext.LoggedInUser.ID);
                    //Should we receive it as hub to hub transfer? We're now using Standard order.
                    receipt = BLL.ReceiptInvoice.CreateAutomaticReceiptInvoiceForSTVTransfer(po.ID, warehouseID, STVNo,
                                                                                             CurrentContext.UserId);
                }

                receiveDoc.Quantity = receiveDoc.QtyPerPack * receiveDoc.NoOfPack;
                receiveDoc.ReceiptID = receipt.ID;
                receiveDoc.MoveNext();
            }
            receiveDoc.Save();

            //Save the location
            receiveDoc.Rewind();

            BLL.ReceivePallet receivePallet = new ReceivePallet();
            while (!receiveDoc.EOF)
            {
                //Save Location Information
                BLL.PalletLocation palletLocation = new PalletLocation();

                receivePallet.AddNew();

                int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID"));
                receivePallet.PalletLocationID = palletLocationID;

                palletLocation.LoadByPrimaryKey(palletLocationID);

                receivePallet.PalletID = palletLocation.PalletID;
                receivePallet.ReceivedQuantity = receiveDoc.Quantity;
                receivePallet.Balance = receiveDoc.Quantity;
                receivePallet.ReceiveID = receiveDoc.ID;
                receivePallet.ReservedStock = 0;

                //Save Discrepancy information if there is any
                receiveDocShortage.Rewind();
                while (receiveDocShortage.FindNextByGUID(receiveDoc.GetColumn("GUID").ToString()))
                {
                    receiveDocShortage.ReceiveDocID = receiveDoc.ID;

                    if (receiveDocShortage.ShortageReasonID == ShortageReasons.Constants.DAMAGED)
                    {
                        receiveDoc.NoOfPack += receiveDocShortage.NoOfPacks;
                        receiveDoc.Quantity += receiveDocShortage.NoOfPacks*receiveDoc.QtyPerPack;

                        palletLocationID = Convert.ToInt32(receiveDocShortage.GetColumn("PalletLocationID"));
                        receivePallet.AddNew();
                        receivePallet.PalletLocationID = palletLocationID;
                        palletLocation.LoadByPrimaryKey(palletLocationID);

                        receivePallet.PalletID = palletLocation.PalletID;
                        receivePallet.ReceivedQuantity = receiveDocShortage.NoOfPacks*receiveDoc.QtyPerPack;
                        receivePallet.Balance = receiveDocShortage.NoOfPacks*receiveDoc.QtyPerPack;
                        receivePallet.ReceiveID = receiveDoc.ID;
                        receivePallet.ReservedStock = 0;
                    }
                }

                receiveDoc.MoveNext();
            }
            receivePallet.IsOriginalReceive = true;
            receivePallet.Save();
        }
 private void OnQueryPopup(object sender, CancelEventArgs e)
 {
     PalletLocation pl = new PalletLocation();
     LookUpEdit lke = (LookUpEdit)gridDetailView.ActiveEditor;
     int itemID = Convert.ToInt32(gridDetailView.GetFocusedDataRow()["ItemID"]);
     lke.Properties.DataSource = PalletLocation.GetAllFreeFor(itemID);
 }