Esempio n. 1
0
        public Fornecedor getFornecedor()
        {
            Fornecedor forn = new Fornecedor();
            Pessoa_Juridica jur = new Pessoa_Juridica();
            Endereco end = new Endereco();
            forn.id_fornecedor = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
            end.id_endereco = Convert.ToInt32(tabela.CurrentRow.Cells[1].Value.ToString());
            forn.razao_social = tabela.CurrentRow.Cells[2].Value.ToString();

            forn.nome_fantasia = tabela.CurrentRow.Cells[3].Value.ToString();
            forn.cnpj = tabela.CurrentRow.Cells[4].Value.ToString();
            forn.inscricao_estadual = tabela.CurrentRow.Cells[5].Value.ToString();
            forn.email = tabela.CurrentRow.Cells[6].Value.ToString();
            forn.telefone = tabela.CurrentRow.Cells[7].Value.ToString();
            forn.celular = tabela.CurrentRow.Cells[8].Value.ToString();
            end.rua = tabela.CurrentRow.Cells[9].Value.ToString();
            end.bairro = tabela.CurrentRow.Cells[10].Value.ToString();
            end.numero = Convert.ToInt32(tabela.CurrentRow.Cells[11].Value.ToString());
            end.cidade = tabela.CurrentRow.Cells[12].Value.ToString();
            end.complemento = tabela.CurrentRow.Cells[13].Value.ToString();
            end.cep = tabela.CurrentRow.Cells[14].Value.ToString();
            end.uf = tabela.CurrentRow.Cells[15].Value.ToString();
            jur.id_pessoa_juridica = Convert.ToInt32(tabela.CurrentRow.Cells[tabela.ColumnCount-1].Value.ToString());
            jur.endereco = end;
            forn.pessoa_juridica=jur;
            return forn;
        }
Esempio n. 2
0
 public FrmCadFornecedor(FrmConsultaFornecedor consulta, Fornecedor fornecedor)
 {
     InitializeComponent();
     init(consulta);
     this.fornecedor = fornecedor;
     PreencherCampos();
     txtcnpj.Enabled = false;
     txtrazaosocial.Enabled = false;
 }
Esempio n. 3
0
 public FrmCadProduto(FrmConsultaProduto consulta, Produto produto)
 {
     InitializeComponent();
     init(consulta);
     this.produto=produto;
     this.fornecedor = produto.fornecedor;
     PreencherCampos();
     //txtdescricao.Enabled = false;
     txtcodigo.Enabled = false;
     txtquantidade_inicial.Enabled = false;
     txtunidade.Enabled = false;
 }
Esempio n. 4
0
        public static bool verifica_Contas_pagar_atrazadas(FrmPrincipal principal)
        {
            string data_atual = GeraDataMysql.Gerar(DateTime.Now);
               string query = "select * from parcela_pagar as p inner join conta_pagar as c on p.id_conta_pagar = c.id_conta_pagar inner join fornecedor as f on f.id_fornecedor = c.id_fornecedor ";
               query += "inner join pessoa_juridica as j on f.id_pessoa_juridica = j.id_pessoa_juridica ";
               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<ParcelaPagar> lista = new List<ParcelaPagar>();

               while (reader.Read())
               {
                  ContaPagar c = new ContaPagar();
                  ParcelaPagar p = new ParcelaPagar();
                  Fornecedor f = new Fornecedor();
                  f.razao_social = reader["razao_social"].ToString();
                  c.credor = reader["credor"].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_pagar = Convert.ToInt32(reader["id_conta_pagar"].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_pagar=c;
                  c.fornecedor = f;
                  lista.Add(p);
               }
               con.Close();
               FrmContasPagarAtrazadas frm = new FrmContasPagarAtrazadas(lista);
               frm.MdiParent= principal;
               frm.Activate();
               frm.Show();
               return true;
               }
        }
Esempio n. 5
0
 public Produto getProduto()
 {
     Produto p = new Produto();
        Fornecedor forn = new Fornecedor();
        p.id_produto = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
        forn.id_fornecedor = Convert.ToInt32(tabela.CurrentRow.Cells[1].Value.ToString());
        p.codigo = tabela.CurrentRow.Cells[2].Value.ToString();
        p.descricao = tabela.CurrentRow.Cells[3].Value.ToString();
        p.estoque= Convert.ToInt64( tabela.CurrentRow.Cells[4].Value.ToString());
        p.unidade = tabela.CurrentRow.Cells[5].Value.ToString();
        p.preco_compra = Convert.ToDecimal(tabela.CurrentRow.Cells[6].Value.ToString());
        p.preco_venda = Convert.ToDecimal(tabela.CurrentRow.Cells[7].Value.ToString());
        forn.razao_social = tabela.CurrentRow.Cells[8].Value.ToString();
        p.data_cadastro = DateTime.Parse(tabela.CurrentRow.Cells[9].Value.ToString());
        p.quantidade_minima = Convert.ToInt32(tabela.CurrentRow.Cells[10].Value.ToString());
        p.fornecedor = forn;
        return p;
 }
Esempio n. 6
0
 public void seleciona_fornecedor(Fornecedor f)
 {
     txtfornecedor.Text = f.razao_social;
     this.fornecedor = f;
 }
Esempio n. 7
0
 private void button2_Click(object sender, EventArgs e)
 {
     fornecedor = null;
     txtFornecedor.Text = "";
 }
Esempio n. 8
0
        public void seleciona_Fornecedor(Fornecedor f)
        {
            fornecedor = f;

            txtFornecedor.Text = f.razao_social;
        }
Esempio n. 9
0
        public ContaPagar GerarConta()
        {
            ContaPagar c = new ContaPagar();
            int id = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
            MySqlConnection con = new MySqlConnection(Config.Conexao);
            string query = "select * from conta_pagar where id_conta_pagar ="+id;
            MySqlCommand cmd = new MySqlCommand(query, con);
            con.Open();
            MySqlDataReader reader = cmd.ExecuteReader();
            reader.Read();
            c.id_conta_pagar = 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.credor = reader["credor"].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_forn=reader["id_fornecedor"].ToString();
            reader.Close();
            if(id_forn.Length!=0){
            query = "select * from fornecedor as f inner join pessoa_juridica as p on f.id_pessoa_juridica=p.id_pessoa_juridica where f.id_fornecedor=" + id_forn;

            cmd.CommandText = query;
            reader = cmd.ExecuteReader();
            reader.Read();
               while (reader.Read())
            {
                Fornecedor f = new Fornecedor();
                f.celular = reader["celular"].ToString();
                f.cnpj = reader["p.cnpj"].ToString();
                f.email = reader["p.email"].ToString();
                f.razao_social = reader["p.razao_social"].ToString();
                f.telefone = f.celular = reader["p.telefone"].ToString();
                f.inscricao_estadual = f.celular = reader["p.inscricao_estadual"].ToString();
                f.id_pessoa_juridica = Convert.ToInt32(reader["p.id_pessoa_juridica"]);
                c.fornecedor = f;
            }
            }
            else
            c.fornecedor=null;
            con.Close();
            return c;
        }
Esempio n. 10
0
 private void button2_Click(object sender, EventArgs e)
 {
     txtFornecedor.Text = "Nenhum";
     fornecedor = null;
 }