Abrir form externo com dados de edicao Segundo a pagina : http://www.adianti.com.br/doc-framework-Presentation-Datagrid-DatagridCustom. Gostaria que a janela abrir os dados da tabela para edicao. codigo: ...
LG
Abrir form externo com dados de edicao  
Fechado
Segundo a pagina : www.adianti.com.br/doc-framework-Presentation-Datagrid-DatagridCusto

Gostaria que a janela abrir os dados da tabela para edicao.

codigo:

 
  1. <?php
  2. class Cliente extends TRecord
  3. {
  4. const TABLENAME = 'cliente';
  5. const PRIMARYKEY= 'id';
  6. const IDPOLICY = 'max'; // {max, serial}
  7. public function get_situacao_cli()
  8. {
  9. $nomes = array('A'=>'Ativo', 'B'=>'Bloqueado','I'=>'Inativo');
  10. return $nomes[$this->SITUACAO];
  11. }
  12. public function set_unidadefederacao(Cidade $object)
  13. {
  14. $this->unidadefederacao = $object;
  15. $this-> ID_CIDADE= $object->ID; //Seu erro está aqui!!! ***
  16. }
  17. public function get_unidadefederacao()
  18. {
  19. // loads the associated object
  20. if (empty($this->unidadefederacao))
  21. $this->unidadefederacao = new cidade($this->ID_CIDADE); // E aqui!!!***
  22. // returns the associated object
  23. return $this->unidadefederacao;
  24. }
  25. }
  26. ?>



 
  1. <?php
  2. /**
  3. * ClienteList Listing
  4. * @author <your name here>
  5. */
  6. class ClienteList extends TStandardList
  7. {
  8. protected $form; // registration form
  9. protected $datagrid; // listing
  10. protected $pageNavigation;
  11. protected $formgrid;
  12. protected $deleteButton;
  13. protected $transformCallback;
  14. /**
  15. * Page constructor
  16. */
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. parent::setDatabase('conexao'); // defines the database
  21. parent::setActiveRecord('Cliente'); // defines the active record
  22. parent::setDefaultOrder('ID_CLIENTE', 'asc'); // defines the default order
  23. // parent::setCriteria($criteria) // define a standard filter
  24. parent::addFilterField('CODIGO', '=', 'CODIGO'); // filterField, operator, formField
  25. parent::addFilterField('RAZAO_SOCIAL', 'like', 'RAZAO_SOCIAL'); // filterField, operator, formField
  26. parent::addFilterField('CPF', 'like', 'CPF'); // filterField, operator, formField
  27. parent::addFilterField('CNPJ', 'like', 'CNPJ'); // filterField, operator, formField
  28. parent::addFilterField('ID_CIDADE', 'like', 'ID_CIDADE'); // filterField, operator, formField
  29. parent::addFilterField('FONE', 'like', 'FONE'); // filterField, operator, formField
  30. parent::addFilterField('SITUACAO', 'like', 'SITUACAO'); // filterField, operator, formField
  31. // creates the form
  32. $this->form = new TQuickForm('form_search_Cliente');
  33. $this->form->class = 'tform'; // change CSS class
  34. $this->form->style = 'display: table;width:100%'; // change style
  35. $this->form->setFormTitle('Cliente');
  36. // $cliente = new Cliente(1);
  37. //echo $cliente->cidade->nome;
  38. // create the form fields
  39. $CODIGO = new TEntry('CODIGO');
  40. $RAZAO_SOCIAL = new TEntry('RAZAO_SOCIAL');
  41. $CPF = new TEntry('CPF');
  42. $CNPJ = new TEntry('CNPJ');
  43. $ID_CIDADE = new TEntry('ID_CIDADE');
  44. $FONE = new TEntry('FONE');
  45. $SITUACAO = new TEntry('SITUACAO');
  46. // add the fields
  47. $this->form->addQuickField('Código:', $CODIGO, 70 );
  48. $this->form->addQuickField('Razão Social:', $RAZAO_SOCIAL, 400 );
  49. $this->form->addQuickField('CPF/CNPJ:', $CPF, 200 );
  50. $this->form->addQuickField('Situação:', $SITUACAO, 200 );
  51. // keep the form filled during navigation with session data
  52. $this->form->setData( TSession::getValue('Cliente_filter_data') );
  53. // add the search form actions
  54. $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'fa:search');
  55. $this->form->addQuickAction(_t('New'), new TAction(array('ClienteForm', 'onEdit')), 'bs:plus-sign green');
  56. // creates a DataGrid
  57. $this->datagrid = new TDataGrid;
  58. $this->datagrid->disableDefaultClick(); // important!
  59. $this->datagrid->style = 'width: 100%';
  60. $this->datagrid->setHeight(320);
  61. // $this->datagrid->datatable = 'true';
  62. // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>');
  63. // creates the datagrid columns
  64. $column_CODIGO = new TDataGridColumn('CODIGO', 'Código', 'center');
  65. $column_RAZAO_SOCIAL = new TDataGridColumn('RAZAO_SOCIAL', 'Razão Social', 'left');
  66. $column_CPF = new TDataGridColumn('CPF', 'CPF/CNPJ', 'center');
  67. $column_CNPJ = new TDataGridColumn('CNPJ', 'CNPJ', 'center');
  68. $column_ID_CIDADE = new TDataGridColumn('unidadefederacao->DESCRICAO', 'Cidade', 'center');
  69. $column_FONE = new TDataGridColumn('FONE', 'Telefone', 'center');
  70. $column_SITUACAO = new TDataGridColumn('situacao_cli', 'Situação', 'center');
  71. //$COL= compara_cpfcnpj( $column_CPF, $column_CNPJ );
  72. // $column_CPFCNPJ = new TDataGridColumn( compara_cpfcnpj , 'CPF/CNPJ', 'center');
  73. $column_CPF->setTransformer(function($value,$object){
  74. if ($value)
  75. return $value;
  76. else
  77. return $object->CNPJ;
  78. });
  79. // add the columns to the DataGrid
  80. $this->datagrid->addColumn($column_CODIGO);
  81. $this->datagrid->addColumn($column_RAZAO_SOCIAL);
  82. $this->datagrid->addColumn($column_CPF);
  83. // $this->datagrid->addColumn($column_CNPJ);
  84. $this->datagrid->addColumn($column_ID_CIDADE);
  85. $this->datagrid->addColumn($column_FONE);
  86. $this->datagrid->addColumn($column_SITUACAO);
  87. // creates the datagrid column actions
  88. $order_CODIGO = new TAction(array($this, 'onReload'));
  89. $order_CODIGO->setParameter('order', 'CODIGO');
  90. $column_CODIGO->setAction($order_CODIGO);
  91. $order_RAZAO_SOCIAL = new TAction(array($this, 'onReload'));
  92. $order_RAZAO_SOCIAL->setParameter('order', 'RAZAO_SOCIAL');
  93. $column_RAZAO_SOCIAL->setAction($order_RAZAO_SOCIAL);
  94. // create EDIT action
  95. $action_edit = new TDataGridAction(array('ClienteForm', 'onEdit'));
  96. $action_edit->setUseButton(TRUE);
  97. $action_edit->setButtonClass('btn btn-default');
  98. $action_edit->setLabel(_t('Edit'));
  99. $action_edit->setImage('fa:pencil-square-o blue fa-lg');
  100. $action_edit->setField('ID_CLIENTE');
  101. $this->datagrid->addAction($action_edit);
  102. // create DELETE action
  103. $action_del = new TDataGridAction(array($this, 'onDelete'));
  104. $action_del->setUseButton(TRUE);
  105. $action_del->setButtonClass('btn btn-default');
  106. $action_del->setLabel(_t('Delete'));
  107. $action_del->setImage('fa:trash-o red fa-lg');
  108. $action_del->setField('ID_CLIENTE');
  109. $this->datagrid->addAction($action_del);
  110. // create the datagrid model
  111. $this->datagrid->createModel();
  112. // create the page navigation
  113. $this->pageNavigation = new TPageNavigation;
  114. $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
  115. $this->pageNavigation->setWidth($this->datagrid->getWidth());
  116. // vertical box container
  117. $container = new TVBox;
  118. $container->style = 'width: 100%';
  119. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  120. $container->add($this->form);
  121. $container->add($this->datagrid);
  122. $container->add($this->pageNavigation);
  123. parent::add($container);
  124. }
  125. }

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework Quero me inscrever agora!

Comentários (9)


NR

Não sei se entendi o que você precisa. Você quer abrir o formulário de edição em uma nova janela?
LG

Sim. Com os respectivos dados escolhidos por mim que estao na mesma tabela.
NR

Você já criou o control ClienteForm? Por padrão ele teria o método onEdit e já deveria funcionar a edição.
LG

gostaria que os dados abrissem numa janela estilo popup
NR

Poste o código da classe ClienteForm
LG

ClientForm.class.php:

 
  1. <?php
  2. /**
  3. * ClienteForm Master/Detail
  4. * @author <your name here>
  5. */
  6. class ClienteForm extends TPage
  7. {
  8. protected $form; // form
  9. protected $formFields;
  10. protected $detail_list;
  11. /**
  12. * Page constructor
  13. */
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. // creates the form
  18. $this->form = new TForm('form_Cliente');
  19. $this->form->class = 'tform'; // CSS class
  20. $this->form->style = 'max-width:700px'; // style
  21. parent::include_css('app/resources/custom-frame.css');
  22. $table_master = new TTable;
  23. $table_master->width = '100%';
  24. $table_master->addRowSet( new TLabel('Cliente'), '', '')->class = 'tformtitle';
  25. // add a table inside form
  26. $table_general = new TTable;
  27. $table_detail = new TTable;
  28. $table_general-> width = '100%';
  29. $table_detail-> width = '100%';
  30. $frame_general = new TFrame;
  31. $frame_general->setLegend('Cliente');
  32. $frame_general->style = 'background:whiteSmoke';
  33. $frame_general->add($table_general);
  34. $table_master->addRow()->addCell( $frame_general )->colspan=2;
  35. $row = $table_master->addRow();
  36. $row->addCell( $table_detail );
  37. $this->form->add($table_master);
  38. // master fields
  39. $ID_CLIENTE = new TEntry('ID_CLIENTE');
  40. $CODIGO = new TEntry('CODIGO');
  41. $RAZAO_SOCIAL = new TEntry('RAZAO_SOCIAL');
  42. $NOME_FANTASIA = new TEntry('NOME_FANTASIA');
  43. $ENDERECO = new TEntry('ENDERECO');
  44. $NUMERO = new TEntry('NUMERO');
  45. $COMPLEMENTO = new TEntry('COMPLEMENTO');
  46. $BAIRRO = new TEntry('BAIRRO');
  47. $ID_CIDADE = new TEntry('ID_CIDADE');
  48. $FONE = new TEntry('FONE');
  49. $FAX = new TEntry('FAX');
  50. $CELULAR = new TEntry('CELULAR');
  51. $CONTATO = new TEntry('CONTATO');
  52. $CNPJ = new TEntry('CNPJ');
  53. $INSCRICAO = new TEntry('INSCRICAO');
  54. $EMAIL = new TEntry('EMAIL');
  55. $CPF = new TEntry('CPF');
  56. $IDENTIDADE = new TEntry('IDENTIDADE');
  57. $TITULO_ELEITOR = new TEntry('TITULO_ELEITOR');
  58. $CART_PROFIS = new TEntry('CART_PROFIS');
  59. $CART_SERIE = new TEntry('CART_SERIE');
  60. $CART_ORGAO = new TEntry('CART_ORGAO');
  61. $FILIACAO_PAI = new TEntry('FILIACAO_PAI');
  62. $FILIACAO_MAE = new TEntry('FILIACAO_MAE');
  63. $DATA_NASCIMENTO = new TDate('DATA_NASCIMENTO');
  64. $DATA_CADASTRO = new TDate('DATA_CADASTRO');
  65. $DATA_ALTERACAO = new TDate('DATA_ALTERACAO');
  66. $DEPENDENTES = new TEntry('DEPENDENTES');
  67. $COMPROVANTE_ENDERECO = new TEntry('COMPROVANTE_ENDERECO');
  68. $DATA_ENDERECO = new TDate('DATA_ENDERECO');
  69. $TIPO_CASA = new TEntry('TIPO_CASA');
  70. $VALOR_ALUGUEL = new TEntry('VALOR_ALUGUEL');
  71. $VALOR_DESPESAS = new TEntry('VALOR_DESPESAS');
  72. $ABERTURA_CADASTRO = new TEntry('ABERTURA_CADASTRO');
  73. $NATURALIDADE = new TEntry('NATURALIDADE');
  74. $EMPREGO_ANTERIOR = new TEntry('EMPREGO_ANTERIOR');
  75. $TEMPO_SERVICO = new TEntry('TEMPO_SERVICO');
  76. $EMPRESA_NOME = new TEntry('EMPRESA_NOME');
  77. $EMPRESA_ID_CIDADE = new TEntry('EMPRESA_ID_CIDADE');
  78. $EMPRESA_FUNCAO = new TEntry('EMPRESA_FUNCAO');
  79. $EMPRESA_ADMISSAO = new TDate('EMPRESA_ADMISSAO');
  80. $EMPRESA_FONE = new TEntry('EMPRESA_FONE');
  81. $RENDA_CLIENTE = new TEntry('RENDA_CLIENTE');
  82. $RENDA_CONJUGE = new TEntry('RENDA_CONJUGE');
  83. $LIMITE_CREDITO = new TEntry('LIMITE_CREDITO');
  84. $CONCEITO = new TEntry('CONCEITO');
  85. $ESTADO_CIVIL = new TEntry('ESTADO_CIVIL');
  86. $SEXO = new TEntry('SEXO');
  87. $SITUACAO = new TEntry('SITUACAO');
  88. $CONJUGE_NOME = new TEntry('CONJUGE_NOME');
  89. $CONJUGE_NASCIMENTO = new TDate('CONJUGE_NASCIMENTO');
  90. $CONJUGE_TRABALHO = new TEntry('CONJUGE_TRABALHO');
  91. $CONJUGE_ADMISSAO = new TDate('CONJUGE_ADMISSAO');
  92. $CONJUGE_FONE = new TEntry('CONJUGE_FONE');
  93. $ENTREGA_NOME = new TEntry('ENTREGA_NOME');
  94. $ENTREGA_ENDERECO = new TEntry('ENTREGA_ENDERECO');
  95. $ENTREGA_BAIRRO = new TEntry('ENTREGA_BAIRRO');
  96. $ENTREGA_ID_CIDADE = new TEntry('ENTREGA_ID_CIDADE');
  97. $ENTREGA_FONE = new TEntry('ENTREGA_FONE');
  98. $NOME_CONHECIDO1 = new TEntry('NOME_CONHECIDO1');
  99. $NOME_CONHECIDO2 = new TEntry('NOME_CONHECIDO2');
  100. $REF_BANCO1 = new TEntry('REF_BANCO1');
  101. $REF_BANCO2 = new TEntry('REF_BANCO2');
  102. $REF_BANCO3 = new TEntry('REF_BANCO3');
  103. $REF_BANCO1_CONTA = new TEntry('REF_BANCO1_CONTA');
  104. $REF_BANCO2_CONTA = new TEntry('REF_BANCO2_CONTA');
  105. $REF_BANCO3_CONTA = new TEntry('REF_BANCO3_CONTA');
  106. $REF_COM_NOME1 = new TEntry('REF_COM_NOME1');
  107. $REF_COM_NOME2 = new TEntry('REF_COM_NOME2');
  108. $REF_COM_NOME3 = new TEntry('REF_COM_NOME3');
  109. $REF_COM_FONE1 = new TEntry('REF_COM_FONE1');
  110. $REF_COM_FONE2 = new TEntry('REF_COM_FONE2');
  111. $REF_COM_FONE3 = new TEntry('REF_COM_FONE3');
  112. $REF_COM_VALOR1 = new TEntry('REF_COM_VALOR1');
  113. $REF_COM_VALOR2 = new TEntry('REF_COM_VALOR2');
  114. $REF_COM_VALOR3 = new TEntry('REF_COM_VALOR3');
  115. $REF_COM_PONTUALIDADE1 = new TEntry('REF_COM_PONTUALIDADE1');
  116. $REF_COM_PONTUALIDADE2 = new TEntry('REF_COM_PONTUALIDADE2');
  117. $REF_COM_PONTUALIDADE3 = new TEntry('REF_COM_PONTUALIDADE3');
  118. $INDICADOR_1 = new TEntry('INDICADOR_1');
  119. $INDICADOR_2 = new TEntry('INDICADOR_2');
  120. $INDICADOR_3 = new TEntry('INDICADOR_3');
  121. $INDICADOR_4 = new TEntry('INDICADOR_4');
  122. $INDICADOR_5 = new TEntry('INDICADOR_5');
  123. $INDICADOR_6 = new TEntry('INDICADOR_6');
  124. $INDICADOR_7 = new TEntry('INDICADOR_7');
  125. $INDICADOR_8 = new TEntry('INDICADOR_8');
  126. $INDICADOR_9 = new TEntry('INDICADOR_9');
  127. $INDICADOR_10 = new TEntry('INDICADOR_10');
  128. $SPC_DATA_ENVIO = new TDate('SPC_DATA_ENVIO');
  129. $SPC_VALOR_COMPRA = new TEntry('SPC_VALOR_COMPRA');
  130. $SPC_DATA_BAIXA = new TDate('SPC_DATA_BAIXA');
  131. $SERASA_DATA_ENVIO = new TDate('SERASA_DATA_ENVIO');
  132. $SERASA_VALOR_COMPRA = new TEntry('SERASA_VALOR_COMPRA');
  133. $SERASA_DATA_BAIXA = new TDate('SERASA_DATA_BAIXA');
  134. $OUTRA_DATA_ENVIO = new TDate('OUTRA_DATA_ENVIO');
  135. $OUTRA_VALOR_COMPRA = new TEntry('OUTRA_VALOR_COMPRA');
  136. $OUTRA_DATA_BAIXA = new TDate('OUTRA_DATA_BAIXA');
  137. $OBSERVACOES = new TEntry('OBSERVACOES');
  138. $TABELA_PRECO = new TEntry('TABELA_PRECO');
  139. $TIPO_PAGAMENTO = new TEntry('TIPO_PAGAMENTO');
  140. $FORMA_PAGAMENTO = new TEntry('FORMA_PAGAMENTO');
  141. $ALTERAR_PRECO = new TEntry('ALTERAR_PRECO');
  142. $ID_CLIENTE_COBRANCA = new TEntry('ID_CLIENTE_COBRANCA');
  143. $IND_TIPO_PAGAMENTO = new TEntry('IND_TIPO_PAGAMENTO');
  144. $RECEBE_COBRANCA = new TEntry('RECEBE_COBRANCA');
  145. $COBRAR_TAXA_CARTORIO = new TEntry('COBRAR_TAXA_CARTORIO');
  146. $COBRAR_TAXA_BANCARIA = new TEntry('COBRAR_TAXA_BANCARIA');
  147. $ID_USUARIO = new TEntry('ID_USUARIO');
  148. $DATA_HORA_ALT = new TEntry('DATA_HORA_ALT');
  149. $ID_VENDEDOR = new TEntry('ID_VENDEDOR');
  150. $ID_TIPO_ATIVIDADE = new TEntry('ID_TIPO_ATIVIDADE');
  151. $ID_PRACA = new TEntry('ID_PRACA');
  152. $ID_EMPRESA = new TEntry('ID_EMPRESA');
  153. $CONCORRENCIA = new TEntry('CONCORRENCIA');
  154. $EMAIL_NFE = new TEntry('EMAIL_NFE');
  155. $ID_FOTO = new TEntry('ID_FOTO');
  156. $UNIDADE_VENDA = new TEntry('UNIDADE_VENDA');
  157. $ID_EMPRESA_NF = new TEntry('ID_EMPRESA_NF');
  158. $EMITE_NOTA = new TEntry('EMITE_NOTA');
  159. $CEP = new TEntry('CEP');
  160. $ID_TRANSPORTADOR = new TEntry('ID_TRANSPORTADOR');
  161. $SALDO_CREDITO = new TEntry('SALDO_CREDITO');
  162. $CODIGO_CONVENIO = new TEntry('CODIGO_CONVENIO');
  163. $ID_CAIXA = new TEntry('ID_CAIXA');
  164. $HISTORICO_VENDAS = new TText('HISTORICO_VENDAS');
  165. $HISTORICO_ITENS = new TText('HISTORICO_ITENS');
  166. $DESCONTO = new TEntry('DESCONTO');
  167. $ID_BANCO = new TEntry('ID_BANCO');
  168. $EMAIL_BOLETO = new TEntry('EMAIL_BOLETO');
  169. $ID_REDE = new TEntry('ID_REDE');
  170. $DIA_VENCTO = new TEntry('DIA_VENCTO');
  171. $DIA_VIRADA = new TEntry('DIA_VIRADA');
  172. $ID_FORMA = new TEntry('ID_FORMA');
  173. $MATRICULA = new TEntry('MATRICULA');
  174. $AUTORIZADO1 = new TEntry('AUTORIZADO1');
  175. $AUTORIZADO2 = new TEntry('AUTORIZADO2');
  176. $AUTORIZADO3 = new TEntry('AUTORIZADO3');
  177. $AUTORIZADO4 = new TEntry('AUTORIZADO4');
  178. $AUTORIZADO5 = new TEntry('AUTORIZADO5');
  179. $AUTORIZADO6 = new TEntry('AUTORIZADO6');
  180. $TRANSMITIDO = new TEntry('TRANSMITIDO');
  181. $OBS_SPC1 = new TEntry('OBS_SPC1');
  182. $OBS_SPC2 = new TEntry('OBS_SPC2');
  183. $OBS_SPC3 = new TEntry('OBS_SPC3');
  184. $ROUPA_CALCA = new TEntry('ROUPA_CALCA');
  185. $ROUPA_CAMISA = new TEntry('ROUPA_CAMISA');
  186. $ROUPA_SAPATO = new TEntry('ROUPA_SAPATO');
  187. $ROUPA_BLAZER = new TEntry('ROUPA_BLAZER');
  188. $DIRETORIO = new TText('DIRETORIO');
  189. $DESC_FINANCEIRO = new TEntry('DESC_FINANCEIRO');
  190. $IND_TPAGTO = new TEntry('IND_TPAGTO');
  191. $DESPESAS_CLIENTE = new TEntry('DESPESAS_CLIENTE');
  192. $NOME_USER_LIBEROU = new TEntry('NOME_USER_LIBEROU');
  193. $ID_USER_LIBEROU = new TEntry('ID_USER_LIBEROU');
  194. $MOTIVO_LIBERACAO = new TEntry('MOTIVO_LIBERACAO');
  195. $LIBERA_CREDIARIO = new TEntry('LIBERA_CREDIARIO');
  196. $DATA_HORA_LIBERACAO = new TDate('DATA_HORA_LIBERACAO');
  197. $QUAL_PRECO = new TEntry('QUAL_PRECO');
  198. $CARENCIA = new TEntry('CARENCIA');
  199. $ID_FOTO_A1 = new TEntry('ID_FOTO_A1');
  200. $ID_FOTO_A2 = new TEntry('ID_FOTO_A2');
  201. $ID_FOTO_A3 = new TEntry('ID_FOTO_A3');
  202. $ID_FOTO_A4 = new TEntry('ID_FOTO_A4');
  203. $ID_FOTO_A5 = new TEntry('ID_FOTO_A5');
  204. $ID_FOTO_A6 = new TEntry('ID_FOTO_A6');
  205. $VALOR_AUTORIZADO1 = new TEntry('VALOR_AUTORIZADO1');
  206. $VALOR_AUTORIZADO2 = new TEntry('VALOR_AUTORIZADO2');
  207. $VALOR_AUTORIZADO3 = new TEntry('VALOR_AUTORIZADO3');
  208. $VALOR_AUTORIZADO4 = new TEntry('VALOR_AUTORIZADO4');
  209. $VALOR_AUTORIZADO5 = new TEntry('VALOR_AUTORIZADO5');
  210. $VALOR_AUTORIZADO6 = new TEntry('VALOR_AUTORIZADO6');
  211. $DI_AUTORIZADO1 = new TDate('DI_AUTORIZADO1');
  212. $DI_AUTORIZADO2 = new TDate('DI_AUTORIZADO2');
  213. $DI_AUTORIZADO3 = new TDate('DI_AUTORIZADO3');
  214. $DI_AUTORIZADO4 = new TDate('DI_AUTORIZADO4');
  215. $DI_AUTORIZADO5 = new TDate('DI_AUTORIZADO5');
  216. $DI_AUTORIZADO6 = new TDate('DI_AUTORIZADO6');
  217. $DF_AUTORIZADO1 = new TDate('DF_AUTORIZADO1');
  218. $DF_AUTORIZADO2 = new TDate('DF_AUTORIZADO2');
  219. $DF_AUTORIZADO3 = new TDate('DF_AUTORIZADO3');
  220. $DF_AUTORIZADO4 = new TDate('DF_AUTORIZADO4');
  221. $DF_AUTORIZADO5 = new TDate('DF_AUTORIZADO5');
  222. $DF_AUTORIZADO6 = new TDate('DF_AUTORIZADO6');
  223. $DOC_AUTORIZADO1 = new TEntry('DOC_AUTORIZADO1');
  224. $DOC_AUTORIZADO2 = new TEntry('DOC_AUTORIZADO2');
  225. $DOC_AUTORIZADO3 = new TEntry('DOC_AUTORIZADO3');
  226. $DOC_AUTORIZADO4 = new TEntry('DOC_AUTORIZADO4');
  227. $DOC_AUTORIZADO5 = new TEntry('DOC_AUTORIZADO5');
  228. $DOC_AUTORIZADO6 = new TEntry('DOC_AUTORIZADO6');
  229. $ENDERECO_TRABALHO = new TEntry('ENDERECO_TRABALHO');
  230. $CONTATO_FINANCEIRO = new TEntry('CONTATO_FINANCEIRO');
  231. $FONE_FINANCEIRO = new TEntry('FONE_FINANCEIRO');
  232. $RG_EXPEDICAO = new TDate('RG_EXPEDICAO');
  233. $RG_ORGAO = new TEntry('RG_ORGAO');
  234. $ESCOLARIDADE = new TEntry('ESCOLARIDADE');
  235. $DESC_APOSENTADORIA = new TEntry('DESC_APOSENTADORIA');
  236. $DESC_PENSAO = new TEntry('DESC_PENSAO');
  237. $NRO_APOSENTADORIA = new TEntry('NRO_APOSENTADORIA');
  238. $NRO_PENSAO = new TEntry('NRO_PENSAO');
  239. $NIT = new TEntry('NIT');
  240. $ID_SITUACAO = new TEntry('ID_SITUACAO');
  241. $ID_CONJUGE = new TEntry('ID_CONJUGE');
  242. $ENDERECO_CORRESPONDENCIA = new TEntry('ENDERECO_CORRESPONDENCIA');
  243. $EMPRESA_CNPJ = new TEntry('EMPRESA_CNPJ');
  244. $EMPRESA_VINCULO = new TEntry('EMPRESA_VINCULO');
  245. $EMPRESA_DEPARTAMENTO = new TEntry('EMPRESA_DEPARTAMENTO');
  246. $EMPRESA_TIPO_SALARIO = new TEntry('EMPRESA_TIPO_SALARIO');
  247. $EMPRESA_ORIGEM = new TEntry('EMPRESA_ORIGEM');
  248. $EMPRESA_OUTRAS_RENDAS = new TEntry('EMPRESA_OUTRAS_RENDAS');
  249. $CONJUGE_TELEFONE = new TEntry('CONJUGE_TELEFONE');
  250. $CONJUGE_TEMPO_TRABALHO = new TEntry('CONJUGE_TEMPO_TRABALHO');
  251. $CONJUGE_SALARIO = new TEntry('CONJUGE_SALARIO');
  252. $CONJUGE_END_TRABALHO = new TEntry('CONJUGE_END_TRABALHO');
  253. $CONJUGE_CID_TRABALHO = new TEntry('CONJUGE_CID_TRABALHO');
  254. $CONJUGE_CEP_TRABALHO = new TEntry('CONJUGE_CEP_TRABALHO');
  255. $CONJUGE_DEP_TRABALHO = new TEntry('CONJUGE_DEP_TRABALHO');
  256. $CONJUGE_DATA_ADM = new TDate('CONJUGE_DATA_ADM');
  257. $CONJUGE_RENDA = new TEntry('CONJUGE_RENDA');
  258. $CONJUGE_VINCULO = new TEntry('CONJUGE_VINCULO');
  259. $CONJUGE_TIPO_EMPREGO = new TEntry('CONJUGE_TIPO_EMPREGO');
  260. $CONJUGE_ORIGEM_RENDA = new TEntry('CONJUGE_ORIGEM_RENDA');
  261. $CONJUGE_OUTRAS_RENDAS = new TEntry('CONJUGE_OUTRAS_RENDAS');
  262. $EMPRESA_CEP = new TEntry('EMPRESA_CEP');
  263. $CONJUGE_CNPJ_TRABALHO = new TEntry('CONJUGE_CNPJ_TRABALHO');
  264. $CONJUGE_PROFISSAO = new TEntry('CONJUGE_PROFISSAO');
  265. $LIMITE_DATA_HORA_ALT = new TDate('LIMITE_DATA_HORA_ALT');
  266. $LIMITE_USUARIO_ALT = new TEntry('LIMITE_USUARIO_ALT');
  267. $UNIDADES = new TEntry('UNIDADES');
  268. $CONJUGE_CPF = new TEntry('CONJUGE_CPF');
  269. $CONJUGE_RG = new TEntry('CONJUGE_RG');
  270. $CASAMENTO_DATA = new TDate('CASAMENTO_DATA');
  271. $CASAMENTO_TIPO = new TEntry('CASAMENTO_TIPO');
  272. $FRETE_PAGAR = new TEntry('FRETE_PAGAR');
  273. $ID_MEUS_PEDIDOS = new TEntry('ID_MEUS_PEDIDOS');
  274. $DATA_ALT_MEUS_PEDIDOS = new TDate('DATA_ALT_MEUS_PEDIDOS');
  275. $ERRO_MEUS_PEDIDOS = new TEntry('ERRO_MEUS_PEDIDOS');
  276. if (!empty($ID_CLIENTE))
  277. {
  278. $ID_CLIENTE->setEditable(FALSE);
  279. }
  280. // detail fields
  281. $detail_ID_CIDADE = new THidden('detail_ID_CIDADE');
  282. $detail_DESCRICAO = new TEntry('detail_DESCRICAO');
  283. $detail_UF = new TEntry('detail_UF');
  284. $detail_COD_IBGE = new TEntry('detail_COD_IBGE');
  285. $detail_CEP = new TEntry('detail_CEP');
  286. $detail_ID_USUARIO = new TEntry('detail_ID_USUARIO');
  287. $detail_DATA_HORA_ALT = new TEntry('detail_DATA_HORA_ALT');
  288. $detail_CONCORRENCIA = new TEntry('detail_CONCORRENCIA');
  289. $detail_ID_PAIS = new TEntry('detail_ID_PAIS');
  290. /** samples
  291. $this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2)); // side by side fields
  292. $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
  293. $fieldX->setSize( 100, 40 ); // set size
  294. **/
  295. // master
  296. $table_general->addRowSet( new TLabel('Id Cliente'), $ID_CLIENTE );
  297. $table_general->addRowSet( new TLabel('Codigo'), $CODIGO );
  298. $table_general->addRowSet( new TLabel('Razao Social'), $RAZAO_SOCIAL );
  299. $table_general->addRowSet( new TLabel('Nome Fantasia'), $NOME_FANTASIA );
  300. $table_general->addRowSet( new TLabel('Endereco'), $ENDERECO );
  301. $table_general->addRowSet( new TLabel('Numero'), $NUMERO );
  302. $table_general->addRowSet( new TLabel('Complemento'), $COMPLEMENTO );
  303. $table_general->addRowSet( new TLabel('Bairro'), $BAIRRO );
  304. $table_general->addRowSet( new TLabel('Id Cidade'), $ID_CIDADE );
  305. $table_general->addRowSet( new TLabel('Fone'), $FONE );
  306. $table_general->addRowSet( new TLabel('Fax'), $FAX );
  307. $table_general->addRowSet( new TLabel('Celular'), $CELULAR );
  308. $table_general->addRowSet( new TLabel('Contato'), $CONTATO );
  309. $table_general->addRowSet( new TLabel('Cnpj'), $CNPJ );
  310. $table_general->addRowSet( new TLabel('Inscricao'), $INSCRICAO );
  311. $table_general->addRowSet( new TLabel('Email'), $EMAIL );
  312. $table_general->addRowSet( new TLabel('Cpf'), $CPF );
  313. $table_general->addRowSet( new TLabel('Identidade'), $IDENTIDADE );
  314. $table_general->addRowSet( new TLabel('Titulo Eleitor'), $TITULO_ELEITOR );
  315. $table_general->addRowSet( new TLabel('Cart Profis'), $CART_PROFIS );
  316. $table_general->addRowSet( new TLabel('Cart Serie'), $CART_SERIE );
  317. $table_general->addRowSet( new TLabel('Cart Orgao'), $CART_ORGAO );
  318. $table_general->addRowSet( new TLabel('Filiacao Pai'), $FILIACAO_PAI );
  319. $table_general->addRowSet( new TLabel('Filiacao Mae'), $FILIACAO_MAE );
  320. $table_general->addRowSet( new TLabel('Data Nascimento'), $DATA_NASCIMENTO );
  321. $table_general->addRowSet( new TLabel('Data Cadastro'), $DATA_CADASTRO );
  322. $table_general->addRowSet( new TLabel('Data Alteracao'), $DATA_ALTERACAO );
  323. $table_general->addRowSet( new TLabel('Dependentes'), $DEPENDENTES );
  324. $table_general->addRowSet( new TLabel('Comprovante Endereco'), $COMPROVANTE_ENDERECO );
  325. $table_general->addRowSet( new TLabel('Data Endereco'), $DATA_ENDERECO );
  326. $table_general->addRowSet( new TLabel('Tipo Casa'), $TIPO_CASA );
  327. $table_general->addRowSet( new TLabel('Valor Aluguel'), $VALOR_ALUGUEL );
  328. $table_general->addRowSet( new TLabel('Valor Despesas'), $VALOR_DESPESAS );
  329. $table_general->addRowSet( new TLabel('Abertura Cadastro'), $ABERTURA_CADASTRO );
  330. $table_general->addRowSet( new TLabel('Naturalidade'), $NATURALIDADE );
  331. $table_general->addRowSet( new TLabel('Emprego Anterior'), $EMPREGO_ANTERIOR );
  332. $table_general->addRowSet( new TLabel('Tempo Servico'), $TEMPO_SERVICO );
  333. $table_general->addRowSet( new TLabel('Empresa Nome'), $EMPRESA_NOME );
  334. $table_general->addRowSet( new TLabel('Empresa Id Cidade'), $EMPRESA_ID_CIDADE );
  335. $table_general->addRowSet( new TLabel('Empresa Funcao'), $EMPRESA_FUNCAO );
  336. $table_general->addRowSet( new TLabel('Empresa Admissao'), $EMPRESA_ADMISSAO );
  337. $table_general->addRowSet( new TLabel('Empresa Fone'), $EMPRESA_FONE );
  338. $table_general->addRowSet( new TLabel('Renda Cliente'), $RENDA_CLIENTE );
  339. $table_general->addRowSet( new TLabel('Renda Conjuge'), $RENDA_CONJUGE );
  340. $table_general->addRowSet( new TLabel('Limite Credito'), $LIMITE_CREDITO );
  341. $table_general->addRowSet( new TLabel('Conceito'), $CONCEITO );
  342. $table_general->addRowSet( new TLabel('Estado Civil'), $ESTADO_CIVIL );
  343. $table_general->addRowSet( new TLabel('Sexo'), $SEXO );
  344. $table_general->addRowSet( new TLabel('Situacao'), $SITUACAO );
  345. $table_general->addRowSet( new TLabel('Conjuge Nome'), $CONJUGE_NOME );
  346. $table_general->addRowSet( new TLabel('Conjuge Nascimento'), $CONJUGE_NASCIMENTO );
  347. $table_general->addRowSet( new TLabel('Conjuge Trabalho'), $CONJUGE_TRABALHO );
  348. $table_general->addRowSet( new TLabel('Conjuge Admissao'), $CONJUGE_ADMISSAO );
  349. $table_general->addRowSet( new TLabel('Conjuge Fone'), $CONJUGE_FONE );
  350. $table_general->addRowSet( new TLabel('Entrega Nome'), $ENTREGA_NOME );
  351. $table_general->addRowSet( new TLabel('Entrega Endereco'), $ENTREGA_ENDERECO );
  352. $table_general->addRowSet( new TLabel('Entrega Bairro'), $ENTREGA_BAIRRO );
  353. $table_general->addRowSet( new TLabel('Entrega Id Cidade'), $ENTREGA_ID_CIDADE );
  354. $table_general->addRowSet( new TLabel('Entrega Fone'), $ENTREGA_FONE );
  355. $table_general->addRowSet( new TLabel('Nome Conhecido1'), $NOME_CONHECIDO1 );
  356. $table_general->addRowSet( new TLabel('Nome Conhecido2'), $NOME_CONHECIDO2 );
  357. $table_general->addRowSet( new TLabel('Ref Banco1'), $REF_BANCO1 );
  358. $table_general->addRowSet( new TLabel('Ref Banco2'), $REF_BANCO2 );
  359. $table_general->addRowSet( new TLabel('Ref Banco3'), $REF_BANCO3 );
  360. $table_general->addRowSet( new TLabel('Ref Banco1 Conta'), $REF_BANCO1_CONTA );
  361. $table_general->addRowSet( new TLabel('Ref Banco2 Conta'), $REF_BANCO2_CONTA );
  362. $table_general->addRowSet( new TLabel('Ref Banco3 Conta'), $REF_BANCO3_CONTA );
  363. $table_general->addRowSet( new TLabel('Ref Com Nome1'), $REF_COM_NOME1 );
  364. $table_general->addRowSet( new TLabel('Ref Com Nome2'), $REF_COM_NOME2 );
  365. $table_general->addRowSet( new TLabel('Ref Com Nome3'), $REF_COM_NOME3 );
  366. $table_general->addRowSet( new TLabel('Ref Com Fone1'), $REF_COM_FONE1 );
  367. $table_general->addRowSet( new TLabel('Ref Com Fone2'), $REF_COM_FONE2 );
  368. $table_general->addRowSet( new TLabel('Ref Com Fone3'), $REF_COM_FONE3 );
  369. $table_general->addRowSet( new TLabel('Ref Com Valor1'), $REF_COM_VALOR1 );
  370. $table_general->addRowSet( new TLabel('Ref Com Valor2'), $REF_COM_VALOR2 );
  371. $table_general->addRowSet( new TLabel('Ref Com Valor3'), $REF_COM_VALOR3 );
  372. $table_general->addRowSet( new TLabel('Ref Com Pontualidade1'), $REF_COM_PONTUALIDADE1 );
  373. $table_general->addRowSet( new TLabel('Ref Com Pontualidade2'), $REF_COM_PONTUALIDADE2 );
  374. $table_general->addRowSet( new TLabel('Ref Com Pontualidade3'), $REF_COM_PONTUALIDADE3 );
  375. $table_general->addRowSet( new TLabel('Indicador 1'), $INDICADOR_1 );
  376. $table_general->addRowSet( new TLabel('Indicador 2'), $INDICADOR_2 );
  377. $table_general->addRowSet( new TLabel('Indicador 3'), $INDICADOR_3 );
  378. $table_general->addRowSet( new TLabel('Indicador 4'), $INDICADOR_4 );
  379. $table_general->addRowSet( new TLabel('Indicador 5'), $INDICADOR_5 );
  380. $table_general->addRowSet( new TLabel('Indicador 6'), $INDICADOR_6 );
  381. $table_general->addRowSet( new TLabel('Indicador 7'), $INDICADOR_7 );
  382. $table_general->addRowSet( new TLabel('Indicador 8'), $INDICADOR_8 );
  383. $table_general->addRowSet( new TLabel('Indicador 9'), $INDICADOR_9 );
  384. $table_general->addRowSet( new TLabel('Indicador 10'), $INDICADOR_10 );
  385. $table_general->addRowSet( new TLabel('Spc Data Envio'), $SPC_DATA_ENVIO );
  386. $table_general->addRowSet( new TLabel('Spc Valor Compra'), $SPC_VALOR_COMPRA );
  387. $table_general->addRowSet( new TLabel('Spc Data Baixa'), $SPC_DATA_BAIXA );
  388. $table_general->addRowSet( new TLabel('Serasa Data Envio'), $SERASA_DATA_ENVIO );
  389. $table_general->addRowSet( new TLabel('Serasa Valor Compra'), $SERASA_VALOR_COMPRA );
  390. $table_general->addRowSet( new TLabel('Serasa Data Baixa'), $SERASA_DATA_BAIXA );
  391. $table_general->addRowSet( new TLabel('Outra Data Envio'), $OUTRA_DATA_ENVIO );
  392. $table_general->addRowSet( new TLabel('Outra Valor Compra'), $OUTRA_VALOR_COMPRA );
  393. $table_general->addRowSet( new TLabel('Outra Data Baixa'), $OUTRA_DATA_BAIXA );
  394. $table_general->addRowSet( new TLabel('Observacoes'), $OBSERVACOES );
  395. $table_general->addRowSet( new TLabel('Tabela Preco'), $TABELA_PRECO );
  396. $table_general->addRowSet( new TLabel('Tipo Pagamento'), $TIPO_PAGAMENTO );
  397. $table_general->addRowSet( new TLabel('Forma Pagamento'), $FORMA_PAGAMENTO );
  398. $table_general->addRowSet( new TLabel('Alterar Preco'), $ALTERAR_PRECO );
  399. $table_general->addRowSet( new TLabel('Id Cliente Cobranca'), $ID_CLIENTE_COBRANCA );
  400. $table_general->addRowSet( new TLabel('Ind Tipo Pagamento'), $IND_TIPO_PAGAMENTO );
  401. $table_general->addRowSet( new TLabel('Recebe Cobranca'), $RECEBE_COBRANCA );
  402. $table_general->addRowSet( new TLabel('Cobrar Taxa Cartorio'), $COBRAR_TAXA_CARTORIO );
  403. $table_general->addRowSet( new TLabel('Cobrar Taxa Bancaria'), $COBRAR_TAXA_BANCARIA );
  404. $table_general->addRowSet( new TLabel('Id Usuario'), $ID_USUARIO );
  405. $table_general->addRowSet( new TLabel('Data Hora Alt'), $DATA_HORA_ALT );
  406. $table_general->addRowSet( new TLabel('Id Vendedor'), $ID_VENDEDOR );
  407. $table_general->addRowSet( new TLabel('Id Tipo Atividade'), $ID_TIPO_ATIVIDADE );
  408. $table_general->addRowSet( new TLabel('Id Praca'), $ID_PRACA );
  409. $table_general->addRowSet( new TLabel('Id Empresa'), $ID_EMPRESA );
  410. $table_general->addRowSet( new TLabel('Concorrencia'), $CONCORRENCIA );
  411. $table_general->addRowSet( new TLabel('Email Nfe'), $EMAIL_NFE );
  412. $table_general->addRowSet( new TLabel('Id Foto'), $ID_FOTO );
  413. $table_general->addRowSet( new TLabel('Unidade Venda'), $UNIDADE_VENDA );
  414. $table_general->addRowSet( new TLabel('Id Empresa Nf'), $ID_EMPRESA_NF );
  415. $table_general->addRowSet( new TLabel('Emite Nota'), $EMITE_NOTA );
  416. $table_general->addRowSet( new TLabel('Cep'), $CEP );
  417. $table_general->addRowSet( new TLabel('Id Transportador'), $ID_TRANSPORTADOR );
  418. $table_general->addRowSet( new TLabel('Saldo Credito'), $SALDO_CREDITO );
  419. $table_general->addRowSet( new TLabel('Codigo Convenio'), $CODIGO_CONVENIO );
  420. $table_general->addRowSet( new TLabel('Id Caixa'), $ID_CAIXA );
  421. $table_general->addRowSet( new TLabel('Historico Vendas'), $HISTORICO_VENDAS );
  422. $table_general->addRowSet( new TLabel('Historico Itens'), $HISTORICO_ITENS );
  423. $table_general->addRowSet( new TLabel('Desconto'), $DESCONTO );
  424. $table_general->addRowSet( new TLabel('Id Banco'), $ID_BANCO );
  425. $table_general->addRowSet( new TLabel('Email Boleto'), $EMAIL_BOLETO );
  426. $table_general->addRowSet( new TLabel('Id Rede'), $ID_REDE );
  427. $table_general->addRowSet( new TLabel('Dia Vencto'), $DIA_VENCTO );
  428. $table_general->addRowSet( new TLabel('Dia Virada'), $DIA_VIRADA );
  429. $table_general->addRowSet( new TLabel('Id Forma'), $ID_FORMA );
  430. $table_general->addRowSet( new TLabel('Matricula'), $MATRICULA );
  431. $table_general->addRowSet( new TLabel('Autorizado1'), $AUTORIZADO1 );
  432. $table_general->addRowSet( new TLabel('Autorizado2'), $AUTORIZADO2 );
  433. $table_general->addRowSet( new TLabel('Autorizado3'), $AUTORIZADO3 );
  434. $table_general->addRowSet( new TLabel('Autorizado4'), $AUTORIZADO4 );
  435. $table_general->addRowSet( new TLabel('Autorizado5'), $AUTORIZADO5 );
  436. $table_general->addRowSet( new TLabel('Autorizado6'), $AUTORIZADO6 );
  437. $table_general->addRowSet( new TLabel('Transmitido'), $TRANSMITIDO );
  438. $table_general->addRowSet( new TLabel('Obs Spc1'), $OBS_SPC1 );
  439. $table_general->addRowSet( new TLabel('Obs Spc2'), $OBS_SPC2 );
  440. $table_general->addRowSet( new TLabel('Obs Spc3'), $OBS_SPC3 );
  441. $table_general->addRowSet( new TLabel('Roupa Calca'), $ROUPA_CALCA );
  442. $table_general->addRowSet( new TLabel('Roupa Camisa'), $ROUPA_CAMISA );
  443. $table_general->addRowSet( new TLabel('Roupa Sapato'), $ROUPA_SAPATO );
  444. $table_general->addRowSet( new TLabel('Roupa Blazer'), $ROUPA_BLAZER );
  445. $table_general->addRowSet( new TLabel('Diretorio'), $DIRETORIO );
  446. $table_general->addRowSet( new TLabel('Desc Financeiro'), $DESC_FINANCEIRO );
  447. $table_general->addRowSet( new TLabel('Ind Tpagto'), $IND_TPAGTO );
  448. $table_general->addRowSet( new TLabel('Despesas Cliente'), $DESPESAS_CLIENTE );
  449. $table_general->addRowSet( new TLabel('Nome User Liberou'), $NOME_USER_LIBEROU );
  450. $table_general->addRowSet( new TLabel('Id User Liberou'), $ID_USER_LIBEROU );
  451. $table_general->addRowSet( new TLabel('Motivo Liberacao'), $MOTIVO_LIBERACAO );
  452. $table_general->addRowSet( new TLabel('Libera Crediario'), $LIBERA_CREDIARIO );
  453. $table_general->addRowSet( new TLabel('Data Hora Liberacao'), $DATA_HORA_LIBERACAO );
  454. $table_general->addRowSet( new TLabel('Qual Preco'), $QUAL_PRECO );
  455. $table_general->addRowSet( new TLabel('Carencia'), $CARENCIA );
  456. $table_general->addRowSet( new TLabel('Id Foto A1'), $ID_FOTO_A1 );
  457. $table_general->addRowSet( new TLabel('Id Foto A2'), $ID_FOTO_A2 );
  458. $table_general->addRowSet( new TLabel('Id Foto A3'), $ID_FOTO_A3 );
  459. $table_general->addRowSet( new TLabel('Id Foto A4'), $ID_FOTO_A4 );
  460. $table_general->addRowSet( new TLabel('Id Foto A5'), $ID_FOTO_A5 );
  461. $table_general->addRowSet( new TLabel('Id Foto A6'), $ID_FOTO_A6 );
  462. $table_general->addRowSet( new TLabel('Valor Autorizado1'), $VALOR_AUTORIZADO1 );
  463. $table_general->addRowSet( new TLabel('Valor Autorizado2'), $VALOR_AUTORIZADO2 );
  464. $table_general->addRowSet( new TLabel('Valor Autorizado3'), $VALOR_AUTORIZADO3 );
  465. $table_general->addRowSet( new TLabel('Valor Autorizado4'), $VALOR_AUTORIZADO4 );
  466. $table_general->addRowSet( new TLabel('Valor Autorizado5'), $VALOR_AUTORIZADO5 );
  467. $table_general->addRowSet( new TLabel('Valor Autorizado6'), $VALOR_AUTORIZADO6 );
  468. $table_general->addRowSet( new TLabel('Di Autorizado1'), $DI_AUTORIZADO1 );
  469. $table_general->addRowSet( new TLabel('Di Autorizado2'), $DI_AUTORIZADO2 );
  470. $table_general->addRowSet( new TLabel('Di Autorizado3'), $DI_AUTORIZADO3 );
  471. $table_general->addRowSet( new TLabel('Di Autorizado4'), $DI_AUTORIZADO4 );
  472. $table_general->addRowSet( new TLabel('Di Autorizado5'), $DI_AUTORIZADO5 );
  473. $table_general->addRowSet( new TLabel('Di Autorizado6'), $DI_AUTORIZADO6 );
  474. $table_general->addRowSet( new TLabel('Df Autorizado1'), $DF_AUTORIZADO1 );
  475. $table_general->addRowSet( new TLabel('Df Autorizado2'), $DF_AUTORIZADO2 );
  476. $table_general->addRowSet( new TLabel('Df Autorizado3'), $DF_AUTORIZADO3 );
  477. $table_general->addRowSet( new TLabel('Df Autorizado4'), $DF_AUTORIZADO4 );
  478. $table_general->addRowSet( new TLabel('Df Autorizado5'), $DF_AUTORIZADO5 );
  479. $table_general->addRowSet( new TLabel('Df Autorizado6'), $DF_AUTORIZADO6 );
  480. $table_general->addRowSet( new TLabel('Doc Autorizado1'), $DOC_AUTORIZADO1 );
  481. $table_general->addRowSet( new TLabel('Doc Autorizado2'), $DOC_AUTORIZADO2 );
  482. $table_general->addRowSet( new TLabel('Doc Autorizado3'), $DOC_AUTORIZADO3 );
  483. $table_general->addRowSet( new TLabel('Doc Autorizado4'), $DOC_AUTORIZADO4 );
  484. $table_general->addRowSet( new TLabel('Doc Autorizado5'), $DOC_AUTORIZADO5 );
  485. $table_general->addRowSet( new TLabel('Doc Autorizado6'), $DOC_AUTORIZADO6 );
  486. $table_general->addRowSet( new TLabel('Endereco Trabalho'), $ENDERECO_TRABALHO );
  487. $table_general->addRowSet( new TLabel('Contato Financeiro'), $CONTATO_FINANCEIRO );
  488. $table_general->addRowSet( new TLabel('Fone Financeiro'), $FONE_FINANCEIRO );
  489. $table_general->addRowSet( new TLabel('Rg Expedicao'), $RG_EXPEDICAO );
  490. $table_general->addRowSet( new TLabel('Rg Orgao'), $RG_ORGAO );
  491. $table_general->addRowSet( new TLabel('Escolaridade'), $ESCOLARIDADE );
  492. $table_general->addRowSet( new TLabel('Desc Aposentadoria'), $DESC_APOSENTADORIA );
  493. $table_general->addRowSet( new TLabel('Desc Pensao'), $DESC_PENSAO );
  494. $table_general->addRowSet( new TLabel('Nro Aposentadoria'), $NRO_APOSENTADORIA );
  495. $table_general->addRowSet( new TLabel('Nro Pensao'), $NRO_PENSAO );
  496. $table_general->addRowSet( new TLabel('Nit'), $NIT );
  497. $table_general->addRowSet( new TLabel('Id Situacao'), $ID_SITUACAO );
  498. $table_general->addRowSet( new TLabel('Id Conjuge'), $ID_CONJUGE );
  499. $table_general->addRowSet( new TLabel('Endereco Correspondencia'), $ENDERECO_CORRESPONDENCIA );
  500. $table_general->addRowSet( new TLabel('Empresa Cnpj'), $EMPRESA_CNPJ );
  501. $table_general->addRowSet( new TLabel('Empresa Vinculo'), $EMPRESA_VINCULO );
  502. $table_general->addRowSet( new TLabel('Empresa Departamento'), $EMPRESA_DEPARTAMENTO );
  503. $table_general->addRowSet( new TLabel('Empresa Tipo Salario'), $EMPRESA_TIPO_SALARIO );
  504. $table_general->addRowSet( new TLabel('Empresa Origem'), $EMPRESA_ORIGEM );
  505. $table_general->addRowSet( new TLabel('Empresa Outras Rendas'), $EMPRESA_OUTRAS_RENDAS );
  506. $table_general->addRowSet( new TLabel('Conjuge Telefone'), $CONJUGE_TELEFONE );
  507. $table_general->addRowSet( new TLabel('Conjuge Tempo Trabalho'), $CONJUGE_TEMPO_TRABALHO );
  508. $table_general->addRowSet( new TLabel('Conjuge Salario'), $CONJUGE_SALARIO );
  509. $table_general->addRowSet( new TLabel('Conjuge End Trabalho'), $CONJUGE_END_TRABALHO );
  510. $table_general->addRowSet( new TLabel('Conjuge Cid Trabalho'), $CONJUGE_CID_TRABALHO );
  511. $table_general->addRowSet( new TLabel('Conjuge Cep Trabalho'), $CONJUGE_CEP_TRABALHO );
  512. $table_general->addRowSet( new TLabel('Conjuge Dep Trabalho'), $CONJUGE_DEP_TRABALHO );
  513. $table_general->addRowSet( new TLabel('Conjuge Data Adm'), $CONJUGE_DATA_ADM );
  514. $table_general->addRowSet( new TLabel('Conjuge Renda'), $CONJUGE_RENDA );
  515. $table_general->addRowSet( new TLabel('Conjuge Vinculo'), $CONJUGE_VINCULO );
  516. $table_general->addRowSet( new TLabel('Conjuge Tipo Emprego'), $CONJUGE_TIPO_EMPREGO );
  517. $table_general->addRowSet( new TLabel('Conjuge Origem Renda'), $CONJUGE_ORIGEM_RENDA );
  518. $table_general->addRowSet( new TLabel('Conjuge Outras Rendas'), $CONJUGE_OUTRAS_RENDAS );
  519. $table_general->addRowSet( new TLabel('Empresa Cep'), $EMPRESA_CEP );
  520. $table_general->addRowSet( new TLabel('Conjuge Cnpj Trabalho'), $CONJUGE_CNPJ_TRABALHO );
  521. $table_general->addRowSet( new TLabel('Conjuge Profissao'), $CONJUGE_PROFISSAO );
  522. $table_general->addRowSet( new TLabel('Limite Data Hora Alt'), $LIMITE_DATA_HORA_ALT );
  523. $table_general->addRowSet( new TLabel('Limite Usuario Alt'), $LIMITE_USUARIO_ALT );
  524. $table_general->addRowSet( new TLabel('Unidades'), $UNIDADES );
  525. $table_general->addRowSet( new TLabel('Conjuge Cpf'), $CONJUGE_CPF );
  526. $table_general->addRowSet( new TLabel('Conjuge Rg'), $CONJUGE_RG );
  527. $table_general->addRowSet( new TLabel('Casamento Data'), $CASAMENTO_DATA );
  528. $table_general->addRowSet( new TLabel('Casamento Tipo'), $CASAMENTO_TIPO );
  529. $table_general->addRowSet( new TLabel('Frete Pagar'), $FRETE_PAGAR );
  530. $table_general->addRowSet( new TLabel('Id Meus Pedidos'), $ID_MEUS_PEDIDOS );
  531. $table_general->addRowSet( new TLabel('Data Alt Meus Pedidos'), $DATA_ALT_MEUS_PEDIDOS );
  532. $table_general->addRowSet( new TLabel('Erro Meus Pedidos'), $ERRO_MEUS_PEDIDOS );
  533. // detail
  534. $frame_details = new TFrame();
  535. $frame_details->setLegend('Cidade');
  536. $row = $table_detail->addRow();
  537. $row->addCell($frame_details);
  538. $btn_save_detail = new TButton('btn_save_detail');
  539. $btn_save_detail->setAction(new TAction(array($this, 'onSaveDetail')), 'Register');
  540. $btn_save_detail->setImage('fa:save');
  541. $table_details = new TTable;
  542. $frame_details->add($table_details);
  543. $table_details->addRowSet( '', $detail_ID_CIDADE );
  544. $table_details->addRowSet( new TLabel('Descricao'), $detail_DESCRICAO );
  545. $table_details->addRowSet( new TLabel('Uf'), $detail_UF );
  546. $table_details->addRowSet( new TLabel('Cod Ibge'), $detail_COD_IBGE );
  547. $table_details->addRowSet( new TLabel('Cep'), $detail_CEP );
  548. $table_details->addRowSet( new TLabel('Id Usuario'), $detail_ID_USUARIO );
  549. $table_details->addRowSet( new TLabel('Data Hora Alt'), $detail_DATA_HORA_ALT );
  550. $table_details->addRowSet( new TLabel('Concorrencia'), $detail_CONCORRENCIA );
  551. $table_details->addRowSet( new TLabel('Id Pais'), $detail_ID_PAIS );
  552. $table_details->addRowSet( $btn_save_detail );
  553. $this->detail_list = new TQuickGrid;
  554. $this->detail_list->setHeight( 175 );
  555. $this->detail_list->makeScrollable();
  556. $this->detail_list->disableDefaultClick();
  557. $this->detail_list->addQuickColumn('', 'edit', 'left', 50);
  558. $this->detail_list->addQuickColumn('', 'delete', 'left', 50);
  559. // items
  560. $this->detail_list->addQuickColumn('Descricao', 'DESCRICAO', 'left', 200);
  561. $this->detail_list->addQuickColumn('Uf', 'UF', 'left', 200);
  562. $this->detail_list->addQuickColumn('Cod Ibge', 'COD_IBGE', 'left', 200);
  563. $this->detail_list->addQuickColumn('Cep', 'CEP', 'left', 200);
  564. $this->detail_list->addQuickColumn('Id Usuario', 'ID_USUARIO', 'left', 100);
  565. $this->detail_list->addQuickColumn('Data Hora Alt', 'DATA_HORA_ALT', 'left', 200);
  566. $this->detail_list->addQuickColumn('Concorrencia', 'CONCORRENCIA', 'left', 100);
  567. $this->detail_list->addQuickColumn('Id Pais', 'ID_PAIS', 'left', 100);
  568. $this->detail_list->createModel();
  569. $row = $table_detail->addRow();
  570. $row->addCell($this->detail_list);
  571. // create an action button (save)
  572. $save_button=new TButton('save');
  573. $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
  574. $save_button->setImage('ico_save.png');
  575. // create an new button (edit with no parameters)
  576. $new_button=new TButton('new');
  577. $new_button->setAction(new TAction(array($this, 'onClear')), _t('New'));
  578. $new_button->setImage('ico_new.png');
  579. // define form fields
  580. $this->formFields = array($ID_CLIENTE,$CODIGO,$RAZAO_SOCIAL,$NOME_FANTASIA,$ENDERECO,$NUMERO,$COMPLEMENTO,$BAIRRO,$ID_CIDADE,$FONE,$FAX,$CELULAR,$CONTATO,$CNPJ,$INSCRICAO,$EMAIL,$CPF,$IDENTIDADE,$TITULO_ELEITOR,$CART_PROFIS,$CART_SERIE,$CART_ORGAO,$FILIACAO_PAI,$FILIACAO_MAE,$DATA_NASCIMENTO,$DATA_CADASTRO,$DATA_ALTERACAO,$DEPENDENTES,$COMPROVANTE_ENDERECO,$DATA_ENDERECO,$TIPO_CASA,$VALOR_ALUGUEL,$VALOR_DESPESAS,$ABERTURA_CADASTRO,$NATURALIDADE,$EMPREGO_ANTERIOR,$TEMPO_SERVICO,$EMPRESA_NOME,$EMPRESA_ID_CIDADE,$EMPRESA_FUNCAO,$EMPRESA_ADMISSAO,$EMPRESA_FONE,$RENDA_CLIENTE,$RENDA_CONJUGE,$LIMITE_CREDITO,$CONCEITO,$ESTADO_CIVIL,$SEXO,$SITUACAO,$CONJUGE_NOME,$CONJUGE_NASCIMENTO,$CONJUGE_TRABALHO,$CONJUGE_ADMISSAO,$CONJUGE_FONE,$ENTREGA_NOME,$ENTREGA_ENDERECO,$ENTREGA_BAIRRO,$ENTREGA_ID_CIDADE,$ENTREGA_FONE,$NOME_CONHECIDO1,$NOME_CONHECIDO2,$REF_BANCO1,$REF_BANCO2,$REF_BANCO3,$REF_BANCO1_CONTA,$REF_BANCO2_CONTA,$REF_BANCO3_CONTA,$REF_COM_NOME1,$REF_COM_NOME2,$REF_COM_NOME3,$REF_COM_FONE1,$REF_COM_FONE2,$REF_COM_FONE3,$REF_COM_VALOR1,$REF_COM_VALOR2,$REF_COM_VALOR3,$REF_COM_PONTUALIDADE1,$REF_COM_PONTUALIDADE2,$REF_COM_PONTUALIDADE3,$INDICADOR_1,$INDICADOR_2,$INDICADOR_3,$INDICADOR_4,$INDICADOR_5,$INDICADOR_6,$INDICADOR_7,$INDICADOR_8,$INDICADOR_9,$INDICADOR_10,$SPC_DATA_ENVIO,$SPC_VALOR_COMPRA,$SPC_DATA_BAIXA,$SERASA_DATA_ENVIO,$SERASA_VALOR_COMPRA,$SERASA_DATA_BAIXA,$OUTRA_DATA_ENVIO,$OUTRA_VALOR_COMPRA,$OUTRA_DATA_BAIXA,$OBSERVACOES,$TABELA_PRECO,$TIPO_PAGAMENTO,$FORMA_PAGAMENTO,$ALTERAR_PRECO,$ID_CLIENTE_COBRANCA,$IND_TIPO_PAGAMENTO,$RECEBE_COBRANCA,$COBRAR_TAXA_CARTORIO,$COBRAR_TAXA_BANCARIA,$ID_USUARIO,$DATA_HORA_ALT,$ID_VENDEDOR,$ID_TIPO_ATIVIDADE,$ID_PRACA,$ID_EMPRESA,$CONCORRENCIA,$EMAIL_NFE,$ID_FOTO,$UNIDADE_VENDA,$ID_EMPRESA_NF,$EMITE_NOTA,$CEP,$ID_TRANSPORTADOR,$SALDO_CREDITO,$CODIGO_CONVENIO,$ID_CAIXA,$HISTORICO_VENDAS,$HISTORICO_ITENS,$DESCONTO,$ID_BANCO,$EMAIL_BOLETO,$ID_REDE,$DIA_VENCTO,$DIA_VIRADA,$ID_FORMA,$MATRICULA,$AUTORIZADO1,$AUTORIZADO2,$AUTORIZADO3,$AUTORIZADO4,$AUTORIZADO5,$AUTORIZADO6,$TRANSMITIDO,$OBS_SPC1,$OBS_SPC2,$OBS_SPC3,$ROUPA_CALCA,$ROUPA_CAMISA,$ROUPA_SAPATO,$ROUPA_BLAZER,$DIRETORIO,$DESC_FINANCEIRO,$IND_TPAGTO,$DESPESAS_CLIENTE,$NOME_USER_LIBEROU,$ID_USER_LIBEROU,$MOTIVO_LIBERACAO,$LIBERA_CREDIARIO,$DATA_HORA_LIBERACAO,$QUAL_PRECO,$CARENCIA,$ID_FOTO_A1,$ID_FOTO_A2,$ID_FOTO_A3,$ID_FOTO_A4,$ID_FOTO_A5,$ID_FOTO_A6,$VALOR_AUTORIZADO1,$VALOR_AUTORIZADO2,$VALOR_AUTORIZADO3,$VALOR_AUTORIZADO4,$VALOR_AUTORIZADO5,$VALOR_AUTORIZADO6,$DI_AUTORIZADO1,$DI_AUTORIZADO2,$DI_AUTORIZADO3,$DI_AUTORIZADO4,$DI_AUTORIZADO5,$DI_AUTORIZADO6,$DF_AUTORIZADO1,$DF_AUTORIZADO2,$DF_AUTORIZADO3,$DF_AUTORIZADO4,$DF_AUTORIZADO5,$DF_AUTORIZADO6,$DOC_AUTORIZADO1,$DOC_AUTORIZADO2,$DOC_AUTORIZADO3,$DOC_AUTORIZADO4,$DOC_AUTORIZADO5,$DOC_AUTORIZADO6,$ENDERECO_TRABALHO,$CONTATO_FINANCEIRO,$FONE_FINANCEIRO,$RG_EXPEDICAO,$RG_ORGAO,$ESCOLARIDADE,$DESC_APOSENTADORIA,$DESC_PENSAO,$NRO_APOSENTADORIA,$NRO_PENSAO,$NIT,$ID_SITUACAO,$ID_CONJUGE,$ENDERECO_CORRESPONDENCIA,$EMPRESA_CNPJ,$EMPRESA_VINCULO,$EMPRESA_DEPARTAMENTO,$EMPRESA_TIPO_SALARIO,$EMPRESA_ORIGEM,$EMPRESA_OUTRAS_RENDAS,$CONJUGE_TELEFONE,$CONJUGE_TEMPO_TRABALHO,$CONJUGE_SALARIO,$CONJUGE_END_TRABALHO,$CONJUGE_CID_TRABALHO,$CONJUGE_CEP_TRABALHO,$CONJUGE_DEP_TRABALHO,$CONJUGE_DATA_ADM,$CONJUGE_RENDA,$CONJUGE_VINCULO,$CONJUGE_TIPO_EMPREGO,$CONJUGE_ORIGEM_RENDA,$CONJUGE_OUTRAS_RENDAS,$EMPRESA_CEP,$CONJUGE_CNPJ_TRABALHO,$CONJUGE_PROFISSAO,$LIMITE_DATA_HORA_ALT,$LIMITE_USUARIO_ALT,$UNIDADES,$CONJUGE_CPF,$CONJUGE_RG,$CASAMENTO_DATA,$CASAMENTO_TIPO,$FRETE_PAGAR,$ID_MEUS_PEDIDOS,$DATA_ALT_MEUS_PEDIDOS,$ERRO_MEUS_PEDIDOS,$detail_DESCRICAO,$detail_UF,$detail_COD_IBGE,$detail_CEP,$detail_ID_USUARIO,$detail_DATA_HORA_ALT,$detail_CONCORRENCIA,$detail_ID_PAIS);
  581. $this->formFields[] = $btn_save_detail;
  582. $this->formFields[] = $save_button;
  583. $this->formFields[] = $new_button;
  584. $this->formFields[] = $detail_ID_CIDADE;
  585. $this->form->setFields( $this->formFields );
  586. $table_master->addRowSet( array($save_button, $new_button), '', '')->class = 'tformaction'; // CSS class
  587. // create the page container
  588. $container = new TVBox;
  589. $container->style = 'width: 90%';
  590. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  591. $container->add($this->form);
  592. parent::add($container);
  593. }
  594. /**
  595. * Clear form
  596. * @param $param URL parameters
  597. */
  598. public function onClear($param)
  599. {
  600. $this->form->clear();
  601. TSession::setValue(__CLASS__.'_items', array());
  602. $this->onReload( $param );
  603. }
  604. /**
  605. * Save an item from form to session list
  606. * @param $param URL parameters
  607. */
  608. public function onSaveDetail( $param )
  609. {
  610. try
  611. {
  612. TTransaction::open('conexao');
  613. $data = $this->form->getData();
  614. /** validation sample
  615. if (! $data->fieldX)
  616. throw new Exception('The field fieldX is required');
  617. **/
  618. $items = TSession::getValue(__CLASS__.'_items');
  619. $key = empty($data->detail_ID_CIDADE) ? 'X'.mt_rand(1000000000, 1999999999) : $data->detail_ID_CIDADE;
  620. $items[ $key ] = array();
  621. $items[ $key ]['ID_CIDADE'] = $key;
  622. $items[ $key ]['DESCRICAO'] = $data->detail_DESCRICAO;
  623. $items[ $key ]['UF'] = $data->detail_UF;
  624. $items[ $key ]['COD_IBGE'] = $data->detail_COD_IBGE;
  625. $items[ $key ]['CEP'] = $data->detail_CEP;
  626. $items[ $key ]['ID_USUARIO'] = $data->detail_ID_USUARIO;
  627. $items[ $key ]['DATA_HORA_ALT'] = $data->detail_DATA_HORA_ALT;
  628. $items[ $key ]['CONCORRENCIA'] = $data->detail_CONCORRENCIA;
  629. $items[ $key ]['ID_PAIS'] = $data->detail_ID_PAIS;
  630. TSession::setValue(__CLASS__.'_items', $items);
  631. // clear detail form fields
  632. $data->detail_ID_CIDADE = '';
  633. $data->detail_DESCRICAO = '';
  634. $data->detail_UF = '';
  635. $data->detail_COD_IBGE = '';
  636. $data->detail_CEP = '';
  637. $data->detail_ID_USUARIO = '';
  638. $data->detail_DATA_HORA_ALT = '';
  639. $data->detail_CONCORRENCIA = '';
  640. $data->detail_ID_PAIS = '';
  641. TTransaction::close();
  642. $this->form->setData($data);
  643. $this->onReload( $param ); // reload the items
  644. }
  645. catch (Exception $e)
  646. {
  647. $this->form->setData( $this->form->getData());
  648. new TMessage('error', $e->getMessage());
  649. }
  650. }
  651. /**
  652. * Load an item from session list to detail form
  653. * @param $param URL parameters
  654. */
  655. public function onEditDetail( $param )
  656. {
  657. $data = $this->form->getData();
  658. // read session items
  659. $items = TSession::getValue(__CLASS__.'_items');
  660. // get the session item
  661. $item = $items[ $param['item_key'] ];
  662. $data->detail_ID_CIDADE = $item['ID_CIDADE'];
  663. $data->detail_DESCRICAO = $item['DESCRICAO'];
  664. $data->detail_UF = $item['UF'];
  665. $data->detail_COD_IBGE = $item['COD_IBGE'];
  666. $data->detail_CEP = $item['CEP'];
  667. $data->detail_ID_USUARIO = $item['ID_USUARIO'];
  668. $data->detail_DATA_HORA_ALT = $item['DATA_HORA_ALT'];
  669. $data->detail_CONCORRENCIA = $item['CONCORRENCIA'];
  670. $data->detail_ID_PAIS = $item['ID_PAIS'];
  671. // fill detail fields
  672. $this->form->setData( $data );
  673. $this->onReload( $param );
  674. }
  675. /**
  676. * Delete an item from session list
  677. * @param $param URL parameters
  678. */
  679. public function onDeleteDetail( $param )
  680. {
  681. $data = $this->form->getData();
  682. // reset items
  683. $data->detail_DESCRICAO = '';
  684. $data->detail_UF = '';
  685. $data->detail_COD_IBGE = '';
  686. $data->detail_CEP = '';
  687. $data->detail_ID_USUARIO = '';
  688. $data->detail_DATA_HORA_ALT = '';
  689. $data->detail_CONCORRENCIA = '';
  690. $data->detail_ID_PAIS = '';
  691. // clear form data
  692. $this->form->setData( $data );
  693. // read session items
  694. $items = TSession::getValue(__CLASS__.'_items');
  695. // delete the item from session
  696. unset($items[ $param['item_key'] ] );
  697. TSession::setValue(__CLASS__.'_items', $items);
  698. // reload items
  699. $this->onReload( $param );
  700. }
  701. /**
  702. * Load the items list from session
  703. * @param $param URL parameters
  704. */
  705. public function onReload($param)
  706. {
  707. // read session items
  708. $items = TSession::getValue(__CLASS__.'_items');
  709. $this->detail_list->clear(); // clear detail list
  710. $data = $this->form->getData();
  711. if ($items)
  712. {
  713. $cont = 1;
  714. foreach ($items as $list_item_key => $list_item)
  715. {
  716. $item_name = 'prod_' . $cont++;
  717. $item = new StdClass;
  718. // create action buttons
  719. $action_del = new TAction(array($this, 'onDeleteDetail'));
  720. $action_del->setParameter('item_key', $list_item_key);
  721. $action_edi = new TAction(array($this, 'onEditDetail'));
  722. $action_edi->setParameter('item_key', $list_item_key);
  723. $button_del = new TButton('delete_detail'.$cont);
  724. $button_del->class = 'btn btn-default btn-sm';
  725. $button_del->setAction( $action_del, '' );
  726. $button_del->setImage('fa:trash-o red fa-lg');
  727. $button_edi = new TButton('edit_detail'.$cont);
  728. $button_edi->class = 'btn btn-default btn-sm';
  729. $button_edi->setAction( $action_edi, '' );
  730. $button_edi->setImage('fa:edit blue fa-lg');
  731. $item->edit = $button_edi;
  732. $item->delete = $button_del;
  733. $this->formFields[ $item_name.'_edit' ] = $item->edit;
  734. $this->formFields[ $item_name.'_delete' ] = $item->delete;
  735. // items
  736. $item->ID_CIDADE = $list_item['ID_CIDADE'];
  737. $item->DESCRICAO = $list_item['DESCRICAO'];
  738. $item->UF = $list_item['UF'];
  739. $item->COD_IBGE = $list_item['COD_IBGE'];
  740. $item->CEP = $list_item['CEP'];
  741. $item->ID_USUARIO = $list_item['ID_USUARIO'];
  742. $item->DATA_HORA_ALT = $list_item['DATA_HORA_ALT'];
  743. $item->CONCORRENCIA = $list_item['CONCORRENCIA'];
  744. $item->ID_PAIS = $list_item['ID_PAIS'];
  745. $row = $this->detail_list->addItem( $item );
  746. $row->onmouseover='';
  747. $row->onmouseout='';
  748. }
  749. $this->form->setFields( $this->formFields );
  750. }
  751. $this->loaded = TRUE;
  752. }
  753. /**
  754. * Load Master/Detail data from database to form/session
  755. */
  756. public function onEdit($param)
  757. {
  758. try
  759. {
  760. TTransaction::open('conexao');
  761. if (isset($param['key']))
  762. {
  763. $key = $param['key'];
  764. $object = new Cliente($key);
  765. $items = Cidade::where('ID_CIDADE', '=', $key)->load();
  766. $session_items = array();
  767. foreach( $items as $item )
  768. {
  769. $item_key = $item->ID_CIDADE;
  770. $session_items[$item_key] = $item->toArray();
  771. $session_items[$item_key]['ID_CIDADE'] = $item->ID_CIDADE;
  772. $session_items[$item_key]['DESCRICAO'] = $item->DESCRICAO;
  773. $session_items[$item_key]['UF'] = $item->UF;
  774. $session_items[$item_key]['COD_IBGE'] = $item->COD_IBGE;
  775. $session_items[$item_key]['CEP'] = $item->CEP;
  776. $session_items[$item_key]['ID_USUARIO'] = $item->ID_USUARIO;
  777. $session_items[$item_key]['DATA_HORA_ALT'] = $item->DATA_HORA_ALT;
  778. $session_items[$item_key]['CONCORRENCIA'] = $item->CONCORRENCIA;
  779. $session_items[$item_key]['ID_PAIS'] = $item->ID_PAIS;
  780. }
  781. TSession::setValue(__CLASS__.'_items', $session_items);
  782. $this->form->setData($object); // fill the form with the active record data
  783. $this->onReload( $param ); // reload items list
  784. TTransaction::close(); // close transaction
  785. }
  786. else
  787. {
  788. $this->form->clear();
  789. TSession::setValue(__CLASS__.'_items', null);
  790. $this->onReload( $param );
  791. }
  792. }
  793. catch (Exception $e) // in case of exception
  794. {
  795. new TMessage('error', $e->getMessage());
  796. TTransaction::rollback();
  797. }
  798. }
  799. /**
  800. * Save the Master/Detail data from form/session to database
  801. */
  802. public function onSave()
  803. {
  804. try
  805. {
  806. // open a transaction with database
  807. TTransaction::open('conexao');
  808. $data = $this->form->getData();
  809. $master = new Cliente;
  810. $master->fromArray( (array) $data);
  811. $this->form->validate(); // form validation
  812. $master->store(); // save master object
  813. // delete details
  814. $old_items = Cidade::where('ID_CIDADE', '=', $master->ID_CLIENTE)->load();
  815. $keep_items = array();
  816. // get session items
  817. $items = TSession::getValue(__CLASS__.'_items');
  818. if( $items )
  819. {
  820. foreach( $items as $item )
  821. {
  822. if (substr($item['ID_CIDADE'],0,1) == 'X' ) // new record
  823. {
  824. $detail = new Cidade;
  825. }
  826. else
  827. {
  828. $detail = Cidade::find($item['ID_CIDADE']);
  829. }
  830. $detail->DESCRICAO = $item['DESCRICAO'];
  831. $detail->UF = $item['UF'];
  832. $detail->COD_IBGE = $item['COD_IBGE'];
  833. $detail->CEP = $item['CEP'];
  834. $detail->ID_USUARIO = $item['ID_USUARIO'];
  835. $detail->DATA_HORA_ALT = $item['DATA_HORA_ALT'];
  836. $detail->CONCORRENCIA = $item['CONCORRENCIA'];
  837. $detail->ID_PAIS = $item['ID_PAIS'];
  838. $detail->ID_CIDADE = $master->ID_CLIENTE;
  839. $detail->store();
  840. $keep_items[] = $detail->ID_CIDADE;
  841. }
  842. }
  843. if ($old_items)
  844. {
  845. foreach ($old_items as $old_item)
  846. {
  847. if (!in_array( $old_item->ID_CIDADE, $keep_items))
  848. {
  849. $old_item->delete();
  850. }
  851. }
  852. }
  853. TTransaction::close(); // close the transaction
  854. // reload form and session items
  855. $this->onEdit(array('key'=>$master->ID_CLIENTE));
  856. new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
  857. }
  858. catch (Exception $e) // in case of exception
  859. {
  860. new TMessage('error', $e->getMessage());
  861. $this->form->setData( $this->form->getData() ); // keep form data
  862. TTransaction::rollback();
  863. }
  864. }
  865. /**
  866. * Show the page
  867. */
  868. public function show()
  869. {</your>
LG

ClientForm.class.php:

 
  1. <?php
  2. /**
  3. * ClienteForm Master/Detail
  4. * @author <your name here>
  5. */
  6. class ClienteForm extends TPage
  7. {
  8. protected $form; // form
  9. protected $formFields;
  10. protected $detail_list;
  11. /**
  12. * Page constructor
  13. */
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. // creates the form
  18. $this->form = new TForm('form_Cliente');
  19. $this->form->class = 'tform'; // CSS class
  20. $this->form->style = 'max-width:700px'; // style
  21. parent::include_css('app/resources/custom-frame.css');
  22. $table_master = new TTable;
  23. $table_master->width = '100%';
  24. $table_master->addRowSet( new TLabel('Cliente'), '', '')->class = 'tformtitle';
  25. // add a table inside form
  26. $table_general = new TTable;
  27. $table_detail = new TTable;
  28. $table_general-> width = '100%';
  29. $table_detail-> width = '100%';
  30. $frame_general = new TFrame;
  31. $frame_general->setLegend('Cliente');
  32. $frame_general->style = 'background:whiteSmoke';
  33. $frame_general->add($table_general);
  34. $table_master->addRow()->addCell( $frame_general )->colspan=2;
  35. $row = $table_master->addRow();
  36. $row->addCell( $table_detail );
  37. $this->form->add($table_master);
  38. // master fields
  39. $ID_CLIENTE = new TEntry('ID_CLIENTE');
  40. $CODIGO = new TEntry('CODIGO');
  41. $RAZAO_SOCIAL = new TEntry('RAZAO_SOCIAL');
  42. $NOME_FANTASIA = new TEntry('NOME_FANTASIA');
  43. $ENDERECO = new TEntry('ENDERECO');
  44. $NUMERO = new TEntry('NUMERO');
  45. $COMPLEMENTO = new TEntry('COMPLEMENTO');
  46. $BAIRRO = new TEntry('BAIRRO');
  47. $ID_CIDADE = new TEntry('ID_CIDADE');
  48. $FONE = new TEntry('FONE');
  49. $FAX = new TEntry('FAX');
  50. $CELULAR = new TEntry('CELULAR');
  51. $CONTATO = new TEntry('CONTATO');
  52. $CNPJ = new TEntry('CNPJ');
  53. $INSCRICAO = new TEntry('INSCRICAO');
  54. $EMAIL = new TEntry('EMAIL');
  55. $CPF = new TEntry('CPF');
  56. $IDENTIDADE = new TEntry('IDENTIDADE');
  57. $TITULO_ELEITOR = new TEntry('TITULO_ELEITOR');
  58. $CART_PROFIS = new TEntry('CART_PROFIS');
  59. $CART_SERIE = new TEntry('CART_SERIE');
  60. $CART_ORGAO = new TEntry('CART_ORGAO');
  61. $FILIACAO_PAI = new TEntry('FILIACAO_PAI');
  62. $FILIACAO_MAE = new TEntry('FILIACAO_MAE');
  63. $DATA_NASCIMENTO = new TDate('DATA_NASCIMENTO');
  64. $DATA_CADASTRO = new TDate('DATA_CADASTRO');
  65. $DATA_ALTERACAO = new TDate('DATA_ALTERACAO');
  66. $DEPENDENTES = new TEntry('DEPENDENTES');
  67. $COMPROVANTE_ENDERECO = new TEntry('COMPROVANTE_ENDERECO');
  68. $DATA_ENDERECO = new TDate('DATA_ENDERECO');
  69. $TIPO_CASA = new TEntry('TIPO_CASA');
  70. $VALOR_ALUGUEL = new TEntry('VALOR_ALUGUEL');
  71. $VALOR_DESPESAS = new TEntry('VALOR_DESPESAS');
  72. $ABERTURA_CADASTRO = new TEntry('ABERTURA_CADASTRO');
  73. $NATURALIDADE = new TEntry('NATURALIDADE');
  74. $EMPREGO_ANTERIOR = new TEntry('EMPREGO_ANTERIOR');
  75. $TEMPO_SERVICO = new TEntry('TEMPO_SERVICO');
  76. $EMPRESA_NOME = new TEntry('EMPRESA_NOME');
  77. $EMPRESA_ID_CIDADE = new TEntry('EMPRESA_ID_CIDADE');
  78. $EMPRESA_FUNCAO = new TEntry('EMPRESA_FUNCAO');
  79. $EMPRESA_ADMISSAO = new TDate('EMPRESA_ADMISSAO');
  80. $EMPRESA_FONE = new TEntry('EMPRESA_FONE');
  81. $RENDA_CLIENTE = new TEntry('RENDA_CLIENTE');
  82. $RENDA_CONJUGE = new TEntry('RENDA_CONJUGE');
  83. $LIMITE_CREDITO = new TEntry('LIMITE_CREDITO');
  84. $CONCEITO = new TEntry('CONCEITO');
  85. $ESTADO_CIVIL = new TEntry('ESTADO_CIVIL');
  86. $SEXO = new TEntry('SEXO');
  87. $SITUACAO = new TEntry('SITUACAO');
  88. $CONJUGE_NOME = new TEntry('CONJUGE_NOME');
  89. $CONJUGE_NASCIMENTO = new TDate('CONJUGE_NASCIMENTO');
  90. $CONJUGE_TRABALHO = new TEntry('CONJUGE_TRABALHO');
  91. $CONJUGE_ADMISSAO = new TDate('CONJUGE_ADMISSAO');
  92. $CONJUGE_FONE = new TEntry('CONJUGE_FONE');
  93. $ENTREGA_NOME = new TEntry('ENTREGA_NOME');
  94. $ENTREGA_ENDERECO = new TEntry('ENTREGA_ENDERECO');
  95. $ENTREGA_BAIRRO = new TEntry('ENTREGA_BAIRRO');
  96. $ENTREGA_ID_CIDADE = new TEntry('ENTREGA_ID_CIDADE');
  97. $ENTREGA_FONE = new TEntry('ENTREGA_FONE');
  98. $NOME_CONHECIDO1 = new TEntry('NOME_CONHECIDO1');
  99. $NOME_CONHECIDO2 = new TEntry('NOME_CONHECIDO2');
  100. $REF_BANCO1 = new TEntry('REF_BANCO1');
  101. $REF_BANCO2 = new TEntry('REF_BANCO2');
  102. $REF_BANCO3 = new TEntry('REF_BANCO3');
  103. $REF_BANCO1_CONTA = new TEntry('REF_BANCO1_CONTA');
  104. $REF_BANCO2_CONTA = new TEntry('REF_BANCO2_CONTA');
  105. $REF_BANCO3_CONTA = new TEntry('REF_BANCO3_CONTA');
  106. $REF_COM_NOME1 = new TEntry('REF_COM_NOME1');
  107. $REF_COM_NOME2 = new TEntry('REF_COM_NOME2');
  108. $REF_COM_NOME3 = new TEntry('REF_COM_NOME3');
  109. $REF_COM_FONE1 = new TEntry('REF_COM_FONE1');
  110. $REF_COM_FONE2 = new TEntry('REF_COM_FONE2');
  111. $REF_COM_FONE3 = new TEntry('REF_COM_FONE3');
  112. $REF_COM_VALOR1 = new TEntry('REF_COM_VALOR1');
  113. $REF_COM_VALOR2 = new TEntry('REF_COM_VALOR2');
  114. $REF_COM_VALOR3 = new TEntry('REF_COM_VALOR3');
  115. $REF_COM_PONTUALIDADE1 = new TEntry('REF_COM_PONTUALIDADE1');
  116. $REF_COM_PONTUALIDADE2 = new TEntry('REF_COM_PONTUALIDADE2');
  117. $REF_COM_PONTUALIDADE3 = new TEntry('REF_COM_PONTUALIDADE3');
  118. $INDICADOR_1 = new TEntry('INDICADOR_1');
  119. $INDICADOR_2 = new TEntry('INDICADOR_2');
  120. $INDICADOR_3 = new TEntry('INDICADOR_3');
  121. $INDICADOR_4 = new TEntry('INDICADOR_4');
  122. $INDICADOR_5 = new TEntry('INDICADOR_5');
  123. $INDICADOR_6 = new TEntry('INDICADOR_6');
  124. $INDICADOR_7 = new TEntry('INDICADOR_7');
  125. $INDICADOR_8 = new TEntry('INDICADOR_8');
  126. $INDICADOR_9 = new TEntry('INDICADOR_9');
  127. $INDICADOR_10 = new TEntry('INDICADOR_10');
  128. $SPC_DATA_ENVIO = new TDate('SPC_DATA_ENVIO');
  129. $SPC_VALOR_COMPRA = new TEntry('SPC_VALOR_COMPRA');
  130. $SPC_DATA_BAIXA = new TDate('SPC_DATA_BAIXA');
  131. $SERASA_DATA_ENVIO = new TDate('SERASA_DATA_ENVIO');
  132. $SERASA_VALOR_COMPRA = new TEntry('SERASA_VALOR_COMPRA');
  133. $SERASA_DATA_BAIXA = new TDate('SERASA_DATA_BAIXA');
  134. $OUTRA_DATA_ENVIO = new TDate('OUTRA_DATA_ENVIO');
  135. $OUTRA_VALOR_COMPRA = new TEntry('OUTRA_VALOR_COMPRA');
  136. $OUTRA_DATA_BAIXA = new TDate('OUTRA_DATA_BAIXA');
  137. $OBSERVACOES = new TEntry('OBSERVACOES');
  138. $TABELA_PRECO = new TEntry('TABELA_PRECO');
  139. $TIPO_PAGAMENTO = new TEntry('TIPO_PAGAMENTO');
  140. $FORMA_PAGAMENTO = new TEntry('FORMA_PAGAMENTO');
  141. $ALTERAR_PRECO = new TEntry('ALTERAR_PRECO');
  142. $ID_CLIENTE_COBRANCA = new TEntry('ID_CLIENTE_COBRANCA');
  143. $IND_TIPO_PAGAMENTO = new TEntry('IND_TIPO_PAGAMENTO');
  144. $RECEBE_COBRANCA = new TEntry('RECEBE_COBRANCA');
  145. $COBRAR_TAXA_CARTORIO = new TEntry('COBRAR_TAXA_CARTORIO');
  146. $COBRAR_TAXA_BANCARIA = new TEntry('COBRAR_TAXA_BANCARIA');
  147. $ID_USUARIO = new TEntry('ID_USUARIO');
  148. $DATA_HORA_ALT = new TEntry('DATA_HORA_ALT');
  149. $ID_VENDEDOR = new TEntry('ID_VENDEDOR');
  150. $ID_TIPO_ATIVIDADE = new TEntry('ID_TIPO_ATIVIDADE');
  151. $ID_PRACA = new TEntry('ID_PRACA');
  152. $ID_EMPRESA = new TEntry('ID_EMPRESA');
  153. $CONCORRENCIA = new TEntry('CONCORRENCIA');
  154. $EMAIL_NFE = new TEntry('EMAIL_NFE');
  155. $ID_FOTO = new TEntry('ID_FOTO');
  156. $UNIDADE_VENDA = new TEntry('UNIDADE_VENDA');
  157. $ID_EMPRESA_NF = new TEntry('ID_EMPRESA_NF');
  158. $EMITE_NOTA = new TEntry('EMITE_NOTA');
  159. $CEP = new TEntry('CEP');
  160. $ID_TRANSPORTADOR = new TEntry('ID_TRANSPORTADOR');
  161. $SALDO_CREDITO = new TEntry('SALDO_CREDITO');
  162. $CODIGO_CONVENIO = new TEntry('CODIGO_CONVENIO');
  163. $ID_CAIXA = new TEntry('ID_CAIXA');
  164. $HISTORICO_VENDAS = new TText('HISTORICO_VENDAS');
  165. $HISTORICO_ITENS = new TText('HISTORICO_ITENS');
  166. $DESCONTO = new TEntry('DESCONTO');
  167. $ID_BANCO = new TEntry('ID_BANCO');
  168. $EMAIL_BOLETO = new TEntry('EMAIL_BOLETO');
  169. $ID_REDE = new TEntry('ID_REDE');
  170. $DIA_VENCTO = new TEntry('DIA_VENCTO');
  171. $DIA_VIRADA = new TEntry('DIA_VIRADA');
  172. $ID_FORMA = new TEntry('ID_FORMA');
  173. $MATRICULA = new TEntry('MATRICULA');
  174. $AUTORIZADO1 = new TEntry('AUTORIZADO1');
  175. $AUTORIZADO2 = new TEntry('AUTORIZADO2');
  176. $AUTORIZADO3 = new TEntry('AUTORIZADO3');
  177. $AUTORIZADO4 = new TEntry('AUTORIZADO4');
  178. $AUTORIZADO5 = new TEntry('AUTORIZADO5');
  179. $AUTORIZADO6 = new TEntry('AUTORIZADO6');
  180. $TRANSMITIDO = new TEntry('TRANSMITIDO');
  181. $OBS_SPC1 = new TEntry('OBS_SPC1');
  182. $OBS_SPC2 = new TEntry('OBS_SPC2');
  183. $OBS_SPC3 = new TEntry('OBS_SPC3');
  184. $ROUPA_CALCA = new TEntry('ROUPA_CALCA');
  185. $ROUPA_CAMISA = new TEntry('ROUPA_CAMISA');
  186. $ROUPA_SAPATO = new TEntry('ROUPA_SAPATO');
  187. $ROUPA_BLAZER = new TEntry('ROUPA_BLAZER');
  188. $DIRETORIO = new TText('DIRETORIO');
  189. $DESC_FINANCEIRO = new TEntry('DESC_FINANCEIRO');
  190. $IND_TPAGTO = new TEntry('IND_TPAGTO');
  191. $DESPESAS_CLIENTE = new TEntry('DESPESAS_CLIENTE');
  192. $NOME_USER_LIBEROU = new TEntry('NOME_USER_LIBEROU');
  193. $ID_USER_LIBEROU = new TEntry('ID_USER_LIBEROU');
  194. $MOTIVO_LIBERACAO = new TEntry('MOTIVO_LIBERACAO');
  195. $LIBERA_CREDIARIO = new TEntry('LIBERA_CREDIARIO');
  196. $DATA_HORA_LIBERACAO = new TDate('DATA_HORA_LIBERACAO');
  197. $QUAL_PRECO = new TEntry('QUAL_PRECO');
  198. $CARENCIA = new TEntry('CARENCIA');
  199. $ID_FOTO_A1 = new TEntry('ID_FOTO_A1');
  200. $ID_FOTO_A2 = new TEntry('ID_FOTO_A2');
  201. $ID_FOTO_A3 = new TEntry('ID_FOTO_A3');
  202. $ID_FOTO_A4 = new TEntry('ID_FOTO_A4');
  203. $ID_FOTO_A5 = new TEntry('ID_FOTO_A5');
  204. $ID_FOTO_A6 = new TEntry('ID_FOTO_A6');
  205. $VALOR_AUTORIZADO1 = new TEntry('VALOR_AUTORIZADO1');
  206. $VALOR_AUTORIZADO2 = new TEntry('VALOR_AUTORIZADO2');
  207. $VALOR_AUTORIZADO3 = new TEntry('VALOR_AUTORIZADO3');
  208. $VALOR_AUTORIZADO4 = new TEntry('VALOR_AUTORIZADO4');
  209. $VALOR_AUTORIZADO5 = new TEntry('VALOR_AUTORIZADO5');
  210. $VALOR_AUTORIZADO6 = new TEntry('VALOR_AUTORIZADO6');
  211. $DI_AUTORIZADO1 = new TDate('DI_AUTORIZADO1');
  212. $DI_AUTORIZADO2 = new TDate('DI_AUTORIZADO2');
  213. $DI_AUTORIZADO3 = new TDate('DI_AUTORIZADO3');
  214. $DI_AUTORIZADO4 = new TDate('DI_AUTORIZADO4');
  215. $DI_AUTORIZADO5 = new TDate('DI_AUTORIZADO5');
  216. $DI_AUTORIZADO6 = new TDate('DI_AUTORIZADO6');
  217. $DF_AUTORIZADO1 = new TDate('DF_AUTORIZADO1');
  218. $DF_AUTORIZADO2 = new TDate('DF_AUTORIZADO2');
  219. $DF_AUTORIZADO3 = new TDate('DF_AUTORIZADO3');
  220. $DF_AUTORIZADO4 = new TDate('DF_AUTORIZADO4');
  221. $DF_AUTORIZADO5 = new TDate('DF_AUTORIZADO5');
  222. $DF_AUTORIZADO6 = new TDate('DF_AUTORIZADO6');
  223. $DOC_AUTORIZADO1 = new TEntry('DOC_AUTORIZADO1');
  224. $DOC_AUTORIZADO2 = new TEntry('DOC_AUTORIZADO2');
  225. $DOC_AUTORIZADO3 = new TEntry('DOC_AUTORIZADO3');
  226. $DOC_AUTORIZADO4 = new TEntry('DOC_AUTORIZADO4');
  227. $DOC_AUTORIZADO5 = new TEntry('DOC_AUTORIZADO5');
  228. $DOC_AUTORIZADO6 = new TEntry('DOC_AUTORIZADO6');
  229. $ENDERECO_TRABALHO = new TEntry('ENDERECO_TRABALHO');
  230. $CONTATO_FINANCEIRO = new TEntry('CONTATO_FINANCEIRO');
  231. $FONE_FINANCEIRO = new TEntry('FONE_FINANCEIRO');
  232. $RG_EXPEDICAO = new TDate('RG_EXPEDICAO');
  233. $RG_ORGAO = new TEntry('RG_ORGAO');
  234. $ESCOLARIDADE = new TEntry('ESCOLARIDADE');
  235. $DESC_APOSENTADORIA = new TEntry('DESC_APOSENTADORIA');
  236. $DESC_PENSAO = new TEntry('DESC_PENSAO');
  237. $NRO_APOSENTADORIA = new TEntry('NRO_APOSENTADORIA');
  238. $NRO_PENSAO = new TEntry('NRO_PENSAO');
  239. $NIT = new TEntry('NIT');
  240. $ID_SITUACAO = new TEntry('ID_SITUACAO');
  241. $ID_CONJUGE = new TEntry('ID_CONJUGE');
  242. $ENDERECO_CORRESPONDENCIA = new TEntry('ENDERECO_CORRESPONDENCIA');
  243. $EMPRESA_CNPJ = new TEntry('EMPRESA_CNPJ');
  244. $EMPRESA_VINCULO = new TEntry('EMPRESA_VINCULO');
  245. $EMPRESA_DEPARTAMENTO = new TEntry('EMPRESA_DEPARTAMENTO');
  246. $EMPRESA_TIPO_SALARIO = new TEntry('EMPRESA_TIPO_SALARIO');
  247. $EMPRESA_ORIGEM = new TEntry('EMPRESA_ORIGEM');
  248. $EMPRESA_OUTRAS_RENDAS = new TEntry('EMPRESA_OUTRAS_RENDAS');
  249. $CONJUGE_TELEFONE = new TEntry('CONJUGE_TELEFONE');
  250. $CONJUGE_TEMPO_TRABALHO = new TEntry('CONJUGE_TEMPO_TRABALHO');
  251. $CONJUGE_SALARIO = new TEntry('CONJUGE_SALARIO');
  252. $CONJUGE_END_TRABALHO = new TEntry('CONJUGE_END_TRABALHO');
  253. $CONJUGE_CID_TRABALHO = new TEntry('CONJUGE_CID_TRABALHO');
  254. $CONJUGE_CEP_TRABALHO = new TEntry('CONJUGE_CEP_TRABALHO');
  255. $CONJUGE_DEP_TRABALHO = new TEntry('CONJUGE_DEP_TRABALHO');
  256. $CONJUGE_DATA_ADM = new TDate('CONJUGE_DATA_ADM');
  257. $CONJUGE_RENDA = new TEntry('CONJUGE_RENDA');
  258. $CONJUGE_VINCULO = new TEntry('CONJUGE_VINCULO');
  259. $CONJUGE_TIPO_EMPREGO = new TEntry('CONJUGE_TIPO_EMPREGO');
  260. $CONJUGE_ORIGEM_RENDA = new TEntry('CONJUGE_ORIGEM_RENDA');
  261. $CONJUGE_OUTRAS_RENDAS = new TEntry('CONJUGE_OUTRAS_RENDAS');
  262. $EMPRESA_CEP = new TEntry('EMPRESA_CEP');
  263. $CONJUGE_CNPJ_TRABALHO = new TEntry('CONJUGE_CNPJ_TRABALHO');
  264. $CONJUGE_PROFISSAO = new TEntry('CONJUGE_PROFISSAO');
  265. $LIMITE_DATA_HORA_ALT = new TDate('LIMITE_DATA_HORA_ALT');
  266. $LIMITE_USUARIO_ALT = new TEntry('LIMITE_USUARIO_ALT');
  267. $UNIDADES = new TEntry('UNIDADES');
  268. $CONJUGE_CPF = new TEntry('CONJUGE_CPF');
  269. $CONJUGE_RG = new TEntry('CONJUGE_RG');
  270. $CASAMENTO_DATA = new TDate('CASAMENTO_DATA');
  271. $CASAMENTO_TIPO = new TEntry('CASAMENTO_TIPO');
  272. $FRETE_PAGAR = new TEntry('FRETE_PAGAR');
  273. $ID_MEUS_PEDIDOS = new TEntry('ID_MEUS_PEDIDOS');
  274. $DATA_ALT_MEUS_PEDIDOS = new TDate('DATA_ALT_MEUS_PEDIDOS');
  275. $ERRO_MEUS_PEDIDOS = new TEntry('ERRO_MEUS_PEDIDOS');
  276. if (!empty($ID_CLIENTE))
  277. {
  278. $ID_CLIENTE->setEditable(FALSE);
  279. }
  280. // detail fields
  281. $detail_ID_CIDADE = new THidden('detail_ID_CIDADE');
  282. $detail_DESCRICAO = new TEntry('detail_DESCRICAO');
  283. $detail_UF = new TEntry('detail_UF');
  284. $detail_COD_IBGE = new TEntry('detail_COD_IBGE');
  285. $detail_CEP = new TEntry('detail_CEP');
  286. $detail_ID_USUARIO = new TEntry('detail_ID_USUARIO');
  287. $detail_DATA_HORA_ALT = new TEntry('detail_DATA_HORA_ALT');
  288. $detail_CONCORRENCIA = new TEntry('detail_CONCORRENCIA');
  289. $detail_ID_PAIS = new TEntry('detail_ID_PAIS');
  290. /** samples
  291. $this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2)); // side by side fields
  292. $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
  293. $fieldX->setSize( 100, 40 ); // set size
  294. **/
  295. // master
  296. $table_general->addRowSet( new TLabel('Id Cliente'), $ID_CLIENTE );
  297. $table_general->addRowSet( new TLabel('Codigo'), $CODIGO );
  298. $table_general->addRowSet( new TLabel('Razao Social'), $RAZAO_SOCIAL );
  299. $table_general->addRowSet( new TLabel('Nome Fantasia'), $NOME_FANTASIA );
  300. $table_general->addRowSet( new TLabel('Endereco'), $ENDERECO );
  301. $table_general->addRowSet( new TLabel('Numero'), $NUMERO );
  302. $table_general->addRowSet( new TLabel('Complemento'), $COMPLEMENTO );
  303. $table_general->addRowSet( new TLabel('Bairro'), $BAIRRO );
  304. $table_general->addRowSet( new TLabel('Id Cidade'), $ID_CIDADE );
  305. $table_general->addRowSet( new TLabel('Fone'), $FONE );
  306. $table_general->addRowSet( new TLabel('Fax'), $FAX );
  307. $table_general->addRowSet( new TLabel('Celular'), $CELULAR );
  308. $table_general->addRowSet( new TLabel('Contato'), $CONTATO );
  309. $table_general->addRowSet( new TLabel('Cnpj'), $CNPJ );
  310. $table_general->addRowSet( new TLabel('Inscricao'), $INSCRICAO );
  311. $table_general->addRowSet( new TLabel('Email'), $EMAIL );
  312. $table_general->addRowSet( new TLabel('Cpf'), $CPF );
  313. $table_general->addRowSet( new TLabel('Identidade'), $IDENTIDADE );
  314. $table_general->addRowSet( new TLabel('Titulo Eleitor'), $TITULO_ELEITOR );
  315. $table_general->addRowSet( new TLabel('Cart Profis'), $CART_PROFIS );
  316. $table_general->addRowSet( new TLabel('Cart Serie'), $CART_SERIE );
  317. $table_general->addRowSet( new TLabel('Cart Orgao'), $CART_ORGAO );
  318. $table_general->addRowSet( new TLabel('Filiacao Pai'), $FILIACAO_PAI );
  319. $table_general->addRowSet( new TLabel('Filiacao Mae'), $FILIACAO_MAE );
  320. $table_general->addRowSet( new TLabel('Data Nascimento'), $DATA_NASCIMENTO );
  321. $table_general->addRowSet( new TLabel('Data Cadastro'), $DATA_CADASTRO );
  322. $table_general->addRowSet( new TLabel('Data Alteracao'), $DATA_ALTERACAO );
  323. $table_general->addRowSet( new TLabel('Dependentes'), $DEPENDENTES );
  324. $table_general->addRowSet( new TLabel('Comprovante Endereco'), $COMPROVANTE_ENDERECO );
  325. $table_general->addRowSet( new TLabel('Data Endereco'), $DATA_ENDERECO );
  326. $table_general->addRowSet( new TLabel('Tipo Casa'), $TIPO_CASA );
  327. $table_general->addRowSet( new TLabel('Valor Aluguel'), $VALOR_ALUGUEL );
  328. $table_general->addRowSet( new TLabel('Valor Despesas'), $VALOR_DESPESAS );
  329. $table_general->addRowSet( new TLabel('Abertura Cadastro'), $ABERTURA_CADASTRO );
  330. $table_general->addRowSet( new TLabel('Naturalidade'), $NATURALIDADE );
  331. $table_general->addRowSet( new TLabel('Emprego Anterior'), $EMPREGO_ANTERIOR );
  332. $table_general->addRowSet( new TLabel('Tempo Servico'), $TEMPO_SERVICO );
  333. $table_general->addRowSet( new TLabel('Empresa Nome'), $EMPRESA_NOME );
  334. $table_general->addRowSet( new TLabel('Empresa Id Cidade'), $EMPRESA_ID_CIDADE );
  335. $table_general->addRowSet( new TLabel('Empresa Funcao'), $EMPRESA_FUNCAO );
  336. $table_general->addRowSet( new TLabel('Empresa Admissao'), $EMPRESA_ADMISSAO );
  337. $table_general->addRowSet( new TLabel('Empresa Fone'), $EMPRESA_FONE );
  338. $table_general->addRowSet( new TLabel('Renda Cliente'), $RENDA_CLIENTE );
  339. $table_general->addRowSet( new TLabel('Renda Conjuge'), $RENDA_CONJUGE );
  340. $table_general->addRowSet( new TLabel('Limite Credito'), $LIMITE_CREDITO );
  341. $table_general->addRowSet( new TLabel('Conceito'), $CONCEITO );
  342. $table_general->addRowSet( new TLabel('Estado Civil'), $ESTADO_CIVIL );
  343. $table_general->addRowSet( new TLabel('Sexo'), $SEXO );
  344. $table_general->addRowSet( new TLabel('Situacao'), $SITUACAO );
  345. $table_general->addRowSet( new TLabel('Conjuge Nome'), $CONJUGE_NOME );
  346. $table_general->addRowSet( new TLabel('Conjuge Nascimento'), $CONJUGE_NASCIMENTO );
  347. $table_general->addRowSet( new TLabel('Conjuge Trabalho'), $CONJUGE_TRABALHO );
  348. $table_general->addRowSet( new TLabel('Conjuge Admissao'), $CONJUGE_ADMISSAO );
  349. $table_general->addRowSet( new TLabel('Conjuge Fone'), $CONJUGE_FONE );
  350. $table_general->addRowSet( new TLabel('Entrega Nome'), $ENTREGA_NOME );
  351. $table_general->addRowSet( new TLabel('Entrega Endereco'), $ENTREGA_ENDERECO );
  352. $table_general->addRowSet( new TLabel('Entrega Bairro'), $ENTREGA_BAIRRO );
  353. $table_general->addRowSet( new TLabel('Entrega Id Cidade'), $ENTREGA_ID_CIDADE );
  354. $table_general->addRowSet( new TLabel('Entrega Fone'), $ENTREGA_FONE );
  355. $table_general->addRowSet( new TLabel('Nome Conhecido1'), $NOME_CONHECIDO1 );
  356. $table_general->addRowSet( new TLabel('Nome Conhecido2'), $NOME_CONHECIDO2 );
  357. $table_general->addRowSet( new TLabel('Ref Banco1'), $REF_BANCO1 );
  358. $table_general->addRowSet( new TLabel('Ref Banco2'), $REF_BANCO2 );
  359. $table_general->addRowSet( new TLabel('Ref Banco3'), $REF_BANCO3 );
  360. $table_general->addRowSet( new TLabel('Ref Banco1 Conta'), $REF_BANCO1_CONTA );
  361. $table_general->addRowSet( new TLabel('Ref Banco2 Conta'), $REF_BANCO2_CONTA );
  362. $table_general->addRowSet( new TLabel('Ref Banco3 Conta'), $REF_BANCO3_CONTA );
  363. $table_general->addRowSet( new TLabel('Ref Com Nome1'), $REF_COM_NOME1 );
  364. $table_general->addRowSet( new TLabel('Ref Com Nome2'), $REF_COM_NOME2 );
  365. $table_general->addRowSet( new TLabel('Ref Com Nome3'), $REF_COM_NOME3 );
  366. $table_general->addRowSet( new TLabel('Ref Com Fone1'), $REF_COM_FONE1 );
  367. $table_general->addRowSet( new TLabel('Ref Com Fone2'), $REF_COM_FONE2 );
  368. $table_general->addRowSet( new TLabel('Ref Com Fone3'), $REF_COM_FONE3 );
  369. $table_general->addRowSet( new TLabel('Ref Com Valor1'), $REF_COM_VALOR1 );
  370. $table_general->addRowSet( new TLabel('Ref Com Valor2'), $REF_COM_VALOR2 );
  371. $table_general->addRowSet( new TLabel('Ref Com Valor3'), $REF_COM_VALOR3 );
  372. $table_general->addRowSet( new TLabel('Ref Com Pontualidade1'), $REF_COM_PONTUALIDADE1 );
  373. $table_general->addRowSet( new TLabel('Ref Com Pontualidade2'), $REF_COM_PONTUALIDADE2 );
  374. $table_general->addRowSet( new TLabel('Ref Com Pontualidade3'), $REF_COM_PONTUALIDADE3 );
  375. $table_general->addRowSet( new TLabel('Indicador 1'), $INDICADOR_1 );
  376. $table_general->addRowSet( new TLabel('Indicador 2'), $INDICADOR_2 );
  377. $table_general->addRowSet( new TLabel('Indicador 3'), $INDICADOR_3 );
  378. $table_general->addRowSet( new TLabel('Indicador 4'), $INDICADOR_4 );
  379. $table_general->addRowSet( new TLabel('Indicador 5'), $INDICADOR_5 );
  380. $table_general->addRowSet( new TLabel('Indicador 6'), $INDICADOR_6 );
  381. $table_general->addRowSet( new TLabel('Indicador 7'), $INDICADOR_7 );
  382. $table_general->addRowSet( new TLabel('Indicador 8'), $INDICADOR_8 );
  383. $table_general->addRowSet( new TLabel('Indicador 9'), $INDICADOR_9 );
  384. $table_general->addRowSet( new TLabel('Indicador 10'), $INDICADOR_10 );
  385. $table_general->addRowSet( new TLabel('Spc Data Envio'), $SPC_DATA_ENVIO );
  386. $table_general->addRowSet( new TLabel('Spc Valor Compra'), $SPC_VALOR_COMPRA );
  387. $table_general->addRowSet( new TLabel('Spc Data Baixa'), $SPC_DATA_BAIXA );
  388. $table_general->addRowSet( new TLabel('Serasa Data Envio'), $SERASA_DATA_ENVIO );
  389. $table_general->addRowSet( new TLabel('Serasa Valor Compra'), $SERASA_VALOR_COMPRA );
  390. $table_general->addRowSet( new TLabel('Serasa Data Baixa'), $SERASA_DATA_BAIXA );
  391. $table_general->addRowSet( new TLabel('Outra Data Envio'), $OUTRA_DATA_ENVIO );
  392. $table_general->addRowSet( new TLabel('Outra Valor Compra'), $OUTRA_VALOR_COMPRA );
  393. $table_general->addRowSet( new TLabel('Outra Data Baixa'), $OUTRA_DATA_BAIXA );
  394. $table_general->addRowSet( new TLabel('Observacoes'), $OBSERVACOES );
  395. $table_general->addRowSet( new TLabel('Tabela Preco'), $TABELA_PRECO );
  396. $table_general->addRowSet( new TLabel('Tipo Pagamento'), $TIPO_PAGAMENTO );
  397. $table_general->addRowSet( new TLabel('Forma Pagamento'), $FORMA_PAGAMENTO );
  398. $table_general->addRowSet( new TLabel('Alterar Preco'), $ALTERAR_PRECO );
  399. $table_general->addRowSet( new TLabel('Id Cliente Cobranca'), $ID_CLIENTE_COBRANCA );
  400. $table_general->addRowSet( new TLabel('Ind Tipo Pagamento'), $IND_TIPO_PAGAMENTO );
  401. $table_general->addRowSet( new TLabel('Recebe Cobranca'), $RECEBE_COBRANCA );
  402. $table_general->addRowSet( new TLabel('Cobrar Taxa Cartorio'), $COBRAR_TAXA_CARTORIO );
  403. $table_general->addRowSet( new TLabel('Cobrar Taxa Bancaria'), $COBRAR_TAXA_BANCARIA );
  404. $table_general->addRowSet( new TLabel('Id Usuario'), $ID_USUARIO );
  405. $table_general->addRowSet( new TLabel('Data Hora Alt'), $DATA_HORA_ALT );
  406. $table_general->addRowSet( new TLabel('Id Vendedor'), $ID_VENDEDOR );
  407. $table_general->addRowSet( new TLabel('Id Tipo Atividade'), $ID_TIPO_ATIVIDADE );
  408. $table_general->addRowSet( new TLabel('Id Praca'), $ID_PRACA );
  409. $table_general->addRowSet( new TLabel('Id Empresa'), $ID_EMPRESA );
  410. $table_general->addRowSet( new TLabel('Concorrencia'), $CONCORRENCIA );
  411. $table_general->addRowSet( new TLabel('Email Nfe'), $EMAIL_NFE );
  412. $table_general->addRowSet( new TLabel('Id Foto'), $ID_FOTO );
  413. $table_general->addRowSet( new TLabel('Unidade Venda'), $UNIDADE_VENDA );
  414. $table_general->addRowSet( new TLabel('Id Empresa Nf'), $ID_EMPRESA_NF );
  415. $table_general->addRowSet( new TLabel('Emite Nota'), $EMITE_NOTA );
  416. $table_general->addRowSet( new TLabel('Cep'), $CEP );
  417. $table_general->addRowSet( new TLabel('Id Transportador'), $ID_TRANSPORTADOR );
  418. $table_general->addRowSet( new TLabel('Saldo Credito'), $SALDO_CREDITO );
  419. $table_general->addRowSet( new TLabel('Codigo Convenio'), $CODIGO_CONVENIO );
  420. $table_general->addRowSet( new TLabel('Id Caixa'), $ID_CAIXA );
  421. $table_general->addRowSet( new TLabel('Historico Vendas'), $HISTORICO_VENDAS );
  422. $table_general->addRowSet( new TLabel('Historico Itens'), $HISTORICO_ITENS );
  423. $table_general->addRowSet( new TLabel('Desconto'), $DESCONTO );
  424. $table_general->addRowSet( new TLabel('Id Banco'), $ID_BANCO );
  425. $table_general->addRowSet( new TLabel('Email Boleto'), $EMAIL_BOLETO );
  426. $table_general->addRowSet( new TLabel('Id Rede'), $ID_REDE );
  427. $table_general->addRowSet( new TLabel('Dia Vencto'), $DIA_VENCTO );
  428. $table_general->addRowSet( new TLabel('Dia Virada'), $DIA_VIRADA );
  429. $table_general->addRowSet( new TLabel('Id Forma'), $ID_FORMA );
  430. $table_general->addRowSet( new TLabel('Matricula'), $MATRICULA );
  431. $table_general->addRowSet( new TLabel('Autorizado1'), $AUTORIZADO1 );
  432. $table_general->addRowSet( new TLabel('Autorizado2'), $AUTORIZADO2 );
  433. $table_general->addRowSet( new TLabel('Autorizado3'), $AUTORIZADO3 );
  434. $table_general->addRowSet( new TLabel('Autorizado4'), $AUTORIZADO4 );
  435. $table_general->addRowSet( new TLabel('Autorizado5'), $AUTORIZADO5 );
  436. $table_general->addRowSet( new TLabel('Autorizado6'), $AUTORIZADO6 );
  437. $table_general->addRowSet( new TLabel('Transmitido'), $TRANSMITIDO );
  438. $table_general->addRowSet( new TLabel('Obs Spc1'), $OBS_SPC1 );
  439. $table_general->addRowSet( new TLabel('Obs Spc2'), $OBS_SPC2 );
  440. $table_general->addRowSet( new TLabel('Obs Spc3'), $OBS_SPC3 );
  441. $table_general->addRowSet( new TLabel('Roupa Calca'), $ROUPA_CALCA );
  442. $table_general->addRowSet( new TLabel('Roupa Camisa'), $ROUPA_CAMISA );
  443. $table_general->addRowSet( new TLabel('Roupa Sapato'), $ROUPA_SAPATO );
  444. $table_general->addRowSet( new TLabel('Roupa Blazer'), $ROUPA_BLAZER );
  445. $table_general->addRowSet( new TLabel('Diretorio'), $DIRETORIO );
  446. $table_general->addRowSet( new TLabel('Desc Financeiro'), $DESC_FINANCEIRO );
  447. $table_general->addRowSet( new TLabel('Ind Tpagto'), $IND_TPAGTO );
  448. $table_general->addRowSet( new TLabel('Despesas Cliente'), $DESPESAS_CLIENTE );
  449. $table_general->addRowSet( new TLabel('Nome User Liberou'), $NOME_USER_LIBEROU );
  450. $table_general->addRowSet( new TLabel('Id User Liberou'), $ID_USER_LIBEROU );
  451. $table_general->addRowSet( new TLabel('Motivo Liberacao'), $MOTIVO_LIBERACAO );
  452. $table_general->addRowSet( new TLabel('Libera Crediario'), $LIBERA_CREDIARIO );
  453. $table_general->addRowSet( new TLabel('Data Hora Liberacao'), $DATA_HORA_LIBERACAO );
  454. $table_general->addRowSet( new TLabel('Qual Preco'), $QUAL_PRECO );
  455. $table_general->addRowSet( new TLabel('Carencia'), $CARENCIA );
  456. $table_general->addRowSet( new TLabel('Id Foto A1'), $ID_FOTO_A1 );
  457. $table_general->addRowSet( new TLabel('Id Foto A2'), $ID_FOTO_A2 );
  458. $table_general->addRowSet( new TLabel('Id Foto A3'), $ID_FOTO_A3 );
  459. $table_general->addRowSet( new TLabel('Id Foto A4'), $ID_FOTO_A4 );
  460. $table_general->addRowSet( new TLabel('Id Foto A5'), $ID_FOTO_A5 );
  461. $table_general->addRowSet( new TLabel('Id Foto A6'), $ID_FOTO_A6 );
  462. $table_general->addRowSet( new TLabel('Valor Autorizado1'), $VALOR_AUTORIZADO1 );
  463. $table_general->addRowSet( new TLabel('Valor Autorizado2'), $VALOR_AUTORIZADO2 );
  464. $table_general->addRowSet( new TLabel('Valor Autorizado3'), $VALOR_AUTORIZADO3 );
  465. $table_general->addRowSet( new TLabel('Valor Autorizado4'), $VALOR_AUTORIZADO4 );
  466. $table_general->addRowSet( new TLabel('Valor Autorizado5'), $VALOR_AUTORIZADO5 );
  467. $table_general->addRowSet( new TLabel('Valor Autorizado6'), $VALOR_AUTORIZADO6 );
  468. $table_general->addRowSet( new TLabel('Di Autorizado1'), $DI_AUTORIZADO1 );
  469. $table_general->addRowSet( new TLabel('Di Autorizado2'), $DI_AUTORIZADO2 );
  470. $table_general->addRowSet( new TLabel('Di Autorizado3'), $DI_AUTORIZADO3 );
  471. $table_general->addRowSet( new TLabel('Di Autorizado4'), $DI_AUTORIZADO4 );
  472. $table_general->addRowSet( new TLabel('Di Autorizado5'), $DI_AUTORIZADO5 );
  473. $table_general->addRowSet( new TLabel('Di Autorizado6'), $DI_AUTORIZADO6 );
  474. $table_general->addRowSet( new TLabel('Df Autorizado1'), $DF_AUTORIZADO1 );
  475. $table_general->addRowSet( new TLabel('Df Autorizado2'), $DF_AUTORIZADO2 );
  476. $table_general->addRowSet( new TLabel('Df Autorizado3'), $DF_AUTORIZADO3 );
  477. $table_general->addRowSet( new TLabel('Df Autorizado4'), $DF_AUTORIZADO4 );
  478. $table_general->addRowSet( new TLabel('Df Autorizado5'), $DF_AUTORIZADO5 );
  479. $table_general->addRowSet( new TLabel('Df Autorizado6'), $DF_AUTORIZADO6 );
  480. $table_general->addRowSet( new TLabel('Doc Autorizado1'), $DOC_AUTORIZADO1 );
  481. $table_general->addRowSet( new TLabel('Doc Autorizado2'), $DOC_AUTORIZADO2 );
  482. $table_general->addRowSet( new TLabel('Doc Autorizado3'), $DOC_AUTORIZADO3 );
  483. $table_general->addRowSet( new TLabel('Doc Autorizado4'), $DOC_AUTORIZADO4 );
  484. $table_general->addRowSet( new TLabel('Doc Autorizado5'), $DOC_AUTORIZADO5 );
  485. $table_general->addRowSet( new TLabel('Doc Autorizado6'), $DOC_AUTORIZADO6 );
  486. $table_general->addRowSet( new TLabel('Endereco Trabalho'), $ENDERECO_TRABALHO );
  487. $table_general->addRowSet( new TLabel('Contato Financeiro'), $CONTATO_FINANCEIRO );
  488. $table_general->addRowSet( new TLabel('Fone Financeiro'), $FONE_FINANCEIRO );
  489. $table_general->addRowSet( new TLabel('Rg Expedicao'), $RG_EXPEDICAO );
  490. $table_general->addRowSet( new TLabel('Rg Orgao'), $RG_ORGAO );
  491. $table_general->addRowSet( new TLabel('Escolaridade'), $ESCOLARIDADE );
  492. $table_general->addRowSet( new TLabel('Desc Aposentadoria'), $DESC_APOSENTADORIA );
  493. $table_general->addRowSet( new TLabel('Desc Pensao'), $DESC_PENSAO );
  494. $table_general->addRowSet( new TLabel('Nro Aposentadoria'), $NRO_APOSENTADORIA );
  495. $table_general->addRowSet( new TLabel('Nro Pensao'), $NRO_PENSAO );
  496. $table_general->addRowSet( new TLabel('Nit'), $NIT );
  497. $table_general->addRowSet( new TLabel('Id Situacao'), $ID_SITUACAO );
  498. $table_general->addRowSet( new TLabel('Id Conjuge'), $ID_CONJUGE );
  499. $table_general->addRowSet( new TLabel('Endereco Correspondencia'), $ENDERECO_CORRESPONDENCIA );
  500. $table_general->addRowSet( new TLabel('Empresa Cnpj'), $EMPRESA_CNPJ );
  501. $table_general->addRowSet( new TLabel('Empresa Vinculo'), $EMPRESA_VINCULO );
  502. $table_general->addRowSet( new TLabel('Empresa Departamento'), $EMPRESA_DEPARTAMENTO );
  503. $table_general->addRowSet( new TLabel('Empresa Tipo Salario'), $EMPRESA_TIPO_SALARIO );
  504. $table_general->addRowSet( new TLabel('Empresa Origem'), $EMPRESA_ORIGEM );
  505. $table_general->addRowSet( new TLabel('Empresa Outras Rendas'), $EMPRESA_OUTRAS_RENDAS );
  506. $table_general->addRowSet( new TLabel('Conjuge Telefone'), $CONJUGE_TELEFONE );
  507. $table_general->addRowSet( new TLabel('Conjuge Tempo Trabalho'), $CONJUGE_TEMPO_TRABALHO );
  508. $table_general->addRowSet( new TLabel('Conjuge Salario'), $CONJUGE_SALARIO );
  509. $table_general->addRowSet( new TLabel('Conjuge End Trabalho'), $CONJUGE_END_TRABALHO );
  510. $table_general->addRowSet( new TLabel('Conjuge Cid Trabalho'), $CONJUGE_CID_TRABALHO );
  511. $table_general->addRowSet( new TLabel('Conjuge Cep Trabalho'), $CONJUGE_CEP_TRABALHO );
  512. $table_general->addRowSet( new TLabel('Conjuge Dep Trabalho'), $CONJUGE_DEP_TRABALHO );
  513. $table_general->addRowSet( new TLabel('Conjuge Data Adm'), $CONJUGE_DATA_ADM );
  514. $table_general->addRowSet( new TLabel('Conjuge Renda'), $CONJUGE_RENDA );
  515. $table_general->addRowSet( new TLabel('Conjuge Vinculo'), $CONJUGE_VINCULO );
  516. $table_general->addRowSet( new TLabel('Conjuge Tipo Emprego'), $CONJUGE_TIPO_EMPREGO );
  517. $table_general->addRowSet( new TLabel('Conjuge Origem Renda'), $CONJUGE_ORIGEM_RENDA );
  518. $table_general->addRowSet( new TLabel('Conjuge Outras Rendas'), $CONJUGE_OUTRAS_RENDAS );
  519. $table_general->addRowSet( new TLabel('Empresa Cep'), $EMPRESA_CEP );
  520. $table_general->addRowSet( new TLabel('Conjuge Cnpj Trabalho'), $CONJUGE_CNPJ_TRABALHO );
  521. $table_general->addRowSet( new TLabel('Conjuge Profissao'), $CONJUGE_PROFISSAO );
  522. $table_general->addRowSet( new TLabel('Limite Data Hora Alt'), $LIMITE_DATA_HORA_ALT );
  523. $table_general->addRowSet( new TLabel('Limite Usuario Alt'), $LIMITE_USUARIO_ALT );
  524. $table_general->addRowSet( new TLabel('Unidades'), $UNIDADES );
  525. $table_general->addRowSet( new TLabel('Conjuge Cpf'), $CONJUGE_CPF );
  526. $table_general->addRowSet( new TLabel('Conjuge Rg'), $CONJUGE_RG );
  527. $table_general->addRowSet( new TLabel('Casamento Data'), $CASAMENTO_DATA );
  528. $table_general->addRowSet( new TLabel('Casamento Tipo'), $CASAMENTO_TIPO );
  529. $table_general->addRowSet( new TLabel('Frete Pagar'), $FRETE_PAGAR );
  530. $table_general->addRowSet( new TLabel('Id Meus Pedidos'), $ID_MEUS_PEDIDOS );
  531. $table_general->addRowSet( new TLabel('Data Alt Meus Pedidos'), $DATA_ALT_MEUS_PEDIDOS );
  532. $table_general->addRowSet( new TLabel('Erro Meus Pedidos'), $ERRO_MEUS_PEDIDOS );
  533. // detail
  534. $frame_details = new TFrame();
  535. $frame_details->setLegend('Cidade');
  536. $row = $table_detail->addRow();
  537. $row->addCell($frame_details);
  538. $btn_save_detail = new TButton('btn_save_detail');
  539. $btn_save_detail->setAction(new TAction(array($this, 'onSaveDetail')), 'Register');
  540. $btn_save_detail->setImage('fa:save');
  541. $table_details = new TTable;
  542. $frame_details->add($table_details);
  543. $table_details->addRowSet( '', $detail_ID_CIDADE );
  544. $table_details->addRowSet( new TLabel('Descricao'), $detail_DESCRICAO );
  545. $table_details->addRowSet( new TLabel('Uf'), $detail_UF );
  546. $table_details->addRowSet( new TLabel('Cod Ibge'), $detail_COD_IBGE );
  547. $table_details->addRowSet( new TLabel('Cep'), $detail_CEP );
  548. $table_details->addRowSet( new TLabel('Id Usuario'), $detail_ID_USUARIO );
  549. $table_details->addRowSet( new TLabel('Data Hora Alt'), $detail_DATA_HORA_ALT );
  550. $table_details->addRowSet( new TLabel('Concorrencia'), $detail_CONCORRENCIA );
  551. $table_details->addRowSet( new TLabel('Id Pais'), $detail_ID_PAIS );
  552. $table_details->addRowSet( $btn_save_detail );
  553. $this->detail_list = new TQuickGrid;
  554. $this->detail_list->setHeight( 175 );
  555. $this->detail_list->makeScrollable();
  556. $this->detail_list->disableDefaultClick();
  557. $this->detail_list->addQuickColumn('', 'edit', 'left', 50);
  558. $this->detail_list->addQuickColumn('', 'delete', 'left', 50);
  559. // items
  560. $this->detail_list->addQuickColumn('Descricao', 'DESCRICAO', 'left', 200);
  561. $this->detail_list->addQuickColumn('Uf', 'UF', 'left', 200);
  562. $this->detail_list->addQuickColumn('Cod Ibge', 'COD_IBGE', 'left', 200);
  563. $this->detail_list->addQuickColumn('Cep', 'CEP', 'left', 200);
  564. $this->detail_list->addQuickColumn('Id Usuario', 'ID_USUARIO', 'left', 100);
  565. $this->detail_list->addQuickColumn('Data Hora Alt', 'DATA_HORA_ALT', 'left', 200);
  566. $this->detail_list->addQuickColumn('Concorrencia', 'CONCORRENCIA', 'left', 100);
  567. $this->detail_list->addQuickColumn('Id Pais', 'ID_PAIS', 'left', 100);
  568. $this->detail_list->createModel();
  569. $row = $table_detail->addRow();
  570. $row->addCell($this->detail_list);
  571. // create an action button (save)
  572. $save_button=new TButton('save');
  573. $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
  574. $save_button->setImage('ico_save.png');
  575. // create an new button (edit with no parameters)
  576. $new_button=new TButton('new');
  577. $new_button->setAction(new TAction(array($this, 'onClear')), _t('New'));
  578. $new_button->setImage('ico_new.png');
  579. // define form fields
  580. $this->formFields = array($ID_CLIENTE,$CODIGO,$RAZAO_SOCIAL,$NOME_FANTASIA,$ENDERECO,$NUMERO,$COMPLEMENTO,$BAIRRO,$ID_CIDADE,$FONE,$FAX,$CELULAR,$CONTATO,$CNPJ,$INSCRICAO,$EMAIL,$CPF,$IDENTIDADE,$TITULO_ELEITOR,$CART_PROFIS,$CART_SERIE,$CART_ORGAO,$FILIACAO_PAI,$FILIACAO_MAE,$DATA_NASCIMENTO,$DATA_CADASTRO,$DATA_ALTERACAO,$DEPENDENTES,$COMPROVANTE_ENDERECO,$DATA_ENDERECO,$TIPO_CASA,$VALOR_ALUGUEL,$VALOR_DESPESAS,$ABERTURA_CADASTRO,$NATURALIDADE,$EMPREGO_ANTERIOR,$TEMPO_SERVICO,$EMPRESA_NOME,$EMPRESA_ID_CIDADE,$EMPRESA_FUNCAO,$EMPRESA_ADMISSAO,$EMPRESA_FONE,$RENDA_CLIENTE,$RENDA_CONJUGE,$LIMITE_CREDITO,$CONCEITO,$ESTADO_CIVIL,$SEXO,$SITUACAO,$CONJUGE_NOME,$CONJUGE_NASCIMENTO,$CONJUGE_TRABALHO,$CONJUGE_ADMISSAO,$CONJUGE_FONE,$ENTREGA_NOME,$ENTREGA_ENDERECO,$ENTREGA_BAIRRO,$ENTREGA_ID_CIDADE,$ENTREGA_FONE,$NOME_CONHECIDO1,$NOME_CONHECIDO2,$REF_BANCO1,$REF_BANCO2,$REF_BANCO3,$REF_BANCO1_CONTA,$REF_BANCO2_CONTA,$REF_BANCO3_CONTA,$REF_COM_NOME1,$REF_COM_NOME2,$REF_COM_NOME3,$REF_COM_FONE1,$REF_COM_FONE2,$REF_COM_FONE3,$REF_COM_VALOR1,$REF_COM_VALOR2,$REF_COM_VALOR3,$REF_COM_PONTUALIDADE1,$REF_COM_PONTUALIDADE2,$REF_COM_PONTUALIDADE3,$INDICADOR_1,$INDICADOR_2,$INDICADOR_3,$INDICADOR_4,$INDICADOR_5,$INDICADOR_6,$INDICADOR_7,$INDICADOR_8,$INDICADOR_9,$INDICADOR_10,$SPC_DATA_ENVIO,$SPC_VALOR_COMPRA,$SPC_DATA_BAIXA,$SERASA_DATA_ENVIO,$SERASA_VALOR_COMPRA,$SERASA_DATA_BAIXA,$OUTRA_DATA_ENVIO,$OUTRA_VALOR_COMPRA,$OUTRA_DATA_BAIXA,$OBSERVACOES,$TABELA_PRECO,$TIPO_PAGAMENTO,$FORMA_PAGAMENTO,$ALTERAR_PRECO,$ID_CLIENTE_COBRANCA,$IND_TIPO_PAGAMENTO,$RECEBE_COBRANCA,$COBRAR_TAXA_CARTORIO,$COBRAR_TAXA_BANCARIA,$ID_USUARIO,$DATA_HORA_ALT,$ID_VENDEDOR,$ID_TIPO_ATIVIDADE,$ID_PRACA,$ID_EMPRESA,$CONCORRENCIA,$EMAIL_NFE,$ID_FOTO,$UNIDADE_VENDA,$ID_EMPRESA_NF,$EMITE_NOTA,$CEP,$ID_TRANSPORTADOR,$SALDO_CREDITO,$CODIGO_CONVENIO,$ID_CAIXA,$HISTORICO_VENDAS,$HISTORICO_ITENS,$DESCONTO,$ID_BANCO,$EMAIL_BOLETO,$ID_REDE,$DIA_VENCTO,$DIA_VIRADA,$ID_FORMA,$MATRICULA,$AUTORIZADO1,$AUTORIZADO2,$AUTORIZADO3,$AUTORIZADO4,$AUTORIZADO5,$AUTORIZADO6,$TRANSMITIDO,$OBS_SPC1,$OBS_SPC2,$OBS_SPC3,$ROUPA_CALCA,$ROUPA_CAMISA,$ROUPA_SAPATO,$ROUPA_BLAZER,$DIRETORIO,$DESC_FINANCEIRO,$IND_TPAGTO,$DESPESAS_CLIENTE,$NOME_USER_LIBEROU,$ID_USER_LIBEROU,$MOTIVO_LIBERACAO,$LIBERA_CREDIARIO,$DATA_HORA_LIBERACAO,$QUAL_PRECO,$CARENCIA,$ID_FOTO_A1,$ID_FOTO_A2,$ID_FOTO_A3,$ID_FOTO_A4,$ID_FOTO_A5,$ID_FOTO_A6,$VALOR_AUTORIZADO1,$VALOR_AUTORIZADO2,$VALOR_AUTORIZADO3,$VALOR_AUTORIZADO4,$VALOR_AUTORIZADO5,$VALOR_AUTORIZADO6,$DI_AUTORIZADO1,$DI_AUTORIZADO2,$DI_AUTORIZADO3,$DI_AUTORIZADO4,$DI_AUTORIZADO5,$DI_AUTORIZADO6,$DF_AUTORIZADO1,$DF_AUTORIZADO2,$DF_AUTORIZADO3,$DF_AUTORIZADO4,$DF_AUTORIZADO5,$DF_AUTORIZADO6,$DOC_AUTORIZADO1,$DOC_AUTORIZADO2,$DOC_AUTORIZADO3,$DOC_AUTORIZADO4,$DOC_AUTORIZADO5,$DOC_AUTORIZADO6,$ENDERECO_TRABALHO,$CONTATO_FINANCEIRO,$FONE_FINANCEIRO,$RG_EXPEDICAO,$RG_ORGAO,$ESCOLARIDADE,$DESC_APOSENTADORIA,$DESC_PENSAO,$NRO_APOSENTADORIA,$NRO_PENSAO,$NIT,$ID_SITUACAO,$ID_CONJUGE,$ENDERECO_CORRESPONDENCIA,$EMPRESA_CNPJ,$EMPRESA_VINCULO,$EMPRESA_DEPARTAMENTO,$EMPRESA_TIPO_SALARIO,$EMPRESA_ORIGEM,$EMPRESA_OUTRAS_RENDAS,$CONJUGE_TELEFONE,$CONJUGE_TEMPO_TRABALHO,$CONJUGE_SALARIO,$CONJUGE_END_TRABALHO,$CONJUGE_CID_TRABALHO,$CONJUGE_CEP_TRABALHO,$CONJUGE_DEP_TRABALHO,$CONJUGE_DATA_ADM,$CONJUGE_RENDA,$CONJUGE_VINCULO,$CONJUGE_TIPO_EMPREGO,$CONJUGE_ORIGEM_RENDA,$CONJUGE_OUTRAS_RENDAS,$EMPRESA_CEP,$CONJUGE_CNPJ_TRABALHO,$CONJUGE_PROFISSAO,$LIMITE_DATA_HORA_ALT,$LIMITE_USUARIO_ALT,$UNIDADES,$CONJUGE_CPF,$CONJUGE_RG,$CASAMENTO_DATA,$CASAMENTO_TIPO,$FRETE_PAGAR,$ID_MEUS_PEDIDOS,$DATA_ALT_MEUS_PEDIDOS,$ERRO_MEUS_PEDIDOS,$detail_DESCRICAO,$detail_UF,$detail_COD_IBGE,$detail_CEP,$detail_ID_USUARIO,$detail_DATA_HORA_ALT,$detail_CONCORRENCIA,$detail_ID_PAIS);
  581. $this->formFields[] = $btn_save_detail;
  582. $this->formFields[] = $save_button;
  583. $this->formFields[] = $new_button;
  584. $this->formFields[] = $detail_ID_CIDADE;
  585. $this->form->setFields( $this->formFields );
  586. $table_master->addRowSet( array($save_button, $new_button), '', '')->class = 'tformaction'; // CSS class
  587. // create the page container
  588. $container = new TVBox;
  589. $container->style = 'width: 90%';
  590. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  591. $container->add($this->form);
  592. parent::add($container);
  593. }
  594. /**
  595. * Clear form
  596. * @param $param URL parameters
  597. */
  598. public function onClear($param)
  599. {
  600. $this->form->clear();
  601. TSession::setValue(__CLASS__.'_items', array());
  602. $this->onReload( $param );
  603. }
  604. /**
  605. * Save an item from form to session list
  606. * @param $param URL parameters
  607. */
  608. public function onSaveDetail( $param )
  609. {
  610. try
  611. {
  612. TTransaction::open('conexao');
  613. $data = $this->form->getData();
  614. /** validation sample
  615. if (! $data->fieldX)
  616. throw new Exception('The field fieldX is required');
  617. **/
  618. $items = TSession::getValue(__CLASS__.'_items');
  619. $key = empty($data->detail_ID_CIDADE) ? 'X'.mt_rand(1000000000, 1999999999) : $data->detail_ID_CIDADE;
  620. $items[ $key ] = array();
  621. $items[ $key ]['ID_CIDADE'] = $key;
  622. $items[ $key ]['DESCRICAO'] = $data->detail_DESCRICAO;
  623. $items[ $key ]['UF'] = $data->detail_UF;
  624. $items[ $key ]['COD_IBGE'] = $data->detail_COD_IBGE;
  625. $items[ $key ]['CEP'] = $data->detail_CEP;
  626. $items[ $key ]['ID_USUARIO'] = $data->detail_ID_USUARIO;
  627. $items[ $key ]['DATA_HORA_ALT'] = $data->detail_DATA_HORA_ALT;
  628. $items[ $key ]['CONCORRENCIA'] = $data->detail_CONCORRENCIA;
  629. $items[ $key ]['ID_PAIS'] = $data->detail_ID_PAIS;
  630. TSession::setValue(__CLASS__.'_items', $items);
  631. // clear detail form fields
  632. $data->detail_ID_CIDADE = '';
  633. $data->detail_DESCRICAO = '';
  634. $data->detail_UF = '';
  635. $data->detail_COD_IBGE = '';
  636. $data->detail_CEP = '';
  637. $data->detail_ID_USUARIO = '';
  638. $data->detail_DATA_HORA_ALT = '';
  639. $data->detail_CONCORRENCIA = '';
  640. $data->detail_ID_PAIS = '';
  641. TTransaction::close();
  642. $this->form->setData($data);
  643. $this->onReload( $param ); // reload the items
  644. }
  645. catch (Exception $e)
  646. {
  647. $this->form->setData( $this->form->getData());
  648. new TMessage('error', $e->getMessage());
  649. }
  650. }
  651. /**
  652. * Load an item from session list to detail form
  653. * @param $param URL parameters
  654. */
  655. public function onEditDetail( $param )
  656. {
  657. $data = $this->form->getData();
  658. // read session items
  659. $items = TSession::getValue(__CLASS__.'_items');
  660. // get the session item
  661. $item = $items[ $param['item_key'] ];
  662. $data->detail_ID_CIDADE = $item['ID_CIDADE'];
  663. $data->detail_DESCRICAO = $item['DESCRICAO'];
  664. $data->detail_UF = $item['UF'];
  665. $data->detail_COD_IBGE = $item['COD_IBGE'];
  666. $data->detail_CEP = $item['CEP'];
  667. $data->detail_ID_USUARIO = $item['ID_USUARIO'];
  668. $data->detail_DATA_HORA_ALT = $item['DATA_HORA_ALT'];
  669. $data->detail_CONCORRENCIA = $item['CONCORRENCIA'];
  670. $data->detail_ID_PAIS = $item['ID_PAIS'];
  671. // fill detail fields
  672. $this->form->setData( $data );
  673. $this->onReload( $param );
  674. }
  675. /**
  676. * Delete an item from session list
  677. * @param $param URL parameters
  678. */
  679. public function onDeleteDetail( $param )
  680. {
  681. $data = $this->form->getData();
  682. // reset items
  683. $data->detail_DESCRICAO = '';
  684. $data->detail_UF = '';
  685. $data->detail_COD_IBGE = '';
  686. $data->detail_CEP = '';
  687. $data->detail_ID_USUARIO = '';
  688. $data->detail_DATA_HORA_ALT = '';
  689. $data->detail_CONCORRENCIA = '';
  690. $data->detail_ID_PAIS = '';
  691. // clear form data
  692. $this->form->setData( $data );
  693. // read session items
  694. $items = TSession::getValue(__CLASS__.'_items');
  695. // delete the item from session
  696. unset($items[ $param['item_key'] ] );
  697. TSession::setValue(__CLASS__.'_items', $items);
  698. // reload items
  699. $this->onReload( $param );
  700. }
  701. /**
  702. * Load the items list from session
  703. * @param $param URL parameters
  704. */
  705. public function onReload($param)
  706. {
  707. // read session items
  708. $items = TSession::getValue(__CLASS__.'_items');
  709. $this->detail_list->clear(); // clear detail list
  710. $data = $this->form->getData();
  711. if ($items)
  712. {
  713. $cont = 1;
  714. foreach ($items as $list_item_key => $list_item)
  715. {
  716. $item_name = 'prod_' . $cont++;
  717. $item = new StdClass;
  718. // create action buttons
  719. $action_del = new TAction(array($this, 'onDeleteDetail'));
  720. $action_del->setParameter('item_key', $list_item_key);
  721. $action_edi = new TAction(array($this, 'onEditDetail'));
  722. $action_edi->setParameter('item_key', $list_item_key);
  723. $button_del = new TButton('delete_detail'.$cont);
  724. $button_del->class = 'btn btn-default btn-sm';
  725. $button_del->setAction( $action_del, '' );
  726. $button_del->setImage('fa:trash-o red fa-lg');
  727. $button_edi = new TButton('edit_detail'.$cont);
  728. $button_edi->class = 'btn btn-default btn-sm';
  729. $button_edi->setAction( $action_edi, '' );
  730. $button_edi->setImage('fa:edit blue fa-lg');
  731. $item->edit = $button_edi;
  732. $item->delete = $button_del;
  733. $this->formFields[ $item_name.'_edit' ] = $item->edit;
  734. $this->formFields[ $item_name.'_delete' ] = $item->delete;
  735. // items
  736. $item->ID_CIDADE = $list_item['ID_CIDADE'];
  737. $item->DESCRICAO = $list_item['DESCRICAO'];
  738. $item->UF = $list_item['UF'];
  739. $item->COD_IBGE = $list_item['COD_IBGE'];
  740. $item->CEP = $list_item['CEP'];
  741. $item->ID_USUARIO = $list_item['ID_USUARIO'];
  742. $item->DATA_HORA_ALT = $list_item['DATA_HORA_ALT'];
  743. $item->CONCORRENCIA = $list_item['CONCORRENCIA'];
  744. $item->ID_PAIS = $list_item['ID_PAIS'];
  745. $row = $this->detail_list->addItem( $item );
  746. $row->onmouseover='';
  747. $row->onmouseout='';
  748. }
  749. $this->form->setFields( $this->formFields );
  750. }
  751. $this->loaded = TRUE;
  752. }
  753. /**
  754. * Load Master/Detail data from database to form/session
  755. */
  756. public function onEdit($param)
  757. {
  758. try
  759. {
  760. TTransaction::open('conexao');
  761. if (isset($param['key']))
  762. {
  763. $key = $param['key'];
  764. $object = new Cliente($key);
  765. $items = Cidade::where('ID_CIDADE', '=', $key)->load();
  766. $session_items = array();
  767. foreach( $items as $item )
  768. {
  769. $item_key = $item->ID_CIDADE;
  770. $session_items[$item_key] = $item->toArray();
  771. $session_items[$item_key]['ID_CIDADE'] = $item->ID_CIDADE;
  772. $session_items[$item_key]['DESCRICAO'] = $item->DESCRICAO;
  773. $session_items[$item_key]['UF'] = $item->UF;
  774. $session_items[$item_key]['COD_IBGE'] = $item->COD_IBGE;
  775. $session_items[$item_key]['CEP'] = $item->CEP;
  776. $session_items[$item_key]['ID_USUARIO'] = $item->ID_USUARIO;
  777. $session_items[$item_key]['DATA_HORA_ALT'] = $item->DATA_HORA_ALT;
  778. $session_items[$item_key]['CONCORRENCIA'] = $item->CONCORRENCIA;
  779. $session_items[$item_key]['ID_PAIS'] = $item->ID_PAIS;
  780. }
  781. TSession::setValue(__CLASS__.'_items', $session_items);
  782. $this->form->setData($object); // fill the form with the active record data
  783. $this->onReload( $param ); // reload items list
  784. TTransaction::close(); // close transaction
  785. }
  786. else
  787. {
  788. $this->form->clear();
  789. TSession::setValue(__CLASS__.'_items', null);
  790. $this->onReload( $param );
  791. }
  792. }
  793. catch (Exception $e) // in case of exception
  794. {
  795. new TMessage('error', $e->getMessage());
  796. TTransaction::rollback();
  797. }
  798. }
  799. /**
  800. * Save the Master/Detail data from form/session to database
  801. */
  802. public function onSave()
  803. {
  804. try
  805. {
  806. // open a transaction with database
  807. TTransaction::open('conexao');
  808. $data = $this->form->getData();
  809. $master = new Cliente;
  810. $master->fromArray( (array) $data);
  811. $this->form->validate(); // form validation
  812. $master->store(); // save master object
  813. // delete details
  814. $old_items = Cidade::where('ID_CIDADE', '=', $master->ID_CLIENTE)->load();
  815. $keep_items = array();
  816. // get session items
  817. $items = TSession::getValue(__CLASS__.'_items');
  818. if( $items )
  819. {
  820. foreach( $items as $item )
  821. {
  822. if (substr($item['ID_CIDADE'],0,1) == 'X' ) // new record
  823. {
  824. $detail = new Cidade;
  825. }
  826. else
  827. {
  828. $detail = Cidade::find($item['ID_CIDADE']);
  829. }
  830. $detail->DESCRICAO = $item['DESCRICAO'];
  831. $detail->UF = $item['UF'];
  832. $detail->COD_IBGE = $item['COD_IBGE'];
  833. $detail->CEP = $item['CEP'];
  834. $detail->ID_USUARIO = $item['ID_USUARIO'];
  835. $detail->DATA_HORA_ALT = $item['DATA_HORA_ALT'];
  836. $detail->CONCORRENCIA = $item['CONCORRENCIA'];
  837. $detail->ID_PAIS = $item['ID_PAIS'];
  838. $detail->ID_CIDADE = $master->ID_CLIENTE;
  839. $detail->store();
  840. $keep_items[] = $detail->ID_CIDADE;
  841. }
  842. }
  843. if ($old_items)
  844. {
  845. foreach ($old_items as $old_item)
  846. {
  847. if (!in_array( $old_item->ID_CIDADE, $keep_items))
  848. {
  849. $old_item->delete();
  850. }
  851. }
  852. }
  853. TTransaction::close(); // close the transaction
  854. // reload form and session items
  855. $this->onEdit(array('key'=>$master->ID_CLIENTE));
  856. new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
  857. }
  858. catch (Exception $e) // in case of exception
  859. {
  860. new TMessage('error', $e->getMessage());
  861. $this->form->setData( $this->form->getData() ); // keep form data
  862. TTransaction::rollback();
  863. }
  864. }
  865. /**
  866. * Show the page
  867. */
  868. public function show()
  869. {</your>
LG

Fiz assim no arquivo que estou utilizando:

ClientList.class.php aonde quero que seja efetuado a abertura da janela popup:

 
  1. <?php
  2. class Cliente extends TRecord
  3. {
  4. const TABLENAME = 'cliente';
  5. const PRIMARYKEY= 'id';
  6. const IDPOLICY = 'max'; // {max, serial}
  7. public function get_situacao_cli()
  8. {
  9. $nomes = array('A'=>'Ativo', 'B'=>'Bloqueado','I'=>'Inativo');
  10. return $nomes[$this->SITUACAO];
  11. }
  12. public function set_unidadefederacao(Cidade $object)
  13. {
  14. $this->unidadefederacao = $object;
  15. $this-> ID_CIDADE= $object->ID; //Seu erro está aqui!!! ***
  16. }
  17. public function get_unidadefederacao()
  18. {
  19. // loads the associated object
  20. if (empty($this->unidadefederacao))
  21. $this->unidadefederacao = new cidade($this->ID_CIDADE); // E aqui!!!***
  22. // returns the associated object
  23. return $this->unidadefederacao;
  24. }
  25. }
  26. function onView($param)
  27. {
  28. // get the parameter and shows the message
  29. $key=$param['key'];
  30. new TMessage('info', "The name is : $key");
  31. }
  32. ?>



 
  1. <?php
  2. /**
  3. * ClienteList Listing
  4. * @author <your name here>
  5. */
  6. class ClienteList extends TStandardList
  7. {
  8. protected $form; // registration form
  9. protected $datagrid; // listing
  10. protected $pageNavigation;
  11. protected $formgrid;
  12. protected $deleteButton;
  13. protected $transformCallback;
  14. /**
  15. * Page constructor
  16. */
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. parent::setDatabase('conexao'); // defines the database
  21. parent::setActiveRecord('Cliente'); // defines the active record
  22. parent::setDefaultOrder('ID_CLIENTE', 'asc'); // defines the default order
  23. // parent::setCriteria($criteria) // define a standard filter
  24. parent::addFilterField('CODIGO', '=', 'CODIGO'); // filterField, operator, formField
  25. parent::addFilterField('RAZAO_SOCIAL', 'like', 'RAZAO_SOCIAL'); // filterField, operator, formField
  26. parent::addFilterField('CPF', 'like', 'CPF'); // filterField, operator, formField
  27. parent::addFilterField('CNPJ', 'like', 'CNPJ'); // filterField, operator, formField
  28. parent::addFilterField('ID_CIDADE', 'like', 'ID_CIDADE'); // filterField, operator, formField
  29. parent::addFilterField('FONE', 'like', 'FONE'); // filterField, operator, formField
  30. parent::addFilterField('SITUACAO', 'like', 'SITUACAO'); // filterField, operator, formField
  31. // creates the form
  32. $this->form = new TQuickForm('form_search_Cliente');
  33. $this->form->class = 'tform'; // change CSS class
  34. $this->form->style = 'display: table;width:100%'; // change style
  35. $this->form->setFormTitle('Cliente');
  36. // $cliente = new Cliente(1);
  37. //echo $cliente->cidade->nome;
  38. // create the form fields
  39. $CODIGO = new TEntry('CODIGO');
  40. $RAZAO_SOCIAL = new TEntry('RAZAO_SOCIAL');
  41. $CPF = new TEntry('CPF');
  42. $CNPJ = new TEntry('CNPJ');
  43. $ID_CIDADE = new TEntry('ID_CIDADE');
  44. $FONE = new TEntry('FONE');
  45. $SITUACAO = new TEntry('SITUACAO');
  46. // add the fields
  47. $this->form->addQuickField('Código:', $CODIGO, 70 );
  48. $this->form->addQuickField('Razão Social:', $RAZAO_SOCIAL, 400 );
  49. $this->form->addQuickField('CPF/CNPJ:', $CPF, 200 );
  50. $this->form->addQuickField('Situação:', $SITUACAO, 200 );
  51. // keep the form filled during navigation with session data
  52. $this->form->setData( TSession::getValue('Cliente_filter_data') );
  53. // add the search form actions
  54. $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'fa:search');
  55. $this->form->addQuickAction(_t('New'), new TAction(array('ClienteForm', 'onEdit')), 'bs:plus-sign green');
  56. // creates a DataGrid
  57. $this->datagrid = new TDataGrid;
  58. $this->datagrid->disableDefaultClick(); // important!
  59. $this->datagrid->style = 'width: 100%';
  60. $this->datagrid->setHeight(320);
  61. // $this->datagrid->datatable = 'true';
  62. // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>');
  63. // creates the datagrid columns
  64. $column_CODIGO = new TDataGridColumn('CODIGO', 'Código', 'center');
  65. $column_RAZAO_SOCIAL = new TDataGridColumn('RAZAO_SOCIAL', 'Razão Social', 'left');
  66. $column_CPF = new TDataGridColumn('CPF', 'CPF/CNPJ', 'center');
  67. $column_CNPJ = new TDataGridColumn('CNPJ', 'CNPJ', 'center');
  68. $column_ID_CIDADE = new TDataGridColumn('unidadefederacao->DESCRICAO', 'Cidade', 'center');
  69. $column_FONE = new TDataGridColumn('FONE', 'Telefone', 'center');
  70. $column_SITUACAO = new TDataGridColumn('situacao_cli', 'Situação', 'center');
  71. //$COL= compara_cpfcnpj( $column_CPF, $column_CNPJ );
  72. // $column_CPFCNPJ = new TDataGridColumn( compara_cpfcnpj , 'CPF/CNPJ', 'center');
  73. $column_CPF->setTransformer(function($value,$object){
  74. if ($value)
  75. return $value;
  76. else
  77. return $object->CNPJ;
  78. });
  79. //$action_edit = new TDataGridAction(array($this, 'onView'));
  80. //$action->setUseButton(TRUE);
  81. //$action->setButtonClass('btn btn-info');
  82. //$this->datagrid->addQuickAction('View', $action_edit, 'ID_CLIENTE', 'fa:search');
  83. // add the columns to the DataGrid
  84. $this->datagrid->addColumn($column_CODIGO);
  85. $this->datagrid->addColumn($column_RAZAO_SOCIAL);
  86. $this->datagrid->addColumn($column_CPF);
  87. // $this->datagrid->addColumn($column_CNPJ);
  88. $this->datagrid->addColumn($column_ID_CIDADE);
  89. $this->datagrid->addColumn($column_FONE);
  90. $this->datagrid->addColumn($column_SITUACAO);
  91. // creates the datagrid column actions
  92. $order_CODIGO = new TAction(array($this, 'onReload'));
  93. $order_CODIGO->setParameter('order', 'CODIGO');
  94. $column_CODIGO->setAction($order_CODIGO);
  95. $order_RAZAO_SOCIAL = new TAction(array($this, 'onReload'));
  96. $order_RAZAO_SOCIAL->setParameter('order', 'RAZAO_SOCIAL');
  97. $column_RAZAO_SOCIAL->setAction($order_RAZAO_SOCIAL);
  98. // create EDIT action
  99. $action_edit = new TDataGridAction(array('ClienteForm', 'onView'));
  100. //$action_edit->setUseButton(TRUE);
  101. //$action_edit->setButtonClass('btn btn-default');
  102. $action_edit->setLabel('+ Detalhes');
  103. // $action_edit->setLabel(_t('Edit'));
  104. $action_edit->setImage('ico_find.png');
  105. $action_edit->setField('ID_CLIENTE');
  106. //$this->datagrid->addAction($action_edit);
  107. $this->datagrid->addQuickAction('View', $action_edit, 'ID_CLIENTE', 'fa:search');
  108. // create DELETE action
  109. $action_del = new TDataGridAction(array($this, 'onDelete'));
  110. //$action_del->setUseButton(TRUE);
  111. //$action_del->setButtonClass('btn btn-default');
  112. $action_del->setLabel(_t('Delete'));
  113. $action_del->setImage('ico_delete.png');
  114. $action_del->setField('ID_CLIENTE');
  115. $this->datagrid->addAction($action_del);
  116. // create the datagrid model
  117. $this->datagrid->createModel();
  118. // create the page navigation
  119. $this->pageNavigation = new TPageNavigation;
  120. $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
  121. $this->pageNavigation->setWidth($this->datagrid->getWidth());
  122. // vertical box container
  123. $container = new TVBox;
  124. $container->style = 'width: 100%';
  125. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  126. $container->add($this->form);
  127. $container->add($this->datagrid);
  128. $container->add($this->pageNavigation);
  129. parent::add($container);
  130. }
  131. }
  132. </your>
PD

Leonardo,

Somente faça a classe de formulário "extends TWindow".

Att,