Esempio n. 1
0
        private void compraToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmConsultaCompra f = new frmConsultaCompra();

            f.ShowDialog();
            f.Dispose();
        }
Esempio n. 2
0
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaCompra f = new frmConsultaCompra();
            f.ShowDialog();
            f.Dispose();

            if (f.codigo != 0)
            {
                DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
                BLLCompra bll = new BLLCompra(cx);
                ModeloCompra modelo = bll.CarregaModeloCompra(f.codigo);

                txtCodigo.Text = modelo.ComCod.ToString();
                txtDataCompra.Text = modelo.ComData;
                txtNota.Text = modelo.ComNfiscal.ToString();
                txtValorTotal.Text = modelo.ComTotal.ToString();
                txtNParcelas.Text = modelo.ComParcelas.ToString();
                txtStatus.Text = modelo.ComStatus.ToString();
                txtFornecedor.Text = modelo.ForCod.ToString();
                txtTipoPagamento.Text = modelo.TpaCod.ToString();

                alteraBotoes(3);
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            f.Dispose();
        }
Esempio n. 3
0
        private void mnuConsultaCompra_Click(object sender, EventArgs e)
        {
            frmConsultaCompra f = new frmConsultaCompra();

            f.ShowDialog();
            f.Dispose();
        }
Esempio n. 4
0
        private void btnLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaCompra f = new frmConsultaCompra();

            Close();
            f.ShowDialog();
            f.Dispose();
        }
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaCompra f = new frmConsultaCompra();

            f.ShowDialog();
            if (f.codigo != 0)
            {
                DALConexao   cx     = new DALConexao(DadosDaConexao.StringDeConexao);
                BLLCompra    bll    = new BLLCompra(cx);
                ModeloCompra modelo = bll.CarregaModeloCompra(f.codigo);
                txtCodCom.Text     = modelo.ComCod.ToString();
                txtNFiscal.Text    = modelo.ComNFiscal.ToString();
                dtDataCompra.Value = modelo.ComData;
                txtForCod.Text     = modelo.ForCod.ToString();
                txtForCod_Leave(sender, e);               // para escrever o nome do fornecedor na tela
                txtTotal.Text          = modelo.ComTotal.ToString();
                this.totalCompra       = modelo.ComTotal; //armazena o valor total da compra
                cbTPagto.SelectedValue = modelo.TpaCod;
                cbNParcelas.Text       = modelo.ComNParcelas.ToString();

                //itens da compra
                BLLItensCompra bllitens = new BLLItensCompra(cx);
                DataTable      tabela   = bllitens.Localizar(modelo.ComCod);
                for (int i = 0; i < tabela.Rows.Count; i++)
                {
                    string   icod       = tabela.Rows[i]["pro_cod"].ToString();
                    string   inome      = tabela.Rows[i]["pro_nome"].ToString();
                    string   iqtd       = tabela.Rows[i]["itc_qtde"].ToString();
                    string   ivu        = tabela.Rows[i]["itc_valor"].ToString();
                    Double   TotalLocal = Convert.ToDouble(tabela.Rows[i]["itc_qtde"]) * Convert.ToDouble(tabela.Rows[i]["itc_valor"]);
                    String[] it         = new String[] { icod, inome, iqtd, ivu, TotalLocal.ToString() };
                    this.dgvItens.Rows.Add(it);
                }

                alteraBotoes(3);
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            f.Dispose();
        }
        //=============================================================================================================
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            //exiber o formulario de consulta compra:
            frmConsultaCompra f = new frmConsultaCompra();

            f.ShowDialog();

            //verificar se tem um codigo carregado:{diferente de zero}
            if (f.codigo != 0)
            {
                DALConexao   cx     = new DALConexao(DadosDaConexao.StringDeConexao);
                BLLCompra    bll    = new BLLCompra(cx);
                ModeloCompra modelo = bll.CarregaModeloCompra(f.codigo);//carrega o modelo da comprea pelo codigo
                //--------------------------------------------------------------------------------------------------------
                //  CARREGAR OS DADOS DA COMPRA
                //--------------------------------------------------------------------------------------------------------
                txtComCod.Text     = modelo.ComCod.ToString();
                txtNFiscal.Text    = modelo.ComNfiscal.ToString();
                dtDataCompra.Value = modelo.ComData;
                txtForCod.Text     = modelo.ForCod.ToString();
                txtForCod_Leave(sender, e);//evento escrever o nome do fornecedor
                //rodapé:
                cbNParcela.Text     = modelo.ComNparcelas.ToString();
                txtTotalCompra.Text = modelo.ComValorTotal.ToString(); //VALOR TOTAL
                this.totalCompra    = modelo.ComValorTotal;            //armazena o total na variavel

                //fazer um LOCALIZAR - select para trazer o numero de parcela
                //fazer um LOCALIZAR - select para trazer a data da primeira parcela

                //TIPO DE PAGAMENTO.
                cbTPagto.SelectedValue = modelo.TpaCod;


                //carregar itens da compra: https://youtu.be/rMOyapoHTx0?list=PLfvOpw8k80Wqj1a66Qsjh8jj4hlkzKSjA&t=204
                BLLItensCompra bLLIt    = new BLLItensCompra(cx);
                DataTable      tabelaIt = bLLIt.Localizar(modelo.ComCod); //passa os itens da compra para uma tabela:
                for (int i = 0; i < tabelaIt.Rows.Count; i++)             //enquanto i for menos que o numero de linhas retornodo
                {
                    //pega os valores: cada loop vai para a prox. linha = i
                    string icod  = tabelaIt.Rows[i]["pro_cod"].ToString();
                    string inome = tabelaIt.Rows[i]["pro_nome"].ToString();
                    string iqtd  = tabelaIt.Rows[i]["itc_qtde"].ToString();
                    string ivund = tabelaIt.Rows[i]["itc_valor"].ToString();

                    //calcula o valor total de cada intem:
                    Double TotalLocalx = Convert.ToDouble(tabelaIt.Rows[i]["itc_qtde"]) * Convert.ToDouble(tabelaIt.Rows[i]["itc_valor"]);

                    //monta uma matriz da linha com os calores de cada coluna:
                    String[] iten = new String[] { icod, inome, iqtd, ivund, txtTotalCompra.Text, TotalLocalx.ToString() };
                    this.dgvItens.Rows.Add(iten);//adicoina os itens da linha no datagrdi...
                }

                alteraBotoes(3);
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }

            //destroi o obejto
            f.Dispose();
        }
Esempio n. 7
0
 private void compraToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     frmConsultaCompra conscomp = new frmConsultaCompra();
     conscomp.ShowDialog();
     conscomp.Dispose();
 }