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 exec_fat_recManual "); /// USER [ execute ] T_Empresa emp = new T_Empresa(this); T_Loja loj = new T_Loja(this); if (input_tg_empresa == Context.TRUE) { if (!emp.select_rows_empresa(input_st_codigo.PadLeft(6, '0'))) { PublishError("Empresa não disponível"); return(false); } if (!emp.fetch()) { return(false); } } else { if (!loj.select_rows_loja(input_st_codigo)) { PublishError("Loja não disponível"); return(false); } if (!loj.fetch()) { return(false); } } T_Faturamento fat = new T_Faturamento(this); T_Faturamento fat_upd = new T_Faturamento(this); if (input_tg_empresa == Context.TRUE) { fat.select_rows_emp(emp.get_identity()); } else { fat.select_rows_loj(loj.get_identity()); } while (fat.fetch()) { if (fat.get_tg_situacao() == TipoSitFat.EmCobrança) { fat_upd.ExclusiveAccess(); if (!fat_upd.selectIdentity(fat.get_identity())) { return(false); } fat_upd.set_tg_situacao(TipoSitFat.PagoOutros); fat_upd.set_vr_cobranca(input_vr_valor); if (!fat_upd.synchronize_T_Faturamento()) { return(false); } fat_upd.ReleaseExclusive(); PublishNote("Faturamento atualizado com sucesso"); break; } } /// USER [ execute ] END Registry("execute done exec_fat_recManual "); return(true); }
public override bool execute( ) { if (base.execute() == false) { return(false); } Registry("execute fetch_dadosDespesas "); /// USER [ execute ] string fk = ""; if (input_tg_empresa == Context.TRUE) { T_Empresa emp = new T_Empresa(this); if (!emp.select_rows_empresa(input_st_codigo.PadLeft(6, '0'))) { PublishError("Código de empresa inválido"); return(false); } if (!emp.fetch()) { return(false); } fk = emp.get_identity(); output_st_nome = emp.get_st_fantasia(); } else { T_Loja loj = new T_Loja(this); if (!loj.select_rows_loja(input_st_codigo)) { PublishError("Código de loja inválido"); return(false); } if (!loj.fetch()) { return(false); } fk = loj.get_identity(); output_st_nome = loj.get_st_nome(); } T_FaturamentoDetalhes fat_det = new T_FaturamentoDetalhes(this); if (input_tg_empresa == Context.TRUE) { if (!fat_det.select_rows_emp(fk, TipoFat.Extras)) { PublishError("Nenhuma despesa encontrada"); return(false); } } else { if (!fat_det.select_rows_loja(fk, TipoFat.Extras)) { PublishError("Nenhuma despesa encontrada"); return(false); } } T_Faturamento fat = new T_Faturamento(this); while (fat_det.fetch()) { if (fat.selectIdentity(fat_det.get_fk_fatura())) { if (fat.get_tg_situacao() != TipoSitFat.Pendente) { continue; } } DadosDespesas dd = new DadosDespesas(); dd.set_fk_faturadet(fat_det.get_identity()); dd.set_st_info(fat_det.get_st_extras()); if (fat_det.get_tg_desconto() == Context.TRUE) { dd.set_vr_cobrança("-" + fat_det.get_vr_cobranca()); } else { dd.set_vr_cobrança(fat_det.get_vr_cobranca()); } output_array_generic_list.Add(dd); } /// USER [ execute ] END Registry("execute done fetch_dadosDespesas "); return(true); }
public override bool authenticate( ) { if (base.authenticate() == false) { return(false); } Registry("authenticate fetch_dadosFaturamento "); /// USER [ authenticate ] T_Faturamento fat = new T_Faturamento(this); T_FaturamentoDetalhes fat_det = new T_FaturamentoDetalhes(this); T_Empresa emp = new T_Empresa(this); T_Loja loj = new T_Loja(this); money mon = new money(); string ident = ""; if (input_tg_empresa == Context.TRUE) { if (!emp.select_rows_empresa(input_st_codigo.PadLeft(6, '0'))) { PublishError("Empresa não existente"); return(false); } if (!emp.fetch()) { return(false); } output_st_msg += emp.get_st_social() + "@"; output_st_msg += emp.get_st_fantasia() + "@"; output_st_msg += emp.get_nu_CNPJ() + "@"; output_st_msg += emp.get_nu_telefone() + "@"; output_st_msg += "@Faturamento pendente: @@"; fat.SetReversedFetch(); if (!fat.select_rows_emp(emp.get_identity())) { PublishError("Nenhum faturamento encontrado"); return(false); } ident = emp.get_st_fantasia(); } else { if (!loj.select_rows_loja(input_st_codigo)) { PublishError("Loja não existente"); return(false); } if (!loj.fetch()) { return(false); } output_st_msg += loj.get_st_nome() + "@"; output_st_msg += loj.get_st_social() + "@"; output_st_msg += loj.get_nu_CNPJ() + "@"; output_st_msg += loj.get_nu_telefone(); //fat.SetReversedFetch(); if (!fat.select_rows_loj(loj.get_identity())) { PublishError("Nenhum faturamento encontrado"); return(false); } } bool Found = false; long tot_cob = 0; while (fat.fetch()) { if (fat.get_tg_situacao() == TipoSitFat.Pendente) { output_st_msg += "@@Faturamento pendente: "; Found = true; } else if (fat.get_tg_situacao() == TipoSitFat.EmCobrança) { output_st_msg += "@@Faturamento em cobrança: "; Found = true; } else { continue; } output_st_msg += var_util.getDDMMYYYY_format(fat.get_dt_vencimento()).Substring(0, 10) + "@"; output_st_msg += "@Total: R$ " + mon.formatToMoney(fat.get_vr_cobranca()) + "@"; tot_cob += fat.get_int_vr_cobranca(); if (!fat_det.select_fk_fat(fat.get_identity())) { PublishNote("Nenhum faturamento encontrado"); } output_st_msg += "@------ Detalhes ------- @"; while (fat_det.fetch()) { switch (fat_det.get_tg_tipoFat()) { case TipoFat.TBM: { output_st_msg += "@Tarifa básica mensal: ".PadRight(33, ' ') + "R$ " + mon.formatToMoney(fat_det.get_vr_cobranca()).PadLeft(7, ' '); break; } case TipoFat.CartaoAtiv: { output_st_msg += "@Tarifa por cartões ativos: ".PadRight(33, ' ') + "R$ " + mon.formatToMoney(fat_det.get_vr_cobranca()).PadLeft(7, ' '); break; } case TipoFat.FixoTrans: { output_st_msg += "@Valor sobre Transações: ".PadRight(33, ' ') + "R$ " + mon.formatToMoney(fat_det.get_vr_cobranca()).PadLeft(7, ' '); break; } case TipoFat.Percent: { output_st_msg += "@Percentual sobre Transações: ".PadRight(33, ' ') + "R$ " + mon.formatToMoney(fat_det.get_vr_cobranca()).PadLeft(7, ' '); break; } } } if (!fat_det.select_fk_fat(fat.get_identity())) { PublishError("Nenhum faturamento encontrado"); return(false); } while (fat_det.fetch()) { switch (fat_det.get_tg_tipoFat()) { case TipoFat.Extras: { output_st_msg += "@@------ Extras ------- @"; output_st_msg += "@" + fat_det.get_st_extras().PadRight(32, ' ') + "R$ " + mon.formatToMoney(fat_det.get_vr_cobranca()).PadLeft(7, ' '); break; } } } } if (!Found) { output_st_msg += "@ - Nenhum débito pendente ou em cobrança - @"; } else { output_st_msg += "@@@# Valor completo devido: R$ " + new money().setMoneyFormat(tot_cob) + "@"; } output_vr_valor = tot_cob.ToString(); if (input_tg_empresa == Context.TRUE) { fat_det.select_rows_emp(emp.get_identity(), TipoFat.Extras); } else { fat_det.select_rows_loja(loj.get_identity(), TipoFat.Extras); } if (fat_det.RowCount() > 0) { output_st_msg += "@@------ Lançamentos futuros ------- @"; while (fat_det.fetch()) { output_st_msg += "@" + fat_det.get_st_extras().PadRight(32, ' ') + "R$ " + mon.formatToMoney(fat_det.get_vr_cobranca()).PadLeft(7, ' '); } if (Found) { output_st_msg += "@@"; } } /// USER [ authenticate ] END Registry("authenticate done fetch_dadosFaturamento "); return(true); }