<?php require_once('../../Connections/controle.php'); ?>
<?php
// technocurve arc 3 php bv block1/3 start
$color1 = "#CCFFFF";
$color2 = "";
$color = $color1;
// technocurve arc 3 php bv block1/3 end
?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_controle, $controle);
$query_clientes = "SELECT * FROM clientes WHERE ativo = 'sim' ORDER BY Nome ASC";
$clientes = mysql_query($query_clientes, $controle) or die(mysql_error());
$row_clientes = mysql_fetch_assoc($clientes);
$totalRows_clientes = mysql_num_rows($clientes);

mysql_select_db($database_concontrol, $controle);
$query_pgto = "SELECT * FROM pagamentos";
$pgto = mysql_query($query_pgto, $controle) or die(mysql_error());
$row_pgto = mysql_fetch_assoc($pgto);
$totalRows_pgto = mysql_num_rows($pgto);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PENNET CLIENTES</title>
<link href='http://fonts.googleapis.com/css?family=Text+Me+One' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Petit+Formal+Script' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Cinzel:400,700' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Josefin+Slab:400,700,700italic' rel='stylesheet' type='text/css'/>
<link href="../css/estilos_clientes.css" rel="stylesheet" type="text/css" />
<head>
<body>
<div id="clientes">
<table width="680"class="table">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><h5>Total de Clientes   &nbsp; <?php echo $totalRows_clientes ?></h5></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table border="0" cellpadding="0" cellspacing="0">
      <tr >
        <?php
  do { // horizontal looper version 3
?>
          <td><table width="650" border="0" cellspacing="5" cellpadding="0">
                <tr <?php 
// technocurve arc 3 php bv block2/3 start
echo " style=\"background-color:$color\"";
// technocurve arc 3 php bv block2/3 end
?>>
<td width="503"><a href="ficha_clientes.php?id=<?php echo $row_clientes['id']; ?>" target="inicial"><?php echo $row_clientes['Nome']; ?></a></td>
                  <td width="61" align="right"><a href="inserir_pgto.php?id=<?php echo $row_clientes['id']; ?>" target="inicial">Pagto</a>.</td>
                  <td width="66" align="right"><a href="edit_clientes.php?id=<?php echo $row_clientes['id']; ?>" target="inicial">Editar</a></td>
                </tr>
                <?php 
// technocurve arc 3 php bv block3/3 start
if ($color == $color1) {
	$color = $color2;
} else {
	$color = $color1;
}
// technocurve arc 3 php bv block3/3 end
?>
            </table></td>
          <?php
    $row_clientes = mysql_fetch_assoc($clientes);
    if (!isset($nested_clientes)) {
      $nested_clientes= 1;
    }
    if (isset($row_clientes) && is_array($row_clientes) && $nested_clientes++ % 1==0) {
      echo "</tr><tr>";
    }
  } while ($row_clientes); //end horizontal looper version 3
?>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
</table>
</div>
</body>
</html>
<?php
mysql_free_result($clientes);

mysql_free_result($pgto);
?>
