-
-
Save fayqLs/ede017eb49b5c49715ea72fc9a4695f9 to your computer and use it in GitHub Desktop.
ADICIONAR ITENS EM LOTE NO DETAILFORM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# VendaForm | |
public function onAddDetailVendaItemVenda($param = null) | |
{ | |
try | |
{ | |
$data = (object) $param; | |
if (empty($data->venda_item_venda__row__id)) | |
{ | |
$data = $this->form->getData(); | |
} | |
} | |
} | |
# ProdutoSimpleList | |
public function SelecionarItens($param = null) | |
{ | |
try | |
{ | |
$selecionados = TSession::getValue(__CLASS__.'builder_datagrid_check'); | |
if ($selecionados) | |
{ | |
TTransaction::open(self::$database); | |
$itens = array(); | |
foreach ($selecionados as $id) | |
{ | |
$produto = Produto::find($id); | |
if ($produto) | |
{ | |
$itens[] = array( | |
'venda_item_venda_produto' => $produto->nome, | |
'venda_item_venda_preco' => $produto->preco, | |
'venda_item_venda__row__id' => 'b'.uniqid(), | |
'venda_item_venda_id' => '' | |
); | |
} | |
} | |
TTransaction::close(); | |
if ($itens) | |
{ | |
TApplication::loadPage('VendaForm', 'onAddVendaItens',array( | |
'itens' => $itens, | |
'static' => 1 | |
)); | |
} | |
TScript::create("Template.closeRightPanel();"); | |
} | |
} | |
catch (Exception $e) | |
{ | |
new TMessage('error', $e->getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment