<?php
// This script and data application were generated by AppGini 5.97
// Download AppGini for free from https://bigprof.com/appgini/download/

	/* Configuration */
	/*************************************/

		$pcConfig = [
			'sugerir_valor' => [
				'atividade' => [
					'parent-table' => 'atividades',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Sugerir Valor de Atividade <span class="hidden child-label-sugerir_valor child-field-caption">(Atividade)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(2 => 'Nome', 3 => 'CPF', 4 => 'Celular', 5 => 'E-mail', 6 => 'Cidade', 7 => 'UF', 9 => 'Atividade', 10 => 'Qdade', 11 => 'Unidade', 12 => 'Valor (R$)', 13 => 'Observa&#231;&#245;es'),
					'display-field-names' => array(2 => 'nome', 3 => 'cpf', 4 => 'celular', 5 => 'email', 6 => 'cidade', 7 => 'uf', 9 => 'atividade', 10 => 'quantidade', 11 => 'unidade', 12 => 'valor', 13 => 'obs'),
					'sortable-fields' => array(0 => '`sugerir_valor`.`id`', 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => '`categorias1`.`nome`', 9 => 10, 10 => 11, 11 => '`unidades1`.`unidade`', 12 => 13, 13 => 14),
					'records-per-page' => 10,
					'default-sort-by' => 1,
					'default-sort-direction' => 'desc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-sugerir_valor',
					'template-printable' => 'children-sugerir_valor-printable',
					'query' => "SELECT `sugerir_valor`.`id` as 'id', `sugerir_valor`.`data` as 'data', `sugerir_valor`.`nome` as 'nome', `sugerir_valor`.`cpf` as 'cpf', `sugerir_valor`.`celular` as 'celular', `sugerir_valor`.`email` as 'email', `sugerir_valor`.`cidade` as 'cidade', `sugerir_valor`.`uf` as 'uf', IF(    CHAR_LENGTH(`categorias1`.`nome`), CONCAT_WS('',   `categorias1`.`nome`), '') as 'categoria', IF(    CHAR_LENGTH(`atividades1`.`atividade`) || CHAR_LENGTH(`atividades1`.`descricao`), CONCAT_WS('',   `atividades1`.`atividade`, ' - ', `atividades1`.`descricao`), '') as 'atividade', `sugerir_valor`.`quantidade` as 'quantidade', IF(    CHAR_LENGTH(`unidades1`.`unidade`), CONCAT_WS('',   `unidades1`.`unidade`), '') as 'unidade', `sugerir_valor`.`valor` as 'valor', `sugerir_valor`.`obs` as 'obs' FROM `sugerir_valor` LEFT JOIN `categorias` as categorias1 ON `categorias1`.`id`=`sugerir_valor`.`categoria` LEFT JOIN `atividades` as atividades1 ON `atividades1`.`id`=`sugerir_valor`.`atividade` LEFT JOIN `unidades` as unidades1 ON `unidades1`.`id`=`sugerir_valor`.`unidade` "
				],
			],
			'sugerir_atividade' => [
			],
			'c001' => [
			],
			'c001_ref' => [
				'id_categoria' => [
					'parent-table' => 'c001',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias <span class="hidden child-label-c001_ref child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor'),
					'sortable-fields' => array(0 => '`c001_ref`.`id`', 1 => '`c0011`.`id`', 2 => '`c001_ref`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c001_ref',
					'template-printable' => 'children-c001_ref-printable',
					'query' => "SELECT `c001_ref`.`id` as 'id', IF(    CHAR_LENGTH(`c0011`.`id`), CONCAT_WS('',   `c0011`.`id`), '') as 'id_categoria', DATE_FORMAT(`c001_ref`.`data`, '%e/%c/%Y') as 'data', `c001_ref`.`nome` as 'nome', `c001_ref`.`cpf` as 'cpf', `c001_ref`.`celular` as 'celular', `c001_ref`.`email` as 'email', `c001_ref`.`cidade` as 'cidade', `c001_ref`.`uf` as 'uf', `c001_ref`.`regiao` as 'regiao', `c001_ref`.`quantidade` as 'quantidade', `c001_ref`.`unidade` as 'unidade', `c001_ref`.`uta` as 'uta', `c001_ref`.`valor` as 'valor', `c001_ref`.`obs` as 'obs', `c001_ref`.`situacao` as 'situacao' FROM `c001_ref` LEFT JOIN `c001` as c0011 ON `c0011`.`id`=`c001_ref`.`id_categoria` "
				],
			],
			'c001_ref_colaborar' => [
				'id_categoria' => [
					'parent-table' => 'c001',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Quero Colaborar <span class="hidden child-label-c001_ref_colaborar child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(0 => 'ID', 10 => 'Sua Colabora&#231;&#227;o:'),
					'display-field-names' => array(0 => 'id', 10 => 'colaboracao'),
					'sortable-fields' => array(0 => '`c001_ref_colaborar`.`id`', 1 => '`c0011`.`id`', 2 => '`c001_ref_colaborar`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => '`unidades1`.`unidade`', 14 => 15, 15 => 16, 16 => 17, 17 => 18),
					'records-per-page' => 10,
					'default-sort-by' => 11,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c001_ref_colaborar',
					'template-printable' => 'children-c001_ref_colaborar-printable',
					'query' => "SELECT `c001_ref_colaborar`.`id` as 'id', IF(    CHAR_LENGTH(`c0011`.`id`), CONCAT_WS('',   `c0011`.`id`), '') as 'id_categoria', DATE_FORMAT(`c001_ref_colaborar`.`data`, '%e/%c/%Y') as 'data', `c001_ref_colaborar`.`nome` as 'nome', `c001_ref_colaborar`.`cpf` as 'cpf', `c001_ref_colaborar`.`celular` as 'celular', `c001_ref_colaborar`.`email` as 'email', `c001_ref_colaborar`.`cidade` as 'cidade', `c001_ref_colaborar`.`uf` as 'uf', `c001_ref_colaborar`.`espaco` as 'espaco', `c001_ref_colaborar`.`colaboracao` as 'colaboracao', `c001_ref_colaborar`.`regiao` as 'regiao', `c001_ref_colaborar`.`quantidade` as 'quantidade', IF(    CHAR_LENGTH(`unidades1`.`unidade`), CONCAT_WS('',   `unidades1`.`unidade`), '') as 'unidade', `c001_ref_colaborar`.`valor` as 'valor', `c001_ref_colaborar`.`uta` as 'uta', `c001_ref_colaborar`.`obs` as 'obs', `c001_ref_colaborar`.`situacao` as 'situacao' FROM `c001_ref_colaborar` LEFT JOIN `c001` as c0011 ON `c0011`.`id`=`c001_ref_colaborar`.`id_categoria` LEFT JOIN `unidades` as unidades1 ON `unidades1`.`id`=`c001_ref_colaborar`.`unidade` "
				],
			],
			'c001_ref_inativas' => [
				'id_categoria' => [
					'parent-table' => 'c001',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias (Todas) <span class="hidden child-label-c001_ref_inativas child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor', 15 => 'Situa&#231;&#227;o'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor', 15 => 'situacao'),
					'sortable-fields' => array(0 => '`c001_ref_inativas`.`id`', 1 => '`c0011`.`id`', 2 => '`c001_ref_inativas`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c001_ref_inativas',
					'template-printable' => 'children-c001_ref_inativas-printable',
					'query' => "SELECT `c001_ref_inativas`.`id` as 'id', IF(    CHAR_LENGTH(`c0011`.`id`), CONCAT_WS('',   `c0011`.`id`), '') as 'id_categoria', DATE_FORMAT(`c001_ref_inativas`.`data`, '%e/%c/%Y') as 'data', `c001_ref_inativas`.`nome` as 'nome', `c001_ref_inativas`.`cpf` as 'cpf', `c001_ref_inativas`.`celular` as 'celular', `c001_ref_inativas`.`email` as 'email', `c001_ref_inativas`.`cidade` as 'cidade', `c001_ref_inativas`.`uf` as 'uf', `c001_ref_inativas`.`regiao` as 'regiao', `c001_ref_inativas`.`quantidade` as 'quantidade', `c001_ref_inativas`.`unidade` as 'unidade', `c001_ref_inativas`.`uta` as 'uta', `c001_ref_inativas`.`valor` as 'valor', `c001_ref_inativas`.`obs` as 'obs', `c001_ref_inativas`.`situacao` as 'situacao' FROM `c001_ref_inativas` LEFT JOIN `c001` as c0011 ON `c0011`.`id`=`c001_ref_inativas`.`id_categoria` "
				],
			],
			'categorias' => [
			],
			'referencias_ativas' => [
			],
			'referencias_inativas' => [
			],
			'uta' => [
			],
			'unidades' => [
			],
			'atividades' => [
			],
			'c002' => [
			],
			'c002_ref' => [
				'id_categoria' => [
					'parent-table' => 'c002',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias <span class="hidden child-label-c002_ref child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor'),
					'sortable-fields' => array(0 => '`c002_ref`.`id`', 1 => '`c0021`.`id`', 2 => '`c002_ref`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c002_ref',
					'template-printable' => 'children-c002_ref-printable',
					'query' => "SELECT `c002_ref`.`id` as 'id', IF(    CHAR_LENGTH(`c0021`.`id`), CONCAT_WS('',   `c0021`.`id`), '') as 'id_categoria', DATE_FORMAT(`c002_ref`.`data`, '%e/%c/%Y') as 'data', `c002_ref`.`nome` as 'nome', `c002_ref`.`cpf` as 'cpf', `c002_ref`.`celular` as 'celular', `c002_ref`.`email` as 'email', `c002_ref`.`cidade` as 'cidade', `c002_ref`.`uf` as 'uf', `c002_ref`.`regiao` as 'regiao', `c002_ref`.`quantidade` as 'quantidade', `c002_ref`.`unidade` as 'unidade', `c002_ref`.`uta` as 'uta', `c002_ref`.`valor` as 'valor', `c002_ref`.`obs` as 'obs', `c002_ref`.`situacao` as 'situacao' FROM `c002_ref` LEFT JOIN `c002` as c0021 ON `c0021`.`id`=`c002_ref`.`id_categoria` "
				],
			],
			'c002_ref_colaborar' => [
				'id_categoria' => [
					'parent-table' => 'c002',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Quero Colaborar <span class="hidden child-label-c002_ref_colaborar child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(0 => 'ID', 10 => 'Sua Colabora&#231;&#227;o:'),
					'display-field-names' => array(0 => 'id', 10 => 'colaboracao'),
					'sortable-fields' => array(0 => '`c002_ref_colaborar`.`id`', 1 => '`c0021`.`id`', 2 => '`c002_ref_colaborar`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => '`unidades1`.`unidade`', 14 => 15, 15 => 16, 16 => 17, 17 => 18),
					'records-per-page' => 10,
					'default-sort-by' => 11,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c002_ref_colaborar',
					'template-printable' => 'children-c002_ref_colaborar-printable',
					'query' => "SELECT `c002_ref_colaborar`.`id` as 'id', IF(    CHAR_LENGTH(`c0021`.`id`), CONCAT_WS('',   `c0021`.`id`), '') as 'id_categoria', DATE_FORMAT(`c002_ref_colaborar`.`data`, '%e/%c/%Y') as 'data', `c002_ref_colaborar`.`nome` as 'nome', `c002_ref_colaborar`.`cpf` as 'cpf', `c002_ref_colaborar`.`celular` as 'celular', `c002_ref_colaborar`.`email` as 'email', `c002_ref_colaborar`.`cidade` as 'cidade', `c002_ref_colaborar`.`uf` as 'uf', `c002_ref_colaborar`.`espaco` as 'espaco', `c002_ref_colaborar`.`colaboracao` as 'colaboracao', `c002_ref_colaborar`.`regiao` as 'regiao', `c002_ref_colaborar`.`quantidade` as 'quantidade', IF(    CHAR_LENGTH(`unidades1`.`unidade`), CONCAT_WS('',   `unidades1`.`unidade`), '') as 'unidade', `c002_ref_colaborar`.`valor` as 'valor', `c002_ref_colaborar`.`uta` as 'uta', `c002_ref_colaborar`.`obs` as 'obs', `c002_ref_colaborar`.`situacao` as 'situacao' FROM `c002_ref_colaborar` LEFT JOIN `c002` as c0021 ON `c0021`.`id`=`c002_ref_colaborar`.`id_categoria` LEFT JOIN `unidades` as unidades1 ON `unidades1`.`id`=`c002_ref_colaborar`.`unidade` "
				],
			],
			'c002_ref_inativas' => [
				'id_categoria' => [
					'parent-table' => 'c002',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias Gerais <span class="hidden child-label-c002_ref_inativas child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor', 15 => 'Situa&#231;&#227;o'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor', 15 => 'situacao'),
					'sortable-fields' => array(0 => '`c002_ref_inativas`.`id`', 1 => '`c0021`.`id`', 2 => '`c002_ref_inativas`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c002_ref_inativas',
					'template-printable' => 'children-c002_ref_inativas-printable',
					'query' => "SELECT `c002_ref_inativas`.`id` as 'id', IF(    CHAR_LENGTH(`c0021`.`id`), CONCAT_WS('',   `c0021`.`id`), '') as 'id_categoria', DATE_FORMAT(`c002_ref_inativas`.`data`, '%e/%c/%Y') as 'data', `c002_ref_inativas`.`nome` as 'nome', `c002_ref_inativas`.`cpf` as 'cpf', `c002_ref_inativas`.`celular` as 'celular', `c002_ref_inativas`.`email` as 'email', `c002_ref_inativas`.`cidade` as 'cidade', `c002_ref_inativas`.`uf` as 'uf', `c002_ref_inativas`.`regiao` as 'regiao', `c002_ref_inativas`.`quantidade` as 'quantidade', `c002_ref_inativas`.`unidade` as 'unidade', `c002_ref_inativas`.`uta` as 'uta', `c002_ref_inativas`.`valor` as 'valor', `c002_ref_inativas`.`obs` as 'obs', `c002_ref_inativas`.`situacao` as 'situacao' FROM `c002_ref_inativas` LEFT JOIN `c002` as c0021 ON `c0021`.`id`=`c002_ref_inativas`.`id_categoria` "
				],
			],
			'colaborar_atividade' => [
			],
			'informacoes' => [
			],
			'c003' => [
			],
			'c003_ref' => [
				'id_categoria' => [
					'parent-table' => 'c003',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias <span class="hidden child-label-c003_ref child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor'),
					'sortable-fields' => array(0 => '`c003_ref`.`id`', 1 => '`c0031`.`id`', 2 => '`c003_ref`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c003_ref',
					'template-printable' => 'children-c003_ref-printable',
					'query' => "SELECT `c003_ref`.`id` as 'id', IF(    CHAR_LENGTH(`c0031`.`id`), CONCAT_WS('',   `c0031`.`id`), '') as 'id_categoria', DATE_FORMAT(`c003_ref`.`data`, '%e/%c/%Y') as 'data', `c003_ref`.`nome` as 'nome', `c003_ref`.`cpf` as 'cpf', `c003_ref`.`celular` as 'celular', `c003_ref`.`email` as 'email', `c003_ref`.`cidade` as 'cidade', `c003_ref`.`uf` as 'uf', `c003_ref`.`regiao` as 'regiao', `c003_ref`.`quantidade` as 'quantidade', `c003_ref`.`unidade` as 'unidade', `c003_ref`.`uta` as 'uta', `c003_ref`.`valor` as 'valor', `c003_ref`.`obs` as 'obs', `c003_ref`.`situacao` as 'situacao' FROM `c003_ref` LEFT JOIN `c003` as c0031 ON `c0031`.`id`=`c003_ref`.`id_categoria` "
				],
			],
			'c003_ref_colaborar' => [
				'id_categoria' => [
					'parent-table' => 'c003',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Quero Colaborar <span class="hidden child-label-c003_ref_colaborar child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(0 => 'ID', 10 => 'Sua Colabora&#231;&#227;o:'),
					'display-field-names' => array(0 => 'id', 10 => 'colaboracao'),
					'sortable-fields' => array(0 => '`c003_ref_colaborar`.`id`', 1 => '`c0031`.`id`', 2 => '`c003_ref_colaborar`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => '`unidades1`.`unidade`', 14 => 15, 15 => 16, 16 => 17, 17 => 18),
					'records-per-page' => 10,
					'default-sort-by' => 11,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c003_ref_colaborar',
					'template-printable' => 'children-c003_ref_colaborar-printable',
					'query' => "SELECT `c003_ref_colaborar`.`id` as 'id', IF(    CHAR_LENGTH(`c0031`.`id`), CONCAT_WS('',   `c0031`.`id`), '') as 'id_categoria', DATE_FORMAT(`c003_ref_colaborar`.`data`, '%e/%c/%Y') as 'data', `c003_ref_colaborar`.`nome` as 'nome', `c003_ref_colaborar`.`cpf` as 'cpf', `c003_ref_colaborar`.`celular` as 'celular', `c003_ref_colaborar`.`email` as 'email', `c003_ref_colaborar`.`cidade` as 'cidade', `c003_ref_colaborar`.`uf` as 'uf', `c003_ref_colaborar`.`espaco` as 'espaco', `c003_ref_colaborar`.`colaboracao` as 'colaboracao', `c003_ref_colaborar`.`regiao` as 'regiao', `c003_ref_colaborar`.`quantidade` as 'quantidade', IF(    CHAR_LENGTH(`unidades1`.`unidade`), CONCAT_WS('',   `unidades1`.`unidade`), '') as 'unidade', `c003_ref_colaborar`.`valor` as 'valor', `c003_ref_colaborar`.`uta` as 'uta', `c003_ref_colaborar`.`obs` as 'obs', `c003_ref_colaborar`.`situacao` as 'situacao' FROM `c003_ref_colaborar` LEFT JOIN `c003` as c0031 ON `c0031`.`id`=`c003_ref_colaborar`.`id_categoria` LEFT JOIN `unidades` as unidades1 ON `unidades1`.`id`=`c003_ref_colaborar`.`unidade` "
				],
			],
			'c003_ref_inativas' => [
				'id_categoria' => [
					'parent-table' => 'c003',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias Gerais <span class="hidden child-label-c003_ref_inativas child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor', 15 => 'Situa&#231;&#227;o'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor', 15 => 'situacao'),
					'sortable-fields' => array(0 => '`c003_ref_inativas`.`id`', 1 => '`c0031`.`id`', 2 => '`c003_ref_inativas`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c003_ref_inativas',
					'template-printable' => 'children-c003_ref_inativas-printable',
					'query' => "SELECT `c003_ref_inativas`.`id` as 'id', IF(    CHAR_LENGTH(`c0031`.`id`), CONCAT_WS('',   `c0031`.`id`), '') as 'id_categoria', DATE_FORMAT(`c003_ref_inativas`.`data`, '%e/%c/%Y') as 'data', `c003_ref_inativas`.`nome` as 'nome', `c003_ref_inativas`.`cpf` as 'cpf', `c003_ref_inativas`.`celular` as 'celular', `c003_ref_inativas`.`email` as 'email', `c003_ref_inativas`.`cidade` as 'cidade', `c003_ref_inativas`.`uf` as 'uf', `c003_ref_inativas`.`regiao` as 'regiao', `c003_ref_inativas`.`quantidade` as 'quantidade', `c003_ref_inativas`.`unidade` as 'unidade', `c003_ref_inativas`.`uta` as 'uta', `c003_ref_inativas`.`valor` as 'valor', `c003_ref_inativas`.`obs` as 'obs', `c003_ref_inativas`.`situacao` as 'situacao' FROM `c003_ref_inativas` LEFT JOIN `c003` as c0031 ON `c0031`.`id`=`c003_ref_inativas`.`id_categoria` "
				],
			],
			'c004' => [
			],
			'c004_ref' => [
				'id_categoria' => [
					'parent-table' => 'c004',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias <span class="hidden child-label-c004_ref child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor'),
					'sortable-fields' => array(0 => '`c004_ref`.`id`', 1 => '`c0041`.`id`', 2 => '`c004_ref`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c004_ref',
					'template-printable' => 'children-c004_ref-printable',
					'query' => "SELECT `c004_ref`.`id` as 'id', IF(    CHAR_LENGTH(`c0041`.`id`), CONCAT_WS('',   `c0041`.`id`), '') as 'id_categoria', DATE_FORMAT(`c004_ref`.`data`, '%e/%c/%Y') as 'data', `c004_ref`.`nome` as 'nome', `c004_ref`.`cpf` as 'cpf', `c004_ref`.`celular` as 'celular', `c004_ref`.`email` as 'email', `c004_ref`.`cidade` as 'cidade', `c004_ref`.`uf` as 'uf', `c004_ref`.`regiao` as 'regiao', `c004_ref`.`quantidade` as 'quantidade', `c004_ref`.`unidade` as 'unidade', `c004_ref`.`uta` as 'uta', `c004_ref`.`valor` as 'valor', `c004_ref`.`obs` as 'obs', `c004_ref`.`situacao` as 'situacao' FROM `c004_ref` LEFT JOIN `c004` as c0041 ON `c0041`.`id`=`c004_ref`.`id_categoria` "
				],
			],
			'c004_ref_colaborar' => [
				'id_categoria' => [
					'parent-table' => 'c004',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Quero Colaborar <span class="hidden child-label-c004_ref_colaborar child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(0 => 'ID', 10 => 'Sua Colabora&#231;&#227;o:'),
					'display-field-names' => array(0 => 'id', 10 => 'colaboracao'),
					'sortable-fields' => array(0 => '`c004_ref_colaborar`.`id`', 1 => '`c0041`.`id`', 2 => '`c004_ref_colaborar`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => '`unidades1`.`unidade`', 14 => 15, 15 => 16, 16 => 17, 17 => 18),
					'records-per-page' => 10,
					'default-sort-by' => 11,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c004_ref_colaborar',
					'template-printable' => 'children-c004_ref_colaborar-printable',
					'query' => "SELECT `c004_ref_colaborar`.`id` as 'id', IF(    CHAR_LENGTH(`c0041`.`id`), CONCAT_WS('',   `c0041`.`id`), '') as 'id_categoria', DATE_FORMAT(`c004_ref_colaborar`.`data`, '%e/%c/%Y') as 'data', `c004_ref_colaborar`.`nome` as 'nome', `c004_ref_colaborar`.`cpf` as 'cpf', `c004_ref_colaborar`.`celular` as 'celular', `c004_ref_colaborar`.`email` as 'email', `c004_ref_colaborar`.`cidade` as 'cidade', `c004_ref_colaborar`.`uf` as 'uf', `c004_ref_colaborar`.`espaco` as 'espaco', `c004_ref_colaborar`.`colaboracao` as 'colaboracao', `c004_ref_colaborar`.`regiao` as 'regiao', `c004_ref_colaborar`.`quantidade` as 'quantidade', IF(    CHAR_LENGTH(`unidades1`.`unidade`), CONCAT_WS('',   `unidades1`.`unidade`), '') as 'unidade', `c004_ref_colaborar`.`valor` as 'valor', `c004_ref_colaborar`.`uta` as 'uta', `c004_ref_colaborar`.`obs` as 'obs', `c004_ref_colaborar`.`situacao` as 'situacao' FROM `c004_ref_colaborar` LEFT JOIN `c004` as c0041 ON `c0041`.`id`=`c004_ref_colaborar`.`id_categoria` LEFT JOIN `unidades` as unidades1 ON `unidades1`.`id`=`c004_ref_colaborar`.`unidade` "
				],
			],
			'c004_ref_inativas' => [
				'id_categoria' => [
					'parent-table' => 'c004',
					'parent-primary-key' => 'id',
					'child-primary-key' => 'id',
					'child-primary-key-index' => 0,
					'tab-label' => 'Refer&#234;ncias Gerais <span class="hidden child-label-c004_ref_inativas child-field-caption">(Id categoria)</span>',
					'auto-close' => false,
					'display-refresh' => true,
					'display-add-new' => true,
					'forced-where' => '',
					'display-fields' => array(9 => 'Regi&#227;o/UF', 10 => 'Qdade', 11 => 'Unidade', 12 => 'UTA', 13 => 'Valor', 15 => 'Situa&#231;&#227;o'),
					'display-field-names' => array(9 => 'regiao', 10 => 'quantidade', 11 => 'unidade', 12 => 'uta', 13 => 'valor', 15 => 'situacao'),
					'sortable-fields' => array(0 => '`c004_ref_inativas`.`id`', 1 => '`c0041`.`id`', 2 => '`c004_ref_inativas`.`data`', 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16),
					'records-per-page' => 10,
					'default-sort-by' => 9,
					'default-sort-direction' => 'asc',
					'open-detail-view-on-click' => true,
					'display-page-selector' => true,
					'show-page-progress' => true,
					'template' => 'children-c004_ref_inativas',
					'template-printable' => 'children-c004_ref_inativas-printable',
					'query' => "SELECT `c004_ref_inativas`.`id` as 'id', IF(    CHAR_LENGTH(`c0041`.`id`), CONCAT_WS('',   `c0041`.`id`), '') as 'id_categoria', DATE_FORMAT(`c004_ref_inativas`.`data`, '%e/%c/%Y') as 'data', `c004_ref_inativas`.`nome` as 'nome', `c004_ref_inativas`.`cpf` as 'cpf', `c004_ref_inativas`.`celular` as 'celular', `c004_ref_inativas`.`email` as 'email', `c004_ref_inativas`.`cidade` as 'cidade', `c004_ref_inativas`.`uf` as 'uf', `c004_ref_inativas`.`regiao` as 'regiao', `c004_ref_inativas`.`quantidade` as 'quantidade', `c004_ref_inativas`.`unidade` as 'unidade', `c004_ref_inativas`.`uta` as 'uta', `c004_ref_inativas`.`valor` as 'valor', `c004_ref_inativas`.`obs` as 'obs', `c004_ref_inativas`.`situacao` as 'situacao' FROM `c004_ref_inativas` LEFT JOIN `c004` as c0041 ON `c0041`.`id`=`c004_ref_inativas`.`id_categoria` "
				],
			],
		];

	/*************************************/
	/* End of configuration */


	$currDir = dirname(__FILE__);
	include_once("{$currDir}/lib.php");
	@header('Content-Type: text/html; charset=' . datalist_db_encoding);

	handle_maintenance();

	/**
	* dynamic configuration based on current user's permissions
	* $userPCConfig array is populated only with parent tables where the user has access to
	* at least one child table
	*/
	$userPCConfig = [];
	foreach($pcConfig as $pcChildTable => $ChildrenLookups) {
		$permChild = getTablePermissions($pcChildTable);
		if(!$permChild['view']) continue;

		foreach($ChildrenLookups as $ChildLookupField => $ChildConfig) {
			$permParent = getTablePermissions($ChildConfig['parent-table']);
			if(!$permParent['view']) continue;

			$userPCConfig[$pcChildTable][$ChildLookupField] = $pcConfig[$pcChildTable][$ChildLookupField];
			// show add new only if configured above AND the user has insert permission
			$userPCConfig[$pcChildTable][$ChildLookupField]['display-add-new'] = ($permChild['insert'] && $pcConfig[$pcChildTable][$ChildLookupField]['display-add-new']);
		}
	}

	/* Receive, UTF-convert, and validate parameters */
	$ParentTable = $_REQUEST['ParentTable']; // needed only with operation=show-children, will be validated in the processing code
	$ChildTable = $_REQUEST['ChildTable'];
		if(!in_array($ChildTable, array_keys($userPCConfig))) {
			/* defaults to first child table in config array if not provided */
			$ChildTable = current(array_keys($userPCConfig));
		}
		if(!$ChildTable) { die('<!-- No tables accessible to current user -->'); }
	$SelectedID = strip_tags($_REQUEST['SelectedID']);
	$ChildLookupField = $_REQUEST['ChildLookupField'];
		if(!in_array($ChildLookupField, array_keys($userPCConfig[$ChildTable]))) {
			/* defaults to first lookup in current child config array if not provided */
			$ChildLookupField = current(array_keys($userPCConfig[$ChildTable]));
		}
	$Page = intval($_REQUEST['Page']);
		if($Page < 1) {
			$Page = 1;
		}
	$SortBy = ($_REQUEST['SortBy'] != '' ? abs(intval($_REQUEST['SortBy'])) : false);
		if(!in_array($SortBy, array_keys($userPCConfig[$ChildTable][$ChildLookupField]['sortable-fields']), true)) {
			$SortBy = $userPCConfig[$ChildTable][$ChildLookupField]['default-sort-by'];
		}
	$SortDirection = strtolower($_REQUEST['SortDirection']);
		if(!in_array($SortDirection, array('asc', 'desc'))) {
			$SortDirection = $userPCConfig[$ChildTable][$ChildLookupField]['default-sort-direction'];
		}
	$Operation = strtolower($_REQUEST['Operation']);
		if(!in_array($Operation, array('get-records', 'show-children', 'get-records-printable', 'show-children-printable'))) {
			$Operation = 'get-records';
		}

	/* process requested operation */
	switch($Operation) {
		/************************************************/
		case 'show-children':
			/* populate HTML and JS content with children tabs */
			$tabLabels = $tabPanels = $tabLoaders = '';
			foreach($userPCConfig as $ChildTable => $childLookups) {
				foreach($childLookups as $ChildLookupField => $childConfig) {
					if($childConfig['parent-table'] == $ParentTable) {
						$TableIcon = ($childConfig['table-icon'] ? "<img src=\"{$childConfig['table-icon']}\" border=\"0\">" : '');
						$tabLabels .= sprintf('<li class="child-tab-label child-table-%s lookup-field-%s %s"><a href="#panel_%s-%s" id="tab_%s-%s" data-toggle="tab">%s%s</a></li>' . "\n\t\t\t\t\t", $ChildTable, $ChildLookupField, ($tabLabels ? '' : 'active'), $ChildTable, $ChildLookupField, $ChildTable, $ChildLookupField, $TableIcon, $childConfig['tab-label']);
						$tabPanels .= sprintf('<div id="panel_%s-%s" class="tab-pane%s"><i class="glyphicon glyphicon-refresh loop-rotate"></i> %s</div>' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, ($tabPanels ? '' : ' active'), $Translation['Loading ...']);
						$tabLoaders .= sprintf('post("parent-children.php", { ChildTable: "%s", ChildLookupField: "%s", SelectedID: "%s", Page: 1, SortBy: "", SortDirection: "", Operation: "get-records" }, "panel_%s-%s");' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, addslashes($SelectedID), $ChildTable, $ChildLookupField);
					}
				}
			}

			if(!$tabLabels) { die('<!-- no children of current parent table are accessible to current user -->'); }
			?>
			<div id="children-tabs">
				<ul class="nav nav-tabs">
					<?php echo $tabLabels; ?>
				</ul>
				<span id="pc-loading"></span>
			</div>
			<div class="tab-content"><?php echo $tabPanels; ?></div>

			<script>
				$j(function() {
					/* for iOS, avoid loading child tabs in modals */
					var iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
					var embedded = ($j('.navbar').length == 0);
					if(iOS && embedded) {
						$j('#children-tabs').next('.tab-content').remove();
						$j('#children-tabs').remove();
						return;
					}

					/* ajax loading of each tab's contents */
					<?php echo $tabLoaders; ?>

					/* show child field caption on tab title in case the same child table appears more than once */
					$j('.child-field-caption').each(function() {
						var clss = $j(this).attr('class').split(/\s+/).reduce(function(rc, cc) {
							return (cc.match(/child-label-.*/) ? '.' + cc : rc);
						}, '');

						// if class occurs more than once, remove .hidden
						if($j(clss).length > 1) $j(clss).removeClass('hidden');
					})
				})
			</script>
			<?php
			break;

		/************************************************/
		case 'show-children-printable':
			/* populate HTML and JS content with children buttons */
			$tabLabels = $tabPanels = $tabLoaders = '';
			foreach($userPCConfig as $ChildTable => $childLookups) {
				foreach($childLookups as $ChildLookupField => $childConfig) {
					if($childConfig['parent-table'] == $ParentTable) {
						$TableIcon = ($childConfig['table-icon'] ? "<img src=\"{$childConfig['table-icon']}\" border=\"0\">" : '');
						$tabLabels .= sprintf('<button type="button" class="btn btn-default child-tab-print-toggler" data-target="#panel_%s-%s" id="tab_%s-%s" data-toggle="collapse">%s %s</button>' . "\n\t\t\t\t\t", $ChildTable, $ChildLookupField, $ChildTable, $ChildLookupField, $TableIcon, $childConfig['tab-label']);
						$tabPanels .= sprintf('<div id="panel_%s-%s" class="collapse child-panel-print"><i class="glyphicon glyphicon-refresh loop-rotate"></i> %s</div>' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, $Translation['Loading ...']);
						$tabLoaders .= sprintf('post("parent-children.php", { ChildTable: "%s", ChildLookupField: "%s", SelectedID: "%s", Page: 1, SortBy: "", SortDirection: "", Operation: "get-records-printable" }, "panel_%s-%s");' . "\n\t\t\t\t", $ChildTable, $ChildLookupField, addslashes($SelectedID), $ChildTable, $ChildLookupField);
					}
				}
			}

			if(!$tabLabels) { die('<!-- no children of current parent table are accessible to current user -->'); }
			?>
			<div id="children-tabs" class="hidden-print">
				<div class="btn-group btn-group-lg">
					<?php echo $tabLabels; ?>
				</div>
				<span id="pc-loading"></span>
			</div>
			<div class="vspacer-lg"><?php echo $tabPanels; ?></div>

			<script>
				$j(function() {
					/* for iOS, avoid loading child tabs in modals */
					var iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
					var embedded = ($j('.navbar').length == 0);
					if(iOS && embedded) {
						$j('#children-tabs').next('.tab-content').remove();
						$j('#children-tabs').remove();
						return;
					}

					/* ajax loading of each tab's contents */
					<?php echo $tabLoaders; ?>
				})
			</script>
			<?php
			break;

		/************************************************/
		case 'get-records-printable':
		default: /* default is 'get-records' */

			if($Operation == 'get-records-printable') {
				$userPCConfig[$ChildTable][$ChildLookupField]['records-per-page'] = 2000;
			}

			// build the user permissions limiter
			$permissionsWhere = $permissionsJoin = '';
			$permChild = getTablePermissions($ChildTable);
			if($permChild['view'] == 1) { // user can view only his own records
				$permissionsWhere = "`$ChildTable`.`{$userPCConfig[$ChildTable][$ChildLookupField]['child-primary-key']}`=`membership_userrecords`.`pkValue` AND `membership_userrecords`.`tableName`='$ChildTable' AND LCASE(`membership_userrecords`.`memberID`)='" . getLoggedMemberID() . "'";
			} elseif($permChild['view'] == 2) { // user can view only his group's records
				$permissionsWhere = "`$ChildTable`.`{$userPCConfig[$ChildTable][$ChildLookupField]['child-primary-key']}`=`membership_userrecords`.`pkValue` AND `membership_userrecords`.`tableName`='$ChildTable' AND `membership_userrecords`.`groupID`='" . getLoggedGroupID() . "'";
			} elseif($permChild['view'] == 3) { // user can view all records
				/* that's the only case remaining ... no need to modify the query in this case */
			}
			$permissionsJoin = ($permissionsWhere ? ", `membership_userrecords`" : '');

			// build the count query
			$forcedWhere = $userPCConfig[$ChildTable][$ChildLookupField]['forced-where'];
			$query = 
				preg_replace('/^select .* from /i', 'SELECT count(1) FROM ', $userPCConfig[$ChildTable][$ChildLookupField]['query']) .
				$permissionsJoin . " WHERE " .
				($permissionsWhere ? "( $permissionsWhere )" : "( 1=1 )") . " AND " .
				($forcedWhere ? "( $forcedWhere )" : "( 2=2 )") . " AND " .
				"`$ChildTable`.`$ChildLookupField`='" . makeSafe($SelectedID) . "'";
			$totalMatches = sqlValue($query);

			// make sure $Page is <= max pages
			$maxPage = ceil($totalMatches / $userPCConfig[$ChildTable][$ChildLookupField]['records-per-page']);
			if($Page > $maxPage) { $Page = $maxPage; }

			// initiate output data array
			$data = array(
				'config' => $userPCConfig[$ChildTable][$ChildLookupField],
				'parameters' => array(
					'ChildTable' => $ChildTable,
					'ChildLookupField' => $ChildLookupField,
					'SelectedID' => $SelectedID,
					'Page' => $Page,
					'SortBy' => $SortBy,
					'SortDirection' => $SortDirection,
					'Operation' => $Operation
				),
				'records' => [],
				'totalMatches' => $totalMatches
			);

			// build the data query
			if($totalMatches) { // if we have at least one record, proceed with fetching data
				$startRecord = $userPCConfig[$ChildTable][$ChildLookupField]['records-per-page'] * ($Page - 1);
				$data['query'] = 
					$userPCConfig[$ChildTable][$ChildLookupField]['query'] .
					$permissionsJoin . " WHERE " .
					($permissionsWhere ? "( $permissionsWhere )" : "( 1=1 )") . " AND " .
					($forcedWhere ? "( $forcedWhere )" : "( 2=2 )") . " AND " .
					"`$ChildTable`.`$ChildLookupField`='" . makeSafe($SelectedID) . "'" . 
					($SortBy !== false && $userPCConfig[$ChildTable][$ChildLookupField]['sortable-fields'][$SortBy] ? " ORDER BY {$userPCConfig[$ChildTable][$ChildLookupField]['sortable-fields'][$SortBy]} $SortDirection" : '') .
					" LIMIT $startRecord, {$userPCConfig[$ChildTable][$ChildLookupField]['records-per-page']}";
				$res = sql($data['query'], $eo);
				while($row = db_fetch_row($res)) {
					$data['records'][$row[$userPCConfig[$ChildTable][$ChildLookupField]['child-primary-key-index']]] = $row;
				}
			} else { // if no matching records
				$startRecord = 0;
			}

			if($Operation == 'get-records-printable') {
				$response = loadView($userPCConfig[$ChildTable][$ChildLookupField]['template-printable'], $data);
			} else {
				$response = loadView($userPCConfig[$ChildTable][$ChildLookupField]['template'], $data);
			}

			// change name space to ensure uniqueness
			$uniqueNameSpace = $ChildTable.ucfirst($ChildLookupField).'GetRecords';
			echo str_replace("{$ChildTable}GetChildrenRecordsList", $uniqueNameSpace, $response);
		/************************************************/
	}
