erro dizendo que não existe a classe TFileldList Fatal error: Class 'TFieldList' not found in C:wamp64wwwadm_conpusisappcontrolconpusisLoteLancamentosForm.class.php on line 75 ...
RS
erro dizendo que não existe a classe TFileldList  
Fatal error: Class 'TFieldList' not found in C:wamp64wwwadm_conpusisappcontrolconpusisLoteLancamentosForm.class.php on line 75


 
  1. <?php
  2. /**
  3. * LoteLancamentoForm Master/Detail
  4. * @author <your name here>
  5. */
  6. class LoteLancamentoForm extends TPage
  7. {
  8. protected $form; // form
  9. protected $fieldlist;
  10. /**
  11. * Class constructor
  12. * Creates the page and the registration form
  13. */
  14. function __construct($param)
  15. {
  16. parent::__construct($param);
  17. // creates the form
  18. $this->form = new TForm('form_LoteLancamento');
  19. $panel_master = new TPanelGroup( 'LoteLancamento' );
  20. $vbox = new TVBox;
  21. $vbox->style = 'width: 100%';
  22. $this->form->add($panel_master);
  23. $panel_master->add($vbox);
  24. $table_general = new TTable;
  25. $table_general->width = '100%';
  26. $frame_general = new TFrame;
  27. $frame_general->class = 'tframe tframe-custom';
  28. $frame_general->setLegend('LoteLancamento');
  29. $frame_general->style = 'background:whiteSmoke';
  30. $frame_general->add($table_general);
  31. $frame_details = new TFrame;
  32. $frame_details->class = 'tframe tframe-custom';
  33. $frame_details->setLegend('CustosLancamentos');
  34. $vbox->add( $frame_general );
  35. $vbox->add( $frame_details );
  36. // master fields
  37. $Id_lote = new TEntry('Id_lote');
  38. $lote_competencia = new TEntry('lote_competencia');
  39. $lote_vencimento = new TDate('lote_vencimento');
  40. $lote_tipo_custo = new TEntry('lote_tipo_custo');
  41. // sizes
  42. $Id_lote->setSize('50%');
  43. $lote_competencia->setSize('100%');
  44. $lote_vencimento->setSize('50%');
  45. $lote_tipo_custo->setSize('50%');
  46. if (!empty($Id_lote))
  47. {
  48. $Id_lote->setEditable(FALSE);
  49. }
  50. // add form fields to be handled by form
  51. $this->form->addField($Id_lote);
  52. $this->form->addField($lote_competencia);
  53. $this->form->addField($lote_vencimento);
  54. $this->form->addField($lote_tipo_custo);
  55. // add form fields to the screen
  56. $table_general->addRowSet( new TLabel('Id Lote'), $Id_lote );
  57. $table_general->addRowSet( new TLabel('Lote Competencia'), $lote_competencia );
  58. $table_general->addRowSet( new TLabel('Lote Vencimento'), $lote_vencimento );
  59. $table_general->addRowSet( new TLabel('Lote Tipo Custo'), $lote_tipo_custo );
  60. // detail fields
  61. $this->fieldlist = new TFieldList;
  62. $this->fieldlist->enableSorting();
  63. $frame_details->add($this->fieldlist);
  64. $id_custo = new TEntry('list_id_custo[]');
  65. $valor = new TEntry('list_valor[]');
  66. $obs = new TText('list_obs[]');
  67. $id_custo->setSize('50%');
  68. $valor->setSize('50%');
  69. $obs->setSize('100%');
  70. $this->fieldlist->addField( '<b>Id Custo</b>', $id_custo);
  71. $this->fieldlist->addField( '<b>Valor</b>', $valor);
  72. $this->fieldlist->addField( '<b>Obs</b>', $obs);
  73. $this->form->addField($id_custo);
  74. $this->form->addField($valor);
  75. $this->form->addField($obs);
  76. // create an action button (save)
  77. $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:save blue');
  78. $new_button = TButton::create('new', array($this, 'onClear'), _t('Clear'), 'fa:eraser red');
  79. $this->form->addField($save_button);
  80. $this->form->addField($new_button);
  81. $panel_master->addFooter( THBox::pack($save_button, $new_button) );
  82. // create the page container
  83. $container = new TVBox;
  84. $container->style = 'width: 100%';
  85. //$container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  86. $container->add($this->form);
  87. parent::add($container);
  88. }
  89. /**
  90. * Executed whenever the user clicks at the edit button da datagrid
  91. */
  92. function onEdit($param)
  93. {
  94. try
  95. {
  96. TTransaction::open('conpusis');
  97. if (isset($param['key']))
  98. {
  99. $key = $param['key'];
  100. $object = new LoteLancamento($key);
  101. $this->form->setData($object);
  102. $items = CustosLancamentos::where('id_lote', '=', $key)->load();
  103. $this->fieldlist->addHeader();
  104. if ($items)
  105. {
  106. foreach($items as $item )
  107. {
  108. $detail = new stdClass;
  109. $detail->list_id_custo = $item->id_custo;
  110. $detail->list_valor = $item->valor;
  111. $detail->list_obs = $item->obs;
  112. $this->fieldlist->addDetail($detail);
  113. }
  114. $this->fieldlist->addCloneAction();
  115. }
  116. else
  117. {
  118. $this->onClear($param);
  119. }
  120. TTransaction::close(); // close transaction
  121. }
  122. }
  123. catch (Exception $e) // in case of exception
  124. {
  125. new TMessage('error', $e->getMessage());
  126. TTransaction::rollback();
  127. }
  128. }
  129. /**
  130. * Clear form
  131. */
  132. public function onClear($param)
  133. {
  134. $this->fieldlist->addHeader();
  135. $this->fieldlist->addDetail( new stdClass );
  136. $this->fieldlist->addCloneAction();
  137. }
  138. /**
  139. * Save the LoteLancamento and the CustosLancamentos's
  140. */
  141. public static function onSave($param)
  142. {
  143. try
  144. {
  145. TTransaction::open('conpusis');
  146. $id = (int) $param['Id_lote'];
  147. $master = new LoteLancamento;
  148. $master->fromArray( $param);
  149. $master->store(); // save master object
  150. // delete details
  151. CustosLancamentos::where('id_lote', '=', $master->Id_lote)->delete();
  152. if( !empty($param['list_id_custo']) AND is_array($param['list_id_custo']) )
  153. {
  154. foreach( $param['list_id_custo'] as $row => $id_custo)
  155. {
  156. if (!empty($id_custo))
  157. {
  158. $detail = new CustosLancamentos;
  159. $detail->id_lote = $master->Id_lote;
  160. $detail->id_custo = $param['list_id_custo'][$row];
  161. $detail->valor = $param['list_valor'][$row];
  162. $detail->obs = $param['list_obs'][$row];
  163. $detail->store();
  164. }
  165. }
  166. }
  167. $data = new stdClass;
  168. $data->Id_lote = $master->Id_lote;
  169. TForm::sendData('form_LoteLancamento', $data);
  170. TTransaction::close(); // close the transaction
  171. new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
  172. }
  173. catch (Exception $e) // in case of exception
  174. {
  175. new TMessage('error', $e->getMessage());
  176. TTransaction::rollback();
  177. }
  178. }
  179. }
  180. ?>


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 (2)


NR

Qual a versão do seu projeto? O TFieldList só foi acrescentado na versão 5
RS

Obrigado Nataniel, deve ser isso porque este projeto está na versão 4, beleza.