Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

rubinhoss

Problema tabela na hora da impressão

Recommended Posts

Bom dia pessoa,

 

Estou com um problema e já procurei em todos os lugares e não consigo resolver.

 

Tenho uma tabela html com geração de linhas dinâmicas.

 

Porém quando vou imprimir e tenho mais de uma página dessas linhas me gera problema conforme imagem.

 

Poderiam me ajudar ?

 

XCjOGr3.png

Compartilhar este post


Link para o post
Compartilhar em outros sites

É um pouco grande.

 

Segue

      <table cellpadding="0" cellspacing="0">
        <tr>
          <td colspan="9" width="900" align="center" style="font-family:Calibri; font-size:40px;">RESUMO DIÁRIO</td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td align="right" style="font-family:Calibri; font-size:18px; font-weight:bold; color:#00F">Periodo:</td>
    <td align="right" style="font-family:Calibri; font-size:18px; font-weight:bold; color:#00F"> <?php echo $dataver1; ?></td>
    <td align="center" style="font-family:Calibri; font-size:18px; font-weight:bold; color:#00F">à</td>
    <td style="font-family:Calibri; font-size:18px; font-weight:bold; color:#00F"><?php echo $dataver2; ?></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td style="border: 1px solid #000; color: #1f497d; font-weight:bold;" align="center" bgcolor="#dbeef3">Unidade</td>
    <td colspan="8" style="border: 1px solid #000; color: #1f497d; font-weight:bold;" align="center" bgcolor="#dbeef3">DESCRIÇÃO CRÉDITO / RETIRADAS</td>
  </tr>
<?php

$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim'"));	

$receitaitaguai = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Itaguai' and data BETWEEN '$datainic' and '$datafim'"));

$despesaitaguai = $consultad['despesa'] + $consulta1d['despesabombo'];



$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim'"));	

$receitanilopolis = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Nilopolis' and data BETWEEN '$datainic' and '$datafim'"));

$despesanilopolis = $consultad['despesa'] + $consulta1d['despesabombo'];

$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim'"));	

$receitamontserrat = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Montserrat' and data BETWEEN '$datainic' and '$datafim'"));

$despesamontserrat = $consultad['despesa'] + $consulta1d['despesabombo'];

$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';

	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim'"));	

$receitateixeira = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Teixeira' and data BETWEEN '$datainic' and '$datafim'"));

$despesateixeira = $consultad['despesa'] + $consulta1d['despesabombo'];

$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim'"));	

$receitaosasco = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Osasco' and data BETWEEN '$datainic' and '$datafim'"));

$despesaosasco = $consultad['despesa'] + $consulta1d['despesabombo'];

$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';

	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim'"));	

$receitalinhares = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Linhares' and data BETWEEN '$datainic' and '$datafim'"));

$despesalinhares = $consultad['despesa'] + $consulta1d['despesabombo'];

$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim'");

while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['receita1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita1valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita2valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['receita3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita3valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta['receita4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['receita4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta['receita4valor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['receita1bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita1bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta1['receita2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita2bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
if ($consulta1['receita3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['receita3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;">R$ ';
 echo number_format($consulta1['receita3bvalor'], 2, ',', '.');
	echo '</td>';
	echo '</tr>';
	}
}
$consultabilheteria = mysql_query ("select * from bilheteria WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim'");
while ($consulta = mysql_fetch_array($consultabilheteria)){
if ($consulta['despesa1'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa1'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa1valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa2'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa2'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa2valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}	
if ($consulta['despesa3'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa3'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa3valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa4'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa4'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa4valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
	if ($consulta['despesa5'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta['despesa5'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta['despesa5valor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
	}
}
	$consultabombo = mysql_query ("select * from bomboniere WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim';");
while ($consulta1 = mysql_fetch_array($consultabombo)){
if ($consulta1['despesa1bombo'] != '')
{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa1bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa1bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa2bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa2bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa2bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa3bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa3bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa3bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa4bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa4bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa4bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
if ($consulta1['despesa5bombo'] != '')
	{
	echo '<tr>';
	echo '<td style="border: 1px solid #000;" align="center">';
 echo $consulta1['complexo'];
 	echo '</td>';
	echo '<td colspan="6" style="border: 1px solid #000;">';
 echo $consulta1['despesa5bombo'];
 	echo '</td>';
	echo '<td colspan="2" style="border: 1px solid #000;color:#F00">R$ ';
 echo '('.number_format($consulta1['despesa5bvalor'], 2, ',', '.').')';
	echo '</td>';
	echo '</tr>';
}
}
$consulta = mysql_fetch_array(mysql_query("SELECT sum(receita1valor + receita2valor + receita3valor + receita4valor) receita FROM bilheteria WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1 = mysql_fetch_array(mysql_query("SELECT sum(receita1bvalor + receita2bvalor + receita3bvalor) receitabombo FROM bomboniere WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim'"));	

$receitacampinas = $consulta['receita'] + $consulta1['receitabombo'];

$consultad = mysql_fetch_array(mysql_query("SELECT sum(despesa1valor + despesa2valor + despesa3valor + despesa4valor + despesa5valor) despesa FROM bilheteria WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim'"));	

$consulta1d = mysql_fetch_array(mysql_query("SELECT sum(despesa1bvalor + despesa2bvalor + despesa3bvalor + despesa4bvalor + despesa5bvalor) despesabombo FROM bomboniere WHERE complexo = 'Campinas' and data BETWEEN '$datainic' and '$datafim'"));

$despesacampinas = $consultad['despesa'] + $consulta1d['despesabombo'];
												
?>
  <tr>
    <td> </td>
    <td colspan="6" style="border: 1px solid #000; color: #1f497d; font-weight:bold;" align="center" bgcolor="#dbeef3">TOTAL</td> 
    <?php 
	$receitatotal = $receitaitaguai + $receitanilopolis + $receitamontserrat + $receitateixeira + $receitaosasco + $receitalinhares + $receitacampinas;
	
	$despesatotal = $despesaitaguai + $despesanilopolis + $despesamontserrat + $despesateixeira + $despesaosasco + $despesalinhares + $despesacampinas;
	
	$total = $receitatotal - $despesatotal;
	
	if ($total >= 0){
		echo '<td colspan="2" style="border: 1px solid #000;"> R$ '.number_format($total, 2, ',', '.');;
		}
	if ($total < 0){
	
		echo '<td colspan="2" style="border: 1px solid #000; color:#F00;"> R$ ('.number_format(($total*-1), 2, ',', '.').')';	
	}
	
	?>
    </td>
  </tr>
</table>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.