//Construtor //------------------------------------------------------------- public FormVendaSimples(FormPrincipal parent) { InitializeComponent(); this.MdiParent = parent; usuarioAtual = parent.lblUsuario.Text; lblVendedor.Text = parent.lblUsuario.Text; dtFin = new DataTable(); Finalizadora fin = new Finalizadora(); dtFin = fin.PreencherCbx(); cbxFormaPgto.DisplayMember = "descricao"; cbxFormaPgto.ValueMember = "id"; cbxFormaPgto.DataSource = dtFin; dt = new DataTable(); dt.Columns.Add("iditem", typeof(int)); dt.Columns.Add("idvenda", typeof(int)); dt.Columns.Add("idproduto", typeof(int)); dt.Columns.Add("descricao", typeof(string)); dt.Columns.Add("preco", typeof(decimal)); dt.Columns.Add("qtde", typeof(int)); dt.Columns.Add("subtotal", typeof(decimal)); dt.Columns.Add("desconto", typeof(decimal)); dt.Columns.Add("total", typeof(decimal)); dt.Columns.Add("estado", typeof(string)); dataGridView1.DataSource = dt; txtCodProduto.Select(); }
//Metodos Eventos //---------------------------------------------------------------- private void comboBox1_DropDownClosed(object sender, EventArgs e) { if (cbxTipo.Text == "TOTAL") { gpbValor.Enabled = true; gpbDataHora.Enabled = true; gpbParcial.Visible = false; gpbObs.Enabled = true; gpbFormaPgto.Enabled = true; //txtValor.Text = txtValorAtual.Text; txtValor.Text = txtTotal.Text; txtValor.ReadOnly = true; txtValor.TabStop = false; dtDataAtual.Focus(); } else if (cbxTipo.Text == "PARCIAL") { gpbValor.Enabled = true; gpbDataHora.Enabled = true; gpbParcial.Visible = true; gpbObs.Enabled = true; gpbFormaPgto.Enabled = true; txtValor.Text = "0,00"; txtNovoJuros.Text = "0,00"; txtNovoTotal.Text = txtTotal.Text; txtValor.ReadOnly = false; txtValor.TabStop = true; dtNovoVencimento.Value = DateTime.Now; //txtNovoValor.Text = txtValorAtual.Text; txtNovoValor.Text = txtTotal.Text; dtDataAtual.Focus(); } dt = new DataTable(); Finalizadora fin = new Finalizadora(); dt = fin.PreencherCbx(); cbxFormaPgto.DisplayMember = "descricao"; cbxFormaPgto.ValueMember = "id"; cbxFormaPgto.DataSource = dt; btnSalvar.Enabled = true; }