public void copy(ref T_RetCobranca cpy)
 {
     nu_codBanco = cpy.nu_codBanco;
     nu_cod      = cpy.nu_cod;
     tg_tipoCob  = cpy.tg_tipoCob;
     st_codMsg   = cpy.st_codMsg;
 }
Beispiel #2
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);
        }