コード例 #1
0
        private void Buscar()
        {
            int         pedido      = Convert.ToInt32(txtConsulta.Text);
            DataTable   dt          = new DataTable();
            DaoBordero  dados       = new DaoBordero();
            AcessoLogin acessoLogin = (AcessoLogin)Session["acessoLogin"];
            int         id_franquia = acessoLogin.idFranquia;

            if (id_franquia == 0 && dropfranquias.SelectedValue != "Selecione")
            {
                id_franquia = Convert.ToInt32(dropfranquias.SelectedValue);
            }

            dt = dados.pro_getCorrigirCheque(pedido, id_franquia);
            if (dt.Rows.Count > 0)
            {
                GvBordero.DataSource = dt;
                GvBordero.DataBind();
            }
            else
            {
                dt = dados.pro_getCorrigirChequeTroca(pedido, id_franquia);
                if (dt.Rows.Count > 0)
                {
                    GvBordero.DataSource = dt;
                    GvBordero.DataBind();
                }
                else
                {
                    dvLeitura.Visible    = false;
                    dadosCheques.Visible = false;
                    GvBordero.DataBind();
                }
            }
        }
コード例 #2
0
        private void BuscaDadosAdm()
        {
            int tipo = 0;

            if (txtConsulta.Text != "")
            {
                int nr_status = Convert.ToInt32(dropStatus.SelectedValue);
                switch (nr_status)
                {
                case 0:
                    tipo = 2;
                    break;

                case 1:
                    tipo = 3;
                    break;

                case 2:
                    tipo = 4;
                    break;

                case 3:
                    tipo = 5;
                    break;
                }
                int         selecao     = Convert.ToInt32(dropSelecao.SelectedValue);
                AcessoLogin acessoLogin = (AcessoLogin)Session["acessoLogin"];
                DaoBordero  bdb         = new DaoBordero();
                DataTable   dt          = new DataTable();
                switch (selecao)
                {
                case 1:
                    //Busca Por Número de Borderô
                    dt = bdb.pro_getDadosBordero(tipo, Convert.ToInt32(txtConsulta.Text), 0);
                    break;

                case 2:
                    dt = bdb.pro_getBorderopedido(tipo, Convert.ToInt32(txtConsulta.Text.Trim()), 0);
                    break;

                case 3:
                    dt = bdb.getBorderoContrato(tipo, txtConsulta.Text.Trim(), 0);
                    break;

                default:
                    Mensagem("Selecione uma fonte de pesquisa...");
                    break;
                }

                if (dt.Rows.Count > 0)
                {
                    GvBordero.DataSource = dt;
                    Session.Add("Exportar", dt);
                    GvBordero.DataBind();

                    foreach (DataRow dr in dt.Rows)
                    {
                        txtFranquia.Text = dr[17].ToString();
                    }
                    decimal Somatotal   = 0;
                    decimal SomaLiquido = 0;
                    Txt_nr_quantidade.Text = dt.Rows.Count.ToString();
                    foreach (GridViewRow row in GvBordero.Rows)
                    {
                        decimal valor = Convert.ToDecimal(row.Cells[14].Text);
                        Somatotal = Somatotal + valor;

                        decimal liquido = Convert.ToDecimal(row.Cells[15].Text);
                        SomaLiquido = SomaLiquido + liquido;
                    }
                    Txt_vl_bruto.Text   = Somatotal.ToString();
                    Txt_vl_liquido.Text = SomaLiquido.ToString();
                    totalizador.Visible = true;
                }
                else
                {
                    GvBordero.DataBind();
                    pnlDados.Visible = false;
                    Mensagem("Não existe dados para essa fonte de pesquisa");
                    totalizador.Visible = false;
                }
            }
            else
            {
                Mensagem("Favor inserir todos os dados..");
                totalizador.Visible = false;
            }
        }