Lançado Adianti Framework 7.6!
Clique aqui para saber mais
getData não retorna valores do Datagrid Olá pessoal, preciso de uma ajuda, copiei aqui mesmo do forum um exemplo para gerar Parcelamento de títulos (https://www.adianti.com.br/forum/pt/view_1630?simulacao-de-financiamento) autor Flavio Maidl, fiz algumas adequações para meu uso, porém não estou conseguindo pegar os valores do datagrid na Action do boão Confirmar, usando $data = $this->form->getData();, porém não retorna os va...
RA
getData não retorna valores do Datagrid  
Olá pessoal, preciso de uma ajuda, copiei aqui mesmo do forum um exemplo para gerar Parcelamento de títulos (https://www.adianti.com.br/forum/pt/view_1630?simulacao-de-financiamento) autor Flavio Maidl, fiz algumas adequações para meu uso, porém não estou conseguindo pegar os valores do datagrid na Action do boão Confirmar, usando $data = $this->form->getData();, porém não retorna os valores da datagrid;

Segue codigo:
  1. <?php
  2. class geradorFinaciamentos extends TWindow {
  3.    
  4.    protected $form;
  5.    private $datagrid;
  6.    
  7.    
  8.    use Adianti\base\AdiantiStandardListTrait;
  9.    
  10.    public function __construct($param) {
  11.       
  12.       parent::__construct();
  13.       
  14.         
  15.       $this->setDatabase('gecom');            // defines the database
  16.       $this->setActiveRecord('Contas');   // defines the active record
  17.       $this->setDefaultOrder('id''asc');         // defines the default order
  18.        
  19.       $this->form = new TForm('form_Vencimentos');
  20.   //    $this->setTitle('Simulador de Parcelamento');
  21.       
  22.       $Clientes_id = new TDBUniqueSearch('Clientes_id''gecom''Clientes''id''CLI_NOME');
  23.       $Clientes_id->setSize('100%');
  24.       $Planoct_id = new TDBUniqueSearch('Planoct_id''gecom''Planoct''id''PLA_DESCRICAO');
  25.       $Planoct_id->setMask('{PLA_DESCRICAO} - ({id})');
  26.       $Planoct_id->setSize('100%');
  27.       $this->form->add(new TLabel('<b>Cliente/Fornecedor:</b>'));
  28.       $this->form->add($Clientes_id);
  29.       $this->form->add(new TLabel('<b>Plano de Contas::</b>'));
  30.       $this->form->add($Planoct_id);
  31.       $Historico = new TEntry('Historico');
  32.       $Historico->setSize('100%');
  33.       $this->form->add(new TLabel('Histórico:'));
  34.       $this->form->add($Historico);
  35.       
  36.       $Dias = new TNumeric(2',''.'true);
  37.       $Dias->setValue(30);
  38.       $Dias->setSize('20%');      
  39.      
  40.       // with: 500, height: automatic
  41.     //  parent::setSize(0.4, 0.7); // use 0.6, 0.4 (for relative sizes 60%, 40%)
  42.       
  43.  
  44.       $texto = new TEntry('texto');
  45.       $texto->setSize('40%');
  46. //     $texto->setValue('1');
  47.       $venci = new TDate('venci');
  48.       $venci->setSize('30%');
  49.       $total = new TEntry('total');
  50.       $doc   = new TEntry('doc');
  51.       
  52.  //     $titulo = new TLabel('<font color = blue>Simulador de Parcelas</font');  
  53.  //     $this->label    = new TLabel('Resultado');
  54.       $this->vtotal   = new TLabel('-');
  55.       $botao          TButton::create('testar', array($this'onTeste'), 'Simular parcelamento''fa:eye green');
  56.       $confirmar      TButton::create('confirmar', array($this'onConfirmar'), 'Confirmar''fa:check green');
  57.     
  58.  
  59.       
  60.       $Dias->popover 'true';
  61.       $Dias->poptitle '<font color = blue /><b>Nº de dias de intervalo entre as parcelas.</b>';
  62.       
  63.       $texto->popover 'true';
  64.       $texto->poptitle '<font color = blue /><b>Quantidade de Parcelas.</b>';
  65.  
  66.       
  67.       $botao->popover 'true';
  68.       $botao->poptitle '<font color = red /><b>SIMULAR PARCELAMENTO</b>';
  69.       $botao->popcontent '<font color = blue>Simula o parcelamento, deixando parcelas com valor exato e calculando vencimentos.</font>';
  70.         
  71.    
  72.       $venci->setMask('dd/mm/yyyy');
  73.       
  74.       $this->form->add(new TLabel('Data Base: '));
  75.       $this->form->add($venci);
  76.       $this->form->add(new TLabel('Intervalo:'));
  77.       $this->form->add($Dias);
  78.       $this->form->add('<br>');
  79.       $this->form->add(new TLabel('Documento:'));
  80.       $this->form->add($doc);
  81.       $this->form->add('<br>');
  82.       $this->form->add(new TLabel('Parcelas:'));
  83.       $this->form->add($texto);
  84.       $this->form->add('<br>');   
  85.       $this->form->add(new TLabel('Valor: '));
  86.       $this->form->add($total);
  87.       $this->form->add('<br>');
  88.       $this->form->add($botao); 
  89.       $this->form->add($confirmar);
  90.       
  91.   
  92.        // creates one datagrid
  93.       $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  94.       $this->datagrid->setHeight(320);
  95.       $this->datagrid->style 'width: 100%';
  96.       $this->form->add($this->datagrid);
  97.   
  98.       $col_parcela   = new TDataGridColumn('CON_PARCELA','Parcela''left');
  99.       $col_doc       = new TDataGridColumn('CON_DOCUMENTO','Documento''center');
  100.       $col_vencto    = new TDataGridColumn('CON_VENCTO','Vencimento''left');
  101.       $col_valor     = new TDataGridColumn('CON_VALOR''Valor''right');
  102.      
  103.       $this->datagrid->addColumn($col_parcela);
  104.       $this->datagrid->addColumn($col_doc);
  105.       $this->datagrid->addColumn($col_vencto);
  106.       $this->datagrid->addColumn($col_valor);
  107.         
  108.       
  109.       $this->form->setFields(array($Clientes_id,$Historico$texto,$doc$venci$botao$confirmar$total));    
  110.     
  111.  
  112.       $this->datagrid->createModel();
  113.   
  114.       $container = new TVBox;
  115.       $container->style 'width: 90%';
  116.       $container->add($this->form);
  117.       
  118.       parent::add($container);
  119.    }
  120.    
  121.    function onTeste() {
  122.       $data $this->form->getData();
  123.       $date TDate::date2us(date($data->venci));
  124.       $date = new DateTime$date );
  125.       $vezes = (double) str_replace(['.'','], ['''.'], $data->texto);
  126.       $total = (double) str_replace(['.'','], ['''.'], $data->total);
  127.       $valor = ($total $vezes);
  128.       $this->datagrid->clear();
  129.      for ($n=1$n<=$vezes$n++)
  130.      {
  131.          $date->add(new DateInterval('P1M')); //'P1M'
  132.          //echo $date->format('Y-m-d');
  133.          //echo "n";
  134.          $nueba $nueba $date->format('Y-m-d').';';
  135.          //echo $nueba;
  136.          
  137.      }
  138.      $binda explode(';'$nueba);
  139.      $NumerodeParcelas $data->texto;
  140.      $Documento $data->doc;
  141.      
  142.      if(substr($data->total, -31) == ',') {
  143.         $data->total substr_replace($data->total'.', -31);
  144.      }
  145.      
  146.      // joga o valor total informado na var $ValordaCompra
  147.      $ValordaCompra $data->total;
  148.      //desta forma se obtem o valor das parcelas desprezando os centavos
  149.      $Parcelas floor($ValordaCompra/$NumerodeParcelas);
  150.      //obtendo o valor da primeira parcela
  151.      $PrimeiraParcela $ValordaCompra-($Parcelas*($NumerodeParcelas-1));
  152.      echo "<br/><br/>";
  153.      for ($y 1$y<=$vezes$y++)
  154.      {
  155.         $x $y;
  156.         $x -= 1;
  157.        // while($y <= $vezes) {
  158.         // cria a classe standard para armazenar os resultados
  159.         $item = new StdClass;     
  160.         $item->CON_VENCTO TDate::date2br($binda[$x]);
  161.         $item->CON_PARCELA     $y;
  162.         $item->CON_DOCUMENTO   $Documento;
  163.         // se for a primeira parcela exibe a var $PrimeiraParcela
  164.         if($y == 1){
  165.            $item->CON_VALOR  number_format($PrimeiraParcela,2,",",".");
  166.         } else {  // se não for a 1º parcela exibe o valor de $Parcelas
  167.            $item->CON_VALOR  number_format($Parcelas,2,",",".");
  168.         }
  169.         $this->datagrid->addItem($item);
  170.        // }
  171.            
  172.      
  173.         
  174.      }
  175.      // soma as parcelas alteradas
  176.      $totala = ($Parcelas*($NumerodeParcelas-1)) + $PrimeiraParcela;
  177.      $cacaca number_format($totala,2,",",".");
  178.      
  179.      //$data->texto = 'texto para o label';
  180.  //    $this->label->setValue('<br/>Dividido em '.$data->texto.' vezes de R$ '.number_format($valor,2,",",".") . '<br/>');
  181.      $this->form->setData($data);
  182.     // exibe as parcelas
  183.       $this->vtotal->setValue('<br/> TOTAL: R$<b> '.number_format($totala,2,",",".").'</b>');
  184.  
  185.     // libera as variáveis da memória
  186.     
  187. //    TSession::setValue('dados',$this->datagrid);
  188.     unset($totala);
  189.     unset($cacaca);
  190.     unset($valor);
  191.   // unset($data);
  192.     unset($date);
  193.     unset($item);
  194.     unset($doc);
  195.     unset($ValordaCompra);
  196.    }
  197.    
  198.   public function onReload()
  199.     {
  200.      //   $this->datagrid->clear();
  201.         
  202.     }    
  203.    
  204.    public function onConfirmar($param)
  205.    {
  206.    
  207.      try
  208.         {
  209.             TTransaction::open('gecom'); // open a transaction
  210.             
  211.             /**
  212.             // Enable Debug logger for SQL operations inside the transaction
  213.             TTransaction::setLogger(new TLoggerSTD); // standard output
  214.             TTransaction::setLogger(new TLoggerTXT('log.txt')); // file
  215.            **/
  216.            
  217.            
  218.             $this->form->validate(); // validate form data
  219.             $data $this->form->getData(); // get form data as array
  220.      //       $this->form->setData($data);
  221.             
  222.             var_dump($data);
  223.    
  224.             
  225.             $object = new Contas;  // create an empty object
  226.             $object->fromArray( (array) $data); // load the object with data
  227.         
  228.             
  229.             $object->store(); // save the object
  230.             
  231.             // get the generated id
  232.             $data->id $object->id;
  233.             
  234.             $this->form->setData($data); // fill form data
  235.             TTransaction::close(); // close the transaction
  236.             
  237.             new TMessage('info''Titulos Gravados.');
  238.         }
  239.         catch (Exception $e// in case of exception
  240.         {
  241.             new TMessage('error'$e->getMessage()); // shows the exception error message
  242.             $this->form->setData$this->form->getData() ); // keep form data
  243.             TTransaction::rollback(); // undo all pending operations
  244.         }
  245.    }
  246.    
  247.    
  248.   function show()
  249.     {
  250.        $this->onReload();
  251.         parent::show();
  252.              
  253.     }   
  254.    
  255.   
  256.    
  257. }
  258. ?>


segue também o var_dump($data);

object(stdClass)[107] public 'Clientes_id' => string '1350' (length=4) public 'Historico' => string 'meu historico' (length=13) public 'texto' => string '3' (length=1) public 'doc' => string 'GTY' (length=3) public 'venci' => string '23/04/2020' (length=10) public 'total' => string '2569' (length=4)





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


NR

O post de formulário no html só retorna o valor de campos. Pelo que vi não há nenhum campo em sua grid, somente labels.

Mas se os dados da grid são só pra visualização mesmo, sem possibilidade de alteração, você pode recriar os dados da parcela na função onConfirmar.

Outra opção é usar a função generateHiddenFields da datagrid. Nesse caso não dá pra usar a função getData, vai ter que pegar as informações através de $param. Tem um mestre x detalhe que trabalha dessa maneira:
https://adianti.com.br/framework_files/tutor/index.php?class=SaleForm
RA

Nataniel Rabaioli, seguinte a sua dica com generateHiddenFields mas mesmo assim em no var_dump em param só retorna

'class' => string 'geradorFinaciamentos' (length=20) 'method' => string 'onConfirmar' (length=11) 'Clientes_id' => string '51' (length=2) 'Planoct_id' => string '' (length=0) 'Historico' => string 'meu hist' (length=8) 'venci' => string '23/04/2020' (length=10) 2 => string '' (length=0) 'doc' => string 'J9987VB' (length=7) 'texto' => string '3' (length=1) 'total' => string '5897' (length=4)


na grid setei a configuração
  1. <?php
  2.       $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  3.       $this->datagrid->setId('titulos_list');
  4.       $this->datagrid->generateHiddenFields();  // -> Dica Nataniel
  5.       $this->datagrid->setHeight(320);
  6.       $this->datagrid->style 'width: 100%';
  7.       $this->form->add($this->datagrid); 
  8. ?>
RA

..Complementando.

Não teria que colocar em setFields o datagrid, se for isso, não consegui fazer.

  1. <?php
  2. $this->form->setFields(array($Clientes_id,$Historico$texto,$doc$venci$botao$confirmar$total));  
  3. ?>
NR

Não precisa colocar no setFields. Só acrescentei o generateHiddenFields e funcionou. Lembrando que deve clicar no "Simular parcelamento" antes, pois a grid precisa estar populada. O retorno foi o seguinte:
  1. <?php
  2. array(14) {
  3.   ["class"]=>
  4.   string(20"geradorFinaciamentos"
  5.   ["method"]=>
  6.   string(11"onConfirmar"
  7.   ["Clientes_id"]=>
  8.   string(1"3"
  9.   ["Planoct_id"]=>
  10.   string(0""
  11.   ["Historico"]=>
  12.   string(6"123123"
  13.   ["venci"]=>
  14.   string(10"23/04/2020"
  15.   [2]=>
  16.   string(0""
  17.   ["doc"]=>
  18.   string(6"213321"
  19.   ["texto"]=>
  20.   string(1"5"
  21.   ["total"]=>
  22.   string(4"1000"
  23.   ["parcelas_CON_PARCELA"]=>
  24.   array(5) {
  25.     [0]=>
  26.     string(1"1"
  27.     [1]=>
  28.     string(1"2"
  29.     [2]=>
  30.     string(1"3"
  31.     [3]=>
  32.     string(1"4"
  33.     [4]=>
  34.     string(1"5"
  35.   }
  36.   ["parcelas_CON_DOCUMENTO"]=>
  37.   array(5) {
  38.     [0]=>
  39.     string(6"213321"
  40.     [1]=>
  41.     string(6"213321"
  42.     [2]=>
  43.     string(6"213321"
  44.     [3]=>
  45.     string(6"213321"
  46.     [4]=>
  47.     string(6"213321"
  48.   }
  49.   ["parcelas_CON_VENCTO"]=>
  50.   array(5) {
  51.     [0]=>
  52.     string(10"23/05/2020"
  53.     [1]=>
  54.     string(10"23/06/2020"
  55.     [2]=>
  56.     string(10"23/07/2020"
  57.     [3]=>
  58.     string(10"23/08/2020"
  59.     [4]=>
  60.     string(10"23/09/2020"
  61.   }
  62.   ["parcelas_CON_VALOR"]=>
  63.   array(5) {
  64.     [0]=>
  65.     string(6"200,00"
  66.     [1]=>
  67.     string(6"200,00"
  68.     [2]=>
  69.     string(6"200,00"
  70.     [3]=>
  71.     string(6"200,00"
  72.     [4]=>
  73.     string(6"200,00"
  74.   }
  75. }
  76. ?>
RA

Nataniel, vc pegou este retorno na Action do botão Confirmar ,


public function onConfirmar($param)
{
....
var_dump($param)

foi aqui ?

NR

Sim, na função onConfirmar
RA

Obrigado pela ajuda Nataniel, mas aqui não consegui pegar esse array no retorno de jeito nenhum, só retorna mesmo a parte do setfield do formulário, poderia postar seu codigo para compração :
NR

  1. <?php
  2. class geradorFinaciamentos extends TWindow {
  3.    
  4.    protected $form;
  5.    private $datagrid;
  6.    
  7.    
  8.    use Adianti\base\AdiantiStandardListTrait;
  9.    
  10.    public function __construct($param) {
  11.       
  12.       parent::__construct();
  13.       
  14.         
  15.       $this->setDatabase('permission');            // defines the database
  16.       $this->setActiveRecord('SystemProgram');   // defines the active record
  17.       $this->setDefaultOrder('id''asc');         // defines the default order
  18.        
  19.       $this->form = new TForm('form_Vencimentos');
  20.   //    $this->setTitle('Simulador de Parcelamento');
  21.       
  22.       $Clientes_id = new TDBUniqueSearch('Clientes_id''permission''SystemProgram''id''name');
  23.       $Clientes_id->setSize('100%');
  24.       $Planoct_id = new TDBUniqueSearch('Planoct_id''permission''SystemProgram''id''name');
  25.       $Planoct_id->setMask('{name} - ({id})');
  26.       $Planoct_id->setSize('100%');
  27.       $this->form->add(new TLabel('<b>Cliente/Fornecedor:</b>'));
  28.       $this->form->add($Clientes_id);
  29.       $this->form->add(new TLabel('<b>Plano de Contas::</b>'));
  30.       $this->form->add($Planoct_id);
  31.       $Historico = new TEntry('Historico');
  32.       $Historico->setSize('100%');
  33.       $this->form->add(new TLabel('Histórico:'));
  34.       $this->form->add($Historico);
  35.       
  36.       $Dias = new TNumeric(2',''.'true);
  37.       $Dias->setValue(30);
  38.       $Dias->setSize('20%');      
  39.      
  40.       // with: 500, height: automatic
  41.     //  parent::setSize(0.4, 0.7); // use 0.6, 0.4 (for relative sizes 60%, 40%)
  42.       
  43.  
  44.       $texto = new TEntry('texto');
  45.       $texto->setSize('40%');
  46. //     $texto->setValue('1');
  47.       $venci = new TDate('venci');
  48.       $venci->setSize('30%');
  49.       $total = new TEntry('total');
  50.       $doc   = new TEntry('doc');
  51.       
  52.  //     $titulo = new TLabel('<font color = blue>Simulador de Parcelas</font');  
  53.  //     $this->label    = new TLabel('Resultado');
  54.       $this->vtotal   = new TLabel('-');
  55.       $botao          TButton::create('testar', array($this'onTeste'), 'Simular parcelamento''fa:eye green');
  56.       $confirmar      TButton::create('confirmar', array($this'onConfirmar'), 'Confirmar''fa:check green');
  57.     
  58.  
  59.       
  60.       $Dias->popover 'true';
  61.       $Dias->poptitle '<font color = blue /><b>Nº de dias de intervalo entre as parcelas.</b>';
  62.       
  63.       $texto->popover 'true';
  64.       $texto->poptitle '<font color = blue /><b>Quantidade de Parcelas.</b>';
  65.  
  66.       
  67.       $botao->popover 'true';
  68.       $botao->poptitle '<font color = red /><b>SIMULAR PARCELAMENTO</b>';
  69.       $botao->popcontent '<font color = blue>Simula o parcelamento, deixando parcelas com valor exato e calculando vencimentos.</font>';
  70.         
  71.    
  72.       $venci->setMask('dd/mm/yyyy');
  73.       
  74.       $this->form->add(new TLabel('Data Base: '));
  75.       $this->form->add($venci);
  76.       $this->form->add(new TLabel('Intervalo:'));
  77.       $this->form->add($Dias);
  78.       $this->form->add('<br>');
  79.       $this->form->add(new TLabel('Documento:'));
  80.       $this->form->add($doc);
  81.       $this->form->add('<br>');
  82.       $this->form->add(new TLabel('Parcelas:'));
  83.       $this->form->add($texto);
  84.       $this->form->add('<br>');   
  85.       $this->form->add(new TLabel('Valor: '));
  86.       $this->form->add($total);
  87.       $this->form->add('<br>');
  88.       $this->form->add($botao); 
  89.       $this->form->add($confirmar);
  90.       
  91.   
  92.        // creates one datagrid
  93.       $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  94.       $this->datagrid->setHeight(320);
  95.       $this->datagrid->style 'width: 100%';
  96.       $this->datagrid->setId('parcelas');
  97.       $this->datagrid->generateHiddenFields();
  98.       $this->form->add($this->datagrid);
  99.   
  100.       $col_parcela   = new TDataGridColumn('CON_PARCELA','Parcela''left');
  101.       $col_doc       = new TDataGridColumn('CON_DOCUMENTO','Documento''center');
  102.       $col_vencto    = new TDataGridColumn('CON_VENCTO','Vencimento''left');
  103.       $col_valor     = new TDataGridColumn('CON_VALOR''Valor''right');
  104.      
  105.       $this->datagrid->addColumn($col_parcela);
  106.       $this->datagrid->addColumn($col_doc);
  107.       $this->datagrid->addColumn($col_vencto);
  108.       $this->datagrid->addColumn($col_valor);
  109.         
  110.       
  111.       $this->form->setFields(array($Clientes_id,$Historico$texto,$doc$venci$botao$confirmar$total));    
  112.     
  113.  
  114.       $this->datagrid->createModel();
  115.   
  116.       $container = new TVBox;
  117.       $container->style 'width: 90%';
  118.       $container->add($this->form);
  119.       
  120.       parent::add($container);
  121.    }
  122.    
  123.    function onTeste() {
  124.       $data $this->form->getData();
  125.       $date TDate::date2us(date($data->venci));
  126.       $date = new DateTime$date );
  127.       $vezes = (double) str_replace(['.'','], ['''.'], $data->texto);
  128.       $total = (double) str_replace(['.'','], ['''.'], $data->total);
  129.       $valor = ($total $vezes);
  130.       $this->datagrid->clear();
  131.      for ($n=1$n<=$vezes$n++)
  132.      {
  133.          $date->add(new DateInterval('P1M')); //'P1M'
  134.          //echo $date->format('Y-m-d');
  135.          //echo "n";
  136.          $nueba $nueba $date->format('Y-m-d').';';
  137.          //echo $nueba;
  138.          
  139.      }
  140.      $binda explode(';'$nueba);
  141.      $NumerodeParcelas $data->texto;
  142.      $Documento $data->doc;
  143.      
  144.      if(substr($data->total, -31) == ',') {
  145.         $data->total substr_replace($data->total'.', -31);
  146.      }
  147.      
  148.      // joga o valor total informado na var $ValordaCompra
  149.      $ValordaCompra $data->total;
  150.      //desta forma se obtem o valor das parcelas desprezando os centavos
  151.      $Parcelas floor($ValordaCompra/$NumerodeParcelas);
  152.      //obtendo o valor da primeira parcela
  153.      $PrimeiraParcela $ValordaCompra-($Parcelas*($NumerodeParcelas-1));
  154.      echo "<br/><br/>";
  155.      for ($y 1$y<=$vezes$y++)
  156.      {
  157.         $x $y;
  158.         $x -= 1;
  159.        // while($y <= $vezes) {
  160.         // cria a classe standard para armazenar os resultados
  161.         $item = new StdClass;     
  162.         $item->CON_VENCTO TDate::date2br($binda[$x]);
  163.         $item->CON_PARCELA     $y;
  164.         $item->CON_DOCUMENTO   $Documento;
  165.         // se for a primeira parcela exibe a var $PrimeiraParcela
  166.         if($y == 1){
  167.            $item->CON_VALOR  number_format($PrimeiraParcela,2,",",".");
  168.         } else {  // se não for a 1º parcela exibe o valor de $Parcelas
  169.            $item->CON_VALOR  number_format($Parcelas,2,",",".");
  170.         }
  171.         $this->datagrid->addItem($item);
  172.        // }
  173.            
  174.      
  175.         
  176.      }
  177.      // soma as parcelas alteradas
  178.      $totala = ($Parcelas*($NumerodeParcelas-1)) + $PrimeiraParcela;
  179.      $cacaca number_format($totala,2,",",".");
  180.      
  181.      //$data->texto = 'texto para o label';
  182.  //    $this->label->setValue('<br/>Dividido em '.$data->texto.' vezes de R$ '.number_format($valor,2,",",".") . '<br/>');
  183.      $this->form->setData($data);
  184.     // exibe as parcelas
  185.       $this->vtotal->setValue('<br/> TOTAL: R$<b> '.number_format($totala,2,",",".").'</b>');
  186.  
  187.     // libera as variáveis da memória
  188.     
  189. //    TSession::setValue('dados',$this->datagrid);
  190.     unset($totala);
  191.     unset($cacaca);
  192.     unset($valor);
  193.   // unset($data);
  194.     unset($date);
  195.     unset($item);
  196.     unset($doc);
  197.     unset($ValordaCompra);
  198.    }
  199.    
  200.   public function onReload()
  201.     {
  202.      //   $this->datagrid->clear();
  203.         
  204.     }    
  205.    
  206.    public function onConfirmar($param)
  207.    {
  208.    
  209.      try
  210.         {
  211.             TTransaction::open('permission'); // open a transaction
  212.             
  213.             var_dump($param);
  214.             return;
  215.             
  216.             /**
  217.             // Enable Debug logger for SQL operations inside the transaction
  218.             TTransaction::setLogger(new TLoggerSTD); // standard output
  219.             TTransaction::setLogger(new TLoggerTXT('log.txt')); // file
  220.            **/
  221.            
  222.            
  223.             $this->form->validate(); // validate form data
  224.             $data $this->form->getData(); // get form data as array
  225.      //       $this->form->setData($data);
  226.             
  227.             var_dump($data);
  228.    
  229.             
  230.             $object = new Contas;  // create an empty object
  231.             $object->fromArray( (array) $data); // load the object with data
  232.         
  233.             
  234.             $object->store(); // save the object
  235.             
  236.             // get the generated id
  237.             $data->id $object->id;
  238.             
  239.             $this->form->setData($data); // fill form data
  240.             TTransaction::close(); // close the transaction
  241.             
  242.             new TMessage('info''Titulos Gravados.');
  243.         }
  244.         catch (Exception $e// in case of exception
  245.         {
  246.             new TMessage('error'$e->getMessage()); // shows the exception error message
  247.             $this->form->setData$this->form->getData() ); // keep form data
  248.             TTransaction::rollback(); // undo all pending operations
  249.         }
  250.    }
  251.    
  252.   function show()
  253.     {
  254.        $this->onReload();
  255.         parent::show();
  256.              
  257.     }   
  258. }
  259. ?>
</font></font></font></font>
RA

Nataniel obrigado pela paciência, olha só eu testei seu codigo aqui, mas aprece o seguinte

  1. <?php
  2.  'Adianti\Widget\Datagrid\TDataGrid' does not have a method 'generateHiddenFields' in C:\wamp\www\gnote\lib\adianti\wrapper\BootstrapDatagridWrapper.php on line 35
  3. ?>


Não tenho esse método na classe TDataGird generateHiddenFields, , uso o Studio 5.5.0