Example #1
0
        void BtnIncluiClick(object sender, EventArgs e)
        {
            frmCadOrcamento frm = new frmCadOrcamento();

            frm.acao = 'i';
            frm.ShowDialog();
            if (!frm.result)
            {
                return;
            }
            CarregaOrcamentos();
            Grid.Sort(dgvCadastro, col_sorted, ord_sorted);
            Grid.MarcaSelecionados(dgvCadastro);
            Grid.Posiciona(dgvCadastro, frm.fornecedor.Trim() + frm.data.Trim() + frm.codigo.Trim());
        }
Example #2
0
        void BtnAlteraClick(object sender, EventArgs e)
        {
            float valor, desconto, total;

            if (dgvCadastro.Rows.Count == 0)
            {
                return;
            }
            int             i   = dgvCadastro.CurrentRow.Index;
            frmCadOrcamento frm = new frmCadOrcamento();

            frm.acao = 'a';
            frm.alteracaoRestrita  = alteracaoRestrita;
            frm.edtFornecedor.Text = dgvCadastro.Rows[i].Cells["Fornecedor"].Value.ToString().Trim();
            frm.dtpData.Value      = DateTime.Parse(dgvCadastro.Rows[i].Cells["Data"].Value.ToString());
            frm.edtCodigo.Text     = dgvCadastro.Rows[i].Cells["Cod"].Value.ToString().Trim();
            frm.usuario            = dgvCadastro.Rows[i].Cells["Vendedor"].Value.ToString().Trim();
            frm.edtCliente.Text    = dgvCadastro.Rows[i].Cells["Cliente"].Value.ToString().Trim();
            frm.edtContato.Text    = dgvCadastro.Rows[i].Cells["Contato"].Value.ToString().Trim();
            frm.edtConsultor.Text  = dgvCadastro.Rows[i].Cells["Consultor"].Value.ToString().Trim();
            frm.tabela             = dgvCadastro.Rows[i].Cells["Tabela"].Value.ToString().Trim();
            frm.caracteristica     = dgvCadastro.Rows[i].Cells["Característica"].Value.ToString().Trim();
            frm.pedido             = dgvCadastro.Rows[i].Cells["P"].Value.ToString().Trim();
            valor    = Globais.StrToFloat(dgvCadastro.Rows[i].Cells["Valor Itens"].Value.ToString());
            desconto = Globais.StrToFloat(dgvCadastro.Rows[i].Cells["Desconto"].Value.ToString());
            float per_consultor = 0;

            float.TryParse(dgvCadastro.Rows[i].Cells["Comissão Consultor"].Value.ToString(), out per_consultor);
            //float per_consultor = (valor != 0) ? (vlr_consultor * 100f / valor) : 0;
            float vlr_consultor = (valor != 0) ? (per_consultor * valor / 100f) : 0;

            total = valor - desconto;
            frm.edtPerConsultor.Text = per_consultor.ToString("#0.00");
            frm.edtVlrConsultor.Text = vlr_consultor.ToString("#,###,##0.00");
            frm.edtValor.Text        = valor.ToString("#,###,##0.00");
            frm.edtDesconto.Text     = desconto.ToString("#,###,##0.00");
            frm.edtTotal.Text        = total.ToString("#,###,##0.00");
            frm.edtResumo.Text       = dgvCadastro.Rows[i].Cells["Resumo"].Value.ToString().Trim();
            frm.edtObservacao.Text   = dgvCadastro.Rows[i].Cells["Observação"].Value.ToString().Trim();
            frm.situacao             = dgvCadastro.Rows[i].Cells["Situação"].Value.ToString().Trim();
            frm.ShowDialog();
            string chave = dgvCadastro.Rows[i].Cells["Chave"].Value.ToString().Trim();

            CarregaOrcamentos();
            Grid.Sort(dgvCadastro, col_sorted, ord_sorted);
            Grid.MarcaSelecionados(dgvCadastro);
            Grid.Posiciona(dgvCadastro, chave);
        }