Skip to content

Instantly share code, notes, and snippets.

@devfabriciobr
Last active June 23, 2023 16:50
Show Gist options
  • Select an option

  • Save devfabriciobr/7ea695248dd17ffb05f6d89fc9bcbd25 to your computer and use it in GitHub Desktop.

Select an option

Save devfabriciobr/7ea695248dd17ffb05f6d89fc9bcbd25 to your computer and use it in GitHub Desktop.
LER ITENS DO TFieldList e DetailForm
<?php
# CASO QUEIRA LER OS REGISTROS DOS COMPONENTES TFieldList OU DetailForm
# EM ALGUM MÉTODO PARA REALIZAR ALGUM PROCESSO, VALIDAÇÃO, etc..
# SEGUE OS EXEMPLOS:
$total = 0.00;
# LER ITENS DO TFieldList
if(!empty($param['venda_item_id']) and is_array($param['venda_item_id']))
{
foreach($param['venda_item_id'] as $linha => $linha_id)
{
$total += floatval($param['venda_item_valor'][$linha]);
}
}
# LER ITENS DO DetailForm
if(!empty($param['venda_item__row__data']))
{
$linhas = 0;
$rowId = $param['venda_item__row__id'];
foreach($param['venda_item__row__data'] as $item)
{
$item = unserialize(base64_decode($item));
$total += floatval($item->total);
$linhas++;
}
}
# ATUALIZA O TOTAL
$object->total = $total;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment