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


Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto 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.