AS
TStandardSeek parou do nada
Fechado
opa galera tinha um for que tava funcionando redondinho, derrepente os TstandardSeek pararam
alguma luz
alguma luz
- <?php
- class VendasCompleto extends TPage{
- protected $form;
- protected $value;
- protected $itens;
- protected 679;
- protected $descricao;
- protected $venda;
- protected $multfild;
- protected $note;
- function __construct() {
- parent::__construct();
- $this->form = new TForm('VendasCompleta');
- $this->venda = new Receber();
- $this->note = new TNotebook(800,300);
- $tableP1 = new TTable();
- $this->multfild = new TMultiField('produtos');
- //produto
- // cliente
- $produto_id = new TSeekButton('produto_id');
- $produto_nome = new TEntry('produto_nome');
- $produto_nome->setEditable(FALSE);
- $seek = new TStandardSeek();
- $action = new TAction(array($seek,'onSetup'));
- $action->setParameter('database', 'mysql');
- $action->setParameter('parent','VendasCompleta');
- $action->setParameter('model','Produto');
- $action->setParameter('display_field','nome');
- $action->setParameter('receive_key','produto_id');
- $action->setParameter('receive_field','produto_nome');
- $produto_id->setAction($action);
- $qtd = new TEntry('qtd');
- $qtd->setMask('999');
- $this->multfild->addField('produto_id','ID',$produto_id,200);
- $this->multfild->addField('produto_nome','Produto',$produto_nome,200);
- $this->multfild->addField('qtd','Quantidade',$qtd,200);
- 679 = new THidden('id');
- $dataf = new TDate('dataVencimento');
- $valor = new TEntry('valor');
- $valor->setNumericMask(2, '.', '');
- $valor->setMaxLength(9);
- $valor->setEditable(FALSE);
- $filter = array(new TFilter('cargos_id','=',10));
- $funcionario = new TDBFCombo('vendedor_id', 'mysql', 'Funcionarios','id', 'nome');
- // cliente
- $cliente_id = new TSeekButton('cliente_id');
- $cliente = new TEntry('cliente');
- $cliente->setEditable(FALSE);
- $seek = new TStandardSeek();
- $action = new TAction(array($seek,'onSetup'));
- $action->setParameter('database', 'mysql');
- $action->setParameter('parent','VendasCompleta');
- $action->setParameter('model','Cliente');
- $action->setParameter('display_field','razaoSocial');
- $action->setParameter('receive_key','cliente_id');
- $action->setParameter('receive_field','cliente');
- $cliente_id->setAction($action);
- $pagamento = new TDBCombo('pagamento_id','mysql','Parcelas','id','tipo');
- $nparcelas = new TEntry('maximo');
- $juros = new TEntry('juros');
- $nparcelas->setEditable(FALSE);
- $juros->setEditable(FALSE);
- $parcelas = new TEntry('parcelas');
- $parcelas->setMask('99');
- $vparcela = new TEntry('vparcela');
- $vparcela->setNumericMask(2, '.', ',');
- $vparcela->setMaxLength(6);
- $vparcela->setEditable(FALSE);
- $vtotal = new TEntry('vtotal');
- $vtotal->setNumericMask(2, '.', ',');
- $vtotal->setMaxLength(6);
- $vtotal->setEditable(FALSE);
- $label = new TLabel('Data Pagamento');
- $row = $tableP1->addRow();
- $row->addCell($label);
- $cell = $row->addCell($dataf);
- $cell->colspan = 2;
- $row = $tableP1->addRow();
- $label = new TLabel('Funcionario');
- $row->addCell($label);
- $row->addCell($funcionario);
- $row = $tableP1->addRow();
- $label = new TLabel('Cod Cliente');
- $row->addCell($label);
- $row->addCell($cliente_id);
- $label = new TLabel('Cliente');
- $row->addCell($label);
- $row->addCell($cliente);
- $row = $tableP1->addRow();
- $label = new TLabel('Forma de Pagamento');
- $row->addCell($label);
- $row->addCell($pagamento);
- $row = $tableP1->addRow();
- $label = new TLabel('Parcelas');
- $row->addCell($label);
- $row->addCell($parcelas);
- $row = $tableP1->addRow();
- $label = new TLabel('Juros');
- $row->addCell($label);
- $row->addCell($juros);
- $label = new TLabel('Valor Parcela');
- $row->addCell($label);
- $row->addCell($vparcela);
- $row=$tableP1->addRow();
- $label = new TLabel('Valor Total');
- $row->addCell($label);
- $row->addCell($valor);
- $label = new TLabel('Valor Final');
- $row->addCell($label);
- $row->addCell($vtotal);
- $row = $tableP1->addRow();
- $calcular = new TButton('gerar');
- // $calcular->setAction(new TAction(array($this,'calcular')),'Calcular');
- $save = new TButton('salvar');
- //$save->setAction(new TAction(array($this,'onSave')),'gravar');
- $save->setImage('ico_save.png');
- $row->addCell($calcular);
- $row->addCell($save);
- $tableP2 = new TTable();
- $row = $tableP2->addRow();
- $row->addCell($this->multfild);
- $incluir = new TButton('Add');
- $row = $tableP2->addRow();
- $row->addCell($incluir);
- $this->form->add($tableP1);
- $this->itens = new TText('descricao');
- $this->itens->setEditable(FALSE);
- $this->note->appendPage('Dados Do Cliente',$tableP1);
- $this->note->appendPage('Dados Dos Produto',$tableP2 );
- $this->note->appendPage('Produtos',$this->itens);
- $this->form->setFields(array(
- $vparcela,$funcionario,
- $vtotal,$parcelas,$pagamento,$dataf,$cliente, $cliente_id,
- $calcular,$juros,$valor,$save,$this->multfild,$incluir,$produto_nome,$produto_id));
- $this->form->add($this->note);
- parent::add($this->note);
- }
- function onEdit($param = NULL){
- $dados = $this->form->getData();
- try {
- TTransaction::open('mysql');
- if(isset($param['key'])){
- $this->venda = new Receber($param['key']);
- $dados->dataVencimento = $venda->dataVencimento ;
- $dados->produto_id = $venda->produto_id ;
- $dados->vendedor_id = $venda->vendedor_id ;
- $dados->cliente_id = $venda->cliente_id ;
- $dados->vparcela = $venda->vparcela ;
- $dados->vtotal = $venda->vtotal ;
- $dados->pagamento_id = $venda->pagamento_id ;
- }else{
- $this->venda = new Receber();
- }
- TForm::sendData('VendasCompleta', $dados);
- TTransaction::close();
- } catch (Exception $ex) {
- new TMessage('error', $ex->getMessage());
- TTransaction::rollback();
- }
- }
- }
Hum... parte do inicio veja se o Model está correto !!
qualquer coisa joga o var_dump($seek); para depurar....
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
Alexandre testa em outro core somente o $seek
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...
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
então pablo ate mudei, mas o problema é que nem um seek funciona nem mesmo os foras do multfiel