/** * Desenha o grid na tela * * @global type $con */ function mostraGrid() { $total_reg = "20"; // número de registros por página $pagina = $_SESSION['pagina']; //Current Page / Pagina Atual if (!$pagina) { $pc = "1"; } else { $pc = $pagina; } $inicio = $pc - 1; $inicio = $inicio * $total_reg; //Busca os registros para o Grid global $con; $busca = 'select k.*, p.descricao as pdescricao,e.descricao as edescricao from kardexs k left join produtos p on (p.id=k.produto_id) left join estoques e on (e.id=k.estoque_id)'; $qry_limitada = mysql_query("{$busca} LIMIT {$inicio},{$total_reg}"); $linha = mysql_fetch_assoc($qry_limitada); // Total de Registros na tabela $qry_total = mysql_query('SELECT count(*)as total from kardexs'); $linha_total = mysql_fetch_assoc($qry_total); //recupera a linha $total_registros = $linha_total['total']; //pega o valor ?> <table border="1"> <thead> <tr> <th>Id</th> <th>Data Movimento</th> <th>Produto</th> <th>P. Descricao</th> <th>Estoque</th> <th>Estoque</th> <th>Tipo Movimento</th> <th>sinal</th> <th>Qtd</th> <th>Acao</th> </tr> </thead> <tbody> <?php do { echo "\n <tr>\n <td>" . $linha['id'] . "</td>\n <td>" . $linha['created'] . "</td>" . "<td>" . $linha['produto_id'] . "</td>" . "<td>" . $linha['pdescricao'] . "</td>" . "<td>" . $linha['estoque_id'] . "</td>" . "<td>" . $linha['edescricao'] . "</td>" . "<td>" . $linha['tiposmovimento_id'] . "</td>" . "<td>" . $linha['sinal'] . "</td>" . "<td>" . $linha['qtd'] . "</td>" . "<td> <a href='cad_kardex.php?acao=confirmaExcluir&id=" . $linha['id'] . "'>Excluir</a></td>" . "</tr>"; } while ($linha = mysql_fetch_assoc($qry_limitada)); ?> </tbody> </table> <?php echo navegacao($pc, $total_registros); }
/** * Desenha o grid na tela * * @global type $con */ function mostraGrid() { $total_reg = "3"; // número de registros por página $pagina = $_SESSION['pagina']; //Current Page / Pagina Atual if (!$pagina) { $pc = "1"; } else { $pc = $pagina; } $inicio = $pc - 1; $inicio = $inicio * $total_reg; //Busca os registros para o Grid global $con; $busca = 'SELECT * from departamentos'; $qry_limitada = mysql_query("{$busca} LIMIT {$inicio},{$total_reg}"); $linha = mysql_fetch_assoc($qry_limitada); // Total de Registros na tabela $qry_total = mysql_query('SELECT count(*)as total from departamentos'); $linha_total = mysql_fetch_assoc($qry_total); //recupera a linha $total_registros = $linha_total['total']; //pega o valor ?> <table border="1"> <thead> <tr> <th>id</th> <th>descricao</th> <th>acao</th> </tr> </thead> <tbody> <?php do { echo "\n <tr>\n <td>" . $linha['id'] . "</td>\n <td>" . $linha['descricao'] . "</td>\n <td> <a href='cad_dep.php?acao=editar&id=" . $linha['id'] . "'>alterar</a> | \n <a href='cad_dep.php?acao=excluir&id=" . $linha['id'] . "'>excluir</a> </td> \n </tr>"; } while ($linha = mysql_fetch_assoc($qry_limitada)); ?> </tbody> </table> <?php echo navegacao($pc, $total_registros); }