private void dataGridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { DataGridViewRow linhaAtual = dataGridView1.CurrentRow; int i = linhaAtual.Index; if (frmven != null) { frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[i].Cells["idvenda"].Value); frmven.txtNumVenda.Text = dataGridView1.Rows[i].Cells["idvenda"].Value.ToString(); frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[i].Cells["idvenda"].Value); frmven.dtVenda.Value = Convert.ToDateTime(dataGridView1.Rows[i].Cells["datavenda"].Value); frmven.lblEstado.Text = dataGridView1.Rows[i].Cells["estado"].Value.ToString(); frmven.lblVendedor.Text = dataGridView1.Rows[i].Cells["vendedor"].Value.ToString(); frmven.lblTotalVenda.Text = dataGridView1.Rows[i].Cells["total"].Value.ToString(); frmven.txtCodigoCliente.Text = dataGridView1.Rows[i].Cells["idcliente"].Value.ToString(); frmven.txtObservacao.Text = dataGridView1.Rows[i].Cells["obs"].Value.ToString(); frmven.txtCodigoCliente.Focus(); frmven.txtNumVenda.Focus(); frmven.butNovo.Focus(); this.Dispose(); } else if (parent != null) { frmven = new FormVendas(parent); frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[i].Cells["idvenda"].Value); frmven.txtNumVenda.Text = dataGridView1.Rows[i].Cells["idvenda"].Value.ToString(); frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[i].Cells["idvenda"].Value); frmven.dtVenda.Value = Convert.ToDateTime(dataGridView1.Rows[i].Cells["datavenda"].Value); frmven.lblEstado.Text = dataGridView1.Rows[i].Cells["estado"].Value.ToString(); frmven.lblVendedor.Text = dataGridView1.Rows[i].Cells["vendedor"].Value.ToString(); frmven.lblTotalVenda.Text = dataGridView1.Rows[i].Cells["total"].Value.ToString(); frmven.txtCodigoCliente.Text = dataGridView1.Rows[i].Cells["idcliente"].Value.ToString(); frmven.txtObservacao.Text = dataGridView1.Rows[i].Cells["obs"].Value.ToString(); frmven.Show(); frmven.txtCodigoCliente.Focus(); frmven.txtNumVenda.Focus(); frmven.butNovo.Focus(); this.Dispose(); } } else if (e.KeyCode == Keys.Escape) { this.CancelButton = butSair; radNumero.Checked = true; txtNumeroVenda.Clear(); txtNumeroVenda.Focus(); } else if (e.KeyCode == Keys.F6) { DataGridViewRow linhaAtual = dataGridView1.CurrentRow; int i = linhaAtual.Index; FormGridItensVenda gridItens = new FormGridItensVenda(); gridItens.idvenda = Convert.ToInt32(dataGridView1.Rows[i].Cells["idvenda"].Value); gridItens.Text = "Itens da Venda --> " + Convert.ToString(dataGridView1.Rows[i].Cells["idvenda"].Value); gridItens.MdiParent = this.ParentForm; gridItens.Show(); } }
private void btnAP_Click(object sender, EventArgs e) { FormVendas frmv = new FormVendas((FormPrincipal)cadCli.ParentForm); frmv.UsuarioAtual = cadCli.frmp.lblUsuario.Text; frmv.Show(); frmv.butNovo.PerformClick(); frmv.txtCodigoCliente.Text = cadCli.tbCodigoCliente.Text; frmv.txtCodigoCliente.Focus(); frmv.txtObservacao.Focus(); //cadCli.Dispose(); this.Dispose(); }
//Construtor //--------------------------------------------------------------------- public FormGridVenda(object frm1) { InitializeComponent(); bd = new BancoDados(); if (frm1 is FormVendas) { frmven = (FormVendas)frm1; } else if (frm1 is FormPrincipal) { this.MdiParent = (FormPrincipal)frm1; parent = (FormPrincipal)frm1; } cbxSituacao.Text = "ABERTA"; dtFim.Value = DateTime.Now; dtInicio.Value = DateTime.Now; txtNumeroVenda.Focus(); }
private void aPrazoToolStripMenuItem_Click(object sender, EventArgs e) { bool open = false; foreach (Form frm in this.MdiChildren) { if (frm is FormVendas) { frm.BringToFront(); open = true; } } if (!open) { frmVen = new FormVendas(this); frmVen.txtNumVenda.Select(); frmVen.Show(); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { } else { if (frmven != null) { frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["idvenda"].Value); frmven.txtNumVenda.Text = dataGridView1.Rows[e.RowIndex].Cells["idvenda"].Value.ToString(); frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["idvenda"].Value); frmven.dtVenda.Value = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells["datavenda"].Value); frmven.lblEstado.Text = dataGridView1.Rows[e.RowIndex].Cells["estado"].Value.ToString(); frmven.lblVendedor.Text = dataGridView1.Rows[e.RowIndex].Cells["vendedor"].Value.ToString(); frmven.lblTotalVenda.Text = dataGridView1.Rows[e.RowIndex].Cells["total"].Value.ToString(); frmven.txtCodigoCliente.Text = dataGridView1.Rows[e.RowIndex].Cells["idcliente"].Value.ToString(); frmven.txtObservacao.Text = dataGridView1.Rows[e.RowIndex].Cells["obs"].Value.ToString(); frmven.txtCodigoCliente.Focus(); frmven.txtNumVenda.Focus(); frmven.butNovo.Focus(); this.Dispose(); } else if (parent != null) { frmven = new FormVendas(parent); frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["idvenda"].Value); frmven.txtNumVenda.Text = dataGridView1.Rows[e.RowIndex].Cells["idvenda"].Value.ToString(); frmven.idVendaAtual = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["idvenda"].Value); frmven.dtVenda.Value = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells["datavenda"].Value); frmven.lblEstado.Text = dataGridView1.Rows[e.RowIndex].Cells["estado"].Value.ToString(); frmven.lblVendedor.Text = dataGridView1.Rows[e.RowIndex].Cells["vendedor"].Value.ToString(); frmven.lblTotalVenda.Text = dataGridView1.Rows[e.RowIndex].Cells["total"].Value.ToString(); frmven.txtCodigoCliente.Text = dataGridView1.Rows[e.RowIndex].Cells["idcliente"].Value.ToString(); frmven.txtObservacao.Text = dataGridView1.Rows[e.RowIndex].Cells["obs"].Value.ToString(); frmven.Show(); frmven.txtCodigoCliente.Focus(); frmven.txtNumVenda.Focus(); frmven.butNovo.Focus(); this.Dispose(); } } }
//private FormCadOs os; //Construtor public FormGridProdutos(object frm1, string tipoobj) { InitializeComponent(); bd = new BancoDados(); if (tipoobj == "produtos") { prod = (FormCadProdutos)frm1; } else if (tipoobj == "ajuste") { ajuste = (FormAjuEstoque)frm1; } else if (tipoobj == "venda") { frmven = (FormVendas)frm1; } else if (tipoobj == "venda2") { frmven2 = (FormVendaSimples)frm1; } txtPesquisa.Focus(); }
//Construtor //------------------------------------------------------------------------------ public FormGridClientes(object frm1, string tipoobj) { InitializeComponent(); bd = new BancoDados(); pf = new PessoaFisica(); if (tipoobj == "clientes") { frm = (FormCadClientes)frm1; } else if (tipoobj == "venda") { frmven = (FormVendas)frm1; } else if (tipoobj == "consulta_venda") { gridVenda = (FormGridVenda)frm1; } else if (tipoobj == "venda2") { frmven2 = (FormVendaSimples)frm1; } txtPesquisaNome.Focus(); }
private void button2_Click(object sender, EventArgs e) { FormVendas interligar = new FormVendas(); interligar.ShowDialog(); }