public void alterar()
 {
     if (tabela.SelectedRows.Count == 1)
     {
         Cliente cli = new Cliente();
         Endereco end = new Endereco();
         cli.id_cliente = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
         end.id_endereco = Convert.ToInt32(tabela.CurrentRow.Cells[1].Value.ToString());
         cli.nome = tabela.CurrentRow.Cells[2].Value.ToString();
         cli.cpf = tabela.CurrentRow.Cells[3].Value.ToString();
         cli.rg = tabela.CurrentRow.Cells[4].Value.ToString();
         string data = tabela.CurrentRow.Cells[5].Value.ToString();
         cli.data = DateTime.Parse(data);
         cli.genero = tabela.CurrentRow.Cells[6].Value.ToString();
         cli.email = tabela.CurrentRow.Cells[7].Value.ToString();
         cli.telefone = tabela.CurrentRow.Cells[8].Value.ToString();
         cli.celular = tabela.CurrentRow.Cells[9].Value.ToString();
         end.rua = tabela.CurrentRow.Cells[10].Value.ToString();
         end.bairro = tabela.CurrentRow.Cells[11].Value.ToString();
         end.numero = Convert.ToInt32(tabela.CurrentRow.Cells[12].Value.ToString());
         end.cidade = tabela.CurrentRow.Cells[13].Value.ToString();
         end.complemento = tabela.CurrentRow.Cells[14].Value.ToString();
         end.cep = tabela.CurrentRow.Cells[15].Value.ToString();
         end.uf = tabela.CurrentRow.Cells[16].Value.ToString();
         cli.endereco = end;
         FrmCadClienteConstrucao cad = new FrmCadClienteConstrucao(this, cli);
         cad.Show();
     }
 }
 public FrmCadClienteConstrucao(FrmConsultaClienteConstrucao consulta, Cliente cliente)
 {
     InitializeComponent();
     init(consulta);
     this.cliente = cliente;
     txtcpf.Enabled = false;
     txtnome.Enabled = false;
     PreencherCampos();
 }
        public List<ParcelaReceber> geraLista()
        {
            string data_atual = GeraDataMysql.Gerar(DateTime.Now);
            string query = "select * from parcela_receber as p inner join conta_receber as c on p.id_conta_receber = c.id_conta_receber inner join cliente as f on f.id_cliente = c.id_cliente ";
            query += "inner join pessoa_fisica as j on f.id_pessoa_fisica = j.id_pessoa_fisica ";
            query += "where p.data_vencimento <='" + data_atual + "' and c.status=1 and p.situacao='ABERTA'";
            MySqlConnection con = new MySqlConnection(Config.Conexao);
            MySqlCommand cmd = new MySqlCommand(query, con);
            con.Open();
            MySqlDataReader reader = cmd.ExecuteReader();

            List<ParcelaReceber> lista = new List<ParcelaReceber>();

            while (reader.Read())
            {
                ContaReceber c = new ContaReceber();
                ParcelaReceber p = new ParcelaReceber();
                Cliente cli = new Cliente();
                cli.nome = reader["nome"].ToString();
                c.data_vencimento = DateTime.Parse(reader["data_vencimento"].ToString());
                c.valor_total = Convert.ToDecimal(reader["valor_total"].ToString());
                c.valor_pago = Convert.ToDecimal(reader["valor_pago"].ToString());
                c.situacao = "ABERTA";
                c.id_conta_receber = Convert.ToInt32(reader["id_conta_receber"].ToString());
                c.data_emissao = DateTime.Parse(reader["data_emissao"].ToString());
                c.documento = reader["documento"].ToString();
                c.entrada = Convert.ToDecimal(reader["entrada"].ToString());
                p.valor = Convert.ToDecimal(reader["valor"].ToString());
                p.data_vencimento = DateTime.Parse(reader["data_vencimento"].ToString());
                p.conta_receber = c;
                c.cliente = cli;
                lista.Add(p);
            }
            con.Close();
            return lista;
        }
Exemple #4
0
        public static bool verifica_Contas_receber_atrazadas(FrmPrincipal principal)
        {
            string data_atual = GeraDataMysql.Gerar(DateTime.Now);
               string query = "select * from parcela_receber as p inner join conta_receber as c on p.id_conta_receber = c.id_conta_receber inner join cliente as f on f.id_cliente = c.id_cliente ";
               query += "inner join pessoa_fisica as j on f.id_pessoa_fisica = j.id_pessoa_fisica ";
               query += "where p.data_vencimento <='" + data_atual + "' and c.status=1 and p.situacao='ABERTA'";
               MySqlConnection con = new MySqlConnection(Config.Conexao);
               MySqlCommand cmd = new MySqlCommand(query, con);
               con.Open();
               MySqlDataReader reader = cmd.ExecuteReader();
               if (!reader.HasRows)
               {
               con.Close();
               return false;
               }
               else
               {
               List<ParcelaReceber> lista = new List<ParcelaReceber>();

               while (reader.Read())
               {
                   ContaReceber c = new ContaReceber();
                   ParcelaReceber p = new ParcelaReceber();
                   Cliente cli = new Cliente();
                   cli.nome = reader["nome"].ToString();
                   c.data_vencimento = DateTime.Parse(reader["data_vencimento"].ToString());
                   c.valor_total = Convert.ToDecimal(reader["valor_total"].ToString());
                   c.valor_pago = Convert.ToDecimal(reader["valor_pago"].ToString());
                   c.situacao = "ABERTA";
                   c.id_conta_receber = Convert.ToInt32(reader["id_conta_receber"].ToString());
                   c.data_emissao = DateTime.Parse(reader["data_emissao"].ToString());
                   c.documento = reader["documento"].ToString();
                   c.entrada = Convert.ToDecimal(reader["entrada"].ToString());
                   p.valor = Convert.ToDecimal(reader["valor"].ToString());
                   p.data_vencimento = DateTime.Parse(reader["data_vencimento"].ToString());
                   p.conta_receber = c;
                   c.cliente = cli;
                   lista.Add(p);
               }
               con.Close();
               FrmContasReceberAtrazadas frm = new FrmContasReceberAtrazadas(lista);
               frm.MdiParent = principal;
               frm.Activate();
               frm.Show();
               return true;
               }
        }
Exemple #5
0
 public Cliente retorna_cliente()
 {
     Cliente cli = new Cliente();
         Endereco end = new Endereco();
         cli.id_cliente = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
         end.id_endereco = Convert.ToInt32(tabela.CurrentRow.Cells[1].Value.ToString());
         cli.nome = tabela.CurrentRow.Cells[2].Value.ToString();
         cli.cpf = tabela.CurrentRow.Cells[3].Value.ToString();
         cli.rg = tabela.CurrentRow.Cells[4].Value.ToString();
         string data = tabela.CurrentRow.Cells[5].Value.ToString();
         cli.data = DateTime.Parse(data);
         cli.genero = tabela.CurrentRow.Cells[6].Value.ToString();
         cli.email = tabela.CurrentRow.Cells[7].Value.ToString();
         cli.telefone = tabela.CurrentRow.Cells[8].Value.ToString();
         cli.celular = tabela.CurrentRow.Cells[9].Value.ToString();
         end.rua = tabela.CurrentRow.Cells[10].Value.ToString();
         end.bairro = tabela.CurrentRow.Cells[11].Value.ToString();
         end.numero = Convert.ToInt32(tabela.CurrentRow.Cells[12].Value.ToString());
         end.cidade = tabela.CurrentRow.Cells[13].Value.ToString();
         end.complemento = tabela.CurrentRow.Cells[14].Value.ToString();
         end.cep = tabela.CurrentRow.Cells[15].Value.ToString();
         end.uf = tabela.CurrentRow.Cells[16].Value.ToString();
         cli.endereco = end;
         return cli;
 }
Exemple #6
0
 public void seleciona_cliente(Cliente cli)
 {
     cliente = cli;
     txtCliente.Text = cli.nome;
 }
Exemple #7
0
 private void button2_Click(object sender, EventArgs e)
 {
     txtCliente.Text = "Nenhum";
     cliente = null;
 }
Exemple #8
0
 private void button2_Click(object sender, EventArgs e)
 {
     cliente = null;
     txtCliente.Text = "";
 }
Exemple #9
0
        public ContaReceber GerarConta()
        {
            ContaReceber c = new ContaReceber();
            int id = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
            MySqlConnection con = new MySqlConnection(Config.Conexao);
            string query = "select * from conta_receber where id_conta_receber ="+id;
            MySqlCommand cmd = new MySqlCommand(query, con);
            con.Open();
            MySqlDataReader reader = cmd.ExecuteReader();
            reader.Read();
            c.id_conta_receber = id;
            c.numDias = Convert.ToInt32(reader["num_dias"].ToString());
            c.valor_total = Convert.ToDecimal(reader["valor_total"].ToString());
            c.numParcelas = c.numDias = Convert.ToInt32(reader["num_parcelas"].ToString());
            c.situacao = reader["situacao"].ToString();
            c.valor_pago = Convert.ToDecimal(reader["valor_pago"].ToString());
            c.data_emissao = DateTime.Parse(reader["data_emissao"].ToString());
            c.data_vencimento = DateTime.Parse(reader["data_vencimento"].ToString());
            c.entrada = Convert.ToDecimal(reader["entrada"].ToString());
            string id_cli=reader["id_cliente"].ToString();
            reader.Close();
            if(id_cli.Length!=0){
            query = "select * from cliente as f inner join pessoa_fisica as p on f.id_pessoa_fisica =p.id_pessoa_fisica where f.id_cliente=" + id_cli;

            cmd.CommandText = query;
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Cliente f = new Cliente();
                f.celular = reader["p.celular"].ToString();
                f.cpf = reader["p.cpf"].ToString();
                f.email = reader["p.email"].ToString();
                f.nome = reader["p.nome"].ToString();
                f.telefone = f.celular = reader["p.telefone"].ToString();
                f.rg = f.celular = reader["p.rg"].ToString();
                c.cliente = f;
            }
            }
            else
            c.cliente=null;
            con.Close();
            return c;
        }