コード例 #1
0
 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", "");
 }