Beispiel #1
0
        private void btnInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                db = new DEWSRMEntities();
                int[]       selRows  = ((GridView)grdPReturns.MainView).GetSelectedRows();
                DataRowView oReturnD = (DataRowView)(((GridView)grdPReturns.MainView).GetRow(selRows[0]));

                int nReturnID = Convert.ToInt32(oReturnD["ID"]);
                _Return = db.Returns.FirstOrDefault(p => p.ReturnID == nReturnID);

                if (_Return == null)
                {
                    MessageBox.Show("select an item to generate invoice", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                fPReturn objfSOrder = new fPReturn();
                objfSOrder.GenerateReturnInvoice(_Return);
                //GenerateInvoice();
                //MoneyReceipt();
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Cannot generate invoice due to " + Ex.Message);
            }
        }
Beispiel #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            fPReturn frm = new fPReturn();

            frm.ItemChanged = RefReshList;
            frm.ShowDlg(new Return());
        }
Beispiel #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                int[]       selRows     = ((GridView)grdPReturns.MainView).GetSelectedRows();
                DataRowView oReturnD    = (DataRowView)(((GridView)grdPReturns.MainView).GetRow(selRows[0]));
                DataRowView oReturnDate = (DataRowView)(((GridView)grdPReturns.MainView).GetRow(selRows[0]));

                int      nReturnID   = Convert.ToInt32(oReturnD["ID"]);
                DateTime dReturnDate = Convert.ToDateTime(oReturnDate["ReturnDate"]);
                Return   oReturn     = db.Returns.FirstOrDefault(p => p.ReturnID == nReturnID);

                if (oReturn == null)
                {
                    MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (Global.CurrentUser.ISEditable == 1)
                {
                    if (dReturnDate < DateTime.Today)
                    {
                        MessageBox.Show("This order can't be return, Please contact BD Team", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }

                fPReturn frm = new fPReturn();
                frm.ItemChanged = RefReshList;
                frm.ShowDlg(oReturn);
            }
        }