Problema com dados repetidos na tabela PHP
Estou com uma duvida, ao fazer um select para preencher um campo se ele for igual a real ele deveria preencher ex: o item 1 no valor de 1 real o item 2 no valor de 2 e o item no valor de 3, porem nos três itens ele preenche apenas com o 1º item.o código Controller:
-
<div class="container">
-
-
<div class="col-md-12">
-
<button id="btnProcessar" type="button" class="btn btn-primary" onclick="processEntSai('.$parameters.');"><span>Processar</span></button>
-
</div>
-
-
<div class="row">
-
<div class="col-md-12">
-
<table cellpadding="5" id="tableItemNota" class="display dataTable cell-border compact" cellspacing="0" style="textalign:center; border-bottom:1px solid black;">
-
<thead>
-
<tr style="border: 1px solid #ccc">
-
<th></th>
-
<th>Item</th>
-
<th>Imagem</th>
-
<th>Qtd</th>
-
<th>U.Medida</th>
-
<th>Peso</th>
-
<th>Código</th>
-
<th>Nº Série</th>
-
<th>Tamanho</th>
-
<th>Descrição</th>
-
<th>Coef.</th>
-
<th>Moeda</th>
-
<th>Valor Unitário</th>
-
<th>Valor Total</th>
-
</tr>
-
</thead>
-
<tbody>';
-
-
foreach($itemNFSaida as $item) {
-
if(file_exists('uploads/produtos/'.$item['CODREF'].'.JPG')){
-
$img_url = BASE_URL.'/uploads/produtos/'.$item['CODREF'].'.JPG';
-
} else {
-
$img_url = BASE_URL.'/assets/images/imgNotFound.png';
-
}
-
-
if($item['QTDDEV'] == $item[$qtdFatRec]){
-
$tdSelectBox = '<span class="glyphicon glyphicon-ban-circle"></span>';
-
} else{
-
$tdSelectBox = '<input type="checkbox" id="'.$item['NUMSEP'].'" name="checkSeq" value="'.$item[$seqCmp].'"/>';
-
}
-
-
if($item['USU_MOEVEN'] == 'AU'){
-
$item['valorEnt'] = $this->step5ModelObj->TotalentSaiComNota(10, $codFil, $numNota);
-
-
$item['PREUNI'] = $item['valorEnt']['USU_VLRMOE'];
-
-
}
-
echo '<tr>
-
<td class="order">'.$tdSelectBox.'</td>
-
<td>'.$item[$seqCmp].'</td>
-
<td><img src="'.$img_url.'" id="imgItemPed" data-codpro="'.$item['CODPRO'].'" onclick="itemModalDetalhes(this)"" style="width: 75px; border-radius: 5px; margin: 0px; cursor: pointer;"></td>
-
<td>'.number_format($item['QTD'], 2, '.', '').'</td>
-
<td>'.$item['UNIMED'].'</td>
-
<td>'.number_format($item['PESBRU'], 2, '.', '').'</td>
-
<td>'.$item['CODPRO'].'</td>
-
<td>'.$item['NUMSEP'].'</td>
-
<td>'.$item['CODDER'].'</td>
-
<td>'.$item['CPL'].'</td>
-
<td>'.number_format($item['USU_PREVEN'], 2, '.', '').'</td>
-
<td>'.$item['USU_MOEVEN'].'</td>
-
<td>'.number_format($item['PREUNI'], 2, ',', '').'</td>
-
<td>'.number_format($item['VLRLIQ'], 2, ',', '').'</td>
-
</tr>';
-
}
-
-
echo '</tbody>
-
</table>
-
</div>
-
</div>
-
</div>';
O código da Model:
-
public function TotalentSaiComNota($codEmp, $codFil, $numPed){
-
$sql = "SELECT
-
USU_VLRMOE
-
FROM
-
E140IPV
-
WHERE
-
CODEMP = ?
-
AND
-
CODFIL = ?
-
AND
-
NUMNFV = ?";
-
-
$sql = $this->db->prepare($sql);
-
$sql->execute(array($codEmp, $codFil, $numPed));
-
-
return $sql->fetch();
-
}
Resumindo preciso que não repita o item do select como está repetindo, preciso que traga os item do select 1. item 1
2. item 2
3. item 3
e não 1. item 1
2. item 1
3. item 1Discussão (0)
Carregando comentários...