protected void btnVisualizar_Click(object sender, EventArgs e)
 {
     try
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         Session["DadosConsultaRepresentante"] = null;
         UsuarioWeb objUsuario        = Session["ObjetoUsuario"] as UsuarioWeb;
         string     sCodRepresentante = string.Empty;
         if (ckbVendedor.Checked)
         {
             sCodRepresentante = cbxVendedor.SelectedValue;
         }
         if (txtDataInicial.Text != "" && txtDataFinal.Text != "")
         {
             dsVendas ds = GetVendasByRepresentantes(Convert.ToDateTime(txtDataInicial.Text), Convert.ToDateTime(txtDataFinal.Text), objUsuario, sCodRepresentante);
             Session["VendasRepresLista"] = ds;
             string sDtInicial = txtDataInicial.Text.Replace("/", ".");
             string sDtFinal   = txtDataFinal.Text.Replace("/", ".");
             Response.Redirect("~/ViewVendasPorRepresentanteListagem.aspx?DT_INI=" + sDtInicial + "&DT_FIM=" + sDtFinal);
         }
         else
         {
             MessageHLP.ShowPopUpMsg("As datas estão incorretas.", this);
         }
     }
     catch (Exception ex)
     {
         MessageHLP.ShowPopUpMsg(ex.Message, this.Page);
     }
 }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);

        if (sUser == "")
        {
            Response.Redirect("~/Login.aspx");
        }
        if (!Page.IsPostBack)
        {
            string sTabela = WebConfigurationManager.AppSettings["TableItens"];
            if (sTabela.ToUpper() == "MOVIPEND")
            {
                gridConsultaPedidos.Columns[5].Visible = false;
            }
            BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoPedidoDetalhado"]);
            ParametroPesquisa objParametros = (ParametroPesquisa)Session["FiltroPedidos"];
            bool bParametrosValidos         = (objParametros != null);
            if (bParametrosValidos)
            {
                bParametrosValidos = (!objParametros.AindaNaoDefiniuFiltro());
            }
            if (!bParametrosValidos)
            {
                Response.Redirect("~/PesquisarPedidos.aspx");
                return;
            }

            PesquisaDadosPedido(objParametros);
        }
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(this.Session);

        if (sUser == "")
        {
            Response.Redirect("~/Login.aspx");
        }

        if (!IsPostBack)
        {
            UsuarioWeb objUsuario     = Session["ObjetoUsuario"] as UsuarioWeb;
            DataTable  dtDadosEmpresa = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet("EMPRESA left join cidades on (cidades.nm_cidnor = empresa.nm_cidnor) and (cidades.cd_ufnor = empresa.cd_ufnor)",
                                                                                    "empresa.cd_fonenor,empresa.cd_faxnor,empresa.cd_email,empresa.ds_endnor,empresa.ds_endcomp,empresa.nm_bairronor,cidades.nm_cidnor,empresa.cd_ufnor,empresa.cd_cepnor", "empresa.CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa.Trim() + "'");

            foreach (DataRow row in dtDadosEmpresa.Rows)
            {
                lblEmail.Text          = " " + row["cd_email"].ToString();
                lblFone1.Text          = row["cd_fonenor"].ToString();
                lblFone2.Text          = row["cd_faxnor"].ToString();
                lblEnderecoCabec.Text  = row["ds_endnor"].ToString() + " , " + row["ds_endcomp"].ToString() + " - " + row["nm_bairronor"].ToString();
                lblEnderecoRodape.Text = row["nm_cidnor"].ToString() + " / " + row["cd_ufnor"].ToString() + " -  CEP:" + row["cd_cepnor"].ToString();
            }
            if (sUser == "")
            {
                btnAcessar.Visible = true;
                VerificaAvisosGeral();
            }
            else
            {
                btnAcessar.Visible = false;
                VerificaAvisosGeraleVendedor();
            }
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);

        if (sUser == "")
        {
            Response.Redirect("~/Home.aspx");
        }
        if (!Page.IsPostBack)
        {
            BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoPedidoDetalhado"]);
            ParametroPesquisa objParametros = (ParametroPesquisa)Session["FiltroPedidos"];
            bool bParametrosValidos         = (objParametros != null);
            if (bParametrosValidos)
            {
                bParametrosValidos = (!objParametros.AindaNaoDefiniuFiltro());
            }
            if (!bParametrosValidos)
            {
                Response.Redirect("~/PesquisarPedidos.aspx");
                return;
            }
            PesquisarDados(objParametros.GetWhere(), objParametros.GetHaving());
        }
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }

            if (Request["PARAMETERCODIGO"] != null)
            {
                sCodigoPedido         = Request["PARAMETERCODIGO"].ToString();
                lblInfo.Text          = "Pedido nº " + sCodigoPedido.Trim() + " foi realizado com sucesso!";
                btnNovoPedido.Visible = true;
                btnImprimir.Visible   = true;
            }
            else if (Request["CD_PEDIDO_EMAIL"] != null)
            {
                sCodigoPedido = Request["CD_PEDIDO_EMAIL"].ToString();
                ParametroPesquisa objParametros = (ParametroPesquisa)Session["FiltroPedidos"];
                objParametros.Limpar();
                objParametros.AddCriterio(string.Format("PEDIDO.CD_PEDIDO = '{0}'", sCodigoPedido));
                lblInfo.Text          = "Pedido nº " + sCodigoPedido.Trim() + "!";
                btnNovoPedido.Visible = false;
                btnImprimir.Visible   = true;
            }
        }
    }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Login.aspx");
         }
         UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"];
         lblRemetente.Text = objUsuario.NomeUsuario.Trim();
         string sPathAnexo = "";
         if (Request.QueryString["ANEXO"].ToString() != String.Empty)
         {
             sPathAnexo = Request.QueryString["ANEXO"].ToString();
             FileInfo finfo = new FileInfo(Server.MapPath("Pedidos//" + sPathAnexo) + ".pdf");
             if (finfo.Exists)
             {
                 lblNmArquivo.Text = finfo.Name;
                 Session["ANEXO"]  = finfo;
             }
             txtDestino.Text = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("pedido inner join clifor on pedido.cd_cliente = clifor.cd_clifor",
                                                                             "coalesce(clifor.cd_emailweb,'')cd_emailweb",
                                                                             string.Format("pedido.cd_pedido = '{0}' and pedido.cd_empresa='{1}'", sPathAnexo, objUsuario.oTabelas.sEmpresa));
             txtTitulo.Text = "Confirmação do seu Pedido Web " + sPathAnexo + ".";
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }

            BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoClienteDetalhado"]);
            ParametroPesquisaCapoli.InicializarParametroPesquisa(
                "FiltroClientes", "CLIFOR", this.Session);
            Session["DadosConsultaClientes"] = null;

            if (Request["CD_ALTER"] != null)
            {
                MultViewPesquisaCliente.ActiveViewIndex = 1;
                UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"];
                lblMsg.Text          = "Cliente Salvo com sucesso!";
                lblCodigo.Text       = Request["CD_ALTER"].ToString();
                lblNmCliente.Text    = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("CLIFOR", "nm_clifor", "CD_ALTER='" + Request["CD_ALTER"].ToString() + "'");
                Session["NM_CLIFOR"] = "";
                Session["CD_ALTER"]  = null;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }
            object IncluiCliente = Request["inclui"];
            if (Convert.ToBoolean(IncluiCliente))
            {
                Session["IncluirClientePedido"] = true;
            }
            Session["Lista"]      = null;
            Session["ListaPreco"] = null;

            BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoClienteDetalhado"]);
            ParametroPesquisa objParametros = (ParametroPesquisa)Session["FiltroClientes"];
            Session["FiltroClientes"] = null;

            bool bParametrosValidos = (objParametros != null);
            if (bParametrosValidos)
            {
                bParametrosValidos = (!objParametros.AindaNaoDefiniuFiltro());
            }
            if (!bParametrosValidos)
            {
                Response.Redirect("~/PesquisarClientes.aspx");
                return;
            }
            PesquisarDados(objParametros.GetWhere());
        }
    }
Exemple #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }

            if (Request["PARAMETERCODIGO"] != null)
            {
                sCodigoPedido         = Request["PARAMETERCODIGO"].ToString();
                lblInfo.Text          = "Pedido nº " + sCodigoPedido.Trim() + " foi realizado com sucesso!";
                btnNovoPedido.Visible = true;
                btnImprimir.Visible   = true;
            }
            else if (Request["CD_PEDIDO_EMAIL"] != null)
            {
                sCodigoPedido         = Request["CD_PEDIDO_EMAIL"].ToString();
                lblInfo.Text          = "Pedido nº " + sCodigoPedido.Trim() + "!";
                btnNovoPedido.Visible = false;
                btnImprimir.Visible   = true;
            }
        }
    }
    private void PesquisarDados(string sWhere, string sHaving)
    {
        UsuarioWeb objUsuario      = (UsuarioWeb)Session["ObjetoUsuario"];
        DataTable  dtPedidos       = (DataTable)Session["DadosConsultaPedidos"];
        bool       bPesquisarDados = (dtPedidos == null);

        string sDoc    = "";
        string stpdocs = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("EMPRESA", "DS_TPDOCWEB", "CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa + "'");

        foreach (string item in stpdocs.Split(';'))
        {
            string[] tpdoc = item.Split(',');
            if (tpdoc.Length > 1)
            {
                sDoc = tpdoc[1].ToString().Trim();
            }
        }


        if (bPesquisarDados)
        {
            string sUserGestor = UsuarioWeb.GetNomeUsuarioGestorConectado(Session);
            string sUser       = UsuarioWeb.GetNomeUsuarioConectado(Session);

            StringBuilder str = new StringBuilder();
            str.Append("SELECT P.CD_EMPRESA, ");
            str.Append("P.DT_PEDIDO, ");
            str.Append("P.CD_PEDIDO, ");
            str.Append("P.NM_GUERRA ");
            str.Append("FROM PEDIDO P ");
            str.Append("LEFT OUTER JOIN MOVITEM MOVI ON (MOVI.CD_EMPRESA = P.CD_EMPRESA) AND (MOVI.CD_PEDIDO = P.CD_PEDIDO) ");
            str.Append("WHERE (P.CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa + "') AND ");
            str.Append("(P.CD_TIPODOC = '" + sDoc + "') AND ");
            string sReplace = sWhere.Replace("(PEDIDO.CD_VEND1 = '" + objUsuario.CodigoVendedor + "') AND", " ");
            str.Append(sReplace + " ");
            str.Append("GROUP BY P.CD_EMPRESA, P.DT_PEDIDO, P.CD_PEDIDO, P.NM_GUERRA ");

            if (!sHaving.Equals(String.Empty))
            {
                str.Append("HAVING " + sHaving);
            }
            dtPedidos = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet(
                str.ToString());

            DataColumn[] ChavePrimaria = new DataColumn[] { dtPedidos.Columns["CD_PEDIDO"] };
            dtPedidos.PrimaryKey            = ChavePrimaria;
            Session["DadosConsultaPedidos"] = dtPedidos;
        }
        if (dtPedidos.Rows.Count == 0)
        {
            MessageHLP.ShowPopUpMsg("Não existem registros no período selecionado", this.Page);
        }
        if (!Page.IsPostBack)
        {
            ProcessaDataBind();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Login.aspx");
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Home.aspx");
         }
         txtDataFinal.Text   = DateTime.Today.ToShortDateString();
         txtDataInicial.Text = (DateTime.Today.AddDays(-10)).ToShortDateString();
     }
 }
Exemple #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DateTime dDataFinal = DateTime.Now;
         txtDataFinal.Text   = dDataFinal.ToString("dd/MM/yyyy");
         txtDataInicial.Text = (dDataFinal.AddDays(-5).ToString("dd/MM/yyyy"));
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Login.aspx");
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Home.aspx");
         }
         rpt.Load(Server.MapPath("rptPedidoComissao.rpt"));
         rpt.SetDataSource((DataSet)Session["DataSetPedidoComissao"]);
         CrystalReportViewer1.ReportSource = rpt;
         GerarPDF();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Home.aspx");
         }
         rpt.Load(Server.MapPath("rptPedidoComissao.rpt"));
         rpt.SetDataSource((List <belComissao>)Session["DataSetPedidoComissao"]);
         rpt.DataDefinition.FormulaFields["f_vendedor"].Text = "\"" + ((List <belComissao>)Session["DataSetPedidoComissao"]).FirstOrDefault().NM_VEND + "\"";
         CrystalReportViewer1.ReportSource = rpt;
         GerarPDF();
     }
 }
Exemple #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Home.aspx");
         }
         DataTable TabelaImpressao = (DataTable)Session["DadosConsultaRepresentante"];
         rpt.Load(Server.MapPath("rptVendasRepresentante.rpt"));
         rpt.SetDataSource(TabelaImpressao);
         CrystalReportViewer1.ReportSource = rpt;
         GerarPDF();
     }
 }
Exemple #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"];

            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }

            string sCodigoPedido   = Request.QueryString["CD_PEDIDO"].ToString().Trim();
            string sCodigoEmpresa  = objUsuario.oTabelas.sEmpresa.Trim();
            string sCodigoVendedor = objUsuario.CodigoVendedor.Trim();



            //StringBuilder str = new StringBuilder();
            //str.Append("SELECT P.CD_EMPRESA, P.CD_PEDIDO, NF.CD_NFSEQ, NF.DT_EMI, MOVI.NR_LANC, ");
            //str.Append("CASE ");
            //str.Append("WHEN (MOVI.CD_DOC LIKE '______') THEN NF.CD_NOTAFIS ELSE '******' END AS NOTAFISCAL, ");
            //str.Append("MOVI.CD_ALTER, MOVI.DS_PROD ");
            //str.Append("FROM PEDIDO P ");
            //str.Append("LEFT OUTER JOIN MOVITEM MOVI ON (MOVI.CD_EMPRESA = P.CD_EMPRESA) AND (MOVI.CD_PEDIDO = P.CD_PEDIDO) ");
            //str.Append("LEFT OUTER JOIN NF ON (NF.CD_NFSEQ = MOVI.CD_NFSEQ) AND (NF.CD_EMPRESA = MOVI.CD_EMPRESA) ");
            //str.Append("WHERE (P.CD_EMPRESA = '" + sCodigoEmpresa + "') AND (PEDIDO.CD_VEND1 = '" + sCodigoVendedor + "') AND (MOVI.NR_LANC IS NOT NULL) AND ");
            //str.Append("(NF.CD_NFSEQ IS NOT NULL) AND (PEDIDO.CD_PEDIDO = '" + sCodigoPedido + "') ");
            //str.Append("ORDER BY NF.DT_EMI");



            //DataTable dtPedFaturado = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet(str.ToString());
            //if (dtPedFaturado.Rows.Count > 0)
            //{
            //    lblPedido.Text = "Pedido: " + sCodigoPedido;
            //    lblCliente.Text = "Cliente: " + objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("PEDIDO", "NM_GUERRA", "(CD_PEDIDO = '" + sCodigoPedido + "')");
            //    DataGrid1.DataSource = dtPedFaturado;
            //    DataGrid1.DataBind();
            //}
            //else
            //{
            //    Response.Redirect("~/Msg.aspx");

            //}
        }
    }
Exemple #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Home.aspx");
         }
         DataTable TabelaImpressao = (DataTable)Session["PedidoRes"];
         //MessageHLP.ShowPopUpMsg(Server.MapPath("rptPedido.rpt"), this);
         rpt.Load(Server.MapPath("rptPedido.rpt"));
         rpt.SetDataSource(TabelaImpressao);
         CrystalReportViewer1.ReportSource = rpt;
         GerarPDF();
     }
 }
Exemple #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DateTime dDataFinal = DateTime.Now;
            txtDataFinal.Text   = dDataFinal.ToString("dd/MM/yyyy");
            txtDataInicial.Text = (dDataFinal.AddDays(-5).ToString("dd/MM/yyyy"));
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }
        }

        BaseDAO.CancelarOperacaoObjetoDAO((BaseDAO)Session["ObjetoPedidoDetalhado"]);
        ParametroPesquisaCapoli.InicializarParametroPesquisa(
            "FiltroPedidos", "PEDIDO", this.Session);
        Session["DadosConsultaPedidos"] = null;
    }
Exemple #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string     sUser          = UsuarioWeb.GetNomeUsuarioConectado(Session);
            UsuarioWeb objUsuario     = new UsuarioWeb();
            DataTable  dtDadosEmpresa = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet("EMPRESA",
                                                                                    "nm_empresa,nm_guerra", "CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa.Trim() + "'");

            foreach (DataRow row in dtDadosEmpresa.Rows)
            {
                lblNmFantasia.Text = "Módulo de Vendas - " + row["nm_guerra"].ToString();
                lblNmEmpresa.Text  = row["nm_empresa"].ToString();
            }


            if (sUser != "")
            {
                string sMessage = string.Empty;
                int    iHour    = DateTime.Now.Hour;
                if (iHour >= 0 && iHour <= 12)
                {
                    sMessage = "Bom dia {0}";
                }
                else if (iHour > 12 && iHour <= 18)
                {
                    sMessage = "Boa tarde {0}";
                }
                else
                {
                    sMessage = "Boa noite {0}";
                }

                lblRepres.Text        = string.Format(sMessage, UsuarioWeb.GetNomeUsuarioConectado(Session));
                btnSair.OnClientClick = "return confirm('Deseja realmente sair do Sistema ?');";
            }
            else
            {
                lblRepres.Text = "";
            }
        }
    }
Exemple #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
         if (sUser == "")
         {
             Response.Redirect("~/Login.aspx");
         }
         if (Session["CD_ALTER"] != null)
         {
             txtCodigo.Text = Session["CD_ALTER"].ToString();
             EventoPesquisar();
         }
         if (Session["NM_CLIFOR"] != null)
         {
             txtCliente.Text = Session["NM_CLIFOR"].ToString();
         }
     }
 }
Exemple #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }
            UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"];

            cbxListaPreco.DataTextField  = "DS_LISTA";
            cbxListaPreco.DataValueField = "CD_LISTA";
            cbxListaPreco.DataSource     = GetListaPrecos();
            cbxListaPreco.DataBind();
            cbxListaPreco.SelectedIndex = 0;
            GridViewDb.DataSource       = GetProdutoGrid();
            GridViewDb.DataBind();
        }
    }
    protected void btnVisualizar_Click(object sender, EventArgs e)
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);

        if (sUser != "")
        {
            Session["DadosConsultaRepresentante"] = null;
            UsuarioWeb objUsuario        = Session["ObjetoUsuario"] as UsuarioWeb;
            string     sCodRepresentante = objUsuario.oTabelas.CdVendedorAtual;
            if (txtDataInicial.Text != "" && txtDataFinal.Text != "")
            {
                dsVendas ds = GetVendasByRepresentantes(Convert.ToDateTime(txtDataInicial.Text), Convert.ToDateTime(txtDataFinal.Text), objUsuario, sCodRepresentante);
                Session["VendasRepresLista"] = ds;
                string sDtInicial = txtDataInicial.Text.Replace("/", ".");
                string sDtFinal   = txtDataFinal.Text.Replace("/", ".");
                Response.Redirect("~/ViewVendasPorRepresentanteListagem.aspx?DT_INI=" + sDtInicial + "&DT_FIM=" + sDtFinal);
            }
            else
            {
                MessageHLP.ShowPopUpMsg("As datas estão incorretas.", this);
            }
        }
    }
Exemple #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Home.aspx");
            }
            string sPathAnexo = "";

            if (Request.QueryString["ANEXO"].ToString() != String.Empty)
            {
                sPathAnexo = Request.QueryString["ANEXO"].ToString();
                FileInfo finfo = new FileInfo(Server.MapPath("Pedidos//" + sPathAnexo) + ".pdf");
                if (finfo.Exists)
                {
                    sPathAnexo = finfo.FullName;
                }
                ShowFile2(sPathAnexo);
            }
        }
    }
Exemple #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (Request["DT_INI"] == null || Request["DT_FIM"] == null)
            {
                Response.Redirect("~/Home.aspx");
            }
            string sDataInicial = Request["DT_INI"].ToString();
            string sDataFinal   = Request["DT_FIM"].ToString();

            dsVendas dsImpressao = (dsVendas)Session["VendasRepresLista"];
            rpt.Load(Server.MapPath("rptVendasRepres.rpt"));
            rpt.SetDataSource(dsImpressao);
            CrystalReportViewer1.ReportSource = rpt;
            string sfiltro = string.Format("Período de {0} à {1}", sDataInicial, sDataFinal);
            if (rpt.DataDefinition.FormulaFields["Filtro"] != null)
            {
                rpt.DataDefinition.FormulaFields["Filtro"].Text = "\"" + sfiltro + "\"";
            }
            GerarPDF();
        }
    }
Exemple #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DateTime dDataFinal = DateTime.Now;
            string   sUser      = UsuarioWeb.GetNomeUsuarioConectado(Session);
            if (sUser == "")
            {
                Response.Redirect("~/Login.aspx");
            }
        }
        DataTable TabelaImpNf    = (DataTable)Session["NF"];
        DataTable TabelaImpDupli = (DataTable)Session["DUPLICATAS"];
        DataTable TabelaImpItens = (DataTable)Session["ITENS"];

        rpt.Load(Server.MapPath("RelatorioVendaNF.rpt"));
        rpt.SetDataSource(TabelaImpNf);
        //rpt.Subreports["SubRelatorioItensNF.rpt"].OpenSubreport("SubRelatorioItensNF.rpt");
        rpt.Subreports["SubRelatorioItensNF.rpt"].SetDataSource(TabelaImpItens);
        //rpt.Subreports[1].OpenSubreport("SubRelatorioDupli.rpt");
        rpt.Subreports["SubRelatorioDupli.rpt"].SetDataSource(TabelaImpDupli);
        CrystalReportViewer1.ReportSource = rpt;
        GerarPDF();
    }
Exemple #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);

        if (sUser == "")
        {
            Response.Redirect("~/Login.aspx");
        }
        object IncluiCliente = Request["inclui"];

        if (Convert.ToBoolean(IncluiCliente))
        {
            Session["IncluirClientePedido"] = false;
        }

        bool IncluiClientePedido = (bool)Session["IncluirClientePedido"];
        bool PesquisaPedido      = false;

        if (Session["PesquisaPendencia"] != null)
        {
            PesquisaPedido = (bool)Session["PesquisaPendencia"];
        }


        if (IncluiClientePedido)
        {
            btnConfirmar.Text = "Incluir Pedido";
            SomenteLeitura(false);
        }
        else if (PesquisaPedido)
        {
            btnConfirmar.Text = "Verificar Pendencia";
            SomenteLeitura(false);
        }
        else
        {
            btnConfirmar.Text = "Confirmar";
            SomenteLeitura(true);
        }
        UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"];
        CliforDAO  objCliente = ClienteDAOWeb.GetInstanciaClienteDAOWeb(Session,
                                                                        objUsuario);


        bool bSolicitouInclusao = ((IncluiCliente != null) &&
                                   (Convert.ToBoolean(IncluiCliente)));

        if (bSolicitouInclusao)
        {
            //A lógica está assim, a fim de que ao se clicar novamente em
            //inclusão o sistema limpe todos os campos e inicie um novo
            //cadastro.
            if (objCliente.Status != StatusRegistro.Nenhum)
            {
                objCliente.CancelarOperacao();
            }
            Response.Redirect("~/CadastroCliente.aspx?incluindo=true");
            return;
        }

        IncluiCliente = Request["incluindo"];
        bool bIncluindo = ((IncluiCliente != null) && (Convert.ToBoolean(IncluiCliente)));

        if ((bIncluindo) && (objCliente.Status != StatusRegistro.IncluindoRegistro))
        {
            if (objCliente.Status == StatusRegistro.AlterandoRegistro)
            {
                objCliente.CancelarOperacao();
            }
            objCliente.ProcessarPrevalidaCad();
            //  lblAdvertencia.Text = String.Empty;
            btnConfirmar.Text = "Cadastrar";
            CarregarValoresCamposLista();
            //  objCliente.PreencherComponentesComValoresBanco(this);
            cbxStPessoaJ_SelectedIndexChanged(null, null);
            txtCdBanco.Text = WebConfigurationManager.AppSettings["CdContaBancariaDefault"];
        }
        else if (!bIncluindo)
        {
            bool bClienteValido;
            try
            {
                if (objCliente.Status == StatusRegistro.IncluindoRegistro)
                {
                    objCliente.CancelarOperacao();
                }
                string  sCdClifor         = Request["CD_ALTER"].ToString();
                DataRow UltimoCliente     = objCliente.RegistroAtual;
                bool    bPesquisarCliente = (UltimoCliente == null);
                if (!bPesquisarCliente)
                {
                    string sUltimoClientePesquisado = UltimoCliente["CD_ALTER"].ToString();
                    bPesquisarCliente = (!sUltimoClientePesquisado.Equals(sCdClifor));
                }
                if (bPesquisarCliente)
                {
                    DataTable dtClifor = objCliente.Select(
                        "(CD_ALTER = '" + sCdClifor.ToString() + "') AND " +
                        "(CD_VEND1 = '" + objUsuario.CodigoVendedor + "') AND " +
                        "((ST_INATIVO <> 'S') OR (ST_INATIVO IS NULL)) ");
                    objCliente.RegistroAtual = dtClifor.Rows[0];
                }
                bClienteValido = (objCliente.RegistroAtual != null);
                if ((bClienteValido) && (objCliente.Status != StatusRegistro.AlterandoRegistro))
                {
                    objCliente.ProcessarPrevalidaAlt();
                }
            }
            catch
            {
                bClienteValido = false;
            }
            if (!bClienteValido)
            {
                Response.Redirect("~/PesquisarClientes.aspx");
                return;
            }
            ProcessarDataBind(objCliente);
            if (objCliente.Status == StatusRegistro.IncluindoRegistro)
            {
                btnConfirmar.OnClientClick = "return confirm('Deseja salvar as informações ?');";
            }
        }
    }
Exemple #28
0
    protected void btnRelatorioVendas_Click(object sender, EventArgs e)
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);

        if (sUser != "")
        {
            Session["DadosConsultaRepresentante"] = null;
            UsuarioWeb objUsuario        = Session["ObjetoUsuario"] as UsuarioWeb;
            string     sCodRepresentante = objUsuario.oTabelas.CdVendedorAtual;

            DateTime data   = DateTime.Now;
            int      iTotal = DateTime.DaysInMonth(data.Year, data.Month);

            string firstDayMonth = new DateTime(data.Year, data.Month, 1).ToShortDateString().Replace("/", ".");
            string lastDayMonth  = new DateTime(data.Year, data.Month, iTotal).ToShortDateString().Replace("/", ".");
            string firstDayWeek  = data.AddDays(1 - Convert.ToDouble(data.DayOfWeek)).ToShortDateString().Replace("/", ".");
            string lastDayWeek   = data.AddDays(7 - Convert.ToDouble(data.DayOfWeek)).ToShortDateString().Replace("/", ".");
            string today         = data.ToShortDateString().Replace("/", ".");

            string stpdocs     = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("EMPRESA", "DS_TPDOCWEB", "CD_EMPRESA = '" + objUsuario.oTabelas.sEmpresa + "'");
            string sTpdocFinal = "";
            foreach (string item in stpdocs.Split(';'))
            {
                string[] tpdoc = item.Split(',');
                if (tpdoc.Length > 1)
                {
                    sTpdocFinal += "'" + tpdoc[1].ToString().Trim() + "',";
                }
            }
            sTpdocFinal = sTpdocFinal.Remove(sTpdocFinal.Length - 1, 1);

            StringBuilder sQuery = new StringBuilder();
            sQuery.Append("select coalesce(sum(p.vl_totalped),0) TOTAL_MES,v.nm_vend, case ");
            sQuery.Append("when extract( month from p.dt_pedido) = 1 then 'Janeiro' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 2 then 'Fevereiro' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 3 then 'Março' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 4 then 'Abril' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 5 then 'Maio' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 6 then 'Junho' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 7 then 'Julho' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 8 then 'Agosto' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 9 then 'Setembro' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 10 then 'Outubro' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 11 then 'Novembro' ");
            sQuery.Append("when extract( month from p.dt_pedido) = 12 then 'Dezembro' ");
            sQuery.Append("end as Mes ,");
            sQuery.Append("(select coalesce(sum(p.vl_totalped),0)  ");
            sQuery.Append("from pedido p ");
            sQuery.Append("inner join clifor c on p.cd_cliente = c.cd_clifor ");
            sQuery.Append("inner join vendedor v on v.cd_vend = c.cd_vend1 ");
            sQuery.Append("where c.cd_vend1 = '{0}' ");
            sQuery.Append("and p.dt_pedido between '{4}' and '{5}' and ");
            sQuery.Append("p.cd_tipodoc in ({3})) TOTAL_SEMANA, ");
            sQuery.Append("(select coalesce(sum(p.vl_totalped),0)  ");
            sQuery.Append("from pedido p ");
            sQuery.Append("inner join clifor c on p.cd_cliente = c.cd_clifor ");
            sQuery.Append("inner join vendedor v on v.cd_vend = c.cd_vend1 ");
            sQuery.Append("where c.cd_vend1 = '{0}' ");
            sQuery.Append("and p.dt_pedido = '{6}' and ");
            sQuery.Append("p.cd_tipodoc in ({3})) TOTAL_DIA ");
            sQuery.Append("from pedido p inner join clifor c on p.cd_cliente = c.cd_clifor ");
            sQuery.Append("inner join vendedor v on v.cd_vend = c.cd_vend1 ");
            sQuery.Append("where ");
            sQuery.Append("c.cd_vend1 = '{0}' and ");
            sQuery.Append("p.dt_pedido between '{1}' and '{2}' and ");
            sQuery.Append("p.cd_tipodoc in ({3}) ");
            sQuery.Append("group by extract( month from p.dt_pedido), v.nm_vend order by extract( month from p.dt_pedido) ");

            string sQueryFinal = string.Format(sQuery.ToString(), sCodRepresentante, firstDayMonth, lastDayMonth, sTpdocFinal, firstDayWeek, lastDayWeek, today);
            Session["DadosConsultaRepresentante"] = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet(sQueryFinal);


            Page.Response.Redirect("~/ViewVendasRepresentante.aspx");
        }
    }
Exemple #29
0
    private void CarregaDados()
    {
        string sUser = UsuarioWeb.GetNomeUsuarioConectado(Session);

        if (sUser == "")
        {
            Response.Redirect("~/Login.aspx");
        }
        UsuarioWeb objUsuario = (UsuarioWeb)Session["ObjetoUsuario"];

        string CodigoCliente = (string)Session["CD_CLIFOR"];
        string NomeCliente   = (string)Session["NM_CLIFOR"];

        txtDataPedido.Text = GetDataFormatada(DateTime.Today.ToShortDateString().ToString());

        string strCD_PRAZO = String.Empty;

        if (CodigoCliente != null)
        {
            txtCodCli.Text = CodigoCliente;
            strCD_PRAZO    = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("CLIFOR INNER JOIN PRAZOS ON (PRAZOS.CD_PRAZO = CLIFOR.CD_PRAZO)", "PRAZOS.CD_PRAZO", "(CLIFOR.CD_CLIFOR = '" + txtCodCli.Text + "')");
            DataTable dtRet = objUsuario.oTabelas.hlpDbFuncoes.qrySeekRet(string.Format("select count(NR_DOC)TOTAL from doc_ctr where coalesce(st_baixa,'') <> 'B' and cd_empresa = '{0}' and cd_cliente = '{1}' and dt_venci < current_date", objUsuario.oTabelas.sEmpresa, CodigoCliente));
            Session["QtdePendencias"] = Convert.ToUInt32(dtRet.Rows[0]["TOTAL"].ToString());
            if (Session["QtdePendencias"] != null)
            {
                if (Convert.ToInt32(Session["QtdePendencias"].ToString()) > 0)
                {
                    lblPendencias.Text = String.Format("{0} Pendência{1}.", Session["QtdePendencias"].ToString(), (Convert.ToInt32(Session["QtdePendencias"].ToString()) > 1 ? "s" : ""));
                }
                else
                {
                    lblPendencias.Text = "";
                }
            }
        }
        else
        {
            Session["QtdePendencias"] = 0;
        }
        CarregaFormaPgto();

        if (NomeCliente != null)
        {
            txtCliente.Text = NomeCliente.ToUpper();
            //string sPrazoPadrao = objUsuario.oTabelas.hlpDbFuncoes.qrySeekValue("CLIFOR", "CD_PRAZO", "cd_clifor = '" + CodigoCliente + "'");
            //if (sPrazoPadrao != "")
            //{
            //    cbxCD_PRAZO.SelectedValue = sPrazoPadrao;
            //}
            //else
            //{
            //    cbxCD_PRAZO.SelectedValue = WebConfigurationManager.AppSettings["CondPagDefault"];
            //}
        }



        cbxDS_TPDOCWEB.DataSource = GetTPDOC();
        cbxDS_TPDOCWEB.DataBind();

        Session["lsCodigo"] = new List <string>();
    }