Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Estou desenvolvendo uma aplicação utilizando PHP/MySQL e Ajax, ainda estou aprendendo PHP OO e resolvi utilizar nessa aplicação...não sei se estou fazendo algo errado mas a Locaweb está me bloqueando, já é a segunda vez que acontece... da primeira achei que podia ser porque eu estava chamando a conexão várias vezes, corrigi e sempre no final do código mando fechar a conexão, porém parece que não é isso pq está acontecendo denovo
já aconteceu isso com alguem? não sei como resolver, ja revisei todo o meu código e nada
segue o código:
Classe de conexão
<?php
class ConectaBD {
var $host = "xxx";
var $usuario = "xxx";
var $senha = "xxx";
var $banco = "xxx";
var $conexao;
var $sql; function conecta(){
try {
$this->conexao = @mysql_connect($this->host, $this->usuario, $this->senha);
}
catch(Exception $e){
return $e->getMessage();
}
try{
$db = @mysql_select_db($this->banco);
}
catch(Exception $e){
return $e->getMessage();
}
}
function fechar(){
if($this->conexao){
@mysql_close($this->conexao);
}
} function query($sql){
$this->sql = mysql_query($sql)or die(mysql_error());
return $this->sql;
}
function resultado(){
return mysql_fetch_array($this->sql);
}
function numrows(){
return mysql_num_rows($this->sql);
}
function ultimoID(){
$this->sql = mysql_query("SELECT LAST_INSERT_ID() as id");
return $this->sql;
}
function zebraLinha($i,$cor){
if($i % 2){
echo $cor;
}
}
}
?>
<?php
include("db.class.php");
class LoteCheque extends ConectaBD {
var $ip;
var $sessao;
var $datahora;
function getIP(){
return $_SERVER['REMOTE_ADDR'];
}
function getSessionID(){
return session_id();
}
function getData(){
return date('Y-m-d H:i:s');
}
public function AbreLote($idcliente,$data){
if(isset($idcliente)){
$abre = "INSERT INTO lote(id_cliente,datalote) VALUES('".$idcliente."','".$data."')";
$this->sql = mysql_query($abre);
return $this->sql;
}
}
public function AdicionarItem($idusuario,$idcliente,$nrocheque,$nrobanco,$agencia,$conta,$valor,$valor_desconto,$compensacao,$consulta,$cpf_cnpj,$cheque_nome,$entregue,$emissao,$vencimento,
$pagamento,$devolvido,$compensado,$dizimado,$session_id,$ip){
if(isset($idusuario) && isset($session_id) && isset($ip)){
$inserir = "INSERT INTO sessao(id_usuario,id_cliente,nro_cheque,nro_banco,agencia,conta,
valor,valor_desconto,dias_compensacao,preco_consulta,cpf_cnpj,cheque_nome,
entregue,emissao,vencimento,pagamento,devolvido,compensado,dizimado,session_id,ip)
VALUES('$idusuario','$idcliente','$nrocheque','$nrobanco','$agencia','$conta','$valor','$valor_desconto','$compensacao',
'$consulta','$cpf_cnpj','$cheque_nome','$entregue','$emissao','$vencimento','$pagamento','$devolvido',
'$compensado','$dizimado','$session_id','$ip')";
$this->sql = mysql_query($inserir);
return $this->sql;
}
}
public function ApagaItem($idsessao,$sessao,$ip){
if(isset($idsessao) && isset($sessao) && isset($ip)){
$apaga = "DELETE FROM sessao WHERE id_sessao = '".$idsessao."' AND session_id = '".$sessao."' AND ip = '".$ip."' ";
$this->sql = mysql_query($apaga);
return $this->sql;
}
}
public function LimpaLote($sessao,$ip,$idusuario,$idcliente){
if(isset($sessao) && isset($ip) && isset($idusuario) && isset($idcliente)){
$apaga = "DELETE FROM sessao WHERE session_id = '".$sessao."' AND ip = '".$ip."' AND id_usuario = '".$idusuario."' AND id_cliente = '".$idcliente."'";
$this->sql = mysql_query($apaga);
return $this->sql;
}
}
}
?>
essa é a página que estou mexendo, se tiver algum erro ou é nela ou nas verificações que faço com ajax
altera-cliente.php
<?php
foreach($_POST AS $key => $value) { ${$key} = $value; }
foreach($_GET AS $key => $value) { ${$key} = $value; }
include_once("classes/db.class.php");
include_once("classes/login.class.php");
include_once("classes/diadasemana.php");
$login = new Usuario();
$login->Verifica();
$sql = new ConectaBD();
$sql->conecta();
$sql->query("SELECT SQL_CACHE * FROM parametros");
$params = $sql->resultado();
$diaSemana = new Diadasemana();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>.:: Intranet Futuritty ::.</title>
<style type="text/css">
a {text-decoration:none;}
</style>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/estilo.css" rel="stylesheet" type="text/css">
<link href="css/tabs.css" rel="stylesheet" type="text/css">
<script language="javascript">
function TABEnter(oEvent){
var oEvent = (oEvent)? oEvent : event;
var oTarget =(oEvent.target)? oEvent.target : oEvent.srcElement;
if(oEvent.keyCode==13)
oEvent.keyCode = 9;
if(oTarget.type=="text" && oEvent.keyCode==13)
//return false;
oEvent.keyCode = 9;
if (oTarget.type=="radio" && oEvent.keyCode==13)
oEvent.keyCode = 9;
}
</script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.maskedinput-1.1.4.pack.js"></script>
<script src="js/jquery.maskMoney.0.2.js" type="text/javascript"></script>
<script src="js/funcoes.js" type="text/javascript"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script src="js/checa-lote.js" type="text/javascript" charset="utf-8"></script>
<script src="js/validar.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function() {
//Default Action
<?php
if(isset($_SESSION['verifica']) && $_SESSION['verifica'] == "3"){
?>
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:#tab3").addClass("active").show(); //Activate first tab
$(".tab_content#tab3").show(); //Show first tab content
<?php
}elseif(isset($_SESSION['verifica']) && $_SESSION['verifica'] == "2"){
?>
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:#tab2").addClass("active").show(); //Activate first tab
$(".tab_content#tab2").show(); //Show first tab content
<?php
}
else{
?>
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
<?php
}
?>
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).show(); //Fade in the active content
return false;
});
});
</script>
<script type="text/javascript">
function apagar(id){
if(confirm("Deseja excluir esse Lote? Ao excluí-lo todos os registros relacionados também serão excluídos!")){
window.location.href="checa-lote.php?acao=excluir-lote&id="+id;
}
}
</script>
</head>
<body bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0">
<div align="center">
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php include ("topo.php"); ?></td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="153" height="450" align="left" valign="top">
<?php
include ("menu.php");
?> </td>
<td width="850" align="center" valign="top" class="textonormal">
<strong>Clientes</strong>
<br><br>
<div class="container">
<ul class="tabs">
<li><a href="#tab1">Dados Cliente</a></li>
<li><a href="#tab2">Lotes</a></li>
<li><a href="#tab3">Abrir Lote</a></li>
<li><a href="#tab4">Busca</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content">
<?php
$sql->query("SELECT * FROM clientes WHERE id_cliente = '".$id."'");
$row = $sql->resultado();
?>
<h2>DADOS CADASTRAIS</h2>
<table width="513" border="0" cellpadding="0" cellspacing="0" bordercolor="#999999" class="element" style="border-collapse:collapse">
<tr>
<td width="513">
<form action="clientes-func.php" method="post" id="forms">
<table width="496" border="0" align="center" cellpadding="1" cellspacing="1" class="textonormal">
<tr>
<td width="93"><strong>Nome:</strong></td>
<td colspan="3">
<input name="nome" type="text" class="text" id="nome" size="40" onKeyDown="TABEnter()" value="<?php echo $row['nome']?>"></td>
</tr>
<tr>
<td><strong>Endereço:</strong></td>
<td colspan="3">
<input name="endereco" type="text" class="text" id="endereco" size="40" onKeyDown="TABEnter()" value="<?php echo $row['endereco']?>">
</td>
</tr>
<tr>
<td><strong>Bairro:</strong></td>
<td colspan="3"><input name="bairro" type="text" class="text" id="bairro" size="40" onKeyDown="TABEnter()" value="<?php echo $row['bairro']?>"></td>
</tr>
<tr>
<td><strong>Cidade:</strong></td>
<td colspan="3">
<input name="cidade" type="text" class="text" id="cidade" size="28" onKeyDown="TABEnter()" value="<?php echo $row['cidade']?>">
<strong>UF:</strong>
<select name="estado" size="1" class="form_campos" id="estado" onKeyDown="TABEnter()">
<option value="<?php echo $row['estado']?>" selected><?php echo $row['estado']?></option>
<option value="Acre">Acre</option>
<option value="Alagoas"> Alagoas</option>
<option value="Amapá">Amapá</option>
<option value="Amazonas"> Amazonas</option>
<option value="Bahia">Bahia</option>
<option value="Ceará">Ceará</option>
<option value="Distrito Federal"> Distrito
Federal</option>
<option value="Espirito Santo"> Espírito Santo</option>
<option value="Goiás">Goiás</option>
<option value="Maranhão"> Maranhão</option>
<option value="Mato Grosso"> Mato Grosso</option>
<option value="Mato Grosso do Sul"> Mato
Grosso do Sul</option>
<option value="Minas Gerais"> Minas Gerais</option>
<option value="Pará">Pará</option>
<option value="Paraíba"> Paraíba</option>
<option value="Paraná"> Paraná</option>
<option value="Pernambuco"> Pernambuco</option>
<option value="Piauí">Piauí</option>
<option value="Rio de Janeiro"> Rio de Janeiro</option>
<option value="Rio Grande do Norte"> Rio
Grande do Norte</option>
<option value="Rio Grande do Sul"> Rio Grande
do Sul</option>
<option value="Rondônia"> Rondônia</option>
<option value="Roraima"> Roraima</option>
<option value="Santa Catarina"> Santa Catarina</option>
<option value="São Paulo"> São Paulo</option>
<option value="Sergipe"> Sergipe</option>
<option value="Tocantins"> Tocantins</option>
</select>
</td>
</tr>
<tr>
<td><strong>CEP:</strong></td>
<td width="159"><input name="cep" type="text" class="text" id="cep" size="17" onKeyDown="TABEnter()" value="<?php echo $row['cep']?>">
<strong> </strong></td>
<td width="88" align="right"><strong>Contato: </strong></td>
<td width="143"><strong>
<input name="contato" type="text" class="text" id="contato" size="17" onKeyDown="TABEnter()" value="<?php echo $row['contato']?>">
</strong></td>
</tr>
<tr>
<td><strong>CNPJ:</strong></td>
<td><input name="cnpj" type="text" class="text" id="cnpj" size="17" onBlur="ValidaCNPJ(this.value);" onKeyDown="TABEnter()" value="<?php echo $row['cnpj']?>"></td>
<td align="right"><strong>Insc. Est:</strong></td>
<td><input name="ie" type="text" class="text" id="ie" size="17" onKeyDown="TABEnter()" value="<?php echo $row['inscr_estadual']?>"></td>
</tr>
<tr>
<td><strong>CPF:</strong></td>
<td>
<input name="cpf" type="text" class="text" id="cpf" size="17" onBlur="validarCPF(this)" onKeyDown="TABEnter()" value="<?php echo $row['cpf']?>"></td>
<td align="right"><strong>RG:</strong></td>
<td>
<input name="rg" type="text" class="text" id="rg" size="17" onKeyDown="TABEnter()" value="<?php echo $row['rg']?>"> </td>
</tr>
<tr>
<td><strong>Fone:</strong></td>
<td><input name="fone" type="text" class="text" id="fone" size="17" onKeyDown="TABEnter()" value="<?php echo $row['telefone']?>"></td>
<td align="right"><strong>Nascimento:</strong></td>
<td>
<input name="nasc" type="text" class="text" id="nasc" size="10" onKeyDown="TABEnter()" value="<?php echo $row['nascimento']?>"> </td>
</tr>
<tr>
<td><strong>Celular:</strong></td>
<td>
<input name="celular" type="text" class="text" id="celular" size="17" onKeyDown="TABEnter()" value="<?php echo $row['celular']?>">
</td>
<td align="right"><strong>Data Cadastro:</strong></td>
<td>
<input name="datacad" type="text" class="text" id="datacad" size="10" onKeyDown="TABEnter()" value="<?php echo $row['data_cadastro']?>" >
</td>
</tr>
<tr>
<td><strong>E-mail:</strong></td>
<td colspan="3"><input name="email" type="text" class="text" id="email" size="35" onKeyPress="javascript:retiraAcento(this);" onKeyDown="TABEnter()" value="<?php echo $row['email']?>"></td>
</tr>
<tr>
<td><strong>Conjuge:</strong></td>
<td colspan="2"><input name="conjuge" type="text" class="text" id="conjuge" size="35" onKeyDown="TABEnter()" value="<?php echo $row['conjuge']?>"></td>
<td>
<input name="ativo" type="checkbox" id="ativo" value="S" onKeyDown="TABEnter()" <?php if($row['inativo'] == "S"){?> checked <?php }?>>
<strong>Cliente Inativo?</strong>
</td>
</tr>
<tr>
<td><strong>Taxa:</strong></td>
<td colspan="3">
<input name="taxa" type="text" class="text" id="taxa" size="5" onKeyDown="TABEnter()" value="<?php echo abs($row['taxa'])?>">
<strong>%</strong></td>
</tr>
<tr>
<td><strong>Observações:</strong></td>
<td colspan="3">
<textarea name="observacoes" id="observacoes" cols="35" rows="5" class="textarea"><?php echo $row['observacoes']?></textarea></td>
</tr>
<tr>
<td> </td>
<td colspan="3">
<input type="submit" name="btnCad" id="btnCad" value="Alterar">
<input type="hidden" name="idcliente" value="<?php echo $id?>">
<input type="hidden" name="xacao" value="alterar"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
<div id="tab2" class="tab_content">
<h2>LOTES</h2>
<table width="399" border="0" cellpadding="1" cellspacing="1" class="textonormal">
<?php
$sql->query("SELECT l.id_lote,l.id_cliente,l.datalote,
li.valor,li.valor_desconto,sum(li.valor) as total,
li.emissao,li.vencimento
FROM lote l
INNER JOIN lote_itens li ON (li.id_lote = l.id_lote)
WHERE l.id_cliente = '".$id."'
GROUP BY l.id_lote");
if($sql->numrows() == 0){
}else{
?>
<tr>
<td width="71" bgcolor="#EEEEEE"><div align="center"><strong>Lote nº</strong></div></td>
<td width="104" bgcolor="#EEEEEE"><div align="center"><strong>Data Lote</strong></div></td>
<td width="115" bgcolor="#EEEEEE"><div align="center"><strong>Total</strong></div></td>
<td width="46" bgcolor="#EEEEEE"><div align="center"><strong>Ver</strong></div></td>
<td width="47" bgcolor="#EEEEEE"><div align="center"><strong>Excluir</strong></div></td>
</tr>
<?php
$i = 0;
while($resp = $sql->resultado()){
?>
<tr>
<td bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><div align="center"><strong><?php echo $resp['id_lote'] ?></strong></div></td>
<td bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><div align="center"><?php echo $resp['datalote'] ?></div></td>
<td bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><div align="center"><?php echo "R$ ".number_format($resp['total'],2,',','.') ?></div></td>
<td bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><div align="center"><a href="#" onClick="window.open('detalhes-lote.php?id=<?php echo $resp['id_lote'] ?>&idcliente=<?php echo $id ?>','popup', 'toolbar=no,location=no,resizable=no,width=700,height=500')"><img src="imagens/ver.gif" width="16" height="16" border="0"></a></div></td>
<td bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><div align="center"><a onClick="apagar(<?php echo $resp['id_lote'] ?>)" style="cursor:pointer"><img src="imagens/logo_excluir.gif" width="16" height="16" border="0"></a></div></td>
</tr>
<?php
$i++;
}
}
?>
</table>
</div>
<div id="tab3" class="tab_content">
<h2>CADASTRAR</h2>
<?php
$url = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
$valor_desconto = $row['taxa'];
?>
<table width="570" border="0" align="center" cellpadding="1" cellspacing="1" class="element">
<tr>
<td width="566">
<form action="checa-lote.php" id="form2" method="post">
<table width="550" border="0" align="center" cellpadding="1" cellspacing="1" class="textonormal">
<tr>
<td width="95"><strong>Cheque Nr:</strong></td>
<td width="238">
<input name="chequenro" type="text" class="text" id="chequenro" size="20" onKeyDown="TABEnter()"> </td>
<td width="107"><div align="left"><strong>Emissão:</strong></div></td>
<td width="97">
<input name="emissao" type="text" class="text" id="emissao" onKeyDown="TABEnter()" size="10"> </td>
</tr>
<tr>
<td><strong>Nr Banco:</strong></td>
<td>
<div style="float:left">
<input name="nrobanco" type="text" class="text" id="nrobanco" size="3" onKeyDown="TABEnter()">
</div>
<div style="float:left; padding-top:6px; padding-left:3px">
<div id="respbanco"></div>
</div> </td>
<td><div align="left"><strong>Vencimento:</strong></div></td>
<td><input name="vencimento" type="text" class="text" id="vencimento" onKeyDown="TABEnter()" size="10"></td>
</tr>
<tr>
<td><strong>Agência:</strong></td>
<td><input name="agencia" type="text" class="text" id="agencia" size="20" onKeyDown="TABEnter()"></td>
<td><div align="left"><strong>Pagamento:</strong></div></td>
<td><input name="pagamento" type="text" class="text" id="pagamento" onKeyDown="TABEnter()" size="10"></td>
</tr>
<tr>
<td><strong>Conta:</strong></td>
<td>
<input name="conta" type="text" class="text" id="conta" size="20" onKeyDown="TABEnter()"></td>
<td><div align="left"><strong>Valor Cheque R$:</strong></div></td>
<td><input name="valor" type="text" class="text" id="valor" size="10" onKeyDown="TABEnter()"></td>
</tr>
<tr>
<td><strong>CPF/CNPJ:</strong></td>
<td>
<div style="float: left">
<input name="cpf_cnpj" type="text" class="text" id="cpf_cnpj" size="20" onBlur="validar(this);" onKeyDown="TABEnter()">
</div>
<div style="float:left; padding-top:6px; padding-left:3px">
<div id="respdoc"></div>
</div> </td>
<td><div align="left"><strong>Porcentagem %: </strong></div></td>
<td><input name="valor_desconto" type="text" class="text" id="valor_desconto" size="10" onKeyDown="TABEnter()" value="<?php echo abs($row['taxa'])?>"></td>
</tr>
<tr>
<td><strong>Cheque Nome:</strong></td>
<td>
<input name="chequenome" type="text" class="text" id="chequenome" size="32" onKeyDown="TABEnter()"></td>
<td><div align="left"><strong>Preço consulta R$:</strong></div></td>
<td><input name="consulta" type="text" class="text" id="consulta" onKeyDown="TABEnter()" size="10" value="<?php echo $params['preco_consulta']?>"></td>
</tr>
<tr>
<td><strong>Entregue a:</strong></td>
<td>
<input name="entregue" type="text" class="text" id="entregue" size="32" onKeyDown="TABEnter()" value="<?php echo $row['nome']?>"></td>
<td><div align="left"><strong>Compensação:</strong></div></td>
<td><input name="compensacao" type="text" class="text" id="compensacao" onKeyDown="TABEnter()" size="10" value="<?php echo $params['dias_compensacao'] ?>"></td>
</tr>
<tr>
<td><strong>Devolvido:</strong></td>
<td>
<input name="devolvido" type="text" class="text" id="devolvido" size="10" onKeyDown="TABEnter()"></td>
<td colspan="2"><div align="center"><img src="../imagens/botcalcular.gif" id="calcular" border="0" style="cursor:pointer"></div></td>
</tr>
<tr>
<td><strong>Compensado:</strong></td>
<td>
<input type="radio" name="compensado" id="compensado" value="S">
Sim
<input name="compensado" type="radio" id="compensado" value="N" checked>
Não</td>
<td colspan="2" rowspan="3" valign="top"><div id="resultcalc"></div></td>
</tr>
<tr>
<td><strong>Dizimado:</strong></td>
<td>
<input type="radio" name="dizimado" id="dizimado" value="S">
Sim
<input name="dizimado" type="radio" id="dizimado" value="N" checked>
Não</td>
</tr>
<tr>
<td><strong>Tipo Cheque:</strong></td>
<td>
<input type="radio" name="tp" id="tp" value="B">
Branco
<input type="radio" name="tp" id="tp" value="P">
Preenchido
</td>
</tr>
<tr>
<td> </td>
<td colspan="3"><input type="submit" name="btnCadLote" id="btnCadLote" value="Cadastrar">
<input type="hidden" name="idcliente" id="idcliente" value="<?php echo $id?>">
<input type="hidden" name="idusuario" id="idusuario" value="<?php echo $_SESSION['id']?>">
<input type="hidden" name="url" id="url" value="<?php echo $url?>">
<input type="hidden" name="acao" value="cadastra-lote"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<div id="respenvia"></div>
<div id="lote">
<?php
$sessao = session_id();
$sql->query("SELECT * FROM sessao WHERE session_id = '".$sessao."' AND id_cliente = '".$id."' AND id_usuario = '".$_SESSION['id']."' ORDER BY id_sessao DESC");
if($sql->numrows() == 0){
}else{
?>
<table border="0" cellpadding="1" cellspacing="1" width="655" class="tabela" style="color: #000000; font-family: Arial; font-size: 12px; text-decoration: none;">
<tr>
<td bgcolor="#EEEEEE" width="64" align="center"><strong>Cheque Nº</strong></td>
<td bgcolor="#EEEEEE" width="204" align="left"><strong>Nome</strong></td>
<td bgcolor="#EEEEEE" width="97" align="center"><strong>Valor</strong></td>
<td bgcolor="#EEEEEE" width="31" align="center"><strong>Dias</strong></td>
<td bgcolor="#EEEEEE" width="71" align="center"><strong>Total</strong></td>
<td bgcolor="#EEEEEE" width="71" align="center"><strong>Pagar</strong></td>
<td bgcolor="#EEEEEE" width="51" align="center"><strong>Detalhes</strong></td>
<td bgcolor="#EEEEEE" width="41" align="center"><div align="center"><strong>Excluir</strong></div></td>
</tr>
<?php
$i = 0;
while($rowx = $sql->resultado()){
$total_valor += $rowx['valor'];
?>
<tr id="<?php echo $rowx['id_sessao'] ?>" class="linha">
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><?php echo $rowx['nro_cheque'] ?></td>
<td align="left" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"> <?php echo $rowx['cheque_nome'] ?></td>
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><strong><?php echo "R$ ".number_format($rowx['valor'],2,',','.') ?></strong></td>
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>">
<?php
$dia = $diaSemana->dtBanco($rowx['vencimento']); // converte a data para Y-m-d
$diaSemana->getDia($dia); //retorna nome do dia
$coddia = $diaSemana->codDia;// pega o codigo do dia
$sql_feriado = mysql_query("SELECT * FROM feriados WHERE data = '".$rowx['vencimento']."'");
if(mysql_num_rows($sql_feriado) == 0){
$compensacao = $rowx['dias_compensacao'];
}else{
$compensacao = $rowx['dias_compensacao']+1;
$resp = mysql_fetch_array($sql_feriado);
$feriado = $resp['feriado'];
}
$vencimento = explode("/",$rowx['vencimento']);
$emissao = explode("/",$rowx['emissao']);
$dia_emissao = mktime(0,0,0,$emissao[1],$emissao[0],$emissao[2]);
$venc_emissao = mktime(0,0,0,$vencimento[1],$vencimento[0],$vencimento[2]);
$dias = $venc_emissao - $dia_emissao;
if($coddia == '0'){// se o dia for sabado ou domingo acrescenta um dia
$compensacao = $compensacao + 1;
$dias = $dias / (60 * 60 * 24);
$dias = abs($dias);
$dias = floor($dias);
}
elseif($coddia == '6'){// se o dia for sabado ou domingo acrescenta um dia
$compensacao = $compensacao + 2;
$dias = $dias / (60 * 60 * 24);
$dias = abs($dias);
$dias = floor($dias);
}
else{
$dias = $dias / (60 * 60 * 24);
$dias = abs($dias);
$dias = floor($dias);
}
$dias_comp = $dias + $compensacao;
$uteis = $diaSemana->somar_dias_uteis($rowx['emissao'], $dias_comp);
echo $dias_comp;
?></td>
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>">
<strong>
<?php
$porcentagem = $rowx['valor_desconto'] / 100;
$total_dia = ($rowx['valor'] * $porcentagem) / 30;
$total_geral = $total_dia * $dias_comp;
$valor_total = $rowx['valor'] + $total_geral;
$total_juros += $valor_total + $rowx['preco_consulta'] ;
echo "R$ ".number_format($valor_total + $rowx['preco_consulta'],2,',','.');
?>
</strong></td>
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>">
<strong style="color:#FF0000">
<?php
$pagar = ($rowx['valor'] - $total_geral) - $rowx['preco_consulta'];
$total_pagar += $pagar;
echo "R$ ".number_format($pagar,2,',','.');
?>
</strong></td>
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><a onClick="window.open('detalhes-item.php?id=<?php echo $rowx['id_sessao'] ?>&idcliente=<?php echo $id?>','popup', 'toolbar=no,location=no,resizable=no,width=700,height=500')" style="cursor:pointer"><img src="imagens/ver.gif" width="16" height="16" border="0"></a></td>
<td align="center" bgcolor="<?php $sql->zebraLinha($i,"#EEEEEE")?>"><a href="#"><img src="imagens/logo_excluir.gif" border=0 class="itemexluir" id=" <?php echo $rowx['id_sessao'] ?>"></a></td>
</tr>
<?php
$i++;
}
?>
<tr bgcolor="#FFFFCC">
<td> </td>
<td><div align="right"><strong>TOTAL:</strong></div></td>
<td align="center"><strong style="color:#0066FF"><?php echo "R$ ".number_format($total_valor,2,',','.'); ?></strong></td>
<td> </td>
<td align="center"><strong style="color:#0066FF"><?php echo "R$ ".number_format($total_juros,2,',','.') ?></strong></td>
<td align="center"><strong style="color:#FF0000"><?php echo "R$ ".number_format($total_pagar,2,',','.') ?></strong></td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<input type="submit" id="enviaLote" value="Cadastrar Lote" style="border:1px solid #CCCCC; cursor:pointer;">
<?php
}
unset($_SESSION['verifica']);
?>
<br>
</div>
</div>
<div id="tab4" class="tab_content">
<h2>BUSCA</h2>
<h3>
<input name="busca" type="text" class="text" id="busca" size="35">
<img src="imagens/magnifier.png" alt="" width="16" height="16" border="0">
</h3>
<div id="resultado"></div>
</div>
</div>
</div>
</td>
</tr>
</table>
<?php include ("rodape.php"); ?>
</div>
</body>
</html>
<?php $sql->fechar(); ?>Carregando comentários...