protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Enter)
            {
                if (dataGridView1.CurrentRow == null)
                {
                    return(true);
                }

                if (dataGridView1.CurrentRow.Cells[0].Value.ToString() != "")
                {
                    #region BAL6.45
                    fmWhseReceiptSingle wrs = new fmWhseReceiptSingle(dataGridView1.CurrentRow.Cells[0].Value.ToString(), 39);
                    wrs.ShowDialog();
                    #endregion
                    ReturnReceipts(Globals.theLocation);
                }

                return(true);
            }

            if (keyData == Keys.Escape)
            {
                this.Close();
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
        public void ReturnReceipts(string LocationCode)
        {
            if (dtWhseResiepts == null)
            {
                dtWhseResiepts = new DataTable();
                dtWhseResiepts.Columns.Add("Navn", typeof(string));
                dtWhseResiepts.Columns.Add("Ordre Type", typeof(string));
                dtWhseResiepts.Columns.Add("Ordre Nr.", typeof(string));
            }
            else
            {
                dtWhseResiepts.Rows.Clear();
            }

            WhseReceiptList_Service warehousrecieptlistservice = new WhseReceiptList_Service();

            warehousrecieptlistservice.UseDefaultCredentials = true;

            List <WhseReceiptList_Filter> WhseRecieptFilterArray = new List <WhseReceiptList_Filter>();

            WhseReceiptList_Filter LocationFilter = new WhseReceiptList_Filter();

            LocationFilter.Field    = WhseReceiptList_Fields.Location_Code;
            LocationFilter.Criteria = LocationCode;
            WhseRecieptFilterArray.Add(LocationFilter);

            WhseReceiptList [] Result = warehousrecieptlistservice.ReadMultiple(WhseRecieptFilterArray.ToArray(), "", 50);

            if (Result.Count() > 0)
            {
                foreach (var item in Result)
                {
                    if (item.No != "")
                    {
                        dtWhseResiepts.Rows.Add(new object[] { item.Buy_from_Vendor_Name, (item.Order_Type.ToString() == "Purchase_Order" ? "Købsordre" : "Returordre"), item.Order_No });
                    }
                }

                dataGridView1.DataSource              = dtWhseResiepts;
                dataGridView1.RowHeadersVisible       = false;
                dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                dataGridView1.Update();
            }
            else
            {
                fmWhseReceiptSingle wrs = new fmWhseReceiptSingle();
                wrs.ShowDialog();
                this.Close();
            }
        }
        public void ReturnReceipts(string LocationCode)
        {
            if (dtBin == null)
            {
                dtBin = new DataTable();
                dtBin.Columns.Add(mt.ReadResFile(this.Name.ToString() + "No"), typeof(string));
                dtBin.Columns.Add(mt.ReadResFile(this.Name.ToString() + "Name"), typeof(string));
                dtBin.Columns.Add(mt.ReadResFile(this.Name.ToString() + "Order"), typeof(string));
            }
            else
            {
                dtBin.Rows.Clear();
            }

            PurchaseOrderList_Service purchaseorderservice = new PurchaseOrderList_Service();

            purchaseorderservice.UseDefaultCredentials = true;

            List <PurchaseOrderList_Filter> PurchaseOrderFilterArray = new List <PurchaseOrderList_Filter>();

            PurchaseOrderList_Filter LocationFilter = new PurchaseOrderList_Filter();

            LocationFilter.Field    = PurchaseOrderList_Fields.Location_Code;
            LocationFilter.Criteria = LocationCode;
            PurchaseOrderFilterArray.Add(LocationFilter);

            PurchaseOrderList_Filter StatusFilter = new PurchaseOrderList_Filter();

            StatusFilter.Field    = PurchaseOrderList_Fields.Status;
            StatusFilter.Criteria = Status.Released.ToString();
            PurchaseOrderFilterArray.Add(StatusFilter);

            PurchaseOrderList_Filter AssignedFilter = new PurchaseOrderList_Filter();

            AssignedFilter.Field    = PurchaseOrderList_Fields.Assigned_User_ID;
            AssignedFilter.Criteria = Globals.theWinlogon;
            PurchaseOrderFilterArray.Add(AssignedFilter);


            PurchaseOrderList [] PurchaseOrderResult = purchaseorderservice.ReadMultiple(PurchaseOrderFilterArray.ToArray(), "", 1000);

            if (PurchaseOrderResult.Count() > 0)
            {
                foreach (var item in PurchaseOrderResult)
                {
                    if (item.No != "")
                    {
                        dtBin.Rows.Add(new object[] { item.No, item.Buy_from_Vendor_Name, (item.Vendor_Order_No == null ? "" : item.Vendor_Order_No) });
                    }
                }

                dataGridView1.DataSource              = dtBin;
                dataGridView1.RowHeadersVisible       = false;
                dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                dataGridView1.Update();
                tbFilter.Focus();
            }
            else
            {
                fmWhseReceiptSingle wrs = new fmWhseReceiptSingle();
                wrs.ShowDialog();
                this.Close();
            }
        }