public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute exec_validGift "); /// USER [ execute ] T_Cartao cart = new T_Cartao(this); input_st_empresa = input_st_empresa.PadLeft(6, '0'); input_st_matricula = input_st_matricula.PadLeft(6, '0'); if (!cart.select_rows_empresa_matricula(input_st_empresa, input_st_matricula)) { PublishError("Cartão não disponível"); return(false); } if (!cart.fetch()) { return(false); } ApplicationUtil util = new ApplicationUtil(); string cod_acesso = util.calculaCodigoAcesso(cart.get_st_empresa(), cart.get_st_matricula(), cart.get_st_venctoCartao()); Trace(cod_acesso); if (input_st_acesso != cod_acesso) { PublishError("Código de acesso inválido"); return(false); } if (input_tg_recarga == Context.TRUE) { if (cart.get_fk_dadosProprietario() == Context.NONE) { PublishError("Cartão previamente adquirido"); return(false); } } /// USER [ execute ] END Registry("execute done exec_validGift "); 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); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute exec_processaArqBancario "); /// USER [ execute ] DataPortable csv_AllArchive = MemoryGet(input_st_id); ApplicationUtil var_util = new ApplicationUtil(); string st_ids = csv_AllArchive.getValue("ids"); Trace(st_ids); int total_records = var_util.indexCSV(st_ids); T_Faturamento fat = new T_Faturamento(this); for (int t = 0; t < total_records; ++t) { DataPortable port_line = MemoryGet(var_util.getCSV(t)); string line = port_line.getValue("line"); Trace(line); int pos = 0; //7 //06 //030908 //7 //0509629684 //030908 //0000000002108 string fk = line.Substring(pos, 25).Trim(); pos += 25; string cod = line.Substring(pos, 2).Trim(); pos += 2; string dt_banco = line.Substring(pos, 6).Trim(); pos += 6; string st_seuNum = line.Substring(pos, 10).Trim(); pos += 10; string st_nosNum = line.Substring(pos, 20).Trim(); pos += 20; string dt_venc = line.Substring(pos, 6).Trim(); pos += 6; string vr_pago = line.Substring(pos, 13).Trim(); pos += 13; vr_pago = vr_pago.TrimStart('0'); Trace(line); fat.ExclusiveAccess(); if (!fat.selectIdentity(fk)) { Registry("Registro " + fk + " desconhecido!"); fat.ReleaseExclusive(); continue; } fat.set_tg_retBanco(cod); if (cod == "00") { fat.set_tg_situacao(TipoSitFat.PagoCC); } if (cod == "10") { fat.set_tg_situacao(TipoSitFat.BaixaCfeInst); } if (cod == "06" || cod == "08" || cod == "15" || cod == "25") { fat.set_tg_situacao(TipoSitFat.PagoDoc); } fat.set_dt_baixa(GetDataBaseTime(new DateTime(2000 + Convert.ToInt32(dt_banco.Substring(4, 2)), Convert.ToInt32(dt_banco.Substring(2, 2)), Convert.ToInt32(dt_banco.Substring(0, 2))))); if (!fat.synchronize_T_Faturamento()) { Registry("Registro " + fk + " não foi possível atualizar!"); } fat.ReleaseExclusive(); } /// USER [ execute ] END Registry("execute done exec_processaArqBancario "); return(true); }
/// USER [ custom_functions ] /// USER [ custom_functions ] END public bool Item1() { #region - INPUT VARS - transaction.MemoryClean(); tst_unit.LogTest("exec_login Item1", ref m_Log); transaction.ut_abort = 0; string st_nome = ""; string st_empresa = ""; string st_senha = ""; #endregion /// USER [ setup_test_1 ] string m_sSessionSeed = "abcdefghijklmnopqrstuvxywz0123456789"; Random randObj = new Random(); int iLen = m_sSessionSeed.Length; for (int t = 0; t < 15; ++t) { st_nome += m_sSessionSeed[randObj.Next(0, iLen)].ToString(); } st_senha = new ApplicationUtil().getMd5Hash("12345678"); T_Usuario u = new T_Usuario(transaction); //string id = ""; /*u.setup ( false, * ref id, * TipoUsuario.Administrador, * Context.TRUE, * transaction.GetDataBaseTime(), * transaction.GetDataBaseTime(), * "0", * Context.FALSE, * "", * "", * "", * "", * "", * st_empresa, * st_senha, * Context.FALSE, * st_nome ); */ /// USER [ setup_test_1 ] END #region - MAPPING TRANSACTION - call_exec_login(st_nome, st_empresa, st_senha); if (transaction.setup() == false) { return(false); } try { #endregion /// USER [ execute_1 ] if (!transaction.authenticate()) { return(false); } if (!transaction.execute()) { return(false); } /// USER [ execute_1 ] END #region - OUTPUT VARS - } catch (System.Exception se) { if (se.Message != "ABORT") { MessageBox.Show(se.ToString()); } } if (transaction.finish() == false) { return(false); } string tg_trocaSenha = ""; CNetHeader header = new CNetHeader(); recv_exec_login(ref tg_trocaSenha, ref header); transaction.sendObjections(ref my_objections); #endregion /// USER [ validate_1 ] /// USER [ validate_1 ] END header.Clear(); 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); }
public override bool execute( ) { Registry("execute exec_pos_vendaEmpresarialSITEF "); /// USER [ execute ] #region - atualizar senhas - cart.ExclusiveAccess(); if (!cart.selectIdentity(cart.get_identity())) { output_st_msg = "Erro aplicativo"; return(false); } if (!prot.selectIdentity(cart.get_fk_dadosProprietario())) { output_st_msg = "Erro aplicativo"; return(false); } if (cart.get_st_titularidade() != "01") { T_Dependente dep = new T_Dependente(this); if (!dep.select_rows_prop_tit(cart.get_fk_dadosProprietario(), cart.get_st_titularidade())) { output_st_msg = "Erro aplicativo"; return(false); } if (!dep.fetch()) { output_st_msg = "Erro aplicativo"; return(false); } var_nomeCliente = dep.get_st_nome(); } else { var_nomeCliente = prot.get_st_nome(); } if (IsDigitado) { string cod_acesso = new ApplicationUtil().calculaCodigoAcesso(cart.get_st_empresa(), cart.get_st_matricula(), cart.get_st_titularidade(), cart.get_nu_viaCartao(), prot.get_st_cpf()); Trace(cod_acesso); if (cod_acesso != input_cont_pe.get_st_senha()) { output_st_msg = "Senha inválida"; var_codResp = "4343"; return(false); } } else { if (cart.get_st_senha() != input_cont_pe.get_st_senha()) { long senhasErradas = cart.get_int_nu_senhaErrada() + 1; cart.set_nu_senhaErrada(senhasErradas.ToString()); if (senhasErradas > 4) { cart.set_tg_status(CartaoStatus.Bloqueado); cart.set_tg_motivoBloqueio(MotivoBloqueio.SENHA_ERRADA); cart.set_dt_bloqueio(GetDataBaseTime()); } if (!cart.synchronize_T_Cartao()) { output_st_msg = "Erro aplicativo"; return(false); } output_st_msg = "Senha inválida"; var_codResp = "4343"; return(false); } else { cart.set_nu_senhaErrada(Context.NONE); } } if (cart.get_tg_tipoCartao() == TipoCartao.presente) { cart.set_vr_limiteTotal(cart.get_int_vr_limiteTotal() - vr_valor); if (!cart.synchronize_T_Cartao()) { output_st_msg = "Erro aplicativo"; return(false); } } cart.ReleaseExclusive(); #endregion #region - busca informações extras - if (!info.selectIdentity(cart.get_fk_infoAdicionais())) { output_st_msg = "Erro aplicativo"; return(false); } #endregion #region - Faz efetivamente a venda - int tmp_nu_parc = Convert.ToInt32(input_cont_pe.get_nu_parcelas()); int index_pos = 0; string tmp_variavel = input_cont_pe.get_st_valores(); if (tmp_variavel.Length < tmp_nu_parc * 12) { output_st_msg = "formato incorreto"; return(false); } if (cart.get_tg_tipoCartao() != TipoCartao.presente) { if (tmp_nu_parc > emp.get_int_nu_parcelas()) { output_st_msg = "excede max. parcelas"; var_codResp = "1212"; return(false); } } #region - obtem nsu - l_nsu.set_dt_log(GetDataBaseTime()); if (!l_nsu.create_LOG_NSU()) { output_st_msg = "Erro aplicativo"; return(false); } #endregion var_nu_nsuAtual = l_nsu.get_identity(); var_nu_nsuEntidade = var_nu_nsuAtual; var_dt_transacao = GetDataBaseTime(); // ## Criar parcelas for (int t = 1; t <= tmp_nu_parc; ++t) { T_Parcelas parc = new T_Parcelas(this); string valor_unit_parc = tmp_variavel.Substring(index_pos, 12); index_pos += 12; #region - atribui valores e links à parcela - parc.set_nu_nsu(l_nsu.get_identity()); parc.set_fk_empresa(emp.get_identity()); parc.set_fk_cartao(cart.get_identity()); parc.set_dt_inclusao(var_dt_transacao); parc.set_nu_parcela(t.ToString()); parc.set_vr_valor(valor_unit_parc); parc.set_nu_indice(t.ToString()); parc.set_tg_pago(TipoParcela.EM_ABERTO); parc.set_fk_loja(loj.get_identity()); parc.set_nu_tot_parcelas(tmp_nu_parc.ToString()); parc.set_fk_terminal(term.get_identity()); #endregion if (!parc.create_T_Parcelas()) { output_st_msg = "erro aplicativo"; return(false); } lstParcs.Add(parc.get_identity()); } #endregion var_codResp = "0000"; /// USER [ execute ] END Registry("execute done exec_pos_vendaEmpresarialSITEF "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute exec_alteraLoja "); /// USER [ execute ] // ## Se container estiver preenchido, alterar dados // ## cadastrais da loja if (input_cont_dl.get_st_nome() != "") { loj.set_nu_CNPJ(input_cont_dl.get_nu_CNPJ()); loj.set_st_nome(input_cont_dl.get_st_nome()); loj.set_st_social(input_cont_dl.get_st_social()); loj.set_st_endereco(input_cont_dl.get_st_endereco()); loj.set_st_enderecoInst(input_cont_dl.get_st_enderecoInst()); loj.set_nu_inscEst(input_cont_dl.get_nu_inscEst()); loj.set_st_cidade(input_cont_dl.get_st_cidade()); loj.set_st_estado(input_cont_dl.get_st_estado()); loj.set_nu_CEP(input_cont_dl.get_nu_CEP()); loj.set_nu_telefone(input_cont_dl.get_nu_telefone()); loj.set_nu_fax(input_cont_dl.get_nu_fax()); loj.set_st_contato(input_cont_dl.get_st_contato()); loj.set_vr_mensalidade(input_cont_dl.get_vr_mensalidade()); loj.set_nu_contaDeb(input_cont_dl.get_nu_contaDeb()); loj.set_st_obs(input_cont_dl.get_st_obs()); loj.set_vr_mensalidade(input_cont_dl.get_vr_mensalidade()); loj.set_nu_pctValor(input_cont_dl.get_nu_pctValor()); loj.set_vr_transacao(input_cont_dl.get_vr_transacao()); loj.set_vr_minimo(input_cont_dl.get_vr_minimo()); loj.set_nu_franquia(input_cont_dl.get_nu_franquia()); loj.set_nu_periodoFat(input_cont_dl.get_nu_periodoFat()); loj.set_nu_diavenc(input_cont_dl.get_nu_diavenc()); loj.set_tg_tipoCobranca(input_cont_dl.get_tg_tipoCobranca()); loj.set_nu_bancoFat(input_cont_dl.get_nu_bancoFat()); loj.set_tg_isentoFat(input_cont_dl.get_tg_isento()); loj.set_st_senha(input_cont_dl.get_st_senhaWeb()); if (!loj.synchronize_T_Loja()) { return(false); } } // ## Alteração de convênios Hashtable hshEmps = new Hashtable(); ArrayList lstEmps = new ArrayList(); if (input_st_csv_empresas.Length > 0) { LINK_LojaEmpresa loj_emp = new LINK_LojaEmpresa(this); // ## buscar e limpar todos os registros de convênio T_Empresa emp = new T_Empresa(this); if (loj_emp.select_fk_loja(loj.get_identity())) { while (loj_emp.fetch()) { hshEmps [loj_emp.get_fk_empresa()] = "0"; lstEmps.Add(loj_emp.get_fk_empresa()); if (!loj_emp.delete()) { return(false); } } } ApplicationUtil util_taxa = new ApplicationUtil(); ApplicationUtil util_repasse = new ApplicationUtil(); ApplicationUtil util_banco = new ApplicationUtil(); ApplicationUtil util_ag = new ApplicationUtil(); ApplicationUtil util_conta = new ApplicationUtil(); // ## Indexa as taxas util_taxa.indexCSV(input_st_csv_taxas); util_repasse.indexCSV(input_st_csv_dias); util_banco.indexCSV(input_st_csv_banco); util_ag.indexCSV(input_st_csv_ag); util_conta.indexCSV(input_st_csv_conta); // ## Percorre todas as empresas vinculadas for (int t = 0; t < var_util.indexCSV(input_st_csv_empresas); ++t) { string empresa = var_util.getCSV(t); if (!emp.select_rows_empresa(empresa)) { return(false); } if (!emp.fetch()) { return(false); } // ## Cria o relacionamento loj_emp.set_fk_empresa(emp.get_identity()); loj_emp.set_fk_loja(loj.get_identity()); loj_emp.set_tx_admin(util_taxa.getCSV(t)); loj_emp.set_nu_dias_repasse(util_repasse.getCSV(t)); loj_emp.set_st_banco(util_banco.getCSV(t)); loj_emp.set_st_ag(util_ag.getCSV(t)); loj_emp.set_st_conta(util_conta.getCSV(t)); if (!loj_emp.create_LINK_LojaEmpresa()) { return(false); } if (hshEmps [emp.get_identity()] != null) { hshEmps [emp.get_identity()] = "1"; } } for (int t = 0; t < lstEmps.Count; ++t) { string tag = lstEmps[t].ToString(); if (hshEmps [tag] != null) { if (hshEmps [tag].ToString() == "0") { // foi removido emp.selectIdentity(tag); LOG_Audit aud = new LOG_Audit(this); aud.set_tg_operacao(TipoOperacao.RemoveConvenio); aud.set_fk_usuario(input_cont_header.get_st_user_id()); aud.set_dt_operacao(GetDataBaseTime()); aud.set_st_observacao(emp.get_st_fantasia()); aud.set_fk_generic(loj.get_identity()); if (!aud.create_LOG_Audit()) { return(false); } } } } PublishNote("Convênios atualizados para loja " + input_cont_dl.get_nu_CNPJ()); } else { PublishNote("Cadastro atualizado para loja " + input_cont_dl.get_nu_CNPJ()); } /// USER [ execute ] END Registry("execute done exec_alteraLoja "); return(true); }
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); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute fetch_comprov_Gift "); /// USER [ execute ] ArrayList lstContent = new ArrayList(); ApplicationUtil util = new ApplicationUtil(); LOG_VendaCartaoGift lvc = new LOG_VendaCartaoGift(this); T_Empresa emp = new T_Empresa(this); T_Cartao cart = new T_Cartao(this); T_Proprietario prot = new T_Proprietario(this); lvc.ExclusiveAccess(); if (!lvc.selectIdentity(input_id_gift)) { return(false); } if (!emp.selectIdentity(lvc.get_fk_empresa())) { return(false); } if (!cart.selectIdentity(lvc.get_fk_cartao())) { return(false); } if (!prot.selectIdentity(cart.get_fk_dadosProprietario())) { return(false); } if (input_tg_reimp == Context.TRUE) { lstContent.Add("Reimpressão de comprovante de venda giftcard"); lstContent.Add(""); DateTime tm = Convert.ToDateTime(lvc.get_dt_compra()); string data = "Porto Alegre, " + tm.ToLongDateString() + " - " + tm.ToLongTimeString(); lstContent.Add(data.PadLeft(80, ' ')); } else { string data = "Porto Alegre, " + DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString(); lstContent.Add(data.PadLeft(80, ' ')); } lstContent.Add(""); lstContent.Add(emp.get_st_social()); lstContent.Add("GIFTCARD LINDÓIA"); string num_cart = cart.get_st_empresa() + "." + cart.get_st_matricula() + "."; num_cart += util.calculaCodigoAcesso(cart.get_st_empresa(), cart.get_st_matricula(), cart.get_st_venctoCartao()); num_cart += "."; num_cart += cart.get_st_venctoCartao().PadLeft(4, '0'); lstContent.Add("Número do cartão: " + num_cart); string cod_trans = var_util.DESCript(cart.get_st_matricula() + DateTime.Now.Second.ToString().PadLeft(2, '0'), "66666666"); lvc.set_st_codImpresso(cod_trans); if (!lvc.synchronize_LOG_VendaCartaoGift()) { return(false); } lstContent.Add("Cod. Transação: " + cod_trans); lstContent.Add("Cpf do comprador: " + prot.get_st_cpf()); lstContent.Add("--------------------------------------------"); lstContent.Add("Valor da carga: R$ " + new money().formatToMoney(lvc.get_vr_carga())); lstContent.Add("--------------------------------------------"); LOG_VendaProdutoGift lvp = new LOG_VendaProdutoGift(this); long extras = 0; long total_extras = 0; if (lvp.select_fk_venda(input_id_gift)) { extras = lvp.RowCount(); } lstContent.Add("Extras: " + extras.ToString()); while (lvp.fetch()) { total_extras += lvp.get_int_vr_valor(); lstContent.Add("-" + lvp.get_st_produto().PadRight(25, ' ') + " R$ " + new money().formatToMoney(lvp.get_vr_valor())); } lstContent.Add("Total Extras: R$ " + new money().formatToMoney(total_extras.ToString())); total_extras += lvc.get_int_vr_carga(); lstContent.Add("Valor Total: R$ " + new money().formatToMoney(total_extras.ToString())); string formPag = "dinheiro"; if (lvc.get_tg_tipoPag() == TipoPagamento.Cheque) { formPag = "Cheque (" + lvc.get_st_cheque() + ")"; } else if (lvc.get_tg_tipoPag() == TipoPagamento.Cartao) { formPag = "Cartão (" + lvc.get_nu_nsuCartao() + ")"; } lstContent.Add("Forma de pagamento: " + formPag); lstContent.Add(""); lstContent.Add("RECEBI O CARTAO GIFTCARD LINDOIA, COMPROMETO-ME A ORIENTAR O"); lstContent.Add("PRESENTEADO QUANTO AO SEU USO E GUARDA."); lstContent.Add(""); lstContent.Add("_________________________________"); lstContent.Add(prot.get_st_nome()); lstContent.Add(""); lstContent.Add("**Caso o pagamento tenha sido efetuado em cheque, somente estará liberado o uso"); lstContent.Add("do cartão após a compensação do mesmo"); for (int t = 0; t < lstContent.Count; ++t) { DataPortable port = new DataPortable(); port.setValue("linha", lstContent[t].ToString()); output_array_generic_lst.Add(port); } { DataPortable port = new DataPortable(); port.setValue("linha", ""); output_array_generic_lst.Add(port); } { DataPortable port = new DataPortable(); port.setValue("linha", "---------------------------------------------------------------"); output_array_generic_lst.Add(port); } { DataPortable port = new DataPortable(); port.setValue("linha", ""); output_array_generic_lst.Add(port); } 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_comprov_Gift "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute exec_processaArqConvenio "); /// USER [ execute ] DataPortable csv_AllArchive = MemoryGet(input_st_id); ApplicationUtil var_util = new ApplicationUtil(); string st_ids = csv_AllArchive.getValue("ids"); Trace(st_ids); int total_records = var_util.indexCSV(st_ids); T_Empresa emp = new T_Empresa(this); if (!emp.select_rows_empresa(input_st_empresa)) { PublishError(""); return(false); } if (!emp.fetch()) { PublishError(""); return(false); } T_Cartao cart = new T_Cartao(this); T_Cartao cart_mat = new T_Cartao(this); T_Proprietario prot = new T_Proprietario(this); T_InfoAdicionais info = new T_InfoAdicionais(this); T_Dependente dep = new T_Dependente(this); LINK_ProprietarioCartao lpc = new LINK_ProprietarioCartao(this); int linha = 0; for (int t = 0; t < total_records; ++t) { linha++; DataPortable port_line = MemoryGet(var_util.getCSV(t)); string line = port_line.getValue("line"); Trace(line); int pos = 0; try { string st_mat = line.Substring(pos, 6).Trim(); pos += 6; string cpf = line.Substring(pos, 11).Trim(); pos += 11; string tit = line.Substring(pos, 2).Trim(); pos += 2; string nome = line.Substring(pos, 50).Trim(); pos += 50; string end = line.Substring(pos, 40).Trim(); pos += 40; string bairro = line.Substring(pos, 20).Trim(); pos += 20; string cep = line.Substring(pos, 8).Trim(); pos += 8; string cidade = line.Substring(pos, 20).Trim(); pos += 20; string tel = line.Substring(pos, 10).Trim(); pos += 10; string email = line.Substring(pos, 50).Trim(); pos += 50; string dt_nasc = line.Substring(pos, 8).Trim(); pos += 8; string lim_mensal = line.Substring(pos, 12).Trim().TrimStart('0').PadLeft(1, '0'); pos += 12; string lim_total = line.Substring(pos, 12).Trim().TrimStart('0').PadLeft(1, '0'); pos += 12; if (lim_total == "0") { lim_total = lim_mensal; } st_mat = st_mat.PadLeft(6, '0'); bool found = false; if (cart_mat.select_rows_empresa_matricula(input_st_empresa, st_mat)) { PublishNote("Matricula " + st_mat + " já cadastrada. Registro descartado"); continue; } if (Convert.ToInt32(tit) == 1) // titular { if (prot.select_rows_cpf(cpf)) { if (prot.fetch()) { if (cart.select_rows_prop(prot.get_identity())) { while (cart.fetch()) { if (cart.get_st_empresa() == input_st_empresa) { if (cart.get_st_titularidade() == "01") { found = true; break; } } } if (found) { continue; // descarta pois cartão já foi criado } } } // não precisa criar dadosproprietario, só o cartão desta empresa found = true; } if (!found) { // cria dados proprietario prot.Reset(); prot.set_st_nome(nome); prot.set_st_cpf(cpf); prot.set_st_endereco(end); prot.set_st_bairro(bairro); prot.set_st_cidade(cidade); prot.set_st_telefone(tel); prot.set_st_email(email); if (dt_nasc == "00000000") { dt_nasc = GetDataBaseTime(); } else { int year = Convert.ToInt32(dt_nasc.Substring(4, 4)); int month = Convert.ToInt32(dt_nasc.Substring(2, 2)); int day = Convert.ToInt32(dt_nasc.Substring(0, 2)); dt_nasc = GetDataBaseTime(new DateTime(year, month, day)); } prot.set_dt_nasc(dt_nasc); prot.create_T_Proprietario(); } info.Reset(); info.set_st_empresa(input_st_empresa); info.set_st_matricula(st_mat); info.create_T_InfoAdicionais(); cart.Reset(); cart.set_st_empresa(input_st_empresa); cart.set_st_matricula(st_mat); cart.set_st_titularidade(tit.PadLeft(2, '0')); cart.set_tg_emitido(StatusExpedicao.NaoExpedido); cart.set_fk_dadosProprietario(prot.get_identity()); cart.set_fk_infoAdicionais(info.get_identity()); cart.set_vr_limiteMensal(lim_mensal); cart.set_vr_limiteTotal(lim_total); cart.set_tg_tipoCartao("0"); cart.set_st_venctoCartao(DateTime.Now.Month.ToString().PadLeft(2, '0') + (DateTime.Now.Year + 5).ToString().Substring(2, 2)); cart.set_tg_status("0"); cart.set_nu_viaCartao("1"); cart.create_T_Cartao(); } else // dependente { // busca proprietario if (prot.select_rows_cpf(cpf)) { if (prot.fetch()) { dep.Reset(); dep.set_st_nome(nome); dep.set_nu_titularidade(tit); dep.set_fk_proprietario(prot.get_identity()); dep.create_T_Dependente(); info.Reset(); info.set_st_empresa(input_st_empresa); info.set_st_matricula(st_mat); info.create_T_InfoAdicionais(); cart.Reset(); cart.set_st_empresa(input_st_empresa); cart.set_st_titularidade(tit.PadLeft(2, '0')); cart.set_st_matricula(st_mat); cart.set_tg_emitido(StatusExpedicao.NaoExpedido); cart.set_fk_dadosProprietario(prot.get_identity()); cart.set_fk_infoAdicionais(info.get_identity()); cart.set_vr_limiteMensal(lim_mensal); cart.set_vr_limiteTotal(lim_total); cart.set_tg_tipoCartao("0"); cart.set_st_venctoCartao(DateTime.Now.Month.ToString().PadLeft(2, '0') + (DateTime.Now.Year + 5).ToString().Substring(2, 2)); cart.set_tg_status("0"); cart.set_nu_viaCartao("1"); cart.create_T_Cartao(); } } } } catch (System.Exception ex) { ex.ToString(); PublishError("Arquivo com registro inválido na linha " + linha); return(false); } } /// USER [ execute ] END Registry("execute done exec_processaArqConvenio "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute fetch_rel_listaCarts "); /// 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(); T_Cartao cart = new T_Cartao(this); T_Cartao cart_prop = new T_Cartao(this); T_Dependente dep_f = new T_Dependente(this); T_Proprietario prot = new T_Proprietario(this); ApplicationUtil util = new ApplicationUtil(); if (cart.select_rows_empresa(input_emp)) { StringBuilder sb = new StringBuilder(); while (cart.fetch()) { DataPortable port = new DataPortable(); port.setValue("cart", cart.get_st_empresa().PadLeft(6, '0') + "." + cart.get_st_matricula().PadLeft(6, '0') + "." + cart.get_st_titularidade().PadLeft(2, '0')); if (cart.get_tg_status() == CartaoStatus.Habilitado) { port.setValue("bloq", "N"); } else { port.setValue("bloq", "S"); } long dispMensal = 0, dispTotal = 0; if (cart.get_st_titularidade() != "01") { if (!dep_f.select_rows_prop_tit(cart.get_fk_dadosProprietario(), cart.get_st_titularidade())) { continue; } if (!dep_f.fetch()) { continue; } port.setValue("prop", dep_f.get_st_nome()); if (!cart_prop.select_rows_tudo(cart.get_st_empresa(), cart.get_st_matricula(), "01")) { continue; } if (!cart_prop.fetch()) { continue; } port.setValue("ltot", cart_prop.get_vr_limiteTotal()); port.setValue("lmen", cart_prop.get_vr_limiteMensal()); port.setValue("ext", cart_prop.get_vr_extraCota()); dispMensal = cart_prop.get_int_vr_limiteMensal() + cart_prop.get_int_vr_extraCota(); dispTotal = cart_prop.get_int_vr_limiteTotal() + cart_prop.get_int_vr_extraCota(); } else { if (!prot.selectIdentity(cart.get_fk_dadosProprietario())) { return(false); } port.setValue("prop", prot.get_st_nome() + " " + prot.get_st_cpf()); port.setValue("ltot", cart.get_vr_limiteTotal()); port.setValue("lmen", cart.get_vr_limiteMensal()); port.setValue("ext", cart.get_vr_extraCota()); port.setValue("end", prot.get_st_endereco() + " Num: " + prot.get_st_numero() + " Compl: " + prot.get_st_complemento()); port.setValue("cpf", "CPF: " + prot.get_st_cpf()); port.setValue("tel", "Telefone: " + prot.get_st_telefone()); port.setValue("cel", "Celular: " + cart.get_st_celCartao()); dispMensal = cart.get_int_vr_limiteMensal() + cart.get_int_vr_extraCota(); dispTotal = cart.get_int_vr_limiteTotal() + cart.get_int_vr_extraCota(); } // ## Obtem saldo disponível util.GetSaldoDisponivel(ref cart, ref dispMensal, ref dispTotal); port.setValue("dmen", dispMensal.ToString()); port.setValue("dtot", dispTotal.ToString()); port.setValue("val", cart.get_st_venctoCartao().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_listaCarts "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute exec_cotaExtraEmpresa "); /// USER [ execute ] T_Empresa emp = new T_Empresa(this); if (!emp.select_rows_empresa(input_emp.PadLeft(6, '0'))) { return(false); } if (!emp.fetch()) { return(false); } ApplicationUtil var_util = new ApplicationUtil(); T_Cartao cart = new T_Cartao(this); T_Cartao cart_upd = new T_Cartao(this); if (cart.select_rows_empresa(input_emp.PadLeft(6, '0'))) { while (cart.fetch()) { if (input_csv_excluded.Contains(cart.get_st_matricula())) { continue; } if (cart.get_tg_status() != CartaoStatus.Habilitado) { continue; } cart_upd.ExclusiveAccess(); cart_upd.selectIdentity(cart.get_identity()); cart_upd.set_vr_extraCota(input_valor); cart_upd.synchronize_T_Cartao(); cart_upd.ReleaseExclusive(); } } int tot = var_util.indexCSV(input_csv_excluded); for (int t = 0; t < tot; ++t) { cart_upd.ExclusiveAccess(); cart_upd.select_rows_empresa_matricula(input_emp.PadLeft(6, '0'), var_util.getCSV(t)); cart_upd.fetch(); cart_upd.set_vr_extraCota("0"); cart_upd.synchronize_T_Cartao(); cart_upd.ReleaseExclusive(); } PublishNote("Cota extra aplicada com sucesso!\nEstes valores serão zerados no próximo fechamento mensal."); /// USER [ execute ] END Registry("execute done exec_cotaExtraEmpresa "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute fetch_agenda "); /// USER [ execute ] LINK_Agenda l_a = new LINK_Agenda(this); // ## Busca todos os registros de agendamento if (l_a.selectAll()) { StringBuilder sb = new StringBuilder(); T_Empresa emp = new T_Empresa(this); I_Scheduler sch = new I_Scheduler(this); ApplicationUtil var_util = new ApplicationUtil(); while (l_a.fetch()) { // ## Cria container de dados DadosAgenda da = new DadosAgenda(); // ## Valida links para outras tabelas if (!emp.selectIdentity(l_a.get_fk_empresa())) { continue; } if (!sch.selectIdentity(l_a.get_fk_schedule())) { continue; } var_util.indexCSV(sch.get_st_job(), ';'); string aff = ""; string job = var_util.getCSV(0); if (sch.get_st_job().IndexOf("afiliada") > 0) { if (job == "schedule_fech_mensal") { aff = " - " + var_util.getCSV(4); } } // ## Copia dados da.set_fk_agenda(l_a.get_identity()); da.set_st_empresa(emp.get_st_empresa() + aff); da.set_st_nome_empresa(emp.get_st_fantasia()); da.set_en_atividade(l_a.get_en_atividade()); da.set_dt_ultima(sch.get_dt_last()); // ## Formata switch (sch.get_tg_type()) { #region - Monthly - case Scheduler.Monthly: { da.set_st_info("Mensal, Dia " + sch.get_nu_monthly_day() + ", Hora " + sch.get_st_monthly_hhmm().Substring(0, 2) + ":" + sch.get_st_monthly_hhmm().Substring(2, 2)); break; } #endregion #region - Weekly - case Scheduler.Weekly: { string dia = ""; switch (sch.get_st_weekly_dow()) { case "0": dia = "Domingo"; break; case "1": dia = "Segunda"; break; case "2": dia = "Terça"; break; case "3": dia = "Quarta"; break; case "4": dia = "Quinta"; break; case "5": dia = "Sexta"; break; case "6": dia = "Sábado"; break; } da.set_st_info("Semanal, Dia " + dia + ", Hora " + sch.get_st_weekly_hhmm().Substring(0, 2) + ":" + sch.get_st_weekly_hhmm().Substring(2, 2)); break; } #endregion #region - Daily - case Scheduler.Daily: { da.set_st_info("Diariamente " + sch.get_st_daily_hhmm().Substring(0, 2) + ":" + sch.get_st_daily_hhmm().Substring(2, 2)); break; } #endregion } // ## Guarda em memória DataPortable mem_rtc = da as DataPortable; sb.Append(MemorySave(ref mem_rtc)); sb.Append(","); } // ## Guarda todos os identificadores em um bloco string list_ids = sb.ToString().TrimEnd(','); DataPortable dp = new DataPortable(); dp.setValue("ids", list_ids); // ## Envia para client a identificação do bloco output_st_csv = MemorySave(ref dp); } /// USER [ execute ] END Registry("execute done fetch_agenda "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute fetch_consultaCartao "); /// USER [ execute ] // ## Filtro para busca de cartões StringBuilder sb = new StringBuilder(); T_Cartao cart = new T_Cartao(this); T_Proprietario prot = new T_Proprietario(this); T_Parcelas parc = new T_Parcelas(this); ApplicationUtil util = new ApplicationUtil(); string st_cart = input_cont_dcc.get_st_cartao(); string st_cpf = input_cont_dcc.get_st_cpf(); // ## Se for cartão especifico if (st_cart.Length > 0) { // admin ou oper if (input_cont_dcc.get_st_empresa().Length > 0) { if (!cart.select_rows_empresa_matricula(input_cont_dcc.get_st_empresa(), st_cart.PadLeft(6, '0'))) { return(true); } } else // root { if (!cart.select_rows_mat(st_cart.PadLeft(6, '0'))) { return(true); } } } // ## Se cpf ou cnpj for informado else if (st_cpf.Length > 0) { if (prot.select_rows_cpf(st_cpf)) { prot.fetch(); if (!cart.select_rows_prop(prot.get_identity())) { return(true); } } } // ## Se for de código de empresa específica else if (input_cont_dcc.get_st_empresa().Length > 0) { if (!cart.select_rows_empresa(input_cont_dcc.get_st_empresa())) { return(true); } } // ## Busca todos registros else { if (!cart.selectAll()) { return(true); } } bool nome = false, total = false, mensal = false, cotaExtra = false, cidade = false, estado = false; string st_nome = input_cont_dcc.get_st_nome().ToUpper(), st_cidade = input_cont_dcc.get_st_cidade(), st_estado = input_cont_dcc.get_st_estado(), expedido = input_cont_dcc.get_tg_expedido(); int i_total = 0, i_mensal = 0, i_cota = 0; // ## Prepara flags de filtro if (st_nome.Length > 0) { nome = true; } if (input_cont_dcc.get_vr_limTotal().Length > 0) { total = true; } if (input_cont_dcc.get_vr_limMensal().Length > 0) { mensal = true; } if (input_cont_dcc.get_vr_cotaExtra().Length > 0) { cotaExtra = true; } if (st_cidade.Length > 0) { cidade = true; } if (st_estado.Length > 0) { estado = true; } // ## Obtem valores rápidos para comparação if (total) { i_total = Convert.ToInt32(input_cont_dcc.get_vr_limTotal()); } if (mensal) { i_mensal = Convert.ToInt32(input_cont_dcc.get_vr_limMensal()); } if (cotaExtra) { i_cota = Convert.ToInt32(input_cont_dcc.get_vr_cotaExtra()); } // ## Busca todos os registros selecionados bool todos = false; bool hab = false; bool bloq = false; bool canc = false; bool adminGift = false; if (input_cont_dcc.get_tg_bloqueado() == "3") // todos { todos = true; } else { if (input_cont_dcc.get_tg_bloqueado() == Context.FALSE) // 0 { hab = true; } else if (input_cont_dcc.get_tg_bloqueado() == Context.TRUE) // 1 { bloq = true; } else { canc = true; // 2 } } if (input_cont_header.get_tg_user_type() == TipoUsuario.AdminGift) { adminGift = false; } T_Dependente dep_f = new T_Dependente(this); T_Cartao cart_prop = new T_Cartao(this); while (cart.fetch()) { string dep = ""; if (cart.get_tg_emitido() != expedido) { continue; } if (adminGift) { if (cart.get_fk_dadosProprietario() == "0") { continue; } } if (!todos) { if (bloq) { if (cart.get_tg_status() != CartaoStatus.Bloqueado) { continue; } } else if (canc) { if (cart.get_tg_status() != CartaoStatus.Bloqueado) { continue; } if (cart.get_tg_status() == CartaoStatus.Bloqueado && cart.get_tg_motivoBloqueio() != MotivoBloqueio.CANCELAMENTO) { continue; } } else if (hab) { if (cart.get_tg_status() != CartaoStatus.Habilitado) { continue; } } } if (total) { if (cart.get_int_vr_limiteTotal() < i_total) { continue; } } if (mensal) { if (cart.get_int_vr_limiteMensal() < i_mensal) { continue; } } if (cotaExtra) { if (cart.get_int_vr_extraCota() < i_cota) { continue; } } if (cart.get_fk_dadosProprietario() != Context.NONE) { if (!prot.selectIdentity(cart.get_fk_dadosProprietario())) { return(false); } } if (cidade) { if (!prot.get_st_cidade().Contains(st_cidade)) { continue; } } if (estado) { if (!prot.get_st_UF().Contains(st_estado)) { continue; } } if (cart.get_st_titularidade() != "01") { if (!dep_f.select_rows_prop_tit(cart.get_fk_dadosProprietario(), cart.get_st_titularidade())) { continue; } if (!dep_f.fetch()) { continue; } dep = dep_f.get_st_nome().ToUpper(); // Dependente if (nome) { if (!dep.Contains(st_nome)) { continue; } } } else { if (nome) { if (!prot.get_st_nome().ToUpper().Contains(st_nome)) { continue; } } } DadosCartao dc = new DadosCartao(); dc.set_st_empresa(cart.get_st_empresa()); dc.set_st_matricula(cart.get_st_matricula()); dc.set_st_titularidade(cart.get_st_titularidade() + ":" + cart.get_nu_viaCartao()); if (cart.get_fk_dadosProprietario() != Context.NONE) { if (dep.Length > 0) { dc.set_st_proprietario(dep); } else { dc.set_st_proprietario(prot.get_st_nome()); } dc.set_st_cpf(prot.get_st_cpf()); } dc.set_tg_status(cart.get_tg_status()); if (cart.get_tg_tipoCartao() == TipoCartao.presente) { dc.set_vr_limiteTotal("0"); dc.set_vr_limiteMensal("0"); dc.set_vr_extraCota("0"); dc.set_vr_dispMes("0"); dc.set_vr_dispTotal(cart.get_vr_limiteTotal()); } else { long dispMensal = 0, dispTotal = 0; if (cart.get_st_titularidade() != "01") { if (!cart_prop.select_rows_tudo(cart.get_st_empresa(), cart.get_st_matricula(), "01")) { continue; } if (!cart_prop.fetch()) { continue; } dc.set_vr_limiteTotal(cart_prop.get_vr_limiteTotal()); dc.set_vr_limiteMensal(cart_prop.get_vr_limiteMensal()); dc.set_vr_extraCota(cart_prop.get_vr_extraCota()); dispMensal = cart_prop.get_int_vr_limiteMensal() + cart_prop.get_int_vr_extraCota(); dispTotal = cart_prop.get_int_vr_limiteTotal() + cart_prop.get_int_vr_extraCota(); } else { dc.set_vr_limiteTotal(cart.get_vr_limiteTotal()); dc.set_vr_limiteMensal(cart.get_vr_limiteMensal()); dc.set_vr_extraCota(cart.get_vr_extraCota()); dispMensal = cart.get_int_vr_limiteMensal() + cart.get_int_vr_extraCota(); dispTotal = cart.get_int_vr_limiteTotal() + cart.get_int_vr_extraCota(); } // ## Obtem saldo disponível util.GetSaldoDisponivel(ref cart, ref dispMensal, ref dispTotal); dc.set_vr_dispMes(dispMensal.ToString()); dc.set_vr_dispTotal(dispTotal.ToString()); } DataPortable tmp = dc as DataPortable; // ## obtem identificador 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); // ## Copia para saida um identificador de bloco output_st_csv_cartao = MemorySave(ref dp); /// USER [ execute ] END Registry("execute done fetch_consultaCartao "); return(true); }
public override bool execute( ) { Registry("execute fetch_extratoWeb "); /// USER [ execute ] T_Cartao cart = new T_Cartao(this); T_Cartao cart_all = new T_Cartao(this); T_Cartao cart_search = new T_Cartao(this); string emp = input_st_cartao.Substring(0, 6); string mat = input_st_cartao.Substring(6, 6); if (!cart.select_rows_tudo(emp, mat, 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); } ArrayList lst_all_carts = new ArrayList(); if (cart_all.select_rows_empresa_matricula(emp, mat)) { while (cart_all.fetch()) { lst_all_carts.Add(cart_all.get_identity()); } } string mes = input_st_cartao.Substring(14, 2); string ano = input_st_cartao.Substring(16, 4); LOG_Transacoes l_tr = new LOG_Transacoes(this); T_Loja loj = new T_Loja(this); T_Parcelas parc = new T_Parcelas(this); T_Dependente dep = new T_Dependente(this); T_Proprietario prot = new T_Proprietario(this); StringBuilder sb_parcs = new StringBuilder(); LOG_Fechamento lf = new LOG_Fechamento(this); if (lf.select_rows_mes_ano_carts(mes, ano, ref lst_all_carts)) { while (lf.fetch()) { if (!loj.selectIdentity(lf.get_fk_loja())) { continue; } if (!parc.selectIdentity(lf.get_fk_parcela())) { continue; } if (!parc.fetch()) { continue; } string nome = ""; if (!cart_search.selectIdentity(lf.get_fk_cartao())) { continue; } if (cart_search.get_st_titularidade() == "01") { if (!prot.selectIdentity(cart_search.get_fk_dadosProprietario())) { continue; } nome = prot.get_st_nome(); } else { if (!dep.select_rows_prop_tit(cart_search.get_fk_dadosProprietario(), cart_search.get_st_titularidade())) { continue; } if (!dep.fetch()) { continue; } nome = dep.get_st_nome(); } if (parc.get_vr_valor() == "0") { continue; } Rel_RTC rtc = new Rel_RTC(); rtc.set_dt_trans(parc.get_dt_inclusao()); rtc.set_st_loja(loj.get_st_nome()); rtc.set_st_nsu(parc.get_nu_nsu()); rtc.set_vr_total(parc.get_vr_valor()); rtc.set_st_indice_parcela(parc.get_nu_indice()); rtc.set_st_term(parc.get_nu_tot_parcelas()); rtc.set_en_op_cartao(nome); DataPortable mem_rtc = rtc as DataPortable; // ## obtem indice sb_parcs.Append(MemorySave(ref mem_rtc)); sb_parcs.Append(","); } } else // presente e futuro { DateTime dt_target = new DateTime(Convert.ToInt32(ano), Convert.ToInt32(mes), 1); DateTime dt_it = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); int my_parc = 1; while (dt_it < dt_target) { my_parc++; dt_it = dt_it.AddMonths(1); } if (parc.select_rows_cartao(ref lst_all_carts, my_parc.ToString())) { while (parc.fetch()) { if (!loj.selectIdentity(parc.get_fk_loja())) { continue; } string nome = ""; if (!cart_search.selectIdentity(parc.get_fk_cartao())) { continue; } if (cart_search.get_st_titularidade() == "01") { if (!prot.selectIdentity(cart_search.get_fk_dadosProprietario())) { continue; } nome = prot.get_st_nome(); } else { if (!dep.select_rows_prop_tit(cart_search.get_fk_dadosProprietario(), cart_search.get_st_titularidade())) { continue; } if (!dep.fetch()) { continue; } nome = dep.get_st_nome(); } Rel_RTC rtc = new Rel_RTC(); rtc.set_dt_trans(parc.get_dt_inclusao()); rtc.set_st_loja(loj.get_st_nome()); rtc.set_st_nsu(parc.get_nu_nsu()); rtc.set_vr_total(parc.get_vr_valor()); rtc.set_st_indice_parcela(parc.get_nu_indice()); rtc.set_st_term(parc.get_nu_tot_parcelas()); rtc.set_en_op_cartao(nome); 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); ApplicationUtil var_util = new ApplicationUtil(); long dispMensal = cart.get_int_vr_limiteMensal() + cart.get_int_vr_extraCota(), dispTotal = cart.get_int_vr_limiteTotal() + cart.get_int_vr_extraCota(); var_util.GetSaldoDisponivel(ref cart, ref dispMensal, ref dispTotal); output_vr_disp = dispMensal.ToString(); output_vr_lim = (cart.get_int_vr_limiteMensal() + cart.get_int_vr_extraCota()).ToString(); /// USER [ execute ] END Registry("execute done fetch_extratoWeb "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute ins_loja "); /// USER [ execute ] if (loj.select_rows_loja(input_cont_dl.get_st_loja())) { PublishError("Loja " + input_cont_dl.get_st_loja() + " previamente cadastrada"); return(false); } loj.set_st_loja(input_cont_dl.get_st_loja()); loj.set_nu_CNPJ(input_cont_dl.get_nu_CNPJ()); loj.set_st_nome(input_cont_dl.get_st_nome()); loj.set_st_social(input_cont_dl.get_st_social()); loj.set_st_endereco(input_cont_dl.get_st_endereco()); loj.set_st_enderecoInst(input_cont_dl.get_st_enderecoInst()); loj.set_nu_inscEst(input_cont_dl.get_nu_inscEst()); loj.set_st_cidade(input_cont_dl.get_st_cidade()); loj.set_st_estado(input_cont_dl.get_st_estado()); loj.set_nu_CEP(input_cont_dl.get_nu_CEP()); loj.set_nu_telefone(input_cont_dl.get_nu_telefone()); loj.set_nu_fax(input_cont_dl.get_nu_fax()); loj.set_st_contato(input_cont_dl.get_st_contato()); loj.set_vr_mensalidade(input_cont_dl.get_vr_mensalidade()); loj.set_nu_contaDeb(input_cont_dl.get_nu_contaDeb()); loj.set_st_obs(input_cont_dl.get_st_obs()); loj.set_tg_blocked(Context.FALSE); loj.set_vr_mensalidade(input_cont_dl.get_vr_mensalidade()); loj.set_nu_pctValor(input_cont_dl.get_nu_pctValor()); loj.set_vr_transacao(input_cont_dl.get_vr_transacao()); loj.set_vr_minimo(input_cont_dl.get_vr_minimo()); loj.set_nu_franquia(input_cont_dl.get_nu_franquia()); loj.set_nu_periodoFat(input_cont_dl.get_nu_periodoFat()); loj.set_nu_diavenc(input_cont_dl.get_nu_diavenc()); loj.set_tg_tipoCobranca(input_cont_dl.get_tg_tipoCobranca()); loj.set_nu_bancoFat(input_cont_dl.get_nu_bancoFat()); loj.set_tg_isentoFat(input_cont_dl.get_tg_isento()); loj.set_st_senha(input_cont_dl.get_st_senhaWeb()); if (!loj.create_T_Loja()) { return(false); } LINK_LojaEmpresa loj_emp = new LINK_LojaEmpresa(this); T_Empresa emp = new T_Empresa(this); ApplicationUtil util_taxa = new ApplicationUtil(); ApplicationUtil util_repasse = new ApplicationUtil(); util_taxa.indexCSV(input_st_csv_taxas); util_repasse.indexCSV(input_st_csv_dias); for (int t = 0; t < var_util.indexCSV(input_st_csv_empresas); ++t) { string empresa = var_util.getCSV(t); if (!emp.select_rows_empresa(empresa)) { return(false); } if (!emp.fetch()) { return(false); } loj_emp.set_fk_empresa(emp.get_identity()); loj_emp.set_fk_loja(loj.get_identity()); loj_emp.set_tx_admin(util_taxa.getCSV(t)); loj_emp.set_nu_dias_repasse(util_repasse.getCSV(t)); if (!loj_emp.create_LINK_LojaEmpresa()) { return(false); } } PublishNote("Loja " + input_cont_dl.get_st_nome() + " (" + input_cont_dl.get_nu_CNPJ() + ") cadastrada com sucesso"); /// USER [ execute ] END Registry("execute done ins_loja "); return(true); }