Esempio n. 1
0
 protected void btnValidaPlaca_Click(object sender, EventArgs e)
 {
     Limpadados();
     if (txtPlaca.Text != "" && txtDataNascimento.Text != "" && txtRenavan.Text != "" && txtChassi.Text != "" && slcCores.SelectedValue != "SELECIONE" && slcCombustivel.SelectedValue != "SELECIONE" && dropsexo.SelectedValue != "SELECIONE")
     {
         daoVourcher       bdv    = new daoVourcher();
         VendaVourcher     venda  = new VendaVourcher();
         VourcherDetalhada vs     = new VourcherDetalhada();
         DataSet           iTable = new DataSet();
         iTable = bdv.ValidaPlaca(txtPlaca.Text.Trim());
         int _countPlaca = Convert.ToInt32(iTable.Tables[0].Rows[0]["ds_Placa"].ToString());
         if (_countPlaca > 0)
         {
             lblmensagem.Visible = true;
             lblmensagem.Text    = "PLACA JA CONSTA NA BASE DE DADOS";
         }
         else
         {
             BuscaItens();
         }
     }
     else
     {
         lblmensagem.Visible = true;
         lblmensagem.Text    = "FAVOR PREENCHER TODOS OS DADOS";
     }
 }
Esempio n. 2
0
 private void BuscaDadosProdutos()
 {
     if (txtNumeroPedido.Text != "")
     {
         string        contrato = null;
         DataSet       ds_itens = new DataSet();
         daoVourcher   bdv      = new daoVourcher();
         VendaVourcher venda    = new VendaVourcher();
         bdv._tipo       = 3;
         bdv._id_veiculo = 0;
         bdv._idPedido   = Convert.ToInt32(txtNumeroPedido.Text);
         ds_itens        = bdv.getVourcherPedidos();
         if (ds_itens.Tables[0].Rows.Count > 0)
         {
             gridItens.DataSource = ds_itens;
             gridItens.DataBind();
             contrato = ds_itens.Tables[0].Rows[0]["nr_contrato"].ToString();
             if (contrato != "" && Session["fl_boleto"].ToString() == "1")
             {
                 btnIMprimir.Visible     = true;
                 btnGeraContrato.Visible = false;
             }
             else
             {
                 btnGeraContrato.Visible = false;
                 btnIMprimir.Visible     = false;
             }
         }
         else
         {
             gridItens.DataBind();
         }
     }
 }
Esempio n. 3
0
        public static string Veiculos(int id_pedido)
        {
            //string retorno = "";
            string        myJsonString;
            DataTable     dt    = new DataTable();
            daoVourcher   bv    = new daoVourcher();
            VendaVourcher venda = new VendaVourcher();

            bv._idPedido = id_pedido;
            var ret = venda.RetornaProdutos(bv.getVeiculos());

            myJsonString = (new JavaScriptSerializer()).Serialize(ret);

            return(myJsonString);
        }
Esempio n. 4
0
        private void getVeiculoSelecionado()
        {
            if (slcprodutos.SelectedValue != "SELECIONE" && txtNumeroPedido.Text != "")
            {
                DataSet       ds_itens = new DataSet();
                daoVourcher   bdv      = new daoVourcher();
                VendaVourcher venda    = new VendaVourcher();



                bdv._tipo       = 1;
                bdv._id_veiculo = Convert.ToInt32(slcprodutos.SelectedValue);
                bdv._idPedido   = Convert.ToInt32(txtNumeroPedido.Text);

                ds_itens             = bdv.getItensVeiculo();
                gridItens.DataSource = ds_itens;
                gridItens.DataBind();
                if (ds_itens.Tables[0].Rows[0]["ds_placa"].ToString() != "")
                {
                    txtPlaca.Text    = ds_itens.Tables[0].Rows[0]["ds_placa"].ToString().Replace("-", "");
                    txtPlaca.Enabled = false;
                }
                else
                {
                    txtPlaca.Text    = "";
                    txtPlaca.Enabled = true;
                }
                txtFabricante.Text      = ds_itens.Tables[0].Rows[0]["ds_fabricante"].ToString();
                txtModelo.Text          = ds_itens.Tables[0].Rows[0]["Modelo"].ToString();
                txtTipoVeiculo.Text     = ds_itens.Tables[0].Rows[0]["ds_categoria"].ToString();
                txtAno.Text             = ds_itens.Tables[0].Rows[0]["ds_ano"].ToString();
                btnGeraContrato.Visible = false;
                btnIMprimir.Visible     = false;
            }
            else
            {
                lblmensagem.Visible = true;
                lblmensagem.Text    = "FAVOR PREENCHER TODOS OS DADOS";
            }
        }
Esempio n. 5
0
        private void BuscaItens()
        {
            if (slcprodutos.SelectedValue != "SELECIONE" && txtNumeroPedido.Text != "")
            {
                string        contrato = null;
                DataSet       ds_itens = new DataSet();
                daoVourcher   bdv      = new daoVourcher();
                VendaVourcher venda    = new VendaVourcher();
                bdv._tipo            = 1;
                bdv._id_veiculo      = Convert.ToInt32(slcprodutos.SelectedValue);
                bdv._idPedido        = Convert.ToInt32(txtNumeroPedido.Text);
                ds_itens             = bdv.getItensVeiculo();
                gridItens.DataSource = ds_itens;
                gridItens.DataBind();

                txtFabricante.Text  = ds_itens.Tables[0].Rows[0]["ds_fabricante"].ToString();
                txtModelo.Text      = ds_itens.Tables[0].Rows[0]["Modelo"].ToString();
                txtTipoVeiculo.Text = ds_itens.Tables[0].Rows[0]["ds_categoria"].ToString();
                txtAno.Text         = ds_itens.Tables[0].Rows[0]["ds_ano"].ToString();
                contrato            = ds_itens.Tables[0].Rows[0]["nr_contrato"].ToString();
                //if(contrato != null)
                //contrato = Convert.ToInt32(ds_itens.Tables[0].Rows[0]["nr_contrato"].ToString());
                if (contrato != "")
                {
                    btnIMprimir.Visible     = true;
                    btnGeraContrato.Visible = false;
                }
                else
                {
                    btnGeraContrato.Visible = true;
                    btnIMprimir.Visible     = false;
                }
            }
            else
            {
                lblmensagem.Visible = true;
                lblmensagem.Text    = "FAVOR PREENCHER TODOS OS DADOS";
            }
        }
Esempio n. 6
0
        private void BuscaPagamentos(int pedido)
        {
            Session["fl_boleto"] = "0";
            daoVourcher       bdv          = new daoVourcher();
            VendaVourcher     venda        = new VendaVourcher();
            VourcherDetalhada vs           = new VourcherDetalhada();
            DataTable         iTpagamentos = new DataTable();

            iTpagamentos = bdv.getPagamentos(pedido);
            if (iTpagamentos.Rows.Count > 0)
            {
                gridPagamentos.DataSource = iTpagamentos;
                gridPagamentos.DataBind();

                foreach (DataRow dw in iTpagamentos.Rows)
                {
                    int boleto = Convert.ToInt32(dw[9].ToString());
                    if (boleto == 1)
                    {
                        Session["fl_boleto"] = 1;
                    }
                }
            }
        }
Esempio n. 7
0
        public void  setContrato()
        {
            if (txtNumeroPedido.Text != "" && txtCpfCnpj.Text != "" && txtRg.Text != "" && txtPlaca.Text != "" && txtVendedor.Text != "" && txtMidia.Text != "" && txtCep.Text != "" && txtChassi.Text != "" && txtCelular.Text != "" && txtTelefone.Text != "" && txtUF.Text != "" && txtFabricante.Text != "" && txtModelo.Text != "" && dropsexo.SelectedValue != "SELECIONE" && slcCombustivel.SelectedValue != "SELECIONE" && slcprodutos.SelectedValue != "SELECIONE" && slcCores.SelectedValue != "SELECIONE" && txtAno.Text != "" && txtTipoVeiculo.Text != "" && txtDataNascimento.Text != "" && txtBairro.Text != "" && txtCidade.Text != "" && txtNumero.Text != "")
            {
                int ret = 0;
                try
                {
                    AcessoLogin acessoLogin = (AcessoLogin)Session["acessoLogin"];
                    lblmensagem.Text = "";
                    VendaVourcher venda       = new VendaVourcher();
                    daoVourcher   bdc         = new daoVourcher();
                    DataSet       dsPedido    = new DataSet();
                    string        nr_contrato = null;
                    string        habilita    = "N".ToString();
                    DataSet       dsValida    = new DataSet();
                    daoPedido     bdv         = new daoPedido();
                    var           tipovenda   = venda.tpVenda(bdc.getTpVenda(Convert.ToInt32(txtNumeroPedido.Text)));
                    string        nr_CpfCnpj  = txtCpfCnpj.Text.Replace(".", "").Replace("/", "").Replace("-", "").ToString();
                    string        ds_placa    = txtPlaca.Text;
                    bdv._nrDocumento = nr_CpfCnpj;
                    dsValida         = bdc.ValidaGeracaoPedidos(nr_CpfCnpj, ds_placa);
                    if (dsValida.Tables[0].Rows.Count > 0)
                    {
                        lblmensagem.Visible = true;
                        lblmensagem.Text    = "Cpf vinculado ao contrato: " + dsValida.Tables[0].Rows[0]["Pedido"].ToString() + " com status: " + dsValida.Tables[0].Rows[0]["status"].ToString();
                    }
                    else
                    {
                        bdc._dsNome = txtNome.Text;
                        if (nr_CpfCnpj.Length > 11)
                        {
                            bdc._tpPessoa = 1;
                        }
                        else
                        {
                            bdc._tpPessoa = 0;
                        }
                        if (bdc._tpPessoa == 0)
                        {
                            bdc._dsCpf = nr_CpfCnpj;
                        }
                        else
                        {
                            bdc._dsCnpj = nr_CpfCnpj;
                        }

                        bdc._dsRg               = txtRg.Text;
                        bdc._dtNascimento       = Convert.ToDateTime(txtDataNascimento.Text);
                        bdc._dsEndereco         = txtEndereco.Text;
                        bdc._nrResidencia       = txtNumero.Text;
                        bdc._dsComplemento      = txtComplemento.Text;
                        bdc._dsCep              = txtCep.Text;
                        bdc._dsBairro           = txtBairro.Text;
                        bdc._dsCidade           = txtCidade.Text;
                        bdc._dsUF               = txtUF.Text;
                        bdc._nrTelResidencial   = txtTelefone.Text;
                        bdc._nrTelCelular       = txtCelular.Text;
                        bdc._ds_pontoReferencia = txtComplemento.Text;
                        bdc._dsEmail            = txtEmail.Text;
                        bdc._tpVeiculo          = txtTipoVeiculo.Text;
                        bdc._ds_fabricante      = txtFabricante.Text;
                        bdc._ds_modelo          = txtModelo.Text;
                        bdc._ds_placa           = ds_placa;
                        bdc._id_veiculo         = Convert.ToInt32(slcprodutos.SelectedValue);
                        DataSet dsValidaHabit = new DataSet();
                        dsValidaHabit = bdc.ValidaHabilitacao();
                        if (dsValidaHabit.Tables[0].Rows.Count > 0)
                        {
                            bdc._dt_Renova = DateTime.Now.AddMonths(12);
                        }
                        else
                        {
                            bdc._dt_Renova = DateTime.Now;
                        }
                        bdc._ds_anoVeiculo  = txtAno.Text;
                        bdc._ds_cor         = slcCores.SelectedValue;
                        bdc._ds_combustivel = slcCombustivel.SelectedValue;
                        bdc._ds_Renavam     = txtRenavan.Text;
                        bdc._ds_Chassi      = txtChassi.Text;
                        bdc._ds_Produto     = slcprodutos.SelectedItem.Text;
                        bdc._id_produto     = slcprodutos.SelectedValue;
                        bdc._ds_vendedor    = txtVendedor.Text.Substring(0, 6);
                        bdc._ds_sexo        = dropsexo.SelectedValue;
                        bdc._ds_Profissao   = "1";
                        bdc._idmidia        = txtMidia.Text;
                        bdc._nrPedido       = Convert.ToInt32(txtNumeroPedido.Text);
                        bdc._ds_usuario     = acessoLogin.Nome;
                        nr_contrato         = bdc.pro_setGeraContrato();
                        if (nr_contrato != null)
                        {
                            bdc._nrcontrato = nr_contrato;
                            ret             = bdc.pro_setVinculaContrato(nr_contrato);
                            //if (bdc._id_produto == "000424" || bdc._id_produto == "000425" || bdc._id_produto == "000426" || bdc._id_produto == "000420" || bdc._id_produto == "000427" || bdc._id_produto == "000436" || bdc._id_produto == "000437" || bdc._id_produto == "000438" || bdc._id_produto == "000439")
                            //{
                            //    int gravar = bdc.pro_seQbe();
                            //}
                            lblmensagem.Visible = true;
                            lblmensagem.Text    = "Contrato gerado com sucesso : " + nr_contrato;
                            if (Session["fl_boleto"].ToString() == "1")
                            {
                                btnIMprimir.Visible = true;
                            }
                            else
                            {
                                btnIMprimir.Visible = true;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    lblmensagem.Visible = true;
                    lblmensagem.Text    = ex.ToString();
                }
            }
            else
            {
                lblmensagem.Visible = true;
                lblmensagem.Text    = "FAVOR PREENCHER TODOS OS DADOS";
            }
        }
Esempio n. 8
0
        public static string setContrato(int id_veiculo, int nr_pedido, string ds_produto, string ds_nome, string nr_CpfCnpj,
                                         string nr_RG, string nr_Cep, string ds_endereco, string nr_residencial,
                                         string ds_complemento, string ds_bairro, string ds_cidade, string ds_uf,
                                         string ds_telefone, string ds_celular, string ds_sexo, string ds_placa,
                                         string dt_nascimento, string ds_email, string ds_fabricante,
                                         string tp_Veiculo, string ds_modelo, string ds_AnoVeiculo, string ds_cores, string ds_combustivel,
                                         string ds_renavan, string ds_chassi, string ds_vendedor, string ds_midia)
        {
            string retorno = "";
            string myJsonString;
            int    ret = 0;

            try
            {
                VendaVourcher venda       = new VendaVourcher();
                daoVourcher   bdc         = new daoVourcher();
                DataSet       dsPedido    = new DataSet();
                string        nr_contrato = null;
                string        habilita    = "N".ToString();
                DataSet       dsValida    = new DataSet();
                daoPedido     bdv         = new daoPedido();
                var           tipovenda   = venda.tpVenda(bdc.getTpVenda(nr_pedido));
                nr_CpfCnpj       = nr_CpfCnpj.Replace(".", "").Replace("/", "").Replace("-", "").ToString();
                bdv._nrDocumento = nr_CpfCnpj;
                dsValida         = bdc.ValidaGeracaoPedidos(nr_CpfCnpj, ds_placa);
                if (dsValida.Tables[0].Rows.Count > 0)
                {
                    retorno      = "Cpf vinculado ao contrato: " + dsValida.Tables[0].Rows[0]["Pedido"].ToString() + " com status: " + dsValida.Tables[0].Rows[0]["status"].ToString();
                    myJsonString = (new JavaScriptSerializer()).Serialize(retorno);
                }
                else
                {
                    bdc._dsNome = ds_nome;
                    if (nr_CpfCnpj.Length > 11)
                    {
                        bdc._tpPessoa = 1;
                    }
                    else
                    {
                        bdc._tpPessoa = 0;
                    }
                    if (bdc._tpPessoa == 0)
                    {
                        bdc._dsCpf = nr_CpfCnpj;
                    }
                    else
                    {
                        bdc._dsCnpj = nr_CpfCnpj;
                    }

                    bdc._dsRg               = nr_RG;
                    bdc._dtNascimento       = Convert.ToDateTime(dt_nascimento);
                    bdc._dsEndereco         = ds_endereco;
                    bdc._nrResidencia       = nr_residencial;
                    bdc._dsComplemento      = ds_complemento;
                    bdc._dsCep              = nr_Cep;
                    bdc._dsBairro           = ds_bairro;
                    bdc._dsCidade           = ds_cidade;
                    bdc._dsUF               = ds_uf;
                    bdc._nrTelResidencial   = ds_telefone;
                    bdc._nrTelCelular       = ds_celular;
                    bdc._ds_pontoReferencia = ds_complemento;
                    bdc._dsEmail            = ds_email;
                    bdc._tpVeiculo          = tp_Veiculo;
                    bdc._ds_fabricante      = ds_fabricante;
                    bdc._ds_modelo          = ds_modelo;
                    bdc._ds_placa           = ds_placa;
                    bdc._id_veiculo         = id_veiculo;
                    DataSet dsValidaHabit = new DataSet();
                    dsValidaHabit = bdc.ValidaHabilitacao();
                    if (dsValidaHabit.Tables[0].Rows.Count > 0)
                    {
                        bdc._dt_Renova = DateTime.Now.AddMonths(12);
                    }
                    else
                    {
                        bdc._dt_Renova = DateTime.Now;
                    }
                    bdc._ds_anoVeiculo  = ds_AnoVeiculo;
                    bdc._ds_cor         = ds_cores;
                    bdc._ds_combustivel = ds_combustivel;
                    bdc._ds_Renavam     = ds_renavan;
                    bdc._ds_Chassi      = ds_chassi;
                    bdc._ds_Produto     = ds_produto;

                    bdc._ds_vendedor  = ds_vendedor;
                    bdc._ds_sexo      = ds_sexo;
                    bdc._ds_Profissao = "1";
                    bdc._idmidia      = ds_midia;
                    nr_contrato       = bdc.pro_setGeraContrato();
                    if (nr_contrato != null)
                    {
                        bdc._nrcontrato = nr_contrato;
                        ret             = bdc.pro_setVinculaContrato(nr_contrato);
                        return("Contrato gerado com sucesso : " + nr_contrato);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return("");
        }
Esempio n. 9
0
 public void BuscaDados()
 {
     if (dropFiltro.SelectedValue != "SELECIONE" && (txtBuscaDados.Text != "" || txtConsultaCpfCnpj.Text != ""))
     {
         DataSet       dt             = new DataSet();
         string        fl_retirado    = "N";
         string        fl_recebimento = "2";
         string        nr_os          = null;
         AcessoLogin   acessoLogin    = (AcessoLogin)Session["acessoLogin"];
         daoVourcher   bv             = new daoVourcher();
         VendaVourcher venda          = new VendaVourcher();
         bv._tipo = Convert.ToInt32(dropFiltro.SelectedValue);
         if (bv._tipo == 1)
         {
             bv._idPedido = Convert.ToInt32(txtBuscaDados.Text);
         }
         else
         {
             bv._dsFiltro = txtConsultaCpfCnpj.Text;
         }
         dt = bv.get_Vourcher();
         if (dt.Tables[0].Rows.Count > 0)
         {
             txtDataPedido.Text   = dt.Tables[0].Rows[0]["dt_pedido"].ToString();
             txtNumeroPedido.Text = dt.Tables[0].Rows[0]["id_pedido"].ToString();
             txtStatusPedido.Text = dt.Tables[0].Rows[0]["st_pedido"].ToString();
             txtCpfCnpj.Text      = dt.Tables[0].Rows[0]["nr_cpfCnpj"].ToString();
             txtRg.Text           = dt.Tables[0].Rows[0]["nr_rg"].ToString();
             txtNome.Text         = dt.Tables[0].Rows[0]["ds_cliente"].ToString();
             txtCep.Text          = dt.Tables[0].Rows[0]["nr_cep"].ToString();
             txtNumero.Text       = dt.Tables[0].Rows[0]["nr_endereco"].ToString();
             txtComplemento.Text  = dt.Tables[0].Rows[0]["ds_complemento"].ToString();
             txtBairro.Text       = dt.Tables[0].Rows[0]["ds_bairro"].ToString();
             txtCidade.Text       = dt.Tables[0].Rows[0]["ds_cidade"].ToString();
             txtUF.Text           = dt.Tables[0].Rows[0]["ds_uf"].ToString();
             txtTelefone.Text     = dt.Tables[0].Rows[0]["nr_telefone"].ToString();
             txtCelular.Text      = dt.Tables[0].Rows[0]["nr_celular"].ToString();
             txtEmail.Text        = dt.Tables[0].Rows[0]["ds_email"].ToString();
             txtEndereco.Text     = dt.Tables[0].Rows[0]["ds_endereco"].ToString();
             txtMidia.Text        = dt.Tables[0].Rows[0]["cd_midia"].ToString();
             txtVendedor.Text     = dt.Tables[0].Rows[0]["ds_vendedor"].ToString();
             fl_retirado          = dt.Tables[0].Rows[0]["fl_retirado"].ToString();
             fl_recebimento       = dt.Tables[0].Rows[0]["id_tipoRecebimento"].ToString();
             BuscaVeiculos(Convert.ToInt32(txtNumeroPedido.Text));
             BuscaPagamentos(Convert.ToInt32(txtNumeroPedido.Text));
             BuscaCoresAutomotivas();
             BuscaDadosProdutos();
             DataSet ds_os = bv.getValidaStatusOS(Convert.ToInt32(txtNumeroPedido.Text));
             if (ds_os.Tables[0].Rows.Count > 0)
             {
                 nr_os = ds_os.Tables[0].Rows[0]["nr_os"].ToString();
             }
             if (txtStatusPedido.Text == "CONFIRMADO")
             {
                 lblmensagem.Text       = "";
                 btnValidaPlaca.Visible = true;
             }
             else if (txtStatusPedido.Text == "PENDENTE")
             {
                 if (fl_retirado == "S" || fl_recebimento == "1" || acessoLogin.Nome == ConfigurationManager.AppSettings[("liberado1")].ToString() || acessoLogin.Nome == ConfigurationManager.AppSettings[("liberado2")].ToString() || nr_os != null)
                 {
                     lblmensagem.Text       = "";
                     btnValidaPlaca.Visible = true;
                 }
                 else
                 {
                     lblmensagem.Text    = "PEDIDO COM STATUS: " + txtStatusPedido.Text + "  NÃO FOI DISTRIBUIDO OS MOTOBOY não foi passado para distribuição Motoboy, ou  usuário não tem permissão. Vendedor :  " + txtVendedor.Text;
                     lblmensagem.Visible = true;
                     gridItens.DataBind();
                     gridPagamentos.DataBind();
                     LimpaCampos();
                     btnValidaPlaca.Visible = false;
                 }
             }
             else
             {
                 lblmensagem.Visible    = true;
                 lblmensagem.Text       = "PEDIDO COM STATUS: " + txtStatusPedido.Text + " NÃO PODE SER GERADO CONTRATO,NECESSARIO CONCLUIR PEDIDO, VENDEDOR " + txtVendedor.Text;
                 btnValidaPlaca.Visible = false;
             }
         }
         else
         {
             gridItens.DataBind();
             gridPagamentos.DataBind();
             lblmensagem.Visible = true;
             lblmensagem.Text    = "NÃO ENCONTRAMOS ESSE PEDIDO/VOURCHER";
             LimpaCampos();
         }
     }
     else
     {
         lblmensagem.Visible = true;
         lblmensagem.Text    = "FAVOR PREENCHER TODOS OS DADOS";
     }
 }