<?php

class grid_fiche_prof_sante_stat_wilaya_resumo
{
   var $Db;
   var $Erro;
   var $Ini;
   var $Lookup;
   var $total;
   var $tipo;
   var $nm_data;
   var $NM_res_sem_reg;
   var $NM_export;
   var $prim_linha;
   var $que_linha;
   var $css_line_back; 
   var $css_line_fonf; 
   var $comando_grafico;
   var $resumo_campos;
   var $nm_location;
   var $Print_All;
   var $NM_raiz_img; 
   var $NM_tit_val; 
   var $NM_totaliz_hrz; 
   var $link_graph_tot; 
   var $Tot_ger; 
   var $nmgp_botoes     = array();
   var $nm_btn_exist    = array();
   var $nm_btn_label    = array(); 
   var $nm_btn_disabled = array();
   var $array_total_statut_maladie;
   var $array_total_maladie_confirmee_labo;
   var $array_total_geral;
   var $array_tot_lin;
   var $array_final;
   var $array_links;
   var $array_links_tit;
   var $array_export;
   var $quant_colunas;
   var $conv_col;
   var $count_ger;
   var $sc_proc_quebra_statut_maladie;
   var $count_statut_maladie;
   var $sc_proc_quebra_maladie_confirmee_labo;
   var $count_maladie_confirmee_labo;

   //---- 
   function __construct($tipo = "")
   {
      $this->Graf_left_dat   = true;
      $this->Graf_left_tot   = true;
      $this->NM_export       = false;
      $this->NM_totaliz_hrz  = false;
      $this->link_graph_tot  = array();
      $this->proc_res_grid   = false;
      $this->array_final     = array();
      $this->array_links     = array();
      $this->array_links_tit = array();
      $this->array_export    = array();
      $this->resumo_campos                      = array();
      $this->comando_grafico                    = array();
      $this->array_total_statut_maladie         = array();
      $this->array_total_maladie_confirmee_labo = array();
      $this->array_general_total = array();
      $this->nm_data = new nm_data("fr");
      if ("" != $tipo && "out" == strtolower($tipo))
      {
         $this->NM_tipo = "out";
      }
      else
      {
         $this->NM_tipo = "pag";
      }
   }

   //---- 
   function initializeButtons()
   {
      $this->nmgp_botoes['group_1'] = "on";
      $this->nmgp_botoes['group_1'] = "on";
      $this->nmgp_botoes['pdf'] = "on";
      $this->nmgp_botoes['word'] = "on";
      $this->nmgp_botoes['xls'] = "on";
      $this->nmgp_botoes['imp'] = "on";
      $this->nmgp_botoes['pdf'] = "on";
      $this->nmgp_botoes['word'] = "on";
      $this->nmgp_botoes['doc'] = "on";
      $this->nmgp_botoes['xls'] = "on";
      $this->nmgp_botoes['print'] = "on";
      $this->nmgp_botoes['html'] = "on";
      $this->nmgp_botoes['chart_conf'] = "on";
      $this->nmgp_botoes['chart_settings'] = "on";
      $this->nmgp_botoes['groupby'] = "on";
      $this->nmgp_botoes['chart_detail'] = "on";
      $this->nmgp_botoes['chart_exit'] = isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['under_dashboard']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['under_dashboard'] ? "off" : "on";

      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['under_dashboard']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['under_dashboard'] && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['maximized']) {
          $tmpDashboardApp = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['dashboard_app'];
          if (isset($_SESSION['scriptcase']['dashboard_toolbar'][$tmpDashboardApp]['grid_fiche_prof_sante_stat_wilaya'])) {
              $tmpDashboardButtons = $_SESSION['scriptcase']['dashboard_toolbar'][$tmpDashboardApp]['grid_fiche_prof_sante_stat_wilaya'];

              $this->nmgp_botoes['first']          = $tmpDashboardButtons['grid_navigate']  ? 'on' : 'off';
              $this->nmgp_botoes['back']           = $tmpDashboardButtons['grid_navigate']  ? 'on' : 'off';
              $this->nmgp_botoes['last']           = $tmpDashboardButtons['grid_navigate']  ? 'on' : 'off';
              $this->nmgp_botoes['forward']        = $tmpDashboardButtons['grid_navigate']  ? 'on' : 'off';
              $this->nmgp_botoes['summary']        = $tmpDashboardButtons['grid_summary']   ? 'on' : 'off';
              $this->nmgp_botoes['qsearch']        = $tmpDashboardButtons['grid_qsearch']   ? 'on' : 'off';
              $this->nmgp_botoes['dynsearch']      = $tmpDashboardButtons['grid_dynsearch'] ? 'on' : 'off';
              $this->nmgp_botoes['filter']         = $tmpDashboardButtons['grid_filter']    ? 'on' : 'off';
              $this->nmgp_botoes['sel_col']        = $tmpDashboardButtons['grid_sel_col']   ? 'on' : 'off';
              $this->nmgp_botoes['sort_col']       = $tmpDashboardButtons['grid_sort_col']  ? 'on' : 'off';
              $this->nmgp_botoes['goto']           = $tmpDashboardButtons['grid_goto']      ? 'on' : 'off';
              $this->nmgp_botoes['qtline']         = $tmpDashboardButtons['grid_lineqty']   ? 'on' : 'off';
              $this->nmgp_botoes['navpage']        = $tmpDashboardButtons['grid_navpage']   ? 'on' : 'off';
              $this->nmgp_botoes['pdf']            = $tmpDashboardButtons['grid_pdf']       ? 'on' : 'off';
              $this->nmgp_botoes['xls']            = $tmpDashboardButtons['grid_xls']       ? 'on' : 'off';
              $this->nmgp_botoes['xml']            = $tmpDashboardButtons['grid_xml']       ? 'on' : 'off';
              $this->nmgp_botoes['json']           = $tmpDashboardButtons['grid_json']      ? 'on' : 'off';
              $this->nmgp_botoes['csv']            = $tmpDashboardButtons['grid_csv']       ? 'on' : 'off';
              $this->nmgp_botoes['rtf']            = $tmpDashboardButtons['grid_rtf']       ? 'on' : 'off';
              $this->nmgp_botoes['word']           = $tmpDashboardButtons['grid_word']      ? 'on' : 'off';
              $this->nmgp_botoes['print']          = $tmpDashboardButtons['grid_print']     ? 'on' : 'off';
              $this->nmgp_botoes['chart_conf']     = $tmpDashboardButtons['chart_conf']     ? 'on' : 'off';
              $this->nmgp_botoes['chart_settings'] = $tmpDashboardButtons['chart_settings'] ? 'on' : 'off';
              $this->nmgp_botoes['groupby']        = $tmpDashboardButtons['sel_groupby']    ? 'on' : 'off';
              $this->nmgp_botoes['chart_detail']   = $tmpDashboardButtons['chart_detail']   ? 'on' : 'off';
              $this->nmgp_botoes['new']            = $tmpDashboardButtons['grid_new']       ? 'on' : 'off';
              $this->nmgp_botoes['reload']         = $tmpDashboardButtons['grid_reload']    ? 'on' : 'off';
          }
      }

   if ($this->Ini->Embutida_iframe) {
       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['sub_cons_iframe_btns'] as $BTN => $BTN_opc) {
           $this->nmgp_botoes[$BTN] = $BTN_opc;
       }
   }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_fiche_prof_sante_stat_wilaya']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_fiche_prof_sante_stat_wilaya']['btn_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_fiche_prof_sante_stat_wilaya']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
          {
              $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
          }
      }
   }

   //---- 
   function resumo_export()
   { 
      $this->NM_export = true;
      $this->monta_resumo();
   } 

    function generateRatingSummarizationJsCss()
    {
        $html = $this->generateRatingSummarizationBreakdownJs();
        $html .= $this->generateRatingSummarizationBarCss();
        return $html;
    }

    function generateRatingSummarizationBreakdownJs()
    {
        $html = <<<SCEOT
<script>
$(function() {
    ratingBreakdownDisplay();
});
function ratingBreakdownDisplay()
{
    $('.sc-rating-breakdown-trigger').on('mouseover', function() {
        let thisId = $(this).data('breakdownId');
        sc_position($(this), $('#sc-breakdown-' + thisId));
    }).on('mouseout', function() {
        let thisId = \$(this).data('breakdownId');
        $('#sc-breakdown-' + thisId).hide();
    });
}
</script>

SCEOT;
        return $html;
    }

    function generateRatingSummarizationBarCss()
    {
        $html = <<<SCEOT
<style>
</style>

SCEOT;
        return $html;
    }

	function generateChartImages() {
		require_once $this->Ini->path_aplicacao . $this->Ini->Apl_grafico;
		$this->Graf         = new grid_fiche_prof_sante_stat_wilaya_grafico();
		$this->Graf->Db     = $this->Db;
		$this->Graf->Erro   = $this->Erro;
		$this->Graf->Ini    = $this->Ini;
		$this->Graf->Lookup = $this->Lookup;

		$chartList  = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts'];
		$chartFiles = array();

		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['phantomjs_export_process'] = true;
		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_step']     = 'image';
		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_count']    = 0;
		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_total']    = 0;

		foreach ($chartList as $chartKey => $chartData) {
			if ('C|' != substr($chartKey, 0, 2)) {
				continue;
			}

			$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_total']++;
		}

		foreach ($chartList as $chartKey => $chartData) {
			if ('C|' != substr($chartKey, 0, 2)) {
				continue;
			}

			$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['phantomjs_export_file'] = '';
			$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_count']++;

			$this->writeProgressFile();

			$this->Graf->generateChartImage($chartKey);

			if ('' != $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['phantomjs_export_file']) {
				$chartFiles[] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['phantomjs_export_file'];
			}
		}

		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['phantomjs_export_process'] = false;

		return $chartFiles;
	} // generateChartImages

	function zipChartImages($password = '') {
		$chartImages = $this->generateChartImages();

		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_step'] = 'zip';

		$this->writeProgressFile();

		$zipFile = $this->zipFileList($chartImages, $password);

		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_step'] = 'end';

		$this->writeProgressFile();

		return $zipFile;
	}

	function zipFileList($fileList, $password = '') {
		$tempDir     = $this->Ini->root . $_SESSION['scriptcase']['grid_fiche_prof_sante_stat_wilaya']['glo_nm_path_imag_temp'] . '/';
		$zipFile     = 'sc_zip_' . md5(microtime() . rand(1, 1000) . session_id()) . '.zip';
		$zipFileFull = $this->zipProtectFileName($tempDir . $zipFile);

		if ('' != $password) {
			if (@is_file($tempDir . $zipFile)) {
				@unlink($tempDir . $zipFile);
			}

			$filename     = array_shift($fileList);
			$filenameFull = $this->zipProtectFileName($tempDir . $filename);

			if (FALSE !== strpos(strtolower(php_uname()), 'windows')) {
				chdir("{$this->Ini->path_third}/zip/windows");
				$zipCommand = "zip.exe -P -j {$password} {$zipFileFull} {$filenameFull}";
			}
			elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) {
				if (FALSE !== strpos(strtolower(php_uname()), 'i686')) {
					chdir("{$this->Ini->path_third}/zip/linux-i386/bin");
				}
				else {
					chdir("{$this->Ini->path_third}/zip/linux-amd64/bin");
				}
				$zipCommand = "./7za -p{$password} a {$zipFileFull} {$filenameFull}";
			}
			elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin')) {
				chdir("{$this->Ini->path_third}/zip/mac/bin");
				$zipCommand = "./7za -p{$password} a {$zipFileFull} {$filenameFull}";
			}

			if (!empty($zipCommand)) {
				exec($zipCommand);
			}

			while (!empty($fileList)) {
				$filename     = array_shift($fileList);
				$filenameFull = $this->zipProtectFileName($tempDir . $filename);

				if (FALSE !== strpos(strtolower(php_uname()), 'windows')) {
					chdir("{$this->Ini->path_third}/zip/windows");
					$zipCommand = "zip.exe -P -j -u {$password} {$zipFileFull} {$filenameFull}";
				}
				elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) {
					if (FALSE !== strpos(strtolower(php_uname()), 'i686')) {
						chdir("{$this->Ini->path_third}/zip/linux-i386/bin");
					}
					else {
						chdir("{$this->Ini->path_third}/zip/linux-amd64/bin");
					}
					$zipCommand = "./7za -p{$password} a {$zipFileFull} {$filenameFull}";
				}
				elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin')) {
					chdir("{$this->Ini->path_third}/zip/mac/bin");
					$zipCommand = "./7za -p{$password} a {$zipFileFull} {$filenameFull}";
				}

				if (!empty($zipCommand)) {
					exec($zipCommand);
				}
			}
		}
		else {
			require_once $this->Ini->path_third . '/zipfile/zipfile.php';

			$tempDir = $this->Ini->root . $_SESSION['scriptcase']['grid_fiche_prof_sante_stat_wilaya']['glo_nm_path_imag_temp'] . '/';
			$zipFile = 'sc_zip_' . md5(microtime() . rand(1, 1000) . session_id()) . '.zip';

			$zipHandler = new zipfile();
			$zipHandler->set_file($tempDir . $zipFile);

			foreach ($fileList as $chartImageName) {
				$chartImageFile = $tempDir . $chartImageName;

				$zipHandler->sc_zip_all($chartImageFile);
			}

			$zipHandler->file();
		}

		return $zipFile;
	}

	function zipProtectFileName($filename) {
		return false !== strpos($filename, ' ') ? "\"{$filename}\"" : $filename;
	}

	function writeProgressFile() {
		if ('image' == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_step']) {
			$progress = floor($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_count'] * 100 / ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_total'] + 1));
			$content  = $this->Ini->Nm_lang['lang_pdff_pcht'] . ": {$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_count']}/{$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_total']}###$progress";

			$content  = $_SESSION['scriptcase']['charset'] != 'UTF-8' ? sc_convert_encoding($content, 'UTF-8', $_SESSION['scriptcase']['charset']) : $content;
		}
		elseif ('zip' == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_step']) {
			$progress = floor($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_count'] * 100 / ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_total'] + 1));
			$content  = $this->Ini->Nm_lang['lang_chrt_zip_img'] . "###$progress";

			$content  = $_SESSION['scriptcase']['charset'] != 'UTF-8' ? sc_convert_encoding($content, 'UTF-8', $_SESSION['scriptcase']['charset']) : $content;
		}
		elseif ('end' == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_step']) {
			$content = "ok###100";
		}
		else {
			$content = "init###0";
		}

		$f = @fopen("{$this->Ini->root}{$_SESSION['scriptcase']['grid_fiche_prof_sante_stat_wilaya']['glo_nm_path_imag_temp']}/{$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['export_progress_file']}", 'w');
		fwrite($f, $content);
		fclose($f);
	}

   function monta_resumo($b_export = false)
   {
       global $nm_saida;

       $this->initializeButtons();

      $this->NM_res_sem_reg = false;
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['Proc_Link_Res'] = false;
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']))
      { 
         $this->res_contr = new grid_fiche_prof_sante_stat_wilaya_apl();
         $this->res_contr->Ini = $this->Ini;
         $this->res_contr->Recupera_where();
         $this->res_contr->SC_where_resumo_search();
         $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_array_resumo'] = "NAO";
      }
      $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_orig'];
      $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_pesq'];
      $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_pesq_filtro'];
     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']))
     { 
         $Busca_temp = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca'];
         if ($_SESSION['scriptcase']['charset'] != "UTF-8")
         {
             $Busca_temp = NM_conv_charset($Busca_temp, $_SESSION['scriptcase']['charset'], "UTF-8");
         }
       $this->id_fiche_ps = (isset($Busca_temp['id_fiche_ps'])) ? $Busca_temp['id_fiche_ps'] : ""; 
       $tmp_pos = (is_string($this->id_fiche_ps)) ? strpos($this->id_fiche_ps, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->id_fiche_ps))
       {
           $this->id_fiche_ps = substr($this->id_fiche_ps, 0, $tmp_pos);
       }
       $this->code_fiche = (isset($Busca_temp['code_fiche'])) ? $Busca_temp['code_fiche'] : ""; 
       $tmp_pos = (is_string($this->code_fiche)) ? strpos($this->code_fiche, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->code_fiche))
       {
           $this->code_fiche = substr($this->code_fiche, 0, $tmp_pos);
       }
       $this->date_declaration = (isset($Busca_temp['date_declaration'])) ? $Busca_temp['date_declaration'] : ""; 
       $tmp_pos = (is_string($this->date_declaration)) ? strpos($this->date_declaration, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->date_declaration))
       {
           $this->date_declaration = substr($this->date_declaration, 0, $tmp_pos);
       }
       $date_declaration_2 = (isset($Busca_temp['date_declaration_input_2'])) ? $Busca_temp['date_declaration_input_2'] : ""; 
       $this->date_declaration_2 = $date_declaration_2; 
       $this->wilaya = (isset($Busca_temp['wilaya'])) ? $Busca_temp['wilaya'] : ""; 
       $tmp_pos = (is_string($this->wilaya)) ? strpos($this->wilaya, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->wilaya))
       {
           $this->wilaya = substr($this->wilaya, 0, $tmp_pos);
       }
     } 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf")
      {
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_resumo']);
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['res_hrz']))
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['res_hrz'] = $this->NM_totaliz_hrz;
      } 
      $this->NM_totaliz_hrz = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['res_hrz'];
      if (isset($_SESSION['scriptcase']['sc_aba_iframe']) && !$this->NM_export)
      {
          foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
          {
              if (in_array("grid_fiche_prof_sante_stat_wilaya", $apls_aba))
              {
                  $this->aba_iframe = true;
                  break;
              }
          }
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['iframe_menu'] && !$this->NM_export && (!isset($_SESSION['scriptcase']['menu_mobile']) || empty($_SESSION['scriptcase']['menu_mobile'])))
      {
          $this->aba_iframe = true;
      }
      $dir_raiz          = strrpos($_SERVER['PHP_SELF'],"/") ;  
      $dir_raiz          = substr($_SERVER['PHP_SELF'], 0, $dir_raiz + 1) ;  
      $this->nm_location = $this->Ini->sc_protocolo . $this->Ini->server . $dir_raiz . "grid_fiche_prof_sante_stat_wilaya.php"; 
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['array_graf_pdf'] = array();
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf")
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_resumo'] = "";
      }
      $this->inicializa_vars();
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_array_resumo'] == "OK" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_total_geral'] == "OK")
      {
          $this->array_total_statut_maladie = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_total']['statut_maladie'];
          $this->array_total_maladie_confirmee_labo = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_total']['maladie_confirmee_labo'];
      }
      else
      {
          $this->array_total_statut_maladie = array();
          $this->array_total_maladie_confirmee_labo = array();
          $this->totaliza();
          $this->finaliza_arrays();
      }
      $Sv_tot_ger = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['tot_geral'];
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_total_geral'] = "N";
      $Gb_geral = "quebra_geral_" . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['SC_Ind_Groupby'];
      $tp_tot = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['Res_search_metric_use']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['Res_search_metric_use'])) ? true : false;
      $this->Total->$Gb_geral($tp_tot, $this->NM_export);
      $this->array_total_geral = array();
      $this->array_total_geral[0] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['tot_geral'][1];
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['tot_geral'][1]) || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['tot_geral'][1] == 0)
      {
          $this->NM_res_sem_reg = true;
      }
      if (isset($Sv_tot_ger))
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['tot_geral'] = $Sv_tot_ger;
          unset($Sv_tot_ger);
      }
      $this->resumo_init();
      if ($this->NM_res_sem_reg)
      {
          $this->resumo_sem_reg();
          $this->resumo_final();
          return;
      }
      $this->completeMatrix();
      $this->buildMatrix();
      $this->buildChart();
      if ($b_export)
      {
          return;
      }
      if (isset($_GET['flash_graf']) && 'chart' == $_GET['flash_graf'])
      {
          require_once($this->Ini->path_aplicacao . $this->Ini->Apl_grafico); 
          $this->Graf  = new grid_fiche_prof_sante_stat_wilaya_grafico();
          $this->Graf->Db     = $this->Db;
          $this->Graf->Erro   = $this->Erro;
          $this->Graf->Ini    = $this->Ini;
          $this->Graf->Lookup = $this->Lookup;
          $this->Graf->monta_grafico();
          exit;
      }
      if (($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == 'print' || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == 'pdf') && strpos(" " . $this->Ini->SC_module_export, "resume") === false)
      { }
      else
      {
          $this->drawMatrix();
      }
      $this->resumo_final();
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_label_graf'] = array();
      if (isset($this->nmgp_label_quebras) && !empty($this->nmgp_label_quebras))
      {
         $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_label_graf'] = $this->nmgp_label_quebras;
      }
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_total']['statut_maladie'] = $this->array_total_statut_maladie;
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_total']['maladie_confirmee_labo'] = $this->array_total_maladie_confirmee_labo;
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['contr_array_resumo'] = "OK";
   }

   function completeMatrix()
   {
       $this->comp_align       = array();
       $this->comp_display     = array();
       $this->comp_field       = array();
       $this->comp_field_nm    = array();
       $this->comp_field_nm_rv = array();
       $this->comp_fill        = array();
       $this->comp_group       = array();
       $this->comp_index       = array();
       $this->comp_label       = array();
       $this->comp_links_fl    = array();
       $this->comp_links_gr    = array();
       $this->comp_order       = array();
       $this->comp_order_start = array();
       $this->comp_order_col   = '';
       $this->comp_order_level = '';
       $this->comp_order_sort  = '';
       $this->comp_sum         = array();
       $this->comp_sum_order   = array();
       $this->comp_sum_display = array();
       $this->comp_sum_dummy   = array();
       $this->comp_sum_fn      = array();
       $this->comp_sum_lnk     = array();
       $this->comp_sum_css     = array();
       $this->comp_sum_nm      = array();
       $this->comp_sum_fill_0  = false;
       $this->comp_tabular     = true;
       $this->comp_tab_hover   = true;
       $this->comp_tab_seq     = true ;
       $this->comp_tab_extend  = true;
       $this->comp_tab_label   = true;
       $this->comp_totals_a    = array();
       $this->comp_totals_al   = array();
       $this->comp_totals_g    = array();
       $this->comp_totals_x    = array();
       $this->comp_totals_y    = array();
       $this->comp_x_axys      = array();
       $this->comp_y_axys      = array();

       $this->build_total_row  = array();
       $this->build_col_count  = 0;

       $this->show_totals_x    = true;
       $this->show_totals_y    = true;
       //-----
       if ($this->NM_export && isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['json_use_label']) && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['json_use_label'])
       {
          $Lab_statut_maladie = "statut_maladie";
          $Lab_maladie_confirmee_labo = "maladie_confirmee_labo";
       }
       else
       {
       $Lab_statut_maladie = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_statut_maladie'] . "";
       $Lab_maladie_confirmee_labo = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_maladie_confirmee_labo'] . "";
       }
       $this->comp_field = array(
           $Lab_statut_maladie,
           $Lab_maladie_confirmee_labo,
       );
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['statut_maladie'] = $Lab_statut_maladie; 
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_confirmee_labo'] = $Lab_maladie_confirmee_labo; 

       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['id_fiche_ps']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['id_fiche_ps'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_id_fiche_ps'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['code_fiche']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['code_fiche'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_code_fiche'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_declaration']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_declaration'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_declaration'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['wilaya']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['wilaya'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_wilaya'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commune']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commune'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_commune'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['structure']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['structure'] = "Structure"; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nom_rapporteur']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nom_rapporteur'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_nom_rapporteur'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['tel_rapporteur']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['tel_rapporteur'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_tel_rapporteur'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['email_rapporteur']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['email_rapporteur'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_email_rapporteur'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_suspectee_nm_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_suspectee_nm_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_maladie_suspectee_nm_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nom_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nom_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_nom_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['prenom_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['prenom_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_prenom_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_naissance_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_naissance_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_naissance_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['age_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['age_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_age_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['sexe_nm_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['sexe_nm_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_sexe_nm_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['profession_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['profession_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_profession_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['adresse_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['adresse_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_adresse_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['wilaya_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['wilaya_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_wilaya_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commune_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commune_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_commune_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['lieu_travail']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['lieu_travail'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_lieu_travail'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['tel_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['tel_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_tel_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['email_malade']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['email_malade'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_email_malade'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['lieux_frequentes']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['lieux_frequentes'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_lieux_frequentes'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_apparition_symptomes']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_apparition_symptomes'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_apparition_symptomes'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['autres_symptomes']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['autres_symptomes'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_autres_symptomes'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['hospitalisation']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['hospitalisation'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_hospitalisation'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_hospitalisation']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_hospitalisation'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_hospitalisation'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['evacuation']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['evacuation'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_evacuation'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_evacuation']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_evacuation'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_evacuation'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['structure_evacuation']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['structure_evacuation'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_structure_evacuation'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['antecedent_medicaux']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['antecedent_medicaux'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_antecedent_medicaux'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commentaires']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commentaires'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_commentaires'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['longitude']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['longitude'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_longitude'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['latitude']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['latitude'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_latitude'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['envoie']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['envoie'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_envoie'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['envoie_ack']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['envoie_ack'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_envoie_ack'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['valide']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['valide'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_valide'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['descr_invalidite']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['descr_invalidite'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_descr_invalidite'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['user_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['user_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_user_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['validator_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['validator_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_validator_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['mobile']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['mobile'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_mobile'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['evolution_nm_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['evolution_nm_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_evolution_nm_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['symptomes']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['symptomes'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_symptomes'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['device_id']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['device_id'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_device_id'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_suspectee_by_ia']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_suspectee_by_ia'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_maladie_suspectee_by_ia'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_validation']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_validation'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_validation'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['user_labo_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['user_labo_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_user_labo_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_confirmation_labo']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_confirmation_labo'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_confirmation_labo'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_confirmee_labo']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['maladie_confirmee_labo'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_maladie_confirmee_labo'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['statut_maladie']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['statut_maladie'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_statut_maladie'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_sortie']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_sortie'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_sortie'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_deces']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_deces'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_deces'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_prelevements']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_prelevements'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_prelevements'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_reception_prelevement']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_reception_prelevement'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_reception_prelevement'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_resultats_labo']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['date_resultats_labo'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_date_resultats_labo'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['type_prelevement_nm_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['type_prelevement_nm_fk'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_type_prelevement_nm_fk'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['resultats_labo']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['resultats_labo'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_resultats_labo'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['labo_destination']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['labo_destination'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_labo_destination'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nin']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nin'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_nin'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commentaires_labo']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commentaires_labo'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_commentaires_labo'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commentaires_semep']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['commentaires_semep'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_commentaires_semep'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['statut_fiche']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['statut_fiche'] = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_statut_fiche'] . ""; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['pays_origine']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['pays_origine'] = "Pays Origine"; 
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nationalite_nm_fk']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['labels']['nationalite_nm_fk'] = "Nationalite Nm Fk"; 
       }
       //-----
       $this->comp_field_nm = array(
           'statut_maladie' => 0,
           'maladie_confirmee_labo' => 1,
       );

       $this->comp_field_nm_rv = array_flip($this->comp_field_nm);

       //-----
       $this->comp_sum = array(
           2 => "" .  $this->Ini->Nm_lang['lang_btns_smry_msge_cnt'] . "",
       );

       //-----
       $this->comp_sum_order = array(
           2,
       );

       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_order']['stat1']))
       {
           foreach ($this->comp_sum as $i_sum => $l_sum)
           {
               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_order']['stat1'][] = $i_sum;
           }
       }
       else
       {
           $this->comp_sum_order = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_order']['stat1'];
       }

       //-----
       $this->comp_sum_display = array(
           2 => true,
       );

           foreach ($this->comp_sum as $i_sum => $l_sum)
           {
               if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'][$i_sum]))
               {
                   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'][$i_sum] = array('label' => $l_sum, 'display' => $this->comp_sum_display[$i_sum]);
               }
               else
               {
                   if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'][$i_sum]['label']))
                   {
                       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'][$i_sum]['label'] = $l_sum;
                   }
                   if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'][$i_sum]['display']))
                   {
                       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'][$i_sum]['display'] = $this->comp_sum_display[$i_sum];
                   }
               }
           }
           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['summarizing_fields_display']['stat1'] as $i_sum => $d_sum)
           {
               $this->comp_sum_display[$i_sum] = $d_sum['display'];
           }

       //-----
       $this->comp_sum_dummy = array(
           0,
           0,
       );

       //-----
       $this->comp_sum_fn = array(
           2 => "C",
       );

       //-----
       $this->comp_sum_lnk = array(
           2 => array('field' => "nm_count", 'show' => false),
       );

       //-----
       $this->comp_sum_css = array(
           2 => "css___nm_count_nm___cnt",
       );

       //-----
       $this->comp_sum_nm = array(
           2 => "__nm_count_nm___cnt",
       );

       //-----
       foreach ($this->array_total_statut_maladie as $i_statut_maladie => $d_statut_maladie) {
           if (!isset($i_statut_maladie, $this->comp_label[0]) || !in_array($i_statut_maladie, $this->comp_label[0], true)) {
               $this->comp_index[0][ $d_statut_maladie[3] ] = $d_statut_maladie[2];
               $this->comp_label[0][ $d_statut_maladie[3] ] = $d_statut_maladie[2];
           }
           foreach ($this->array_total_maladie_confirmee_labo[$i_statut_maladie] as $i_maladie_confirmee_labo => $d_maladie_confirmee_labo) {
               if (!isset($i_maladie_confirmee_labo, $this->comp_label[1][ $d_statut_maladie[3] ]) || !in_array($i_maladie_confirmee_labo, $this->comp_label[1][ $d_statut_maladie[3] ], true)) {
                   $this->comp_index[1][ $d_maladie_confirmee_labo[3] ] = $d_maladie_confirmee_labo[2];
                   $this->comp_label[1][ $d_statut_maladie[3] ][ $d_maladie_confirmee_labo[3] ] = $d_maladie_confirmee_labo[2];
               }
           }
       }

       //-----
       $this->comp_x_axys = array(0);
       $this->comp_y_axys = array(1);

       //-----
       $this->comp_align = array('', '');

       //-----
       $this->comp_links_gr = array(0, 1);

       //-----
       $this->comp_links_fl = array(
           array('name' => 'statut_maladie', 'prot' => '@aspass@'),
           array('name' => 'maladie_confirmee_labo', 'prot' => '@aspass@'),
       );

       //-----
       $this->comp_rating_gby = array(
           0 => "",
           1 => "",
       );

       //-----
       $this->comp_rating_sum = array(
           1 => "",
       );

       //-----
       $this->comp_fill = array(
           0 => true,
           1 => true,
       );

       //-----
       $this->comp_display = array(
           0 => 'label',
           1 => 'label',
       );

       //-----
       $this->comp_order = array(
           0 => 'label',
           1 => 'label',
       );
       $this->comp_order_start = array(
           0 => 'asc',
           1 => 'asc',
       );
       $this->comp_order_invert = array(
           0 => false,
           1 => false,
       );
       $this->comp_order_enabled = array(
           0 => true,
           1 => true,
       );
       $this->comp_order_datatype = array(
           0 => 'bpchar',
           1 => 'varchar',
       );

       //-----
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_group_by'] = $this->comp_field;
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_x_axys']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_x_axys'] = $this->comp_x_axys;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_y_axys']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_y_axys'] = $this->comp_y_axys;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_fill']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_fill'] = $this->comp_fill;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order'] = $this->comp_order;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_start']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_start'] = $this->comp_order_start;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular'] = $this->comp_tabular;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_hover']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_hover'] = $this->comp_tabular && $this->comp_tab_hover;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_seq']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_seq'] = $this->comp_tabular && $this->comp_tab_seq;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_label']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_label'] = $this->comp_tabular && $this->comp_tab_label;
       }

       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_col']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_col'] = 0;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_level']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_level'] = 0;
       }
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_sort']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_sort'] = '';
       }
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'] && isset($_POST['parm']))
       { 
           $todo  = explode("*scout", $_POST['parm']);
           foreach ($todo as $param)
           {
               $cadapar = explode("*scin", $param);
               if (isset($cadapar[1])) {
                   $_POST[$cadapar[0]] = $cadapar[1];
               }
           }
        } 
       if (isset($_POST['change_sort']) && 'Y' == $_POST['change_sort'])
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_sort'] = $_POST['sort_ord'];
           if ('' == $_POST['sort_ord'])
           {
               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_col']  = 0;
           }
           else
           {
               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_col']  = $_POST['sort_col'];
           }
       }
       if (isset($_POST['change_sort']) && 'NEW' == $_POST['change_sort']) {
           for ($i = 0; $i < sizeof($this->comp_label); $i++) {
               if ($i == $_POST['sort_col']) {
                   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_start'][$i] = $_POST['sort_ord'];
               }
           }
       }

       $this->comp_x_axys      = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_x_axys'];
       $this->comp_y_axys      = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_y_axys'];
       $this->comp_fill        = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_fill'];
       $this->comp_order       = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order'];
       $this->comp_order_start = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_start'];
       $this->comp_order_col   = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_col'];
       $this->comp_order_level = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_level'];
       $this->comp_order_sort  = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_sort'];
       $this->comp_tabular     = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular'];
       $this->comp_tab_hover   = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_hover'];
       $this->comp_tab_seq     = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_seq'];
       $this->comp_tab_label   = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_tabular_label'];

       //-----
       for ($i = 0; $i < sizeof($this->comp_label); $i++) {
           if ('label' == $this->comp_order[$i]) {
               if (('desc' == $this->comp_order_start[$i] && !$this->comp_order_invert[$i]) || ('asc' == $this->comp_order_start[$i] && $this->comp_order_invert[$i]))
               {
                   $sortFn = 'arsort';
                   arsort($this->comp_index[$i]);
               }
               else
               {
                   $sortFn = 'asort';
                   asort($this->comp_index[$i]);
               }
               $this->comp_label[$i] = $this->arrangeLabelList($this->comp_label[$i], $i, $sortFn);
           }
           else {
               if (('desc' == $this->comp_order_start[$i] && !$this->comp_order_invert[$i]) || ('asc' == $this->comp_order_start[$i] && $this->comp_order_invert[$i]))
               {
                   $sortFn = 'krsort';
                   krsort($this->comp_index[$i]);
               }
               else
               {
                   $sortFn = 'ksort';
                   ksort($this->comp_index[$i]);
               }
               $this->comp_label[$i] = $this->arrangeLabelList($this->comp_label[$i], $i, $sortFn);
           }
       }

       //-----
     if (isset($this->comp_label[0])) {
       foreach ($this->comp_label[0] as $i_statut_maladie => $l_statut_maladie) {
           if (isset($this->array_total_statut_maladie[$i_statut_maladie])) {
               $this->comp_group[$i_statut_maladie] = array();
           }
           foreach ($this->comp_label[1][$i_statut_maladie] as $i_maladie_confirmee_labo => $l_maladie_confirmee_labo) {
               if (isset($this->array_total_maladie_confirmee_labo[$i_statut_maladie][$i_maladie_confirmee_labo])) {
                   $this->comp_group[$i_statut_maladie][$i_maladie_confirmee_labo] = array();
               }
           }
       }
     }

   }

   function arrangeLabelList($label, $level, $method) {
       $new_label = $label;

       if (0 == $level) {
           if ('reverse' == $method) {
               $new_label = array_reverse($new_label, true);
           }
           elseif ('asort' == $method) {
               asort($new_label);
           }
           else {
               ksort($new_label);
           }
       }
       else {
           foreach ($label as $i => $sub_label) {
               $new_label[$i] = $this->arrangeLabelList($sub_label, $level - 1, $method);
           }
       }

       return $new_label;
   }

   function getCompData($level, $params = array()) {
       if (0 == $level) {
           $return = $this->array_total_statut_maladie;
       }
       elseif (1 == $level) {
           $return = $this->array_total_maladie_confirmee_labo;
       }

       if (array() == $params) {
           return $return;
       }

       foreach ($params as $i_param => $param) {
           if (!isset($return[$param])) {
               return 0;
           }

           $return = $return[$param];
       }

       return $return;
   }   

   function buildMatrix()
   {
       $this->build_labels = $this->getXAxys();
       $this->build_data   = $this->getYAxys();
   }

   function getXAxys()
   {
       $a_axys = array();

       if (0 == sizeof($this->comp_x_axys))
       {
           if (0 < sizeof($this->comp_sum))
           {
               foreach ($this->comp_sum_order as $i_sum)
               {
                   if ($this->comp_sum_display[$i_sum])
                   {
                       $l_sum = $this->comp_sum[$i_sum];
                       $chart    = '0|' . ($i_sum - 1) . '|';
                       $a_axys[] = array(
                           'group'      => 1,
                           'value'      => $i_sum,
                           'label'      => $l_sum,
                           'field_name' => $this->comp_sum_nm[$i_sum],
                           'function'   => $this->comp_sum_fn[$i_sum],
                           'params'     => array($i_sum - 1),
                           'children'   => array(),
                           'chart'      => $chart,
                           'css'        => isset($this->comp_sum_css[$i_sum]) ? $this->comp_sum_css[$i_sum] : '',
                       );
                   }
               }
           }
           else
           {
               $a_axys = array();
           }
           $a_labels[] = $a_axys;

           $this->build_col_count = count($a_labels[0]);
       }
       else
       {
           foreach ($this->comp_index[0] as $i_group => $l_group)
           {
               $a_params = array($i_group);
               $a_axys[] = array(
                   'group'    => 0,
                   'value'    => $i_group,
                   'label'    => $this->getRatingGroupBy($l_group, $i_group, 0),//$l_group,
                   'params'   => $a_params,
                   'children' => $this->addChildren(1, $this->comp_fill[1], $this->comp_group[$i_group], $a_params),
               );
           }

           $a_labels = array();
           $this->addChildrenLabel($a_axys, $a_labels);

           $this->build_col_count = 0;
           if (isset($a_labels[0])) {
               foreach ($a_labels[0] as $labelInfo) {
                   if (isset($labelInfo['colspan'])) {
                       $this->build_col_count += $labelInfo['colspan'];
                   }
               }
           }
       }

       if ($this->show_totals_x && 0 < sizeof($this->comp_x_axys))
       {
           $a_labels[0][] = array(
               'group'   => -1,
               'value'   => $this->Ini->Nm_lang['lang_othr_chrt_totl'],
               'label'   => $this->Ini->Nm_lang['lang_othr_chrt_totl'],
               'params'  => array(),
               'colspan' => sizeof($this->comp_sum),
               'rowspan' => sizeof($this->comp_x_axys),
           );
           foreach ($this->comp_sum_order as $i_sum)
           {
               if ($this->comp_sum_display[$i_sum])
               {
                   $s_label = $this->comp_sum[$i_sum];
                   $a_labels[sizeof($this->comp_x_axys)][] = array(
                       'group'    => -1,
                       'value'    => $s_label,
                       'label'    => $s_label,
                       'function' => $this->comp_sum_fn[$i_sum],
                       'params'   => array(),
                       'chart'    => 'T|' . ($i_sum - 1),
                           'css'      => isset($this->comp_sum_css[$i_sum]) ? $this->comp_sum_css[$i_sum] : '',
                   );
               }
           }
       }

       return $a_labels;
   }

   function addChildren($group, $fill, $children, $params)
   {
       if (!isset($this->comp_x_axys[$group]))
       {
           if (0 < sizeof($this->comp_sum))
           {
               $a_sum = array();
               foreach ($this->comp_sum_order as $i_sum)
               {
                   if ($this->comp_sum_display[$i_sum])
                   {
                       $l_sum = $this->comp_sum[$i_sum];
                       $chart    = $group . '|' . ($i_sum - 1) . '|' . implode('|', $params);
                       $params_n = array_merge($params, array($i_sum - 1));
                       $a_sum[] = array(
                           'group'    => $group,
                           'value'    => $i_sum,
                           'label'    => $l_sum,
                           'function' => $this->comp_sum_fn[$i_sum],
                           'params'   => $params_n,
                           'children' => array(),
                           'chart'    => $chart,
                           'css'      => isset($this->comp_sum_css[$i_sum]) ? $this->comp_sum_css[$i_sum] : '',
                       );
                   }
               }
               return $a_sum;
           }
           else
           {
               return array();
           }
       }

       $a_axys = array();

       if ($fill)
       {
           foreach ($this->comp_index[$group] as $i_group => $l_group)
           {
               $params_n = array_merge($params, array($i_group));
               $a_axys[] = array(
                   'group'    => $group,
                   'value'    => $i_group,
                   'label'    => $this->getRatingGroupBy($l_group, $i_group, $group),//$l_group,
                   'params'   => $params_n,
                   'children' => $this->addChildren($group + 1, $this->comp_fill[$group + 1], $children[$i_group], $params_n),
               );
           }
       }
       else
       {
           foreach ($children as $i_group => $a_group)
           {
               $params_n = array_merge($params, array($i_group));
               $a_axys[] = array(
                   'group'    => $group,
                   'value'    => $i_group,
                   'label'    => $this->getRatingGroupBy($this->comp_index[$group][$i_group], $i_group, $group),//$this->comp_index[$group][$i_group],
                   'params'   => $params_n,
                   'children' => $this->addChildren($group + 1, $this->comp_fill[$group + 1], $children[$i_group], $params_n),
               );
           }
       }

       return $a_axys;
   }

   function countChildren($children)
   {
       if (empty($children))
       {
           return 1;
       }

       $i = 0;
       foreach ($children as $data)
       {
           $i += $this->countChildren($data['children']);
       }
       return $i;
   }

   function addChildrenLabel($children, &$a_labels)
   {
       foreach ($children as $a_cols)
       {
           $a_labels[$a_cols['group']][] = array(
               'group'    => $a_cols['group'],
               'value'    => $a_cols['value'],
               'label'    => $a_cols['label'],
               'function' => isset($a_cols['function']) ? $a_cols['function'] : '',
               'params'   => $a_cols['params'],
               'colspan'  => $this->countChildren($a_cols['children']),
               'chart'    => isset($a_cols['chart']) ? $a_cols['chart'] : '',
               'css'      => isset($a_cols['css'])   ? $a_cols['css']   : '',
           );
           if (!empty($a_cols['children']))
           {
               $this->addChildrenLabel($a_cols['children'], $a_labels);
           }
       }
   }

   function getYAxys()
   {
       $a_axys = array();

       $this->addYChildren(0, $this->comp_group, $a_axys, array());
       $this->fixOrder($a_axys);
       $this->orderBy($a_axys, $this->comp_order_sort, $this->comp_order_col - 1, 0, array());
       $this->comp_chart_axys = $a_axys;

       $a_data              = array();
       $i_row               = 0;
       $this->subtotal_data = array();
       $this->addYChildrenData($a_axys, $a_data, $i_row, 0, array(), array());

       if (!empty($this->subtotal_data))
       {
           end($this->subtotal_data);
           $i_max = key($this->subtotal_data);
           for ($i = $i_max; $i >= 0; $i--)
           {
               $this->build_total_row[] = true;
               $a_data[] = $this->subtotal_data[$i];
           }
       }

       $this->makeTabular($a_data);

       $this->buildTotalsY($a_data);

       return $a_data;
   }

   function addYChildren($group, $tree, &$axys, $param)
   {
       $comp_label = (isset($this->comp_label[$group])) ? $this->comp_label[$group] : array();
       $tmp_param  = $param;
       while (!empty($tmp_param))
       {
           $tmp_index  = array_shift($tmp_param);
           $comp_label = (isset($comp_label[$tmp_index])) ? $comp_label[$tmp_index] : array();
       }
       foreach ($comp_label as $i_group => $l_group)
       {
           if (isset($tree[$i_group]))
           {
               $new_param = array_merge($param, array($i_group));
               if (in_array($group, $this->comp_y_axys))
               {
                   if (!isset($axys[$i_group]))
                   {
                       $axys[$i_group] = array(
                           'group'    => $group,
                           'value'    => $i_group,
                           'label'    => $l_group,
                           'children' => array(),
                       );
                   }
                   $this->addYChildren($group + 1, $tree[$i_group], $axys[$i_group]['children'], $new_param);
               }
               else
               {
                   $this->addYChildren($group + 1, $tree[$i_group], $axys, $new_param);
               }
           }
       }
   }

   function fixOrder(&$axys)
   {
       $n_axys = array();
       $key    = key($axys);
     if (isset($axys[$key]['group'])) 
     {
       $group  = $axys[$key]['group'];

       foreach ($this->comp_index[$group] as $i_group => $l_group)
       {
           if (isset($axys[$i_group]))
           {
               $n_axys[$i_group] = $axys[$i_group];
           }
           if (!empty($n_axys[$i_group]['children']))
           {
               $this->fixOrder($n_axys[$i_group]['children']);
           }
       }

       $axys = $n_axys;
     }
   }

   function orderBy(&$axys, $ord, $col, $level, $keys)
   {
       if (-1 == $col || '' == $ord)
       {
           return;
       }

       if ($this->comp_order_level <= $level)
       {
           $n_axys = array();
           $o_axys = array();

           foreach ($axys as $i_group => $d_group)
           {
               $o_axys[$i_group] = 0;
           }

           $a_order = $this->getOrderArray($this->getCompData($level), $ord, $col, $keys, $o_axys);

           foreach ($a_order as $i_group => $v_group)
           {
               $n_axys[$i_group] = $axys[$i_group];
           }

           $axys = $n_axys;
       }

       foreach ($axys as $i_group => $d_group)
       {
           if (!empty($d_group['children']))
           {
               $n_keys = array_merge($keys, array($i_group));
               $this->orderBy($axys[$i_group]['children'], $ord, $col, $level + 1, $n_keys);
           }
       }
   }

   function getOrderArray($data, $ord, $col, $keys, $elem)
   {
       while (!empty($keys))
       {
           $key = key($keys);

           if (isset($data[ $keys[$key] ]))
           {
               $data = $data[ $keys[$key] ];
           }

           unset($keys[$key]);
       }

       foreach ($elem as $i_group => $v_group)
       {
           if (isset($data[$i_group]) && isset($data[$i_group][$col]))
           {
               $elem[$i_group] = $data[$i_group][$col];
           }
       }

       if ('a' == $ord)
       {
           asort($elem);
       }
       else
       {
           arsort($elem);
       }

       return $elem;
   }

   function getRatingGroupBy($originalLabel, $value, $groupByField)
   {
       if (isset($this->comp_rating_gby[$groupByField]) && '' != $this->comp_rating_gby[$groupByField] && method_exists($this, $this->comp_rating_gby[$groupByField])) {
           $fnName = $this->comp_rating_gby[$groupByField];
           return $this->$fnName($value);
       }
       return $originalLabel;
   }

   function getRatingSummarization($value, $summarizationField, $alreadyArray = false)
   {
       if (isset($this->comp_rating_sum[$summarizationField]) && '' != $this->comp_rating_sum[$summarizationField] && method_exists($this, $this->comp_rating_sum[$summarizationField])) {
           $fnName = $this->comp_rating_sum[$summarizationField];
           return $this->$fnName($value, $alreadyArray);
       }
       return '';
   }

   function addYChildrenData($axys, &$data, &$row, $level, $params, $tab_col)
   {
       foreach ($axys as $i_data)
       {
           $params_n = array_merge($params, array($i_data['value']));
           if (sizeof($this->comp_y_axys) > $level + 1)
           {
               $tab_col[$level]['label'] = $i_data['label'];
               $tab_col[$level]['group'] = $i_data['group'];
               $tab_col[$level]['value'] = $i_data['value'];
           }
           $b_subtotal = !(!$this->comp_tabular || ($this->comp_tabular && sizeof($this->comp_y_axys) == $level + 1));
           if (1)
           {
               $new_data = array();
               if ($this->comp_tabular)
               {
                   foreach ($tab_col as $i_tab_col => $a_col_data)
                   {
                       $new_data[] = array(
                           'level'  => $level,
                           'label'  => $this->getRatingGroupBy($a_col_data['label'], $a_col_data['value'], $a_col_data['group']),
                           'link'   => '',
                       );
                   }
               }
               if (!$b_subtotal)
               {
                   $new_data[] = array(
                       'level'  => $level,
                       'group'  => $i_data['group'],
                       'value'  => $i_data['value'],
                       'label'  => $this->getRatingGroupBy($i_data['label'], $i_data['value'], $i_data['group']),
                       'params' => $params_n,
                       'link'   => '',
                   );
               }
               elseif ($this->comp_tab_extend && $this->comp_tab_hover)
               {
                   $last_item                           = count($new_data) - 1;
                   $new_data[$last_item]['colspan']    = sizeof($this->comp_y_axys) - sizeof($params_n) + 1;
                   $new_data[$last_item]['display_as'] = 'subtotal';
                   if (!$this->comp_tab_label)
                   {
                       $new_data[$last_item]['label'] = $this->Ini->Nm_lang['lang_othr_chrt_totl'];
                   }
                   $new_data[$last_item]['link'] = '';
               }
               else
               {
                   $last_item = count($new_data) - 1;
                   $new_data[] = array(
                       'level'      => $level,
                       'group'      => $i_data['group'],
                       'value'      => $this->Ini->Nm_lang['lang_othr_chrt_totl'],
                       'label'      => $this->comp_tab_label ? $new_data[$last_item]['label'] : $this->Ini->Nm_lang['lang_othr_chrt_totl'],
                       'params'     => $params_n,
                       'link'       => '',
                       'colspan'    => sizeof($this->comp_y_axys) - sizeof($params_n),
                       'display_as' => 'subtotal'
                   );
               }
               $a_columns = 1 == sizeof($this->build_labels)
                          ? current($this->build_labels)
                          : $this->build_labels[sizeof($this->build_labels) - 1];
               if (0 < sizeof($this->comp_x_axys))
               {
                   $this->initTotalsX();
               }
               $i = 0;
               foreach ($a_columns as $a_col_data)
               {
                   if (-1 < $a_col_data['group'])
                   {
                       $val = $this->getCellValue($a_col_data['params'], $params_n);
                       $rat = $this->getCellRating($a_col_data['params'], $params_n);
                       $cnt = $this->getCellCount($a_col_data['params'], $params_n);
                       $fmt = isset($a_col_data['params']) ? $a_col_data['params'][sizeof($a_col_data['params']) - 1] : 0;
                       $key = '';
                       $lnk = $this->getDataLinkParams($params_n, $a_col_data['params']);
                       if (1 == sizeof($this->comp_x_axys))
                       {
                           $key = $this->addTotalsG($i_data, $a_col_data, $params, $val);
                       }
                       unset($a_col_data['chart']);
                       if (sizeof($this->comp_y_axys) - 1 > $level)
                       {
                           $a_chart_params = $a_col_data['params'];
                           unset($a_chart_params[sizeof($a_col_data['params']) - 1]);
                           if (0 < sizeof($params_n))
                           {
                               for ($j = 0; $j < sizeof($params_n); $j++)
                               {
                                   $a_chart_params[] = $params_n[$j];
                               }
                           }
                           $a_col_data['chart'] = ($i_data['group'] + 1). '|' . $fmt . '|' . implode('|', $a_chart_params);
                       }
                       $new_data[] = array(
                           'level'     => -1,
                           'value'     => $val,
                           'rating'    => $rat,
                           'format'    => $fmt,
                           'link_fld'  => (is_numeric($fmt)) ? $fmt + 1 : 0,
                           'link_data' => $lnk,
                           'chart'     => isset($a_col_data['chart']) ? $a_col_data['chart'] : '',
                           'css'       => isset($a_col_data['css'])   ? $a_col_data['css']   : '',
                           'subtotal'  => $b_subtotal,
                       );
                       $aCellColP = $a_col_data['params'];
                       if (0 < sizeof($this->comp_x_axys))
                       {
                           $i_col_x = array_pop($a_col_data['params']);
                           $this->addTotalsX($i_col_x, $val, $key, $cnt);
                           if (0 == $level && 0 < sizeof($this->comp_x_axys))
                           {
                               $this->addTotalsA ('anal', $i_col_x, $val, $a_col_data['params'][0]);
                               $this->addTotalsAL('anal', $i_col_x, $val, $i_data['value']);
                           }
                       }
                       if (($this->comp_tabular || 0 == $level) && !$b_subtotal)
                       {
                           $iTotalP   = array_pop($aCellColP);
                           $aCellParams = array(
                               'col' => $aCellColP,
                               'row' => array(),
                               'fnc' => $iTotalP
                           );
                           $this->addTotalsY($i, $val, $a_col_data['function'], $fmt, $aCellParams);
                       }
                       $i++;
                   }
               }
               if (0 < sizeof($this->comp_x_axys))
               {
                   $this->buildTotalsX($new_data, $i, $level, $i_data['label'], $b_subtotal);
               }
               if (!$b_subtotal)
               {
                   $this->build_total_row[$row] = false;
                   $data[$row] = $new_data;
                   $row++;
               }
               elseif ($this->show_totals_y && !empty($this->comp_sum))
               {
                   if (!isset($this->subtotal_data[$level]))
                   {
                       $this->subtotal_data[$level] = $new_data;
                   }
                   else
                   {
                       end($this->subtotal_data);
                       $i_max = key($this->subtotal_data);
                       for ($i = $i_max; $i >= $level; $i--)
                       {
                           $this->build_total_row[$row] = true;
                           $data[$row] = $this->subtotal_data[$i];
                           $row++;
                           if ($i != $level)
                           {
                               unset($this->subtotal_data[$i]);
                           }
                       }
                       $this->subtotal_data[$level] = $new_data;
                   }
               }
           }
           $this->addYChildrenData($i_data['children'], $data, $row, $level + 1, $params_n, $tab_col);
       }
   }

   function getDataLinkParams($param, $col)
   {
       $a_par = array();

       if (1 < sizeof($col))
       {
           for ($i = 0; $i < sizeof($col) - 1; $i++)
           {
               $a_par[] = $col[$i];
           }
       }

       return implode('|', array_merge($a_par, $param));
   }

   function getDataLink($field, $data, $value)
   {
       if (!isset($this->comp_sum_lnk[$field]) || !$this->comp_sum_lnk[$field]['show'])
       {
           return $value;
       }

       $s_link_field = $this->comp_sum_lnk[$field]['field'];

       $a_link = array(
       );

       if (!isset($a_link[$s_link_field]))
       {
           return $value;
       }

       $a_data = explode('|', $data);
       $a_par  = array();
       $b_ok   = true;

       foreach ($a_link[$s_link_field]['param'] as $s_param => $a_param)
       {
           if ('C' == $a_param['type'])
           {
               if (!isset($a_data[ $this->comp_field_nm[ $a_param['value'] ] ]))
               {
                   $b_ok = false;
               }
               else
               {
                   $a_par[$s_param] = $a_data[ $this->comp_field_nm[ $a_param['value'] ] ];
               }
           }
           else
           {
               $a_par[$s_param] = $a_param['value'];
           }
       }

       if (!$b_ok)
       {
           return $value;
       }

       $b_modal = false;
       if (false !== strpos($a_link[$s_link_field]['html'], '__NM_FLD_PAR_M__'))
       {
           $b_modal                       = true;
           $a_link[$s_link_field]['html'] = str_replace('__NM_FLD_PAR_M__', '__NM_FLD_PAR__', $a_link[$s_link_field]['html']);
       }

       $return = str_replace('__NM_FLD_PAR__', $this->getDataLinkValue($a_par), $a_link[$s_link_field]['html']) . $value . '</a>';

       return $b_modal ? $this->getModalLink($return) :  $return;
   }

   function getDataLinkValue($param)
   {
       $a_links = array();

       foreach ($param as $i => $v)
       {
           $a_links[] = $i . '?#?' . $v;
       }

       return implode('?@?', $a_links);
   }

   function getModalLink($param)
   {
       return str_replace(array('?#?', '?@?'), array('*scin', '*scout'), $param);
   }

   function getLabelLink($param, $i_tmp = -1, $bProtect = true)
   {
       $a_links = array();

       if (-1 == $i_tmp)
       {
           foreach ($param as $i => $v)
           {
               $i_fld     = $i + sizeof($this->comp_x_axys);
               $a_links[] = $this->comp_links_fl[$i_fld]['name'] . '?#?' . $this->comp_links_fl[$i_fld]['prot'] . addslashes($this->getChartText($v, $bProtect)) . $this->comp_links_fl[$i_fld]['prot'];
           }
       }
       else
       {
           for ($i = 0; $i <= $i_tmp; $i++)
           {
               $v         = (isset($param[$i])) ? $param[$i] : "";
               $i_fld     = $i + sizeof($this->comp_x_axys);
               $a_links[] = $this->comp_links_fl[$i_fld]['name'] . '?#?' . $this->comp_links_fl[$i_fld]['prot'] . addslashes($this->getChartText($v, $bProtect)) . $this->comp_links_fl[$i_fld]['prot'];
           }
       }

       $Parms_Res  = implode('?@?', $a_links);
       $Md5_Res    = "@SC_par@" . NM_encode_input($this->Ini->sc_page) . "@SC_par@grid_fiche_prof_sante_stat_wilaya@SC_par@" . md5($Parms_Res);
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['LigR_Md5'][md5($Parms_Res)] = $Parms_Res;
       return $Md5_Res;
   }

   function getChartLink($param, $bProtect = true)
   {
       $a_links = array();

       foreach ($param as $i => $v)
       {
           $a_links[] = $this->comp_links_fl[$i]['name'] . '?#?' . $this->comp_links_fl[$i]['prot'] . $this->getChartText($v, $bProtect) . $this->comp_links_fl[$i]['prot'];
       }

       return implode('?@?', $a_links);
   }

   function getCellCount($aColPar, $aRowPar)
   {
       array_pop($aColPar);
       $i_tot = 0;
       $a_val = (0 == sizeof($this->comp_x_axys))
              ? array_merge($aRowPar, array($i_tot))
              : array_merge($aColPar, $aRowPar, array($i_tot));
       return $this->getCompDataCell($a_val, $this->getCompData(sizeof($aColPar) + sizeof($aRowPar) - 1));
   }

   function getCellRating($aColPar, $aRowPar)
   {
       $i_tot = array_pop($aColPar);
       $a_val = (0 == sizeof($this->comp_x_axys))
              ? array_merge($aRowPar, array($i_tot))
              : array_merge($aColPar, $aRowPar, array($i_tot));
       return $this->getRatingSummarization($this->getCompDataCell($a_val, $this->getCompData(sizeof($aColPar) + sizeof($aRowPar) - 1)), $i_tot);
   }

   function getCellValue($aColPar, $aRowPar)
   {
       $i_tot = array_pop($aColPar);
       $a_val = (0 == sizeof($this->comp_x_axys))
              ? array_merge($aRowPar, array($i_tot))
              : array_merge($aColPar, $aRowPar, array($i_tot));
       return $this->getCompDataCell($a_val, $this->getCompData(sizeof($aColPar) + sizeof($aRowPar) - 1));
   }

   function getCompDataCell($par, $data)
   {
       $key = key($par);
       $cur = $par[$key];
       if (is_array($data[$cur]))
       {
           unset($par[$key]);
           return $this->getCompDataCell($par, $data[$cur]);
       }
       elseif (isset($data[$cur]))
       {
           return $data[$cur];
       }
       elseif (!$this->comp_sum_fill_0)
       {
           return '';
       }
       else
       {
           return 0;
       }
   }

   function makeTabular(&$a_data)
   {
       if ($this->comp_tabular)
       {
           $a_labels = array();
   if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert'])
   {
     $this->comp_tab_hover = true;
   }
           if ($this->comp_tab_hover)
           {
               foreach ($a_data as $row => $columns)
               {
                   for ($i = 0; $i < sizeof($this->comp_y_axys) - 1; $i++)
                   {
                      if (!isset($a_labels[$i]))
                      {
                          $a_labels[$i] = '';
                      }
                      if (isset($a_data[$row][$i]) && !isset($a_data[$row][$i]['display_as']))
                      {
                          if (isset($columns[$i]['label']) && $a_labels[$i] == $columns[$i]['label'])
                          {
                              $a_data[$row][$i]['display_as'] = 'none';
                          }
                          else
                          {
                              $a_data[$row][$i]['display_as'] = 'auto';
                          }
                      }
                      $a_labels[$i] = (isset($columns[$i]['label'])) ? $columns[$i]['label'] : "";
                   }
               }
           }
           else
           {
               foreach ($a_data as $row => $columns)
               {
                   for ($i = 0; $i < sizeof($this->comp_y_axys) - 1; $i++)
                   {
                       if (!isset($a_labels[$i]))
                       {
                           $a_labels[$i] = array(
                               'old'  => $columns[$i]['label'],
                               'row'  => $row,
                               'span' => 1,
                           );
                       }
                       elseif ($a_labels[$i]['old'] == $columns[$i]['label'])
                       {
                           unset($a_data[$row][$i]);
                           $a_labels[$i]['span']++;
                       }
                       else
                       {
                           $a_data[ $a_labels[$i]['row'] ][$i]['rowspan'] = $a_labels[$i]['span'];
                           $a_labels[$i]['old']  = $columns[$i]['label'];
                           $a_labels[$i]['row']  = $row;
                           $a_labels[$i]['span'] = 1;
                       }
                   }
               }
               foreach ($a_labels as $i_col => $a_col_data)
               {
                   $a_data[ $a_col_data['row'] ][$i_col]['rowspan'] = $a_col_data['span'];
               }
           }
       }
   }

   function initTotalsX()
   {
       $this->comp_totals_x = array();

       if (!$this->show_totals_x)
       {
           return;
       }

       foreach ($this->comp_sum_order as $i_sum)
       {
           if ($this->comp_sum_display[$i_sum])
           {
               $l_sum = $this->comp_sum[$i_sum];
               $this->comp_totals_x[$i_sum - 1] = array('values' => array(), 'count' => array(), 'chart' => '');
           }
       }
   }

   function addTotalsX($col, $val, $chart, $count)
   {
       if (!$this->show_totals_x)
       {
           return;
       }

       $this->comp_totals_x[$col]['chart'] = $chart;
       $this->comp_totals_x[$col]['count'][] = $count;
       if (isset($this->comp_rating_sum[$col]) && '' != $this->comp_rating_sum[$col] && method_exists($this, $this->comp_rating_sum[$col])) {
           $this->comp_totals_x[$col]['values'][] = json_decode($val, true);
       } else {
           $this->comp_totals_x[$col]['values'][] = $val;
       }
   }

   function buildTotalsX(&$row, $col, $level, $label, $sub)
   {
       if (!$this->show_totals_x)
       {
           return;
       }

       foreach ($this->comp_sum_order as $i_sum)
       {
           if ($this->comp_sum_display[$i_sum])
           {
               $l_sum = $this->comp_sum[$i_sum];
               if (isset($this->comp_rating_sum[$i_sum - 1]) && '' != $this->comp_rating_sum[$i_sum - 1] && method_exists($this, $this->comp_rating_sum[$i_sum - 1])) {
                   $i_temp[$i_sum - 1] = array();
               } else {
                   $i_temp[$i_sum - 1] = '';
               }
               $i_count[$i_sum - 1] = 0;
           }
       }

       $key = key($this->comp_totals_x);

       for ($i = 0; $i < sizeof($this->comp_totals_x[$key]['values']); $i++)
       {
           foreach ($this->comp_sum_order as $i_sum)
           {
               if ($this->comp_sum_display[$i_sum])
               {
                   if (isset($this->comp_rating_sum[$i_sum - 1]) && '' != $this->comp_rating_sum[$i_sum - 1] && method_exists($this, $this->comp_rating_sum[$i_sum - 1])) {
                       foreach ($this->comp_totals_x[$i_sum - 1]['values'][$i]['vls'] as $ratingValue => $ratingCount) {
                           if (!isset($i_temp[$i_sum - 1][$ratingValue])) {
                               $i_temp[$i_sum - 1][$ratingValue] = 0;
                           }
                           $i_temp[$i_sum - 1][$ratingValue] += $ratingCount;
                       }
                       continue;
                   }
                   if ('' == $this->comp_totals_x[$i_sum - 1]['values'][$i])
                   {
                       $this->comp_totals_x[$i_sum - 1]['values'][$i] = 0;
                   }
                   $l_sum = $this->comp_sum[$i_sum];
                   $this_count = (int) $this->comp_totals_x[$i_sum - 1]['count'][$i];
                   if ('' == $i_temp[$i_sum - 1])
                   {
                       if ('A' == $this->comp_sum_fn[$i_sum])
                       {
                           $i_temp[$i_sum - 1] = $this->comp_totals_x[$i_sum - 1]['values'][$i] * $this_count;
                       } else {
                           $i_temp[$i_sum - 1] = $this->comp_totals_x[$i_sum - 1]['values'][$i];
                       }
                   }
                   elseif ('M' == $this->comp_sum_fn[$i_sum] && '' !== $this->comp_totals_x[$i_sum - 1]['values'][$i])
                   {
                       $i_temp[$i_sum - 1] = min($i_temp[$i_sum - 1], $this->comp_totals_x[$i_sum - 1]['values'][$i]);
                   }
                   elseif ('X' == $this->comp_sum_fn[$i_sum])
                   {
                       $i_temp[$i_sum - 1] = max($i_temp[$i_sum - 1], $this->comp_totals_x[$i_sum - 1]['values'][$i]);
                   }
                   else
                   {
                       if ('A' == $this->comp_sum_fn[$i_sum])
                       {
                           $i_temp[$i_sum - 1] += ($this->comp_totals_x[$i_sum - 1]['values'][$i] * $this_count);
                       } else {
                           $i_temp[$i_sum - 1] += $this->comp_totals_x[$i_sum - 1]['values'][$i];
                       }
                   }
                   $i_count[$i_sum - 1] += $this_count;
               }
           }
       }
       foreach ($this->comp_sum as $i_sum => $l_sum)
       {
           if (isset($this->comp_rating_sum[$i_sum - 1]) && '' != $this->comp_rating_sum[$i_sum - 1] && method_exists($this, $this->comp_rating_sum[$i_sum - 1])) {
               continue;
           }
           if ('A' == $this->comp_sum_fn[$i_sum] && isset($this->comp_totals_x[$i_sum - 1]['values']) && is_numeric($i_count[$i_sum - 1]))
           {
               $i_temp[$i_sum - 1] /= $i_count[$i_sum - 1];
           }
           if ('%' == $this->comp_sum_fn[$i_sum])
           {
               $i_temp[$i_sum - 1] = 100.00;
           }
       }
       foreach ($this->comp_sum_order as $i_sum)
       {
           if ($this->comp_sum_display[$i_sum])
           {
               $l_sum = $this->comp_sum[$i_sum];
               $row[] = array(
                   'total'  => true,
                   'level'  => -1,
                   'value'  => $i_temp[$i_sum - 1],
                   'rating' => $this->getRatingSummarization($i_temp[$i_sum - 1], $i_sum - 1, true),
                   'format' => $i_sum - 1,
                   'chart'  => $this->comp_totals_x[$i_sum - 1]['chart'],
               );
               if (0 == $level && 0 < sizeof($this->comp_x_axys))
               {
                   $this->addTotalsA('sint', $i_sum - 1, $i_temp[$i_sum - 1], $label);
               }
               if (($this->comp_tabular || 0 == $level) && !$sub)
               {
                   $aCellParams = array(
                       'col' => false,
                       'row' => array(),
                       'fnc' => $i_sum - 1
                   );
                   $this->addTotalsY($col + ($i_sum - 1), $i_temp[$i_sum - 1], $this->comp_sum_fn[$i_sum], $i_sum - 1, $aCellParams);
               }
           }
       }
   }

   function addTotalsA($mode, $col, $val, $label)
   {
       if (!isset($this->comp_totals_a[$col]))
       {
           $this->comp_totals_a[$col] = array(
               'labels' => array(),
               'values' => array(
                   'anal' => array(),
                   'sint' => array(),
               ),
           );
       }
       if ('sint' == $mode)
       {
           $this->comp_totals_a[$col]['labels'][]         = $label;
           $this->comp_totals_a[$col]['values']['sint'][] = $val;
       }
       elseif ('anal' == $mode)
       {
           if (isset($this->comp_index[ $this->comp_x_axys[0] ][$label]))
           {
               $label = $this->comp_index[ $this->comp_x_axys[0] ][$label];
           }
           $this->comp_totals_a[$col]['values']['anal'][$label][] = $val;
       }
   }

   function addTotalsAL($mode, $col, $val, $label)
   {
       if (!isset($this->comp_totals_al[$col]))
       {
           $this->comp_totals_al[$col] = array(
               'labels' => array(),
               'values' => array(
                   'anal' => array(),
                   'sint' => array(),
               ),
           );
       }
       if ('sint' == $mode)
       {
           $this->comp_totals_al[$col]['labels'][]         = $label;
           $this->comp_totals_al[$col]['values']['sint'][] = $val;
       }
       elseif ('anal' == $mode)
       {
           if (isset($this->comp_index[ $this->comp_y_axys[0] ][$label]))
           {
               $label = $this->comp_index[ $this->comp_y_axys[0] ][$label];
           }
           $this->comp_totals_al[$col]['values']['anal'][$label][] = $val;
       }
   }

   function addTotalsY($col, $val, $fun, $fmt, $par = array())
   {
       if (!$this->show_totals_y)
       {
           return;
       }

       if (!isset($this->comp_totals_y[$col]))
       {
           $this->comp_totals_y[$col] = array(
               'format'   => $fmt,
               'function' => $fun,
               'param_c'  => empty($par) ? false : $par['col'],
               'param_r'  => empty($par) ? false : $par['row'],
               'param_f'  => empty($par) ? ''    : $par['fnc'],
               'values'   => array(),
           );
       }
       $this->comp_totals_y[$col]['values'][] = $val;
   }

   function buildTotalsY(&$matrix)
   {
       if (!$this->show_totals_y)
       {
           return;
       }

       $row = sizeof($matrix);

       $this->build_total_row[$row] = true;

       $matrix[$row][] = array(
           'group'      => -1,
           'value'      => $this->Ini->Nm_lang['lang_msgs_totl'],
           'label'      => $this->Ini->Nm_lang['lang_msgs_totl'],
           'params'     => array(),
           'colspan'    => $this->comp_tabular ? sizeof($this->comp_y_axys) : 1,
           'display_as' => $this->comp_tab_hover ? 'total' : 'total'
       );

       $aTotals = array();
       foreach ($this->comp_totals_y as $cols)
       {
           $iSum           = empty($cols['param_c']) ? $this->getColumnTotal(false, $cols['param_f']) : $this->getColumnTotal($cols['param_c'], $cols['param_f']);
           if ($cols['function'] == "%") {
               $iSum = 100.00;
           }
           $aTotals[]      = $iSum;
           $matrix[$row][] = array(
               'total'  => true,
               'level'  => -1,
               'value'  => $iSum,
               'format' => $cols['format'],
           );
           $this->array_general_total[] = $iSum;
       }

       if (1 == sizeof($this->comp_x_axys))
       {
           $i_count = 0;
           $aLabels = array();
           foreach ($this->comp_index[0] as $group_label)
           {
               $aLabels[] = $group_label;
               foreach ($this->comp_sum as $i_sum => $l_sum)
               {
                   $this->comp_totals_al[$i_sum - 1]['values']['sint'][] = $aTotals[$i_count];
                   $i_count++;
               }
           }
           foreach ($this->comp_sum as $i_sum => $l_sum)
           {
               $this->comp_totals_al[$i_sum - 1]['labels'] = $aLabels;
           }
       }
   }

   function addTotalsG($line, $column, $param, $value)
   {
       $s_item  = $column['params'][0];
       $i_total = $column['params'][1];
       $param[] = $line['value'];
       $s_key   = 'G|' . $i_total . '|' . implode('|', $param);

       if (!isset($this->comp_totals_g[$s_key]))
       {
           $this->comp_totals_g[$s_key] = array(
               'title'    => $this->getChartText($this->comp_sum[$i_total + 1]),
               'show_sub' => true,
               'subtitle' => $this->getChartText($this->getChartSubtitle($param, 1)),
               'field_x'  => $this->getCompFieldName(0),
               'field_y'  => $this->comp_sum_nm[$i_total + 1],
               'label_x'  => $this->getChartText($this->comp_field[0]),
               'label_y'  => $this->getChartText($this->comp_sum[$i_total + 1]),
               'labels'   => array(),
               'values'   => array(
               'sint'     => array(0 => array()),
               ),
           );
       }

       $this->comp_totals_g[$s_key]['labels'][]            = isset($this->comp_index[0][$s_item]) ? $this->comp_index[0][$s_item] : $s_item;
       $this->comp_totals_g[$s_key]['values']['sint'][0][] = $value;

       return $s_key;
   }

   function getCompFieldName($index)
   {
       foreach ($this->comp_field_nm as $fieldName => $fieldIndex) {
           if ($index == $fieldIndex) {
               return $fieldName;
           }
       }
       return '';
   }

   function getColumnTotal($param_c, $param_f)
   {
       $paramCompRatingSum = $param_f;
       if (false == $param_c)
       {
           $final_data = $this->array_total_geral;
           if (empty($final_data)) {
               return "";
           }
           $param_f   -= 1;
       }
       else
       {
           if (1 == count($this->comp_x_axys)) {
               $return = $this->array_total_statut_maladie;
           }
           elseif (2 == count($this->comp_x_axys)) {
               $return = $this->array_total_maladie_confirmee_labo;
           }
           $final_data = $this->getColumnTotalData($param_c, $return);
       }
       if (isset($this->comp_rating_sum[$paramCompRatingSum]) && '' != $this->comp_rating_sum[$paramCompRatingSum] && method_exists($this, $this->comp_rating_sum[$paramCompRatingSum])) {
           $fnName = $this->comp_rating_sum[$paramCompRatingSum];
           return $this->$fnName($final_data[$param_f]);
       } else {
           return $final_data[$param_f];
       }
   }

   function getColumnTotalData($param_c, $data)
   {
       $elem = array_shift($param_c);

       if (empty($param_c))
       {
            return $data[$elem];
       }
       else
       {
           return $this->getColumnTotalData($param_c, $data[$elem]);
       }
   }

   function buildColumnTotal($fun, $rows)
   {
       $total = '';

       foreach ($rows as $val)
       {
           if ('' == $total)
           {
               $total = $val;
           }
           elseif ('M' == $fun && '' !== $val)
           {
               $total = min($total, $val);
           }
           elseif ('X' == $fun)
           {
               $total = max($total, $val);
           }
           else
           {
               $total += $val;
           }
       }

       if ('A' == $fun)
       {
           $total /= sizeof($rows);
       }
       if ('%' == $fun)
       {
           $total = 100.00;
       }
       if ('W' == $fun || 'V' == $fun || 'P' == $fun)
       {
           $total = "";
       }

       return $total;
   }

   function buildChart()
   {
       $this->comp_chart_data   = array();

       $Lab_statut_maladie = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_statut_maladie'] . "";
       $Lab_maladie_confirmee_labo = "" . $this->Ini->Nm_lang['lang_public_fiche_prof_sante_fld_maladie_confirmee_labo'] . "";
       $this->comp_chart_config = array(
           '0|1' => array(
               'title'    => $this->getChartText(strip_tags("" .  $this->Ini->Nm_lang['lang_btns_smry_msge_cnt'] . "")),
               'show_sub' => true,
               'subtitle' => "",
               'field_x'  => 'statut_maladie',
               'field_y'  => $this->comp_sum_nm[2],
               'label_x'  => $this->getChartText(strip_tags($Lab_statut_maladie)),
               'label_y'  => $this->getChartText(strip_tags("" .  $this->Ini->Nm_lang['lang_btns_smry_msge_cnt'] . "")),
               'format'   => $this->formatChartValue(1),
           ),
           '1|1' => array(
               'title'    => $this->getChartText(strip_tags("" .  $this->Ini->Nm_lang['lang_btns_smry_msge_cnt'] . "")),
               'show_sub' => true,
               'subtitle' => "",
               'field_x'  => 'maladie_confirmee_labo',
               'field_y'  => $this->comp_sum_nm[2],
               'label_x'  => $this->getChartText(strip_tags($Lab_maladie_confirmee_labo)),
               'label_y'  => $this->getChartText(strip_tags("" .  $this->Ini->Nm_lang['lang_btns_smry_msge_cnt'] . "")),
               'format'   => $this->formatChartValue(1),
           ),
           'T|1' => array(
               'title'    => $this->getChartText(""),
               'show_sub' => true,
               'subtitle' => "",
               'label_x'  => $this->getChartText(""),
               'label_y'  => $this->getChartText(""),
               'format'   => $this->formatChartValue(1),
           ),
       );

       $aTotalGeneral = false ? $this->comp_totals_al : $this->comp_totals_a;
       if (!empty($aTotalGeneral))
       {
           foreach ($aTotalGeneral as $i_total => $a_total)
           {
               if (isset($this->comp_chart_config['T|' . $i_total]))
               {
                   if (false)
                   {
                       $sTitleAxysX  = $this->comp_field[0];
                       $sTitleLegend = '' != $this->comp_chart_config[$key]['label_x']  ? $this->comp_chart_config[$key]['label_x']  : $this->getChartText($this->comp_field[sizeof($this->comp_x_axys)]);
                   }
                   else
                   {
                       $sTitleAxysX  = '' != $this->comp_chart_config[$key]['label_x']  ? $this->comp_chart_config[$key]['label_x']  : $this->getChartText($this->comp_field[sizeof($this->comp_x_axys)]);
                       $sTitleLegend = $this->comp_field[0];
                   }
                   $key = 'T|' . $i_total;
                   $this->comp_chart_data[$key] = array(
                       'title'    => '' != $this->comp_chart_config[$key]['title']    ? $this->comp_chart_config[$key]['title']    : $this->getChartText($this->Ini->Nm_lang['lang_othr_chrt_totl']),
                       'show_sub' => $this->comp_chart_config[$key]['show_sub'],
                       'subtitle' => '' != $this->comp_chart_config[$key]['subtitle'] ? $this->comp_chart_config[$key]['subtitle'] : $this->getChartText($this->comp_sum[$i_total + 1]),
                       'legend'   => $sTitleLegend,
                       'label_x'  => $sTitleAxysX,
                       'label_y'  => '' != $this->comp_chart_config[$key]['label_y']  ? $this->comp_chart_config[$key]['label_y']  : $this->getChartText($this->comp_sum[$i_total + 1]),
                       'format'   => $this->comp_chart_config[$key]['format'],
                       'labels'   => $a_total['labels'],
                       'values'   => array(
                           'anal' => $a_total['values']['anal'],
                           'sint' => array($a_total['values']['sint']),
                       ),
                   );
               }
           }
       }

       foreach ($this->comp_y_axys as $i_group)
       {
           $this->addGroupCharts($this->comp_chart_data, $this->getCompData($i_group), $i_group, $i_group, array());
       }

       if (!empty($this->comp_totals_g))
       {
           foreach ($this->comp_totals_g as $chart => $data)
           {
               $info = explode('|', $chart);
               $key  = 'G|' . (sizeof($info) - 2) . '|' . $info[1];
               if (isset($this->comp_chart_config[$key]))
               {
                   $this->comp_chart_data[$chart]             = $data;
                   $this->comp_chart_data[$chart]['show_sub'] = $this->comp_chart_config[$key]['show_sub'];
                   if ('' != $this->comp_chart_config[$key]['title'])
                   {
                       $this->comp_chart_data[$chart]['title'] = $this->comp_chart_config[$key]['title'];
                   }
                   if ('' != $this->comp_chart_config[$key]['subtitle'])
                   {
                       $this->comp_chart_data[$chart]['subtitle'] = $this->comp_chart_config[$key]['subtitle'];
                   }
                   if ('' != $this->comp_chart_config[$key]['label_x'])
                   {
                       $this->comp_chart_data[$chart]['label_x'] = $this->comp_chart_config[$key]['label_x'];
                   }
                   if ('' != $this->comp_chart_config[$key]['label_y'])
                   {
                       $this->comp_chart_data[$chart]['label_y'] = $this->comp_chart_config[$key]['label_y'];
                   }
               }
           }
       }
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts']    = $this->comp_chart_data;
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_orig']      = $this->comp_chart_data;
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['comb_table_data'] = array();
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['comb_table_def']  = array();
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['anlt_table_data'] = array();
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['anlt_table_def']  = array();

       $this->filterChartsByGroupbyLevel();


       require_once($this->Ini->path_aplicacao . $this->Ini->Apl_grafico); 
       $this->Graf  = new grid_fiche_prof_sante_stat_wilaya_grafico();
       $this->Graf->Db     = $this->Db;
       $this->Graf->Erro   = $this->Erro;
       $this->Graf->Ini    = $this->Ini;
       $this->Graf->Lookup = $this->Lookup;
       foreach ($this->comp_chart_data as $sChartKey => $aChartData)
       {
           $this->Graf->monta_grafico($sChartKey, 'xml');
       }
   }

	function filterChartsByGroupbyLevel() {
		global $nmgp_opcao;

		$applyFilter = false;

		if (isset($nmgp_opcao) && ('pdf' == $nmgp_opcao || 'pdf_res' == $nmgp_opcao) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_level']) && '' !== $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_level']) {
			$applyFilter = true;
		}
		elseif (isset($nmgp_opcao) && 'image_res' == $nmgp_opcao && isset($_POST['chart_level']) && '' !== $_POST['chart_level']) {
			$applyFilter = true;
			$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_level'] = $_POST['chart_level'];
		}
		elseif (isset($nmgp_opcao) && 'print_res' == $nmgp_opcao && isset($_POST['chart_level']) && '' !== $_POST['chart_level']) {
			$applyFilter = true;
			$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_level'] = $_POST['chart_level'];
		}
		elseif ($this->Ini->sc_export_ajax && isset($_POST['chart_level']) && '' !== $_POST['chart_level']) {
			$applyFilter = true;
			$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_level'] = $_POST['chart_level'];
		}

		$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_orig'];

		if ($applyFilter) {
			foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts'] as $chartIndex => $chartData) {
				$indexParts = explode('|', $chartIndex);

				if (in_array($indexParts[0], array('C', 'G', 'T'))) {
					$groupbyLevel = $indexParts[1];
				}
				else {
					$groupbyLevel = $indexParts[0];
				}

				if ($groupbyLevel > $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_level']) {
					unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts'][$chartIndex]);
				}
			}
		}

		$this->comp_chart_data = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts'];
	}

   function formatChartValue($total)
   {
       $arr_param = array();

       if ($total == 1)
       {
           $arr_param = array(
               'decimals'          => "0",
               'decimalSeparator'  => "",
               'thousandSeparator' => "",
               'trailingZeros'     => "0",
               'monetarySymbol'    => "",
               'monetaryPosition'  => "",
               'monetarySpace'     => "",
               'monetaryDecimal'   => "",
               'monetaryThousands' => "",
               'formatNumberScale' => "0",
               'forceDecimals'     => "",
           );
       }

       $sMonetIni = '';
       $sMonetEnd = '';

       if ('' != $arr_param['monetarySymbol'])
       {
           if ('' == $arr_param['monetaryPosition'] || 'left' == $arr_param['monetaryPosition'])
           {
               $sMonetIni = $arr_param['monetarySymbol'] . $arr_param['monetarySpace'];
               $sMonetEnd = '';
           }
           else
           {
               $sMonetIni = '';
               $sMonetEnd = $arr_param['monetarySpace'] . $arr_param['monetarySymbol'];
           }
           $arr_param['decimalSeparator']  = $arr_param['monetaryDecimal'];
           $arr_param['thousandSeparator'] = $arr_param['monetaryThousands'];
       }
       if ('' == $arr_param['decimals'])
       {
           $arr_param['decimals'] = 0;
           unset($arr_param['trailingZeros']);
       }
       elseif (1 != $arr_param['forceDecimals'])
       {
           $arr_param['forceDecimals'] = 0;
       }
       else
       {
           $arr_param['forceDecimals'] = 1;
       }
       if ('' == $arr_param['trailingZeros'])
       {
           unset($arr_param['trailingZeros']);
       }
       if ('' != $sMonetIni)
       {
           $arr_param['numberPrefix'] = $sMonetIni;
       }
       if ('' != $sMonetEnd)
       {
           $arr_param['numberSuffix'] = $sMonetEnd;
       }
       unset($arr_param['monetarySymbol']);
       unset($arr_param['monetaryPosition']);
       unset($arr_param['monetarySpace']);
       unset($arr_param['monetaryDecimal']);
       unset($arr_param['monetaryThousands']);

       if (',' == $arr_param['decimalSeparator'])
       {
           unset($arr_param['decimalSeparator']);
           $arr_param['decimalSeparator'] = ',';
       }
       if (',' == $arr_param['thousandSeparator'])
       {
           unset($arr_param['thousandSeparator']);
           $arr_param['thousandSeparator'] = ',';
       }

       if (isset($arr_param['formatNumberScale']) && '1' == $arr_param['formatNumberScale'])
       {
           unset($arr_param['trailingZeros']);
           $arr_param['decimals'] = 0;
       }

       foreach ($arr_param as $i => $v)
       {
           if ('' === $v)
           {
               unset($arr_param[$i]);
           }
       }

       return $arr_param;
   }

   function addGroupCharts(&$charts, $data, $group, $level, $param)
   {
       if (0 == $level)
       {
           $a_keys   = array();
           $a_totals = array();
           $this->getKeysTotals($a_keys, $a_totals, $data, $param);
           foreach ($a_totals as $i_total => $values)
           {
               $key_data  = $key_config = $group . '|' . $i_total;
               $key_data .= '|' . implode('|', $param);
               if (isset($this->comp_chart_config[$key_config]))
               {
                   $this->comp_chart_data[$key_data]                      = $this->comp_chart_config[$key_config];
                   $this->comp_chart_data[$key_data]['param']             = $param;
                   $this->comp_chart_data[$key_data]['summ_idx']          = $i_total;
                   $this->comp_chart_data[$key_data]['summ_fn']           = $this->comp_sum_fn[$i_total + 1];
                   $this->comp_chart_data[$key_data]['labels']            = $this->getGroupLabels($group, $a_keys);
                   $this->comp_chart_data[$key_data]['db_values']         = $a_keys;
                   $this->comp_chart_data[$key_data]['label_order']       = $this->comp_order[$group];
                   $this->comp_chart_data[$key_data]['values']['sint'][0] = $values;
                   $grid_links = array();
                   $xml_links  = array();
                   foreach ($a_keys as $tmp_key)
                   {
                       $link_index   = array_merge($param, array($tmp_key));
                       $grid_links[] = $this->getChartLink($link_index, -1);
                       $xml_links[]  = $this->getFusionLink('sc_grid_fiche_prof_sante_stat_wilaya_' . session_id() . '_!!!' . implode('_', array_merge(array($group + 1, $i_total), $link_index)) . '!!!.json');
                   }
                   $this->comp_chart_data[$key_data]['grid_links'] = $grid_links;
                   $this->comp_chart_data[$key_data]['xml_links']  = (sizeof($this->comp_y_axys) > $group + 1) ? $xml_links : array();
                   $this->comp_chart_data[$key_data]['xml']        = $this->getFusionLink('sc_grid_fiche_prof_sante_stat_wilaya_' . session_id() . '_!!!' . implode('_', array_merge(array($group, $i_total), $param)) . '!!!.json');
                   if (0 < $group && !empty($param))
                   {
                       $this->comp_chart_data[$key_data]['subtitle'] = $this->getChartText($this->getChartSubtitle($param));
                   }
                   if (0 == sizeof($this->comp_x_axys) && empty($param))
                   {
                       $this->getAnaliticCharts($i_total, $this->comp_chart_data[$key_data]);
                   }
               }
           }
       }
       else
       {
           foreach ($data as $key => $list)
           {
               $this->addGroupCharts($charts, $list, $group, $level - 1, array_merge($param, array($key)));
           }
       }
   }

   function getFusionLink($originalLink)
   {
       $linkParts = explode('!!!', $originalLink);

       if (1 == count($linkParts)) {
           return $originalLink;
       }

       $linkParts[1] = md5($linkParts[1]);

       return implode('', $linkParts);
   }

   function getKeysTotals(&$a_keys, &$a_totals, $data, $param)
   {
       for ($i = 0; $i < sizeof($this->comp_x_axys); $i++)
       {
           $key_param = key($param);
           unset($param[$key_param]);
       }
       $list_data = $this->comp_chart_axys;
       foreach ($param as $now_param)
       {
           $list_data = $list_data[$now_param]['children'];
       }
       $list_data = (is_array($list_data)) ? array_keys($list_data) : array();
       $size = sizeof($this->comp_sum_dummy);
       foreach ($list_data as $k_group)
       {
           if (isset($data[$k_group])) {
               $totals = $data[$k_group];
           }
           else {
               $totals = $this->comp_sum_dummy;
           }
           $a_keys[] = $k_group;
           $count    = 0;
           foreach ($totals as $i_total => $v_total)
           {
               if ($count == $size)
               {
                   break;
               }
               $a_totals[$i_total][] = $v_total;
               $count++;
           }
       }
       if (!empty($param))
       {
           $a_indexes = $this->getRealIndexes($this->comp_chart_axys, $param);
           foreach ($a_keys as $i => $v)
           {
               if (!in_array($v, $a_indexes))
               {
                   unset($a_keys[$i]);
                   foreach ($a_totals as $t => $l)
                   {
                       unset($a_totals[$t][$i]);
                   }
               }
           }
           $a_keys = array_values($a_keys);
           foreach ($a_totals as $t => $l)
           {
               $a_totals[$t] = array_values($a_totals[$t]);
           }
       }
   }

   function getRealIndexes($data, $param)
   {
       if (empty($param))
       {
           $a_indexes = array();
           foreach ($data as $i => $v)
           {
               $a_indexes[] = $i;
           }
           return $a_indexes;
       }
       else
       {
           $key = key($param);
           $val = $param[$key];
           unset($param[$key]);
           return $this->getRealIndexes($data[$val]['children'], $param);
       }
   }

   function getGroupLabels($group, $keys)
   {
       $a_labels = array();
       foreach ($keys as $key)
       {
           $a_labels[] = isset($this->comp_index[$group][$key]) ? $this->comp_index[$group][$key] : $key;
       }
       return $a_labels;
   }

   function getChartSubtitle($param, $s = 0)
   {
       $a_links = array();

       foreach ($param as $i => $v)
       {
           $a_links[] = $this->comp_field[$i + $s] . ' = ' . $this->comp_index[$i + $s][$v];
       }

       return implode(' :: ', $a_links);
   }

   function getAnaliticCharts($total, &$chart_data)
   {
       $chart_data['labels_anal']           = array();
       $chart_data['legend']                = (isset($this->comp_field[1])) ? $this->comp_field[1] : "";
       $chart_data['values']['anal']        = array();
       $chart_data['values']['anal_values'] = array();
       $chart_data['values']['anal_links']  = array();

       foreach ($this->comp_index[0] as $i_0 => $v_0)
       {
           $chart_data['labels_anal'][] = $v_0;
       }
      if (isset($this->comp_index[1])) {
       foreach ($this->comp_index[1] as $i_1 => $v_1)
       {
           $chart_data['values']['anal'][$v_1] = array();
           foreach ($this->comp_index[0] as $i_0 => $v_0)
           {
               $vCompData                                  = $this->getCompData(1, array($i_0, $i_1, $total));
               $chart_data['values']['anal'][$v_1][]       = isset($vCompData) ? $vCompData : 0;
               $chart_data['values']['anal_values'][$v_1]  = $i_1;
               $chart_data['values']['anal_links'][$i_1][] = $this->getChartLink(array($i_0, $i_1), -1);
           }
       }
      }
   }

   function getChartText($s, $bProtect = true)
   {
       if (!$bProtect)
       {
           return $s;
       }
       if ('UTF-8' != $_SESSION['scriptcase']['charset'])
       {
           $s = sc_convert_encoding($s, 'UTF-8', $_SESSION['scriptcase']['charset']);
       }
       return function_exists('html_entity_decode') ? html_entity_decode($s, ENT_COMPAT | ENT_HTML401, 'UTF-8') : $s;
   }

   function drawMatrix()
   {
       global $nm_saida;

       if ($this->NM_export)
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_export']['label'] = $this->build_labels;
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_export']['data']  = $this->build_data;
           return;
       }

       $nm_saida->saida("<tr id=\"summary_body\" class='sc-mobile-inner-control'>\r\n");
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
       { 
           $_SESSION['scriptcase']['saida_html'] = "";
       } 
      $TD_padding = (!$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == "pdf") ? " style=\"padding: 0px !important;\"" : "";
       $nm_saida->saida("<td class=\"" . $this->css_scGridTabelaTd . " sc-mobile-inner-control\"" . $TD_padding . ">\r\n");
       $nm_saida->saida("<table class=\"scGridTabela\" id=\"sc-ui-summary-body\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top; width: 100%;\">\r\n");

       $this->drawMatrixLabels();
      if ($this->comp_tab_hover)
      {
          $nm_saida->saida("    <script type=\"text/javascript\">\r\n");
          $nm_saida->saida("        $(function() {\r\n");
          $nm_saida->saida("            $(\".scGridSummaryLine\").click(function() {\r\n");
          $nm_saida->saida("              var bHasClicked = $(this).find(\".scGridSummaryLineOdd\").hasClass(\"scGridSummaryClickedLine\") || $(this).find(\".scGridSummaryLineEven\").hasClass(\"scGridSummaryClickedLine\") || $(this).find(\".scGridSummarySubtotal\").hasClass(\"scGridSummaryClickedSubtotal\") || $(this).find(\".scGridSummaryTotal\").hasClass(\"scGridSummaryClickedTotal\");\r\n");
          $nm_saida->saida("              $(\".scGridSummaryLineOdd\").removeClass(\"scGridSummaryClickedLine\");\r\n");
          $nm_saida->saida("              $(\".scGridSummaryLineEven\").removeClass(\"scGridSummaryClickedLine\");\r\n");
          $nm_saida->saida("              $(\".scGridSummaryGroupbyVisible\").removeClass(\"scGridSummaryClickedGroupbyVisible\");\r\n");
          $nm_saida->saida("              $(\".scGridSummaryGroupbyInvisible\").removeClass(\"scGridSummaryClickedGroupbyInvisible\");\r\n");
          $nm_saida->saida("              $(\".scGridSummaryGroupbyInvisibleDisplay\").removeClass(\"scGridSummaryClickedGroupbyInvisibleDisplay\");\r\n");
          $nm_saida->saida("              $(\".scGridSummarySubtotal\").removeClass(\"scGridSummaryClickedSubtotal\");\r\n");
          $nm_saida->saida("              $(\".scGridSummaryTotal\").removeClass(\"scGridSummaryClickedTotal\");\r\n");
          $nm_saida->saida("              if (!bHasClicked) {\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummaryLineOdd\").addClass(\"scGridSummaryClickedLine\");\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummaryLineEven\").addClass(\"scGridSummaryClickedLine\");\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummaryGroupbyVisible\").addClass(\"scGridSummaryClickedGroupbyVisible\");\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummaryGroupbyInvisible\").addClass(\"scGridSummaryClickedGroupbyInvisible\");\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummaryGroupbyInvisibleDisplay\").addClass(\"scGridSummaryClickedGroupbyInvisibleDisplay\");\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummarySubtotal\").addClass(\"scGridSummaryClickedSubtotal\");\r\n");
          $nm_saida->saida("                $(this).find(\".scGridSummaryTotal\").addClass(\"scGridSummaryClickedTotal\");\r\n");
          $nm_saida->saida("              }\r\n");
          $nm_saida->saida("            });\r\n");
          $nm_saida->saida("        });\r\n");
          $nm_saida->saida("    </script>\r\n");
      }

       $s_class   = 'scGridSummaryLineOdd';
       $s_class_v = 'scGridSummaryGroupbyVisible';
        $iSeqCount = 0;
       foreach ($this->build_data as $row_i => $lines)
       {
           $fixedColumnCount = 0;
           $this->prim_linha = false;
           $sTrClass         = $this->comp_tab_hover ? ' class="scGridSummaryLine"' : '';
           $nm_saida->saida(" <tr $sTrClass>\r\n");
           if ($this->comp_tab_seq)
           {
               if ($this->build_total_row[$row_i])
               {
                   $sSeqDisplay = '&nbsp;';
               }
               else
               {
                   $iSeqCount++;
                   $sSeqDisplay = $iSeqCount;
               }
               $nm_saida->saida(" <td class=\"scGridSummaryGroupbyVisible scGridSummaryGroupbySeq sc-col-op sc-col-op-seq\">$sSeqDisplay</td>\r\n");
           }
           foreach ($lines as $col_i => $columns)
           {
               $this->NM_graf_left = $this->Graf_left_dat;
               if (isset($columns['level']) && 0 <= $columns['level'])
               {
                   if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
                   {
                       $columns['label'] = ($columns['label'] == "") ? "&nbsp;" : $columns['label'];
                       $s_label   = (isset($columns['link']) && '' != $columns['link']) ? "<a href=\"javascript: nm_link_cons('" . $columns['link'] . "')\" class=\"" . (isset($columns['display_as']) && 'none' == $columns['display_as'] ? 'scGridSummaryGroupbyInvisibleLink' : 'scGridSummaryGroupbyVisibleLink') . "\">" . $columns['label'] . '</a>' : $columns['label'];
                   }
                   else
                   {
                       $s_label   = $columns['label'];
                   }
                   $s_style   = '';
                   $s_text    = $this->comp_tabular ? $s_label : str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', $columns['level']) . $s_label;
                   $s_class_v = 'scGridSummaryGroupbyVisible';
                   if (isset($columns['display_as']) && 'none' == $columns['display_as'])
                   {
                       $s_text    = '<span class="scGridSummaryGroupbyInvisibleDisplay">' . $s_text . '</span>';
                       $s_class_v = 'scGridSummaryGroupbyInvisible';
                   }
                   elseif (isset($columns['display_as']) && 'subtotal' == $columns['display_as'])
                   {
                       $s_class_v = 'scGridSummarySubtotal';
                   }
                   elseif (isset($columns['display_as']) && 'total' == $columns['display_as'])
                   {
                       $s_class_v = 'scGridSummaryTotal';
                   }
                   $s_class_fix_fld = ' sc-col-fld sc-col-fld-';
                   $s_class_fix_fld_idx = $fixedColumnCount;
                   $fixedColumnCount++;
               }
               else
               {
                   $s_style = '';
                   $columnValue = isset($columns['rating']) && '' != $columns['rating'] ? $columns['rating'] : $this->formatValue($columns['format'], $columns['value']);
                   if (isset($columns['total']) && $columns['total'])
                   {
                       $s_style   = ' style="text-align: right"';
                       $s_text    = $columnValue;
                       $s_class_v = 'scGridSummaryTotal';
                       $this->NM_graf_left = $this->Graf_left_tot;
                   }
                   elseif (isset($columns['subtotal']) && $columns['subtotal'])
                   {
                       $s_text    = $columnValue;
                       $s_class_v = 'scGridSummarySubtotal';
                   }
                   else
                   {
                       if (!isset($columns['link_fld']))  { $columns['link_fld']  = "";}
                       if (!isset($columns['link_data'])) { $columns['link_data'] = "";}
                       if (!isset($columns['format']))    { $columns['format']    = "";}
                       $s_text    = $this->getDataLink($columns['link_fld'], $columns['link_data'], $columnValue);
                       $s_class_v = $s_class;
                   }
                   $s_class_fix_fld = '';
                   $s_class_fix_fld_idx = '';
               }
               $css     = (isset($columns['css']) && '' != $columns['css']) ? ' ' . $columns['css'] . '_field' : '';
               $colspan = (isset($columns['colspan']) && 1 < $columns['colspan']) ? ' colspan="' . $columns['colspan'] . '"' : '';
               $rowspan = (isset($columns['rowspan']) && 1 < $columns['rowspan']) ? ' rowspan="' . $columns['rowspan'] . '"' : '';
               $chart   = (($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida']) && isset($columns['chart']) && '' != $columns['chart'] && isset($this->comp_chart_data[ $columns['chart'] ]))
                        ? nmButtonOutput($this->arr_buttons, "bgraf", "nm_graf_submit_2('" . $columns['chart'] . "')", "nm_graf_submit_2('" . $columns['chart'] . "')", "", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "" . $this->comp_chart_data[ $columns['chart'] ]['label_x'] . " X " . $this->comp_chart_data[ $columns['chart'] ]['label_y'] . "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "") : '';
               if ($this->NM_graf_left)
               {
                   $nm_saida->saida("  <td" . $s_style . " class=\"" . $s_class_v . $s_class_fix_fld . $s_class_fix_fld_idx . $css . "\"" . $colspan . "" . $rowspan . ">" . $chart . "" . $s_text . "</td>\r\n");
               }
               else
               {
                   $nm_saida->saida("  <td" . $s_style . " class=\"" . $s_class_v . $s_class_fix_fld . $s_class_fix_fld_idx . $css . "\"" . $colspan . "" . $rowspan . ">" . $s_text . "" . $chart . "</td>\r\n");
               }
           }
           $nm_saida->saida(" </tr>\r\n");
           if ('scGridSummaryLineOdd' == $s_class)
           {
               $s_class                   = 'scGridSummaryLineEven';
               $this->Ini->cor_link_dados = 'scGridFieldEvenLink';
           }
           else
           {
               $s_class                   = 'scGridSummaryLineOdd';
               $this->Ini->cor_link_dados = 'scGridFieldOddLink';
           }
       }

       $nm_saida->saida("</table>\r\n");
       $nm_saida->saida("</td>\r\n");
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
       { 
           $nm_saida->saida("<script>\r\n");
           $nm_saida->saida("if (typeof ratingBreakdownDisplay == \"function\") {\r\n");
           $nm_saida->saida("    setTimeout(function() { ratingBreakdownDisplay() }, 500);\r\n");
           $nm_saida->saida("}\r\n");
           $nm_saida->saida("</script>\r\n");
           if ($this->proc_res_grid)
           { 
               $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_res_grid', 'value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
           } 
           else 
           { 
               $this->Ini->Arr_result['setValue'][] = array('field' => 'summary_body', 'value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
           } 
           $_SESSION['scriptcase']['saida_html'] = "";
       } 
       $nm_saida->saida("</tr>\r\n");
   }

   function drawMatrixLabels()
   {
       global $nm_saida;

       $this->prim_linha = true;

       $nm_saida->saida("    <script type=\"text/javascript\">\r\n");
       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
       { 
           $nm_saida->saida("        function sc_session_redir(url_redir)\r\n");
           $nm_saida->saida("        {\r\n");
           $nm_saida->saida("            if (typeof(sc_session_redir_mobile) === typeof(function(){})) { sc_session_redir_mobile(url_redir); }\r\n");
           $nm_saida->saida("            if (window.parent && window.parent.document != window.document && typeof window.parent.sc_session_redir === 'function')\r\n");
           $nm_saida->saida("            {\r\n");
           $nm_saida->saida("                window.parent.sc_session_redir(url_redir);\r\n");
           $nm_saida->saida("            }\r\n");
           $nm_saida->saida("            else\r\n");
           $nm_saida->saida("            {\r\n");
           $nm_saida->saida("                if (window.opener && typeof window.opener.sc_session_redir === 'function')\r\n");
           $nm_saida->saida("                {\r\n");
           $nm_saida->saida("                    window.close();\r\n");
           $nm_saida->saida("                    window.opener.sc_session_redir(url_redir);\r\n");
           $nm_saida->saida("                }\r\n");
           $nm_saida->saida("                else\r\n");
           $nm_saida->saida("                {\r\n");
           $nm_saida->saida("                    window.location = url_redir;\r\n");
           $nm_saida->saida("                }\r\n");
           $nm_saida->saida("            }\r\n");
           $nm_saida->saida("        }\r\n");
       }
       $nm_saida->saida("        $(function() {\r\n");
       $nm_saida->saida("            $(\".sc-ui-sort\").mouseover(function() {\r\n");
       $nm_saida->saida("                $(this).css(\"cursor\", \"pointer\");\r\n");
       $nm_saida->saida("            }).click(function() {\r\n");
       $nm_saida->saida("                var newOrder, colOrder;\r\n");
       $nm_saida->saida("                if ($(this).hasClass(\"sc-ui-sort-desc\")) {\r\n");
       $nm_saida->saida("                    $(this).removeClass(\"sc-ui-sort-desc\").addClass(\"sc-ui-sort-asc\");\r\n");
       $nm_saida->saida("                    newOrder = \"asc\";\r\n");
       $nm_saida->saida("                }\r\n");
       $nm_saida->saida("                else {\r\n");
       $nm_saida->saida("                    $(this).removeClass(\"sc-ui-sort-asc\").addClass(\"sc-ui-sort-desc\");\r\n");
       $nm_saida->saida("                    newOrder = \"desc\";\r\n");
       $nm_saida->saida("                }\r\n");
       $nm_saida->saida("                colOrder = $(this).attr(\"id\").substr(11);\r\n");
       $nm_saida->saida("                changeSort(colOrder, newOrder, false);\r\n");
       $nm_saida->saida("            });\r\n");
       $nm_saida->saida("        });\r\n");
       $nm_saida->saida("    </script>\r\n");

       $apl_cab_resumo = $this->Ini->Nm_lang['lang_othr_smry_msge'];

       $b_display     = false;
       $b_display_seq = false;
       foreach ($this->build_labels as $lines)
       {
           $nm_saida->saida(" <tr class=\"sc-ui-summary-header-row\">\r\n");
           if ($this->comp_tab_seq && !$b_display_seq) {
               $nm_saida->saida("  <td class=\"scGridSummaryLabel sc-col-title sc-col-op sc-col-op-seq\" rowspan=\"" . sizeof($this->build_labels) . "\">&nbsp;</td>\r\n");
               $b_display_seq = true;
           }

           if (!$b_display)
           {
               if ($this->comp_tabular)
               {
                   $fixedColumnCount = 0;
                   foreach ($this->comp_y_axys as $iYAxysIndex)
                   {
                       $hasOrder = !isset($this->comp_order_enabled[$iYAxysIndex]) || $this->comp_order_enabled[$iYAxysIndex];
                       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert']) {
                           $hasOrder = false;
                       }
                       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_start'][$iYAxysIndex]))
                       {
                           $sInitialOrder   = '';
                           $sInitialDisplay = '; display: none';
                           $sInitialSrc     = '';
                       }
                       elseif ('asc' == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_order_start'][$iYAxysIndex])
                       {
                           $sInitialOrder   = ' sc-ui-sort-asc';
                           $sInitialDisplay = '';
                           $sInitialSrc     = $this->Ini->Label_summary_sort_asc;
                       }
                       else
                       {
                           $sInitialOrder   = ' sc-ui-sort-desc';
                           $sInitialDisplay = '';
                           $sInitialSrc     = $this->Ini->Label_summary_sort_desc;
                       }
                       $nm_saida->saida("  <td class=\"scGridSummaryLabel sc-col-title sc-col-fld sc-col-fld-{$fixedColumnCount}\" rowspan=\"" . sizeof($this->build_labels) . "\">\r\n");
                       if ($hasOrder) {
                           $nm_saida->saida("    <span class=\"sc-ui-sort" . $sInitialOrder . "\" id=\"sc-id-sort-" . $iYAxysIndex . "\">\r\n");
                       }
                       $nm_saida->saida("   " . $this->comp_field[$iYAxysIndex] . "\r\n");
                       if ($hasOrder) {
                           if (!$this->Ini->Export_html_zip) {
                               $nm_saida->saida("     <img style=\"vertical-align: middle" . $sInitialDisplay . "\" src=\"" . $this->Ini->path_img_global . "/" . $sInitialSrc . "\" border=\"0\"/>\r\n");
                           }
                           else {
                               $nm_saida->saida("     <img style=\"vertical-align: middle" . $sInitialDisplay . "\" src=\"" . $sInitialSrc . "\" border=\"0\"/>\r\n");
                           }
                           $nm_saida->saida("    </span>\r\n");
                       }
                       $nm_saida->saida("  </td>\r\n");
                       $fixedColumnCount++;
                   }
               }
               else
               {
                   $nm_saida->saida("  <td class=\"scGridSummaryLabel sc-col-title sc-col-fld sc-col-fld-0\" rowspan=\"" . sizeof($this->build_labels) . "\">\r\n");
                       if (0 < $this->comp_order_col)
                       {
                       $nm_saida->saida("    <a href=\"javascript: changeSort('0', '0', true)\" class=\"scGridLabelLink \">\r\n");
                       }
                   $nm_saida->saida("   " . $apl_cab_resumo . "\r\n");
                       if (0 < $this->comp_order_col)
                       {
                           if (!$this->Ini->Export_html_zip) {
                           $nm_saida->saida("    <IMG style=\"vertical-align: middle\" SRC=\"" . $this->Ini->path_img_global . "/" . $this->Ini->Label_summary_sort_asc . "\" BORDER=\"0\"/>\r\n");
                       }
                       else {
                           $nm_saida->saida("    <IMG style=\"vertical-align: middle\" SRC=\"" . $this->Ini->Label_summary_sort_asc . "\" BORDER=\"0\"/>\r\n");
                       }
                       $nm_saida->saida("    </a>\r\n");
                       }
               $nm_saida->saida("  </td>\r\n");
               }
               $b_display = true;
           }
           foreach ($lines as $columns) {
               $tdStyleTags = array();
               $this->NM_graf_left = $this->Graf_left_dat;
               if (isset($columns['group']) && $columns['group'] == -1) {
                   $this->NM_graf_left = $this->Graf_left_tot;
               }
               if ('' == $columns['function'] && '' != $this->comp_align[ $columns['group'] ]) {
                   $tdStyleTags[] = 'text-align: ' . $this->comp_align[ $columns['group'] ];
               }
               $css       = ('' != $columns['css']) ? ' ' . $columns['css'] . '_label' : '';
               $colspan   = (isset($columns['colspan']) && 1 < $columns['colspan']) ? ' colspan="' . $columns['colspan'] . '"' : '';
               $rowspan   = (isset($columns['rowspan']) && 1 < $columns['rowspan']) ? ' rowspan="' . $columns['rowspan'] . '"' : '';
               $chart     = (($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida']) && isset($columns['chart']) && '' != $columns['chart'] && isset($this->comp_chart_data[ $columns['chart'] ]))
                          ? nmButtonOutput($this->arr_buttons, "bgraf", "nm_graf_submit_2('" . $columns['chart'] . "')", "nm_graf_submit_2('" . $columns['chart'] . "')", "", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "" . $this->comp_chart_data[ $columns['chart'] ]['label_x'] . " X " . $this->comp_chart_data[ $columns['chart'] ]['label_y'] . "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "") : '';
               $col_label = $this->getColumnLabel($columns['label'], $columns['params'][0], $css, $chart, $tdStyleTags, $this->NM_graf_left);
               $tdStyle   = empty($tdStyleTags) ? '' : ' style="' . implode(';', $tdStyleTags) . '"';
                   $nm_saida->saida("  <td class=\"scGridSummaryLabel" . $css . "\"" . $colspan . "" . $rowspan . "><span class='scGridSummaryLabelContainerSpan' " . $tdStyle . ">" . $col_label . "</span></td>\r\n");
           }
           $nm_saida->saida(" </tr>\r\n");
       }
if($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert']){ 
           $nm_saida->saida("   </thead>\r\n");
 }
   }

   function getColumnLabel($label, $col, $css, $chartValue, &$tdStyleTags, $chartLeft, $labelLeft = true)
   {
       $tdStyleTags[] = 'display: flex';
       $tdStyleTags[] = 'flex-direction: row';
       $tdStyleTags[] = 'align-items: center';
       if (0 != sizeof($this->comp_x_axys)) {
           $tdStyleTags[] = $labelLeft ? 'justify-content: left' : 'justify-content: right';
           return $chartLeft ? $chartValue . $label : $label . $chartValue;
       }

       if (1 == $col) {
           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert']) {
               return nl2br($label);
           }
           $sortIconValue = $this->Ini->Label_summary_sort;
           $spanLabelAlign = '; justify-content: flex-end;';
           $sortOrder = 'a';
           if (isset($this->comp_order_col) && $this->comp_order_col == $col + 1) {
               if ($this->comp_order_sort == 'd') {
                   $sortIconValue = $this->Ini->Label_summary_sort_desc;
                   $sInitialOrderFA = 'desc';
                   $sortOrder = '';
               } else {
                   $sortIconValue = $this->Ini->Label_summary_sort_asc;
                   $sInitialOrderFA = 'asc';
                   $sortOrder = 'd';
               }
           }
           $linkIni = "<a href=\"javascript: changeSort(" . ($col + 1) . ", '" . $sortOrder . "', true)\" class=\"scGridLabelLink" . $css . "\">";
           $linkEnd = "</a>";
           $labelValue = nl2br($label);
           $labelLink = $linkIni . $labelValue . $linkEnd;
           $labelChart = $chartLeft ? $chartValue . $labelLink : $labelLink . $chartValue;
           if (!$this->Ini->Export_html_zip) {
               $sortIconLink = $linkIni . "<IMG SRC=\"" . $this->Ini->path_img_global . "/" . $sortIconValue . "\" BORDER=\"0\"/>" . $linkEnd;
           } else {
               $sortIconLink = $linkIni . "<IMG SRC=\"" . $sortIconValue . "\" BORDER=\"0\"/>" . $linkEnd;
           }
           if (empty($this->Ini->Label_summary_sort_pos) || $this->Ini->Label_summary_sort_pos == "right") {
               $this->Ini->Label_summary_sort_pos = "right_field";
           }
           if (empty($sortIconValue)) {
               $tdStyleTags[] = $labelLeft ? 'justify-content: left' : 'justify-content: right';
               return $labelChart;
           } elseif ($this->Ini->Label_summary_sort_pos == "right_field") {
               $tdStyleTags[] = $labelLeft ? 'justify-content: left' : 'justify-content: right';
               return '<span style="flex-grow: 1' . $spanLabelAlign . '">' . $labelChart . $sortIconLink . '</span>';
           } elseif ($this->Ini->Label_summary_sort_pos == "left_field") {
               $tdStyleTags[] = $labelLeft ? 'justify-content: left' : 'justify-content: right';
               return '<span style="flex-grow: 1' . $spanLabelAlign . '">' . $sortIconLink . $labelChart . '</span>';
           } elseif ($this->Ini->Label_summary_sort_pos == "right_cell") {
               $tdStyleTags[] = $labelLeft ? 'justify-content: space-between' : 'justify-content: right';
               return '<span style="flex-grow: 1' . $spanLabelAlign . '">' . $labelChart . '</span>' . $sortIconLink;
           } elseif ($this->Ini->Label_summary_sort_pos == "left_cell") {
               $tdStyleTags[] = $labelLeft ? 'justify-content: left' : 'justify-content: space-between';
               return $sortIconLink . '<span style="flex-grow: 1' . $spanLabelAlign . '">' . $labelChart . '</span>';
           }
       }

       $spanLabelAlign = $labelLeft ? 'justify-content: left' : 'justify-content: right';
       if (1 == $col) {
           $spanLabelAlign = 'justify-content: flex-end';
       }
       $tdStyleTags[] = $spanLabelAlign;
       return $chartLeft ? $chartValue . $label : $label . $chartValue;
   }

   public static function formatValue($total, $valor_campo)
   {
       $isNegative = 0 > $valor_campo;
       if ($total == 1)
       {
           nmgp_Form_Num_Val($valor_campo, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "");
       }
       return $valor_campo;
   }

   //---- 
   function resumo_init()
   {
      $this->arr_buttons['group_group_1']= array(
          'value'            => "" . $this->Ini->Nm_lang['lang_btns_expt'] . "",
          'hint'             => "" . $this->Ini->Nm_lang['lang_btns_expt'] . "",
          'type'             => "button",
          'display'          => "text_img",
          'display_position' => "text_right",
          'image'            => "scriptcase__NM__export.png",
          'fontawesomeicon'  => "",
          'has_fa'           => true,
          'content_icons'    => false,
          'style'            => "default",
      );

      $this->arr_buttons['group_group_1']= array(
          'value'            => "" . $this->Ini->Nm_lang['lang_btns_expt'] . "",
          'hint'             => "" . $this->Ini->Nm_lang['lang_btns_expt'] . "",
          'type'             => "button",
          'display'          => "text_img",
          'display_position' => "text_right",
          'image'            => "scriptcase__NM__export.png",
          'fontawesomeicon'  => "",
          'has_fa'           => true,
          'content_icons'    => false,
          'style'            => "default",
      );

      if ($this->NM_export)
      {
          return;
      }
      $this->monta_html_ini();
      $this->monta_cabecalho();
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && !$_SESSION['scriptcase']['proc_mobile'])
      {
          $this->monta_barra_top();
          $this->monta_embbed_placeholder_top();
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && $_SESSION['scriptcase']['proc_mobile'])
      {
          $this->monta_barra_top();
          $this->monta_embbed_placeholder_mobile_top();
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
      {
          $this->monta_resumo_search();
      }
   }

   function monta_css()
   {
      global $nm_saida, $nmgp_tipo_pdf, $nmgp_cor_print;
       $compl_css = "";
       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
       {
           include($this->Ini->path_btn . $this->Ini->Str_btn_grid);
       }
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
       {
          if (($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == "print" && strtoupper($nmgp_cor_print) == "PB") || $nmgp_tipo_pdf == "pb")
           { 
               if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw']['grid_fiche_prof_sante_stat_wilaya']))
               {
                   $compl_css = str_replace(".", "_", $_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw']['grid_fiche_prof_sante_stat_wilaya']) . "_";
               } 
           } 
           else 
           { 
               if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css']['grid_fiche_prof_sante_stat_wilaya']))
               {
                   $compl_css = str_replace(".", "_", $_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css']['grid_fiche_prof_sante_stat_wilaya']) . "_";
               } 
           }
       }
       $temp_css  = explode("/", $compl_css);
       if (isset($temp_css[1])) { $compl_css = $temp_css[1];}
       $this->css_scGridPage          = $compl_css . "scGridPage";
       $this->css_scGridToolbar       = $compl_css . "scGridToolbar";
       $this->css_scGridToolbarPadd   = $compl_css . "scGridToolbarPadding";
       $this->css_css_toolbar_obj     = $compl_css . "css_toolbar_obj";
       $this->css_scGridHeader        = $compl_css . "scGridHeader";
       $this->css_scGridHeaderFont    = $compl_css . "scGridHeaderFont";
       $this->css_scGridFooter        = $compl_css . "scGridFooter";
       $this->css_scGridFooterFont    = $compl_css . "scGridFooterFont";
       $this->css_scGridTotal         = $compl_css . "scGridTotal";
       $this->css_scGridTotalFont     = $compl_css . "scGridTotalFont";
       $this->css_scGridFieldEven     = $compl_css . "scGridFieldEven";
       $this->css_scGridFieldEvenFont = $compl_css . "scGridFieldEvenFont";
       $this->css_scGridFieldEvenVert = $compl_css . "scGridFieldEvenVert";
       $this->css_scGridFieldEvenLink = $compl_css . "scGridFieldEvenLink";
       $this->css_scGridFieldOdd      = $compl_css . "scGridFieldOdd";
       $this->css_scGridFieldOddFont  = $compl_css . "scGridFieldOddFont";
       $this->css_scGridFieldOddVert  = $compl_css . "scGridFieldOddVert";
       $this->css_scGridFieldOddLink  = $compl_css . "scGridFieldOddLink";
       $this->css_scGridLabel         = $compl_css . "scGridLabel";
       $this->css_scGridLabelFont     = $compl_css . "scGridLabelFont";
       $this->css_scGridLabelLink     = $compl_css . "scGridLabelLink";
       $this->css_scGridTabela        = $compl_css . "scGridTabela";
       $this->css_scGridTabelaTd      = $compl_css . "scGridTabelaTd";
       $this->css_scAppDivMoldura     = $compl_css . "scAppDivMoldura";
       $this->css_scAppDivHeader      = $compl_css . "scAppDivHeader";
       $this->css_scAppDivHeaderText  = $compl_css . "scAppDivHeaderText";
       $this->css_scAppDivContent     = $compl_css . "scAppDivContent";
       $this->css_scAppDivContentText = $compl_css . "scAppDivContentText";
       $this->css_scAppDivToolbar     = $compl_css . "scAppDivToolbar";
       $this->css_scAppDivToolbarInput= $compl_css . "scAppDivToolbarInput";
   }

   function resumo_sem_reg()
   {
      global $nm_saida;
      $res_sem_reg = $this->Ini->Nm_lang['lang_errm_empt']; 
      $nm_saida->saida("  <TR id=\"summary_body\">\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
      { 
          $_SESSION['scriptcase']['saida_html'] = "";
      } 
      $nm_saida->saida("   <TD class=\"scGridFieldOdd scGridFieldOddFont\" align=\"center\" style=\"vertical-align: top;font-size:12px;\">\r\n");
      $nm_saida->saida("     " . $res_sem_reg . "\r\n");
      $nm_saida->saida("   </TD>\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
      { 
          $this->Ini->Arr_result['setValue'][] = array('field' => 'summary_body', 'value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
          $_SESSION['scriptcase']['saida_html'] = "";
      } 
      $nm_saida->saida("  </TR>\r\n");
   }

   function resumo_sem_reg_chart()
   {
      global $nm_saida;
      $res_sem_reg = $this->Ini->Nm_lang['lang_errm_empt']; 
      $displayMessage = $this->NM_res_sem_reg ? '' : ' style="display: none"';
      $nm_saida->saida("  <TR id=\"rec_not_found_chart\"" . $displayMessage . ">\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
      { 
          $_SESSION['scriptcase']['saida_html'] = "";
      } 
      $nm_saida->saida("   <TD class=\"scGridFieldOdd scGridFieldOddFont\" align=\"center\" style=\"vertical-align: top;font-size:12px;\">\r\n");
      $nm_saida->saida("     " . $res_sem_reg . "\r\n");
      $nm_saida->saida("   </TD>\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
      { 
         if ($this->NM_res_sem_reg)
         {
              $this->Ini->Arr_result['setDisplay'][] = array('field' => 'rec_not_found_chart', 'value' => '');
              $this->Ini->Arr_result['setVisibility'][] = array('field' => 'res_chart_table', 'value' => 'hidden');
         }
         else
         {
              $this->Ini->Arr_result['setDisplay'][] = array('field' => 'rec_not_found_chart', 'value' => 'none');
              $this->Ini->Arr_result['setDisplay'][] = array('field' => 'res_chart_table', 'value' => '');
              $this->Ini->Arr_result['setVisibility'][] = array('field' => 'res_chart_table', 'value' => 'visible');
         }
          $_SESSION['scriptcase']['saida_html'] = "";
      } 
      $nm_saida->saida("  </TR>\r\n");
   }

   //---- 
   function resumo_final()
   {
       global $nm_saida;
      if ($this->NM_export)
      {
          return;
      }
      $this->monta_html_fim();
   }

   //---- 
   function inicializa_vars()
   {
      $this->Tot_ger = false;
      require_once($this->Ini->path_aplicacao . "grid_fiche_prof_sante_stat_wilaya_total.class.php"); 
      $this->Print_All = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['print_all'];
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'] || $this->Ini->sc_export_ajax_img)
      { 
          $this->NM_raiz_img = $this->Ini->root; 
      } 
      else 
      { 
          $this->NM_raiz_img = ""; 
      } 
      if ($this->Print_All)
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] = "print";
          $this->Ini->nm_limite_lin = $this->Ini->nm_limite_lin_res_prt; 
      }
      else
      {
          $this->Ini->nm_limite_lin = $this->Ini->nm_limite_lin_res; 
      }
      $this->Total   = new grid_fiche_prof_sante_stat_wilaya_total($this->Ini->sc_page);
      $this->prep_modulos("Total");
      if ($this->NM_export)
      {
          return;
      }
      $this->monta_css();
      $this->que_linha = "impar";
      $this->css_line_back = $this->css_scGridFieldOdd;
      $this->css_line_fonf = $this->css_scGridFieldOddFont;
      $this->Ini->cor_link_dados = $this->css_scGridFieldOddLink;
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['LigR_Md5'] = array();
   }

   //---- 
   function prep_modulos($modulo)
   {
      $this->$modulo->Ini    = $this->Ini;
      $this->$modulo->Db     = $this->Db;
      $this->$modulo->Erro   = $this->Erro;
      $this->$modulo->Lookup = $this->Lookup;
   }

   //---- 
   function totaliza()
   {
      $this->Total->Calc_resumo_stat1("res", $this->NM_export);
      foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_total'] as $cmp_gb => $resto)
      {
          $Arr_tot_name = "array_total_" . $cmp_gb;
          $this->$Arr_tot_name = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['arr_total'][$cmp_gb];
      }
      if (is_array($this->array_total_statut_maladie)) {
          ksort($this->array_total_statut_maladie);
      }
      if (is_array($this->array_total_maladie_confirmee_labo)) {
          ksort($this->array_total_maladie_confirmee_labo);
      }
      $Gb_geral = "quebra_geral_" . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['SC_Ind_Groupby'];
      $this->Total->$Gb_geral(false, $this->NM_export);
   }

   //----- 
   function monta_html_ini($first_table = true)
   {
      global $nm_saida, $nmgp_tipo_pdf, $nmgp_cor_print;

      if ($first_table)
      {

      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
      { 
          $nm_saida->saida("<TABLE style=\"padding: 0px; border-spacing: 0px; border-width: 0px; width: 100%;\">\r\n");
          return;
      } 
       header("X-XSS-Protection: 1; mode=block");
       header("X-Frame-Options: SAMEORIGIN");
if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
{
       $nm_saida->saida("<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:word\" xmlns=\"http://www.w3.org/TR/REC-html40\">\r\n");
}
if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['responsive_chart']['active']) {
$nm_saida->saida("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
$nm_saida->saida("            \"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n");
}
$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_refresh_after_chart'] = 'resumo';
      $nm_saida->saida("<HTML" . $_SESSION['scriptcase']['reg_conf']['html_dir'] . ">\r\n");
      $nm_saida->saida("<HEAD>\r\n");
      $nm_saida->saida(" <TITLE>MDO - Statistiques</TITLE>\r\n");
      $nm_saida->saida(" <META http-equiv=\"Content-Type\" content=\"text/html; charset=" . $_SESSION['scriptcase']['charset_html'] . "\" />\r\n");
if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
{
      $nm_saida->saida(" <META http-equiv=\"Expires\" content=\"Fri, Jan 01 1900 00:00:00 GMT\"/>\r\n");
      $nm_saida->saida(" <META http-equiv=\"Last-Modified\" content=\"" . gmdate('D, d M Y H:i:s') . " GMT\"/>\r\n");
      $nm_saida->saida(" <META http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate\"/>\r\n");
      $nm_saida->saida(" <META http-equiv=\"Cache-Control\" content=\"post-check=0, pre-check=0\"/>\r\n");
      $nm_saida->saida(" <META http-equiv=\"Pragma\" content=\"no-cache\"/>\r\n");
}
      $nm_saida->saida(" <link rel=\"shortcut icon\" href=\"../_lib/img/sys__NM__img__NM__emergency_2785811.png\">\r\n");
       $css_body = "";
      $nm_saida->saida(" <style type=\"text/css\">\r\n");
      $nm_saida->saida("  BODY { " . $css_body . " }\r\n");
      $nm_saida->saida(" </style>\r\n");
      if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
      { 
           $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_form.css\" /> \r\n");
           $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_form" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" /> \r\n");
           $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
           $nm_saida->saida("     var applicationKeys = '';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+q';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'ctrl+s';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'ctrl+f';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+p';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+w';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+x';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+m';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+c';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+r';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'ctrl+p';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+shift+p';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+shift+w';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+shift+x';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+shift+m';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+shift+c';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+shift+r';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'alt+enter';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'f1';\r\n");
           $nm_saida->saida("     applicationKeys += ',';\r\n");
           $nm_saida->saida("     applicationKeys += 'ctrl+g';\r\n");
           $nm_saida->saida("     var hotkeyList = '';\r\n");
           $nm_saida->saida("     function execHotKey(e, h) {\r\n");
           $nm_saida->saida("         var hotkey_fired = false\r\n");
           $nm_saida->saida("         switch (true) {\r\n");
           $nm_saida->saida("             case (['alt+q'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_sai');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['ctrl+s'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_savegrid');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['ctrl+f'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_fil');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+p'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_pdf');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+w'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_word');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+x'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_xls');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+m'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_xml');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+c'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_csv');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+r'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_rtf');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['ctrl+p'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_imp');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+shift+p'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_pdf');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+shift+w'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_word');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+shift+x'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_xls');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+shift+m'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_xml');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+shift+c'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_csv');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+shift+r'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_rtf');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['alt+enter'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_cons');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['f1'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_webh');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("             case (['ctrl+g'].indexOf(h.key) > -1):\r\n");
           $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_gbrl');\r\n");
           $nm_saida->saida("                 break;\r\n");
           $nm_saida->saida("         }\r\n");
           $nm_saida->saida("         if (hotkey_fired) {\r\n");
           $nm_saida->saida("             e.preventDefault();\r\n");
           $nm_saida->saida("             return false;\r\n");
           $nm_saida->saida("         } else {\r\n");
           $nm_saida->saida("             return true;\r\n");
           $nm_saida->saida("         }\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("   </script>\r\n");
           $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/hotkeys.inc.js\"></script>\r\n");
           $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/hotkeys_setup.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery/js/jquery.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery/js/jquery-ui.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"../_lib/lib/js/scInput.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"../_lib/lib/js/jquery.scInput.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"../_lib/lib/js/jquery.scInput2.js\"></script>\r\n");
           $nm_saida->saida(" <link rel=\"stylesheet\" href=\"" . $this->Ini->path_prod . "/third/jquery/css/smoothness/jquery-ui.css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida(" <link rel=\"stylesheet\" href=\"" . $this->Ini->path_prod . "/third/font-awesome/6.2/css/all.min.css\" type=\"text/css\" media=\"screen,print\" />\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/touch_punch/jquery.ui.touch-punch.min.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/malsup-blockui/jquery.blockUI.js\"></script>\r\n");
           $nm_saida->saida(" <link rel=\"stylesheet\" href=\"" . $this->Ini->path_prod . "/third/jquery_plugin/select2/css/select2.min.css\" type=\"text/css\" />\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/select2/js/select2.full.min.js\"></script>\r\n");
           if ($_SESSION['scriptcase']['proc_mobile'] && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav']) {  
               $forced_mobile = (isset($_SESSION['scriptcase']['force_mobile']) && $_SESSION['scriptcase']['force_mobile']) ? 'true' : 'false';
               $sc_app_data   = json_encode([ 
                   'forceMobile' => $forced_mobile, 
                   'appType' => 'summary', 
                   'improvements' => true, 
                   'displayOptionsButton' => false, 
                   'displayScrollUp' => true, 
                   'bottomToolbarFixed' => true, 
                   'mobileSimpleToolbar' => false, 
                   'scrollUpPosition' => 'A', 
                   'toolbarOrientation' => 'H', 
                   'mobilePanes' => 'true', 
                   'navigationBarButtons' => unserialize('a:5:{i:0;s:14:"sys_format_ini";i:1;s:14:"sys_format_ret";i:2;s:15:"sys_format_rows";i:3;s:14:"sys_format_ava";i:4;s:14:"sys_format_fim";}'), 
                   'langs' => [ 
                       'lang_refined_search' => html_entity_decode($this->Ini->Nm_lang['lang_refined_search'], ENT_COMPAT, $_SESSION['scriptcase']['charset']), 
                       'lang_summary_search_button' => html_entity_decode($this->Ini->Nm_lang['lang_summary_search_button'], ENT_COMPAT, $_SESSION['scriptcase']['charset']), 
                       'lang_details_button' => html_entity_decode($this->Ini->Nm_lang['lang_details_button'], ENT_COMPAT, $_SESSION['scriptcase']['charset']), 
                   ], 
               ]); ?> 
        <input type="hidden" id="sc-mobile-app-data" value='<?php echo $sc_app_data; ?>' />
        <script type="text/javascript" src="../_lib/lib/js/nm_modal_panes.jquery.js"></script>
        <script type="text/javascript" src="../_lib/lib/js/nm_mobile.js"></script>
        <link rel='stylesheet' href='../_lib/lib/css/nm_mobile.css' type='text/css'/>
                    <script>
                        $(document).ready(function(){
                            bootstrapMobile();
                        });
                    </script>           <?php }
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"grid_fiche_prof_sante_stat_wilaya_ajax.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\">\r\n");
           $nm_saida->saida("   var sc_ajaxBg = '" . $this->Ini->Color_bg_ajax . "';\r\n");
           $nm_saida->saida("   var sc_ajaxBordC = '" . $this->Ini->Border_c_ajax . "';\r\n");
           $nm_saida->saida("   var sc_ajaxBordS = '" . $this->Ini->Border_s_ajax . "';\r\n");
           $nm_saida->saida("   var sc_ajaxBordW = '" . $this->Ini->Border_w_ajax . "';\r\n");
           $nm_saida->saida(" </script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"grid_fiche_prof_sante_stat_wilaya_jquery_3820.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"grid_fiche_prof_sante_stat_wilaya_message.js\"></script>\r\n");
           $nm_saida->saida("        <script type=\"text/javascript\">\r\n");
           $nm_saida->saida("          var sc_pathToTB = '" . $this->Ini->path_prod . "/third/jquery_plugin/thickbox/';\r\n");
           $nm_saida->saida("          var sc_tbLangClose = \"" . html_entity_decode($this->Ini->Nm_lang['lang_tb_close'], ENT_COMPAT, $_SESSION['scriptcase']['charset']) . "\";\r\n");
           $nm_saida->saida("          var sc_tbLangEsc = \"" . html_entity_decode($this->Ini->Nm_lang['lang_tb_esc'], ENT_COMPAT, $_SESSION['scriptcase']['charset']) . "\";\r\n");
           $nm_saida->saida("        </script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/thickbox/thickbox-compressed.js\"></script>\r\n");
           $nm_saida->saida(" <script type=\"text/javascript\" src=\"../_lib/lib/js/nm_position.js\"></script>\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_tab.css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_tab" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_appdiv.css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_appdiv" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_grid.css\"  type=\"text/css\"/> \r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_grid" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\"  type=\"text/css\"/> \r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_filter.css\" /> \r\n");
           if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
           { 
               $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" . $this->Ini->str_google_fonts . "\"  type=\"text/css\"/> \r\n");
           } 
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" . $this->Ini->path_prod . "/third/jquery_plugin/sumoselect-master/sumoselect.min.css\" rel=\"stylesheet\"> \r\n");
           $nm_saida->saida("   <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/sumoselect-master/jquery.sumoselect.min.js\"></script>\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_btngrp.css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_btngrp" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" . $this->Ini->path_prod . "/third/jquery_plugin/thickbox/thickbox.css\" type=\"text/css\" media=\"screen\" />\r\n");
           $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/buttons/" . $this->Ini->Str_btn_css . "\" /> \r\n");
      } 
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css']))
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css'] = rand(0, 1000);
      }
      $NM_css = @fopen($this->Ini->root . $this->Ini->path_imag_temp . '/sc_css_grid_fiche_prof_sante_stat_wilaya_sum_' . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css'] . '.css', 'w');
      if (($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == "print" && strtoupper($nmgp_cor_print) == "PB") || $nmgp_tipo_pdf == "pb")
      {
          $NM_css_file = $this->Ini->str_schema_all . "_grid_bw.css";
          $NM_css_dir  = $this->Ini->str_schema_all . "_grid_bw" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
      }
      else
      {
          $NM_css_file = $this->Ini->str_schema_all . "_grid.css";
          $NM_css_dir  = $this->Ini->str_schema_all . "_grid" . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
      }
      if (is_file($this->Ini->path_css . $NM_css_file))
      {
          $NM_css_attr = file($this->Ini->path_css . $NM_css_file);
          foreach ($NM_css_attr as $NM_line_css)
          {
              $NM_line_css = str_replace("../../img", $this->Ini->path_imag_cab  , $NM_line_css);
              @fwrite($NM_css, "    " .  $NM_line_css . "\r\n");
          }
      }
      if (is_file($this->Ini->path_css . $NM_css_dir))
      {
          $NM_css_attr = file($this->Ini->path_css . $NM_css_dir);
          foreach ($NM_css_attr as $NM_line_css)
          {
              $NM_line_css = str_replace("../../img", $this->Ini->path_imag_cab  , $NM_line_css);
              @fwrite($NM_css, "    " .  $NM_line_css . "\r\n");
          }
      }
      @fclose($NM_css);
     $this->Ini->summary_css = $this->Ini->path_imag_temp . '/sc_css_grid_fiche_prof_sante_stat_wilaya_sum_' . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css'] . '.css';
     if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == "print")
     {
         $nm_saida->saida("  <style type=\"text/css\">\r\n");
         $NM_css = file($this->Ini->root . $this->Ini->path_imag_temp . '/sc_css_grid_fiche_prof_sante_stat_wilaya_sum_' . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css'] . '.css');
         foreach ($NM_css as $cada_css)
         {
              $nm_saida->saida("  " . str_replace("\r\n", "", $cada_css) . "\r\n");
         }
         $nm_saida->saida("  </style>\r\n");
     }
     else
     {
         $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" . $this->Ini->summary_css . "\" type=\"text/css\" media=\"screen\" />\r\n");
     }
     $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_res_" . strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css\" />\r\n");
     $nm_saida->saida(" <style type=\"text/css\">\r\n");
     if (!$this->Ini->Export_html_zip)     {
           $nm_saida->saida(" .scGridSummaryLabel a img[src\$='" . $this->Ini->Label_sort_desc . "'], \r\n");
           $nm_saida->saida(" .scGridSummaryLabel a img[src\$='" . $this->Ini->Label_sort_asc . "'], \r\n");
           $nm_saida->saida(" .scGridSummaryLabel a img[src\$='" . $this->arr_buttons['bgraf']['image'] . "']{opacity:1!important;} \r\n");
           $nm_saida->saida(" .scGridSummaryLabel a img{opacity:0;transition:all .2s;} \r\n");
           $nm_saida->saida(" .scGridSummaryLabel:HOVER a img{opacity:1;transition:all .2s;} \r\n");
           $nm_saida->saida(" .scGridSummaryLabel span > img[src\$='" . $this->Ini->Label_sort_desc . "'], \r\n");
           $nm_saida->saida(" .scGridSummaryLabel span > img[src\$='" . $this->Ini->Label_sort_asc . "']{opacity:1!important;} \r\n");
           $nm_saida->saida(" .scGridSummaryLabel span > img{opacity:0;transition:all .2s;} \r\n");
           $nm_saida->saida(" .scGridSummaryLabel:HOVER span > img{opacity:1;transition:all .2s;} \r\n");
     }
      $nm_saida->saida(" .scGridTabela TD { white-space: nowrap }\r\n");
      $nm_saida->saida(" </style>\r\n");
           $nm_saida->saida("   <script type=\"text/javascript\"> \r\n");
           $nm_saida->saida("   var scBtnGrpStatus = {};\r\n");
           $nm_saida->saida("   \$(function(){ \r\n");
           $nm_saida->saida("     $(\".scBtnGrpText\").mouseover(function() { $(this).addClass(\"scBtnGrpTextOver\"); }).mouseout(function() { $(this).removeClass(\"scBtnGrpTextOver\"); });\r\n");
           $nm_saida->saida("     $(\".scBtnGrpClick\").mouseup(function(event){\r\n");
           $nm_saida->saida("          event.preventDefault();\r\n");
           $nm_saida->saida("          if(event.target !== event.currentTarget) return;\r\n");
           $nm_saida->saida("          if($(this).find(\"a\").prop('href') != '')\r\n");
           $nm_saida->saida("          {\r\n");
           $nm_saida->saida("              $(this).find(\"a\").click();\r\n");
           $nm_saida->saida("          }\r\n");
           $nm_saida->saida("          else\r\n");
           $nm_saida->saida("          {\r\n");
           $nm_saida->saida("              eval($(this).find(\"a\").prop('onclick'));\r\n");
           $nm_saida->saida("          }\r\n");
           $nm_saida->saida("     });\r\n");
           $nm_saida->saida("   }); \r\n");
           $nm_saida->saida("   function scBtnGrpShow(sGroup) {\r\n");
           $nm_saida->saida("     if (typeof(scBtnGrpShowMobile) === typeof(function(){})) { return scBtnGrpShowMobile(sGroup); };\r\n");
           $nm_saida->saida("     $('#sc_btgp_btn_' + sGroup).addClass('selected');\r\n");
           $nm_saida->saida("     var btnPos = $('#sc_btgp_btn_' + sGroup).offset();\r\n");
           $nm_saida->saida("     scBtnGrpStatus[sGroup] = 'open';\r\n");
           $nm_saida->saida("     $('#sc_btgp_btn_' + sGroup).mouseout(function() {\r\n");
           $nm_saida->saida("       scBtnGrpStatus[sGroup] = '';\r\n");
           $nm_saida->saida("       setTimeout(function() {\r\n");
           $nm_saida->saida("         scBtnGrpHide(sGroup, false);\r\n");
           $nm_saida->saida("       }, 1000);\r\n");
           $nm_saida->saida("     }).mouseover(function() {\r\n");
           $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'over';\r\n");
           $nm_saida->saida("     });\r\n");
           $nm_saida->saida("     $('#sc_btgp_div_' + sGroup + ' span a').click(function() {\r\n");
           $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'out';\r\n");
           $nm_saida->saida("       scBtnGrpHide(sGroup, false);\r\n");
           $nm_saida->saida("     });\r\n");
           $nm_saida->saida("     $('#sc_btgp_div_' + sGroup).css({\r\n");
           $nm_saida->saida("       'left': btnPos.left\r\n");
           $nm_saida->saida("     })\r\n");
           $nm_saida->saida("     .mouseover(function() {\r\n");
           $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'over';\r\n");
           $nm_saida->saida("     })\r\n");
           $nm_saida->saida("     .mouseleave(function() {\r\n");
           $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'out';\r\n");
           $nm_saida->saida("       setTimeout(function() {\r\n");
           $nm_saida->saida("         scBtnGrpHide(sGroup, false);\r\n");
           $nm_saida->saida("       }, 1000);\r\n");
           $nm_saida->saida("     })\r\n");
           $nm_saida->saida("     .show('fast');\r\n");
           $nm_saida->saida("   }\r\n");
           $nm_saida->saida("   function scBtnGrpHide(sGroup, bForce) {\r\n");
           $nm_saida->saida("     if (bForce || 'over' != scBtnGrpStatus[sGroup]) {\r\n");
           $nm_saida->saida("       $('#sc_btgp_div_' + sGroup).hide('fast');\r\n");
           $nm_saida->saida("       $('#sc_btgp_btn_' + sGroup).removeClass('selected');\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("   }\r\n");
           $nm_saida->saida("   </script> \r\n");
           $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
           $nm_saida->saida("     function scBtnGroupByShow(sUrl, sPos) {\r\n");
           $nm_saida->saida("       $.ajax({\r\n");
           $nm_saida->saida("         type: \"GET\",\r\n");
           $nm_saida->saida("         dataType: \"html\",\r\n");
           $nm_saida->saida("         url: sUrl\r\n");
           $nm_saida->saida("       }).done(function(data) {\r\n");
           $nm_saida->saida("         $(\"#sc_id_groupby_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
           $nm_saida->saida("         $(\"#sc_id_groupby_placeholder_\" + sPos).find(\"td\").html(data);\r\n");
           $nm_saida->saida("         $(\"#sc_id_groupby_placeholder_\" + sPos).show();\r\n");
           $nm_saida->saida("       });\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("     function scBtnGroupByHide(sPos) {\r\n");
           $nm_saida->saida("       $(\"#sc_id_groupby_placeholder_\" + sPos).hide();\r\n");
           $nm_saida->saida("       $(\"#sc_id_groupby_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("     function scBtnSelCamposShow(sUrl, sPos) {\r\n");
           $nm_saida->saida("       $.ajax({\r\n");
           $nm_saida->saida("         type: \"GET\",\r\n");
           $nm_saida->saida("         dataType: \"html\",\r\n");
           $nm_saida->saida("         url: sUrl\r\n");
           $nm_saida->saida("       }).done(function(data) {\r\n");
           $nm_saida->saida("         $(\"#sc_id_sel_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
           $nm_saida->saida("         $(\"#sc_id_sel_campos_placeholder_\" + sPos).find(\"td\").html(data);\r\n");
           $nm_saida->saida("         $(\"#sc_id_sel_campos_placeholder_\" + sPos).show();\r\n");
           $nm_saida->saida("       });\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("     function scBtnSelCamposHide(sPos) {\r\n");
           $nm_saida->saida("       $(\"#sc_id_sel_campos_placeholder_\" + sPos).hide();\r\n");
           $nm_saida->saida("       $(\"#sc_id_sel_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("     function scBtnOrderCamposShow(sUrl, sPos) {\r\n");
           $nm_saida->saida("       $.ajax({\r\n");
           $nm_saida->saida("         type: \"GET\",\r\n");
           $nm_saida->saida("         dataType: \"html\",\r\n");
           $nm_saida->saida("         url: sUrl\r\n");
           $nm_saida->saida("       }).done(function(data) {\r\n");
           $nm_saida->saida("         $(\"#sc_id_order_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
           $nm_saida->saida("         $(\"#sc_id_order_campos_placeholder_\" + sPos).find(\"td\").html(data);\r\n");
           $nm_saida->saida("         $(\"#sc_id_order_campos_placeholder_\" + sPos).show();\r\n");
           $nm_saida->saida("       });\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("     function scBtnOrderCamposHide(sPos) {\r\n");
           $nm_saida->saida("       $(\"#sc_id_order_campos_placeholder_\" + sPos).hide();\r\n");
           $nm_saida->saida("       $(\"#sc_id_order_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
           $nm_saida->saida("     }\r\n");
           $nm_saida->saida("   </script>\r\n");
           $cssJsContent = $this->generateRatingSummarizationJsCss();
           $nm_saida->saida("$cssJsContent\r\n");
           $nm_saida->saida("<style type=\"text/css\">\r\n");
           $nm_saida->saida("</style>\r\n");
           $nm_saida->saida("<script>\r\n");
           $nm_saida->saida("</script>\r\n");

if ($_SESSION['scriptcase']['proc_mobile'])
{
       $nm_saida->saida("   <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" />\r\n");
}

      $nm_saida->saida("</HEAD>\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['responsive_chart']['active']) {
          $summary_width = "width=\"100%\"";
          $chart_height = " style=\"height: 100%\"";
          $border_height = "height: 100%;";
      }
      else {
          $chart_height = '';
          $border_height = '';
          if ($_SESSION['scriptcase']['proc_mobile'])
          {
              $summary_width = "width=\"100%\"";
          }
          else
          {
              $summary_width = "width=\"\"";
          }
      }
      if (!$this->Ini->Export_html_zip && $this->Print_All && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word']) 
      {
          $nm_saida->saida(" <BODY id=\"grid_summary\" class=\"" . $this->css_scGridPage . " sc-app-grid\" style=\"-webkit-print-color-adjust: exact;\">\r\n");
          $nm_saida->saida("   <TABLE id=\"sc_table_print\" cellspacing=0 cellpadding=0 align=\"center\" valign=\"top\" " . $summary_width . ">\r\n");
          $nm_saida->saida("     <TR>\r\n");
          $nm_saida->saida("       <TD align=\"center\">\r\n");
          $Cod_Btn = nmButtonOutput($this->arr_buttons, "bprint", "prit_web_page()", "prit_web_page()", "Bprint_print", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
          $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("       </TD>\r\n");
          $nm_saida->saida("     </TR>\r\n");
          $nm_saida->saida("   </TABLE>\r\n");
          $nm_saida->saida("  <script type=\"text/javascript\">\r\n");
          $nm_saida->saida("     function prit_web_page()\r\n");
          $nm_saida->saida("     {\r\n");
          $nm_saida->saida("        document.getElementById('sc_table_print').style.display = 'none';\r\n");
          $nm_saida->saida("        var is_safari = navigator.userAgent.indexOf(\"Safari\") > -1;\r\n");
          $nm_saida->saida("        var is_chrome = navigator.userAgent.indexOf('Chrome') > -1\r\n");
          $nm_saida->saida("        if ((is_chrome) && (is_safari)) {is_safari=false;}\r\n");
          $nm_saida->saida("        window.print();\r\n");
          $nm_saida->saida("        if (is_safari) {setTimeout(\"window.close()\", 1000);} else {window.close();}\r\n");
          $nm_saida->saida("     }\r\n");
          $nm_saida->saida("  </script>\r\n");
      }
      else
      {
          $remove_margin = isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['remove_margin']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['remove_margin'] ? 'margin: 0;' : '';
          $remove_border = isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['remove_border']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['remove_border'] ? 'border-width: 0;' : '';
          $vertical_center = '';
          $nm_saida->saida(" <BODY id=\"grid_summary\" class=\"" . $this->css_scGridPage . " sc-app-grid\" style=\"" . $remove_margin . $vertical_center . "\">\r\n");
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
      {
           $Cod_Btn = nmButtonOutput($this->arr_buttons, "berrm_clse", "nmAjaxHideDebug()", "nmAjaxHideDebug()", "", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
           $nm_saida->saida("<div id=\"id_debug_window\" style=\"display: none;\" class='scDebugWindow'><table class=\"scFormMessageTable\">\r\n");
           $nm_saida->saida("<tr><td class=\"scFormMessageTitle\">" . $Cod_Btn . "&nbsp;&nbsp;Output</td></tr>\r\n");
           $nm_saida->saida("<tr><td class=\"scFormMessageMessage\" style=\"padding: 0px; vertical-align: top\"><div style=\"padding: 2px; height: 200px; width: 350px; overflow: auto\" id=\"id_debug_text\"></div></td></tr>\r\n");
           $nm_saida->saida("</table></div>\r\n");
      }
      $nm_saida->saida("  " . $this->Ini->Ajax_result_set . "\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == "pdf")
      { 
              $nm_saida->saida("  <div style=\"height:1px;overflow:hidden\"><H1 style=\"font-size:0;padding:1px\">" . $this->Ini->Nm_lang['lang_othr_smry_msge'] . "</H1></div>\r\n");
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'] && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
      { 
          $nm_saida->saida("      <STYLE>\r\n");
          $nm_saida->saida("       .ttip {border:1px solid black;font-size:12px;layer-background-color:lightyellow;background-color:lightyellow;color:black;}\r\n");
          $nm_saida->saida("      </STYLE>\r\n");
          $nm_saida->saida("      <div id=\"tooltip\" style=\"position:absolute;visibility:hidden;border:1px solid black;font-size:12px;layer-background-color:lightyellow;background-color:lightyellow;padding:1px;color:black;\"></div>\r\n");
      } 

      }

      $nm_saida->saida("<TABLE id=\"main_table_res\" cellspacing=0 cellpadding=0 align=\"center\" valign=\"top\" " . $summary_width . $chart_height . ">\r\n");
      $nm_saida->saida(" <TR class='sc-mobile-inner-control'>\r\n");
      $nm_saida->saida("  <TD class='sc-mobile-inner-control' " . $chart_height . ">\r\n");
      $nm_saida->saida("  <div class=\"scGridBorder\" style=\"" . $border_height . (isset($remove_border) ? $remove_border : '') . "\">\r\n");
       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
       { 
           $nm_saida->saida("  <div id=\"id_div_process\" style=\"display: none; margin: 10px; whitespace: nowrap\" class=\"scFormProcessFixed\"><span class=\"scFormProcess\"><img border=\"0\" src=\"" . $this->Ini->path_icones . "/scriptcase__NM__ajax_load.gif\" align=\"absmiddle\" />&nbsp;" . $this->Ini->Nm_lang['lang_othr_prcs'] . "...</span></div>\r\n");
           $nm_saida->saida("  <div id=\"id_div_process_block\" style=\"display: none; margin: 10px; whitespace: nowrap\"><span class=\"scFormProcess\"><img border=\"0\" src=\"" . $this->Ini->path_icones . "/scriptcase__NM__ajax_load.gif\" align=\"absmiddle\" />&nbsp;" . $this->Ini->Nm_lang['lang_othr_prcs'] . "...</span></div>\r\n");
           $nm_saida->saida("  <div id=\"id_fatal_error\" class=\"scGridLabel\" style=\"display: none; position: absolute\"></div>\r\n");
       } 
      $nm_saida->saida("  <table width='100%' cellspacing=0 cellpadding=0" . $chart_height . " class='sc-mobile-inner-control'>\r\n");
      $nm_saida->saida("<TR class='sc-mobile-inner-control'>\r\n");
      $nm_saida->saida("<TD style=\"padding: 0px; vertical-align: initial\" class='sc-mobile-inner-control'>\r\n");
      $nm_saida->saida("<TABLE style=\"padding: 0px; border-spacing: 0px; border-width: 0px; border-collapse: collapse;  vertical-align: top; width: 100%;\" class='sc-mobile-inner-control'>\r\n");
   }

   //-----  top
   function monta_barra_top_normal()
   {
      global $nm_url_saida, $nm_apl_dependente, $nm_saida;
      $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""; 
      $Save_res_sem_reg = $this->NM_res_sem_reg;
      if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'] && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_resumo_search']))
      {
          $this->NM_res_sem_reg = false;
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
      {
         $nm_saida->saida(" <TR align=\"center\" id=\"obj_barra_top\">\r\n");
         $nm_saida->saida("  <TD class=\"" . $this->css_scGridTabelaTd . "\">\r\n");
         $nm_saida->saida("   <TABLE class=\"" . $this->css_scGridToolbar . "\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top; width: 100%;\">\r\n");
         $nm_saida->saida("    <TR class=\"" . $this->css_scGridToolbarPadd . "_tr\">\r\n");
         $nm_saida->saida("     <TD class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"left\">\r\n");
         $NM_btn  = false;
         $NM_Gbtn = false;
      if (!$this->grid_emb_form && $this->nmgp_botoes['group_1'] == "on")
      {
          $nm_saida->saida("           <script type=\"text/javascript\">var sc_itens_btgp_group_1_top = false;</script>\r\n");
          $Cod_Btn = nmButtonOutput($this->arr_buttons, "group_group_1", "scBtnGrpShow('group_1_top')", "scBtnGrpShow('group_1_top')", "sc_btgp_btn_group_1_top", "", "" . $this->Ini->Nm_lang['lang_btns_expt'] . "", "", "absmiddle", "", "", $this->Ini->path_botoes, "", "" . $this->Ini->Nm_lang['lang_btns_expt'] . "", "", "", "__sc_grp__", "text_img", "text_right", "", "", "", "", "", "", "");
          $nm_saida->saida("           $Cod_Btn\r\n");
          $NM_btn  = true;
          $NM_Gbtn = false;
          $Cod_Btn = nmButtonGroupTableOutput($this->arr_buttons, "group_group_1", 'group_1', 'top', 'list', 'ini');
          $nm_saida->saida("           $Cod_Btn\r\n");
      if (!$this->grid_emb_form && $this->nmgp_botoes['pdf'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rpdf_top\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['pdf'][] = "Rpdf_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bpdf", "", "", "Rpdf_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_pdf.php?nm_opc=pdf&nm_target=0&nm_cor=cor&papel=8&orientacao=1&bookmarks=1&largura=1200&conf_larg=S&conf_fonte=10&grafico=S&sc_ver_93=s&nm_tem_gb=s&nm_res_cons=s&nm_ini_pdf_res=resume,chart&nm_all_modules=resume,chart&password=n&summary_export_columns=N&pdf_zip=N&origem=res&language=fr&conf_socor=N&nm_label_group=N&nm_all_cab=S&nm_all_label=S&nm_orient_grid=2&script_case_init=" . $this->Ini->sc_page . "&app_name=grid_fiche_prof_sante_stat_wilaya&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
         if ($NM_Gbtn)
         {
                  $nm_saida->saida("           </td></tr><tr><td class=\"scBtnGrpBackground\">\r\n");
            $NM_Gbtn = false;
         }
      if (!$this->grid_emb_form && $this->nmgp_botoes['word'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rword_top\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['word'][] = "Rword_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bword", "", "", "Rword_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_word.php?script_case_init=" . $this->Ini->sc_page . "&summary_export_columns=N&nm_cor=CO&nm_res_cons=s&nm_ini_word_res=resume,chart&nm_all_modules=resume,chart&password=n&origem=res&language=fr&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
      if (!$this->grid_emb_form && $this->nmgp_botoes['xls'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rxls_top\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['xls'][] = "Rxls_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bexcel", "", "", "Rxls_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_xls.php?script_case_init=" . $this->Ini->sc_page . "&app_name=grid_fiche_prof_sante_stat_wilaya&nm_tp_xls=xlsx&nm_tot_xls=S&nm_tot_xls=S&nm_res_cons=s&nm_ini_xls_res=resume,chart&nm_all_modules=resume,chart&password=n&summary_export_columns=N&origem=res&language=fr&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
         if ($NM_Gbtn)
         {
                  $nm_saida->saida("           </td></tr><tr><td class=\"scBtnGrpBackground\">\r\n");
            $NM_Gbtn = false;
         }
      if (!$this->grid_emb_form && $this->nmgp_botoes['print'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rprinttop\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['print'][] = "Rprint_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bprint", "", "", "Rprint_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_print.php?script_case_init=" . $this->Ini->sc_page . "&summary_export_columns=N&nm_opc=resumo&nm_cor=CO&nm_res_cons=s&nm_ini_prt_res=resume,chart&nm_all_modules=resume,chart&password=n&origem=res&language=fr&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
          $Cod_Btn = nmButtonGroupTableOutput($this->arr_buttons, "group_group_1", 'group_1', 'top', 'list', 'fim');
          $nm_saida->saida("           $Cod_Btn\r\n");
          $nm_saida->saida("           <script type=\"text/javascript\">\r\n");
          $nm_saida->saida("             if (!sc_itens_btgp_group_1_top) {\r\n");
          $nm_saida->saida("                 document.getElementById('sc_btgp_btn_group_1_top').style.display='none'; }\r\n");
          $nm_saida->saida("           </script>\r\n");
      }
      if ($this->nmgp_botoes['chart_conf'] == 'on' && !$this->grid_emb_form && !$this->NM_res_sem_reg)
      {
         $this->nm_btn_exist['chart_conf'][] = "Rgraf_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bconf_graf", "", "", "Rgraf_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_graf_flash.php?nome_apl=grid_fiche_prof_sante_stat_wilaya&campo_apl=nm_resumo_graf&sc_page=" . NM_encode_input($this->Ini->sc_page) . "&language=fr&tp_apl=cns_htm&KeepThis=true&TB_iframe=true&height=450&width=400&modal=true", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
      }
      if ($this->nmgp_botoes['chart_settings'] == 'on' && !$this->grid_emb_form && !$this->NM_res_sem_reg)
      {
         $this->nm_btn_exist['chart_settings'][] = "Rconfig_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "smry_conf", "summaryConfig();", "summaryConfig();", "Rconfig_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
      }
      if ($this->nmgp_botoes['groupby'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opc_psq'] && !$this->grid_emb_form && !$this->NM_res_sem_reg)
      {
          $Q_free  = false;
          $Q_count = 0;
          foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['SC_All_Groupby'] as $QB => $Tp)
          {
              if (!in_array($QB, $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['SC_Groupby_hide']) && $Tp == "all")
              {
                  $Q_count++;
                  if ($QB == "sc_free_group_by")
                  {
                      $Q_free = true;
                  }
              }
          }
          if ($Q_count > 1 || $Q_free)
          {
             $this->nm_btn_exist['groupby'][] = "sel_groupby_top";
              $Cod_Btn = nmButtonOutput($this->arr_buttons, "bgroupby", "scBtnGroupByShow('" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_sel_groupby.php?opc_ret=resumo&path_img=" . $this->Ini->path_img_global . "&path_btn=" . $this->Ini->path_botoes . "&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&embbed_groupby=Y&toolbar_pos=top', 'top');", "scBtnGroupByShow('" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_sel_groupby.php?opc_ret=resumo&path_img=" . $this->Ini->path_img_global . "&path_btn=" . $this->Ini->path_botoes . "&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&embbed_groupby=Y&toolbar_pos=top', 'top');", "sel_groupby_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
              $nm_saida->saida("           $Cod_Btn \r\n");
          }
              $NM_btn = true;
      }
         $nm_saida->saida("     </TD> \r\n");
         $nm_saida->saida("     <TD class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"center\">\r\n");
         $NM_btn = false;
         $NM_Gbtn = false;
         $nm_saida->saida("     </TD> \r\n");
         $nm_saida->saida("     <TD class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"right\">\r\n");
         $NM_btn = false;
         $NM_Gbtn = false;
         if (is_file("grid_fiche_prof_sante_stat_wilaya_help.txt") && !$this->grid_emb_form && !$this->NM_res_sem_reg)
         {
            $Arq_WebHelp = file("grid_fiche_prof_sante_stat_wilaya_help.txt"); 
            if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
            {
                $Arq_WebHelp[0] = str_replace("\r\n" , "", trim($Arq_WebHelp[0]));
                $Tmp = explode(";", $Arq_WebHelp[0]); 
                foreach ($Tmp as $Cada_help)
                {
                    $Tmp1 = explode(":", $Cada_help); 
                    if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "res" && is_file($this->Ini->root . $this->Ini->path_help . $Tmp1[1]))
                    {
                        $Cod_Btn = nmButtonOutput($this->arr_buttons, "bhelp", "nm_open_popup('" . $this->Ini->path_help . $Tmp1[1] . "');", "nm_open_popup('" . $this->Ini->path_help . $Tmp1[1] . "');", "Rhelp_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
                        $nm_saida->saida("           $Cod_Btn \r\n");
                    }
                }
            }
         }
      if ($this->nmgp_botoes['chart_exit'] == 'on' && !$this->grid_emb_form)
      {
          $this->nm_btn_exist['exit'][] = "Rsai_top";
         if ($nm_apl_dependente == 1) 
         { 
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bvoltar", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
         } 
         elseif (!$this->Ini->Embutida_iframe && !$this->Ini->SC_Link_View && !$this->aba_iframe) 
         { 
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bsair", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
         } 
      }
         $nm_saida->saida("     </TD>\r\n");
         $nm_saida->saida("    </TR>\r\n");
         $nm_saida->saida("   </TABLE>\r\n");
         $nm_saida->saida("  </TD>\r\n");
         $nm_saida->saida(" </TR>\r\n");
      }
      $this->NM_res_sem_reg = $Save_res_sem_reg;
   }

   //-----  top
   function monta_barra_top_mobile()
   {
      global $nm_url_saida, $nm_apl_dependente, $nm_saida;
      $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""; 
      $Save_res_sem_reg = $this->NM_res_sem_reg;
      if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'] && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_resumo_search']))
      {
          $this->NM_res_sem_reg = false;
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
      {
         $nm_saida->saida(" <TR align=\"center\" id=\"obj_barra_top\">\r\n");
         $nm_saida->saida("  <TD class=\"" . $this->css_scGridTabelaTd . "\">\r\n");
         $nm_saida->saida("   <TABLE class=\"" . $this->css_scGridToolbar . "\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top; width: 100%;\">\r\n");
         $nm_saida->saida("    <TR class=\"" . $this->css_scGridToolbarPadd . "_tr\">\r\n");
         $nm_saida->saida("     <TD class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"left\">\r\n");
         $NM_btn  = false;
         $NM_Gbtn = false;
      if (!$this->grid_emb_form && $this->nmgp_botoes['group_1'] == "on")
      {
          $nm_saida->saida("           <script type=\"text/javascript\">var sc_itens_btgp_group_1_top = false;</script>\r\n");
          $Cod_Btn = nmButtonOutput($this->arr_buttons, "group_group_1", "scBtnGrpShow('group_1_top')", "scBtnGrpShow('group_1_top')", "sc_btgp_btn_group_1_top", "", "" . $this->Ini->Nm_lang['lang_btns_expt'] . "", "", "absmiddle", "", "", $this->Ini->path_botoes, "", "" . $this->Ini->Nm_lang['lang_btns_expt'] . "", "", "", "__sc_grp__", "text_img", "text_right", "", "", "", "", "", "", "");
          $nm_saida->saida("           $Cod_Btn\r\n");
          $NM_btn  = true;
          $NM_Gbtn = false;
          $Cod_Btn = nmButtonGroupTableOutput($this->arr_buttons, "group_group_1", 'group_1', 'top', 'list', 'ini');
          $nm_saida->saida("           $Cod_Btn\r\n");
      if (!$this->grid_emb_form && $this->nmgp_botoes['pdf'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rpdf_top\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['pdf'][] = "Rpdf_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bpdf", "", "", "Rpdf_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_pdf.php?nm_opc=pdf&nm_target=0&nm_cor=cor&papel=8&orientacao=1&bookmarks=1&largura=1200&conf_larg=S&conf_fonte=10&grafico=S&sc_ver_93=s&nm_tem_gb=s&nm_res_cons=s&nm_ini_pdf_res=resume,chart&nm_all_modules=resume,chart&password=n&summary_export_columns=N&pdf_zip=N&origem=res&language=fr&conf_socor=N&nm_label_group=N&nm_all_cab=S&nm_all_label=S&nm_orient_grid=2&script_case_init=" . $this->Ini->sc_page . "&app_name=grid_fiche_prof_sante_stat_wilaya&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
         if ($NM_Gbtn)
         {
                  $nm_saida->saida("           </td></tr><tr><td class=\"scBtnGrpBackground\">\r\n");
            $NM_Gbtn = false;
         }
      if (!$this->grid_emb_form && $this->nmgp_botoes['word'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rword_top\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['word'][] = "Rword_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bword", "", "", "Rword_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_word.php?script_case_init=" . $this->Ini->sc_page . "&summary_export_columns=N&nm_cor=CO&nm_res_cons=s&nm_ini_word_res=resume,chart&nm_all_modules=resume,chart&password=n&origem=res&language=fr&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
      if (!$this->grid_emb_form && $this->nmgp_botoes['xls'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rxls_top\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['xls'][] = "Rxls_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bexcel", "", "", "Rxls_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_xls.php?script_case_init=" . $this->Ini->sc_page . "&app_name=grid_fiche_prof_sante_stat_wilaya&nm_tp_xls=xlsx&nm_tot_xls=S&nm_tot_xls=S&nm_res_cons=s&nm_ini_xls_res=resume,chart&nm_all_modules=resume,chart&password=n&summary_export_columns=N&origem=res&language=fr&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
         if ($NM_Gbtn)
         {
                  $nm_saida->saida("           </td></tr><tr><td class=\"scBtnGrpBackground\">\r\n");
            $NM_Gbtn = false;
         }
      if (!$this->grid_emb_form && $this->nmgp_botoes['print'] == "on" && !$this->NM_res_sem_reg)
      {
          $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
          $nm_saida->saida("            <div id=\"div_Rprinttop\" class=\"scBtnGrpText scBtnGrpClick\">\r\n");
         $this->nm_btn_exist['print'][] = "Rprint_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bprint", "", "", "Rprint_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_print.php?script_case_init=" . $this->Ini->sc_page . "&summary_export_columns=N&nm_opc=resumo&nm_cor=CO&nm_res_cons=s&nm_ini_prt_res=resume,chart&nm_all_modules=resume,chart&password=n&origem=res&language=fr&KeepThis=true&TB_iframe=true&modal=true", "group_1", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
          $nm_saida->saida("            </div>\r\n");
      }
          $Cod_Btn = nmButtonGroupTableOutput($this->arr_buttons, "group_group_1", 'group_1', 'top', 'list', 'fim');
          $nm_saida->saida("           $Cod_Btn\r\n");
          $nm_saida->saida("           <script type=\"text/javascript\">\r\n");
          $nm_saida->saida("             if (!sc_itens_btgp_group_1_top) {\r\n");
          $nm_saida->saida("                 document.getElementById('sc_btgp_btn_group_1_top').style.display='none'; }\r\n");
          $nm_saida->saida("           </script>\r\n");
      }
      if ($this->nmgp_botoes['chart_conf'] == 'on' && !$this->grid_emb_form && !$this->NM_res_sem_reg)
      {
         $this->nm_btn_exist['chart_conf'][] = "Rgraf_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bconf_graf", "", "", "Rgraf_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_config_graf_flash.php?nome_apl=grid_fiche_prof_sante_stat_wilaya&campo_apl=nm_resumo_graf&sc_page=" . NM_encode_input($this->Ini->sc_page) . "&language=fr&tp_apl=cns_htm&KeepThis=true&TB_iframe=true&height=450&width=400&modal=true", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
      }
      if ($this->nmgp_botoes['chart_settings'] == 'on' && !$this->grid_emb_form && !$this->NM_res_sem_reg)
      {
         $this->nm_btn_exist['chart_settings'][] = "Rconfig_top";
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "smry_conf", "summaryConfig();", "summaryConfig();", "Rconfig_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
      }
      if ($this->nmgp_botoes['groupby'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opc_psq'] && !$this->grid_emb_form && !$this->NM_res_sem_reg)
      {
          $Q_free  = false;
          $Q_count = 0;
          foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['SC_All_Groupby'] as $QB => $Tp)
          {
              if (!in_array($QB, $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['SC_Groupby_hide']) && $Tp == "all")
              {
                  $Q_count++;
                  if ($QB == "sc_free_group_by")
                  {
                      $Q_free = true;
                  }
              }
          }
          if ($Q_count > 1 || $Q_free)
          {
             $this->nm_btn_exist['groupby'][] = "sel_groupby_top";
              $Cod_Btn = nmButtonOutput($this->arr_buttons, "bgroupby", "scBtnGroupByShow('" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_sel_groupby.php?opc_ret=resumo&path_img=" . $this->Ini->path_img_global . "&path_btn=" . $this->Ini->path_botoes . "&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&embbed_groupby=Y&toolbar_pos=top', 'top');", "scBtnGroupByShow('" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_sel_groupby.php?opc_ret=resumo&path_img=" . $this->Ini->path_img_global . "&path_btn=" . $this->Ini->path_botoes . "&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&embbed_groupby=Y&toolbar_pos=top', 'top');", "sel_groupby_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
              $nm_saida->saida("           $Cod_Btn \r\n");
          }
              $NM_btn = true;
      }
         if (is_file("grid_fiche_prof_sante_stat_wilaya_help.txt") && !$this->grid_emb_form && !$this->NM_res_sem_reg)
         {
            $Arq_WebHelp = file("grid_fiche_prof_sante_stat_wilaya_help.txt"); 
            if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
            {
                $Arq_WebHelp[0] = str_replace("\r\n" , "", trim($Arq_WebHelp[0]));
                $Tmp = explode(";", $Arq_WebHelp[0]); 
                foreach ($Tmp as $Cada_help)
                {
                    $Tmp1 = explode(":", $Cada_help); 
                    if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "res" && is_file($this->Ini->root . $this->Ini->path_help . $Tmp1[1]))
                    {
                        $Cod_Btn = nmButtonOutput($this->arr_buttons, "bhelp", "nm_open_popup('" . $this->Ini->path_help . $Tmp1[1] . "');", "nm_open_popup('" . $this->Ini->path_help . $Tmp1[1] . "');", "Rhelp_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
                        $nm_saida->saida("           $Cod_Btn \r\n");
                    }
                }
            }
         }
      if ($this->nmgp_botoes['chart_exit'] == 'on' && !$this->grid_emb_form)
      {
          $this->nm_btn_exist['exit'][] = "Rsai_top";
         if ($nm_apl_dependente == 1) 
         { 
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bvoltar", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
         } 
         elseif (!$this->Ini->Embutida_iframe && !$this->Ini->SC_Link_View && !$this->aba_iframe) 
         { 
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bsair", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "document.FRES.action='$nm_url_saida'; document.FRES.submit();", "", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
         } 
      }
         $nm_saida->saida("     </TD>\r\n");
         $nm_saida->saida("    </TR>\r\n");
         $nm_saida->saida("   </TABLE>\r\n");
         $nm_saida->saida("  </TD>\r\n");
         $nm_saida->saida(" </TR>\r\n");
      }
      $this->NM_res_sem_reg = $Save_res_sem_reg;
   }

   function monta_barra_top()
   {
       $this->grid_emb_form = false;
       if(isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
       {
           $this->monta_barra_top_mobile();
       }
       else
       {
           $this->monta_barra_top_normal();
       }
   }
   function monta_barra_bot()
   {
       $this->grid_emb_form = false;
       if(isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
       {
           $this->monta_barra_bot_mobile();
       }
       else
       {
           $this->monta_barra_bot_normal();
       }
   }
   function monta_embbed_placeholder_top()
   {
      global $nm_saida;
      $nm_saida->saida("     <tr id=\"sc_id_save_grid_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
      $nm_saida->saida("     <tr id=\"sc_id_groupby_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
      $nm_saida->saida("     <tr id=\"sc_id_sel_campos_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
      $nm_saida->saida("     <tr id=\"sc_id_order_campos_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
   }
   function monta_embbed_placeholder_mobile_top()
   {
      global $nm_saida;
      $nm_saida->saida("     <tr id=\"sc_id_save_grid_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
      $nm_saida->saida("     <tr id=\"sc_id_groupby_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
      $nm_saida->saida("     <tr id=\"sc_id_sel_campos_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
      $nm_saida->saida("     <tr id=\"sc_id_order_campos_placeholder_top\" style=\"display: none\">\r\n");
      $nm_saida->saida("      <td>\r\n");
      $nm_saida->saida("      </td>\r\n");
      $nm_saida->saida("     </tr>\r\n");
   }
   //----- 
   function monta_html_fim()
   {
      global $nm_saida;
      $str_pbfile = $this->Ini->root . $this->Ini->path_imag_temp . '/sc_pb_' . session_id() . '.tmp';
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['print_all'])
      {
          $this->grafico_pdf();
      }
      $nm_saida->saida("</TABLE>\r\n");
      $nm_saida->saida("<link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" . $this->Ini->str_schema_all . "_sweetalert.css\" />\r\n");
      $nm_saida->saida("<script type=\"text/javascript\" src=\"" . $_SESSION['scriptcase']['grid_fiche_prof_sante_stat_wilaya']['glo_nm_path_prod'] . "/third/sweetalert/sweetalert2.all.min.js\"></script>\r\n");
      $nm_saida->saida("<script type=\"text/javascript\" src=\"" . $_SESSION['scriptcase']['grid_fiche_prof_sante_stat_wilaya']['glo_nm_path_prod'] . "/third/sweetalert/polyfill.min.js\"></script>\r\n");
      $nm_saida->saida("<script type=\"text/javascript\" src=\"../_lib/lib/js/frameControl.js\"></script>\r\n");
      $confirmButtonClass = '';
      $cancelButtonClass  = '';
      $confirmButtonText  = $this->Ini->Nm_lang['lang_btns_cfrm'];
      $cancelButtonText   = $this->Ini->Nm_lang['lang_btns_cncl'];
      $confirmButtonFA    = '';
      $cancelButtonFA     = '';
      $confirmButtonFAPos = '';
      $cancelButtonFAPos  = '';
      if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['style']) && '' != $this->arr_buttons['bsweetalert_ok']['style']) {
          $confirmButtonClass = 'scButton_' . $this->arr_buttons['bsweetalert_ok']['style'];
      }
      if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['style']) && '' != $this->arr_buttons['bsweetalert_cancel']['style']) {
          $cancelButtonClass = 'scButton_' . $this->arr_buttons['bsweetalert_cancel']['style'];
      }
      if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['value']) && '' != $this->arr_buttons['bsweetalert_ok']['value']) {
          $confirmButtonText = $this->arr_buttons['bsweetalert_ok']['value'];
      }
      if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['value']) && '' != $this->arr_buttons['bsweetalert_cancel']['value']) {
          $cancelButtonText = $this->arr_buttons['bsweetalert_cancel']['value'];
      }
      if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) {
          $confirmButtonFA = $this->arr_buttons['bsweetalert_ok']['fontawesomeicon'];
      }
      if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) {
          $cancelButtonFA = $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon'];
      }
      if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_ok']['display_position']) {
          $confirmButtonFAPos = 'text_right';
      }
      if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_cancel']['display_position']) {
          $cancelButtonFAPos = 'text_right';
      }
      $nm_saida->saida("<script type=\"text/javascript\">\r\n");
      $nm_saida->saida("  var scSweetAlertConfirmButton = \"" . $confirmButtonClass . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertCancelButton = \"" . $cancelButtonClass . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertConfirmButtonText = \"" . $confirmButtonText . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertCancelButtonText = \"" . $cancelButtonText . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertConfirmButtonFA = \"" . $confirmButtonFA . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertCancelButtonFA = \"" . $cancelButtonFA . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertConfirmButtonFAPos = \"" . $confirmButtonFAPos . "\";\r\n");
      $nm_saida->saida("  var scSweetAlertCancelButtonFAPos = \"" . $cancelButtonFAPos . "\";\r\n");
      $nm_saida->saida("</script>\r\n");
      $nm_saida->saida("<script type=\"text/javascript\">\r\n");
      $nm_saida->saida("$(function() {\r\n");
      if ((isset($this->nm_mens_alert) && count($this->nm_mens_alert)) || (isset($this->Ini->nm_mens_alert) && count($this->Ini->nm_mens_alert))) {
   if (isset($this->Ini->nm_mens_alert) && !empty($this->Ini->nm_mens_alert))
   {
       if (isset($this->nm_mens_alert) && !empty($this->nm_mens_alert))
       {
           $this->nm_mens_alert   = array_merge($this->Ini->nm_mens_alert, $this->nm_mens_alert);
           $this->nm_params_alert = array_merge($this->Ini->nm_params_alert, $this->nm_params_alert);
       }
       else
       {
           $this->nm_mens_alert   = $this->Ini->nm_mens_alert;
           $this->nm_params_alert = $this->Ini->nm_params_alert;
       }
   }
   if (isset($this->nm_mens_alert) && !empty($this->nm_mens_alert))
   {
       foreach ($this->nm_mens_alert as $i_alert => $mensagem)
       {
           $alertParams = array();
           if (isset($this->nm_params_alert[$i_alert]))
           {
               foreach ($this->nm_params_alert[$i_alert] as $paramName => $paramValue)
               {
                   if (in_array($paramName, array('title', 'timer', 'confirmButtonText', 'confirmButtonFA', 'confirmButtonFAPos', 'cancelButtonText', 'cancelButtonFA', 'cancelButtonFAPos', 'footer', 'width', 'padding')))
                   {
                       $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
                   }
                   elseif (in_array($paramName, array('showConfirmButton', 'showCancelButton', 'toast')) && in_array($paramValue, array(true, false)))
                   {
                       $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
                   }
                   elseif ('position' == $paramName && in_array($paramValue, array('top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom', 'bottom-start', 'bottom-end')))
                   {
                       $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
                   }
                   elseif ('type' == $paramName && in_array($paramValue, array('warning', 'error', 'success', 'info', 'question')))
                   {
                       $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
                   }
                   elseif ('background' == $paramName)
                   {
                       $image_param = $paramValue;
                       preg_match_all('/url\(([\s])?(["|\'])?(.*?)(["|\'])?([\s])?\)/i', $paramValue, $matches, PREG_PATTERN_ORDER);
                       if (isset($matches[3])) {
                           foreach ($matches[3] as $match) {
                               if ('http:' != substr($match, 0, 5) && 'https:' != substr($match, 0, 6) && '/' != substr($match, 0, 1)) {
                                   $image_param = str_replace($match, "{$this->Ini->path_img_global}/{$match}", $image_param);
                               }
                           }
                       }
                       $paramValue = $image_param;
                       $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
                   }
               }
           }
           $jsonParams = json_encode($alertParams);
           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
           { 
               $this->Ini->Arr_result['AlertJS'][] = NM_charset_to_utf8($mensagem);
               $this->Ini->Arr_result['AlertJSParam'][] = $alertParams;
           } 
           else 
           { 
$nm_saida->saida("       scJs_alert('" . $mensagem . "', $jsonParams);\r\n");
           } 
       }
   }
      }
      $nm_saida->saida("});\r\n");
      $nm_saida->saida("</script>\r\n");
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'])
      { 
          return;
      } 
      if (!isset($_GET['flash_graf']))
      {
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
      { 
      $nm_saida->saida("</BODY>\r\n");
      $nm_saida->saida("</HTML>\r\n");
          return;
      } 
      if (isset($_GET['flash_graf']) && 'pdf' == $_GET['flash_graf'])
      {
          $this->grafico_pdf_flash();
      }
      elseif ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['opcao'] == "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['graf_pdf'] == "S")
      {
          $this->grafico_pdf();
      }
      else
      {
if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['doc_word'])
{ 
      $nm_saida->saida("</TABLE>\r\n");
      $nm_saida->saida("</div>\r\n");
      $nm_saida->saida("</TD>\r\n");
      $nm_saida->saida("</TR>\r\n");
      $nm_saida->saida("</TABLE>\r\n");
       $nm_saida->saida("<script type=\"text/javascript\">\r\n");
       $nm_saida->saida("function summaryConfig() {\r\n");
       $nm_saida->saida("  tb_show('', 'grid_fiche_prof_sante_stat_wilaya_config_pivot.php?nome_apl=grid_fiche_prof_sante_stat_wilaya&sc_page=" . NM_encode_input($this->Ini->sc_page) . "&language=fr&TB_iframe=true&modal=true&height=300&width=500', '');\r\n");
       $nm_saida->saida("}\r\n");
       $nm_saida->saida("function changeSort(col, ord, oldSort) {\r\n");
       $nm_saida->saida("  Parm_change  = 'change_sort*scin';\r\n");
       $nm_saida->saida("  Parm_change += oldSort ? 'Y' : 'NEW';\r\n");
       $nm_saida->saida("  Parm_change += '*scoutsort_col*scin';\r\n");
       $nm_saida->saida("  Parm_change +=  col;\r\n");
       $nm_saida->saida("  Parm_change += '*scoutsort_ord*scin';\r\n");
       $nm_saida->saida("  Parm_change +=  ord;\r\n");
       $nm_saida->saida("  nm_gp_submit_ajax('resumo', Parm_change);\r\n");
       $nm_saida->saida("}\r\n");
       $nm_saida->saida("</script>\r\n");
       $nm_saida->saida("<form name=\"refresh_config\" method=\"post\" action=\"grid_fiche_prof_sante_stat_wilaya.php\" style=\"display: none\">\r\n");
       $nm_saida->saida("<input type=\"hidden\" name=\"nmgp_opcao\" value=\"resumo\" />\r\n");
       $nm_saida->saida("<input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\" />\r\n");
       $nm_saida->saida("<input type=\"hidden\" name=\"change_sort\" value=\"N\" />\r\n");
       $nm_saida->saida("<input type=\"hidden\" name=\"sort_col\" />\r\n");
       $nm_saida->saida("<input type=\"hidden\" name=\"sort_ord\" />\r\n");
       $nm_saida->saida("</form>\r\n");
}
          $nm_saida->saida("<FORM name=\"F3\" method=\"post\" action=\"grid_fiche_prof_sante_stat_wilaya.php\"\r\n");
          $nm_saida->saida("                                  target = \"_self\" style=\"display: none\"> \r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_chave\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_opcao\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_tipo_pdf\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_ordem\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_chave_det\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_quant_linhas\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_url_saida\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_parms\" value=\"\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_outra_jan\" value=\"\"/>\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_orig_pesq\" value=\"\"/>\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\" />\r\n");
          $nm_saida->saida("</FORM>\r\n");
          $nm_saida->saida("<form name=\"FRES\" method=\"post\" \r\n");
          $nm_saida->saida("                    action=\"\" \r\n");
          $nm_saida->saida("                    target=\"_self\" style=\"display: none\"> \r\n");
          $nm_saida->saida("<input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
          $nm_saida->saida("</form> \r\n");
          $nm_saida->saida("<form name=\"FRES_chart_export_view\" method=\"get\" target=\"_blank\" style=\"display: none\"></form>\r\n");
          $nm_saida->saida("<form name=\"FCONS\" method=\"post\" \r\n");
          $nm_saida->saida("                    action=\"grid_fiche_prof_sante_stat_wilaya.php\" \r\n");
          $nm_saida->saida("                    target=\"_self\" style=\"display: none\"> \r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_opcao\" value=\"link_res\" />\r\n");
          $nm_saida->saida("<INPUT type=\"hidden\" name=\"nmgp_parms_where\" value=\"\" />\r\n");
          $nm_saida->saida("<input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
          $nm_saida->saida("</form> \r\n");
   $nm_saida->saida("   <form name=\"F4\" method=\"post\" \r\n");
   $nm_saida->saida("                     action=\"grid_fiche_prof_sante_stat_wilaya.php\" \r\n");
   $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"rec\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"rec\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_call_php\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
   $nm_saida->saida("   </form> \r\n");
          $nm_saida->saida("<form name=\"Fgraf\" method=\"post\" \r\n");
          $nm_saida->saida("                   action=\"grid_fiche_prof_sante_stat_wilaya.php\" \r\n");
          $nm_saida->saida("                   target=\"_self\" style=\"display: none\"> \r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"nmgp_opcao\" value=\"grafico\"/>\r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"campo\" value=\"\"/>\r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"nivel_quebra\" value=\"\"/>\r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"campo_val\" value=\"\"/>\r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"nmgp_parms\" value=\"\" />\r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
          $nm_saida->saida("  <input type=\"hidden\" name=\"summary_css\" value=\"" . NM_encode_input($this->Ini->summary_css) . "\"/> \r\n");
          $nm_saida->saida("</form> \r\n");
   $nm_saida->saida("<form name=\"Fprint\" id=\"sc-id-form-print\" method=\"post\" \r\n");
   $nm_saida->saida("                  action=\"grid_fiche_prof_sante_stat_wilaya_iframe_prt.php\" \r\n");
   $nm_saida->saida("                  target=\"jan_print\" style=\"display: none\"> \r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"path_botoes\" value=\"" . $this->Ini->path_botoes . "\"/> \r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"opcao\" value=\"res_print\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"tp_print\" value=\"RC\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"cor_print\" value=\"CO\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"nmgp_opcao\" value=\"res_print\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"nmgp_tipo_print\" value=\"RC\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"nmgp_cor_print\" value=\"CO\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
   $nm_saida->saida("  <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
   $nm_saida->saida("</form> \r\n");
   $nm_saida->saida("   <form name=\"Fexport\" id=\"sc-id-form-export\" method=\"post\" \r\n");
   $nm_saida->saida("                     action=\"grid_fiche_prof_sante_stat_wilaya.php\" \r\n");
   $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tp_xls\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tot_xls\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_delim_line\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_delim_col\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_delim_dados\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_label_csv\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_xml_tag\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_xml_label\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_json_format\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nm_json_label\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
   $nm_saida->saida("   </form> \r\n");
   $nm_saida->saida("  <form name=\"Fdoc_word\" id=\"sc-id-form-word-export\" method=\"post\" style=\"display: none\" \r\n");
   $nm_saida->saida("      action=\"grid_fiche_prof_sante_stat_wilaya.php\" \r\n");
   $nm_saida->saida("      target=\"_self\"> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"doc_word_res\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_cor_word\" value=\"CO\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_navegator_print\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
   $nm_saida->saida("  </form> \r\n");
   $nm_saida->saida("  <form name=\"Fres_pdf\" method=\"post\" target=\"_self\">\r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_parms\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"sc_tp_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tipo_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"sc_parms_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_parms_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"chart_level\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"sc_create_charts\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"sc_graf_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_graf_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"use_pass_pdf\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"pdf_all_cab\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"pdf_all_label\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"pdf_label_group\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"pdf_zip\" value=\"\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
   $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" . session_id() . "\"/> \r\n");
   $nm_saida->saida("  </form> \r\n");
   $nm_saida->saida("<SCRIPT language=\"Javascript\">\r\n");
   $nm_saida->saida("   $(function(){ \r\n");
   $nm_saida->saida("       NM_btn_disable();\r\n");
   $nm_saida->saida("   }); \r\n");
   $nm_saida->saida("   function NM_btn_disable()\r\n");
   $nm_saida->saida("   {\r\n");
   foreach ($this->nm_btn_disabled as $cod_btn => $st_btn) {
      if (isset($this->nm_btn_exist[$cod_btn]) && $st_btn == 'on') {
         foreach ($this->nm_btn_exist[$cod_btn] as $cada_id) {
           $nm_saida->saida("     $('#" . $cada_id . "').prop('onclick', null).off('click').addClass('disabled').removeAttr('href');\r\n");
           $nm_saida->saida("     $('#div_" . $cada_id . "').addClass('disabled');\r\n");
         }
      }
   }
   $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_gp_word_conf(cor, SC_module_export, password, ajax, str_type, bol_param)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (\"R\" == ajax)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           $('#TB_window').remove();\r\n");
          $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
          $nm_saida->saida("               nm_submit_modal(\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\"+ str_type +\"&sAdd=__E__nmgp_cor_word=\" + cor + \"__E__SC_module_export=\" + SC_module_export + \"__E__nmgp_password=\" + password + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.Fdoc_word.nmgp_cor_word.value = cor;\r\n");
          $nm_saida->saida("           document.Fdoc_word.nmgp_password.value = password;\r\n");
          $nm_saida->saida("           document.Fdoc_word.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("               document.Fdoc_word.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("           document.Fdoc_word.submit();\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida(" function nm_link_cons(x) \r\n");
          $nm_saida->saida(" {\r\n");
          $nm_saida->saida("     document.FCONS.nmgp_parms_where.value = x;\r\n");
          $nm_saida->saida("     document.FCONS.submit();\r\n");
          $nm_saida->saida(" }\r\n");
          $nm_saida->saida("   function nm_gp_print_conf(tp, cor, SC_module_export, password, ajax, str_type, bol_param)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (\"R\" == ajax)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           $('#TB_window').remove();\r\n");
          $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
          $nm_saida->saida("               nm_submit_modal(\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\"+ str_type +\"&sAdd=__E__cor_print=\" + cor + \"__E__SC_module_export=\" + SC_module_export + \"__E__nmgp_password=\" + password + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.Fprint.tp_print.value = tp;\r\n");
          $nm_saida->saida("           document.Fprint.cor_print.value = cor;\r\n");
          $nm_saida->saida("           document.Fprint.nmgp_tipo_print.value = tp;\r\n");
          $nm_saida->saida("           document.Fprint.nmgp_cor_print.value = cor;\r\n");
          $nm_saida->saida("           document.Fprint.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("           document.Fprint.nmgp_password.value = password;\r\n");
          $nm_saida->saida("           if (password != \"\")\r\n");
          $nm_saida->saida("           {\r\n");
          $nm_saida->saida("               document.Fprint.target = '_self';\r\n");
          $nm_saida->saida("               document.Fprint.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("           }\r\n");
          $nm_saida->saida("           else\r\n");
          $nm_saida->saida("           {\r\n");
          $nm_saida->saida("               window.open('','jan_print','location=no,menubar=no,resizable,scrollbars,status=no,toolbar=no');\r\n");
          $nm_saida->saida("           }\r\n");
          $nm_saida->saida("           document.Fprint.submit() ;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_gp_xls_conf(tp_xls, SC_module_export, password, tot_xls, ajax, str_type, bol_param)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (\"R\" == ajax)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           $('#TB_window').remove();\r\n");
          $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
          $nm_saida->saida("               nm_submit_modal(\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__SC_module_export=\" + SC_module_export + \"__E__nmgp_tp_xls=\" + tp_xls + \"__E__nmgp_tot_xls=\" + tot_xls + \"__E__nmgp_password=\" + password + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_opcao.value = 'xls_res';\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_tp_xls.value = tp_xls;\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_tot_xls.value = tot_xls;\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
          $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("               document.Fexport.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("           document.Fexport.submit() ;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_gp_csv_conf(delim_line, delim_col, delim_dados, label_csv, SC_module_export, password, ajax, str_type, bol_param)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (\"R\" == ajax)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           $('#TB_window').remove();\r\n");
          $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
          $nm_saida->saida("               nm_submit_modal(\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__nm_delim_line=\" + delim_line + \"__E__nm_delim_col=\" + delim_col + \"__E__nm_delim_dados=\" + delim_dados + \"__E__nm_label_csv=\" + label_csv + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_opcao.value = \"csv_res\";\r\n");
          $nm_saida->saida("           document.Fexport.nm_delim_line.value = delim_line;\r\n");
          $nm_saida->saida("           document.Fexport.nm_delim_col.value = delim_col;\r\n");
          $nm_saida->saida("           document.Fexport.nm_delim_dados.value = delim_dados;\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
          $nm_saida->saida("           document.Fexport.nm_label_csv.value = label_csv;\r\n");
          $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("               document.Fexport.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("           document.Fexport.submit() ;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_gp_xml_conf(xml_tag, xml_label, SC_module_export, password, ajax, str_type, bol_param)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (\"R\" == ajax)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           $('#TB_window').remove();\r\n");
          $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
          $nm_saida->saida("               nm_submit_modal(\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__nm_xml_tag=\" + xml_tag + \"__E__nm_xml_label=\" + xml_label + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_opcao.value = \"xml_res\";\r\n");
          $nm_saida->saida("           document.Fexport.nm_xml_tag.value   = xml_tag;\r\n");
          $nm_saida->saida("           document.Fexport.nm_xml_label.value = xml_label;\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
          $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("               document.Fexport.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("           document.Fexport.submit() ;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_gp_json_conf(json_format, json_label, SC_module_export, password, ajax, str_type, bol_param)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (\"R\" == ajax)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           $('#TB_window').remove();\r\n");
          $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
          $nm_saida->saida("               nm_submit_modal(\"" . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__nm_json_format=\" + json_format + \"__E__nm_json_label=\" + json_label + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_opcao.value    = \"json_res\";\r\n");
          $nm_saida->saida("           document.Fexport.nm_json_format.value   = json_format;\r\n");
          $nm_saida->saida("           document.Fexport.nm_json_label.value = json_label;\r\n");
          $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
          $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("               document.Fexport.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("           document.Fexport.submit() ;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_gp_rtf_conf()\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       document.Fexport.nmgp_opcao.value = \"rtf_res\";\r\n");
          $nm_saida->saida("       document.Fexport.action = \"grid_fiche_prof_sante_stat_wilaya_export_ctrl.php\";\r\n");
          $nm_saida->saida("       document.Fexport.submit() ;\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida(" function nm_open_export(arq_export) \r\n");
          $nm_saida->saida(" { \r\n");
          $nm_saida->saida("    window.location = arq_export;\r\n");
          $nm_saida->saida(" } \r\n");
          $nm_saida->saida(" function nm_gp_submit_ajax(opc, parm) \r\n");
          $nm_saida->saida(" { \r\n");
          $nm_saida->saida("    return ajax_navigate_res(opc, parm); \r\n");
          $nm_saida->saida(" } \r\n");
          $nm_saida->saida("   function nm_submit_modal(parms, t_parent) \r\n");
          $nm_saida->saida("   { \r\n");
          $nm_saida->saida("      if (t_parent == 'S' && typeof parent.tb_show == 'function')\r\n");
          $nm_saida->saida("      { \r\n");
          $nm_saida->saida("           parent.tb_show('', parms, '');\r\n");
          $nm_saida->saida("      } \r\n");
          $nm_saida->saida("      else\r\n");
          $nm_saida->saida("      { \r\n");
          $nm_saida->saida("         tb_show('', parms, '');\r\n");
          $nm_saida->saida("      } \r\n");
          $nm_saida->saida("   } \r\n");
          $nm_saida->saida("   function nm_move() \r\n");
          $nm_saida->saida("   { \r\n");
          $nm_saida->saida("      document.F3.target = \"_self\"; \r\n");
          $nm_saida->saida("      document.F3.submit();\r\n");
          $nm_saida->saida("   } \r\n");
          $nm_saida->saida(" function nm_gp_move(x, y, z, p, g, crt, ajax, chart_level, page_break_pdf, SC_module_export, use_pass_pdf, pdf_all_cab, pdf_all_label, pdf_label_group, pdf_zip) \r\n");
          $nm_saida->saida(" {\r\n");
          $nm_saida->saida("  document.F3.nmgp_opcao.value = x;\r\n");
          $nm_saida->saida("  document.F3.target = \"_self\"; \r\n");
          $nm_saida->saida("  if (y == 1) \r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("      document.F3.target = \"_blank\"; \r\n");
          $nm_saida->saida("  }\r\n");
          $nm_saida->saida("  if (\"busca\" == x)\r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("      document.F3.nmgp_orig_pesq.value = z; \r\n");
          $nm_saida->saida("      z = '';\r\n");
          $nm_saida->saida("  }\r\n");
          $nm_saida->saida("  if (z != null && z != '') \r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("     document.F3.nmgp_tipo_pdf.value = z;\r\n");
          $nm_saida->saida("  }\r\n");
          $nm_saida->saida("  document.F3.script_case_init.value = \"" . NM_encode_input($this->Ini->sc_page) . "\" ;\r\n");
          $nm_saida->saida("  if (\"xls_res\" == x)\r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("       document.F3.SC_module_export.value = z;\r\n");
          $nm_saida->saida("       str_type = (z == \"s\") ? \"xls\" : \"xls_res\"\r\n");
          $nm_saida->saida("       document.F3.nmgp_opcao.value = str_type;\r\n");
      if (!extension_loaded("zip"))
      {
          $nm_saida->saida("      alert (\"" . html_entity_decode($this->Ini->Nm_lang['lang_othr_prod_xtzp'], ENT_COMPAT, $_SESSION['scriptcase']['charset']) . "\");\r\n");
          $nm_saida->saida("      return false;\r\n");
      } 
          $nm_saida->saida("  }\r\n");
          $nm_saida->saida("  if (\"xml_res\" == x)\r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("       document.F3.SC_module_export.value = z;\r\n");
          $nm_saida->saida("  }\r\n");
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['grid_fiche_prof_sante_stat_wilaya_iframe_params'] = array(
          'str_tmp'          => $this->Ini->path_imag_temp,
          'str_prod'         => $this->Ini->path_prod,
          'str_btn'          => $this->Ini->Str_btn_css,
          'str_lang'         => $this->Ini->str_lang,
          'str_schema'       => $this->Ini->str_schema_all,
          'str_google_fonts' => $this->Ini->str_google_fonts,
      );
      $prep_parm_pdf = "nmgp_opcao?#?pdf_res?@?scsess?#?" . session_id() . "?@?str_tmp?#?" . $this->Ini->path_imag_temp . "?@?str_prod?#?" . $this->Ini->path_prod . "?@?str_btn?#?" . $this->Ini->Str_btn_css . "?@?str_lang?#?" . $this->Ini->str_lang . "?@?str_schema?#?"  . $this->Ini->str_schema_all . "?@?script_case_init?#?" . $this->Ini->sc_page . "?@?jspath?#?" . $this->Ini->path_js . "?#?";
      $Md5_pdf    = "@SC_par@" . NM_encode_input($this->Ini->sc_page) . "@SC_par@grid_fiche_prof_sante_stat_wilaya@SC_par@" . md5($prep_parm_pdf);
      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['Md5_pdf'][md5($prep_parm_pdf)] = $prep_parm_pdf;
          $nm_saida->saida("      document.Fres_pdf.sc_tp_pdf.value = z;\r\n");
          $nm_saida->saida("      document.Fres_pdf.nmgp_tipo_pdf.value = z;\r\n");
          $nm_saida->saida("      document.Fres_pdf.sc_parms_pdf.value = p;\r\n");
          $nm_saida->saida("      document.Fres_pdf.nmgp_parms_pdf.value = p;\r\n");
          $nm_saida->saida("      document.Fres_pdf.chart_level.value = chart_level;\r\n");
          $nm_saida->saida("      document.Fres_pdf.sc_create_charts.value = crt;\r\n");
          $nm_saida->saida("      document.Fres_pdf.sc_graf_pdf.value = g;\r\n");
          $nm_saida->saida("      document.Fres_pdf.nmgp_graf_pdf.value = g;\r\n");
          $nm_saida->saida("      document.Fres_pdf.SC_module_export.value = SC_module_export;\r\n");
          $nm_saida->saida("      document.Fres_pdf.use_pass_pdf.value = use_pass_pdf;\r\n");
          $nm_saida->saida("      document.Fres_pdf.pdf_all_cab.value = pdf_all_cab;\r\n");
          $nm_saida->saida("      document.Fres_pdf.pdf_all_label.value = pdf_all_label;\r\n");
          $nm_saida->saida("      document.Fres_pdf.pdf_label_group.value = pdf_label_group;\r\n");
          $nm_saida->saida("      document.Fres_pdf.pdf_zip.value = pdf_zip;\r\n");
          $nm_saida->saida("  if (\"pdf\" == x)\r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("      if (\"R\" == ajax)\r\n");
          $nm_saida->saida("      {\r\n");
          $nm_saida->saida("          ajax_export('pdf_res','&sc_tp_pdf=' + z + '&sc_parms_pdf=' + p + '&sc_create_charts=' + crt + '&sc_graf_pdf=' + g + '&chart_level=' + chart_level, false);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("      else\r\n");
          $nm_saida->saida("      {\r\n");
          $nm_saida->saida("          document.Fres_pdf.nmgp_parms.value = \"" . $Md5_pdf . "\" ;\r\n");
          $nm_saida->saida("          document.Fres_pdf.action = \"grid_fiche_prof_sante_stat_wilaya_iframe.php\";\r\n");
          $nm_saida->saida("          document.Fres_pdf.submit();\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("  }\r\n");
          $nm_saida->saida("  else\r\n");
          $nm_saida->saida("  {\r\n");
          $nm_saida->saida("      document.F3.submit();\r\n");
          $nm_saida->saida("  }\r\n");
          $nm_saida->saida(" }\r\n");
          $nm_saida->saida(" function nm_gp_submit5(apl_lig, apl_saida, parms, target, opc, modal_h, modal_w) \r\n");
          $nm_saida->saida(" { \r\n");
          $nm_saida->saida("    if (apl_lig.substr(0, 7) == \"http://\" || apl_lig.substr(0, 8) == \"https://\")\r\n");
          $nm_saida->saida("    {\r\n");
          $nm_saida->saida("        if (target == '_blank') \r\n");
          $nm_saida->saida("        {\r\n");
          $nm_saida->saida("            window.open (apl_lig);\r\n");
          $nm_saida->saida("        }\r\n");
          $nm_saida->saida("        else\r\n");
          $nm_saida->saida("        {\r\n");
          $nm_saida->saida("            window.location = apl_lig;\r\n");
          $nm_saida->saida("        }\r\n");
          $nm_saida->saida("        return;\r\n");
          $nm_saida->saida("    }\r\n");
          $nm_saida->saida("    if (target == 'modal') \r\n");
          $nm_saida->saida("    {\r\n");
          $nm_saida->saida("        par_modal = '?script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&nmgp_outra_jan=true&nmgp_url_saida=modal';\r\n");
          $nm_saida->saida("        if (opc != null && opc != '') \r\n");
          $nm_saida->saida("        {\r\n");
          $nm_saida->saida("            par_modal += '&nmgp_opcao=grid';\r\n");
          $nm_saida->saida("        }\r\n");
          $nm_saida->saida("        if (parms != null && parms != '') \r\n");
          $nm_saida->saida("        {\r\n");
          $nm_saida->saida("            par_modal += '&nmgp_parms=' + parms;\r\n");
          $nm_saida->saida("        }\r\n");
          $nm_saida->saida("        tb_show('', apl_lig + par_modal + '&TB_iframe=true&modal=true&height=' + modal_h + '&width=' + modal_w, '');\r\n");
          $nm_saida->saida("        return;\r\n");
          $nm_saida->saida("    }\r\n");
          $nm_saida->saida("    document.F3.target               = target; \r\n");
          $nm_saida->saida("    if (target == '_blank') \r\n");
          $nm_saida->saida("    {\r\n");
          $nm_saida->saida("        document.F3.nmgp_outra_jan.value = \"true\" ;\r\n");
          $nm_saida->saida("    }\r\n");
          $nm_saida->saida("    document.F3.action               = apl_lig  ;\r\n");
          $nm_saida->saida("    if (opc != null && opc != '') \r\n");
          $nm_saida->saida("    {\r\n");
          $nm_saida->saida("        document.F3.nmgp_opcao.value = \"grid\" ;\r\n");
          $nm_saida->saida("    }\r\n");
          $nm_saida->saida("    else\r\n");
          $nm_saida->saida("    {\r\n");
          $nm_saida->saida("        document.F3.nmgp_opcao.value = \"\" ;\r\n");
          $nm_saida->saida("    }\r\n");
          $nm_saida->saida("    document.F3.nmgp_url_saida.value = apl_saida ;\r\n");
          $nm_saida->saida("    document.F3.nmgp_parms.value = parms ;\r\n");
          $nm_saida->saida("    document.F3.submit() ;\r\n");
          $nm_saida->saida("    document.F3.nmgp_outra_jan.value = \"\";\r\n");
          $nm_saida->saida("    document.F3.nmgp_parms.value = \"\";\r\n");
          $nm_saida->saida("    document.F3.action = \"grid_fiche_prof_sante_stat_wilaya.php\";\r\n");
          $nm_saida->saida(" } \r\n");
          $nm_saida->saida("   var tem_hint;\r\n");
          $nm_saida->saida("   function nm_mostra_hint(nm_obj, nm_evt, nm_mens)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (nm_mens == \"\")\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           return;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       tem_hint = true;\r\n");
          $nm_saida->saida("       if (document.layers)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           theString=\"<DIV CLASS='ttip'>\" + nm_mens + \"</DIV>\";\r\n");
          $nm_saida->saida("           document.tooltip.document.write(theString);\r\n");
          $nm_saida->saida("           document.tooltip.document.close();\r\n");
          $nm_saida->saida("           document.tooltip.left = nm_evt.pageX + 14;\r\n");
          $nm_saida->saida("           document.tooltip.top = nm_evt.pageY + 2;\r\n");
          $nm_saida->saida("           document.tooltip.visibility = \"show\";\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           if(document.getElementById)\r\n");
          $nm_saida->saida("           {\r\n");
          $nm_saida->saida("              nmdg_nav = navigator.appName;\r\n");
          $nm_saida->saida("              elm = document.getElementById(\"tooltip\");\r\n");
          $nm_saida->saida("              elml = nm_obj;\r\n");
          $nm_saida->saida("              elm.innerHTML = nm_mens;\r\n");
          $nm_saida->saida("              if (nmdg_nav == \"Netscape\")\r\n");
          $nm_saida->saida("              {\r\n");
          $nm_saida->saida("                  elm.style.height = elml.style.height;\r\n");
          $nm_saida->saida("                  elm.style.top = nm_evt.pageY + 2;\r\n");
          $nm_saida->saida("                  elm.style.left = nm_evt.pageX + 14;\r\n");
          $nm_saida->saida("              }\r\n");
          $nm_saida->saida("              else\r\n");
          $nm_saida->saida("              {\r\n");
          $nm_saida->saida("                  elm.style.top = nm_evt.y + document.body.scrollTop + 10;\r\n");
          $nm_saida->saida("                  elm.style.left = nm_evt.x + document.body.scrollLeft + 10;\r\n");
          $nm_saida->saida("              }\r\n");
          $nm_saida->saida("              elm.style.visibility = \"visible\";\r\n");
          $nm_saida->saida("           }\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("   function nm_apaga_hint()\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("       if (!tem_hint)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           return;\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       tem_hint = false;\r\n");
          $nm_saida->saida("       if (document.layers)\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           document.tooltip.visibility = \"hidden\";\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("       else\r\n");
          $nm_saida->saida("       {\r\n");
          $nm_saida->saida("           if(document.getElementById)\r\n");
          $nm_saida->saida("           {\r\n");
          $nm_saida->saida("              elm.style.visibility = \"hidden\";\r\n");
          $nm_saida->saida("           }\r\n");
          $nm_saida->saida("       }\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida(" function nm_graf_submit(campo, nivel, campo_val, parms, target) \r\n");
          $nm_saida->saida(" { \r\n");
          $nm_saida->saida("    document.Fgraf.campo.value = campo ;\r\n");
          $nm_saida->saida("    document.Fgraf.nivel_quebra.value = nivel ;\r\n");
          $nm_saida->saida("    document.Fgraf.campo_val.value = campo_val ;\r\n");
          $nm_saida->saida("    document.Fgraf.nmgp_parms.value   = parms ;\r\n");
          $nm_saida->saida("    if (target != null) \r\n");
          $nm_saida->saida("    {\r\n");
          $nm_saida->saida("        document.Fgraf.target = target; \r\n");
          $nm_saida->saida("    }\r\n");
          $nm_saida->saida("    document.Fgraf.submit() ;\r\n");
          $nm_saida->saida(" } \r\n");
          $nm_saida->saida(" function nm_graf_submit_2(chart)\r\n");
          $nm_saida->saida(" {\r\n");
          $nm_saida->saida("    document.Fgraf.nmgp_parms.value = chart;\r\n");
          $nm_saida->saida("    document.Fgraf.submit();\r\n");
          $nm_saida->saida(" } \r\n");
          $nm_saida->saida(" function Refresh_Chart()\r\n");
          $nm_saida->saida(" {\r\n");
          $nm_saida->saida("     document.FRES.action = \"grid_fiche_prof_sante_stat_wilaya.php\";\r\n");
          $nm_saida->saida("     document.FRES.submit();\r\n");
          $nm_saida->saida(" }\r\n");
          $nm_saida->saida(" function nm_open_popup(parms)\r\n");
          $nm_saida->saida(" {\r\n");
          $nm_saida->saida("     NovaJanela = window.open (parms, '', 'resizable, scrollbars');\r\n");
          $nm_saida->saida(" }\r\n");
          $nm_saida->saida("   function process_hotkeys(hotkey)\r\n");
          $nm_saida->saida("   {\r\n");
          $nm_saida->saida("      if (hotkey == 'sys_format_pdf') { \r\n");
          $nm_saida->saida("         var output =  $('#Rpdf_top').click();\r\n");
          $nm_saida->saida("         return (0 < output.length);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("      if (hotkey == 'sys_format_word') { \r\n");
          $nm_saida->saida("         var output =  $('#Rword_top').click();\r\n");
          $nm_saida->saida("         return (0 < output.length);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("      if (hotkey == 'sys_format_xls') { \r\n");
          $nm_saida->saida("         var output =  $('#Rxls_top').click();\r\n");
          $nm_saida->saida("         return (0 < output.length);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("      if (hotkey == 'sys_format_imp') { \r\n");
          $nm_saida->saida("         var output =  $('#Rprint_top').click();\r\n");
          $nm_saida->saida("         return (0 < output.length);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("      if (hotkey == 'sys_format_gbrl') { \r\n");
          $nm_saida->saida("         var output =  $('#sel_groupby_top').click();\r\n");
          $nm_saida->saida("         return (0 < output.length);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("      if (hotkey == 'sys_format_webh') { \r\n");
          $nm_saida->saida("         var output =  $('#Rhelp_top').click();\r\n");
          $nm_saida->saida("         return (0 < output.length);\r\n");
          $nm_saida->saida("      }\r\n");
          $nm_saida->saida("   return false;\r\n");
          $nm_saida->saida("   }\r\n");
          $nm_saida->saida("</SCRIPT>\r\n");
          $nm_saida->saida("</BODY>\r\n");
          $nm_saida->saida("</HTML>\r\n");
      }
   }

   function monta_html_ini_pdf()
   {
      global $nm_saida;
       $tp_quebra = "";
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css']))
       {
           $NM_css = @fopen($this->Ini->root . $this->Ini->path_imag_temp . '/sc_css_grid_fiche_prof_sante_stat_wilaya_grid_' . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['num_css'] . '.css', 'a');
           $NM_css_file = $this->Ini->root . $this->Ini->path_link . "grid_fiche_prof_sante_stat_wilaya/grid_fiche_prof_sante_stat_wilaya_res_" . strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']). ".css";
           if (is_file($NM_css_file))
           {
               $NM_css_attr = file($NM_css_file);
               foreach ($NM_css_attr as $NM_line_css)
               {
                   @fwrite($NM_css, "    " . $NM_line_css . "\r\n");
               }
           }
           @fclose($NM_css);
       }
       $this->Print_All = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['print_all'];
       $tp_quebra = "<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>";
       if ($this->Print_All || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['print_all'])
       {
       $tp_quebra = "<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>";
       }
       $nm_saida->saida("" . $tp_quebra . "\r\n");
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['responsive_chart']['active']) {
           $summary_width = "width=\"100%\"";
       }
       else {
           if ($_SESSION['scriptcase']['proc_mobile'])
           {
               $summary_width = "width=\"100%\"";
           }
           else
           {
               $summary_width = "width=\"100%\"";
           }
       }
       $nm_saida->saida("<TABLE style=\"padding: 0px; border-spacing: 0px; border-width: 0px;\" align=\"center\" valign=\"top\" " . $summary_width . ">\r\n");
       $nm_saida->saida("<TR>\r\n");
       $nm_saida->saida("<TD style=\"padding: 0px\">\r\n");
       $nm_saida->saida("<TABLE style=\"padding: 0px; border-spacing: 0px; border-width: 0px; width: 100%;\">\r\n");
   }
   function monta_html_fim_pdf()
   {
      global $nm_saida;
      $nm_saida->saida("</TABLE>\r\n");
      $nm_saida->saida("</TD>\r\n");
      $nm_saida->saida("</TR>\r\n");
      $nm_saida->saida("</TABLE>\r\n");
   }
//--- 
//--- 
 function grafico_pdf()
 {
   global $nm_saida, $nm_lang;
   require_once($this->Ini->path_aplicacao . $this->Ini->Apl_grafico); 
   $this->Graf  = new grid_fiche_prof_sante_stat_wilaya_grafico();
   $this->Graf->Db     = $this->Db;
   $this->Graf->Erro   = $this->Erro;
   $this->Graf->Ini    = $this->Ini;
   $this->Graf->Lookup = $this->Lookup;
   if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts']) && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['skip_charts']) || !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['skip_charts']))
   {
       $this->Graf->monta_grafico('', 'pdf_lib');
       $prim_graf = true;
       $nm_saida->saida("<B><div style=\"height:1px;overflow:hidden\"><H1 style=\"font-size:0;padding:1px\">" . $this->Ini->Nm_lang['lang_btns_chrt_pdff_hint'] . "</H1></div></B>\r\n");
       $iChartCount = 1;
       $iChartTotal = sizeof($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts']);
       $sChartLang  = isset($this->Ini->Nm_lang['lang_pdff_pcht']) ? $this->Ini->Nm_lang['lang_pdff_pcht'] : 'Generating chart';
       if (!NM_is_utf8($sChartLang))
       {
           $sChartLang = sc_convert_encoding($sChartLang, "UTF-8", $_SESSION['scriptcase']['charset']);
       }
       $bChartFP = false;
      if (!isset($this->progress_fp) || !$this->progress_fp)
      {
           $bChartFP           = true;
           $str_pbfile         = $this->Ini->root . $this->Ini->path_imag_temp . '/sc_pb_' . session_id() . '.tmp';
           $this->progress_fp  = fopen($str_pbfile, 'a');
           $this->progress_tot = 100;
           $this->progress_now = 90;
           $this->progress_res = 0;
      }
 if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert'])
 { 
           $nm_saida->saida(" <style>\r\n");
            $nm_saida->saida("  table td, table tr{ page-break-inside: avoid !important; }\r\n");
           $nm_saida->saida(" </style>\r\n");
 } 
       $prim_graf = ($this->Ini->SC_module_export == "chart") ? true : false;
       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['pivot_charts'] as $chart_index => $chart_data)
       {
           if (!$prim_graf)
           {
                   $nm_saida->saida("<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>\r\n");
           }
           $prim_graf = false;
 if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert'])
 { 
           $nm_saida->saida("<table style=\"width: 100%; page-break-inside: avoid !important;\" ><tr><td>\r\n");
 } else {
           $nm_saida->saida("<table><tr><td>\r\n");
 } 
           $tit_graf = $chart_data['title'];
           if ('' != $chart_data['subtitle'])
           {
               $tit_graf .= ' - ' . $chart_data['subtitle'];
           }
           if ('UTF-8' != $_SESSION['scriptcase']['charset'])
           {
               $tit_graf = sc_convert_encoding($tit_graf, $_SESSION['scriptcase']['charset'], 'UTF-8');
           }
           $tit_book_marks = str_replace(" ", "&nbsp;", $tit_graf);
           $random_id = 'sc-id-h2-' . md5(session_id() . microtime() . rand(1, 1000));
           $nm_saida->saida("<b><h2 id=\"$random_id\">$tit_book_marks</h2></b>\r\n");
           if ($this->progress_fp)
           {
               grid_fiche_prof_sante_stat_wilaya_pdf_progress_call($this->progress_tot . "_#NM#_" . $this->progress_now . "_#NM#_" . $sChartLang . " " . $iChartCount . "...\n", $this->Ini->Nm_lang, true);
               fwrite($this->progress_fp, $this->progress_now . "_#NM#_" . $sChartLang . " " . $iChartCount . "...\n");
               $iChartCount++;
               if (0 < $this->progress_res)
               {
                   $this->progress_now++;
               }
           }
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['this_chart_label'] = '';
           $this->Graf->monta_grafico($chart_index, 'pdf');
           $nm_saida->saida("</td></tr></table>\r\n");
       }
       if ($bChartFP)
       {
           $lang_protect = $this->Ini->Nm_lang['lang_pdff_gnrt'];
           if (!NM_is_utf8($lang_protect))
           {
               $lang_protect = sc_convert_encoding($lang_protect, "UTF-8", $_SESSION['scriptcase']['charset']);
           }
           grid_fiche_prof_sante_stat_wilaya_pdf_progress_call(100 . "_#NM#_" . 90 . "_#NM#_" . $lang_protect . "...\n", $this->Ini->Nm_lang);
           fwrite($this->progress_fp, 90 . "_#NM#_" . $lang_protect . "...\n");
           fclose($this->progress_fp);
       }
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['charts_html']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['charts_html'])
       {
            $nm_saida->saida("<script type=\"text/javascript\">\r\n");
            $nm_saida->saida("{$_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['charts_html']}\r\n");
            $nm_saida->saida("</script>\r\n");
       }
   }
       $nm_saida->saida("</body>\r\n");
       $nm_saida->saida("</HTML>\r\n");
 }
//--- 
//--- 
 function grafico_pdf_flash()
 {
   global $nm_saida, $nm_lang;
   if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_list']))
   {
       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['chart_list'] as $arr_chart)
       {
           $nm_saida->saida("<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>\r\n");
       $nm_saida->saida("<b><div style=\"height:1px;overflow:hidden\"><H1 style=\"font-size:0;padding:1px\">" . $this->Ini->Nm_lang['lang_btns_chrt_pdff_hint'] . "</H1></div></b>\r\n");
           $nm_saida->saida("<table><tr><td>\r\n");
           $tit_graf       = $arr_chart[1];
           if ('UTF-8' != $_SESSION['scriptcase']['charset'])
           {
               $tit_graf = sc_convert_encoding($tit_graf, $_SESSION['scriptcase']['charset'], 'UTF-8');
           }
           $tit_book_marks = str_replace(" ", "&nbsp;", $tit_graf);
           $nm_saida->saida("<b><h2>$tit_book_marks</h2></b>\r\n");
           $nm_saida->saida("<img src='" . $arr_chart[0] . ".png'/>\r\n");
           $_SESSION['scriptcase']['sc_num_img']++;
           $nm_saida->saida("</td></tr></table>\r\n");
       }
   }
   $nm_saida->saida("</body>\r\n");
   $nm_saida->saida("</HTML>\r\n");
 }
//--- 
	function getHeaderColspan() {
		return $this->getHeaderColspan_index() + $this->getHeaderColspan_labels() + $this->getHeaderColspan_summarizing() + $this->getHeaderColspan_lineTotal();
	} // getHeaderColspan

	function getHeaderColspan_index() {
		return $this->comp_tab_seq ? 1 : 0;
	} // getHeaderColspan_index

	function getHeaderColspan_labels() {
		return $this->comp_tabular ? count($this->comp_y_axys) : 1;
	} // getHeaderColspan_labels

	function getHeaderColspan_summarizing() {
		return $this->build_col_count;
	} // getHeaderColspan_summarizing

	function getHeaderColspan_summarizing_fields() {
		$total = 0;

		foreach ($this->comp_sum_display as $displayFlag) {
			if ($displayFlag) {
				$total++;
			}
		}

		return $total;
	} // getHeaderColspan_summarizing_fields

	function getHeaderColspan_lineTotal() {
             if (substr($this->Ini->PHP_ver, 0, 2) > 72) {
		return (isset($this->comp_x_axys) && is_countable($this->comp_x_axys) && count($this->comp_x_axys)) ? $this->getHeaderColspan_summarizing_fields() : 0;
             }
             else {
		return (isset($this->comp_x_axys) && is_array($this->comp_x_axys) && count($this->comp_x_axys)) ? $this->getHeaderColspan_summarizing_fields() : 0;
             }
	} // getHeaderColspan_lineTotal

   //----- 
   function monta_cabecalho()
   {
      global $nm_saida;
      if ($this->Ini->Embutida_iframe || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['embutida'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['dashboard_info']['compact_mode'])
      { 
          return;
      } 
      $this->nm_data->SetaData(date("Y/m/d H:i:s"), "YYYY/MM/DD HH:II:SS");
      $nm_cab_filtro   = ""; 
      $nm_cab_filtrobr = ""; 
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']))
      { 
        $Busca_temp = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca'];
        if ($_SESSION['scriptcase']['charset'] != "UTF-8")
        {
            $Busca_temp = NM_conv_charset($Busca_temp, $_SESSION['scriptcase']['charset'], "UTF-8");
        }
          $id_fiche_ps = (isset($Busca_temp['id_fiche_ps'])) ? $Busca_temp['id_fiche_ps'] : ""; 
          $tmp_pos = (is_string($id_fiche_ps)) ? strpos($id_fiche_ps, "##@@") : false;
          if ($tmp_pos !== false && !is_array($id_fiche_ps))
          {
              $id_fiche_ps = substr($id_fiche_ps, 0, $tmp_pos);
          }
          $code_fiche = (isset($Busca_temp['code_fiche'])) ? $Busca_temp['code_fiche'] : ""; 
          $tmp_pos = (is_string($code_fiche)) ? strpos($code_fiche, "##@@") : false;
          if ($tmp_pos !== false && !is_array($code_fiche))
          {
              $code_fiche = substr($code_fiche, 0, $tmp_pos);
          }
          $date_declaration = (isset($Busca_temp['date_declaration'])) ? $Busca_temp['date_declaration'] : ""; 
          $tmp_pos = (is_string($date_declaration)) ? strpos($date_declaration, "##@@") : false;
          if ($tmp_pos !== false && !is_array($date_declaration))
          {
              $date_declaration = substr($date_declaration, 0, $tmp_pos);
          }
          $date_declaration_2 = (isset($Busca_temp['date_declaration_input_2'])) ? $Busca_temp['date_declaration_input_2'] : ""; 
          $wilaya = (isset($Busca_temp['wilaya'])) ? $Busca_temp['wilaya'] : ""; 
          $tmp_pos = (is_string($wilaya)) ? strpos($wilaya, "##@@") : false;
          if ($tmp_pos !== false && !is_array($wilaya))
          {
              $wilaya = substr($wilaya, 0, $tmp_pos);
          }
      } 
      if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['cond_pesq']))
      {  
          $pos       = 0;
          $trab_pos  = false;
          $pos_tmp   = true; 
          $tmp       = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['cond_pesq'];
          while ($pos_tmp)
          {
             $pos = strpos($tmp, "##*@@", $pos);
             if ($pos !== false)
             {
                 $trab_pos = $pos;
                 $pos += 4;
             }
             else
             {
                 $pos_tmp = false;
             }
          }
          $nm_cond_filtro_or  = (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['cond_pesq'], $trab_pos + 5) == "or")  ? " " . trim($this->Ini->Nm_lang['lang_srch_orr_cond']) . " " : "";
          $nm_cond_filtro_and = (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['cond_pesq'], $trab_pos + 5) == "and") ? " " . trim($this->Ini->Nm_lang['lang_srch_and_cond']) . " " : "";
          $nm_cab_filtro   = substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['cond_pesq'], 0, $trab_pos);
          $nm_cab_filtrobr = str_replace("##*@@", ", " . $nm_cond_filtro_or . "<br />", $nm_cab_filtro);
          $pos       = 0;
          $trab_pos  = false;
          $pos_tmp   = true; 
          $tmp       = $nm_cab_filtro;
          while ($pos_tmp)
          {
             $pos = strpos($tmp, "##*@@", $pos);
             if ($pos !== false)
             {
                 $trab_pos = $pos;
                 $pos += 4;
             }
             else
             {
                 $pos_tmp = false;
             }
          }
          if ($trab_pos === false)
          {
          }
          else  
          {  
             $nm_cab_filtro = substr($nm_cab_filtro, 0, $trab_pos) . " " .  $nm_cond_filtro_or . $nm_cond_filtro_and . substr($nm_cab_filtro, $trab_pos + 5);
             $nm_cab_filtro = str_replace("##*@@", ", " . $nm_cond_filtro_or, $nm_cab_filtro);
          }   
      }   
      $nm_saida->saida(" <TR align=\"center\">\r\n");
     if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['proc_pdf_vert']) {
          $header_colspan = $this->getHeaderColspan();
          $nm_saida->saida("  <TD colspan=\"" . $header_colspan . "\" class=\"" . $this->css_scGridTabelaTd . " " . $this->css_scGridPage . "\">\r\n");
     }
     else {
          $nm_saida->saida("  <TD class=\"" . $this->css_scGridTabelaTd . " " . $this->css_scGridPage . "\">\r\n");
     }
      $nm_saida->saida("<style>\r\n");
      $nm_saida->saida("    .scMenuTHeaderFont img, .scGridHeaderFont img , .scFormHeaderFont img , .scTabHeaderFont img , .scContainerHeaderFont img , .scFilterHeaderFont img { height:23px;}\r\n");
      $nm_saida->saida("</style>\r\n");
      $nm_saida->saida("<div class=\"" . $this->css_scGridHeader . "\" style=\"height: 54px; padding: 17px 15px; box-sizing: border-box;margin: -1px 0px 0px 0px;width: 100%;\">\r\n");
      $nm_saida->saida("    <div class=\"" . $this->css_scGridHeaderFont . "\" style=\"float: left; text-transform: uppercase;\">MDO - Statistiques</div>\r\n");
      $nm_saida->saida("    <div class=\"" . $this->css_scGridHeaderFont . "\" style=\"float: right;\">" . "" . $_SESSION['var_fac_name'] . "" . "</div>\r\n");
      $nm_saida->saida("</div>\r\n");
      $nm_saida->saida("  </TD>\r\n");
      $nm_saida->saida(" </TR>\r\n");
   }

   function monta_resumo_search()
   {
      global $nm_saida;
      $nm_saida->saida(" <TR><TD id=\"id_resumo_search\" valign=\"top\" style=\"display:'';\">\r\n");
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
       { 
           $_SESSION['scriptcase']['saida_html'] = "";
       } 
      $this->html_resumo_search();
       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['ajax_nav'])
       { 
           $this->Ini->Arr_result['setDisplay'][] = array('field' => 'id_resumo_search', 'value' => '');
           $this->Ini->Arr_result['setValue'][] = array('field' => 'id_resumo_search', 'value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
           $_SESSION['scriptcase']['saida_html'] = "";
           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']))
           { 
               $this->Ini->Arr_result['setArr'][] = array('var' => 'Tab_obj_res_combo', 'value' => '');
               foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look'] as $cada_combo => $opcs_combo)
               { 
                   $this->Ini->Arr_result['setVar'][]     = array("var" => "Tab_obj_res_combo['" . $cada_combo . "']", "value" => "true");
                   $this->Ini->Arr_result['setDisplay'][] = array("field" => "btn_clear_" . $cada_combo, "value" => "");
               } 
               if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']))
               { 
                   $this->Ini->Arr_result['setDisplay'][] = array("field" => "res_search_clear", "value" => "");
               } 
           } 
       } 
      $nm_saida->saida(" </TD></TR>\r\n");
   }
   function html_resumo_search()
   {
       global $nm_saida;
       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['res_search_label'] = array();
       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']))
       {
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']         = array();
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']    = array();
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['Res_search_metric_use'] = array();
           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_res_lookup']      = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_pesq'];
       }
       $nm_saida->saida("    <form id= \"id_Resumo_search\" name=\"FResumo_search\" method=\"post\" action=\"grid_fiche_prof_sante_stat_wilaya.php\" target=\"_self\"> \r\n");
       $nm_saida->saida("     <input type=\"hidden\" name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
       $nm_saida->saida("     <input type=\"hidden\" name=\"nmgp_opcao\" value=\"resumo_search\"/> \r\n");
       $nm_saida->saida("     <input type=\"hidden\" name=\"parm\" value=\"\"/> \r\n");
       $nm_saida->saida(" <div id=\"TB_Resumo_Search\" class='scGridSummarySearchMoldura' style='width: 100%;'>\r\n");
       $lin_obj  = $this->resumo_search_maladie_confirmee_labo_SC_1();
       $nm_saida->saida("" . $lin_obj . "\r\n");
       $lin_obj  = $this->resumo_search_wilaya_SC_1();
       $nm_saida->saida("" . $lin_obj . "\r\n");
       $lin_obj  = $this->resumo_search_commune_SC_1();
       $nm_saida->saida("" . $lin_obj . "\r\n");
       $lin_obj  = $this->resumo_search_statut_maladie_SC_1();
       $nm_saida->saida("" . $lin_obj . "\r\n");
       $lin_obj  = $this->resumo_search_evolution_nm_fk_SC_1();
       $nm_saida->saida("" . $lin_obj . "\r\n");
       $nm_saida->saida("    <div class='scGridSummarySearchCleanBtn' style='float:left; width:100%;'>\r\n");
       $Cod_Btn  = nmButtonOutput($this->arr_buttons, "bfilref_limpar", "nm_proc_res_search('', '', '', '', 'clear_res_search', '');", "nm_proc_res_search('', '', '', '', 'clear_res_search', '');", "res_search_clear", "", "", "display: none", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
       $nm_saida->saida("" . $Cod_Btn . "\r\n");
       if ($_SESSION['scriptcase']['proc_mobile']) {
           $Cod_Btn  = nmButtonOutput($this->arr_buttons, "bfilref_apply", "Refresh_Chart();", "Refresh_Chart();", "res_search_view", "", "", "display: none", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
           $nm_saida->saida("" . $Cod_Btn . "\r\n");
           $Cod_Btn  = nmButtonOutput($this->arr_buttons, "bfilref_close", "history.back();", "history.back();", "res_search_back", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
           $nm_saida->saida("" . $Cod_Btn . "\r\n");
       }
       $nm_saida->saida("    </div>\r\n");
       $nm_saida->saida("    <div style='clear:both'></div>\r\n");
       $nm_saida->saida("    </form>\r\n");
       $nm_saida->saida("    </div>\r\n");
       $this->JS_resumo_search();
       $nm_saida->saida(" <SCRIPT LANGUAGE=\"Javascript\" SRC=\"" . $this->Ini->path_js . "/nm_format_num.js\"></SCRIPT>\r\n");
   }
   function resumo_search_wilaya_SC_1()
   {
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']['wilaya_SC_1']))
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo active' style='float:left;'>";
       }
       else
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo' style='float:left;'>";
       }
       $lin_obj .= "       <div class='scGridSummarySearchLabel'>";
       $lin_obj .= "Wilaya";
       $Cod_Btn  = nmButtonOutput($this->arr_buttons, "blimparsummaryfield", "nm_proc_res_search('wilaya_SC_1', '', '', '', 'clear_search_obj', '', '');", "nm_proc_res_search('wilaya_SC_1', '', '', '', 'clear_search_obj', '', '');", "wilaya_SC_1_clear", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
       $lin_obj .= "<span id=\"btn_clear_wilaya_SC_1\" style='float:right; display: none;' class='scGridSummarySearchLabelclean'>". $Cod_Btn ."</span>"; 
       $lin_obj .= "     </div>";
       $lin_obj  .= "   <div class='scGridSummarySearchObjeto' id=\"id_tab_wilaya_SC_1\" style=\" \">";
       $lin_obj  .= "   <select multiple class=\"css_toolbar_obj\" style=\"vertical-align: middle;\" id=\"wilaya_SC_1\" name=\"wilaya_SC_1\" onChange=\"nm_proc_res_search('wilaya_SC_1', 'wilaya', 'select', 'txt', 'in', '', '');\" onClick=\"ajax_res_fill_combo('wilaya_SC_1');\">";
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['wilaya_SC_1']))
       {
           $result_look = $this->Lookup->lookup_res_wilaya_SC_1();
           foreach ($result_look['set_option'] as $ind => $opcs)
           {
               $selected  = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['wilaya_SC_1']) && in_array($opcs['opt'], $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['wilaya_SC_1'])) ? " selected" : "";
               $lin_obj  .= "   <option value=\"" . $opcs['opt'] . "\"" . $selected . ">" . $opcs['value'] . "</option>";
           }
       }
       $lin_obj  .= "   </select>";
       $lin_obj  .= "   </div>";
       $lin_obj .= "    </div>";
       return $lin_obj;
   }
   function resumo_search_commune_SC_1()
   {
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']['commune_SC_1']))
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo active' style='float:left;'>";
       }
       else
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo' style='float:left;'>";
       }
       $lin_obj .= "       <div class='scGridSummarySearchLabel'>";
       $lin_obj .= "Commune";
       $Cod_Btn  = nmButtonOutput($this->arr_buttons, "blimparsummaryfield", "nm_proc_res_search('commune_SC_1', '', '', '', 'clear_search_obj', '', '');", "nm_proc_res_search('commune_SC_1', '', '', '', 'clear_search_obj', '', '');", "commune_SC_1_clear", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
       $lin_obj .= "<span id=\"btn_clear_commune_SC_1\" style='float:right; display: none;' class='scGridSummarySearchLabelclean'>". $Cod_Btn ."</span>"; 
       $lin_obj .= "     </div>";
       $lin_obj  .= "   <div class='scGridSummarySearchObjeto' id=\"id_tab_commune_SC_1\" style=\" \">";
       $lin_obj  .= "   <select multiple class=\"css_toolbar_obj\" style=\"vertical-align: middle;\" id=\"commune_SC_1\" name=\"commune_SC_1\" onChange=\"nm_proc_res_search('commune_SC_1', 'commune', 'select', 'txt', 'in', '', '');\" onClick=\"ajax_res_fill_combo('commune_SC_1');\">";
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['commune_SC_1']))
       {
           $result_look = $this->Lookup->lookup_res_commune_SC_1();
           foreach ($result_look['set_option'] as $ind => $opcs)
           {
               $selected  = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['commune_SC_1']) && in_array($opcs['opt'], $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['commune_SC_1'])) ? " selected" : "";
               $lin_obj  .= "   <option value=\"" . $opcs['opt'] . "\"" . $selected . ">" . $opcs['value'] . "</option>";
           }
       }
       $lin_obj  .= "   </select>";
       $lin_obj  .= "   </div>";
       $lin_obj .= "    </div>";
       return $lin_obj;
   }
   function resumo_search_maladie_confirmee_labo_SC_1()
   {
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']['maladie_confirmee_labo_SC_1']))
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo active' style='float:left;'>";
       }
       else
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo' style='float:left;'>";
       }
       $lin_obj .= "       <div class='scGridSummarySearchLabel'>";
       $lin_obj .= "Maladie";
       $Cod_Btn  = nmButtonOutput($this->arr_buttons, "blimparsummaryfield", "nm_proc_res_search('maladie_confirmee_labo_SC_1', '', '', '', 'clear_search_obj', '', '');", "nm_proc_res_search('maladie_confirmee_labo_SC_1', '', '', '', 'clear_search_obj', '', '');", "maladie_confirmee_labo_SC_1_clear", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
       $lin_obj .= "<span id=\"btn_clear_maladie_confirmee_labo_SC_1\" style='float:right; display: none;' class='scGridSummarySearchLabelclean'>". $Cod_Btn ."</span>"; 
       $lin_obj .= "     </div>";
       $lin_obj  .= "   <div class='scGridSummarySearchObjeto' id=\"id_tab_maladie_confirmee_labo_SC_1\" style=\" \">";
       $lin_obj  .= "   <select multiple class=\"css_toolbar_obj\" style=\"vertical-align: middle;\" id=\"maladie_confirmee_labo_SC_1\" name=\"maladie_confirmee_labo_SC_1\" onChange=\"nm_proc_res_search('maladie_confirmee_labo_SC_1', 'maladie_confirmee_labo', 'select', 'txt', 'in', '', '');\" onClick=\"ajax_res_fill_combo('maladie_confirmee_labo_SC_1');\">";
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['maladie_confirmee_labo_SC_1']))
       {
           $result_look = $this->Lookup->lookup_res_maladie_confirmee_labo_SC_1();
           foreach ($result_look['set_option'] as $ind => $opcs)
           {
               $selected  = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['maladie_confirmee_labo_SC_1']) && in_array($opcs['opt'], $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['maladie_confirmee_labo_SC_1'])) ? " selected" : "";
               $lin_obj  .= "   <option value=\"" . $opcs['opt'] . "\"" . $selected . ">" . $opcs['value'] . "</option>";
           }
       }
       $lin_obj  .= "   </select>";
       $lin_obj  .= "   </div>";
       $lin_obj .= "    </div>";
       return $lin_obj;
   }
   function resumo_search_statut_maladie_SC_1()
   {
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']['statut_maladie_SC_1']))
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo active' style='float:left;'>";
       }
       else
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo' style='float:left;'>";
       }
       $lin_obj .= "       <div class='scGridSummarySearchLabel'>";
       $lin_obj .= "Statut";
       $Cod_Btn  = nmButtonOutput($this->arr_buttons, "blimparsummaryfield", "nm_proc_res_search('statut_maladie_SC_1', '', '', '', 'clear_search_obj', '', '');", "nm_proc_res_search('statut_maladie_SC_1', '', '', '', 'clear_search_obj', '', '');", "statut_maladie_SC_1_clear", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
       $lin_obj .= "<span id=\"btn_clear_statut_maladie_SC_1\" style='float:right; display: none;' class='scGridSummarySearchLabelclean'>". $Cod_Btn ."</span>"; 
       $lin_obj .= "     </div>";
       $lin_obj  .= "   <div class='scGridSummarySearchObjeto' id=\"id_tab_statut_maladie_SC_1\" style=\" \">";
       $lin_obj  .= "   <select multiple class=\"css_toolbar_obj\" style=\"vertical-align: middle;\" id=\"statut_maladie_SC_1\" name=\"statut_maladie_SC_1\" onChange=\"nm_proc_res_search('statut_maladie_SC_1', 'statut_maladie', 'select', 'txt', 'in', '', '');\" onClick=\"ajax_res_fill_combo('statut_maladie_SC_1');\">";
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['statut_maladie_SC_1']))
       {
           $result_look = $this->Lookup->lookup_res_statut_maladie_SC_1();
           foreach ($result_look['set_option'] as $ind => $opcs)
           {
               $selected  = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['statut_maladie_SC_1']) && in_array($opcs['opt'], $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['statut_maladie_SC_1'])) ? " selected" : "";
               $lin_obj  .= "   <option value=\"" . $opcs['opt'] . "\"" . $selected . ">" . $opcs['value'] . "</option>";
           }
       }
       $lin_obj  .= "   </select>";
       $lin_obj  .= "   </div>";
       $lin_obj .= "    </div>";
       return $lin_obj;
   }
   function resumo_search_evolution_nm_fk_SC_1()
   {
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search']['evolution_nm_fk_SC_1']))
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo active' style='float:left;'>";
       }
       else
       {
           $lin_obj .= "   <div class='scGridSummarySearchCampo' style='float:left;'>";
       }
       $lin_obj .= "       <div class='scGridSummarySearchLabel'>";
       $lin_obj .= "Evolution";
       $Cod_Btn  = nmButtonOutput($this->arr_buttons, "blimparsummaryfield", "nm_proc_res_search('evolution_nm_fk_SC_1', '', '', '', 'clear_search_obj', '', '');", "nm_proc_res_search('evolution_nm_fk_SC_1', '', '', '', 'clear_search_obj', '', '');", "evolution_nm_fk_SC_1_clear", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "", "", "", "");
       $lin_obj .= "<span id=\"btn_clear_evolution_nm_fk_SC_1\" style='float:right; display: none;' class='scGridSummarySearchLabelclean'>". $Cod_Btn ."</span>"; 
       $lin_obj .= "     </div>";
       $lin_obj  .= "   <div class='scGridSummarySearchObjeto' id=\"id_tab_evolution_nm_fk_SC_1\" style=\" \">";
       $lin_obj  .= "   <select multiple class=\"css_toolbar_obj\" style=\"vertical-align: middle;\" id=\"evolution_nm_fk_SC_1\" name=\"evolution_nm_fk_SC_1\" onChange=\"nm_proc_res_search('evolution_nm_fk_SC_1', 'evolution_nm_fk', 'select', 'txt', 'in', '', '');\" onClick=\"ajax_res_fill_combo('evolution_nm_fk_SC_1');\">";
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['evolution_nm_fk_SC_1']))
       {
           $result_look = $this->Lookup->lookup_res_evolution_nm_fk_SC_1();
           foreach ($result_look['set_option'] as $ind => $opcs)
           {
               $selected  = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['evolution_nm_fk_SC_1']) && in_array($opcs['opt'], $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']['evolution_nm_fk_SC_1'])) ? " selected" : "";
               $lin_obj  .= "   <option value=\"" . $opcs['opt'] . "\"" . $selected . ">" . $opcs['value'] . "</option>";
           }
       }
       $lin_obj  .= "   </select>";
       $lin_obj  .= "   </div>";
       $lin_obj .= "    </div>";
       return $lin_obj;
   }
   function JS_resumo_search()
   {
       global $nm_saida;
       $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
       $nm_saida->saida("     $(document).ready(function() {\r\n");
       $nm_saida->saida("         $('#wilaya_SC_1').SumoSelect({okCancelInMulti:true, placeholder: '" . $this->Ini->Nm_lang['lang_search_select_summary'] . "', captionFormat:'{0} " . $this->Ini->Nm_lang['lang_btns_selected_summary'] . "', captionFormatAllSelected: '" . $this->Ini->Nm_lang['lang_btns_all_of_them_summary'] . "', selectAll:true, search: true, searchText:'" . $this->Ini->Nm_lang['lang_btns_type_summary'] . "', locale : ['" . $this->Ini->Nm_lang['lang_btns_ok_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_cancel_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_all_selected_summary'] . "'] });\r\n");
       if ($_SESSION['scriptcase']['proc_mobile']) {
           $nm_saida->saida("         ajax_res_fill_combo('wilaya_SC_1');\r\n");
       }
       $nm_saida->saida("         $('#commune_SC_1').SumoSelect({okCancelInMulti:true, placeholder: '" . $this->Ini->Nm_lang['lang_search_select_summary'] . "', captionFormat:'{0} " . $this->Ini->Nm_lang['lang_btns_selected_summary'] . "', captionFormatAllSelected: '" . $this->Ini->Nm_lang['lang_btns_all_of_them_summary'] . "', selectAll:true, search: true, searchText:'" . $this->Ini->Nm_lang['lang_btns_type_summary'] . "', locale : ['" . $this->Ini->Nm_lang['lang_btns_ok_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_cancel_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_all_selected_summary'] . "'] });\r\n");
       if ($_SESSION['scriptcase']['proc_mobile']) {
           $nm_saida->saida("         ajax_res_fill_combo('commune_SC_1');\r\n");
       }
       $nm_saida->saida("         $('#maladie_confirmee_labo_SC_1').SumoSelect({okCancelInMulti:true, placeholder: '" . $this->Ini->Nm_lang['lang_search_select_summary'] . "', captionFormat:'{0} " . $this->Ini->Nm_lang['lang_btns_selected_summary'] . "', captionFormatAllSelected: '" . $this->Ini->Nm_lang['lang_btns_all_of_them_summary'] . "', selectAll:true, search: true, searchText:'" . $this->Ini->Nm_lang['lang_btns_type_summary'] . "', locale : ['" . $this->Ini->Nm_lang['lang_btns_ok_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_cancel_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_all_selected_summary'] . "'] });\r\n");
       if ($_SESSION['scriptcase']['proc_mobile']) {
           $nm_saida->saida("         ajax_res_fill_combo('maladie_confirmee_labo_SC_1');\r\n");
       }
       $nm_saida->saida("         $('#statut_maladie_SC_1').SumoSelect({okCancelInMulti:true, placeholder: '" . $this->Ini->Nm_lang['lang_search_select_summary'] . "', captionFormat:'{0} " . $this->Ini->Nm_lang['lang_btns_selected_summary'] . "', captionFormatAllSelected: '" . $this->Ini->Nm_lang['lang_btns_all_of_them_summary'] . "', selectAll:true, search: true, searchText:'" . $this->Ini->Nm_lang['lang_btns_type_summary'] . "', locale : ['" . $this->Ini->Nm_lang['lang_btns_ok_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_cancel_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_all_selected_summary'] . "'] });\r\n");
       if ($_SESSION['scriptcase']['proc_mobile']) {
           $nm_saida->saida("         ajax_res_fill_combo('statut_maladie_SC_1');\r\n");
       }
       $nm_saida->saida("         $('#evolution_nm_fk_SC_1').SumoSelect({okCancelInMulti:true, placeholder: '" . $this->Ini->Nm_lang['lang_search_select_summary'] . "', captionFormat:'{0} " . $this->Ini->Nm_lang['lang_btns_selected_summary'] . "', captionFormatAllSelected: '" . $this->Ini->Nm_lang['lang_btns_all_of_them_summary'] . "', selectAll:true, search: true, searchText:'" . $this->Ini->Nm_lang['lang_btns_type_summary'] . "', locale : ['" . $this->Ini->Nm_lang['lang_btns_ok_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_cancel_summary'] . "', '" . $this->Ini->Nm_lang['lang_btns_all_selected_summary'] . "'] });\r\n");
       if ($_SESSION['scriptcase']['proc_mobile']) {
           $nm_saida->saida("         ajax_res_fill_combo('evolution_nm_fk_SC_1');\r\n");
       }
       $nm_saida->saida("         scLoadScInput('input:text.sc-js-input');\r\n");
       if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look']))
       { 
           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look'] as $cada_combo => $opcs_combo)
           { 
               $nm_saida->saida("         $('#btn_clear_" . $cada_combo . "').show();\r\n");
           } 
           $nm_saida->saida("         $('#res_search_clear').show();\r\n");
           $nm_saida->saida("         $('#res_search_view').show();\r\n");
           $nm_saida->saida("         $('#res_search_back').hide();\r\n");
       } 
       $nm_saida->saida("     })\r\n");
       $nm_saida->saida("     Tab_obj_res_combo = new Array();\r\n");
       $nm_saida->saida("     Tab_obj_res_combo['statut_maladie_SC_1'] = true;\r\n");
       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['resumo_search_look'] as $cada_combo => $opcs_combo) {
          $nm_saida->saida("     Tab_obj_res_combo['" . $cada_combo . "'] = true;\r\n");
       } 
       $nm_saida->saida("     function ajax_res_fill_combo(field)\r\n");
       $nm_saida->saida("     {\r\n");
       $nm_saida->saida("         if (Tab_obj_res_combo[field]) {\r\n");
       $nm_saida->saida("             return false;\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         Tab_obj_res_combo[field] = true;\r\n");
       $nm_saida->saida("         nmAjaxProcOn();\r\n");
       $nm_saida->saida("         $.ajax({\r\n");
       $nm_saida->saida("           type: \"POST\",\r\n");
       $nm_saida->saida("           url: \"grid_fiche_prof_sante_stat_wilaya.php\",\r\n");
       $nm_saida->saida("           data: \"nmgp_opcao=ajax_res_fill_combo&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "\" + \"&NM_parms=\" + field\r\n");
       $nm_saida->saida("          })\r\n");
       $nm_saida->saida("          .done(function(res_fill_combo) {\r\n");
       $nm_saida->saida("             var i, oResp;\r\n");
       $nm_saida->saida("             Tst_integrid = res_fill_combo.trim();\r\n");
       $nm_saida->saida("             if (\"{\" != Tst_integrid.substr(0, 1)) {\r\n");
       $nm_saida->saida("                 nmAjaxProcOff();\r\n");
       $nm_saida->saida("                 alert (res_fill_combo);\r\n");
       $nm_saida->saida("                 return;\r\n");
       $nm_saida->saida("             }\r\n");
       $nm_saida->saida("             eval(\"oResp = \" + res_fill_combo);\r\n");
       $nm_saida->saida("             if (oResp[\"ss_time_out\"]) {\r\n");
       $nm_saida->saida("                 nmAjaxProcOff();\r\n");
       $nm_saida->saida("                 nm_move();\r\n");
       $nm_saida->saida("             }\r\n");
       $nm_saida->saida("             var field_sel = field;\r\n");
       $nm_saida->saida("             $('#' + field_sel).empty();\r\n");
       $nm_saida->saida("             if (oResp[\"set_option\"]) {\r\n");
       $nm_saida->saida("                 for (i = 0; i < oResp[\"set_option\"].length; i++) {\r\n");
       $nm_saida->saida("                     if (oResp[\"set_option\"][i][\"field\"] != field_sel) {\r\n");
       $nm_saida->saida("                         if (field_sel != \"\") {\r\n");
       $nm_saida->saida("                             $('#' + field_sel)[0].sumo.reload();\r\n");
       $nm_saida->saida("                             $('#' + field_sel).parent().find(\".CaptionCont\").click();\r\n");
       $nm_saida->saida("                         }\r\n");
       $nm_saida->saida("                         field_sel = oResp[\"set_option\"][i][\"field\"];\r\n");
       $nm_saida->saida("                         $('#' + field_sel).empty();\r\n");
       $nm_saida->saida("                     }\r\n");
       $nm_saida->saida("                     if (oResp[\"set_option\"][i][\"opt\"] == '__NM__') {\r\n");
       $nm_saida->saida("                         $('#' + field_sel).append($('<option>', { value: oResp[\"set_option\"][i][\"opt\"],text: oResp[\"set_option\"][i][\"value\"], selected: true, disabled: true}));\r\n");
       $nm_saida->saida("                     } else {\r\n");
       $nm_saida->saida("                         $('#' + field_sel).append($('<option>', { value: oResp[\"set_option\"][i][\"opt\"],text: oResp[\"set_option\"][i][\"value\"]}));\r\n");
       $nm_saida->saida("                     }\r\n");
       $nm_saida->saida("                 }\r\n");
       $nm_saida->saida("             }\r\n");
       $nm_saida->saida("             $('#' + field_sel)[0].sumo.reload();\r\n");
       $nm_saida->saida("             $('#' + field_sel).parent().find(\".CaptionCont\").click();\r\n");
       $nm_saida->saida("             if (oResp[\"htmOutput\"]) {\r\n");
       $nm_saida->saida("                 nmAjaxShowDebug(oResp);\r\n");
       $nm_saida->saida("             }\r\n");
       $nm_saida->saida("             nmAjaxProcOff();\r\n");
       $nm_saida->saida("         });\r\n");
       $nm_saida->saida("     }\r\n");
       $nm_saida->saida("     function nm_res_search_mobile_panel()\r\n");
       $nm_saida->saida("     {\r\n");
       $nm_saida->saida("         $('#res_search_clear').show();\r\n");
       $nm_saida->saida("         $('#res_search_view').show();\r\n");
       $nm_saida->saida("         $('#res_search_back').hide();\r\n");
       $nm_saida->saida("     }\r\n");
       $nm_saida->saida("     function nm_proc_res_search(obj_id, nam_db, tp_obj, tp_dado, tp_pesq, tp_data, format_dt)\r\n");
       $nm_saida->saida("     {\r\n");
       $nm_saida->saida("         if (tp_pesq == 'clear_res_search') {\r\n");
       $nm_saida->saida("             ajax_navigate_res('resumo_search', 'clear_res_search');\r\n");
       $nm_saida->saida("             return;\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         var result = '';\r\n");
       $nm_saida->saida("         if (tp_obj == 'slider') {\r\n");
       $nm_saida->saida("             result = $('#id_slider_' + obj_id).slider('values')[0] + \"_VLS_\" + $('#id_slider_' + obj_id).slider('values')[1];\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         $('#' + obj_id).addClass('active');\r\n");
       $nm_saida->saida("         if (tp_obj == 'select') {\r\n");
       $nm_saida->saida("             result  = res_search_get_select(obj_id);\r\n");
       $nm_saida->saida("             if (result == \"__NM__\") {\r\n");
       $nm_saida->saida("                 nam_db = \"\";\r\n");
       $nm_saida->saida("                 tp_obj = \"\";\r\n");
       $nm_saida->saida("                 tp_dado = \"\";\r\n");
       $nm_saida->saida("                 tp_pesq = \"clear_search_obj_all\";\r\n");
       $nm_saida->saida("                 tp_data = \"\";\r\n");
       $nm_saida->saida("                 format_dt = \"\";\r\n");
       $nm_saida->saida("             }\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         if (tp_obj == 'checkbox') {\r\n");
       $nm_saida->saida("             result  = res_search_get_checkbox(obj_id);\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         if (tp_obj == 'input' && tp_pesq == 'bw') {\r\n");
       $nm_saida->saida("             result = $('#' + obj_id + '_1').val() + \"_VLS_\" + $('#' + obj_id + '_2').val();\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         if (tp_data == 'realtive') {\r\n");
       $nm_saida->saida("             format_dt = result;\r\n");
       $nm_saida->saida("         }\r\n");
       $nm_saida->saida("         out_int  = obj_id + '__DL__' + nam_db + '__DL__' + tp_dado + '__DL__' + tp_pesq + '__DL__' + tp_data + '__DL__' + format_dt + '__DL__' + result;\r\n");
       $nm_saida->saida("         out_int  = out_int.replace(/[+]/g, \"__NM_PLUS__\");\r\n");
       $nm_saida->saida("         out_int  = out_int.replace(/[&]/g, \"__NM_AMP__\");\r\n");
       $nm_saida->saida("         out_int  = out_int.replace(/[%]/g, \"__NM_PRC__\");\r\n");
       $nm_saida->saida("         ajax_navigate_res('resumo_search', out_int);\r\n");
       $nm_saida->saida("     }\r\n");
       $nm_saida->saida("     function res_search_get_select(obj_id)\r\n");
       $nm_saida->saida("     {\r\n");
       $nm_saida->saida("        var obj = document.getElementById(obj_id);\r\n");
       $nm_saida->saida("        var val  = \"\";\r\n");
       $nm_saida->saida("        if (!obj.length)\r\n");
       $nm_saida->saida("        {\r\n");
       $nm_saida->saida("            val = obj.options[obj.selectedIndex].value;\r\n");
       $nm_saida->saida("            return val;\r\n");
       $nm_saida->saida("        }\r\n");
       $nm_saida->saida("        else\r\n");
       $nm_saida->saida("        {\r\n");
       $nm_saida->saida("            for (iCheck = 0; iCheck < obj.length; iCheck++)\r\n");
       $nm_saida->saida("            {\r\n");
       $nm_saida->saida("                if (obj.options[iCheck].selected)\r\n");
       $nm_saida->saida("                {\r\n");
       $nm_saida->saida("                    val += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
       $nm_saida->saida("                    val += obj.options[iCheck].value;\r\n");
       $nm_saida->saida("                }\r\n");
       $nm_saida->saida("            }\r\n");
       $nm_saida->saida("        }\r\n");
       $nm_saida->saida("        return val;\r\n");
       $nm_saida->saida("     }\r\n");
       $nm_saida->saida("     function res_search_get_checkbox(obj_id)\r\n");
       $nm_saida->saida("     {\r\n");
       $nm_saida->saida("        var Nobj = document.getElementById(obj_id).name;\r\n");
       $nm_saida->saida("        var obj  = document.getElementsByName(Nobj);\r\n");
       $nm_saida->saida("        var val  = \"\";\r\n");
       $nm_saida->saida("        if (!obj.length)\r\n");
       $nm_saida->saida("        {\r\n");
       $nm_saida->saida("            if (obj.checked)\r\n");
       $nm_saida->saida("            {\r\n");
       $nm_saida->saida("                val = obj.value;\r\n");
       $nm_saida->saida("            }\r\n");
       $nm_saida->saida("            return val;\r\n");
       $nm_saida->saida("        }\r\n");
       $nm_saida->saida("        else\r\n");
       $nm_saida->saida("        {\r\n");
       $nm_saida->saida("            for (iCheck = 0; iCheck < obj.length; iCheck++)\r\n");
       $nm_saida->saida("            {\r\n");
       $nm_saida->saida("                if (obj[iCheck].checked)\r\n");
       $nm_saida->saida("                {\r\n");
       $nm_saida->saida("                    val += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
       $nm_saida->saida("                    val += obj[iCheck].value;\r\n");
       $nm_saida->saida("                }\r\n");
       $nm_saida->saida("            }\r\n");
       $nm_saida->saida("        }\r\n");
       $nm_saida->saida("        return val;\r\n");
       $nm_saida->saida("     }\r\n");
       $nm_saida->saida("</script>\r\n");
   }

   //---- 
   function inicializa_arrays()
   {
      $this->array_total_statut_maladie = array();
      $this->array_total_maladie_confirmee_labo = array();
   }

   //---- 
   function adiciona_registro($quebra_statut_maladie, $quebra_maladie_confirmee_labo, $quebra_statut_maladie_orig, $quebra_maladie_confirmee_labo_orig)
   {
      //----- statut_maladie
      if (!isset($this->array_total_statut_maladie[$quebra_statut_maladie_orig]))
      {
         $this->array_total_statut_maladie[$quebra_statut_maladie_orig][0] = 1;
         $this->array_total_statut_maladie[$quebra_statut_maladie_orig][1] = 1;
         $this->array_total_statut_maladie[$quebra_statut_maladie_orig][2] = $quebra_statut_maladie;
         $this->array_total_statut_maladie[$quebra_statut_maladie_orig][3] = $quebra_statut_maladie_orig;
      }
      else
      {
         $this->array_total_statut_maladie[$quebra_statut_maladie_orig][0]++;
         $this->array_total_statut_maladie[$quebra_statut_maladie_orig][2]++;
      }
      //----- maladie_confirmee_labo
      if (!isset($this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig]))
      {
         $this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig][0] = 1;
         $this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig][1] = 1;
         $this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig][2] = $quebra_maladie_confirmee_labo;
         $this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig][3] = $quebra_maladie_confirmee_labo_orig;
      }
      else
      {
         $this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig][0]++;
         $this->array_total_maladie_confirmee_labo[$quebra_statut_maladie_orig][$quebra_maladie_confirmee_labo_orig][2]++;
      }
   }

   //---- 
   function finaliza_arrays()
   {
   }

   function prepara_resumo()
   {
      $this->inicializa_vars();
      $this->resumo_init();
      $this->inicializa_arrays();
   }

   function finaliza_resumo()
   {
      $this->finaliza_arrays();
   }

//
   function nm_acumula_resumo($nm_tipo="resumo")
   {
     global $nm_lang;
     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']))
     { 
         $Busca_temp = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca'];
         if ($_SESSION['scriptcase']['charset'] != "UTF-8")
         {
             $Busca_temp = NM_conv_charset($Busca_temp, $_SESSION['scriptcase']['charset'], "UTF-8");
         }
       $this->id_fiche_ps = $Busca_temp['id_fiche_ps']; 
       $this->id_fiche_ps = (isset($Busca_temp['id_fiche_ps'])) ? $Busca_temp['id_fiche_ps'] : ""; 
       $tmp_pos = (is_string($this->id_fiche_ps)) ? strpos($this->id_fiche_ps, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->id_fiche_ps))
       {
           $this->id_fiche_ps = substr($this->id_fiche_ps, 0, $tmp_pos);
       }
       $this->code_fiche = $Busca_temp['code_fiche']; 
       $this->code_fiche = (isset($Busca_temp['code_fiche'])) ? $Busca_temp['code_fiche'] : ""; 
       $tmp_pos = (is_string($this->code_fiche)) ? strpos($this->code_fiche, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->code_fiche))
       {
           $this->code_fiche = substr($this->code_fiche, 0, $tmp_pos);
       }
       $this->date_declaration = $Busca_temp['date_declaration']; 
       $this->date_declaration = (isset($Busca_temp['date_declaration'])) ? $Busca_temp['date_declaration'] : ""; 
       $tmp_pos = (is_string($this->date_declaration)) ? strpos($this->date_declaration, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->date_declaration))
       {
           $this->date_declaration = substr($this->date_declaration, 0, $tmp_pos);
       }
       $date_declaration_2 = (isset($Busca_temp['date_declaration_input_2'])) ? $Busca_temp['date_declaration_input_2'] : ""; 
       $this->date_declaration_2 = $date_declaration_2; 
       $this->wilaya = $Busca_temp['wilaya']; 
       $this->wilaya = (isset($Busca_temp['wilaya'])) ? $Busca_temp['wilaya'] : ""; 
       $tmp_pos = (is_string($this->wilaya)) ? strpos($this->wilaya, "##@@") : false;
       if ($tmp_pos !== false && !is_array($this->wilaya))
       {
           $this->wilaya = substr($this->wilaya, 0, $tmp_pos);
       }
     } 
     $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_orig'];
     $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_pesq'];
     $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_pesq_filtro'];
     $this->nm_field_dinamico = array();
     $this->nm_order_dinamico = array();
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ""; 
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
     { 
         $nmgp_select = "SELECT id_fiche_ps, code_fiche, str_replace (convert(char(10),date_declaration,102), '.', '-') + ' ' + convert(char(8),date_declaration,20), wilaya, commune, sexe_nm_fk, evolution_nm_fk, maladie_confirmee_labo, statut_maladie, pays_origine, nationalite_nm_fk from (SELECT     id_fiche_ps,     code_fiche,     date_declaration,     wilaya,     commune,     \"structure\",     nom_rapporteur,     tel_rapporteur,     email_rapporteur,     maladie_suspectee_nm_fk,     nom_malade,     prenom_malade,     date_naissance_malade,     age_malade,     sexe_nm_fk,     profession_malade,     adresse_malade,     wilaya_malade,     commune_malade,     lieu_travail,     tel_malade,     email_malade,     lieux_frequentes,     date_apparition_symptomes,     autres_symptomes,     hospitalisation,     date_hospitalisation,     evacuation,     date_evacuation,     structure_evacuation,     antecedent_medicaux,     commentaires,     longitude,     latitude,     envoie,     envoie_ack,     valide,     descr_invalidite,     user_fk,     validator_fk,     mobile,     evolution_nm_fk,     symptomes,     device_id,     maladie_suspectee_by_ia,     date_validation,     user_labo_fk,     date_confirmation_labo,     maladie_confirmee_labo,     statut_maladie,     date_sortie,     date_deces,     date_prelevements,     date_reception_prelevement,     date_resultats_labo,     type_prelevement_nm_fk,     resultats_labo,     labo_destination,     nin,     commentaires_labo,     commentaires_semep,     statut_fiche,     pays_origine,     nationalite_nm_fk FROM     \"public\".fiche_prof_sante  WHERE  (structure in (select code_structure from structures_sante where wilaya_structure = '" . $_SESSION['var_fac'] . "'))  and  (((fiche_prof_sante.date_declaration)::date >= (('now'::text)::date - (concat(( SELECT sec_settings.set_value                    FROM sec_settings                   WHERE ((sec_settings.set_name)::text = 'stat_observation_period'::text)), ' days'))::interval))  AND (fiche_prof_sante.deleted IS DISTINCT FROM 'O'::bpchar)) ) nm_sel_esp"; 
     } 
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
     { 
         $nmgp_select = "SELECT id_fiche_ps, code_fiche, date_declaration, wilaya, commune, sexe_nm_fk, evolution_nm_fk, maladie_confirmee_labo, statut_maladie, pays_origine, nationalite_nm_fk from (SELECT     id_fiche_ps,     code_fiche,     date_declaration,     wilaya,     commune,     \"structure\",     nom_rapporteur,     tel_rapporteur,     email_rapporteur,     maladie_suspectee_nm_fk,     nom_malade,     prenom_malade,     date_naissance_malade,     age_malade,     sexe_nm_fk,     profession_malade,     adresse_malade,     wilaya_malade,     commune_malade,     lieu_travail,     tel_malade,     email_malade,     lieux_frequentes,     date_apparition_symptomes,     autres_symptomes,     hospitalisation,     date_hospitalisation,     evacuation,     date_evacuation,     structure_evacuation,     antecedent_medicaux,     commentaires,     longitude,     latitude,     envoie,     envoie_ack,     valide,     descr_invalidite,     user_fk,     validator_fk,     mobile,     evolution_nm_fk,     symptomes,     device_id,     maladie_suspectee_by_ia,     date_validation,     user_labo_fk,     date_confirmation_labo,     maladie_confirmee_labo,     statut_maladie,     date_sortie,     date_deces,     date_prelevements,     date_reception_prelevement,     date_resultats_labo,     type_prelevement_nm_fk,     resultats_labo,     labo_destination,     nin,     commentaires_labo,     commentaires_semep,     statut_fiche,     pays_origine,     nationalite_nm_fk FROM     \"public\".fiche_prof_sante  WHERE  (structure in (select code_structure from structures_sante where wilaya_structure = '" . $_SESSION['var_fac'] . "'))  and  (((fiche_prof_sante.date_declaration)::date >= (('now'::text)::date - (concat(( SELECT sec_settings.set_value                    FROM sec_settings                   WHERE ((sec_settings.set_name)::text = 'stat_observation_period'::text)), ' days'))::interval))  AND (fiche_prof_sante.deleted IS DISTINCT FROM 'O'::bpchar)) ) nm_sel_esp"; 
     } 
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     { 
         $nmgp_select = "SELECT id_fiche_ps, code_fiche, convert(char(23),date_declaration,121), wilaya, commune, sexe_nm_fk, evolution_nm_fk, maladie_confirmee_labo, statut_maladie, pays_origine, nationalite_nm_fk from (SELECT     id_fiche_ps,     code_fiche,     date_declaration,     wilaya,     commune,     \"structure\",     nom_rapporteur,     tel_rapporteur,     email_rapporteur,     maladie_suspectee_nm_fk,     nom_malade,     prenom_malade,     date_naissance_malade,     age_malade,     sexe_nm_fk,     profession_malade,     adresse_malade,     wilaya_malade,     commune_malade,     lieu_travail,     tel_malade,     email_malade,     lieux_frequentes,     date_apparition_symptomes,     autres_symptomes,     hospitalisation,     date_hospitalisation,     evacuation,     date_evacuation,     structure_evacuation,     antecedent_medicaux,     commentaires,     longitude,     latitude,     envoie,     envoie_ack,     valide,     descr_invalidite,     user_fk,     validator_fk,     mobile,     evolution_nm_fk,     symptomes,     device_id,     maladie_suspectee_by_ia,     date_validation,     user_labo_fk,     date_confirmation_labo,     maladie_confirmee_labo,     statut_maladie,     date_sortie,     date_deces,     date_prelevements,     date_reception_prelevement,     date_resultats_labo,     type_prelevement_nm_fk,     resultats_labo,     labo_destination,     nin,     commentaires_labo,     commentaires_semep,     statut_fiche,     pays_origine,     nationalite_nm_fk FROM     \"public\".fiche_prof_sante  WHERE  (structure in (select code_structure from structures_sante where wilaya_structure = '" . $_SESSION['var_fac'] . "'))  and  (((fiche_prof_sante.date_declaration)::date >= (('now'::text)::date - (concat(( SELECT sec_settings.set_value                    FROM sec_settings                   WHERE ((sec_settings.set_name)::text = 'stat_observation_period'::text)), ' days'))::interval))  AND (fiche_prof_sante.deleted IS DISTINCT FROM 'O'::bpchar)) ) nm_sel_esp"; 
     } 
     else 
     { 
         $nmgp_select = "SELECT id_fiche_ps, code_fiche, date_declaration, wilaya, commune, sexe_nm_fk, evolution_nm_fk, maladie_confirmee_labo, statut_maladie, pays_origine, nationalite_nm_fk from (SELECT     id_fiche_ps,     code_fiche,     date_declaration,     wilaya,     commune,     \"structure\",     nom_rapporteur,     tel_rapporteur,     email_rapporteur,     maladie_suspectee_nm_fk,     nom_malade,     prenom_malade,     date_naissance_malade,     age_malade,     sexe_nm_fk,     profession_malade,     adresse_malade,     wilaya_malade,     commune_malade,     lieu_travail,     tel_malade,     email_malade,     lieux_frequentes,     date_apparition_symptomes,     autres_symptomes,     hospitalisation,     date_hospitalisation,     evacuation,     date_evacuation,     structure_evacuation,     antecedent_medicaux,     commentaires,     longitude,     latitude,     envoie,     envoie_ack,     valide,     descr_invalidite,     user_fk,     validator_fk,     mobile,     evolution_nm_fk,     symptomes,     device_id,     maladie_suspectee_by_ia,     date_validation,     user_labo_fk,     date_confirmation_labo,     maladie_confirmee_labo,     statut_maladie,     date_sortie,     date_deces,     date_prelevements,     date_reception_prelevement,     date_resultats_labo,     type_prelevement_nm_fk,     resultats_labo,     labo_destination,     nin,     commentaires_labo,     commentaires_semep,     statut_fiche,     pays_origine,     nationalite_nm_fk FROM     \"public\".fiche_prof_sante  WHERE  (structure in (select code_structure from structures_sante where wilaya_structure = '" . $_SESSION['var_fac'] . "'))  and  (((fiche_prof_sante.date_declaration)::date >= (('now'::text)::date - (concat(( SELECT sec_settings.set_value                    FROM sec_settings                   WHERE ((sec_settings.set_name)::text = 'stat_observation_period'::text)), ' days'))::interval))  AND (fiche_prof_sante.deleted IS DISTINCT FROM 'O'::bpchar)) ) nm_sel_esp"; 
     } 
     $nmgp_select .= " " . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['where_pesq']; 
     $campos_order = "";
     $format       = $this->Ini->Get_Gb_date_format('stat1', 'statut_maladie');
     $campos_order = $this->Ini->Get_date_order_groupby("statut_maladie", 'asc', $format, $campos_order);
     $format       = $this->Ini->Get_Gb_date_format('stat1', 'maladie_confirmee_labo');
     $campos_order = $this->Ini->Get_date_order_groupby("maladie_confirmee_labo", 'asc', $format, $campos_order);
     $nmgp_order_by = (!empty($campos_order)) ? " order by " . $campos_order : "";
     $nmgp_select .= $nmgp_order_by; 
     $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select; 
     $rs_res = $this->Db->Execute($nmgp_select) ; 
     if ($rs_res === false && !$rs_graf->EOF) 
     { 
         $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
         exit ; 
     }  
// 
     if ($nm_tipo != "resumo") 
     {  
          $this->nm_acum_res_unit($rs_res, $nm_tipo);
     }  
     else  
     {  
         while (!$rs_res->EOF) 
         {  
                $this->nm_acum_res_unit($rs_res, "resumo");
                $rs_res->MoveNext();
         }  
     }  
     $rs_res->Close();
   }
// 
   function nm_acum_res_unit($rs_res, $nm_tipo="resumo")
   {
            if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca']))
            { 
                $Busca_temp = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_fiche_prof_sante_stat_wilaya']['campos_busca'];
                if ($_SESSION['scriptcase']['charset'] != "UTF-8")
                {
                    $Busca_temp = NM_conv_charset($Busca_temp, $_SESSION['scriptcase']['charset'], "UTF-8");
                }
                $this->id_fiche_ps = (isset($Busca_temp['id_fiche_ps'])) ? $Busca_temp['id_fiche_ps'] : ""; 
                $tmp_pos = (is_string($this->id_fiche_ps)) ? strpos($this->id_fiche_ps, "##@@") : false;
                if ($tmp_pos !== false && !is_array($this->id_fiche_ps))
                {
                   $this->id_fiche_ps = substr($this->id_fiche_ps, 0, $tmp_pos);
                }
                $this->code_fiche = (isset($Busca_temp['code_fiche'])) ? $Busca_temp['code_fiche'] : ""; 
                $tmp_pos = (is_string($this->code_fiche)) ? strpos($this->code_fiche, "##@@") : false;
                if ($tmp_pos !== false && !is_array($this->code_fiche))
                {
                   $this->code_fiche = substr($this->code_fiche, 0, $tmp_pos);
                }
                $this->wilaya = (isset($Busca_temp['wilaya'])) ? $Busca_temp['wilaya'] : ""; 
                $tmp_pos = (is_string($this->wilaya)) ? strpos($this->wilaya, "##@@") : false;
                if ($tmp_pos !== false && !is_array($this->wilaya))
                {
                   $this->wilaya = substr($this->wilaya, 0, $tmp_pos);
                }
            } 
            $this->id_fiche_ps = $rs_res->fields[0] ;  
            $this->code_fiche = $rs_res->fields[1] ;  
            $this->date_declaration = $rs_res->fields[2] ;  
            $this->wilaya = $rs_res->fields[3] ;  
            $this->commune = $rs_res->fields[4] ;  
            $this->sexe_nm_fk = $rs_res->fields[5] ;  
            $this->evolution_nm_fk = $rs_res->fields[6] ;  
            $this->maladie_confirmee_labo = $rs_res->fields[7] ;  
            $this->statut_maladie = $rs_res->fields[8] ;  
            $this->pays_origine = $rs_res->fields[9] ;  
            $this->nationalite_nm_fk = $rs_res->fields[10] ;  
            $this->statut_maladie_orig = $this->statut_maladie;
            $this->maladie_confirmee_labo_orig = $this->maladie_confirmee_labo;
            if ($nm_tipo == "resumo")
            {
                $this->adiciona_registro($this->statut_maladie, $this->maladie_confirmee_labo, $this->statut_maladie_orig,  $this->maladie_confirmee_labo_orig);
            }
   }
//
   function nm_gera_mask(&$nm_campo, $nm_mask)
   { 
      $trab_campo = $nm_campo;
      $trab_mask  = $nm_mask;
      $tam_campo  = strlen($nm_campo);
      $trab_saida = "";
      $str_highlight_ini = "";
      $str_highlight_fim = "";
      if(substr($nm_campo, 0, 23) == '<div class="highlight">' && substr($nm_campo, -6) == '</div>')
      {
           $str_highlight_ini = substr($nm_campo, 0, 23);
           $str_highlight_fim = substr($nm_campo, -6);

           $trab_campo = substr($nm_campo, 23, -6);
           $tam_campo  = strlen($trab_campo);
      }      $mask_num = false;
      for ($x=0; $x < strlen($trab_mask); $x++)
      {
          if (substr($trab_mask, $x, 1) == "#")
          {
              $mask_num = true;
              break;
          }
      }
      if ($mask_num )
      {
          $ver_duas = explode(";", $trab_mask);
          if (isset($ver_duas[1]) && !empty($ver_duas[1]))
          {
              $cont1 = count(explode("#", $ver_duas[0])) - 1;
              $cont2 = count(explode("#", $ver_duas[1])) - 1;
              if ($tam_campo >= $cont2)
              {
                  $trab_mask = $ver_duas[1];
              }
              else
              {
                  $trab_mask = $ver_duas[0];
              }
          }
          $tam_mask = strlen($trab_mask);
          $xdados = 0;
          for ($x=0; $x < $tam_mask; $x++)
          {
              if (substr($trab_mask, $x, 1) == "#" && $xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_campo, $xdados, 1);
                  $xdados++;
              }
              elseif ($xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_mask, $x, 1);
              }
          }
          if ($xdados < $tam_campo)
          {
              $trab_saida .= substr($trab_campo, $xdados);
          }
          $nm_campo = $str_highlight_ini . $trab_saida . $str_highlight_ini;
          return;
      }
      for ($ix = strlen($trab_mask); $ix > 0; $ix--)
      {
           $char_mask = substr($trab_mask, $ix - 1, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               $trab_saida = $char_mask . $trab_saida;
           }
           else
           {
               if ($tam_campo != 0)
               {
                   $trab_saida = substr($trab_campo, $tam_campo - 1, 1) . $trab_saida;
                   $tam_campo--;
               }
               else
               {
                   $trab_saida = "0" . $trab_saida;
               }
           }
      }
      if ($tam_campo != 0)
      {
          $trab_saida = substr($trab_campo, 0, $tam_campo) . $trab_saida;
          $trab_mask  = str_repeat("z", $tam_campo) . $trab_mask;
      }
   
      $iz = 0; 
      for ($ix = 0; $ix < strlen($trab_mask); $ix++)
      {
           $char_mask = substr($trab_mask, $ix, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               if ($char_mask == "." || $char_mask == ",")
               {
                   $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
               }
               else
               {
                   $iz++;
               }
           }
           elseif ($char_mask == "x" || substr($trab_saida, $iz, 1) != "0")
           {
               $ix = strlen($trab_mask) + 1;
           }
           else
           {
               $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
           }
      }
      $nm_campo = $str_highlight_ini . $trab_saida . $str_highlight_ini;
   } 
   function nm_conv_data_db($dt_in, $form_in, $form_out)
   {
       $dt_out = $dt_in;
       if (strtoupper($form_in) == "DB_FORMAT") {
           if ($dt_out == "null" || $dt_out == "")
           {
               $dt_out = "";
               return $dt_out;
           }
           $form_in = "AAAA-MM-DD";
       }
       if (strtoupper($form_out) == "DB_FORMAT") {
           if (empty($dt_out))
           {
               $dt_out = "null";
               return $dt_out;
           }
           $form_out = "AAAA-MM-DD";
       }
       if (strtoupper($form_out) == "SC_FORMAT_REGION") {
           $this->nm_data->SetaData($dt_in, strtoupper($form_in));
           $prep_out  = (strpos(strtolower($form_in), "dd") !== false) ? "dd" : "";
           $prep_out .= (strpos(strtolower($form_in), "mm") !== false) ? "mm" : "";
           $prep_out .= (strpos(strtolower($form_in), "aa") !== false) ? "aaaa" : "";
           $prep_out .= (strpos(strtolower($form_in), "yy") !== false) ? "aaaa" : "";
           return $this->nm_data->FormataSaida($this->nm_data->FormatRegion("DT", $prep_out));
       }
       else {
           nm_conv_form_data($dt_out, $form_in, $form_out);
           return $dt_out;
       }
   }
}
?>
