<?php
ob_start();
session_start();
include_once('../class/class.mysql.php');
include_once('../include/utilitarios.php');
include_once('../empresa/class.empresa.php');
include_once('class.mdc.php');
$mysqlCom = new MysqlConnect();
$empresa = new Empresa();
extract($_GET);
$id_empresa = $_SESSION["fild_id_empresa"];
if ($id_empresa == '') {
	exit;
}
$empresa->SelectEmpresa($id_empresa);
$Mdc = new MDC();

$Mdc->RecebidoDiarioAnalitico(DataInvertida($data));


?>
<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<title>MDC</title>
	<style>
		.CSSTableGenerator {
			margin: 0px;
			padding: 0px;
			width: 100%;
			border: 1px solid #565656;

			-moz-border-radius-bottomleft: 0px;
			-webkit-border-bottom-left-radius: 0px;
			border-bottom-left-radius: 0px;

			-moz-border-radius-bottomright: 0px;
			-webkit-border-bottom-right-radius: 0px;
			border-bottom-right-radius: 0px;

			-moz-border-radius-topright: 0px;
			-webkit-border-top-right-radius: 0px;
			border-top-right-radius: 0px;

			-moz-border-radius-topleft: 0px;
			-webkit-border-top-left-radius: 0px;
			border-top-left-radius: 0px;
		}

		.CSSTableGenerator table {
			border-collapse: collapse;
			border-spacing: 0;
			width: 100%;
			height: 100%;
			margin: 0px;
			padding: 0px;
		}

		.CSSTableGenerator tr:last-child td:last-child {
			-moz-border-radius-bottomright: 0px;
			-webkit-border-bottom-right-radius: 0px;
			border-bottom-right-radius: 0px;
		}

		.CSSTableGenerator table tr:first-child td:first-child {
			-moz-border-radius-topleft: 0px;
			-webkit-border-top-left-radius: 0px;
			border-top-left-radius: 0px;
		}

		.CSSTableGenerator table tr:first-child td:last-child {
			-moz-border-radius-topright: 0px;
			-webkit-border-top-right-radius: 0px;
			border-top-right-radius: 0px;
		}

		.CSSTableGenerator tr:last-child td:first-child {
			-moz-border-radius-bottomleft: 0px;
			-webkit-border-bottom-left-radius: 0px;
			border-bottom-left-radius: 0px;
		}

		.CSSTableGenerator tr:hover td {}

		.CSSTableGenerator tr:nth-child(odd) {
			background-color: #e5e5e5;
		}

		.CSSTableGenerator tr:nth-child(even) {
			background-color: #ffffff;
		}

		.CSSTableGenerator td {
			vertical-align: middle;


			border: 1px solid #565656;
			border-width: 0px 1px 1px 0px;
			text-align: left;
			padding: 7px;
			font-size: 10px;
			font-family: Arial;
			font-weight: normal;
			color: #000000;
		}

		.CSSTableGenerator tr:last-child td {
			border-width: 0px 1px 0px 0px;
		}

		.CSSTableGenerator tr td:last-child {
			border-width: 0px 0px 1px 0px;
		}

		.CSSTableGenerator tr:last-child td:last-child {
			border-width: 0px 0px 0px 0px;
		}

		.CSSTableGenerator tr:first-child td {
			background: -o-linear-gradient(bottom, #cccccc 5%, #b2b2b2 100%);
			background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #b2b2b2));
			background: -moz-linear-gradient(center top, #cccccc 5%, #b2b2b2 100%);
			filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#b2b2b2");
			background: -o-linear-gradient(top, #cccccc, b2b2b2);

			background-color: #cccccc;
			border: 0px solid #565656;
			text-align: center;
			border-width: 0px 0px 1px 1px;
			font-size: 14px;
			font-family: Arial;
			font-weight: bold;
			color: #000000;
		}

		.CSSTableGenerator tr:first-child:hover td {
			background: -o-linear-gradient(bottom, #cccccc 5%, #b2b2b2 100%);
			background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #b2b2b2));
			background: -moz-linear-gradient(center top, #cccccc 5%, #b2b2b2 100%);
			filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#b2b2b2");
			background: -o-linear-gradient(top, #cccccc, b2b2b2);

			background-color: #cccccc;
		}

		.CSSTableGenerator tr:first-child td:first-child {
			border-width: 0px 0px 1px 0px;
		}

		.CSSTableGenerator tr:first-child td:last-child {
			border-width: 0px 0px 1px 1px;
		}
	</style>
</head>

<body>
	<div align="center">
		<?php $empresa->get_LogoGrande('../') ?>
	</div>
	<div style="width:635px; margin: 0 auto;">
		<p align="center">
		<table class="CSSTableGenerator" style="border:1px solid #333">
			<tr>
				<td colspan="5">MDC - Analítico Data (<?php echo $data ?>)</td>
			</tr>
			<tr>
				<td width="193" class="descricao">Nome do Cliente</td>
				<td width="95" class="descricao">Vencimento</td>
				<td width="125" class="descricao">Tipo Pagamento</td>
				<td width="91" class="descricao">
					<div align="right">Valor</div>
				</td>
				<td width="102" class="descricao">
					<div align="right">Caixa</div>
				</td>
			</tr>
			<?php
			$DH = $CH = $CA = $DE = $FT = $OT = 0;
			while ($row = mysqli_fetch_object($Mdc->qry)) {


				switch ($row->id_tipo_pagamento) {
					case 1:
						$DH += $row->valor;
						break;
					case 2:
						$CH += $row->valor;
						break;
					case 3:
						$CA += $row->valor;
						break;
					case 4:
						$DE += $row->valor;
						break;
					case 5:
						$FT += $row->valor;
						break;
					case 6:
						$OT += $row->valor;
						break;
				}

			?>

				<tr>
					<td class="descricao">
						<div align="left"><?php echo $row->nome ?></div>
					</td>
					<td class="descricao"><?php echo InverterData($row->data_vencimento) ?></td>
					<td class="descricao"><?php echo $row->descricao ?></td>
					<td class="descricao">
						<div align="right"><?php echo FormatoValor($row->valor) ?></div>
					</td>
					<td class="descricao">
						<div align="right"><?php echo $row->nome_caixa ?></div>
					</td>
				</tr>


			<?php } ?>

		</table>
		<?php
		echo 'Valor Dinheiro.: ' . FormatoValor($DH) . '<br>';
		echo 'Valor Cheque.: ' . FormatoValor($CH) . '<br>';
		echo 'Valor Cartão.: ' . FormatoValor($CA) . '<br>';
		echo 'Valor Deposito.: ' . FormatoValor($DE) . '<br>';
		echo 'Valor Faturado.: ' . FormatoValor($FT) . '<br>';
		echo 'Valor Outros.: ' . FormatoValor($OT) . '<br/><br/>';


		echo 'Data Corrente ' . date('d/m/Y') ?>
		</p>
	</div>
</body>

</html>