public static function generateRENDA($block_renda)
 {
     $rdpc = TextBuilder_ES::getVariaveis_table(TextBuilder_ES::$idMunicipio, "RDPC");
     //RDPC
     $pind = TextBuilder_ES::getVariaveis_table(TextBuilder_ES::$idMunicipio, "PIND");
     //PIND
     $pop = TextBuilder_ES::getVariaveis_table(TextBuilder_ES::$idMunicipio, "POP");
     //POP
     $gini = TextBuilder_ES::getVariaveis_table(TextBuilder_ES::$idMunicipio, "GINI");
     //GINI
     if (TextBuilder_ES::$print) {
         $block_renda->setData("quebra", "<div style='page-break-after: always'></div>");
     } else {
         $block_renda->setData("quebra", "");
     }
     $block_renda->setData("fonte", TextBuilder_ES::$fontePerfil);
     $block_renda->setData("titulo", "Ingresos");
     //@Translate
     $block_renda->setData("subtitulo", "");
     $block_renda->setData("info", "");
     //@Translate
     $str = "El ingreso per cápita promedio de [municipio] [caiu_cresceu] un [tx_cresc_renda]% en las dos últimas décadas,\n            tras pasar de R\$[renda91] en 1991 a R\$[renda00] en el 2000 y a R\$[renda10] en 2010. La tasa anual promedio de crecimiento se situó en un \n            [tx_cresc_renda9100]% en el primer período y en un [tx_cresc_renda0010]% en el segundo. La pobreza extrema (medida de acuerdo con la proporción de personas con ingreso familiar per cápita inferior a 70,00 R\$ en reales de agosto de 2010) pasó de un \n            [tx_pobreza_91]% en 1991 a un [tx_pobreza_00]%\n            en el 2000 y a un [tx_pobreza_10]% en 2010.\n            <br><br>La desigualdad [diminuiu_aumentou]: el Índice de Gini pasó de \n            [gini_91] en 1991 a [gini_00] en el 2000 y a [gini_10] en 2010. \n            ";
     $texto = new Texto($str);
     $texto->replaceTags("municipio", TextBuilder_ES::$nomeMunicipio);
     //TODO: Tirar o igual da comparação (feito pq a base não é oficial e há replicações
     if (Formulas::getRenda10puro($rdpc) >= Formulas::getRenda91puro($rdpc)) {
         $texto->replaceTags("caiu_cresceu", "aumentó");
     } else {
         if (Formulas::getRenda10puro($rdpc) < Formulas::getRenda91puro($rdpc)) {
             $texto->replaceTags("caiu_cresceu", "disminuyó");
         }
     }
     //@Translate
     $texto->replaceTags("tx_cresc_renda", Formulas::getTxCrescRenda($rdpc));
     $texto->replaceTags("renda91", Formulas::getRenda91($rdpc));
     $texto->replaceTags("renda00", Formulas::getRenda00($rdpc));
     $texto->replaceTags("renda10", Formulas::getRenda10($rdpc));
     $texto->replaceTags("tx_cresc_renda9100", Formulas::getTxCrescRenda9100($rdpc));
     $texto->replaceTags("tx_cresc_renda0010", Formulas::getTxCrescRenda0010($rdpc));
     $texto->replaceTags("tx_pobreza_91", Formulas::getTxPobreza91($pind));
     $texto->replaceTags("tx_pobreza_00", Formulas::getTxPobreza00($pind));
     $texto->replaceTags("tx_pobreza_10", Formulas::getTxPobreza10($pind));
     //$texto->replaceTags("red_extrema_pobreza", str_replace(".",",",number_format((( ($pind[0]["valor"] * $pop[0]["valor"]) - ($pind[2]["valor"] * $pop[2]["valor"]) ) / ($pind[0]["valor"] * $pop[0]["valor"])) * 100, 2)));
     if (Formulas::getGini10puro($gini) < Formulas::getGini91puro($gini)) {
         $texto->replaceTags("diminuiu_aumentou", "disminuyó");
     } else {
         if (Formulas::getGini10puro($gini) == Formulas::getGini91puro($gini)) {
             $texto->replaceTags("diminuiu_aumentou", "permanecido");
         } else {
             if (Formulas::getGini10puro($gini) > Formulas::getGini91puro($gini)) {
                 $texto->replaceTags("diminuiu_aumentou", "aumentó");
             }
         }
     }
     //@Translate
     $texto->replaceTags("gini_91", Formulas::getGini91($gini));
     $texto->replaceTags("gini_00", Formulas::getGini00($gini));
     $texto->replaceTags("gini_10", Formulas::getGini10($gini));
     $block_renda->setData("text", $texto->getTexto());
     //@Translate
     $block_renda->setData("block_box1", "<br><b>¿Qué es el Índice de Gini?</b><br>\n            Es un instrumento para medir <br>\n            el grado de concentración de los ingresos <br>\n            en función de la diferencia entre los ingresos <br>\n            de los más pobres y de los más ricos. <br>\n            Se trata de un valor que varía de entre 0 y 1,<br>\n            donde 0 representa una situación de igualdad total,<br>\n            es decir, donde todos perciben los mismos ingresos,<br>\n            y el valor 1 refleja una desigualdad total,<br>\n            a saber, en que una sola persona percibe <br>\n            todos los ingresos del lugar.");
     // GRAFICO
     $block_renda->setData("tableContent", "");
     $block_renda->setData("tableContent2", "");
 }
 public static function generateRENDA($block_renda)
 {
     $rdpc = TextBuilder_EN::getVariaveis_table(TextBuilder_EN::$idMunicipio, "RDPC");
     //RDPC
     $pind = TextBuilder_EN::getVariaveis_table(TextBuilder_EN::$idMunicipio, "PIND");
     //PIND
     $pop = TextBuilder_EN::getVariaveis_table(TextBuilder_EN::$idMunicipio, "POP");
     //POP
     $gini = TextBuilder_EN::getVariaveis_table(TextBuilder_EN::$idMunicipio, "GINI");
     //GINI
     if (TextBuilder_EN::$print) {
         $block_renda->setData("quebra", "<div style='page-break-after: always'></div>");
     } else {
         $block_renda->setData("quebra", "");
     }
     $block_renda->setData("fonte", TextBuilder_EN::$fontePerfil);
     $block_renda->setData("titulo", "Income");
     //@Translate
     $block_renda->setData("subtitulo", "");
     $block_renda->setData("info", "");
     //@Translate
     $str = "During the last two decades, the average income per capita of [municipio] [caiu_cresceu] [tx_cresc_renda]%,\n            from R\$[renda91], in 1991, to R\$[renda00] in 2000 and R\$[renda10] in 2010.\n            In the first period the average annual growth rate was\n            [tx_cresc_renda9100]% and, in the second period, [tx_cresc_renda0010]%.\n            Extreme poverty (as measured by the proportion of people with income per capita below R\$ 70,00 in August 2010) went from\n            [tx_pobreza_91]% in 1991 to [tx_pobreza_00]%\n            in 2000 and to [tx_pobreza_10]%  in 2010.\n            <br><br>The inequality [diminuiu_aumentou]: the Gini coefficient rose from [gini_91]\n            in 1991 to [gini_00] in 2000 and to [gini_10] in 2010. \n            ";
     $texto = new Texto($str);
     $texto->replaceTags("municipio", TextBuilder_EN::$nomeMunicipio);
     //TODO: Tirar o igual da comparação (feito pq a base não é oficial e há replicações
     if (Formulas::getRenda10puro($rdpc) >= Formulas::getRenda91puro($rdpc)) {
         $texto->replaceTags("caiu_cresceu", "grew");
     } else {
         if (Formulas::getRenda10puro($rdpc) < Formulas::getRenda91puro($rdpc)) {
             $texto->replaceTags("caiu_cresceu", "fell");
         }
     }
     //@Translate
     $texto->replaceTags("tx_cresc_renda", Formulas::getTxCrescRenda($rdpc));
     $texto->replaceTags("renda91", Formulas::getRenda91($rdpc));
     $texto->replaceTags("renda00", Formulas::getRenda00($rdpc));
     $texto->replaceTags("renda10", Formulas::getRenda10($rdpc));
     $texto->replaceTags("tx_cresc_renda9100", Formulas::getTxCrescRenda9100($rdpc));
     $texto->replaceTags("tx_cresc_renda0010", Formulas::getTxCrescRenda0010($rdpc));
     $texto->replaceTags("tx_pobreza_91", Formulas::getTxPobreza91($pind));
     $texto->replaceTags("tx_pobreza_00", Formulas::getTxPobreza00($pind));
     $texto->replaceTags("tx_pobreza_10", Formulas::getTxPobreza10($pind));
     //$texto->replaceTags("red_extrema_pobreza", str_replace(".",",",number_format((( ($pind[0]["valor"] * $pop[0]["valor"]) - ($pind[2]["valor"] * $pop[2]["valor"]) ) / ($pind[0]["valor"] * $pop[0]["valor"])) * 100, 2)));
     if (Formulas::getGini10puro($gini) < Formulas::getGini91puro($gini)) {
         $texto->replaceTags("diminuiu_aumentou", "decreased");
     } else {
         if (Formulas::getGini10puro($gini) == Formulas::getGini91puro($gini)) {
             $texto->replaceTags("diminuiu_aumentou", "remained");
         } else {
             if (Formulas::getGini10puro($gini) > Formulas::getGini91puro($gini)) {
                 $texto->replaceTags("diminuiu_aumentou", "increased");
             }
         }
     }
     //@Translate
     $texto->replaceTags("gini_91", Formulas::getGini91($gini));
     $texto->replaceTags("gini_00", Formulas::getGini00($gini));
     $texto->replaceTags("gini_10", Formulas::getGini10($gini));
     $block_renda->setData("text", $texto->getTexto());
     //@Translate
     $block_renda->setData("block_box1", "<br><b>What is the Gini Index?</b><br>\n            The Gini index is an instrument used<br>\n            to measure the degree of income concentration.<br>\n            It points out the difference <br>\n            between the poorest and richest incomes. <br>\n            Numerically, it varies from 0 to 1, <br>\n            with 0 representing a situation of  <br>\n            complete equality or everyone having <br>\n            the same income. The value of 1 means <br>\n            complete income inequality, or a situation <br>\n            where only one person holds all <br>\n            the income in a given place. ");
     // GRAFICO
     $block_renda->setData("tableContent", "");
     $block_renda->setData("tableContent2", "");
 }
 public static function generateRENDA($block_renda)
 {
     $rdpc = TextBuilder::getVariaveis_table(TextBuilder::$idMunicipio, "RDPC");
     //RDPC
     $pind = TextBuilder::getVariaveis_table(TextBuilder::$idMunicipio, "PIND");
     //PIND
     $pop = TextBuilder::getVariaveis_table(TextBuilder::$idMunicipio, "POP");
     //POP
     $gini = TextBuilder::getVariaveis_table(TextBuilder::$idMunicipio, "GINI");
     //GINI
     $pmpob = TextBuilder::getVariaveis_table(TextBuilder::$idMunicipio, "PMPOB");
     //GINI
     if (TextBuilder::$print) {
         $block_renda->setData("quebra", "<div style='page-break-after: always'></div>");
     } else {
         $block_renda->setData("quebra", "");
     }
     $block_renda->setData("fonte", TextBuilder::$fontePerfil);
     $block_renda->setData("titulo", TextBuilder::$aba->getTitulo());
     //@Translate
     $block_renda->setData("subtitulo", "");
     $block_renda->setData("info", "");
     //@Translate
     $str = TextBuilder::$aba->getTexto();
     $texto = new Texto($str);
     $texto->replaceTags("municipio", TextBuilder::$nomeMunicipio);
     //TODO: Tirar o igual da comparação (feito pq a base não é oficial e há replicações
     if (Formulas::getRenda10puro($rdpc) >= Formulas::getRenda91puro($rdpc)) {
         $texto->replaceTags("caiu_cresceu", TextBuilder::$aba->getCresceu());
     } else {
         if (Formulas::getRenda10puro($rdpc) < Formulas::getRenda91puro($rdpc)) {
             $texto->replaceTags("caiu_cresceu", TextBuilder::$aba->getCaiu());
         }
     }
     //@Translate
     //@NãoInclusoEmRM&UDH
     if (TextBuilder::$type != "perfil_rm" && TextBuilder::$type != "perfil_udh") {
         //$texto->replaceTags("tx_cresc_renda", Formulas::getTxCrescRenda($rdpc));
         $texto->replaceTags("tx_cresc_renda_9110", Formulas::getTxCrescRenda9110($rdpc));
         $texto->replaceTags("tx_media_anual_cresc_renda9110_1por19", Formulas::getTxMediaAnualCrescRenda9110_1por19($rdpc));
         $texto->replaceTags("tx_media_anual_cresc_renda0010_1por9", Formulas::getTxMediaAnualCrescRenda9100_1por9($rdpc));
         $texto->replaceTags("tx_media_anual_cresc_renda0010", Formulas::getTxMediaAnualCrescRenda0010($rdpc));
         //$texto->replaceTags("tx_cresc_renda", Formulas::getTxCrescRenda($rdpc));
         $texto->replaceTags("renda91", Formulas::getRenda91($rdpc));
         $texto->replaceTags("tx_cresc_renda9100", Formulas::getTxCrescRenda9100($rdpc));
         $texto->replaceTags("pmpob_91", Formulas::getProporcaoPobres91($pmpob));
         $texto->replaceTags("tx_pobreza_91", Formulas::getTxPobreza91($pind));
         $texto->replaceTags("gini_91", Formulas::getGini91($gini));
         if (Formulas::getGini10puro($gini) < Formulas::getGini91puro($gini)) {
             $texto->replaceTags("diminuiu_aumentou", TextBuilder::$aba->getDiminuiu());
         } else {
             if (Formulas::getGini10puro($gini) == Formulas::getGini91puro($gini)) {
                 $texto->replaceTags("diminuiu_aumentou", TextBuilder::$aba->getManteve());
             } else {
                 if (Formulas::getGini10puro($gini) > Formulas::getGini91puro($gini)) {
                     $texto->replaceTags("diminuiu_aumentou", TextBuilder::$aba->getAumentou());
                 }
             }
         }
         //@Translate
     }
     $texto->replaceTags("gini_00", Formulas::getGini00($gini));
     $texto->replaceTags("gini_10", Formulas::getGini10($gini));
     $texto->replaceTags("renda00", Formulas::getRenda00($rdpc));
     $texto->replaceTags("renda10", Formulas::getRenda10($rdpc));
     $texto->replaceTags("tx_cresc_renda0010", Formulas::getTxCrescRenda0010($rdpc));
     $texto->replaceTags("tx_media_anual_cresc_renda0010", Formulas::getTxMediaAnualCrescRenda0010($rdpc));
     $texto->replaceTags("pmpob_00", Formulas::getProporcaoPobres00($pmpob));
     $texto->replaceTags("pmpob_10", Formulas::getProporcaoPobres10($pmpob));
     $texto->replaceTags("tx_pobreza_00", Formulas::getTxPobreza00($pind));
     $texto->replaceTags("tx_pobreza_10", Formulas::getTxPobreza10($pind));
     //$texto->replaceTags("red_extrema_pobreza", str_replace(".",",",number_format((( ($pind[0]["valor"] * $pop[0]["valor"]) - ($pind[2]["valor"] * $pop[2]["valor"]) ) / ($pind[0]["valor"] * $pop[0]["valor"])) * 100, 2)));
     if (TextBuilder::$type === "perfil_udh") {
         //Município e RM em que a UDH está situada
         $mun_da_udh = TextBuilder::getMUN_udh(TextBuilder::$idMunicipio);
         $rm_da_udh = TextBuilder::getRM_udh(TextBuilder::$idMunicipio);
         $texto->replaceTags("mun_udh", $mun_da_udh[0]["nome"]);
         $texto->replaceTags("rm_udh", $rm_da_udh[0]["nome"]);
         $rdpc_mun = TextBuilder::getVariaveis_tablePersonalizado($mun_da_udh[0]["id"], "RDPC", "perfil_m");
         //T_ENV
         $rdpc_rm = TextBuilder::getVariaveis_tablePersonalizado($rm_da_udh[0]["id"], "RDPC", "perfil_rm");
         //T_ENV
         $pmpob_mun = TextBuilder::getVariaveis_tablePersonalizado($mun_da_udh[0]["id"], "PMPOB", "perfil_m");
         //T_ENV
         $pmpob_rm = TextBuilder::getVariaveis_tablePersonalizado($rm_da_udh[0]["id"], "PMPOB", "perfil_rm");
         //T_ENV
         $texto->replaceTags("renda10_mun_udh", Formulas::getRenda10($rdpc_mun));
         $texto->replaceTags("renda10_rm_udh", Formulas::getRenda10($rdpc_rm));
         $texto->replaceTags("pmpob_10_mun_udh", Formulas::getProporcaoPobres10($pmpob_mun));
         $texto->replaceTags("pmpob_10_rm_udh", Formulas::getProporcaoPobres10($pmpob_rm));
     }
     $block_renda->setData("text", $texto->getTexto());
     //@Translate
     $block_renda->setData("block_box1", TextBuilder::$aba->getIGini());
     // GRAFICO
     $block_renda->setData("tableContent", "");
     $block_renda->setData("tableContent2", "");
 }