<?php require_once('Connections/config.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}

$data=date('Y-m-d');

//$data='2021-04-28';

mysql_select_db($database_config, $config);
$query_clientes = "SELECT * FROM sis_cliente WHERE data_ins LIKE '$data%' ORDER BY tecnico ASC";
$clientes = mysql_query($query_clientes, $config) or die(mysql_error());
$row_clientes = mysql_fetch_assoc($clientes);
$totalRows_clientes = mysql_num_rows($clientes);

mysql_select_db($database_config, $config);
$query_clientes1 = "SELECT  * FROM dia_suporte WHERE fechamento LIKE '$data%' AND assunto LIKE 'SUPORTE%' AND status='fechado' ORDER BY assunto,tecnico ASC";
$clientes1 = mysql_query($query_clientes1, $config) or die(mysql_error());
$row_clientes1 = mysql_fetch_assoc($clientes1);
$totalRows_clientes1 = mysql_num_rows($clientes1);

mysql_select_db($database_config, $config);
$query_clientes2 = "SELECT  * FROM dia_suporte WHERE fechamento LIKE '$data%' AND assunto LIKE 'TRANS%' AND status='fechado' ORDER BY assunto,tecnico ASC";
$clientes2 = mysql_query($query_clientes2, $config) or die(mysql_error());
$row_clientes2 = mysql_fetch_assoc($clientes2);
$totalRows_clientes2 = mysql_num_rows($clientes2);



?><!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=iso-8859-1" />
<title>Untitled Document</title>
<link href="tables.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style2 {
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
</head>
<body>

<table width="90%" border="0" cellspacing="0" cellpadding="0">
  <tr class="odd">
    <td><span class="style1">INSTALAÇÕES REALIZADAS DIA <?php echo date('d/m/Y', strtotime($data)); ?> || TOTAL <?php echo $totalRows_clientes; ?> || TOTAL DE SERVIÇOS <?php echo $totalRows_clientes+$totalRows_clientes1+$totalRows_clientes2; ?></span></td>
  </tr>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr width='90%' class="odd">
      <td><strong>DATA</td>
      <td><strong>LOGIN</td>
      <td><strong>NOME</td>
      <td><strong>ATENDENTE</td>
      <td><strong>INSTALADOR</td>
</tr>
   <?php do { ?>
<tr>
      <td><strong><?php echo $row_clientes['data_ins']; ?></td>
      <td><?php echo $row_clientes['login']; ?></td>
      <td><?php echo $row_clientes['nome']; ?></td>
      <td><?php echo $row_clientes['vendedor']; ?></td>
      <td><?php echo $row_clientes['tecnico']; ?></td>
</tr>
    <?php } while ($row_clientes = mysql_fetch_assoc($clientes)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($clientes);
?>


<?php require_once('Connections/config.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}

$data=date('Y-m-d');

//$data='2021-04-28';

mysql_select_db($database_config, $config);
$query_clientes = "SELECT  * FROM dia_suporte WHERE fechamento LIKE '$data%' AND assunto LIKE 'SUPORTE%' AND status='fechado' ORDER BY assunto,tecnico ASC";
$clientes = mysql_query($query_clientes, $config) or die(mysql_error());
$row_clientes = mysql_fetch_assoc($clientes);
$totalRows_clientes = mysql_num_rows($clientes);

?><!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=iso-8859-1" />
<title>Untitled Document</title>
<link href="tables.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style2 {
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
</head>
<body>

<table width="90%" border="0" cellspacing="0" cellpadding="0">
  <tr class="odd">
    <td><span class="style1">SUPORTE REALIZADAS DIA <?php echo date('d/m/Y', strtotime($data)); ?> || TOTAL <?php echo $totalRows_clientes; ?></span></td>
  </tr>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr width='90%' class="odd">
      <td><strong>LOGIN</td>
      <td><strong>NOME</td>
      <td><strong>ASSUNTO</td>
      <td><strong>TECNICO</td>
      <td><strong>DATA</td>
</tr>
   <?php do { ?>
<tr>
      <td><?php echo $row_clientes['login']; ?></td>
      <td><?php echo $row_clientes['nome']; ?></td>
      <td><?php echo $row_clientes['assunto']; ?></td>
      <td><?php echo $row_clientes['login_atend']; ?></td>
      <td><?php echo $row_clientes['fechamento']; ?></td>
</tr>
    <?php } while ($row_clientes = mysql_fetch_assoc($clientes)); ?>
<?php
mysql_select_db($database_config, $config);
$query_clientes1 = "SELECT  * FROM dia_suporte WHERE fechamento LIKE '$data%' AND assunto LIKE 'TRANS%' AND status='fechado' ORDER BY assunto,tecnico ASC";
$clientes1 = mysql_query($query_clientes1, $config) or die(mysql_error());
$row_clientes1 = mysql_fetch_assoc($clientes1);
$totalRows_clientes1 = mysql_num_rows($clientes1);

?>
<br>
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
  <tr class="odd">
    <td><span class="style1">TRANSFERÊNCIA REALIZADAS DIA <?php echo date('d/m/Y', strtotime($data)); ?> || TOTAL <?php echo $totalRows_clientes1; ?></span></td>
  </tr>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr width='90%' class="odd">
      <td><strong>LOGIN</td>
      <td><strong>NOME</td>
      <td><strong>ASSUNTO</td>
      <td><strong>TECNICO</td>
      <td><strong>DATA</td>
</tr>


<?php do { ?>
<tr>
      <td><?php echo $row_clientes1['login']; ?></td>
      <td><?php echo $row_clientes1['nome']; ?></td>
      <td><?php echo $row_clientes1['assunto']; ?></td>
      <td><?php echo $row_clientes1['login_atend']; ?></td>
      <td><?php echo $row_clientes1['fechamento']; ?></td>
</tr>
    <?php } while ($row_clientes1 = mysql_fetch_assoc($clientes1)); ?>
</table>
<br>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($clientes);
mysql_free_result($clientes1);
?>