Como faço para implementar o calculo na operação pegando o var INSS e obter o resultado na linha salario * inss
<?php
var inss = 8%;
$tabela = '<table border="1" border: solid gray 5px;>';//abre table
$tabela .='<thead>';//abre cabeçalho
$tabela .= '<tr>';//abre uma linha
$tabela .= '</tr>';//fecha linha
$tabela .='</thead>'; //fecha cabeçalho
$tabela .='<tbody>';//abre corpo da tabela
$db = pg_connect("port=55432 dbname=folha user=fortesrh password=1234");
$consulta=pg_query($db,"SELECT funcionario.nome, funcionario.cargo, cargo.salario from funcionario INNER JOIN cargo ON funcionario.cargo = cargo.descricao ORDER BY funcionario.nome");
while ($linha = pg_fetch_array($consulta)) {//declaração da variável linha trazendo o resultado da query
$tabela .= '<th colspan="2" width="210px">Folha de Pagamento</th>';
$tabela .= '<th colspan="3" width="410px">Data e Assinatura: ____/____/_____ ___________________________________________________</th>';
$tabela .= '</tr>';//fecha linha
$tabela .= '<th width="170px" height="20px" align="left">Empresa: XP Seriços Demonstrativos Ltda ME</th>';
$tabela .= '<th width="100px" align="left">CNPJ: 00.000.000/0000-00</th>';
$tabela .= '<th width="150px" align="center">Admissão: 10/05/2019</th>';
$tabela .= '<th width="150px" align="center">Competência: Junho de 2019</th>';
$tabela .= '</tr>';//fecha linha
$tabela .= '<tr>'; // abre uma linha
$tabela .= '<td>'.$linha['nome'].'</td>'; // coluna nome do funcionario
$tabela .= '<td align="center">'.$linha['cargo'].'</td>'; // coluna cargo
$tabela .= '<td align="center">'.$linha['salario'].'</td>'; // coluna salario
$tabela .= '<td align="center">'.$linha['salario * inss'].'</td>'; // coluna salario
$tabela .= '</tr>'; // fecha linha
$tabela .= '<th width="550px" colspan="5" align="center">----------------------------------------------------------------------</th>';
$tabela .= '</tr>'; // fecha linha
}
$tabela .='</tbody>'; //fecha corpo
$tabela .= '</table>';//fecha tabela
echo $tabela; // imprime
?>
SpoilerDiscussão (7)
Carregando comentários...