Ejemplo n.º 1
0
    public static String Grava(string xcodigo,
                               string xproduto,
                               string xlinha1,
                               string xlinha2,
                               string xlinha3,
                               string xlinha4,
                               string xlinha5
                               )
    {
        if (xproduto == "")
        {
            xproduto = "0";
        }

        if ((xcodigo != String.Empty) && (xproduto != String.Empty))
        {
            string script = "INSERT INTO boleto_mensagens VALUES ( " +
                            xcodigo +
                            ", " + xproduto +
                            ", " + Srelib.QStr(xlinha1) +
                            ", " + Srelib.QStr(xlinha2) +
                            ", " + Srelib.QStr(xlinha3) +
                            ", " + Srelib.QStr(xlinha4) +
                            ", " + Srelib.QStr(xlinha5) +
                            " ) ";

            //" where nome=" + Rgblib.QStr(pParametro);

            SreDblib.ExecScript(script);
        }
        return(" ");
    }
Ejemplo n.º 2
0
    public static String Altera(string xID,
                                string xnome,
                                string xdescricao,
                                string xorgao,
                                string xdivulgacao,
                                string xperiodicidade,
                                string xtipo,
                                string xinicio,
                                string xfim,
                                string xdmais,
                                Boolean xativo,
                                string xobserva_1,
                                string xobserva_2)
    {
        string script = "UPDATE INDEXADORES SET " +
                        " descricao = " + Srelib.QStr(xdescricao) +
                        " ,orgao = " + Srelib.QStr(xorgao) +
                        " ,divulgacao = " + Srelib.QStr(xdivulgacao) +
                        " ,inicio = " + xinicio +
                        " ,fim = " + xfim +
                        " ,dmais = " + xdmais +
                        ", ativo = " + Convert.ToString(Convert.ToInt16(xativo)) +
                        " ,observa_1 = " + Srelib.QStr(xobserva_1) +
                        " ,observa_2 = " + Srelib.QStr(xobserva_2) +
                        " where ID =" + xID;

        SreDblib.ExecScript(script);

        return(" ");
    }
Ejemplo n.º 3
0
    public static DataSet PegaDadosCep2007(string xcep, Boolean xcepespecial)
    {
        string script = "";

        if (xcep != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, " +
                         " (select c.Cidade from localidades c where c.id = l.CodLoc ) Cidade, " +
                         " (select c.UF from localidades c where c.id = l.CodLoc ) UF " +
                         " from logradouros l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            else
            {
                script = "select l.*, l.nome Complemento, " +
                         " (select c.Cidade from localidades c where c.id = l.CodLoc ) Cidade, " +
                         " (select c.UF from localidades c where c.id = l.CodLoc ) UF " +
                         " from especiais l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Ejemplo n.º 4
0
    public static DataSet PegaDadosLogradouro2014(string xendereco, string xuf, Boolean xcepespecial)
    {
        string script = "";

        if (xendereco != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_logradouro l where l.endereco like " + Srelib.QStr("%" + xendereco + "%");
                if (xuf != String.Empty)
                {
                    script = script + " and l.ufe_sg = " + Srelib.QStr(xuf);
                }
                script = script + " order by UF, Cidade";
            }
            else
            {
                script = " select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_grande_usuario l where l.endereco like " + Srelib.QStr("%" + xendereco + "%");
                if (xuf != String.Empty)
                {
                    script = script + " and l.ufe_sg = " + Srelib.QStr(xuf);
                }
                script = script + " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Ejemplo n.º 5
0
    public static DataSet PegaDadosCep2014(string xcep, Boolean xcepespecial)
    {
        string script = "";

        if (xcep != String.Empty)
        {
            if (!xcepespecial)
            {
                script = "select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_logradouro l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            else
            {
                script = " select l.*, l.ufe_sg UF, " +
                         " (select c.loc_nosub from log_localidade c where c.loc_nu_sequencial = l.loc_nu_sequencial ) Cidade " +
                         " from log_grande_usuario l where l.cep = " + Srelib.QStr(xcep) +
                         " order by UF, Cidade";
            }
            return(SreDblib.GetDsScriptCep(script));
        }
        else
        {
            return(null);
        }
    }
Ejemplo n.º 6
0
    public void AutenticaEmail(string wempresa, ref bool wckemail, ref bool wckssl, ref string wsmtpporta, ref string wlogin, ref string wsenha, ref bool wcktls)
    {
        String script = "SELECT ckemail, ckssl, smtpporta, login, senha, cktls " +
                        "FROM empresa WITH(NOLOCK) " +
                        "WHERE apelido = " + Srelib.QStr(wempresa);
        DataSet ds = SreDblib.GetDsScript(script);


        if (ds.Tables[0].Rows.Count == 0)
        {
            wckemail   = false;
            wsmtpporta = "";
            wlogin     = "";
            wsenha     = "";
            wckssl     = false;
            wcktls     = false;
        }
        else
        {
            wckemail   = Convert.ToBoolean(ds.Tables[0].Rows[0]["ckemail"].ToString());
            wckssl     = Convert.ToBoolean(ds.Tables[0].Rows[0]["ckssl"].ToString());
            wcktls     = Convert.ToBoolean(ds.Tables[0].Rows[0]["cktls"].ToString());
            wsmtpporta = ds.Tables[0].Rows[0]["smtpporta"].ToString();
            wlogin     = ds.Tables[0].Rows[0]["login"].ToString();
            wsenha     = ds.Tables[0].Rows[0]["senha"].ToString();
        }
        ds.Clear();
    }
Ejemplo n.º 7
0
    public static String GravaSaldoInicial(string xcod_conta,
                                           string xdata,
                                           string xdescricao,
                                           string xcomplemento,
                                           string xsaldo_i,
                                           string xsaldo_aplicacaoD,
                                           string xsaldo_aplicacaoB,
                                           string xdtregistro)
    {
        if (xsaldo_i.Trim() == "")
        {
            xsaldo_i = "0.00";
        }

        if (xcod_conta != String.Empty)
        {
            string script = "INSERT INTO CONTAS_SALDO_INICIAL VALUES ( " +
                            Srelib.QStr(xcod_conta) +
                            ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdata)) +
                            ", " + Srelib.QStr(xdescricao) +
                            ", " + Srelib.QStr(xcomplemento) +
                            ", " + Srelib.forcaponto(xsaldo_i) +
                            ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdtregistro)) +
                            ", " + Srelib.forcaponto(xsaldo_aplicacaoD) +
                            ", " + Srelib.forcaponto(xsaldo_aplicacaoB) +
                            " ) ";

            SreDblib.ExecScript(script);
        }
        return(" ");
    }
Ejemplo n.º 8
0
    public void WebGravaLog(String pBase,
                            String pLogin,
                            String pIp,
                            String pCod,
                            String pComplem,
                            String pXml)
    {
        // Conexao Conn = new Conexao(pXml);
        String Qry = "EXEC WEBLOGINC " +
                     Srelib.QStr(pBase) + "," +
                     Srelib.QStr(pLogin) + "," +
                     Srelib.QStr(pIp) + "," +
                     pCod + "," +
                     Srelib.QStr(pComplem) + "," +
                     Srelib.QStr(pLogin);

        DS = new DataSet();
        SqlCommand Command = new SqlCommand(Qry, DM.ConexaoSessao);

        Command.CommandTimeout = 99999;
        SqlDataAdapter DA = new SqlDataAdapter();

        Command.ExecuteNonQuery();
        // Conn.SqlConn.Close();
    }
Ejemplo n.º 9
0
    public static String AlteraContaSaldoInicial(string xID,
                                                 string xcod_conta,
                                                 string xdata,
                                                 string xdescricao,
                                                 string xcomplemento,
                                                 string xsaldo_i,
                                                 string xsaldo_aplicacaoD,
                                                 string xsaldo_aplicacaoB,
                                                 string xdtregistro)
    {
        string script = "UPDATE CONTAS_SALDO_INICIAL SET " +
                        " cod_conta = " + Srelib.QStr(xcod_conta) +
                        " ,data = " + Srelib.QStr(Srelib.DataAmericanasembarra(xdata)) +
                        " ,descricao = " + Srelib.QStr(xdescricao) +
                        " ,complemento = " + Srelib.QStr(xcomplemento) +
                        " ,saldo_i = " + Srelib.forcaponto(xsaldo_i) +
                        " ,saldo_aplicacaoD = " + Srelib.forcaponto(xsaldo_aplicacaoD) +
                        " ,saldo_aplicacaoB = " + Srelib.forcaponto(xsaldo_aplicacaoB) +
                        " ,dtregistro = " + Srelib.QStr(Srelib.DataAmericanasembarra(xdtregistro)) +
                        " where ID =" + xID;

        //revisar quando mexer na cobrança bancária

        SreDblib.ExecScript(script);

        return(" ");
    }
Ejemplo n.º 10
0
    public static String GravaTaxa(string xmes, string xano, string xnome, string xvalor)
    {
        if (xvalor.Trim() == "")
        {
            xvalor = "0";
        }

        if (xmes != string.Empty)
        {
            string script = "UPDATE TAXAS_MENSAIS " +
                            " SET " + xnome + " = " + Srelib.forcaponto(xvalor) +
                            " WHERE MES = " +
                            Srelib.QStr(xmes) +
                            " AND ANO = " +
                            Srelib.QStr(xano);

            //Srelib.QStr(Srelib.QStr0(xmes, 2)) +
            // " AND ANO = " +
            //Srelib.QStr(Srelib.QStr0(xano, 4));
            //" where nome=" + Rgblib.QStr(pParametro);

            SreDblib.ExecScript(script);
        }
        return(" ");
    }
Ejemplo n.º 11
0
    public static DataSet PegaDadosTaxasMensaisNome(String xNome, DateTime xPrevisao1, DateTime xPrevisao2)
    {
        string script;

        if (xNome == "")
        {
            script = " SELECT * FROM taxas_mensais WITH(NOLOCK) " +
                     " WHERE (Convert(DateTime," + Srelib.QStr("01/") + "+mes+" + Srelib.QStr("/") + "+ano,103) " +
                     " between " + Srelib.QStr(Srelib.DataAmericanasembarra(Convert.ToString(xPrevisao1))) +
                     " and " + Srelib.QStr(Srelib.DataAmericanasembarra(Convert.ToString(xPrevisao2))) + ") " +
                     " order by " +
                     "REPLICATE('0', 4 - LEN(ano)) + CAST(ano AS varchar), " +
                     "REPLICATE('0', 2 - LEN(mes)) + CAST(mes AS varchar) ";
        }
        else
        {
            script = "SELECT mes, ano, " + xNome + " FROM taxas_mensais WITH(NOLOCK) " +
                     " WHERE (Convert(DateTime," + Srelib.QStr("01/") + "+mes+" + Srelib.QStr("/") + "+ano,103) " +
                     " between " + Srelib.QStr(Srelib.DataAmericanasembarra(Convert.ToString(xPrevisao1))) +
                     " and " + Srelib.QStr(Srelib.DataAmericanasembarra(Convert.ToString(xPrevisao2))) + ") " +
                     " order by " +
                     "REPLICATE('0', 4 - LEN(ano)) + CAST(ano AS varchar), " +
                     "REPLICATE('0', 2 - LEN(mes)) + CAST(mes AS varchar) ";
        }

        return(SreDblib.GetDsScript(script));
    }
Ejemplo n.º 12
0
    public static String Grava(string xlogin,
                               string xdata,
                               string xhora,
                               string xtabela,
                               string xoperacao,
                               string xobs,
                               string xacao)
    {
        if (xlogin != String.Empty)
        {
            if (Convert.ToInt32(xhora.Substring(0, 2)) > 23)
            {
                xhora = "00:00:00";
            }

            string script = "INSERT INTO LOG VALUES ( " +
                            Srelib.QStr(xlogin) +
                            ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdata) + " " + xhora) +
                            ", newid() " +
                            ", " + Srelib.QStr(xtabela) +
                            ", " + Srelib.QStr(xoperacao) +
                            ", " + Srelib.QStr(xobs) +
                            ", " + Srelib.QStr(xacao) +
                            " ) ";

            //" where nome=" + Rgblib.QStr(pParametro);

            SreDblib.ExecScript(script);
        }
        return(" ");
    }
Ejemplo n.º 13
0
    public static DataSet LookUpLogAcoes(string xusuario,
                                         string xData1,
                                         string xData2,
                                         string xModulo,
                                         string xAcao,
                                         string xComplementoAcao)
    {
        //
        string script;

        if (xusuario == "")
        {
            script = "SELECT * FROM log WITH(NOLOCK) WHERE (DataHora >= " + Srelib.QStr(Srelib.DataAmericanasembarra(xData1)) +
                     " and DataHora <= " + Srelib.QStr(Srelib.DataAmericanasembarra(xData2)) + ") ";
        }
        else
        {
            script = "SELECT * FROM log WITH(NOLOCK) WHERE Login = "******" and (DataHora >= " + Srelib.QStr(Srelib.DataAmericanasembarra(xData1)) +
                     " and DataHora <= " + Srelib.QStr(Srelib.DataAmericanasembarra(xData2)) + ") ";
        }

        script = script + " and ((tabela like " + Srelib.QStr("%" + xComplementoAcao.ToUpper() + "%") + ") ";

        script = script + " or (obs like " + Srelib.QStr("%" + xComplementoAcao.ToUpper() + "%") + ") ";

        script = script + " or (acao like " + Srelib.QStr("%" + xComplementoAcao.ToUpper() + "%") + ")) ";

        script = script + " order by DataHora";

        return(SreDblib.GetDsScript(script));
    }
Ejemplo n.º 14
0
    public static String Exclui(string xID, string xnome, string xperiodicidade)
    {
        //Indexadores
        string script = "";

        script = " DELETE FROM INDEXADORES " +
                 " WHERE NOT EXISTS (SELECT 1 FROM VENDAS " +
                 " WHERE indexador  = " + Srelib.QStr(xnome.ToUpper()) + " ) and nome = " + Srelib.QStr(xnome.ToUpper()) + " ";
        SreDblib.ExecScript(script);
        //
        //Campo
        if (xperiodicidade == "DIARIA")
        {
            script = "if not exists(select 1 from vendas where indexador = " + Srelib.QStr(xnome.ToUpper()) + ") " +
                     " ALTER TABLE TAXAS_DIARIAS " +
                     " DROP COLUMN [" + xnome.ToUpper() + "]";
        }
        else
        {
            script = "if not exists(select 1 from vendas where indexador = " + Srelib.QStr(xnome.ToUpper()) + ") " +
                     " ALTER TABLE TAXAS_MENSAIS " +
                     " DROP COLUMN [" + xnome.ToUpper() + "]";
        }
        SreDblib.ExecScript(script);

        return(" ");
    }
Ejemplo n.º 15
0
    public DataSet PegaGerentes(Usuario xUsuario, String cGerente, Boolean lMaster, String pXml)
    {
        // Conexao Conn = new Conexao(pXml);

        String Qry;

        String cMaster = "0";

        if (lMaster)
        {
            cMaster = "1";
        }

        Qry = "SELEC_GERENTES " +
              xUsuario.CodUsuario + "," +
              Srelib.QStr(cGerente) + "," +
              cMaster;

        DS = new DataSet();
        SqlCommand Command = new SqlCommand(Qry, DM.ConexaoSessao);

        Command.CommandTimeout = 99999;
        SqlDataAdapter DA = new SqlDataAdapter();

        DA.TableMappings.Add("Table", "CRTOTCED1");
        DA.SelectCommand = Command;

        DA.Fill(DS);

        // Conn.SqlConn.Close();

        return(DS);
    }
Ejemplo n.º 16
0
    public static int PegaMaiorCritica(String wempresa, String wcedente, int wtipo_op, int wbordero, String wduplicata, String wbanco, String wagencia, String wconta, String wcheque)
    {
        String sql = "SELECT top 1 codigo FROM criticas WITH(NOLOCK) " +
                     "WHERE empresa=" + Srelib.QStr(wempresa) +
                     " and cedente=" + Srelib.QStr(wcedente) +
                     " and tipo_operacao=" + Convert.ToString(wtipo_op) +
                     " and bordero=" + Convert.ToString(wbordero) +
                     " and duplicata=" + Srelib.QStr(wduplicata) +
                     " and banco=" + Srelib.QStr(wbanco) +
                     " and agencia=" + Srelib.QStr(wagencia) +
                     " and conta=" + Srelib.QStr(wconta) +
                     " and cheque=" + Srelib.QStr(wcheque);

        if ((SreDblib.GetParametro("CCC") == "SIM"))
        {
            sql = sql + " and codigo>200 and codigo<255";
        }
        else
        {
            sql = sql + " and ((codigo<=200) or (codigo>=255))";
        }
        sql = sql + " ORDER BY codigo DESC";
        DataSet ds = SreDblib.GetDsScript(sql);

        if (ds.Tables[0].Rows.Count == 0)
        {
            return(0);
        }
        else
        {
            return(Convert.ToInt16(ds.Tables[0].Rows[0]["codigo"].ToString()));
        }
    }
Ejemplo n.º 17
0
    public static String PegaSaldoFinalDataAnterior(string xcodigo_conta,
                                                    DateTime xdata,
                                                    ref string xsaldo_f,
                                                    ref string xsaldo_aplicacaoD,
                                                    ref string xsaldo_aplicacaoB)
    {
        //
        DataSet ds;
        string  script = "select TOP 1 * from conta_" + Srelib.QStr0(xcodigo_conta.Trim(), 5) +
                         " with(nolock) " +
                         " Where " +
                         " data < " + Srelib.QStr(Srelib.DataAmericanasembarra(Convert.ToString(xdata).Substring(0, 10))) +
                         " order by ID DESC ";

        ds = SreDblib.GetDsScript(script);
        //
        if (ds.Tables[0].Rows.Count > 0)
        {
            //Faz caso exista lançamentos anteriores a data
            //
            xsaldo_f          = ds.Tables[0].Rows[0]["saldo_f"].ToString().Trim();
            xsaldo_aplicacaoD = ds.Tables[0].Rows[0]["saldo_aplicacaoD"].ToString().Trim();
            xsaldo_aplicacaoB = ds.Tables[0].Rows[0]["saldo_aplicacaoB"].ToString().Trim();
        }
        else
        {
            //
            xsaldo_f          = uContas.PegaSaldoInicial(xcodigo_conta);
            xsaldo_aplicacaoD = uContas.PegaSaldoInicialsaldo_aplicacaoD(xcodigo_conta);
            xsaldo_aplicacaoB = uContas.PegaSaldoInicialsaldo_aplicacaoB(xcodigo_conta);
        }
        return("");
    }
Ejemplo n.º 18
0
    public static String AlteraConta(string xID,
                                     string xcod_banco,
                                     string xcod_agencia,
                                     string xcod_conta,
                                     string xnome_agencia,
                                     string xcidade,
                                     string xuf,
                                     string xcep,
                                     string xlimite_cheque,
                                     string xconta_contabil,
                                     string xcomplemento,
                                     string xcombo)
    {
        string script = "UPDATE CONTAS SET " +
                        " cod_banco = " + Srelib.QStr(xcod_banco) +
                        " ,cod_agencia = " + Srelib.QStr(xcod_agencia) +
                        " ,cod_conta = " + Srelib.QStr(xcod_conta) +
                        " ,nome_agencia = " + Srelib.QStr(xnome_agencia) +
                        " ,cidade = " + Srelib.QStr(xcidade) +
                        " ,uf = " + Srelib.QStr(xuf) +
                        " ,cep = " + Srelib.QStr(xcep) +
                        " ,limite_cheque = " + Srelib.forcaponto(xlimite_cheque) +
                        " ,conta_contabil = " + Srelib.QStr(xconta_contabil) +
                        " ,complemento = " + Srelib.QStr(xcomplemento) +
                        " ,combo = " + Srelib.QStr(xcombo) +
                        " where ID =" + xID;

        //revisar quando mexer na cobrança bancária

        SreDblib.ExecScript(script);

        return(" ");
    }
Ejemplo n.º 19
0
    public static String Altera(string xlogin,
                                string xsenha,
                                string xnome,
                                string xsetor,
                                string xfuncao,
                                string xfone,
                                Int32 xperfil,
                                string xemail,
                                string xalcada,
                                Boolean xativo
                                )
    {
        if (xlogin != String.Empty)
        {
            string script = "UPDATE USUARIO SET " +
                            " Senha = " + Srelib.QStr(xsenha) +
                            " ,Nome =  " + Srelib.QStr(xnome) +
                            " ,Setor = " + Srelib.QStr(xsetor) +
                            " ,Funcao =  " + Srelib.QStr(xfuncao) +
                            " ,Fone = " + Srelib.QStr(xfone) +
                            " ,email =  " + Srelib.QStr(xemail) +
                            " ,alcada = " + Srelib.QStr(xalcada) +
                            " ,ativo =  " + Convert.ToString(Convert.ToInt16(xativo)) +
                            " where Login = "******" ");
    }
Ejemplo n.º 20
0
    public String PegaValorSerasa(String pXml)
    {
        // Conexao Conn = new Conexao(pXml);
        String Qry = "EXEC GN_CALC_SERASA " +
                     Srelib.QStr(Srelib.DataQuery(data, DM.FormatoData)) + "," +
                     numero;


        DataSet    _StProc = new DataSet();
        SqlCommand Command = new SqlCommand(Qry, DM.ConexaoSessao);

        Command.CommandTimeout = 99999;
        SqlDataAdapter DA = new SqlDataAdapter();

        DA.TableMappings.Add("Table", "calcbor");
        DA.SelectCommand = Command;
        DA.Fill(_StProc);
        DataTable DT;

        DT = _StProc.Tables["calcbor"];
        DataRow DR = DT.Rows[0];

        cms = Convert.ToString(DR["valor_serasa"]);

        return(cms);
    }
Ejemplo n.º 21
0
    public static String Grava(string xcodigo,
                               string xcod_banco,
                               string xcod_agencia,
                               string xcod_conta,
                               string xnome_agencia,
                               string xcidade,
                               string xuf,
                               string xcep,
                               string xlimite_cheque,
                               string xconta_contabil,
                               string xcomplemento,
                               string xcombo)
    {
        if (xcod_banco != String.Empty)
        {
            string script = "INSERT INTO CONTAS VALUES ( " +
                            Srelib.QStr(xcodigo) +
                            ", " + Srelib.QStr(xcod_banco) +
                            ", " + Srelib.QStr(xcod_agencia) +
                            ", " + Srelib.QStr(xcod_conta) +
                            ", " + Srelib.QStr(xnome_agencia) +
                            ", " + Srelib.QStr(xcidade) +
                            ", " + Srelib.QStr(xuf) +
                            ", " + Srelib.QStr(xcep) +
                            ", " + Srelib.forcaponto(xlimite_cheque) +
                            ", " + Srelib.QStr(xconta_contabil) +
                            ", " + Srelib.QStr(xcomplemento) +
                            ", " + xcombo +
                            " ) ";

            SreDblib.ExecScript(script);
        }
        return(" ");
    }
Ejemplo n.º 22
0
 public static String Grava(ref string xlancamento,
                            string xproduto,
                            string xclasse,
                            string xfornecedor,
                            string xdescricao,
                            string xdtprevista,
                            decimal xvlr_previsto,
                            string xdtrealizado,
                            decimal xvlr_realizado,
                            string xconta,
                            string xdocumento,
                            string xdtdocumento,
                            string xcheque,
                            string xcmc7,
                            string xdtcompensacao,
                            int xcontabil,
                            string xintegracao_contabil,
                            string xpedido_compra,
                            string xgrupo,
                            int xnominal)
 {
     //
     if (xlancamento != String.Empty)
     {
         //Check de Lançamento
         if (uContasPagar.LancamentoExiste(xlancamento))
         {
             xlancamento = uContasPagar.PegaNovoCodigoCPagar();
         }
         //
         string script = "INSERT INTO CONTAS_PAGAR VALUES ( " +
                         Srelib.QStr(xlancamento) +
                         ", " + Srelib.QStr(xproduto) +
                         ", " + Srelib.QStr(xclasse) +
                         ", " + Srelib.QStr(xfornecedor) +
                         ", " + Srelib.QStr(xdescricao) +
                         ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdtprevista)) +
                         ", " + Srelib.forcaponto(Convert.ToString(xvlr_previsto)) +
                         ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdtrealizado)) +
                         ", " + Srelib.forcaponto(Convert.ToString(xvlr_realizado)) +
                         ", " + Srelib.QStr(xconta) +
                         ", " + Srelib.QStr(xdocumento) +
                         ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdtdocumento)) +
                         ", " + Srelib.QStr(xcheque) +
                         ", " + Srelib.QStr(xcmc7) +
                         ", " + Srelib.QStr(Srelib.DataAmericanasembarra(xdtcompensacao)) +
                         ", " + Convert.ToString(xcontabil) +
                         ", " + Srelib.QStr(xintegracao_contabil) +
                         ", " + Srelib.QStr(xpedido_compra) +
                         ", " + Srelib.QStr(xgrupo) +
                         ", " + Convert.ToString(xnominal) +
                         " ) ";
         //
         SreDblib.ExecScript(script);
     }
     return(" ");
 }
    protected void btprocessa_Click(object sender, EventArgs e)
    {
        Boolean lOk = true;
        //
        string usuarioselecionado = "";
        Int32  permissoes         = 0;
        string stringpermissoes   = "";

        //Usuario
        if (cbusuario.Text != string.Empty)
        {
            usuarioselecionado = cbusuario.Text;
        }
        else
        {
            lOk = false;
        }
        //Processa Permissões do Perfil de Usuário
        if (lOk)
        {
            permissoes = lookuppermissoesusuario.Items.Count;
            if (permissoes != 0)
            {
                for (int i = 0; i < permissoes; i++)
                {
                    stringpermissoes = stringpermissoes + Srelib.QStr(lookuppermissoesusuario.Items[i].ToString().Substring(0, 15)) + ", ";
                }
            }
        }
        //Grava
        if (lOk)
        {
            //Exclui Permissoes retiradas
            if (stringpermissoes != string.Empty)
            {
                stringpermissoes = stringpermissoes.Substring(0, stringpermissoes.Length - 2);
            }
            //
            uPermissoes.ExcluiPermissoesUsuario(usuarioselecionado, "", stringpermissoes);
            //Inclui Permissoes Acescentadas
            uPermissoes.GravaPermissoesUsuario(usuarioselecionado, "", stringpermissoes);
            //
            // CRIA LOG  ===============================================================================================================================================
            fwObs_Log = "PERFIL: " + usuarioselecionado + " - PERMISSÕES: " + stringpermissoes;
            SqlParameter[] param_log = { new SqlParameter("@login",    (String)Session["CodUsuario"]),
                                         new SqlParameter("@tabela",   "USUARIO"),
                                         new SqlParameter("@operacao", "CONFIG"),
                                         new SqlParameter("@obs",      "PERMISSÕES PERFIL"),
                                         new SqlParameter("@acao",     fwObs_Log) };
            uLog.MakeLog(param_log);
            // FIM CRIA LOG ============================================================================================================================================
            //
            //ScriptManager.RegisterStartupScript(UpdatePanel, GetType(), "msgbox", "alert('Processamento Concluído!');", true);
            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), Guid.NewGuid().ToString(),
                                                "toastr.success('Processamento Concluído!', 'Atenção!')", true);
        }
    }
Ejemplo n.º 24
0
    public static string PegaGrupoPorDescricao(string xdescricao)
    {
        string script;

        script = " SELECT grupo FROM produto_grupo " +
                 " WHERE produto = 41 " +
                 " AND substring(descricao,charindex(" + Srelib.QStr(xdescricao) + ",descricao,7),3) = " + Srelib.QStr(xdescricao);

        return(Convert.ToString(SreDblib.GetCampoScript(script)));
    }
Ejemplo n.º 25
0
    public static DataSet PegaDadosContatoProduto(string xcbproduto,
                                                  string xcbprodutogrupo,
                                                  string xdtprevisao1)
    {
        string script;

        //
        if (xdtprevisao1 == "01/01/1900")
        {
            script = "SELECT * FROM Contato C WITH(NOLOCK) WHERE 1 = 1 ";
            //
            if (xcbproduto != string.Empty)
            {
                script = script + " AND exists(SELECT * FROM VENDAS V WHERE V.CLIENTE = C.ID AND V.PRODUTO = " +
                         Srelib.QStr(xcbproduto) + " ";
                //
                if (xcbprodutogrupo != string.Empty)
                {
                    script = script + " AND V.GRUPO = " +
                             Srelib.QStr(xcbprodutogrupo) + " ";
                }
                script = script + " ) ";
            }

            script = script + " ORDER BY nome ";
        }
        else
        {
            script = "SELECT * FROM Contato C WITH(NOLOCK) WHERE 1 = 1 ";
            //
            if (xcbproduto != string.Empty)
            {
                script = script + " AND exists(SELECT * FROM VENDAS V WHERE V.CLIENTE = C.ID AND V.PRODUTO = " +
                         Srelib.QStr(xcbproduto) + " ";
                //
                if (xcbprodutogrupo != string.Empty)
                {
                    script = script + " AND V.GRUPO = " +
                             Srelib.QStr(xcbprodutogrupo) + " ";
                    //
                    string nomearquivo = "parcelas_" + Srelib.QStr0(xcbproduto.Trim(), 5) + "_" + Srelib.QStr0(xcbprodutogrupo.Trim(), 5);
                    script = script + " AND exists(SELECT * FROM " + nomearquivo + " P WHERE P.PRODUTO = " +
                             Srelib.QStr(xcbproduto) +
                             " AND P.GRUPO = " + Srelib.QStr(xcbprodutogrupo);
                }


                script = script + " ) ";
            }

            script = script + " ORDER BY nome ";
        }

        return(SreDblib.GetDsScript(script));
    }
Ejemplo n.º 26
0
    public static String Grava(string xnome,
                               string xdescricao,
                               string xorgao,
                               string xdivulgacao,
                               string xperiodicidade,
                               string xtipo,
                               string xinicio,
                               string xfim,
                               string xdmais,
                               Boolean xativo,
                               string xobserva_1,
                               string xobserva_2)
    {
        if (xnome != String.Empty)
        {
            if (xinicio == String.Empty)
            {
                xinicio = "0";
            }
            if (xfim == String.Empty)
            {
                xfim = "0";
            }
            if (xdmais == String.Empty)
            {
                xdmais = "0";
            }

            string script = "Insert into INDEXADORES With (ROWLOCK) (nome, descricao, orgao, divulgacao, periodicidade, tipo, inicio, fim, dmais, ativo, observa_1, observa_2) " +
                            " SELECT " +
                            Srelib.QStr(xnome.ToUpper()) +
                            ", " + Srelib.QStr(xdescricao.ToUpper()) +
                            ", " + Srelib.QStr(xorgao) +
                            ", " + Srelib.QStr(xdivulgacao) +
                            ", " + Srelib.QStr(xperiodicidade.ToUpper()) +
                            ", " + Srelib.QStr(xtipo.ToUpper()) +
                            ", " + xinicio +
                            ", " + xfim +
                            ", " + xdmais +
                            ", " + Convert.ToString(Convert.ToInt16(xativo)) +
                            ", " + Srelib.QStr(xobserva_1) +
                            ", " + Srelib.QStr(xobserva_2) +
                            " WHERE not exists (select * from INDEXADORES where nome = " + Srelib.QStr(xnome.ToUpper()) + ") ";

            SreDblib.ExecScript(script);
            //
            //Grava o campo na tabela de Taxas Mensais ou taxas Diárias
            uIndexadores.GravaCampoTaxa(xnome,
                                        xperiodicidade,
                                        xtipo);
            //
        }
        return(" ");
    }
Ejemplo n.º 27
0
    public static String Exclui(string xlogin)
    {
        if (xlogin != String.Empty)
        {
            string script = "DELETE USUARIO  " +
                            " where Login = "******" ");
    }
Ejemplo n.º 28
0
    public static String AlteraProdutoCadastro(string xproduto,
                                               Boolean xCadastro)
    {
        string script = "UPDATE PRODUTO SET " +
                        " ativo = " + Convert.ToInt16(xCadastro) +
                        " where ID =" + Srelib.QStr(xproduto);

        SreDblib.ExecScript(script);

        return(" ");
    }
Ejemplo n.º 29
0
    public static String Exclui(string xnome)
    {
        if (xnome != String.Empty)
        {
            string script = "DELETE parametros  " +
                            " where nome = " + Srelib.QStr(xnome);

            SreDblib.ExecScript(script);
        }
        return(" ");
    }
Ejemplo n.º 30
0
    public static String ExcluiCadPermissao(string xpermissao)
    {
        if (xpermissao != String.Empty)
        {
            string script = "DELETE CADPERMISSOES  " +
                            " where Permissao = " + Srelib.QStr(xpermissao);

            SreDblib.ExecScript(script);
        }
        return(" ");
    }