Lançado Adianti Framework 7.6!
Clique aqui para saber mais
TStandardSeek parou do nada opa galera tinha um for que tava funcionando redondinho, derrepente os TstandardSeek pararam alguma luz ...
AS
TStandardSeek parou do nada  
Fechado
opa galera tinha um for que tava funcionando redondinho, derrepente os TstandardSeek pararam

alguma luz

  1. <?php
  2. class VendasCompleto extends TPage{
  3.     
  4.     protected $form;
  5.     protected  $value;
  6.     protected $itens;
  7.     protected 679;
  8.     protected $descricao;
  9.     protected $venda;
  10.     protected $multfild;
  11.     protected   $note;
  12.             function __construct() {
  13.         parent::__construct();
  14.         
  15.     
  16.         $this->form = new TForm('VendasCompleta');
  17.        
  18.         $this->venda = new Receber();
  19.                
  20.           $this->note = new TNotebook(800,300);
  21.         $tableP1 = new TTable();
  22.                 $this->multfild = new TMultiField('produtos');
  23.                 //produto
  24.                 // cliente
  25.                 $produto_id = new TSeekButton('produto_id');
  26.                 $produto_nome = new TEntry('produto_nome');
  27.                 $produto_nome->setEditable(FALSE);
  28.                 $seek = new TStandardSeek();
  29.                 $action = new TAction(array($seek,'onSetup'));
  30.                 $action->setParameter('database''mysql');
  31.                 $action->setParameter('parent','VendasCompleta');
  32.                 $action->setParameter('model','Produto');
  33.                 $action->setParameter('display_field','nome');
  34.                 $action->setParameter('receive_key','produto_id');
  35.                 $action->setParameter('receive_field','produto_nome');
  36.                 $produto_id->setAction($action);
  37.                 $qtd = new TEntry('qtd');
  38.                 $qtd->setMask('999');
  39.                 $this->multfild->addField('produto_id','ID',$produto_id,200);
  40.                 $this->multfild->addField('produto_nome','Produto',$produto_nome,200);
  41.                 $this->multfild->addField('qtd','Quantidade',$qtd,200);
  42.                 679 = new THidden('id');
  43.         
  44.         $dataf = new TDate('dataVencimento');
  45.         
  46.         $valor = new TEntry('valor');
  47.         $valor->setNumericMask(2'.''');
  48.         $valor->setMaxLength(9);
  49.         $valor->setEditable(FALSE);
  50.         
  51. $filter = array(new TFilter('cargos_id','=',10));
  52. $funcionario = new TDBFCombo('vendedor_id''mysql''Funcionarios','id''nome');
  53.     
  54.         
  55.       
  56.       // cliente
  57.        $cliente_id = new TSeekButton('cliente_id');
  58.         $cliente = new TEntry('cliente');
  59.         $cliente->setEditable(FALSE);
  60.         $seek = new TStandardSeek();
  61.         
  62.         $action = new TAction(array($seek,'onSetup'));
  63.         $action->setParameter('database''mysql');
  64.         $action->setParameter('parent','VendasCompleta');
  65.         $action->setParameter('model','Cliente');
  66.         $action->setParameter('display_field','razaoSocial');
  67.         $action->setParameter('receive_key','cliente_id');
  68.         $action->setParameter('receive_field','cliente');
  69.         
  70.           $cliente_id->setAction($action);
  71.         
  72.           
  73.         
  74.           $pagamento = new TDBCombo('pagamento_id','mysql','Parcelas','id','tipo');
  75.         $nparcelas = new TEntry('maximo');
  76.         $juros = new TEntry('juros');
  77.        
  78.        
  79.         $nparcelas->setEditable(FALSE);
  80.         $juros->setEditable(FALSE);
  81.        
  82.      
  83.        $parcelas = new TEntry('parcelas');
  84.         $parcelas->setMask('99');
  85.        $vparcela = new TEntry('vparcela');
  86.         $vparcela->setNumericMask(2'.'',');
  87.         $vparcela->setMaxLength(6);
  88.         $vparcela->setEditable(FALSE);
  89.         
  90.          $vtotal = new TEntry('vtotal');
  91.         $vtotal->setNumericMask(2'.'',');
  92.         $vtotal->setMaxLength(6);
  93.         $vtotal->setEditable(FALSE);
  94.         
  95.        
  96.        $label = new TLabel('Data Pagamento');
  97.       $row =  $tableP1->addRow();
  98.       
  99.       $row->addCell($label);
  100.       $cell $row->addCell($dataf);
  101.      $cell->colspan 2;
  102.       
  103.           $row =  $tableP1->addRow();
  104.           $label = new TLabel('Funcionario');
  105.        $row->addCell($label);
  106.       $row->addCell($funcionario);
  107.       
  108.    
  109.       
  110.       
  111.        $row =  $tableP1->addRow();
  112.        $label = new TLabel('Cod Cliente');
  113.        $row->addCell($label);
  114.        $row->addCell($cliente_id);
  115.        
  116.        $label = new TLabel('Cliente');
  117.        $row->addCell($label);
  118.        $row->addCell($cliente);
  119.        
  120.       
  121.       
  122.    
  123.       $row $tableP1->addRow();
  124.     
  125.       
  126.          $label = new TLabel('Forma de Pagamento');
  127.        $row->addCell($label);
  128.    $row->addCell($pagamento);
  129.    
  130.     $row $tableP1->addRow();
  131.           $label = new TLabel('Parcelas');
  132.        $row->addCell($label);
  133.    $row->addCell($parcelas);
  134.    
  135.     $row $tableP1->addRow();
  136.        $label = new TLabel('Juros');
  137.        $row->addCell($label);
  138.    $row->addCell($juros);
  139.    
  140.    
  141.        $label = new TLabel('Valor Parcela');
  142.        $row->addCell($label);
  143.    $row->addCell($vparcela);
  144.    
  145.    
  146.        $row=$tableP1->addRow();
  147.        
  148.          $label = new TLabel('Valor Total');
  149.        $row->addCell($label);
  150.       $row->addCell($valor);
  151.       
  152.    
  153.        $label = new TLabel('Valor Final');
  154.        $row->addCell($label);
  155.    $row->addCell($vtotal);
  156.    
  157.    
  158.    
  159.    $row $tableP1->addRow();
  160.    $calcular = new TButton('gerar');
  161.    
  162.   // $calcular->setAction(new TAction(array($this,'calcular')),'Calcular');
  163.     $save = new TButton('salvar');
  164.    
  165.    //$save->setAction(new TAction(array($this,'onSave')),'gravar');
  166. $save->setImage('ico_save.png');
  167.    
  168.    $row->addCell($calcular);
  169.    $row->addCell($save);
  170. $tableP2 = new TTable();
  171.                 $row =  $tableP2->addRow();
  172.                 $row->addCell($this->multfild);
  173.                 $incluir = new TButton('Add');
  174.                 $row =  $tableP2->addRow();
  175.                 $row->addCell($incluir);
  176.       $this->form->add($tableP1);
  177.                 $this->itens = new TText('descricao');
  178.                 $this->itens->setEditable(FALSE);
  179.      
  180.       $this->note->appendPage('Dados Do Cliente',$tableP1);
  181.       $this->note->appendPage('Dados Dos Produto',$tableP2 );
  182.                 $this->note->appendPage('Produtos',$this->itens);
  183.                 $this->form->setFields(array(
  184.          $vparcela,$funcionario,
  185.          $vtotal,$parcelas,$pagamento,$dataf,$cliente$cliente_id,
  186.          $calcular,$juros,$valor,$save,$this->multfild,$incluir,$produto_nome,$produto_id));
  187.                 $this->form->add($this->note);
  188.       parent::add($this->note);
  189.     }
  190.     
  191.     function onEdit($param NULL){
  192.              $dados $this->form->getData();
  193.                 try {
  194.            
  195.              TTransaction::open('mysql');
  196.          
  197.           if(isset($param['key'])){   
  198.              $this->venda = new Receber($param['key']);
  199.           
  200.             $dados->dataVencimento $venda->dataVencimento ;
  201.             $dados->produto_id $venda->produto_id ;
  202.             $dados->vendedor_id =  $venda->vendedor_id ;
  203.             $dados->cliente_id $venda->cliente_id   ;
  204.             $dados->vparcela $venda->vparcela ;
  205.             $dados->vtotal =  $venda->vtotal ;
  206.             $dados->pagamento_id $venda->pagamento_id ;
  207.              
  208.           }else{
  209.                 $this->venda = new Receber();
  210.           }
  211.         
  212.   
  213.                  TForm::sendData('VendasCompleta'$dados);
  214.              TTransaction::close();
  215.        } catch (Exception $ex) {
  216.            
  217.            new TMessage('error'$ex->getMessage());
  218.            TTransaction::rollback();
  219.            
  220.        }
  221.     }
  222.    
  223. }

Pacotão Dominando o Adianti Framework 7
O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado! Versão 7.4


Dominando o Adianti 7 Quero me inscrever agora!

Comentários (5)


FC

Hum... parte do inicio veja se o Model está correto !!

qualquer coisa joga o var_dump($seek); para depurar....
AS

então felipe, tudo esta okay o problema é que não recupera os dados
ele lista certinho, mas quando clica os campos do from ficam em branco
FC

Alexandre testa em outro core somente o $seek
PD

Alexandre,

Quando você usa TSeekButton com TMultifield, o nome dos campos deve ser precedido pelo nome do próprio Multifield, veja que adicionei "produtos_" na frente...

  1. <?php
  2.                 $action->setParameter('receive_key','produtos_produto_id');
  3.                 $action->setParameter('receive_field','produtos_produto_nome');
  4. ?>


Caso você tenha dúvidas de como eu fiz, dê uma olhada no cadastro de livros do Library, pois lá tem uma multifield de autores, que usa seekbutton:
www.adianti.com.br/framework-library

abraço!
Pablo
AS

então pablo ate mudei, mas o problema é que nem um seek funciona nem mesmo os foras do multfiel

  1. <?php
  2. class VendasCompleto extends TPage{
  3.     
  4.     protected $form;
  5.     protected  $value;
  6.     protected $itens;
  7.     protected $id;
  8.     protected $descricao;
  9.     protected $venda;
  10.     protected $multfild;
  11.     protected   $note;
  12.             function __construct() {
  13.         parent::__construct();
  14.         
  15.     
  16.         $this->form = new TForm('VendasCompleta');
  17.        
  18.         $this->venda = new Receber();
  19.                
  20.           $this->note = new TNotebook(800,300);
  21.         $tableP1 = new TTable();
  22.                 $this->multfild = new TMultiField('produtos');
  23.                 //produto
  24.                 // cliente
  25.                 $produto_id = new TSeekButton('produto_id');
  26.                 $produto_nome = new TEntry('produto_nome');
  27.                 $produto_nome->setEditable(FALSE);
  28.                 $seekProduto = new TStandardSeek();
  29.                 $action = new TAction(array($seekProduto,'onSetup'));
  30.                 $action->setParameter('database''mysql');
  31.                 $action->setParameter('parent','VendasCompleta');
  32.                 $action->setParameter('model','Produto');
  33.                 $action->setParameter('display_field','nome');
  34.                 $action->setParameter('receive_key','produtos_produto_id');
  35.                 $action->setParameter('receive_field','produtos_produto_nome');
  36.                 $produto_id->setAction($action);
  37.                 $qtd = new TEntry('qtd');
  38.                 $qtd->setMask('999');
  39.                 $this->multfild->addField('produto_id','ID',$produto_id,40);
  40.                 $this->multfild->addField('produto_nome','Produto',$produto_nome,300);
  41.                 $this->multfild->addField('qtd','Quantidade',$qtd,50);
  42.                 $id = new THidden('id');
  43.         
  44.         $dataf = new TDate('dataVencimento');
  45.         
  46.         $valor = new TEntry('valor');
  47.         $valor->setNumericMask(2'.''');
  48.         $valor->setMaxLength(9);
  49.         $valor->setEditable(FALSE);
  50.         
  51. $filter = array(new TFilter('cargos_id','=',10));
  52. $funcionario = new TDBFCombo('vendedor_id''mysql''Funcionarios','id''nome');
  53.     
  54.         
  55.       
  56.       // cliente
  57.        $cliente_id = new TSeekButton('cliente_id');
  58.         $cliente = new TEntry('cliente');
  59.         $cliente->setEditable(FALSE);
  60.         $seek2 = new TStandardSeek();
  61.         
  62.         $action2 = new TAction(array($seek2,'onSetup'));
  63.         $action2->setParameter('database''mysql');
  64.         $action2->setParameter('parent','VendasCompleta');
  65.         $action2->setParameter('model','Cliente');
  66.         $action2->setParameter('display_field','razaoSocial');
  67.         $action2->setParameter('receive_key','cliente_id');
  68.         $action2->setParameter('receive_field','cliente');
  69.         
  70.           $cliente_id->setAction($action2);
  71.         
  72.           
  73.         
  74.           $pagamento = new TDBCombo('pagamento_id','mysql','Parcelas','id','tipo');
  75.         $nparcelas = new TEntry('maximo');
  76.         $juros = new TEntry('juros');
  77.        
  78.        
  79.         $nparcelas->setEditable(FALSE);
  80.         $juros->setEditable(FALSE);
  81.        
  82.      
  83.        $parcelas = new TEntry('parcelas');
  84.         $parcelas->setMask('99');
  85.        $vparcela = new TEntry('vparcela');
  86.         $vparcela->setNumericMask(2'.'',');
  87.         $vparcela->setMaxLength(6);
  88.         $vparcela->setEditable(FALSE);
  89.         
  90.          $vtotal = new TEntry('vtotal');
  91.         $vtotal->setNumericMask(2'.'',');
  92.         $vtotal->setMaxLength(6);
  93.         $vtotal->setEditable(FALSE);
  94.         
  95.        
  96.        $label = new TLabel('Data Pagamento');
  97.       $row =  $tableP1->addRow();
  98.       
  99.       $row->addCell($label);
  100.       $cell $row->addCell($dataf);
  101.      $cell->colspan 2;
  102.       
  103.           $row =  $tableP1->addRow();
  104.           $label = new TLabel('Funcionario');
  105.        $row->addCell($label);
  106.       $row->addCell($funcionario);
  107.       
  108.    
  109.       
  110.       
  111.        $row =  $tableP1->addRow();
  112.        $label = new TLabel('Cod Cliente');
  113.        $row->addCell($label);
  114.        $row->addCell($cliente_id);
  115.        
  116.        $label = new TLabel('Cliente');
  117.        $row->addCell($label);
  118.        $row->addCell($cliente);
  119.        
  120.       
  121.       
  122.    
  123.       $row $tableP1->addRow();
  124.     
  125.       
  126.          $label = new TLabel('Forma de Pagamento');
  127.        $row->addCell($label);
  128.    $row->addCell($pagamento);
  129.    
  130.     $row $tableP1->addRow();
  131.           $label = new TLabel('Parcelas');
  132.        $row->addCell($label);
  133.    $row->addCell($parcelas);
  134.    
  135.     $row $tableP1->addRow();
  136.        $label = new TLabel('Juros');
  137.        $row->addCell($label);
  138.    $row->addCell($juros);
  139.    
  140.    
  141.        $label = new TLabel('Valor Parcela');
  142.        $row->addCell($label);
  143.    $row->addCell($vparcela);
  144.    
  145.    
  146.        $row=$tableP1->addRow();
  147.        
  148.          $label = new TLabel('Valor Total');
  149.        $row->addCell($label);
  150.       $row->addCell($valor);
  151.       
  152.    
  153.        $label = new TLabel('Valor Final');
  154.        $row->addCell($label);
  155.    $row->addCell($vtotal);
  156.    
  157.    
  158.    
  159.    $row $tableP1->addRow();
  160.    $calcular = new TButton('gerar');
  161.    
  162.   // $calcular->setAction(new TAction(array($this,'calcular')),'Calcular');
  163.     $save = new TButton('salvar');
  164.    
  165.    //$save->setAction(new TAction(array($this,'onSave')),'gravar');
  166. $save->setImage('ico_save.png');
  167.    
  168.    $row->addCell($calcular);
  169.    $row->addCell($save);
  170. $tableP2 = new TTable();
  171.                 $row =  $tableP2->addRow();
  172.                 $row->addCell($this->multfild);
  173.                 $incluir = new TButton('Add');
  174.                 $row =  $tableP2->addRow();
  175.                 $row->addCell($incluir);
  176.       $this->form->add($tableP1);
  177.      
  178.       $this->note->appendPage('Dados Do Cliente',$tableP1);
  179.       $this->note->appendPage('Dados Dos Produto',$tableP2 );
  180.                 $this->form->setFields(array(
  181.          $vparcela,$funcionario,
  182.          $vtotal,$parcelas,$pagamento,$dataf,$cliente$cliente_id,
  183.          $calcular,$juros,$valor,$save,$this->multfild,$incluir,$produto_nome,$produto_id));
  184.                 $this->form->add($this->note);
  185.       parent::add($this->note);
  186.     }
  187.     
  188.     function onEdit($param NULL){
  189.              $dados $this->form->getData();
  190.                 try {
  191.            
  192.              TTransaction::open('mysql');
  193.          
  194.           if(isset($param['key'])){   
  195.              $this->venda = new Receber($param['key']);
  196.           
  197.             $dados->dataVencimento $venda->dataVencimento ;
  198.             $dados->produto_id $venda->produto_id ;
  199.             $dados->vendedor_id =  $venda->vendedor_id ;
  200.             $dados->cliente_id $venda->cliente_id   ;
  201.             $dados->vparcela $venda->vparcela ;
  202.             $dados->vtotal =  $venda->vtotal ;
  203.             $dados->pagamento_id $venda->pagamento_id ;
  204.              
  205.           }else{
  206.                 $this->venda = new Receber();
  207.           }
  208.         
  209.   
  210.                  TForm::sendData('VendasCompleta'$dados);
  211.              TTransaction::close();
  212.        } catch (Exception $ex) {
  213.            
  214.            new TMessage('error'$ex->getMessage());
  215.            TTransaction::rollback();
  216.            
  217.        }
  218.     }
  219.    
  220. }