private void btLocalizar_Click(object sender, EventArgs e)
        {
            btReceber.Enabled = false;
            frmConsultaVenda f = new frmConsultaVenda();

            f.ShowDialog();
            if (f.codigo != 0)
            {
                DaoConexao  cx     = new DaoConexao(DadosDeConexao.StringDeConexao);
                BLLVenda    bll    = new BLLVenda(cx);
                ModeloVenda modelo = bll.CarregaModeloVenda(f.codigo);
                txtCodigo.Text = modelo.VenCod.ToString();
                dtData.Value   = modelo.VenData;
                BLLCliente    bllf    = new BLLCliente(cx);
                ModeloCliente modeloc = bllf.CarregaModeloCliente(modelo.CliCod);
                txtCliente.Text = modeloc.CliNome;
                txtValor.Text   = modelo.VenTotal.ToString();

                BLLParcelasVenda bllp = new BLLParcelasVenda(cx);
                dgvParcelas.DataSource = bllp.Localizar(modelo.VenCod);

                dgvParcelas.Columns[0].Visible    = false;
                dgvParcelas.Columns[1].HeaderText = "Parcela";
                dgvParcelas.Columns[1].Width      = 100;
                dgvParcelas.Columns[2].HeaderText = "Valor da parcela";
                dgvParcelas.Columns[2].Width      = 225;
                dgvParcelas.Columns[3].HeaderText = "Recebido em";
                dgvParcelas.Columns[3].Width      = 200;
                dgvParcelas.Columns[4].HeaderText = "Vencimento";
                dgvParcelas.Columns[4].Width      = 250;
            }
        }
Beispiel #2
0
        private void vendaToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmConsultaVenda f = new frmConsultaVenda();

            f.ShowDialog();
            f.Dispose();
        }
Beispiel #3
0
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaVenda f = new frmConsultaVenda();

            f.ShowDialog();
            if (f.codigo != 0)
            {
                DaoConexao  cx     = new DaoConexao(DadosDeConexao.StringDeConexao);
                BLLVenda    bll    = new BLLVenda(cx);
                ModeloVenda modelo = bll.CarregaModeloVenda(f.codigo);
                txtVenCodigo.Text = modelo.VenCod.ToString();
                txtNFiscal.Text   = modelo.VenNFiscal.ToString();
                dtDataVenda.Value = modelo.VenData;
                txtCliCod.Text    = modelo.CliCod.ToString();
                txtCliCod_Leave(sender, e); //para escrever o nome do cliente na tela
                cbTpagto.SelectedValue = modelo.TpaCod;
                cbNParcelas.Text       = modelo.VenNParcelas.ToString();
                if (modelo.VenAvista == 1)
                {
                    cbVendaAVista.Checked = true;
                }
                else
                {
                    cbVendaAVista.Checked = false;
                }
                txtTotalVenda.Text = modelo.VenTotal.ToString();
                this.totalVenda    = modelo.VenTotal; //armazenar o valor total da venda

                //itens da venda
                BLLItensVenda bllItens = new BLLItensVenda(cx);
                DataTable     tabela   = bllItens.Localizar(modelo.VenCod);
                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]["itv_qtde"].ToString();
                    string   ivu        = tabela.Rows[i]["itv_valor"].ToString();
                    Double   TotalLocal = Convert.ToDouble(tabela.Rows[i]["itv_qtde"]) * Convert.ToDouble(tabela.Rows[i]["itv_valor"]);
                    String[] it         = new String[] { icod, inome, iqtd, ivu, TotalLocal.ToString() };
                    this.dgvItens.Rows.Add(it);
                }

                this.alteraBotoes(3);
                lbMsg.Visible = false;
                if (modelo.VenStatus != "ativa")
                {
                    //lbMsg.Text = "Venda Cancelada";
                    lbMsg.Visible     = true;
                    btExcluir.Enabled = false;
                }
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            f.Dispose();
        }
Beispiel #4
0
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            try
            {
                frmConsultaVenda f = new frmConsultaVenda();
                f.ShowDialog();


                if (f.codigo != 0)
                {
                    txtCod.Text = f.codigo.ToString();
                }


                f.Dispose();
            }
            catch { }
        }
Beispiel #5
0
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaVenda f = new frmConsultaVenda();
            f.ShowDialog();
            f.Dispose();

            if (f.codigo != 0)
            {
                itensVenda.Clear();

                DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);

                BLLTipoPagamento blltp = new BLLTipoPagamento(cx);
                cbxTipoPagamento.DataSource = blltp.Localizar("");
                cbxTipoPagamento.DisplayMember = "tpa_nome";
                cbxTipoPagamento.ValueMember = "tpa_cod";

                BLLCliente bllcli = new BLLCliente(cx);
                cbxCliente.DataSource = bllcli.Localizar("");
                cbxCliente.DisplayMember = "cli_nome";
                cbxCliente.ValueMember = "cli_cod";

                BLLProduto bllpro = new BLLProduto(cx);
                cbxProduto.DataSource = bllpro.Localizar("");
                cbxProduto.DisplayMember = "pro_nome";
                cbxProduto.ValueMember = "pro_cod";

                BLLVenda bllvenda = new BLLVenda(cx);
                ModeloVenda modelo = bllvenda.CarregaModeloVenda(f.codigo);

                cbxTipoPagamento.SelectedValue = modelo.TpaCod;
                cbxCliente.SelectedValue = modelo.CliCod;
                txtNumParcelas.Text = Convert.ToString(modelo.VenNparcelas);

                this.codigo = modelo.VenCod;

                BLLItemVenda bll2 = new BLLItemVenda(cx);
                DataTable itens = bll2.Localizar(Convert.ToInt32(modelo.VenCod));
                foreach(DataRow linha in itens.Rows)
                {
                    ModeloItemVenda item = new ModeloItemVenda();
                    item = bll2.CarregaModeloItemVenda(Convert.ToInt32(linha["itemvenda_cod"].ToString()));
                    itensVenda.Add(item);
                }

                dataGridItens.DataSource = null;
                dataGridItens.DataSource = itensVenda;
                dataGridItens.Refresh();

                alteraBotoes(3);

                atualizarTotal();
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            f.Dispose();
        }