private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var us = new User();
            var userID = MainWindow.LoggedinId;
            us.LoadByPrimaryKey(userID);
            var dr = gridView1.GetFocusedDataRow();

            if (dr == null) return;

            //if (us.UserName != "admin")
            //{
            //    XtraMessageBox.Show("You don't have the privilege to update reference number!", "Caution");
            //    return;
            //}

            int tranId = Convert.ToInt32(dr["ID"]);
            var rec = new ReceiveDoc();
            var iss = new IssueDoc();
            var dis = new Disposal();
            rec.LoadByPrimaryKey(tranId);
            iss.GetIssueByBatchAndId(rec.ItemID, rec.BatchNo, rec.ID);
            _dtDate.Value = DateTime.Now;
            _dtDate.CustomFormat = "MM/dd/yyyy";

            //if (iss.RowCount == 0)
            //{
                if ((iss.RowCount != 0) && (iss.RecievDocID != null && iss.RecievDocID == rec.ID))
                {
                    var edRec = new EditReceive(tranId, true);
                    MainWindow.ShowForms(edRec);
                }
            //}
            else if(iss.RowCount ==0)
            {
                var edRec = new EditReceive(tranId, false);
                MainWindow.ShowForms(edRec);
            }
        }
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            DataRow dr = gridView1.GetFocusedDataRow();

            if (dr == null) return;

            int tranId = Convert.ToInt32(dr["ID"]);
            ReceiveDoc rec = new ReceiveDoc();
            rec.LoadByPrimaryKey(tranId);

            _dtDate.Value = DateTime.Now;
            _dtDate.CustomFormat = "MM/dd/yyyy";
            IssueDoc iss = new IssueDoc();
            iss.GetIssueByBatchAndId(rec.ItemID, rec.BatchNo, rec.ID);
            DateTime dtCurrent = ConvertDate.DateConverter(_dtDate.Text);

            if ((rec.Date.Year != dtCurrent.Year && rec.Date.Month < 11) || (iss.RowCount != 0))
            {
                //XtraMessageBox.Show("Unable to edit, This Transaction has been processed. Try Loss and Adjustment.", "Unable to Edit", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                EditReceive edRec = new EditReceive(tranId, true);
                MainWindow.ShowForms(edRec);
            }
            else
            {
                EditReceive edRec = new EditReceive(tranId, false);
                MainWindow.ShowForms(edRec);
            }
        }