Exemplo n.º 1
0
        public override bool execute( )
        {
            Registry("execute infra_fetchFile ");

            /// USER [ execute ]

            bool Stop = false;

            DataPortable port = MemoryGet(input_st_part);

            string data = port.getValue("data");

            int tam = Convert.ToInt32(new InstallData().maxPacket) - 200;

            if (data.Length < tam)
            {
                tam  = data.Length;
                Stop = true;
            }

            output_st_content = data.Substring(0, tam);

            if (!Stop)
            {
                port.setValue("data", data.Substring(tam, data.Length - tam));

                output_st_next_part = MemorySave(ref port);
            }

            /// USER [ execute ] END

            Registry("execute done infra_fetchFile ");

            return(true);
        }
Exemplo n.º 2
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_usuarios ");

            /// USER [ execute ]

            T_Usuario m_user = new T_Usuario(this);

            StringBuilder sb = new StringBuilder();

            for (int t = 0; t < var_util.indexCSV(input_st_csv_list); ++t)
            {
                if (!m_user.selectIdentity(var_util.getCSV(t)))
                {
                    return(false);
                }

                if (m_user.get_tg_bloqueio() == "2")
                {
                    continue;
                }

                DadosUsuario du = new DadosUsuario();

                du.set_id_usuario(m_user.get_identity());
                du.set_st_empresa(m_user.get_st_empresa());
                du.set_st_nome(m_user.get_st_nome());
                du.set_tg_bloqueio(m_user.get_tg_bloqueio());
                du.set_tg_nivel(m_user.get_tg_nivel());

                DataPortable mem_rtc = du as DataPortable;

                // ## obtem indice

                sb.Append(MemorySave(ref mem_rtc));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## obtem indice geral

            output_st_csv = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_usuarios ");

            return(true);
        }
Exemplo n.º 3
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute upload_archive ");

            /// USER [ execute ]

            DataPortable csv_AllArchive = MemoryGet(input_st_id);

            StringBuilder sb_csv = new StringBuilder(  );

            if (csv_AllArchive.getValue("ids") != "")
            {
                sb_csv.Append(csv_AllArchive.getValue("ids"));
                sb_csv.Append(",");
            }

            for (int t = 0; t < input_array_generic_lst.Count; ++t)
            {
                DataPortable port = input_array_generic_lst [t] as DataPortable;

                sb_csv.Append(MemorySave(ref port));
                sb_csv.Append(",");
            }

            csv_AllArchive.setValue("ids", sb_csv.ToString().TrimEnd(','));

            output_st_new_id = MemorySave(ref csv_AllArchive);

            /// USER [ execute ] END

            Registry("execute done upload_archive ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_consultaAuditoria ");

            /// USER [ execute ]

            StringBuilder sb = new StringBuilder();

            string obs  = input_cont_dca.get_st_obs(),
                   nome = input_cont_dca.get_st_user();

            long nu_oper = 0,
                 val     = 0;

            // ## Se existe operador específico

            if (input_cont_dca.get_nu_oper().Length > 0)
            {
                nu_oper = Convert.ToInt32(input_cont_dca.get_nu_oper());
            }

            LOG_Audit aud_log = new LOG_Audit(this);

            bool ReqObs  = true;
            bool ReqNome = true;

            if (obs.Length == 0)
            {
                ReqObs = false;
            }
            if (nome.Length == 0)
            {
                ReqNome = false;
            }

            // ## Para datas especificas

            if (input_cont_dca.get_dt_ini().Length > 0 &&
                input_cont_dca.get_dt_fim().Length > 0)
            {
                if (!aud_log.select_rows_dt_ini_fim(input_cont_dca.get_dt_ini(),
                                                    input_cont_dca.get_dt_fim()))
                {
                    return(true);
                }
            }

            // ## Se somente data de inicio

            else if (input_cont_dca.get_dt_ini().Length > 0)
            {
                if (!aud_log.select_rows_dt_ini(input_cont_dca.get_dt_ini()))
                {
                    return(true);
                }
            }

            // ## Se somente data final

            else if (input_cont_dca.get_dt_fim().Length > 0)
            {
                if (!aud_log.select_rows_dt_fim(input_cont_dca.get_dt_fim()))
                {
                    return(true);
                }
            }

            // ## Se tiver alguma obs especifica

            else if (obs.Length > 0)
            {
                ReqObs = false;

                if (!aud_log.select_rows_obs(obs))
                {
                    return(true);
                }
            }

            // ## Seleciona tudo...

            else
            {
                if (!aud_log.selectAll())
                {
                    return(true);
                }
            }

            // ## Tabela auxiliar de operadores

            Hashtable hshOpers = new Hashtable();

            if (user.get_tg_nivel() == TipoUsuario.Administrador ||
                user.get_tg_nivel() == TipoUsuario.AdminGift)
            {
                // ## Para caso de administradores, filtrar somente
                // ## transações de seus usuários

                T_Usuario user_tb = new T_Usuario(this);

                if (user_tb.select_rows_empresa(user.get_st_empresa()))
                {
                    while (user_tb.fetch())
                    {
                        // ## indexa

                        hshOpers [user_tb.get_identity()] = "*";
                    }
                }
            }

            // ## busca registros selecionados

            while (aud_log.fetch())
            {
                val = aud_log.get_int_tg_operacao();

                // ## Confere se operador está dentro de uma
                // ## determinada empresa

                if (hshOpers.Count > 0)
                {
                    if (hshOpers [aud_log.get_fk_usuario()] == null)
                    {
                        continue;
                    }
                }

                // ## Confere operador especifico

                if (nu_oper > 0)
                {
                    if (val != nu_oper)
                    {
                        continue;
                    }
                }

                // ## Confere se Obs deve ser filtrada

                if (ReqObs)
                {
                    if (!aud_log.get_st_observacao().Contains(obs))
                    {
                        continue;
                    }
                }

                // ## Busca usuário em questão

                if (!user.selectIdentity(aud_log.get_fk_usuario()))
                {
                    continue;
                }

                // ## Se for nome em especifico

                if (ReqNome)
                {
                    if (!user.get_st_nome().Contains(nome))
                    {
                        continue;
                    }
                }

                // ## Copia dados para memória

                DadosAuditoria da = new DadosAuditoria();

                da.set_nu_oper(aud_log.get_tg_operacao());
                da.set_dt_operacao(aud_log.get_dt_operacao());
                da.set_st_usuario(user.get_st_nome());
                da.set_st_obs(aud_log.get_st_observacao());
                da.set_id_link(aud_log.get_fk_generic());

                DataPortable tmp = da as DataPortable;

                sb.Append(MemorySave(ref tmp));
                sb.Append(",");
            }

            // ## gera bloco de identificadores

            string list_ids = sb.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
                return(true);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            output_st_csv_audit = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_consultaAuditoria ");

            return(true);
        }
Exemplo n.º 5
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_arquivoFat ");

            /// USER [ execute ]

            T_Faturamento fat     = new T_Faturamento(this);
            T_Faturamento fat_upd = new T_Faturamento(this);

            if (!fat.select_rows_dt_venc(input_dia_venc_ini,
                                         input_dia_venc_fim,
                                         TipoSitFat.Pendente))
            {
                PublishError("Nenhum registro encontrado");
                return(false);
            }

            StringBuilder sb_content = new StringBuilder();

            T_Empresa emp = new T_Empresa(this);
            T_Loja    loj = new T_Loja(this);

            if (input_tg_debito == Context.FALSE)
            {
                #region - DOC -

                long seq           = 1;
                long vr_total_tits = 0;

                string cnpj   = "";
                string nome   = "";
                string end    = "";
                string cidade = "";
                string estado = "";
                string cep    = "";

                #region - HEADER -
                {
                    DataPortable port = new DataPortable();

                    string header = "01REMESSA" +
                                    " ".PadLeft(17, ' ') +
                                    Parametros.Cedente.PadLeft(12, '0') +
                                    " ".PadLeft(8, ' ') +
                                    Parametros.Empresa.PadRight(30, ' ') +
                                    "041BANRISUL" +
                                    " ".PadLeft(7, ' ') +
                                    DateTime.Now.Day.ToString("00") +
                                    DateTime.Now.Month.ToString("00") +
                                    (DateTime.Now.Year - 2000).ToString("00") +
                                    " ".PadLeft(294, ' ') +
                                    "000001";

                    port.setValue("line", header);

                    sb_content.Append(MemorySave(ref port));
                    sb_content.Append(",");
                }
                #endregion

                while (fat.fetch())
                {
                    if (fat.get_fk_empresa() != Context.FALSE)
                    {
                        if (!emp.selectIdentity(fat.get_fk_empresa()))
                        {
                            return(false);
                        }

                        if (emp.get_tg_tipoCobranca() != TipoCobranca.Doc)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (!loj.selectIdentity(fat.get_fk_loja()))
                        {
                            return(false);
                        }

                        if (loj.get_tg_tipoCobranca() != TipoCobranca.Doc)
                        {
                            continue;
                        }
                    }

                    bool registroValido = true;

                    if (fat.get_int_vr_cobranca() < 500 && fat.get_int_vr_cobranca() > 0)
                    {
                        ins_despesa tr = new ins_despesa(this);

                        tr.input_cont_header = input_cont_header;

                        if (fat.get_fk_empresa() != Context.FALSE)
                        {
                            tr.input_st_codigo = emp.get_st_empresa();
                        }
                        else
                        {
                            tr.input_st_codigo = loj.get_st_loja();
                        }

                        tr.input_tg_desconto = Context.FALSE;
                        tr.input_vr_cobranca = fat.get_vr_cobranca();
                        tr.input_st_extra    = "Adiamento de cobrança";

                        tr.quiet = true;

                        tr.RunOnline();

                        registroValido = false;
                    }

                    if (fat.get_int_vr_cobranca() == 0)
                    {
                        registroValido = false;
                    }

                    if (registroValido)
                    {
                        seq++;

                        StringBuilder sb_line = new StringBuilder();

                        string dv = fat.get_dt_vencimento().Substring(8, 2) +                                   // dia
                                    fat.get_dt_vencimento().Substring(5, 2) +                                   // mes
                                    fat.get_dt_vencimento().Substring(2, 2);                                    // ano

                        vr_total_tits += fat.get_int_vr_cobranca() + 350;

                        if (fat.get_fk_empresa() != Context.FALSE)
                        {
                            nome   = emp.get_st_social().PadRight(35, ' ').Substring(0, 35);
                            end    = emp.get_st_endereco().PadRight(40, ' ').Substring(0, 40);
                            cnpj   = emp.get_nu_CNPJ().PadLeft(14, '0');
                            cidade = emp.get_st_cidade().PadRight(15, ' ').Substring(0, 15);
                            estado = emp.get_st_estado().PadRight(2, ' ');
                            cep    = emp.get_nu_CEP().PadRight(8, '0');
                        }
                        else
                        {
                            nome   = loj.get_st_social().PadRight(35, ' ').Substring(0, 35);
                            end    = loj.get_st_endereco().PadRight(40, ' ').Substring(0, 40);
                            cnpj   = loj.get_nu_CNPJ().PadLeft(14, '0');
                            cidade = loj.get_st_cidade().PadRight(15, ' ').Substring(0, 15);
                            estado = loj.get_st_estado().PadRight(2, ' ');
                            cep    = loj.get_nu_CEP().PadRight(8, '0');
                        }

                        sb_line.Append("1");
                        sb_line.Append("0".PadLeft(16, '0'));
                        sb_line.Append(Parametros.Cedente.PadLeft(12, '0'));
                        sb_line.Append("0".PadLeft(8, '0'));
                        sb_line.Append(fat.get_identity().PadRight(25, ' '));                                          // ??? Dados de retorno
                        sb_line.Append(" ".PadLeft(10, ' '));
                        sb_line.Append("Multa de 10% após vencto.".PadRight(32, ' '));                                 // Msg imp no bloqueto
                        sb_line.Append(" ".PadLeft(3, ' '));
                        sb_line.Append("1");                                                                           // tipo de carteira
                        sb_line.Append("01");                                                                          // código de ocorrência
                        sb_line.Append(fat.get_identity().ToString().PadRight(10, ' '));                               // seu numero
                        sb_line.Append(dv);                                                                            // dia vencimento
                        sb_line.Append(fat.get_vr_cobranca().PadLeft(13, '0'));
                        sb_line.Append("041");                                                                         // banco
                        sb_line.Append(" ".PadLeft(5, ' '));
                        sb_line.Append("06");                                                                          // cobrança escritural
                        sb_line.Append("N");                                                                           // aceite
                        sb_line.Append(DateTime.Now.Day.ToString("00"));
                        sb_line.Append(DateTime.Now.Month.ToString("00"));
                        sb_line.Append((DateTime.Now.Year - 2000).ToString("00"));
                        sb_line.Append("09");                                                                                                      // código de protesto! (09) protestar (15) devolver
                        sb_line.Append("  ");
                        sb_line.Append("0");                                                                                                       // codigo de mora (0) diario (1) mensal
                        sb_line.Append("0".PadLeft(12, '0'));                                                                                      // valor juros diario
                        sb_line.Append("0".PadLeft(6, '0'));                                                                                       // data desconto antecipado
                        sb_line.Append("0".PadLeft(13, '0'));                                                                                      // valor desconto
                        sb_line.Append("0".PadLeft(13, '0'));                                                                                      // valor iof
                        sb_line.Append("0".PadLeft(13, '0'));                                                                                      // abatimento
                        sb_line.Append("02");                                                                                                      // tipo de inscrição CNPJ
                        sb_line.Append(cnpj);
                        sb_line.Append(nome);
                        sb_line.Append(" ".PadLeft(5, ' '));
                        sb_line.Append(end);
                        sb_line.Append(" ".PadLeft(7, ' '));
                        sb_line.Append("0".PadLeft(3, '0'));
                        sb_line.Append("0".PadLeft(2, '0'));
                        sb_line.Append(cep);
                        sb_line.Append(cidade);
                        sb_line.Append(estado);
                        sb_line.Append("0".PadLeft(4, '0'));
                        sb_line.Append(" ");
                        sb_line.Append("0".PadLeft(13, '0'));
                        sb_line.Append("15");
                        sb_line.Append(" ".PadLeft(23, ' '));
                        sb_line.Append(seq.ToString().PadLeft(6, '0'));

                        DataPortable port = new DataPortable();

                        port.setValue("line", sb_line.ToString());

                        sb_content.Append(MemorySave(ref port));
                        sb_content.Append(",");
                    }

                    fat_upd.ExclusiveAccess();

                    if (!fat_upd.selectIdentity(fat.get_identity()))
                    {
                        return(false);
                    }

                    if (registroValido)
                    {
                        fat_upd.set_tg_situacao(TipoSitFat.EmCobrança);
                    }
                    else
                    {
                        fat_upd.set_tg_situacao(TipoSitFat.PagoDoc);
                    }

                    if (!fat_upd.synchronize_T_Faturamento())
                    {
                        return(false);
                    }

                    fat_upd.ReleaseExclusive();
                }

                // ## TRAILER
                {
                    DataPortable port = new DataPortable();

                    string trailer = "9" +
                                     " ".PadLeft(26, ' ') +
                                     vr_total_tits.ToString().PadLeft(13, '0') +
                                     " ".PadLeft(354, ' ') +
                                     seq.ToString("000000");

                    port.setValue("line", trailer);

                    sb_content.Append(MemorySave(ref port));
                    sb_content.Append(",");
                }

                #endregion
            }
            else
            {
                #region - DÉBITO EM CONTA -

                long seq           = 1;
                long vr_total_tits = 0;

                string conta_deb = "";
                string dt_venc   = "";

                LOG_NSA l_nsa = new LOG_NSA(this);

                l_nsa.set_dt_log(GetDataBaseTime());

                l_nsa.create_LOG_NSA();

                #region - HEADER -
                {
                    DataPortable port = new DataPortable();

                    string header = "A1" +
                                    Parametros.ConvenioDebConta +
                                    " ".PadLeft(15, ' ') +
                                    "Starfiche".PadRight(20, ' ') +
                                    "041BANRISUL".PadRight(23, ' ') +
                                    DateTime.Now.Year.ToString("0000") +
                                    DateTime.Now.Month.ToString("00") +
                                    DateTime.Now.Day.ToString("00") +
                                    l_nsa.get_identity().PadLeft(6, '0') +
                                    "04DEBITOAUTOMATICO".PadRight(69, ' ');

                    port.setValue("line", header);

                    sb_content.Append(MemorySave(ref port));
                    sb_content.Append(",");
                }
                #endregion

                while (fat.fetch())
                {
                    if (fat.get_fk_empresa() != Context.FALSE)
                    {
                        if (!emp.selectIdentity(fat.get_fk_empresa()))
                        {
                            return(false);
                        }

                        if (emp.get_tg_tipoCobranca() == TipoCobranca.Doc)
                        {
                            continue;
                        }

                        if (emp.get_int_nu_bancoFat() != 41)
                        {
                            continue;
                        }

                        conta_deb = emp.get_nu_contaDeb();
                    }
                    else
                    {
                        if (!loj.selectIdentity(fat.get_fk_loja()))
                        {
                            return(false);
                        }

                        if (loj.get_tg_tipoCobranca() == TipoCobranca.Doc)
                        {
                            continue;
                        }

                        if (loj.get_int_nu_bancoFat() != 41)
                        {
                            continue;
                        }

                        conta_deb = loj.get_nu_contaDeb();
                    }

                    dt_venc = fat.get_dt_vencimento().Substring(0, 4) +
                              fat.get_dt_vencimento().Substring(5, 2) +
                              fat.get_dt_vencimento().Substring(8, 2);

                    vr_total_tits += fat.get_int_vr_cobranca();

                    StringBuilder sb_line = new StringBuilder();

                    sb_line.Append("E");
                    sb_line.Append(fat.get_identity().PadRight(25, ' '));
                    sb_line.Append(conta_deb.PadRight(14, ' '));
                    sb_line.Append(" ".PadRight(4, ' '));
                    sb_line.Append(dt_venc);
                    sb_line.Append(fat.get_vr_cobranca().PadLeft(15, '0'));
                    sb_line.Append("03");
                    sb_line.Append(fat.get_identity().PadRight(60, ' '));
                    sb_line.Append(" ".PadRight(20, ' '));
                    sb_line.Append("0");

                    DataPortable port = new DataPortable();

                    port.setValue("line", sb_line.ToString());

                    sb_content.Append(MemorySave(ref port));
                    sb_content.Append(",");

                    fat_upd.ExclusiveAccess();

                    if (!fat_upd.selectIdentity(fat.get_identity()))
                    {
                        return(false);
                    }

                    fat_upd.set_tg_situacao(TipoSitFat.EmCobrança);

                    if (!fat_upd.synchronize_T_Faturamento())
                    {
                        return(false);
                    }

                    fat_upd.ReleaseExclusive();
                }

                #region - TRAILER -
                {
                    ++seq;

                    DataPortable port = new DataPortable();

                    string trailer = "Z" + seq.ToString().PadLeft(6, '0') +
                                     vr_total_tits.ToString().PadLeft(17, '0') +
                                     " ".PadLeft(126, ' ');

                    port.setValue("line", trailer);

                    sb_content.Append(MemorySave(ref port));
                    sb_content.Append(",");
                }
                #endregion

                #endregion
            }

            string list_ids = sb_content.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
                return(true);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            output_st_msg = MemorySave(ref dp);



            LOG_NS_FAT l_nsFat = new LOG_NS_FAT(this);

            l_nsFat.set_dt_log(GetDataBaseTime());

            l_nsFat.create_LOG_NS_FAT();

            output_nu_nsFat = l_nsFat.get_identity();


            // Limpa avisos do ins_despesa
            this.objection.Clear();

            /// USER [ execute ] END

            Registry("execute done fetch_arquivoFat ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_edu_extrato ");

            /// USER [ execute ]

            T_Terminal term = new T_Terminal(this);
            T_Loja     loj  = new T_Loja(this);

            StringBuilder sb = new StringBuilder();

            long vr_tot = 0;

            // ## Busca registros

            while (l_tr.fetch())
            {
                loj.set_st_nome("");

                if (l_tr.get_tg_contabil() == Context.TRUE)
                {
                    if (l_tr.get_en_operacao() == OperacaoCartao.VENDA_EMPRESARIAL ||
                        l_tr.get_en_operacao() == OperacaoCartao.PAY_FONE_GRAVA_PEND)
                    {
                        if (l_tr.get_tg_confirmada() == TipoConfirmacao.Confirmada)
                        {
                            // ## Contabilizar em total

                            vr_tot += l_tr.get_int_vr_total();
                        }
                    }
                    else if (l_tr.get_en_operacao() != OperacaoCartao.EDU_DEP_DIARIO &&
                             l_tr.get_en_operacao() != OperacaoCartao.EDU_DEP_FUNDO &&
                             l_tr.get_en_operacao() != OperacaoCartao.EDU_DEP_IMEDIATO)
                    {
                        // ## desprezar

                        continue;
                    }
                }
                else
                {
                    if (l_tr.get_en_operacao() != OperacaoCartao.PAY_FONE_CANCELA_VENDA &&
                        l_tr.get_en_operacao() != OperacaoCartao.VENDA_EMPRESARIAL_CANCELA)
                    {
                        // ## desprezar

                        continue;
                    }
                }

                // ## Guardar este registro em memória

                EduExtrato etc = new EduExtrato();

                etc.set_st_nsu(l_tr.get_nu_nsu());
                etc.set_dt_trans(l_tr.get_dt_transacao());

                if (l_tr.get_en_operacao() == OperacaoCartao.VENDA_EMPRESARIAL ||
                    l_tr.get_en_operacao() == OperacaoCartao.PAY_FONE_GRAVA_PEND)
                {
                    // ## débito

                    etc.set_vr_valor("-" + l_tr.get_vr_total());
                }
                else
                {
                    // ## depósito

                    etc.set_vr_valor(l_tr.get_vr_total());
                }

                // ## Busca loja

                if (!loj.selectIdentity(l_tr.get_fk_loja()))
                {
                    // ## depósito automático de conversão de fundo ao disponivel

                    etc.set_st_loja("ConveyNET");
                }
                else
                {
                    etc.set_st_loja(loj.get_st_nome());
                }

                etc.set_vr_disp(l_tr.get_vr_saldo_disp());
                etc.set_vr_fundo(l_tr.get_vr_saldo_disp_tot());

                etc.set_en_oper(l_tr.get_en_operacao());

                DataPortable mem_rtc = etc as DataPortable;

                // ## Gera identificador

                sb.Append(MemorySave(ref mem_rtc));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // # Guarda todos os registros

            output_st_csv = MemorySave(ref dp);

            T_Empresa emp = new T_Empresa(this);

            // ## Busca empresa

            if (emp.select_rows_empresa(input_st_emp))
            {
                if (!emp.fetch())
                {
                    return(false);
                }
            }

            output_st_empresa = emp.get_st_fantasia();

            output_st_total_periodo = vr_tot.ToString();

            if (output_st_csv == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_edu_extrato ");

            return(true);
        }
        public override bool execute( )
        {
            Registry("execute web_fetch_rel_edu_extrato ");

            /// USER [ execute ]

            StringBuilder sb = new StringBuilder();

            long vr_tot = 0;

            T_Terminal term = new T_Terminal(this);

            T_Loja loj = new T_Loja(this);

            while (l_tr.fetch())
            {
                loj.set_st_nome("");

                if (l_tr.get_tg_contabil() == Context.TRUE)
                {
                    if (l_tr.get_en_operacao() == OperacaoCartao.VENDA_EMPRESARIAL ||
                        l_tr.get_en_operacao() == OperacaoCartao.PAY_FONE_GRAVA_PEND)
                    {
                        if (l_tr.get_tg_confirmada() == TipoConfirmacao.Confirmada)
                        {
                            vr_tot += l_tr.get_int_vr_total();
                        }
                    }
                    else if (l_tr.get_en_operacao() != OperacaoCartao.EDU_DEP_DIARIO &&
                             l_tr.get_en_operacao() != OperacaoCartao.EDU_DEP_FUNDO &&
                             l_tr.get_en_operacao() != OperacaoCartao.EDU_DEP_IMEDIATO)
                    {
                        continue;
                    }
                }
                else
                {
                    if (l_tr.get_en_operacao() != OperacaoCartao.PAY_FONE_CANCELA_VENDA &&
                        l_tr.get_en_operacao() != OperacaoCartao.VENDA_EMPRESARIAL_CANCELA)
                    {
                        continue;
                    }
                }

                EduExtrato etc = new EduExtrato();

                etc.set_st_nsu(l_tr.get_nu_nsu());
                etc.set_dt_trans(l_tr.get_dt_transacao());

                if (l_tr.get_en_operacao() == OperacaoCartao.VENDA_EMPRESARIAL ||
                    l_tr.get_en_operacao() == OperacaoCartao.PAY_FONE_GRAVA_PEND)
                {
                    etc.set_vr_valor("-" + l_tr.get_vr_total());
                }
                else
                {
                    etc.set_vr_valor(l_tr.get_vr_total());
                }

                if (!loj.selectIdentity(l_tr.get_fk_loja()))
                {
                    etc.set_st_loja("ConveyNET");
                }
                else
                {
                    etc.set_st_loja(loj.get_st_nome());
                }

                etc.set_vr_disp(l_tr.get_vr_saldo_disp());
                etc.set_vr_fundo(l_tr.get_vr_saldo_disp_tot());
                etc.set_en_oper(l_tr.get_en_operacao());

                DataPortable mem_rtc = etc as DataPortable;

                string index = MemorySave(ref mem_rtc);

                sb.Append(index);
                sb.Append(",");
            }

            // indexa todos os pagamentos
            {
                string list_ids = sb.ToString().TrimEnd(',');

                if (list_ids == "")
                {
                    PublishNote("Nenhum registro encontrado");
                    return(false);
                }

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## Guarda indexador de grupo

                output_st_csv = MemorySave(ref dp);
            }

            output_st_total_periodo = vr_tot.ToString();

            if (output_st_csv == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
            }

            /// USER [ execute ] END

            Registry("execute done web_fetch_rel_edu_extrato ");

            return(true);
        }
Exemplo n.º 8
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_1_rtc ");

            /// USER [ execute ]

            // ##
            // ## O seguinte trecho indexa as lojas possíveis
            // ## de retorno para uma determinada empresa.
            // ##
            // ## E, no caso de a empresa original ser administradora
            // ## de empresas, indexar todas as lojas de todas empresas
            // ## desta rede.
            // ##

            Hashtable hshLojas = new Hashtable();

            #region - filtro de lojas da empresa -

            if (user.get_tg_nivel() == TipoUsuario.Administrador)
            {
                T_Empresa emp_orig = new T_Empresa(this);

                // ## Busca empresa original

                if (!emp_orig.select_rows_empresa(user.get_st_empresa()))
                {
                    return(false);
                }

                if (!emp_orig.fetch())
                {
                    return(false);
                }

                LINK_LojaEmpresa lnk = new LINK_LojaEmpresa(this);

                // ## busca relacionamento das empresas com lojas

                if (lnk.select_fk_empresa_geral(emp_orig.get_identity()))
                {
                    while (lnk.fetch())
                    {
                        // ## indexa lojas

                        hshLojas [lnk.get_fk_loja()] = "*";
                    }
                }

                // ## busca empresas administradas

                T_Empresa emp_lnk_admin = new T_Empresa(this);

                if (emp_lnk_admin.select_fk_admin(emp_orig.get_identity()))
                {
                    while (emp_lnk_admin.fetch())
                    {
                        // ## busca lojas de cada empresa administrada

                        LINK_LojaEmpresa lnk_admin = new LINK_LojaEmpresa(this);

                        if (lnk_admin.select_fk_empresa_geral(emp_lnk_admin.get_identity()))
                        {
                            while (lnk_admin.fetch())
                            {
                                // ## indexa loja

                                hshLojas [lnk_admin.get_fk_loja()] = "*";
                            }
                        }
                    }
                }
            }

            #endregion

            StringBuilder sb = new StringBuilder();

            long vr_tot           = 0;
            long vr_tot_cancelado = 0;

            T_Terminal term = new T_Terminal(this);

            while (l_tr.fetch())
            {
                // ## Filtra lojas não vinculadas à empresa

                if (hshLojas.Count > 0)
                {
                    if (hshLojas [l_tr.get_fk_loja()] == null)
                    {
                        continue;
                    }
                }

                // ## Busca terminal

                if (term.selectIdentity(l_tr.get_fk_terminal()))
                {
                    if (fk_loja.Length > 0)
                    {
                        if (term.get_fk_loja() != fk_loja)
                        {
                            continue;
                        }
                    }

                    if (!loj.selectIdentity(term.get_fk_loja()))
                    {
                        continue;
                    }

                    if (input_st_cidade.Length > 0)
                    {
                        if (!loj.get_st_cidade().Contains(input_st_cidade))
                        {
                            continue;
                        }
                    }

                    if (input_st_estado.Length > 0)
                    {
                        if (!loj.get_st_estado().Contains(input_st_estado))
                        {
                            continue;
                        }
                    }

                    if (l_tr.get_tg_contabil() == Context.TRUE)
                    {
                        if (l_tr.get_tg_confirmada() == TipoConfirmacao.Cancelada)
                        {
                            vr_tot_cancelado += l_tr.get_int_vr_total();
                        }
                        else
                        if (l_tr.get_tg_confirmada() == TipoConfirmacao.Confirmada)
                        {
                            vr_tot += l_tr.get_int_vr_total();
                        }
                    }
                }

                // ## Copia dados para memória

                Rel_RTC rtc = new Rel_RTC();

                rtc.set_st_loja(loj.get_st_nome());
                rtc.set_st_term(term.get_nu_terminal());
                rtc.set_st_nsu(l_tr.get_nu_nsu());
                rtc.set_vr_total(l_tr.get_vr_total());
                rtc.set_nu_parc(l_tr.get_nu_parcelas());
                rtc.set_dt_trans(l_tr.get_dt_transacao());
                rtc.set_tg_status(l_tr.get_tg_confirmada());
                rtc.set_st_motivo(l_tr.get_st_msg_transacao());
                rtc.set_en_op_cartao(l_tr.get_en_operacao());

                DataPortable mem_rtc = rtc as DataPortable;

                // ## obtem indice

                sb.Append(MemorySave(ref mem_rtc));
                sb.Append(",");

                if (l_tr.get_int_nu_parcelas() > 1)
                {
                    T_Parcelas parc = new T_Parcelas(this);

                    if (parc.select_fk_log_trans(l_tr.get_identity()))
                    {
                        while (parc.fetch())
                        {
                            Rel_RTC rtc2 = new Rel_RTC();

                            rtc2.set_vr_total(parc.get_vr_valor());
                            rtc2.set_nu_parc(parc.get_nu_indice());
                            rtc2.set_dt_trans(l_tr.get_dt_transacao());
                            rtc2.set_tg_status(l_tr.get_tg_confirmada());
                            rtc2.set_st_motivo(l_tr.get_st_msg_transacao());
                            rtc2.set_en_op_cartao(l_tr.get_en_operacao());

                            DataPortable mem_rtc_parc = rtc2 as DataPortable;

                            // ## obtem indice

                            sb.Append(MemorySave(ref mem_rtc_parc));
                            sb.Append(",");
                        }
                    }
                }
            }

            string list_ids = sb.ToString().TrimEnd(',');

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## obtem indice geral

            output_st_csv = MemorySave(ref dp);

            // ## obtem dados adicionais

            T_Cartao cart = new T_Cartao(this);

            if (!cart.selectIdentity(st_cart_id))
            {
                return(false);
            }

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(cart.get_st_empresa()))
            {
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            string nome = "";

            if (cart.get_st_titularidade() != "01")
            {
                T_Dependente dep = new T_Dependente(this);

                dep.select_rows_prop_tit(cart.get_fk_dadosProprietario(), cart.get_st_titularidade());
                dep.fetch();

                nome = dep.get_st_nome() + " (Dependente)";
            }
            else
            {
                T_Proprietario prot = new T_Proprietario(this);

                prot.selectIdentity(cart.get_fk_dadosProprietario());

                nome = prot.get_st_nome() + " - CPF " + prot.get_st_cpf();
            }

            output_st_empresa = emp.get_st_fantasia();

            output_st_cartao = cart.get_st_empresa() + "." +
                               cart.get_st_matricula() + "." +
                               cart.get_st_titularidade() + ":" +
                               cart.get_nu_viaCartao() + " - " +
                               nome;

            output_st_total_periodo   = vr_tot.ToString();
            output_st_total_cancelado = vr_tot_cancelado.ToString();



            // ##### ------------------------------------------------------
            // ##### Relatório extra sobre todas as parcelas do cartão
            // ##### ------------------------------------------------------
            {
                T_Cartao cart_parc     = new T_Cartao(this);
                T_Cartao cart_parc_dep = new T_Cartao(this);

                ArrayList lstDeps = new ArrayList();

                if (cart_parc.selectIdentity(st_cart_id))
                {
                    if (cart_parc.get_tg_tipoCartao() == TipoCartao.presente)
                    {
                        return(true);
                    }

                    if (cart_parc_dep.select_rows_empresa_matricula(cart_parc.get_st_empresa(),
                                                                    cart_parc.get_st_matricula()))
                    {
                        while (cart_parc_dep.fetch())
                        {
                            lstDeps.Add(cart_parc_dep.get_identity());
                        }
                    }
                }

                StringBuilder sb_parcs = new StringBuilder();

                T_Parcelas parc = new T_Parcelas(this);

                for (int u = 1; u <= 12; ++u)
                {
                    string cur_pac = "Comprometimento mensal (" + u.ToString() + ")";

                    if (u == 1)
                    {
                        cur_pac += " - vigente";
                    }

                    bool HasContent   = false;
                    long tot_parc_ind = 0;

                    if (parc.select_rows_relat_parc(u.ToString(), ref lstDeps))
                    {
                        while (parc.fetch())
                        {
                            if (!term.selectIdentity(parc.get_fk_terminal()))
                            {
                                continue;
                            }

                            if (!loj.selectIdentity(term.get_fk_loja()))
                            {
                                continue;
                            }

                            if (l_tr.selectIdentity(parc.get_fk_log_transacoes()))
                            {
                                if (l_tr.get_tg_confirmada() != TipoConfirmacao.Confirmada)
                                {
                                    continue;
                                }
                            }

                            tot_parc_ind += parc.get_int_vr_valor();

                            HasContent = true;

                            Rel_RTC rtc = new Rel_RTC();

                            rtc.set_st_loja(loj.get_st_nome());
                            rtc.set_st_term(term.get_nu_terminal());
                            rtc.set_st_nsu(l_tr.get_nu_nsu());
                            rtc.set_vr_total(parc.get_vr_valor());
                            rtc.set_nu_parc(u.ToString());
                            rtc.set_dt_trans(l_tr.get_dt_transacao());
                            rtc.set_tg_status(l_tr.get_tg_confirmada());
                            rtc.set_st_motivo(l_tr.get_st_msg_transacao());
                            rtc.set_en_op_cartao(l_tr.get_en_operacao());

                            rtc.set_st_indice_parcela(parc.get_nu_indice());

                            DataPortable mem_rtc = rtc as DataPortable;

                            // ## obtem indice

                            sb_parcs.Append(MemorySave(ref mem_rtc));
                            sb_parcs.Append(",");
                        }
                    }

                    if (!HasContent)
                    {
                        break;
                    }

                    output_st_parcs       += cur_pac + ",";
                    output_st_parcs_total += tot_parc_ind.ToString() + "," +
                                             (cart_parc.get_int_vr_limiteMensal() - tot_parc_ind).ToString() + ",";
                }

                string list_ids_parc = sb_parcs.ToString().TrimEnd(',');

                DataPortable dp_parcs = new DataPortable();

                dp_parcs.setValue("ids", list_ids_parc);

                output_st_parcs_content = MemorySave(ref dp_parcs);
                output_st_parcs         = output_st_parcs.TrimEnd(',');
                output_st_parcs_total   = output_st_parcs_total.TrimEnd(',');
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_1_rtc ");

            return(true);
        }
Exemplo n.º 9
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_relFat ");

            /// USER [ execute ]

            T_Faturamento fat = new T_Faturamento(this);

            if (!fat.select_rows_dt_venc(input_st_dt_ini,
                                         input_st_dt_fim,
                                         input_tg_type))
            {
                PublishError("Nenhum registro encontrado");
                return(false);
            }

            T_Empresa     emp     = new T_Empresa(this);
            T_Loja        loj     = new T_Loja(this);
            T_RetCobranca ret_cob = new T_RetCobranca(this);

            string nome      = "";
            long   total_cob = 0;

            StringBuilder sb_content = new StringBuilder();

            while (fat.fetch())
            {
                if (input_tg_type == TipoSitFat.PagoDoc ||
                    input_tg_type == TipoSitFat.PagoCC)
                {
                    if (fat.get_tg_retBanco() == "0")
                    {
                        continue;
                    }
                }

                Rel_FatCompleto rel = new Rel_FatCompleto();



                if (fat.get_fk_empresa() != Context.FALSE)
                {
                    if (!emp.selectIdentity(fat.get_fk_empresa()))
                    {
                        return(false);
                    }

                    if (emp.get_tg_isentoFat() == Context.TRUE)
                    {
                        continue;
                    }

                    nome = "(E) " + emp.get_st_social();

                    ret_cob.select_rows_cod(emp.get_nu_bancoFat(),
                                            fat.get_tg_retBanco(),
                                            emp.get_tg_tipoCobranca());

                    total_cob += fat.get_int_vr_cobranca();
                }
                else
                {
                    if (!loj.selectIdentity(fat.get_fk_loja()))
                    {
                        return(false);
                    }

                    nome = "(L) [" + loj.get_st_loja() + "] " + loj.get_st_social() + " - " + loj.get_st_nome();

                    if (loj.get_tg_isentoFat() == Context.TRUE)
                    {
                        nome = "(ISENTO) " + nome;
                    }
                    else
                    {
                        total_cob += fat.get_int_vr_cobranca();
                    }

                    ret_cob.select_rows_cod(loj.get_nu_bancoFat(),
                                            fat.get_tg_retBanco(),
                                            loj.get_tg_tipoCobranca());
                }

                ret_cob.fetch();

                rel.set_st_nome(nome);
                rel.set_vr_cobranca(fat.get_vr_cobranca());
                rel.set_dt_vencimento(fat.get_dt_vencimento());

                if (fat.get_tg_situacao() != TipoSitFat.EmCobrança)
                {
                    rel.set_dt_baixa(fat.get_dt_baixa());
                    rel.set_cod_retBanco(fat.get_tg_retBanco());
                    rel.set_st_msgBanco(ret_cob.get_st_codMsg());
                }

                DataPortable port = rel as DataPortable;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            output_st_total = total_cob.ToString();

            // content
            {
                string list_ids = sb_content.ToString().TrimEnd(',');

                if (list_ids == "")
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
                else
                {
                    DataPortable dp = new DataPortable();

                    dp.setValue("ids", list_ids);

                    output_st_content_block = MemorySave(ref dp);
                }
            }

            /// USER [ execute ] END

            Registry("execute done fetch_relFat ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_edu_movEscola ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                PublishError("Nenhuma empresa com o código fornecido");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            output_st_nome_escola = emp.get_st_fantasia();

            LOG_Transacoes ltr = new LOG_Transacoes(this);

            StringBuilder sb = new StringBuilder();

            if (ltr.select_rows_emp_dt(emp.get_identity(),
                                       input_st_dt_ini,
                                       input_st_dt_fim,
                                       TipoConfirmacao.Confirmada))
            {
                T_Cartao cart = new T_Cartao(this);
                T_Loja   loj  = new T_Loja(this);

                while (ltr.fetch())
                {
                    if (!cart.selectIdentity(ltr.get_fk_cartao()))
                    {
                        continue;
                    }

                    if (!loj.selectIdentity(ltr.get_fk_loja()))
                    {
                        continue;
                    }

                    Rel_MovEscola rme = new Rel_MovEscola();

                    rme.set_st_aluno(cart.get_st_aluno());
                    rme.set_st_loja(loj.get_st_nome() + " - " + loj.get_st_social());
                    rme.set_vr_valor(ltr.get_vr_total());
                    rme.set_dt_trans(ltr.get_dt_transacao());

                    DataPortable mem_rme = rme as DataPortable;

                    // # Guarda registro

                    sb.Append(MemorySave(ref mem_rme));
                    sb.Append(",");
                }
            }

            string list_ids = sb.ToString().TrimEnd(',');

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            output_st_content = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_rel_edu_movEscola ");

            return(true);
        }
Exemplo n.º 11
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_6_fat ");

            /// USER [ execute ]

            T_Faturamento fat = new T_Faturamento(this);

            if (!fat.select_rows_dt_venc(input_st_dt_ini,
                                         input_st_dt_fim,
                                         TipoSitFat.Pendente))
            {
                PublishError("Nenhum registro encontrado");
                return(false);
            }

            T_Empresa             emp     = new T_Empresa(this);
            T_Loja                loj     = new T_Loja(this);
            T_FaturamentoDetalhes fat_det = new T_FaturamentoDetalhes(this);

            StringBuilder sb_content = new StringBuilder();
            StringBuilder sb_entity  = new StringBuilder();

            long total          = 0,
                 total_desconto = 0,
                 CartaoAtiv     = 0,
                 Extras         = 0,
                 FixoTrans      = 0,
                 Percent        = 0,
                 TBM            = 0;

            while (fat.fetch())
            {
                Entidade ent = new Entidade();

                ent.set_fk_fatura(fat.get_identity());

                long desconto = 0;

                if (fat.get_fk_empresa() != Context.NONE)
                {
                    if (!emp.selectIdentity(fat.get_fk_empresa()))
                    {
                        return(false);
                    }

                    if (emp.get_tg_isentoFat() == Context.TRUE)
                    {
                        continue;
                    }

                    ent.set_st_nome("Associação (" + emp.get_st_empresa() + ") " + emp.get_st_fantasia() + " - CNPJ: " + emp.get_nu_CNPJ());
                }
                else
                {
                    if (!loj.selectIdentity(fat.get_fk_loja()))
                    {
                        return(false);
                    }

                    if (loj.get_tg_isentoFat() == Context.TRUE)
                    {
                        continue;
                    }

                    ent.set_st_nome("Loja (" + loj.get_st_loja() + ") " + loj.get_st_nome() + " - CNPJ: " + loj.get_nu_CNPJ());
                }

                DataPortable tmp = ent as DataPortable;

                sb_entity.Append(MemorySave(ref tmp));
                sb_entity.Append(",");

                fat_det.Reset();

                if (fat_det.select_fk_fat(fat.get_identity()))
                {
                    while (fat_det.fetch())
                    {
                        Rel_FAT r_f = new Rel_FAT();

                        if (fat_det.get_tg_desconto() == Context.TRUE)
                        {
                            desconto += fat_det.get_int_vr_cobranca();
                        }

                        r_f.set_st_extra(fat_det.get_st_extras());
                        r_f.set_vr_cob(fat_det.get_vr_cobranca());
                        r_f.set_tg_tipoFat(fat_det.get_tg_tipoFat());
                        r_f.set_tg_desconto(fat_det.get_tg_desconto());

                        switch (fat_det.get_tg_tipoFat())
                        {
                        case TipoFat.CartaoAtiv:        CartaoAtiv += fat_det.get_int_vr_cobranca();    break;

                        case TipoFat.Extras:            Extras += fat_det.get_int_vr_cobranca();    break;

                        case TipoFat.FixoTrans:         FixoTrans += fat_det.get_int_vr_cobranca();    break;

                        case TipoFat.Percent:           Percent += fat_det.get_int_vr_cobranca();    break;

                        case TipoFat.TBM:                       TBM += fat_det.get_int_vr_cobranca();    break;
                        }

                        r_f.set_fk_fatura(fat_det.get_fk_fatura());

                        DataPortable tmp2 = r_f as DataPortable;

                        sb_content.Append(MemorySave(ref tmp2));
                        sb_content.Append(",");
                    }
                }

                total          += fat.get_int_vr_cobranca();
                total_desconto += desconto;

                output_st_csv_subtotal          += fat.get_vr_cobranca() + ",";
                output_st_csv_subtotal_desconto += desconto.ToString() + ",";
            }

            // content
            {
                string list_ids = sb_content.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                output_st_content_block = MemorySave(ref dp);
            }

            // entidades
            {
                string list_ids = sb_entity.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                output_st_emp_loj_block = MemorySave(ref dp);
            }

            output_st_csv_subtotal          = output_st_csv_subtotal.TrimEnd(',');
            output_st_csv_subtotal_desconto = output_st_csv_subtotal_desconto.TrimEnd(',');

            output_st_total          = total.ToString();
            output_st_total_desconto = total_desconto.ToString();
            output_CartaoAtiv        = CartaoAtiv.ToString();
            output_Extras            = Extras.ToString();
            output_FixoTrans         = FixoTrans.ToString();
            output_Percent           = Percent.ToString();
            output_TBM = TBM.ToString();

            /// USER [ execute ] END

            Registry("execute done fetch_rel_6_fat ");

            return(true);
        }
Exemplo n.º 12
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_5_rle ");

            /// USER [ execute ]


            // # Disabilita escrita em disco
            // # AVISO: somente por motivos de performance
            // # Somente recomendado para relatórios em produção

            SQL_LOGGING_ENABLE = false;

            StringBuilder sb = new StringBuilder();

            Hashtable hsh_loja_confirmada = new Hashtable();
            Hashtable hsh_loja_cancelada  = new Hashtable();

            Hashtable hsh_loja = new Hashtable();             // guarda se container foi gerado
            ArrayList tmp_loja = new ArrayList();             // lista de  lojas

            long vr_sub_confirmada = 0,
                 vr_sub_cancelada  = 0,
                 vr_tot_confirmada = 0,
                 vr_tot_cancelada  = 0;

            LINK_LojaEmpresa link = new LINK_LojaEmpresa(this);
            T_Cartao         cart = new T_Cartao(this);

            string id = "";

            // # Busca todos os convênios de uma empresa

            if (link.select_fk_empresa_geral(emp.get_identity()))
            {
                while (link.fetch())
                {
                    loj.Reset();

                    if (!loj.selectIdentity(link.get_fk_loja()))
                    {
                        continue;
                    }

                    id = loj.get_identity();

                    #region - identifico a loja -

                    if (hsh_loja [id] == null)
                    {
                        DadosLoja dl = new DadosLoja();

                        dl.set_st_loja(id);
                        dl.set_st_nome("(" + loj.get_st_loja() + ") " + loj.get_st_nome());

                        output_array_generic_lstLojas.Add(dl);

                        tmp_loja.Add(id);
                        hsh_loja [id] = 1;
                    }

                    #endregion

                    if (!l_tr.select_rows_dt_loj(input_st_dt_ini,
                                                 input_st_dt_fim,
                                                 id))
                    {
                        continue;
                    }

                    T_Parcelas parc = new T_Parcelas(this);

                    while (l_tr.fetch())
                    {
                        if (!cart.selectIdentity(l_tr.get_fk_cartao()))
                        {
                            continue;
                        }

                        if (cart.get_st_empresa() != input_st_empresa)
                        {
                            continue;
                        }

                        #region - contabiliza -

                        if (l_tr.get_tg_contabil() == Context.TRUE)
                        {
                            long cur_val = l_tr.get_int_vr_total();

                            if (l_tr.get_tg_confirmada() == TipoConfirmacao.Confirmada)
                            {
                                if (hsh_loja_confirmada [id] == null)
                                {
                                    vr_sub_confirmada = (long)0;
                                }
                                else
                                {
                                    vr_sub_confirmada = (long)hsh_loja_confirmada [id];
                                }

                                vr_tot_confirmada += cur_val;

                                hsh_loja_confirmada [id] = vr_sub_confirmada + cur_val;
                            }
                            else if (l_tr.get_tg_confirmada() == TipoConfirmacao.Cancelada)
                            {
                                if (hsh_loja_cancelada [id] == null)
                                {
                                    vr_sub_cancelada = (long)0;
                                }
                                else
                                {
                                    vr_sub_cancelada = (long)hsh_loja_cancelada [id];
                                }

                                vr_tot_cancelada += cur_val;

                                hsh_loja_cancelada [id] = vr_sub_cancelada + cur_val;
                            }
                        }

                        #endregion

                        Rel_RLE rle = new Rel_RLE();

                        #region - atribui ao container -

                        rle.set_st_cartao(cart.get_st_empresa() + "." +
                                          cart.get_st_matricula() + "." +
                                          cart.get_st_titularidade());

                        rle.set_st_nsu(l_tr.get_nu_nsu());
                        rle.set_vr_total(l_tr.get_vr_total());
                        rle.set_nu_parc(l_tr.get_nu_parcelas());

                        if (parc.select_fk_log_trans(l_tr.get_identity()))
                        {
                            if (parc.fetch())
                            {
                                rle.set_st_nsu(l_tr.get_nu_nsu());
                            }
                        }

                        rle.set_dt_trans(l_tr.get_dt_transacao());
                        rle.set_tg_status(l_tr.get_tg_confirmada());
                        rle.set_st_motivo(l_tr.get_st_msg_transacao());
                        rle.set_en_op_cartao(l_tr.get_en_operacao());
                        rle.set_st_loja(id);

                        #endregion

                        DataPortable mem_rle = rle as DataPortable;

                        // # Guarda registro

                        sb.Append(MemorySave(ref mem_rle));
                        sb.Append(",");
                    }
                }

                string list_ids = sb.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // # Guarda todos os registros

                output_st_csv = MemorySave(ref dp);

                #region - calcula totais -

                long value_sub = 0;

                for (int t = 0; t < tmp_loja.Count; ++t)
                {
                    id = tmp_loja[t] as string;

                    if (hsh_loja_confirmada [id] == null)
                    {
                        hsh_loja_confirmada [id] = (long)0;
                    }
                    if (hsh_loja_cancelada  [id] == null)
                    {
                        hsh_loja_cancelada  [id] = (long)0;
                    }

                    value_sub = (long)hsh_loja_confirmada [id];

                    output_st_csv_subtotal += value_sub.ToString() + ",";

                    value_sub = (long)hsh_loja_cancelada [id];

                    output_st_csv_subtotal_cancelado += value_sub.ToString() + ",";
                }

                #endregion

                output_st_csv_subtotal           = output_st_csv_subtotal.TrimEnd(',');
                output_st_csv_subtotal_cancelado = output_st_csv_subtotal_cancelado.TrimEnd(',');
                output_st_total           = vr_tot_confirmada.ToString();
                output_st_total_cancelado = vr_tot_cancelada.ToString();
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_5_rle ");

            return(true);
        }
Exemplo n.º 13
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_listaTransacoesLojas ");

            /// USER [ execute ]

            LOG_Transacoes ltr = new LOG_Transacoes(this);

            if (!ltr.select_rows_dt(input_dt_ini, input_dt_fim))
            {
                PublishError("Nenhuma transação disponível");
                return(false);
            }

            Hashtable hshEmp = new Hashtable();
            Hashtable hshLoj = new Hashtable();

            ArrayList lstEmp = new ArrayList();
            ArrayList lstLoj = new ArrayList();

            while (ltr.fetch())
            {
                string fk_empresa = ltr.get_fk_empresa();

                if (hshEmp [fk_empresa] == null)
                {
                    hshEmp [fk_empresa] = (long)0;
                    lstEmp.Add(fk_empresa);
                }

                hshEmp [fk_empresa] = (long)hshEmp [fk_empresa] + 1;

                string fk_loja = ltr.get_fk_loja();

                if (hshLoj [fk_loja] == null)
                {
                    hshLoj [fk_loja] = (long)0;
                    lstLoj.Add(fk_loja);
                }

                hshLoj [fk_loja] = (long)hshLoj [fk_loja] + 1;
            }

            ArrayList lstEmpSort = new ArrayList();

            for (int t = 0; t < lstEmp.Count; ++t)
            {
                string tg  = lstEmp[t].ToString();
                long   qtd = (long)hshEmp [tg];
                string res = qtd.ToString().PadLeft(12, '0') + tg;

                lstEmpSort.Add(res);
            }

            ArrayList lstLojSort = new ArrayList();

            for (int t = 0; t < lstLoj.Count; ++t)
            {
                string tg  = lstLoj[t].ToString();
                long   qtd = (long)hshLoj [tg];
                string res = qtd.ToString().PadLeft(12, '0') + tg;

                lstLojSort.Add(res);
            }

            lstEmpSort.Sort();
            lstLojSort.Sort();

            StringBuilder sb_global = new StringBuilder();

            T_Empresa emp = new T_Empresa(this);

            for (int t = lstEmpSort.Count - 1; t >= 0; --t)
            {
                string line = lstEmpSort[t].ToString();
                string qtd  = line.Substring(0, 12).TrimStart('0');

                if (emp.selectIdentity(line.Substring(12, line.Length - 12)))
                {
                    DadosConsultaGraficoTransLojas dl = new DadosConsultaGraficoTransLojas();

                    dl.set_nu_trans(qtd);
                    dl.set_nu_cod(emp.get_st_empresa());
                    dl.set_st_nome(emp.get_st_fantasia());
                    dl.set_tg_tipo("E");

                    DataPortable mem = dl as DataPortable;

                    sb_global.Append(MemorySave(ref mem));
                    sb_global.Append(",");
                }
            }

            T_Loja loj = new T_Loja(this);

            for (int t = lstLojSort.Count - 1; t >= 0; --t)
            {
                string line = lstLojSort[t].ToString();
                string qtd  = line.Substring(0, 12).TrimStart('0');

                if (loj.selectIdentity(line.Substring(12, line.Length - 12)))
                {
                    DadosConsultaGraficoTransLojas dl = new DadosConsultaGraficoTransLojas();

                    dl.set_nu_trans(qtd);
                    dl.set_nu_cod(loj.get_st_loja());
                    dl.set_st_nome(loj.get_st_nome() + " - " + loj.get_st_social());
                    dl.set_tg_tipo("L");

                    DataPortable mem = dl as DataPortable;

                    sb_global.Append(MemorySave(ref mem));
                    sb_global.Append(",");
                }
            }

            string list_ids = sb_global.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishNote("Nenhum registro encontrado");
                return(false);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            output_st_csv = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_listaTransacoesLojas ");

            return(true);
        }
Exemplo n.º 14
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_repEfetivo ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                PublishError("Empresa não disponível");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            output_st_nome_empresa = emp.get_st_fantasia();

            T_RepasseLoja repLoja = new T_RepasseLoja(this);

            if (!repLoja.select_rows_dt(input_dt_ini, input_dt_fim))
            {
                PublishError("Nenhum repasse encontrado");
                return(false);
            }

            LINK_RepasseParcela lrp     = new LINK_RepasseParcela(this);
            LINK_LojaEmpresa    loj_emp = new LINK_LojaEmpresa(this);
            T_Loja     loj  = new T_Loja(this);
            T_Parcelas parc = new T_Parcelas(this);
            T_Cartao   cart = new T_Cartao(this);

            StringBuilder sb_lojas        = new StringBuilder();
            StringBuilder sb_content      = new StringBuilder();
            StringBuilder sb_contentPagto = new StringBuilder();

            string id_rep_loja = "";

            while (repLoja.fetch())
            {
                if (!loj.selectIdentity(repLoja.get_fk_loja()))
                {
                    return(false);
                }

                if (input_st_loja.Length > 0)
                {
                    if (loj.get_st_loja() != input_st_loja)
                    {
                        continue;
                    }
                }

                if (!loj_emp.select_fk_empresa_loja(emp.get_identity(), loj.get_identity()))
                {
                    return(false);
                }

                if (!loj_emp.fetch())
                {
                    return(false);
                }

                // obtenho identificação geral deste pagto
                id_rep_loja = loj.get_st_nome() + " [" + loj.get_st_loja() + "] Perc.: " + ((double)loj_emp.get_int_tx_admin() / 100).ToString().Replace(",", ".") + "% <br>Data Repasse: " + repLoja.get_dt_efetiva();

                sb_lojas.Append(id_rep_loja);
                sb_lojas.Append(",");

                double tx = loj_emp.get_int_tx_admin();

                DadosPagtoRepasse dpr = new DadosPagtoRepasse();

                dpr.set_st_loja(id_rep_loja);
                dpr.set_vr_valor(repLoja.get_vr_valor());
                dpr.set_tg_opcao(repLoja.get_tg_opcao());
                dpr.set_dt_pagto(repLoja.get_dt_efetiva());

                if (repLoja.get_tg_opcao() != TipoPagamento.Cheque &&
                    repLoja.get_tg_opcao() != TipoPagamento.Dinheiro)
                {
                    // valor em depósito
                    dpr.set_st_extra("Banco (" + loj_emp.get_st_banco() +
                                     ") Agência (" + loj_emp.get_st_ag() +
                                     ") Conta (" + loj_emp.get_st_conta() + ")");
                }
                else
                {
                    dpr.set_st_extra(repLoja.get_st_ident());
                }

                // index em memoria, retrieve depois
                {
                    DataPortable port = dpr;

                    sb_contentPagto.Append(MemorySave(ref port));
                    sb_contentPagto.Append(",");
                }

                // busco detalhes

                if (!lrp.select_fk_rep(repLoja.get_identity()))
                {
                    return(false);
                }

                while (lrp.fetch())
                {
                    if (!parc.selectIdentity(lrp.get_fk_parcela()))
                    {
                        return(false);
                    }

                    if (!cart.selectIdentity(parc.get_fk_cartao()))
                    {
                        return(false);
                    }

                    DadosRepasse dr = new DadosRepasse();

                    dr.set_st_loja(id_rep_loja);

                    dr.set_st_nsu(parc.get_nu_nsu());
                    dr.set_dt_trans(parc.get_dt_inclusao());
                    dr.set_st_cartao(cart.get_st_empresa() + "." +
                                     cart.get_st_matricula() + "." +
                                     cart.get_st_titularidade());

                    long det_tot = Convert.ToInt64(parc.get_int_vr_valor() - (parc.get_int_vr_valor() * tx / 10000));

                    dr.set_vr_repasse(det_tot.ToString());
                    dr.set_vr_total(parc.get_vr_valor());

                    // index em memoria, retrieve depois
                    {
                        DataPortable port = dr;

                        sb_content.Append(MemorySave(ref port));
                        sb_content.Append(",");
                    }
                }
            }

            output_st_csv_lojas = sb_lojas.ToString().TrimEnd(',');

            // indexa todos os items
            {
                string list_ids = sb_content.ToString().TrimEnd(',');

                if (list_ids == "")
                {
                    PublishNote("Nenhum registro encontrado");
                    return(false);
                }

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## Guarda indexador de grupo

                output_st_csv_contents = MemorySave(ref dp);
            }

            // indexa todos os pagamentos
            {
                string list_ids = sb_contentPagto.ToString().TrimEnd(',');

                if (list_ids == "")
                {
                    PublishNote("Nenhum registro encontrado");
                    return(false);
                }

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## Guarda indexador de grupo

                output_st_csv_pagto = MemorySave(ref dp);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_repEfetivo ");

            return(true);
        }
Exemplo n.º 15
0
        public override bool execute( )
        {
            Registry("execute fetch_memory ");

            /// USER [ execute ]

            StringBuilder   sb       = new StringBuilder();
            ApplicationUtil var_util = new ApplicationUtil();

            int memory = Convert.ToInt32(new InstallData().maxPacket) / Convert.ToInt32(input_st_bytes);

            // ###
            // ###  Obtem todos os id´s que o relatório gerou
            // ###

            DataPortable dp_container = MemoryGet(input_st_block);

            string ids   = dp_container.getValue("ids");
            string final = "";



            int total_records = var_util.indexCSV(ids);



            // ###
            // ###  Compila uma lista de id´s que cabem na memoria
            // ###

            bool Term = false;

            for (int y = 0; y < total_records; ++y)
            {
                sb.Append(var_util.getCSV(y));
                sb.Append(",");

                if (--memory == 0 || y == total_records - 1)
                {
                    final = sb.ToString();

                    // se for ultimo registro
                    if (y == total_records - 1)
                    {
                        Term = true;


                        final = final.TrimEnd(',');
                    }

                    break;
                }
            }

            if (Term != true && final.Length > 0)
            {
                // ###
                // ### Atualiza a lista com id´s que ainda nao foram devolvidos
                // ###

                string new_batch = ids.Replace(final, "");



                DataPortable dp_new_recs = new DataPortable();

                dp_new_recs.setValue("ids", new_batch);

                // ###
                // ### Obtem novo id da lista
                // ###

                output_st_new_block = MemorySave(ref dp_new_recs);
            }

            // ###
            // ### Copia itens da memoria
            // ###

            final = final.TrimEnd(',');

            var_util.clearPortable();

            total_records = var_util.indexCSV(final);

            for (int y = 0; y < total_records; ++y)
            {
                output_array_generic_lst.Add(MemoryGet(var_util.getCSV(y)));
            }

            /// USER [ execute ] END

            Registry("execute done fetch_memory ");

            return(true);
        }
Exemplo n.º 16
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_listaLojas ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_emp))
            {
                PublishError("Empresa " + input_emp + " não disponível");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            output_nome_emp = emp.get_st_fantasia();

            LINK_LojaEmpresa loj_emp = new LINK_LojaEmpresa(this);

            if (!loj_emp.select_fk_empresa_geral(emp.get_identity()))
            {
                PublishError("Nenhuma loja cadastrada");
                return(false);
            }

            T_Loja     loj  = new T_Loja(this);
            T_Terminal term = new T_Terminal(this);

            StringBuilder sb = new StringBuilder();

            while (loj_emp.fetch())
            {
                if (!loj.selectIdentity(loj_emp.get_fk_loja()))
                {
                    continue;
                }

                if (!term.select_fk_loja(loj.get_identity()))
                {
                    continue;
                }

                DataPortable port = new DataPortable();

                port.setValue("cod", loj.get_st_loja());
                port.setValue("nome", loj.get_st_nome() + " - " + loj.get_st_social());
                port.setValue("tel", loj.get_nu_telefone());
                port.setValue("cid", loj.get_st_cidade());
                port.setValue("est", loj.get_st_estado());
                port.setValue("term", term.RowCount().ToString());
                port.setValue("cnpj", loj.get_nu_CNPJ());
                port.setValue("drep", loj_emp.get_nu_dias_repasse());
                port.setValue("prep", loj_emp.get_tx_admin().PadLeft(4, '0').Insert(2, ",") + " %");

                sb.Append(MemorySave(ref port));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## obtem indice geral

            output_id = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_rel_listaLojas ");

            return(true);
        }
Exemplo n.º 17
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_tarifas ");

            /// USER [ execute ]

            StringBuilder sb_emp     = new StringBuilder();
            StringBuilder sb_content = new StringBuilder();

            money mon_help = new money();

            T_Empresa emp = new T_Empresa(this);

            emp.select_rows_tarifas();

            while (emp.fetch())
            {
                DadosEmpresa de = new DadosEmpresa();

                de.set_st_fantasia("(E) " + emp.get_st_empresa() + " " + emp.get_st_fantasia());

                DataPortable tmp = de as DataPortable;

                sb_emp.Append(MemorySave(ref tmp));
                sb_emp.Append(",");

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Empresa" );
                    rt.set_st_val(emp.get_st_fantasia());

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Mensalidade" );
                    rt.set_st_val(mon_help.formatToMoney(emp.get_vr_mensalidade()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Percentual sobre transação" );

                    string pct = emp.get_nu_pctValor().PadLeft(3, '0');

                    pct = pct.Insert(pct.Length - 2, ",") + "%";

                    rt.set_st_val(pct);

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Valor transação" );
                    rt.set_st_val(mon_help.formatToMoney(emp.get_vr_transacao()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Valor mínimo" );
                    rt.set_st_val(mon_help.formatToMoney(emp.get_vr_minimo()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Franquia de transações" );
                    rt.set_st_val(emp.get_nu_franquia());

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Valor por cartão ativo" );
                    rt.set_st_val(mon_help.formatToMoney(emp.get_vr_cartaoAtivo()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Isento de Fatura" );

                    if (emp.get_tg_isentoFat() == Context.TRUE)
                    {
                        rt.set_st_val("SIM");
                    }
                    else
                    {
                        rt.set_st_val("NÃO");
                    }

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Situação" );

                    if (emp.get_tg_blocked() == Context.TRUE)
                    {
                        rt.set_st_val("Bloq.");
                    }
                    else
                    {
                        rt.set_st_val("Ativo");
                    }

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }
            }

            T_Loja loj = new T_Loja(this);

            loj.select_rows_tarifas();

            while (loj.fetch())
            {
                DadosEmpresa de = new DadosEmpresa();

                string id = "(" + loj.get_st_loja() + ") CNPJ: " + loj.get_nu_CNPJ() + " " + loj.get_st_nome() + " - " + loj.get_st_social();

                de.set_st_fantasia(id);

                DataPortable tmp = de as DataPortable;

                sb_emp.Append(MemorySave(ref tmp));
                sb_emp.Append(",");

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Empresa" );
                    rt.set_st_val(id);

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(id);
                    //rt.set_st_desc ( "Mensalidade" );
                    rt.set_st_val(mon_help.formatToMoney(loj.get_vr_mensalidade()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(id);
                    //rt.set_st_desc ( "Percentual sobre transação" );

                    string pct = loj.get_nu_pctValor().PadLeft(3, '0');

                    pct = pct.Insert(pct.Length - 2, ",") + "%";

                    rt.set_st_val(pct);

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(id);
                    //rt.set_st_desc ( "Valor transação" );
                    rt.set_st_val(mon_help.formatToMoney(loj.get_vr_transacao()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(id);
                    //rt.set_st_desc ( "Valor mínimo" );
                    rt.set_st_val(mon_help.formatToMoney(loj.get_vr_minimo()));

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(id);
                    //rt.set_st_desc ( "Franquia de transações" );
                    rt.set_st_val(loj.get_nu_franquia());

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Valor por cartão ativo" );
                    rt.set_st_val("0");

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(id);
                    //rt.set_st_desc ( "Isento de Fatura" );

                    if (loj.get_tg_isentoFat() == Context.TRUE)
                    {
                        rt.set_st_val("SIM");
                    }
                    else
                    {
                        rt.set_st_val("NÃO");
                    }

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }

                {
                    Rel_Tarifas rt = new Rel_Tarifas();

                    rt.set_st_emp(de.get_st_fantasia());
                    //rt.set_st_desc ( "Situação" );

                    if (loj.get_tg_blocked() == Context.TRUE)
                    {
                        rt.set_st_val("Bloq.");
                    }
                    else
                    {
                        rt.set_st_val("Ativo");
                    }

                    if (loj.get_tg_cancel() == Context.TRUE)
                    {
                        rt.set_st_val("Cancel.");
                    }

                    DataPortable port_rt = rt as DataPortable;

                    sb_content.Append(MemorySave(ref port_rt));
                    sb_content.Append(",");
                }
            }

            // content
            {
                string list_ids = sb_content.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                output_st_csv = MemorySave(ref dp);
            }

            // entidades
            {
                string list_ids = sb_emp.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                output_st_csv_emp = MemorySave(ref dp);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_tarifas ");

            return(true);
        }
        public override bool execute( )
        {
            Registry("execute infra_SchedulerDispatcher ");

            /// USER [ execute ]

            I_Scheduler sch      = new I_Scheduler(this);
            DateTime    time_now = DateTime.Now;

            if (sch.selectAll())
            {
                while (sch.fetch())
                {
                    bool Exec = false;

                    if (sch.get_tg_status() == Context.CLOSED)
                    {
                        continue;
                    }

                    switch (sch.get_tg_type())
                    {
                    case Scheduler.Specific:
                    {
                        DateTime time = Convert.ToDateTime(sch.get_dt_specific());

                        if (time_now.Year == time.Year)
                        {
                            if (time_now.Month == time.Month)
                            {
                                if (time_now.Day == time.Day)
                                {
                                    if (time_now.Hour == time.Hour)
                                    {
                                        if (time_now.Minute == time.Minute)
                                        {
                                            Exec = true;
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }

                    case Scheduler.Daily:
                    {
                        int daily_hh = Convert.ToInt32(sch.get_st_daily_hhmm().Substring(0, 2));
                        int daily_mm = Convert.ToInt32(sch.get_st_daily_hhmm().Substring(2, 2));

                        if (time_now.Hour == daily_hh)
                        {
                            if (time_now.Minute == daily_mm)
                            {
                                Exec = true;
                            }
                        }

                        break;
                    }

                    case Scheduler.Weekly:
                    {
                        long weekly_dow = sch.get_int_st_weekly_dow();
                        long weekly_hh  = Convert.ToInt64(sch.get_st_daily_hhmm().Substring(0, 2));
                        long weekly_mm  = Convert.ToInt64(sch.get_st_daily_hhmm().Substring(2, 2));

                        switch (weekly_dow)
                        {
                        case 0: if (time_now.DayOfWeek != DayOfWeek.Sunday)
                            {
                                continue;
                            }
                            break;

                        case 1: if (time_now.DayOfWeek != DayOfWeek.Monday)
                            {
                                continue;
                            }
                            break;

                        case 2: if (time_now.DayOfWeek != DayOfWeek.Tuesday)
                            {
                                continue;
                            }
                            break;

                        case 3: if (time_now.DayOfWeek != DayOfWeek.Wednesday)
                            {
                                continue;
                            }
                            break;

                        case 4: if (time_now.DayOfWeek != DayOfWeek.Thursday)
                            {
                                continue;
                            }
                            break;

                        case 5: if (time_now.DayOfWeek != DayOfWeek.Friday)
                            {
                                continue;
                            }
                            break;

                        case 6: if (time_now.DayOfWeek != DayOfWeek.Saturday)
                            {
                                continue;
                            }
                            break;

                        default: break;                                         // 7 is everyday
                        }

                        if (time_now.Hour == weekly_hh)
                        {
                            if (time_now.Minute == weekly_mm)
                            {
                                Exec = true;
                            }
                        }

                        break;
                    }

                    case Scheduler.Monthly:
                    {
                        long monthly_dd = sch.get_int_nu_monthly_day();
                        long monthly_hh = Convert.ToInt64(sch.get_st_monthly_hhmm().Substring(0, 2));
                        long monthly_mm = Convert.ToInt64(sch.get_st_monthly_hhmm().Substring(2, 2));

                        if (time_now.Day == monthly_dd)
                        {
                            if (time_now.Hour == monthly_hh)
                            {
                                if (time_now.Minute == monthly_mm)
                                {
                                    Exec = true;
                                }
                            }
                        }

                        break;
                    }

                    case Scheduler.Minute:
                    {
                        Exec = true;
                        break;
                    }

                    default:
                    {
                        Registry("Unrecognized code! " + sch.get_tg_type());
                        break;
                    }
                    }

                    if (Exec)
                    {
                        Registry(sch.get_st_job() + " >> MATCH!");
                    }

                    Registry(sch.get_st_job());

                    if (!Exec)
                    {
                        Registry(sch.get_st_job() + " >> Checking backlog....");

                        DateTime tim = Convert.ToDateTime(sch.get_dt_prev());

                        Registry(tim.ToString());
                        Registry(time_now.ToString());

                        if (time_now >= tim)
                        {
                            Registry("Back log for: " + sch.get_st_job());
                            Exec = true;
                        }
                    }

                    if (!Exec)
                    {
                        continue;
                    }

                    Registry("Running: " + sch.get_st_job());

                    ApplicationUtil var_util = new ApplicationUtil();

                    int    max_params = var_util.indexCSV(sch.get_st_job(), ';');
                    string job        = var_util.getCSV(0);

                    string path = var_SessionKey +
                                  "\\Log_" +
                                  DateTime.Now.Year.ToString() +
                                  DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Hour.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Minute.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Second.ToString().PadLeft(2, '0') +
                                  "_" +
                                  job +
                                  "_" +
                                  sch.get_identity() +
                                  ".txt.wrk";

                    FileStream   logFile;
                    StreamWriter logStream;

                    if (File.Exists(path))
                    {
                        logFile = new FileStream(path, FileMode.Append, FileAccess.Write);
                    }
                    else
                    {
                        logFile = new FileStream(path, FileMode.Create, FileAccess.Write);
                    }

                    logStream           = new StreamWriter(logFile);
                    logStream.AutoFlush = true;

                    var_Comm.Clear();

                    DB_Access new_access = new DB_Access(ref m_gen_my_access);

                    var_disp.var_Translator = var_Translator;

                    if (max_params >= 3)
                    {
                        DataPortable port = new DataPortable();

                        for (int t = 1; t < max_params;)
                        {
                            string ident     = var_util.getCSV(t); ++t;
                            string ident_val = var_util.getCSV(t); ++t;

                            port.setValue(ident, ident_val);
                        }

                        string buffer = "";

                        port.ExportBuffer(ref buffer);

                        Registry(buffer);

                        new_access.MemorySave("input", ref port);
                    }

                    // Runnig in a new thread
                    var_disp.ExecuteThreadTransaction(job,
                                                      Convert.ToInt32(sch.get_identity()),
                                                      ref logStream,
                                                      ref var_Comm,
                                                      ref new_access,
                                                      path);
                }
            }

            /// USER [ execute ] END

            Registry("execute done infra_SchedulerDispatcher ");

            return(true);
        }
Exemplo n.º 19
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_listaUsuarios ");

            /// USER [ execute ]

            T_Usuario m_user = new T_Usuario(this);

            // ## Busca usuários da empresa

            if (input_cont_header.get_st_empresa() == "000000")
            {
                // ## Todos, ordenados por empresa

                m_user.select_rows_empresa_super();
            }
            else
            {
                // ## Somente vinculados a uma empresa

                m_user.select_rows_empresa(input_cont_header.get_st_empresa());
            }

            int max = m_user.RowCount();

            StringBuilder sb = new StringBuilder();

            while (m_user.fetch())
            {
                // ## Copia dados

                if (m_user.get_tg_bloqueio() == "2")
                {
                    continue;
                }

                DadosUsuario info = new DadosUsuario();

                info.set_id_usuario(m_user.get_identity());
                info.set_st_nome(m_user.get_st_nome());
                info.set_tg_bloqueio(m_user.get_tg_bloqueio());
                info.set_tg_nivel(m_user.get_tg_nivel());
                info.set_st_empresa(m_user.get_st_empresa());

                DataPortable tmp = info as DataPortable;

                // ## Obtem identificador para registro

                sb.Append(MemorySave(ref tmp));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
                return(true);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## Obtem identificador geral

            output_st_csv_id = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_listaUsuarios ");

            return(true);
        }
        public override bool execute( )
        {
            Registry("execute exec_pf_graficoGerencial ");

            /// USER [ execute ]

            string dt_start = "";
            string dt_end   = "";

            if (input_tg_tipo == "01")
            {
                dt_start = GetTodayStartTime();
                dt_end   = GetTodayEndTime();
            }
            else if (input_tg_tipo == "02")
            {
                dt_start = GetMonthStartTime();
                dt_end   = GetMonthEndTime();
            }

            long Conf = 0;
            long Canc = 0;
            long Neg  = 0;
            long Pend = 0;

            LOG_Transacoes ltr = new LOG_Transacoes(this);

            if (ltr.select_rows_dt(dt_start, dt_end))
            {
                while (ltr.fetch())
                {
                    if (ltr.get_tg_confirmada() == TipoConfirmacao.Cancelada)
                    {
                        ++Canc;
                    }
                    else if (ltr.get_tg_confirmada() == TipoConfirmacao.Confirmada)
                    {
                        ++Conf;
                    }
                    else if (ltr.get_tg_confirmada() == TipoConfirmacao.Negada ||
                             ltr.get_tg_confirmada() == TipoConfirmacao.Erro)
                    {
                        ++Neg;
                    }
                    else if (ltr.get_tg_confirmada() == TipoConfirmacao.Pendente)
                    {
                        ++Pend;
                    }
                }
            }

            {
                DataPortable dp = new DataPortable();

                dp.setValue("desc", "Canc");
                dp.setValue("valor", Canc.ToString());

                output_array_generic_lst.Add(dp);
            }

            {
                DataPortable dp = new DataPortable();

                dp.setValue("desc", "Conf");
                dp.setValue("valor", Conf.ToString());

                output_array_generic_lst.Add(dp);
            }

            {
                DataPortable dp = new DataPortable();

                dp.setValue("desc", "Neg");
                dp.setValue("valor", Neg.ToString());

                output_array_generic_lst.Add(dp);
            }

            {
                DataPortable dp = new DataPortable();

                dp.setValue("desc", "Pend");
                dp.setValue("valor", Pend.ToString());

                output_array_generic_lst.Add(dp);
            }

            /// USER [ execute ] END

            Registry("execute done exec_pf_graficoGerencial ");

            return(true);
        }
        public override bool execute( )
        {
            Registry("execute fetch_extratoWebFuturo ");

            /// USER [ execute ]

            T_Cartao cart          = new T_Cartao(this);
            T_Cartao cart_parc_dep = new T_Cartao(this);

            if (!cart.select_rows_tudo(input_st_cartao.Substring(0, 6),
                                       input_st_cartao.Substring(6, 6),
                                       input_st_cartao.Substring(12, 2)))
            {
                PublishError("Matrícula não disponível");
                return(false);
            }

            if (!cart.fetch())
            {
                return(false);
            }

            if (cart.get_st_senha() != input_st_senha)
            {
                PublishError("Senha inválida");
                return(false);
            }

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(cart.get_st_empresa()))
            {
                PublishError("Empresa inválida");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            T_Parcelas parc = new T_Parcelas(this);

            ArrayList lstDeps = new ArrayList();

            if (cart_parc_dep.select_rows_empresa_matricula(cart.get_st_empresa(),
                                                            cart.get_st_matricula()))
            {
                while (cart_parc_dep.fetch())
                {
                    lstDeps.Add(cart_parc_dep.get_identity());
                }
            }

            T_Terminal     term = new T_Terminal(this);
            T_Loja         loj  = new T_Loja(this);
            LOG_Transacoes l_tr = new LOG_Transacoes(this);

            StringBuilder sb_parcs = new StringBuilder();

            for (int t = 2; t <= emp.get_int_nu_parcelas(); ++t)
            {
                if (parc.select_rows_relat_parc(t.ToString(), ref lstDeps))
                {
                    while (parc.fetch())
                    {
                        if (!term.selectIdentity(parc.get_fk_terminal()))
                        {
                            continue;
                        }

                        if (!loj.selectIdentity(term.get_fk_loja()))
                        {
                            continue;
                        }

                        if (l_tr.selectIdentity(parc.get_fk_log_transacoes()))
                        {
                            if (l_tr.get_tg_confirmada() != TipoConfirmacao.Confirmada)
                            {
                                continue;
                            }
                        }

                        Rel_RTC rtc = new Rel_RTC();

                        rtc.set_st_loja(loj.get_st_nome());
                        rtc.set_vr_total(parc.get_vr_valor());
                        rtc.set_nu_parc(parc.get_nu_tot_parcelas());
                        rtc.set_st_indice_parcela(parc.get_nu_indice());

                        DataPortable mem_rtc = rtc as DataPortable;

                        // ## obtem indice

                        sb_parcs.Append(MemorySave(ref mem_rtc));
                        sb_parcs.Append(",");
                    }
                }
            }

            string list_ids_parc = sb_parcs.ToString().TrimEnd(',');

            DataPortable dp_parcs = new DataPortable();

            dp_parcs.setValue("ids", list_ids_parc);

            output_st_content = MemorySave(ref dp_parcs);

            /// USER [ execute ] END

            Registry("execute done fetch_extratoWebFuturo ");

            return(true);
        }
Exemplo n.º 22
0
        public override bool execute( )
        {
            Registry("execute schedule_proc_batch ");

            /// USER [ execute ]

            string dir_watch = new SyCrafEngine.InstallData().pathDir + "\\proc\\";

            I_Batch bat = new I_Batch(this);

            Thread.Sleep(3000);                //  Wait to build valid filelist

            if (bat.select_rows_free(Context.FALSE, Context.FALSE))
            {
                while (bat.fetch())
                {
                    string archive = bat.get_st_archive();

                    #region - SETUP -

                    string path = new InstallData().pathDir + "\\Log_" +
                                  DateTime.Now.Year.ToString() +
                                  DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Hour.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Minute.ToString().PadLeft(2, '0') +
                                  DateTime.Now.Second.ToString().PadLeft(2, '0') +
                                  "_batch_" + archive + ".txt.wrk";

                    FileStream   logFile;
                    StreamWriter logStream;

                    if (File.Exists(path))
                    {
                        logFile = new FileStream(path, FileMode.Append, FileAccess.Write);
                    }
                    else
                    {
                        logFile = new FileStream(path, FileMode.Create, FileAccess.Write);
                    }

                    logStream           = new StreamWriter(logFile);
                    logStream.AutoFlush = true;

                    var_Comm.Clear();
                    DB_Access new_access = new DB_Access(ref m_gen_my_access);

                    var_disp.var_Translator = var_Translator;

                    DataPortable port = new DataPortable();

                    port.setValue("archive", archive);

                    new_access.MemorySave("input", ref port);

                    #endregion

                    if (archive.StartsWith("CARGA_EDU_"))
                    {
                        // Runnig in a new thread
                        var_disp.ExecuteThreadTransaction("load_edu",
                                                          Convert.ToInt32(bat.get_identity()),
                                                          ref logStream,
                                                          ref var_Comm,
                                                          ref new_access,
                                                          path);
                    }
                    else if (archive.StartsWith("CARGA_EDUEMPRESASVIRTUAIS"))
                    {
                        // Runnig in a new thread
                        var_disp.ExecuteThreadTransaction("load_edu_emp_virtual",
                                                          Convert.ToInt32(bat.get_identity()),
                                                          ref logStream,
                                                          ref var_Comm,
                                                          ref new_access,
                                                          path);
                    }
                    else if (archive.StartsWith("LEGADO"))
                    {
                        // Runnig in a new thread
                        var_disp.ExecuteThreadTransaction("load_legado",
                                                          Convert.ToInt32(bat.get_identity()),
                                                          ref logStream,
                                                          ref var_Comm,
                                                          ref new_access,
                                                          path);
                    }
                }
            }

            /// USER [ execute ] END

            Registry("execute done schedule_proc_batch ");

            return(true);
        }
Exemplo n.º 23
0
        public override bool execute( )
        {
            Registry("execute infra_fetchUpdaterVersion ");

            /// USER [ execute ]

            string upgradePath = new InstallData().upgradePath.Replace("depot\\Server", "depot\\Client\\Data");

            if (Directory.Exists(upgradePath))
            {
                string [] my_files = Directory.GetFiles(upgradePath);
                int       numFiles = my_files.GetLength(0);

                for (int t = 0; t < numFiles; ++t)
                {
                    string fileName = my_files[t];

                    for (int h = fileName.Length - 1; h > 0; --h)
                    {
                        if (fileName [h] == '\\')
                        {
                            fileName = fileName.Substring(h + 1, fileName.Length - h - 1);
                            break;
                        }
                    }

                    Trace(fileName);

                    if (input_tg_windows == Context.TRUE)
                    {
                        if (fileName != "UpdateEngine.dll" && fileName != "Updater.exe")
                        {
                            continue;
                        }
                    }
                    else                     // linux_dist
                    {
                        if (fileName != "UpdateEngine.dll" && fileName != "LinuxUpdater.exe")
                        {
                            continue;
                        }
                    }

                    DataPortable port = new DataPortable();

                    string filePath = upgradePath + "\\" + fileName;

                    FileStream   fs  = new FileStream(filePath, FileMode.Open);
                    BinaryReader br  = new BinaryReader(fs);
                    byte[]       bin = br.ReadBytes(Convert.ToInt32(fs.Length));
                    fs.Close();
                    br.Close();

                    StringBuilder hexString = new StringBuilder();

                    for (int i = 0; i < bin.Length; i++)
                    {
                        hexString.Append(bin[i].ToString("X2"));
                    }

                    port.setValue("data", hexString.ToString());

                    output_st_csv_files += fileName + ",";
                    output_st_csv_files += MemorySave(ref port) + ",";
                }
            }

            output_st_csv_files = output_st_csv_files.TrimEnd(',');

            /// USER [ execute ] END

            Registry("execute done infra_fetchUpdaterVersion ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_consultaEmpresa ");

            /// USER [ execute ]

            StringBuilder sb = new StringBuilder();

            string nome   = input_cont_dce.get_st_nome(),
                   cidade = input_cont_dce.get_st_cidade(),
                   estado = input_cont_dce.get_st_estado();

            long vr_min   = 0,
                 vr_max   = 0,
                 qtd_cart = 0,
                 qtd_parc = 0,
                 nu_lojas = 0,
                 val      = 0;

            // ## Prepara filtros

            if (input_cont_dce.get_nu_cartoes().Length > 0)
            {
                qtd_cart = Convert.ToInt32(input_cont_dce.get_nu_cartoes());
            }
            if (input_cont_dce.get_nu_parcelas().Length > 0)
            {
                qtd_parc = Convert.ToInt32(input_cont_dce.get_nu_parcelas());
            }
            if (input_cont_dce.get_nu_lojas().Length > 0)
            {
                nu_lojas = Convert.ToInt32(input_cont_dce.get_nu_lojas());
            }

            if (input_cont_dce.get_vr_taxa_min().Length > 0)
            {
                vr_min = Convert.ToInt32(input_cont_dce.get_vr_taxa_min());
            }
            if (input_cont_dce.get_vr_taxa_min().Length > 0)
            {
                vr_max = Convert.ToInt32(input_cont_dce.get_vr_taxa_max());
            }

            LINK_LojaEmpresa loj_emp = new LINK_LojaEmpresa(this);

            // ## Busca todos os registros

            nome = nome.ToUpper();

            while (emp.fetch())
            {
                val = emp.get_int_vr_mensalidade();

                if (vr_min > 0)
                {
                    if (val < vr_min)
                    {
                        continue;
                    }
                }

                if (vr_max > 0)
                {
                    if (val > vr_max)
                    {
                        continue;
                    }
                }

                if (vr_min > 0 && vr_max > 0)
                {
                    if (val < vr_min || val > vr_max)
                    {
                        continue;
                    }
                }

                if (qtd_cart > 0)
                {
                    if (emp.get_int_nu_cartoes() < qtd_cart)
                    {
                        continue;
                    }
                }

                if (qtd_parc > 0)
                {
                    if (emp.get_int_nu_parcelas() < qtd_parc)
                    {
                        continue;
                    }
                }

                if (nome.Length > 0)
                {
                    if (!emp.get_st_social().ToUpper().Contains(nome))
                    {
                        if (!emp.get_st_fantasia().ToUpper().Contains(nome))
                        {
                            continue;
                        }
                    }
                }

                if (cidade.Length > 0)
                {
                    if (!emp.get_st_cidade().Contains(cidade))
                    {
                        continue;
                    }
                }
                if (estado.Length > 0)
                {
                    if (!emp.get_st_estado().Contains(estado))
                    {
                        continue;
                    }
                }

                // ## Contabiliza numero de lojas

                loj_emp.SetCountMode();
                loj_emp.select_fk_empresa_geral(emp.get_identity());

                if (input_cont_dce.get_nu_lojas().Length > 0)
                {
                    if (loj_emp.GetCount() < nu_lojas)
                    {
                        continue;
                    }
                }

                // ## Copia dados para memória

                DadosEmpresa de = new DadosEmpresa();

                de.set_nu_lojas(loj_emp.GetCount().ToString());

                de.set_st_empresa(emp.get_st_empresa());
                de.set_st_fantasia(emp.get_st_fantasia().Trim() + " - " + emp.get_st_social().Trim());
                de.set_st_cidade(emp.get_st_cidade());
                de.set_st_estado(emp.get_st_estado());
                de.set_nu_cartoes(emp.get_nu_cartoes());
                de.set_nu_parcelas(emp.get_nu_parcelas());
                de.set_vr_mensalidade(emp.get_vr_mensalidade());
                de.set_nu_CNPJ(emp.get_nu_CNPJ());
                de.set_tg_bloq(emp.get_tg_bloq());

                DataPortable tmp = de as DataPortable;

                // ## indexa em CSV

                sb.Append(MemorySave(ref tmp));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
                return(true);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## Obtem identificador de bloco

            output_st_csv_empresas = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_consultaEmpresa ");

            return(true);
        }
Exemplo n.º 25
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_prevLojista ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                PublishError("Empresa não disponível");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            T_Loja loj = new T_Loja(this);

            if (!loj.select_rows_loja(input_cont_header.get_st_empresa().TrimStart('0')))
            {
                return(false);
            }

            if (!loj.fetch())
            {
                return(false);
            }

            LINK_LojaEmpresa loj_emp = new LINK_LojaEmpresa(this);

            if (!loj_emp.select_fk_empresa_loja(emp.get_identity(),
                                                loj.get_identity()))
            {
                PublishError("Loja não conveniada com empresa");
                return(false);
            }

            if (!loj_emp.fetch())
            {
                return(false);
            }

            double tx = loj_emp.get_int_tx_admin();

            T_Parcelas     parc = new T_Parcelas(this);
            T_Cartao       cart = new T_Cartao(this);
            LOG_Transacoes ltr  = new LOG_Transacoes(this);

            if (parc.select_rows_lojista_emp(loj.get_identity(),
                                             emp.get_identity(),
                                             "1"))
            {
                SQL_LOGGING_ENABLE = false;

                StringBuilder sb = new StringBuilder();

                while (parc.fetch())
                {
                    if (parc.get_tg_pago() == Context.TRUE)
                    {
                        continue;
                    }

                    if (!ltr.selectIdentity(parc.get_fk_log_transacoes()))
                    {
                        continue;
                    }

                    if (ltr.get_tg_confirmada() != TipoConfirmacao.Confirmada)
                    {
                        continue;
                    }

                    if (!cart.selectIdentity(parc.get_fk_cartao()))
                    {
                        continue;
                    }

                    if (cart.get_st_empresa() != emp.get_st_empresa())
                    {
                        continue;
                    }

                    DadosRepasse dr = new DadosRepasse();

                    dr.set_st_cartao(cart.get_st_empresa() + "." +
                                     cart.get_st_matricula() + "." +
                                     cart.get_st_titularidade());

                    dr.set_st_nsu(parc.get_nu_nsu());
                    dr.set_dt_trans(parc.get_dt_inclusao());
                    dr.set_id_parcela(parc.get_nu_indice());
                    dr.set_vr_total(parc.get_vr_valor());

                    //DateTime t_rep = Convert.ToDateTime ( p

                    //dr.set_dt_repasse   (

                    long repasse = Convert.ToInt64(parc.get_int_vr_valor() - (parc.get_int_vr_valor() * tx / 10000));

                    dr.set_vr_repasse(repasse.ToString());

                    DataPortable mem_rtc = dr as DataPortable;

                    // ## obtem indice

                    sb.Append(MemorySave(ref mem_rtc));
                    sb.Append(",");
                }

                string list_ids = sb.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## obtem indice geral

                output_st_csv = MemorySave(ref dp);

                SQL_LOGGING_ENABLE = true;
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_prevLojista ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_edu_movRedeEscola ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_cont_header.get_st_empresa()))
            {
                PublishError("Nenhuma empresa com o código fornecido");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            output_st_empresa = emp.get_st_fantasia();

            T_Empresa emp_escola = new T_Empresa(this);

            if (!emp_escola.select_fk_admin(emp.get_identity()))
            {
                PublishError("Nenhum colégio cadastrado");
                return(false);
            }

            ArrayList lstEscolas = new ArrayList();

            while (emp_escola.fetch())
            {
                lstEscolas.Add(emp_escola.get_identity());
            }

            ArrayList lstResults = new ArrayList();

            LOG_Transacoes ltr = new LOG_Transacoes(this);

            // busca todas escolas cadastradas
            for (int t = 0; t < lstEscolas.Count; ++t)
            {
                emp_escola.selectIdentity(lstEscolas[t].ToString());

                if (ltr.select_rows_emp_dt(emp_escola.get_identity(),
                                           input_st_dt_ini,
                                           input_st_dt_fim,
                                           TipoConfirmacao.Confirmada))
                {
                    Hashtable hshLojaValor = new Hashtable();
                    ArrayList lstLoja      = new ArrayList();

                    // busca todas as transações das lojas e seu somatorio
                    while (ltr.fetch())
                    {
                        string fk_loja = ltr.get_fk_loja();

                        if (!lstLoja.Contains(fk_loja))
                        {
                            hshLojaValor [fk_loja] = Convert.ToInt64(0);
                            lstLoja.Add(fk_loja);
                        }

                        // acrescenta mais um valor na loja
                        hshLojaValor [fk_loja] = Convert.ToInt64(hshLojaValor [fk_loja]) +
                                                 ltr.get_int_vr_total();
                    }


                    for (int h = 0; h < lstLoja.Count; ++h)
                    {
                        string fk_loja    = lstLoja[h].ToString();
                        string tot_amount = Convert.ToInt64(hshLojaValor [fk_loja]).ToString();

                        lstResults.Add(tot_amount.PadLeft(12, '0') +
                                       emp_escola.get_identity().PadLeft(12, '0') +
                                       fk_loja.PadLeft(12, '0'));
                    }
                }
            }

            // ordena
            lstResults.Sort();

            T_Loja loj = new T_Loja(this);

            StringBuilder sb = new StringBuilder();

            for (int t = 0; t < lstResults.Count; ++t)
            {
                string numbers = lstResults[t].ToString();

                string valor  = numbers.Substring(0, 12).TrimStart('0');
                string escola = numbers.Substring(12, 12).TrimStart('0');
                string loja   = numbers.Substring(24, 12).TrimStart('0');

                if (!emp_escola.selectIdentity(escola))
                {
                    continue;
                }

                if (!loj.selectIdentity(loja))
                {
                    continue;
                }

                Rel_MovRedeEscola rme = new Rel_MovRedeEscola();

                rme.set_st_loja(loj.get_st_nome() + " - " + loj.get_st_social());
                rme.set_vr_valor(valor);
                rme.set_st_colegio(emp_escola.get_st_fantasia());

                DataPortable mem_rme = rme as DataPortable;

                // # Guarda registro

                sb.Append(MemorySave(ref mem_rme));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            output_st_content = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_rel_edu_movRedeEscola ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_reciboVendaGift ");

            /// USER [ execute ]

            LOG_Transacoes ltr  = new LOG_Transacoes(this);
            T_Loja         loj  = new T_Loja(this);
            T_Terminal     term = new T_Terminal(this);
            T_Cartao       cart = new T_Cartao(this);

            if (!ltr.select_rows_nsu(input_nsu, GetTodayStartTime(), GetTodayEndTime()))
            {
                return(false);
            }

            if (!ltr.fetch())
            {
                return(false);
            }

            fk_transacao = ltr.get_identity();

            if (!loj.selectIdentity(ltr.get_fk_loja()))
            {
                return(false);
            }

            if (!term.selectIdentity(ltr.get_fk_terminal()))
            {
                return(false);
            }

            if (!cart.selectIdentity(ltr.get_fk_cartao()))
            {
                return(false);
            }

            ArrayList lstContent = new ArrayList();

            lstContent.Add("Gift Card Lindóia Shopping");
            lstContent.Add("Rede ConveyNET");
            lstContent.Add("Cod. Estab: " + loj.get_st_loja());
            lstContent.Add("Nr.Cartao: " + cart.get_st_empresa() + "." + cart.get_st_matricula());
            lstContent.Add("No. Terminal: " + term.get_nu_terminal());
            lstContent.Add("Loja: " + loj.get_st_nome());
            lstContent.Add("--------------------------------------");
            lstContent.Add("Cod.Process.: 2000 - Cartao Convenio");

            string data = ltr.get_dt_transacao();

            lstContent.Add("Data Trans.: " + data.Substring(8, 2) + "/" +
                           data.Substring(5, 2) + "/" +
                           data.Substring(0, 4) + " Hora: " +
                           data.Substring(11, 8));

            lstContent.Add("NSU: " + ltr.get_nu_nsu());
            lstContent.Add("");
            lstContent.Add("");
            lstContent.Add("VALOR TOT. R$ " + new money().formatToMoney(ltr.get_vr_total()));
            lstContent.Add("");
            lstContent.Add("");
            lstContent.Add("Operador: " + user.get_st_nome());

            for (int t = 0; t < lstContent.Count; ++t)
            {
                DataPortable port = new DataPortable();
                port.setValue("linha", lstContent[t].ToString());
                output_array_generic_lst.Add(port);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_reciboVendaGift ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_dadosAdministradora ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            // ## Busca empresa

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                PublishError("Empresa inválida");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            // ## Obtem chave da empresa principal

            string fk_admin = emp.get_identity();

            // ## Busca todas as empresas

            if (!emp.selectAll())
            {
                PublishError("Nenhuma empresa cadastrada");
                return(false);
            }

            // ## Dois grupos, um das empresas vinculadas
            // ## e outro de não vinculadas

            StringBuilder sb_in  = new StringBuilder();
            StringBuilder sb_out = new StringBuilder();

            // ## Busca registros

            while (emp.fetch())
            {
                // ## Empresa admin deve ser filtrada

                if (emp.get_identity() == fk_admin)
                {
                    continue;
                }

                // ## Copia para memória

                DadosEmpresa de = new DadosEmpresa();

                de.set_st_fantasia(emp.get_st_fantasia());
                de.set_st_empresa(emp.get_st_empresa());

                DataPortable port = de as DataPortable;

                // ## Caso link para admin bater com admin
                // ## esta empresa é vinculada

                if (emp.get_fk_admin() == fk_admin)
                {
                    // ## obtem indexador

                    sb_in.Append(MemorySave(ref port));
                    sb_in.Append(",");
                }
                else
                {
                    // ## obtem indexador

                    sb_out.Append(MemorySave(ref port));
                    sb_out.Append(",");
                }
            }

            // in
            {
                string list_ids = sb_in.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## obtem indexador de grupo

                output_st_in_csv = MemorySave(ref dp);
            }

            // out
            {
                string list_ids = sb_out.ToString().TrimEnd(',');

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## obtem indexador de grupo

                output_st_out_csv = MemorySave(ref dp);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_dadosAdministradora ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_cartoes_grafica ");

            /// USER [ execute ]

            StringBuilder sb = new StringBuilder();

            T_Cartao       cart     = new T_Cartao(this);
            T_Cartao       cart_upd = new T_Cartao(this);
            T_Proprietario prot     = new T_Proprietario(this);
            T_Empresa      emp      = new T_Empresa(this);

            ApplicationUtil util = new ApplicationUtil();

            // ## Busca empresa informada

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                PublishError("Empresa inválida");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            string nome_empresa = emp.get_st_fantasia().PadRight(25, ' ');

            // ## Busca todos cartões vinculados à empresa

            if (cart.select_rows_empresa(input_st_empresa))
            {
                while (cart.fetch())
                {
                    // ## Se cartão não estiver expedido...

                    if (cart.get_tg_emitido() == StatusExpedicao.NaoExpedido)
                    {
                        DadosExpedicao port = new DadosExpedicao();

                        string line = "+";

                        string nome = "";

                        if (cart.get_tg_tipoCartao() == TipoCartao.presente)
                        {
                            nome = "";
                        }
                        else
                        {
                            if (!prot.selectIdentity(cart.get_fk_dadosProprietario()))
                            {
                                return(false);
                            }

                            nome = prot.get_st_nome();

                            T_Dependente dep_f = new T_Dependente(this);

                            if (dep_f.select_rows_prop_tit(cart.get_fk_dadosProprietario(),
                                                           cart.get_st_titularidade()))
                            {
                                if (dep_f.fetch())
                                {
                                    nome = dep_f.get_st_nome();
                                }
                            }
                        }

                        line += nome + ",";
                        line += cart.get_st_empresa() + ",";
                        line += cart.get_st_matricula() + ",";

                        cart.set_st_venctoCartao(cart.get_st_venctoCartao().PadLeft(4, '0'));

                        line += cart.get_st_venctoCartao().Substring(0, 2) + "/" +
                                cart.get_st_venctoCartao().Substring(2, 2) + ",";

                        if (cart.get_tg_tipoCartao() == TipoCartao.presente)
                        {
                            line += util.calculaCodigoAcesso(cart.get_st_empresa(),
                                                             cart.get_st_matricula(),
                                                             cart.get_st_venctoCartao());
                        }
                        else
                        {
                            line += util.calculaCodigoAcesso(cart.get_st_empresa(),
                                                             cart.get_st_matricula(),
                                                             cart.get_st_titularidade(),
                                                             cart.get_nu_viaCartao(),
                                                             prot.get_st_cpf());
                        }

                        line += ",";
                        line += nome + ",";

                        // # Trilha

                        line += "|";

                        line += "826766" + cart.get_st_empresa() +
                                cart.get_st_matricula() +
                                cart.get_st_titularidade() +
                                cart.get_nu_viaCartao() +
                                "65" + cart.get_st_venctoCartao();

                        line += "|";

                        port.set_st_line(line);

                        // ## Salva em memória

                        DataPortable mem_port = port as DataPortable;

                        sb.Append(MemorySave(ref mem_port));
                        sb.Append(",");

                        // ## Atualiza estado do cartão para 'em expedição'

                        cart_upd.ExclusiveAccess();

                        if (!cart_upd.selectIdentity(cart.get_identity()))
                        {
                            return(false);
                        }

                        cart_upd.set_tg_emitido(StatusExpedicao.EmExpedicao);

                        // ## Atualiza

                        if (!cart_upd.synchronize_T_Cartao())
                        {
                            return(false);
                        }

                        cart_upd.ReleaseExclusive();
                    }
                }
            }

            // ## Gera bloco de linhas em um identificador

            string list_ids = sb.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishError("Nenhum cartão encontrado para ser expedido à grafica");
                return(false);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## Copia para saída

            output_st_csv = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_cartoes_grafica ");

            return(true);
        }
Exemplo n.º 30
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_dirCont ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_st_empresa.PadLeft(6, '0')))
            {
                PublishError("Empresa não disponível");
                return(false);
            }

            if (!emp.fetch())
            {
                return(false);
            }

            output_st_nome_empresa = emp.get_st_fantasia();

            StringBuilder sb_content = new StringBuilder();

            {
                DadosContabilGift dcg = new DadosContabilGift();

                dcg.set_st_item("Quant. Cartões Cancelados");

                T_Cartao cart = new T_Cartao(this);

                cart.SetCountMode();

                cart.select_rows_canc(input_cont_header.get_st_empresa(),
                                      input_dt_ini,
                                      input_dt_fim,
                                      MotivoBloqueio.CANCELAMENTO,
                                      TipoCartao.presente,
                                      CartaoStatus.Bloqueado);

                dcg.set_nu_valor(cart.GetCount().ToString());

                Trace(dcg.get_st_item());
                Trace(dcg.get_nu_valor());

                DataPortable port = dcg;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            {
                DadosContabilGift dcg = new DadosContabilGift();

                dcg.set_st_item("Quant. Recargas");

                LOG_VendaCartaoGift lvc = new LOG_VendaCartaoGift(this);

                lvc.SetCountMode();

                lvc.select_rows_cargas(input_dt_ini,
                                       input_dt_fim,
                                       emp.get_identity(),
                                       Context.FALSE);

                dcg.set_nu_valor(lvc.GetCount().ToString());

                Trace(dcg.get_st_item());
                Trace(dcg.get_nu_valor());

                DataPortable port = dcg;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            long vendidos = 0;

            {
                DadosContabilGift dcg = new DadosContabilGift();

                dcg.set_st_item("Quant. Cartões Vendidos");

                LOG_VendaCartaoGift lvc = new LOG_VendaCartaoGift(this);

                lvc.SetCountMode();

                lvc.select_rows_cargas(input_dt_ini,
                                       input_dt_fim,
                                       emp.get_identity(),
                                       Context.TRUE);


                vendidos = lvc.GetCount();

                dcg.set_nu_valor(vendidos.ToString());

                Trace(dcg.get_st_item());
                Trace(dcg.get_nu_valor());

                DataPortable port = dcg;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            long disp = 0;

            {
                DadosContabilGift dcg = new DadosContabilGift();

                dcg.set_st_item("Saldo Anterior");

                T_Cartao cart = new T_Cartao(this);

                cart.SetCountMode();

                cart.select_rows_gift_disp(Context.NONE, TipoCartao.presente);

                disp = cart.GetCount();

                long anterior = vendidos + cart.GetCount();

                dcg.set_nu_valor(anterior.ToString());

                DataPortable port = dcg;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            {
                DadosContabilGift dcg = new DadosContabilGift();

                dcg.set_st_item("Saldo Atual");
                dcg.set_nu_valor(disp.ToString());

                DataPortable port = dcg;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            long novo_cartao_carga = 0;
            long cartao_recarga    = 0;

            long tarifa_novo_cartao_carga = 0;
            long tarifa_cartao_recarga    = 0;

            {
                DadosContabilGift dcg = new DadosContabilGift();

                dcg.set_st_item("Movimento do dia");
                dcg.set_nu_valor("0");

                LOG_VendaCartaoGift lvc = new LOG_VendaCartaoGift(this);

                T_ExtraGift eGift = new T_ExtraGift(this);

                eGift.selectAll();
                eGift.fetch();

                long vr_valor  = 0;
                long tx_adesao = eGift.get_int_vr_valor();

                eGift.fetch();

                long tx_recarga = eGift.get_int_vr_valor();

                // novo cartão
                lvc.select_rows_cargas(input_dt_ini,
                                       input_dt_fim,
                                       emp.get_identity(),
                                       Context.TRUE);

                long qtd_novo_cartao_carga = lvc.RowCount();

                while (lvc.fetch())
                {
                    novo_cartao_carga += lvc.get_int_vr_carga();
                }

                tarifa_novo_cartao_carga = qtd_novo_cartao_carga * tx_adesao;

                vr_valor += novo_cartao_carga + tarifa_novo_cartao_carga;

                lvc.Reset();

                // recargas
                if (lvc.select_rows_cargas(input_dt_ini,
                                           input_dt_fim,
                                           emp.get_identity(),
                                           Context.FALSE))
                {
                    long qtd_cartao_recarga = lvc.RowCount();

                    while (lvc.fetch())
                    {
                        cartao_recarga += lvc.get_int_vr_carga();
                    }

                    tarifa_cartao_recarga = qtd_cartao_recarga * tx_recarga;

                    vr_valor += cartao_recarga + tarifa_cartao_recarga;
                }

                dcg.set_nu_valor("R$ " + new money().formatToMoney(vr_valor.ToString()));

                DataPortable port = dcg;

                sb_content.Append(MemorySave(ref port));
                sb_content.Append(",");
            }

            output_cont_dsc.set_vr_tot_carga((cartao_recarga + novo_cartao_carga).ToString());
            output_cont_dsc.set_vr_tot_tarifa((tarifa_cartao_recarga + tarifa_novo_cartao_carga).ToString());

            long tot_compras = 0;
            long tot_taxa    = 0;
            long tot_repasse = 0;

            {
                T_Parcelas       parc    = new T_Parcelas(this);
                LINK_LojaEmpresa loj_emp = new LINK_LojaEmpresa(this);

                // busca parcelas da empresa no dia
                if (parc.select_rows_empresa_gift(emp.get_identity(), input_dt_ini, input_dt_fim))
                {
                    while (parc.fetch())
                    {
                        // busca convenio
                        if (!loj_emp.select_fk_empresa_loja(emp.get_identity(), parc.get_fk_loja()))
                        {
                            return(false);
                        }

                        if (!loj_emp.fetch())
                        {
                            return(false);
                        }

                        double tx = loj_emp.get_int_tx_admin();

                        long taxa = Convert.ToInt64(parc.get_int_vr_valor() * tx / 10000);

                        tot_compras += parc.get_int_vr_valor();
                        tot_taxa    += taxa;
                        tot_repasse += Convert.ToInt64(parc.get_int_vr_valor() - taxa);
                    }
                }
            }

            output_cont_dsc.set_vr_tot_compras(tot_compras.ToString());
            output_cont_dsc.set_vr_tot_tx(tot_taxa.ToString());
            output_cont_dsc.set_vr_tot_repasse(tot_repasse.ToString());

            // indexa todos os items
            {
                string list_ids = sb_content.ToString().TrimEnd(',');

                if (list_ids == "")
                {
                    PublishNote("Nenhum registro encontrado");
                    return(false);
                }

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## Guarda indexador de grupo

                output_st_csv_contents = MemorySave(ref dp);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_dirCont ");

            return(true);
        }