Skip to content

Instantly share code, notes, and snippets.

@jonexe
Created March 19, 2014 22:11
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jonexe/9652540 to your computer and use it in GitHub Desktop.
Ayuda
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
if (is_page(359) ) { get_header('Consultas'); }
elseif (is_page(496)) { get_header('CapturaSB'); }// Captura SB
elseif (is_page(505)) { get_header('CapturaManual'); }// Captura SB
else {get_header();}
?>
<?php
//header( 'Content-Type: text/html;charset=utf-8' );
setlocale(LC_MONETARY, 'es_MX');
define('MY_HOST', '216.70.86.180');
define('MY_USER', 'bookAdmin2');
define('MY_PASSWORD', 'comE310');
define('MY_NAME', 'reportediario');
$dias = array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado");
$meses = array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
/*--------------------
Funciones COMENCHI
----------------------*/
// getColor - Fortamea $numero rojo si es negativo
function getColor($numero)
{
if ($numero < 0 )
return '#EB0000';
else return '#000000';
}
?>
<div id="primary" class="">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php //get_template_part( 'content', 'page' ); ?>
<?php if (is_page(359) ) {}?>
<?php comments_template( '', false ); ?>
<?php
// si pagina es 'Status de Sala' {Operaciones}
if (is_page(461) ) {
if( current_user_can('level_9') ) :
$host = "216.70.86.180";
$user = "bookAdmin2";
$password = "comE310";
$database = "reportediario";
$connection = mysql_connect($host,$user,$password)
or die("Could not connect: ".mysql_error());
mysql_select_db($database,$connection)
or die("Error in selecting the database:".mysql_error());
$sql ="SELECT MAX(data.fecha) AS ultimoReporte, data.sala AS salaUsuario, salas.nombreComercialSala AS sala, salas.contactoSala AS contacto, salas.emailSala AS email, salas.statusSala AS status FROM data INNER JOIN salas ON data.sala = salas.nombreSala GROUP BY data.sala ORDER BY ultimoReporte DESC, salas.contactoSala";
$sql_result=mysql_query($sql,$connection)
or exit("Sql Error".mysql_error());
$sql_num=mysql_num_rows($sql_result);
?>
<table id="wp-table-reloaded-id-3-no-1" class="wp-table-reloaded wp-table-reloaded-id-3" style="background: transparent;">
<tr style="border: 1px solid #333; background: white;">
<th></th>
<th colspan='2'>Sala</th>
<th>&Uacute;ltimo Reporte</th>
<th>Contacto</th>
<th>email</th>
</tr>
<?php
$date = date('Y-m-j');
$alDia = strtotime('-1 day',strtotime($date));
$unDia = strtotime('-2 day',strtotime($date));
$dosDias = strtotime('-3 day',strtotime($date));
$cuatroDias = strtotime('-5 day',strtotime($date));
$seisDias = strtotime('-7 day',strtotime($date));
$foliatti = array("Foliatti Mercado de Abastos","Foliatti Guadalupe","Foliatti Ajijic","Foliatti Allende");
$salasSB = array("aguaprieta","ensenada","sanluis","guamuchil","teziutlan");
$contador = 1;
while($row=mysql_fetch_array($sql_result))
{
$ultimoRep = $row['ultimoReporte'];
if (in_array($row['sala'], $foliatti)) {
//$ultimoRep = date("Y-m-d",strtotime($date." - 2 days "));
}
if ($contador&1) {echo "<tr class='odd'>";}
else {echo "<tr class='even'>";}
echo "<td>".$contador++."</td>";
if ($row['status'] == '0'){echo "<td class='styled'>" . $row['sala'] . "</td><td style='text-align:left;background: white url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAKElEQVQIW2NkQAPnz5//z4gsBhIwNDRkhAvCBECKwILIAmBBdAGQIADgRxNyeHcRsgAAAABJRU5ErkJggg==) repeat; border:1px solid #ccc; color: #adadad'>Baja</td>";}
elseif ($row['status'] == '2') {echo "<td style='text-align:left' class='styled'>" . $row['sala'] . "</td><td style='text-align:left;background: #f9818c; border:1px solid #f6515f; color: #f8f8f8'>Suspensi&oacute;n</td>";}
else {echo "<td style='text-align:left' colspan='2'>" . $row['sala'] . "</td>";}
if (strtotime($ultimoRep) == $alDia) {
echo "<td class='styled'><span id='superGreen' class='status'>01</span>";
}
else if (strtotime($ultimoRep) == $unDia) {
echo "<td class='styled'><span id='green' class='status'>02</span>";
}
else if (strtotime($ultimoRep) <= $dosDias && strtotime($ultimoRep) >= $cuatroDias) {
echo "<td class='styled'><span id='yell' class='status'>03</span>";
}
else if (strtotime($ultimoRep) <= $cuatroDias && strtotime($ultimoRep) >= $seisDias) {
echo "<td class='styled'><span id='orange' class='status'>04</span>";
}
else if (strtotime($ultimoRep) < $seisDias) {
echo "<td class='styled'><span id='red' class='status'>05</span>";
}
else {
echo "<td class='styled'>";
}
echo $meses[date('n', strtotime($ultimoRep))-1] ." ".date('d', strtotime($ultimoRep));
if ($row['status'] == '0' || $row['status'] == '2') {
if ( date('Y', strtotime($ultimoRep)) !== date('Y') ) {
echo ", ".date('Y', strtotime($ultimoRep));
}
echo "</td>";
} // si esta dado de baja o suspendido
else {
echo "</td>";
}
/*if (in_array($row['salaUsuario'], $salasSB)) { // si la sala captura SB
$salaUsuario = $row['salaUsuario'];
$sqlSB ="SELECT MIN(fecha) AS ultimoReporteSB FROM data WHERE ingresosTotalesSB IS NULL AND sala = '$salaUsuario'";
$sqlSB_result=mysql_query($sqlSB,$connection)
or exit("Sql Error".mysql_error());
//$sql_num=mysql_num_rows($sql_result);
while($rowie=mysql_fetch_array($sqlSB_result)) {
//echo "<td>".$rowie['ultimoReporteSB']."</td>";
echo "<td>". $meses[date('n',strtotime($rowie['ultimoReporteSB'].' yesterday '))-1] ." ". date('d', strtotime($rowie['ultimoReporteSB'].' yesterday '))."</td>";
}
} // end sala captura SB
else {
echo "<td></td>";
}*/
echo "<td>".$row['contacto']."</td>";
echo "<td>".$row['email']."</td>";
}
echo "</tr>";
$contador++;
?>
</table>
<?php
endif;
}
// si pagina es 'Consulta de Operaciones' {Operaciones -> Salas -> Consulta de Operaciones}
if (is_page(359) ) {
?>
<?php global $user_ID; if( $user_ID ) : ?>
<!-- Si usuario no es admin o accionista -->
<?php if( !current_user_can('level_9') ) : ?>
<div style="text-align: center;">
<h2>Operaciones del d&iacute;a</h2>
<form id="queryForm" action="<?php echo get_permalink( $post->ID ); ?>" method="POST" class="wp-core-ui">
<fieldset style="padding: 5px 0;">
<label for="from">Fecha inicial</label>
<input type="text" id="from" name="from" />
<label for="to">Fecha final</label>
<input type="text" id="to" name="to" /><!-- Selecciona sala -->
<br /><br />
<input type="submit" name="" value="Consultar" class="button button-primary" style="height: 30px;width: 35%;" />
</fieldset>
<?php
?>
</form>
</div>
<div id="yoma">
<table id="hideTableSala" class="wp-table-reloaded wp-table-reloaded-id-3" style="background: transparent; border-collapse: collapse;" >
<?php
$fechaIni = $_POST["from"];
$fechaFin = $_POST["to"];
$sala = trim($current_user->user_login);
$newdb = new wpdb(MY_USER, MY_PASSWORD, MY_NAME, MY_HOST);
$user_count = $newdb->get_results( "SELECT sala, fecha, ingresosTotalesMaq, pagoDevolucionesMaq, pagoPremioMaq, ingresosTotalesBingo, pagoPremioBingo, ingresosTotalesSB, pagoPremioSB, ingresosTotales, pagoDevoluciones, pagoPremio, sorteos, totalPremios, netWinIEPS, iepsMaq, iepsBingo, iepsSB, iepsSala, retMaq, retBingo, retSB, retPremios, retSorteos, retSala, segobMaq, segobBingo, segobSB, segobSala, estatalMaq, estatalBingo, estatalSB, estatalSala, ideMaq, ideBingo, ideSB, ideSala, impuestoMaq, impuestoBingo, impuestoSB, ISRSala, totalImpuesto, depMaq, depBingo, depSB, depSala, partMaq, partBingo, partSB, partSala FROM data WHERE sala = '$sala' AND fecha BETWEEN '$fechaIni' AND '$fechaFin' ORDER BY fecha" );
if (count($user_count)!=0) {
echo "<tr>
<td colspan='3' style='background: transparent;border: 0; font-size:26px; padding: 15px 0 5px'>".ucwords($fivesdraft->sala)."</td></tr>
<tr>
<th style='border:0;background: transparent'></th><th style='border:0;background: transparent'></th>
<th style='border-right:0;'></th>
<th style='text-align:center; border-right:0; border-left:0;'>Maquinas</th>
<th style='border-left:0;'></th>
<th style='border:0; background: transparent'></th>
<th class='azul' style='text-align:center;border-right:0;'>Bingo</th>
<th style='border-left:0;'></th>
<th style='border:0;background: transparent'></th>
<th class='azul' style='text-align:center;border-right:0;'>SportBook</th>
<th style='border-left:0;'></th>
<th style='border:0;background: transparent'></th>
<th style='border-right:0;'></th>
<th class='azul' style='text-align:center; border-right:0; border-left:0'>Totales</th>
<th style='border-left:0;'></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th style='border-bottom:0; text-align:center' class='blanktd'>Premios</th>
<th style='border-bottom:0; text-align:center' class='blanktd'>Total</th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th style='border-bottom:0; text-align: center' class='blanktd'>NETWIN</th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>IEPS<input id='toggleIEPS' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th style='border-right:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-left:0;'>Retenci&oacute;n <input id='toggleRet' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>SEGOB<input id='toggleSEG' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>Estatal<input id='toggleEst' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>IDE<input id='toggleIDE' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th><th></th>
<th>Impuestos<input id='toggleImp' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>DEP<input id='toggleDep' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>Particiapaci&oacute;n<input id='togglePart' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
</tr>
<tr>
<th style='text-align: center;'>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fecha&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Devoluciones</th>
<th>Premios</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Premios</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Premios</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Devoluciones</th>
<th>Premios</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0; text-align:center'>de sala</th>
<th style='border-top:0; text-align:center'>premios</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0; text-align:center'>IEPS</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Premios</th>
<th style='border-top:0;'>Sorteos</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>ISR</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
</tr>";
$contador = 0;
foreach ( $user_count as $fivesdraft ) {
if ($contador&1) { echo "<tr class='odd'>";}
else {echo "<tr class='even'>";}
?>
<td style="padding:5px 2px;"><?php echo date("y-m-d", strtotime($fivesdraft->fecha)) ?></td>
<td style="border: 0; background: transparent;"></td><!--<td ><?php echo $fivesdraft->JugadoresActivos ?></td>-->
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->ingresosTotalesMaq)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoDevolucionesMaq)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoPremioMaq)."<br />"; ?></td>
<td style="border: 0; background: transparent;"></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoPremioBingo)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->ingresosTotalesBingo)."<br />"; ?></td>
<td style="border: 0; background: transparent"></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->ingresosTotalesSB)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoPremioSB)."<br />"; ?></td>
<td style="border: 0; background: transparent"></td>
<td style="text-align: right;"><?php
echo money_format('%+#10.2n', $fivesdraft->ingresosTotales)."<br />"; ?></td>
<td style="text-align: right;"><?php
echo money_format('%+#10.2n', $fivesdraft->pagoDevoluciones)."<br />"; ?></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->pagoPremio)."'>". money_format('%+#10.2n', $fivesdraft->pagoPremio)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->sorteos)."'>". money_format('%+#10.2n', $fivesdraft->sorteos)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->totalPremios)."'>". money_format('%+#10.2n', $fivesdraft->totalPremios)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->netWinIEPS)."'>". money_format('%+#10.2n', $fivesdraft->netWinIEPS)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsMaq)."'>". money_format('%+#10.2n', $fivesdraft->iepsMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsBingo)."'>". money_format('%+#10.2n', $fivesdraft->iepsBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsSB)."'>". money_format('%+#10.2n', $fivesdraft->iepsSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsSala)."'>". money_format('%+#10.2n', $fivesdraft->iepsSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retMaq)."'>". money_format('%+#10.2n', $fivesdraft->retMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retBingo)."'>". money_format('%+#10.2n', $fivesdraft->retBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retSB)."'>". money_format('%+#10.2n', $fivesdraft->retSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retPremios)."'>". money_format('%+#10.2n', $fivesdraft->retPremios)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retSorteos)."'>". money_format('%+#10.2n', $fivesdraft->retSorteos)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retSala)."'>". money_format('%+#10.2n', $fivesdraft->retSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobMaq)."'>". money_format('%+#10.2n', $fivesdraft->segobMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobBingo)."'>". money_format('%+#10.2n', $fivesdraft->segobBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobSB)."'>". money_format('%+#10.2n', $fivesdraft->segobSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobSala)."'>". money_format('%+#10.2n', $fivesdraft->segobSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalMaq)."'>". money_format('%+#10.2n', $fivesdraft->estatalMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalBingo)."'>". money_format('%+#10.2n', $fivesdraft->estatalBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalSB)."'>". money_format('%+#10.2n', $fivesdraft->estatalSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalSala)."'>". money_format('%+#10.2n', $fivesdraft->estatalSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideMaq)."'>". money_format('%+#10.2n', $fivesdraft->ideMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideBingo)."'>". money_format('%+#10.2n', $fivesdraft->ideBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideSB)."'>". money_format('%+#10.2n', $fivesdraft->ideSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideSala)."'>". money_format('%+#10.2n', $fivesdraft->ideSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->impuestoMaq)."'>". money_format('%+#10.2n', $fivesdraft->impuestoMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->impuestoBingo)."'>". money_format('%+#10.2n', $fivesdraft->impuestoBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->impuestoSB)."'>". money_format('%+#10.2n', $fivesdraft->impuestoSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ISRSala)."'>". money_format('%+#10.2n', $fivesdraft->ISRSala)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->totalImpuesto)."'>". money_format('%+#10.2n', $fivesdraft->totalImpuesto)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depMaq)."'>". money_format('%+#10.2n', $fivesdraft->depMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depBingo)."'>". money_format('%+#10.2n', $fivesdraft->depBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depSB)."'>". money_format('%+#10.2n', $fivesdraft->depSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depSala)."'>". money_format('%+#10.2n', $fivesdraft->depSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partMaq)."'>". money_format('%+#10.2n', $fivesdraft->partMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partBingo)."'>". money_format('%+#10.2n', $fivesdraft->partBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partSB)."'>". money_format('%+#10.2n', $fivesdraft->partSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partSala)."'>". money_format('%+#10.2n', $fivesdraft->partSala)."</td>"; ?>
</tr>
<?php
$contador++;
} // END foreach
} // END $user_count
$user_countTotales = $newdb->get_results( "SELECT sala, SUM(ingresosTotalesMaq) AS ingTotMaq, SUM(pagoDevolucionesMaq) AS pagoDevMaq, SUM(pagoPremioMaq) AS pagoPreMaq, SUM(ingresosTotalesBingo) AS ingTotBinTot, SUM(pagoPremioBingo) AS pagPremBingoTot, SUM(ingresosTotalesSB) AS ingTotSBTot, SUM(pagoPremioSB) AS pagPremSBTot, SUM(ingresosTotales) AS ingTotTot, SUM(pagoDevoluciones) AS pagoDevTot, SUM(pagoPremio) AS pagoPremTot, SUM(sorteos) AS sorteosTot, SUM(totalPremios) AS premiosTot, SUM(netWinIEPS) AS netWinTot, SUM(iepsMaq) AS iepsMaqTot, SUM(iepsBingo) AS iepsBingoTot, SUM(iepsSB) AS iepsSBTot, SUM(iepsSala) AS iepsSalaTot, SUM(retMaq) AS retMaqTot, SUM(retBingo) AS retBingoTot, SUM(retSB) AS retSBTot, SUM(retPremios) AS retPremTot, SUM(retSorteos) AS retSorTot, SUM(retSala) AS retSalaTot, SUM(segobMaq) AS segMaqTot, SUM(segobBingo) AS segBingoTot, SUM(segobSB) AS segSBTot, SUM(segobSala) AS segSalaTot, SUM(estatalMaq) AS estMaqTot, SUM(estatalBingo) AS estBingoTot, SUM(estatalSB) AS estSBTot, SUM(estatalSala) AS estSalatot, SUM(ideMaq) AS ideMaqTot, SUM(ideBingo) AS ideBingoTot, SUM(ideSB) AS ideSBTot, SUM(ideSala) AS ideSalaTot, SUM(impuestoMaq) AS impMaqTot, SUM(impuestoBingo) AS impBingoTot, SUM(impuestoSB) AS impSBTot, SUM(ISRSala) AS ISRSalaTot, SUM(totalImpuesto) AS impSalaTot, SUM(depMaq) AS depMaqTot, SUM(depBingo) AS depBingoTot, SUM(depSB) AS depSBTot, SUM(depSala) AS depSalaTot, SUM(partMaq) AS partMaqTot, SUM(partBingo) AS partBingoTot, SUM(partSB) AS partSBTot, SUM(partSala) AS partSalaTot FROM data WHERE sala ='$sala' AND fecha BETWEEN '$fechaIni' AND '$fechaFin' GROUP BY sala" );
if (count($user_countTotales)!=0) {
foreach ( $user_countTotales as $fivesdraftTotales ) {
if ($contador&1) { echo "<tr class='odd'>";}
else {echo "<tr class='even'>";}
echo "<td><h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TOTALES &nbsp; &nbsp;&nbsp;</h1></td>";
echo "<td style='border:0;background: transparent'></td><td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotMaq)."</td>";
echo "<td style=''>". money_format('%+#10.2n', $fivesdraftTotales->pagoDevMaq)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoPreMaq)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotBinTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagPremBingoTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagPremSBTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotTot)."</td>"; // Totales (maq, Bingo, SB)
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoDevTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoPremTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->sorteosTot)."</td>"; // Sorteos
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->premiosTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->netWinTot)."</td>"; // NetWin IEPS
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsMaqTot)."</td>"; // IEPS
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retMaqTot)."</td>"; // Retencion
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retgSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSalaTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSalaTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segMaqTot)."</td>"; // SEGOB
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estMaqTot)."</td>"; // Estatal
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ideMaqTot)."</td>"; // IDE
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ideBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ideSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->IdeSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impMaqTot)."</td>"; // Impuestos
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ISRSalaTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depMaqTot)."</td>"; // DEP
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partMaqTot)."</td>"; // Participacion
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partSalaTot)."</td>";
echo "</tr>";
$contador++;
}
} // END if count >0
echo "</table></div>";
else : // Si es Admin ?>
<div style="text-align: center;">
<h2>Operaciones del d&iacute;a</h2>
<form id="queryForm" action="<?php echo get_permalink( $post->ID ); ?>" method="POST" class="wp-core-ui">
<div id="tabsRangoFechas" style="width: 40%; margin: 0 auto;">
<ul>
<li><a href="#tabsRangoFechas-1">Rango</a></li>
<li><a href="#tabsRangoFechas-2">Mes</a></li>
<li><a href="#tabsRangoFechas-3">Semana</a></li>
</ul>
<br /><br />
<select id='selectSala' title='Selecciona sala(s)' multiple='multiple' name='salaAc[]' size='6'>
<optgroup label="luftha">
<option value='aguaprieta'>Agua Prieta</option>
<option value='cananea'>Cananea</option>
<option value='ensenada'>Ensenada</option>
<option value='guamuchil'>Guamuchil</option>
<option value='nogales'>Nogales</option>
</optgroup>
<optgroup label="HWE">
<option value='hollywood1'>Hollywood Constituci&oacute;n</option>
<option value='hollywood2'>Hollywood Estanzuela</option>
</optgroup>
<optgroup label="Foliatti">
<option value='ajijic'>Ajijic</option>
<option value='allende'>Allende</option>
<option value='guadalajara'>Guadalajara</option>
<option value='guadalupe'>Guadalupe</option>
<option value='monterrey'>Monterrey</option>
<option value='puertovallarta'>Puerto Vallarta</option>
</optgroup>
<optgroup label="Otros">
<option value='gomezpalacio'>Gomez Palacio</option>
<option value='linares'>Linares</option>
<option value='montemorelos'>Montemorelos</option>
<option value='naucalpan'>Naucalpan</option>
<option value='sanluis'>San Luis Rio Colorado</option>
<option value='texcoco'>Texcoco</option>
<option value='teziutlan'>Teziutl&aacute;n</option>
<option value='ciudadjuarez'>Golden Treasure</option>
</optgroup>
</select>
<div id="tabsRangoFechas-3">
<p>En construcci&oacute;n</p>
</div>
<div id="tabsRangoFechas-2">
<label for="monthDate">Mes:</label><input type="text" id="monthDate" name="monthDate" value="" /><br />
</div> <!-- END mes -->
<div id="tabsRangoFechas-1">
<fieldset style="padding: 5px 0; text-align: right; width: 300px; margin: 0 auto;" >
<label for="from">Fecha inicial</label>
<input type="text" id="from" name="from" /><br />
<label for="to">Fecha final</label>
<input type="text" id="to" name="to" /><!-- Selecciona sala -->
</fieldset>
</div>
<input type="submit" name="" value="Consultar" class="button button-primary" style="height: 25px;width: 30%;" />
<br /><br />
</div>
<?php
?>
</form>
</div>
<?php
$fechaIni = $_POST["from"];
$fechaFin = $_POST["to"];
if (empty($fechaIni)) {
$fechaIni = $_POST["monthDate"];
}
$salas = count($_POST["salaAc"]);
for ($i = 0; $i < $salas; $i++)
{
if ($i == $salas-1) {
//echo $_POST["salaAc"][$i];
$sqlStatement = $sqlStatement. "'". $_POST["salaAc"][$i]."'";
}
else {
//echo $_POST["salaAc"][$i].", ";
$sqlStatement = $sqlStatement . "'".$_POST["salaAc"][$i]."', ";
}
}
$newdb = new wpdb(MY_USER, MY_PASSWORD, MY_NAME, MY_HOST);
?>
<div id="yoma">
<?php
$query1 = "SELECT sala, fecha, ingresosTotalesMaq, pagoDevolucionesMaq, pagoPremioMaq, ingresosTotalesBingo, pagoPremioBingo, ingresosTotalesSB, pagoPremioSB, ingresosTotales, pagoDevoluciones, pagoPremio, sorteos, totalPremios, netWinIEPS, iepsMaq, iepsBingo, iepsSB, iepsSala, retMaq, retBingo, retSB, retPremios, retSorteos, retSala, segobMaq, segobBingo, segobSB, segobSala, estatalMaq, estatalBingo, estatalSB, estatalSala, ideMaq, ideBingo, ideSB, ideSala, impuestoMaq, impuestoBingo, impuestoSB, ISRSala, totalImpuesto, depMaq, depBingo, depSB, depSala, partMaq, partBingo, partSB, partSala FROM data WHERE sala IN(".$sqlStatement.") AND";
$query2 = "SELECT sala, SUM(ingresosTotalesMaq) AS ingTotMaq, SUM(pagoDevolucionesMaq) AS pagoDevMaq, SUM(pagoPremioMaq) AS pagoPreMaq, SUM(ingresosTotalesBingo) AS ingTotBinTot, SUM(pagoPremioBingo) AS pagPremBingoTot, SUM(ingresosTotalesSB) AS ingTotSBTot, SUM(pagoPremioSB) AS pagPremSBTot, SUM(ingresosTotales) AS ingTotTot, SUM(pagoDevoluciones) AS pagoDevTot, SUM(pagoPremio) AS pagoPremTot, SUM(sorteos) AS sorteosTot, SUM(totalPremios) AS premiosTot, SUM(netWinIEPS) AS netWinTot, SUM(iepsMaq) AS iepsMaqTot, SUM(iepsBingo) AS iepsBingoTot, SUM(iepsSB) AS iepsSBTot, SUM(iepsSala) AS iepsSalaTot, SUM(retMaq) AS retMaqTot, SUM(retBingo) AS retBingoTot, SUM(retSB) AS retSBTot, SUM(retPremios) AS retPremTot, SUM(retSorteos) AS retSorTot, SUM(retSala) AS retSalaTot, SUM(segobMaq) AS segMaqTot, SUM(segobBingo) AS segBingoTot, SUM(segobSB) AS segSBTot, SUM(segobSala) AS segSalaTot, SUM(estatalMaq) AS estMaqTot, SUM(estatalBingo) AS estBingoTot, SUM(estatalSB) AS estSBTot, SUM(estatalSala) AS estSalatot, SUM(ideMaq) AS ideMaqTot, SUM(ideBingo) AS ideBingoTot, SUM(ideSB) AS ideSBTot, SUM(ideSala) AS ideSalaTot, SUM(impuestoMaq) AS impMaqTot, SUM(impuestoBingo) AS impBingoTot, SUM(impuestoSB) AS impSBTot, SUM(ISRSala) AS ISRSalaTot, SUM(totalImpuesto) AS impSalaTot, SUM(depMaq) AS depMaqTot, SUM(depBingo) AS depBingoTot, SUM(depSB) AS depSBTot, SUM(depSala) AS depSalaTot, SUM(partMaq) AS partMaqTot, SUM(partBingo) AS partBingoTot, SUM(partSB) AS partSBTot, SUM(partSala) AS partSalaTot FROM data WHERE sala IN(".$sqlStatement.") AND";
if (empty($fechaFin)) { // Busqueda por Mes
$month = date('m',strtotime($fechaIni));
$year=date('Y',strtotime($fechaIni));
$user_count = $newdb->get_results( $query1." MONTH(fecha)= '$month' AND YEAR(fecha) = '$year' ORDER BY sala, fecha" );
$user_countTotales = $newdb->get_results( $query2." MONTH(fecha)= '$month' AND YEAR(fecha) = '$year' GROUP BY sala" );
}
else { // busqueda por Rango
$user_count = $newdb->get_results( $query1." fecha BETWEEN '$fechaIni' AND '$fechaFin' ORDER BY sala, fecha" );
$user_countTotales = $newdb->get_results( $query2." fecha BETWEEN '$fechaIni' AND '$fechaFin' GROUP BY sala" );
}
if (count($user_count)!=0) {
?>
<table id="hideTableSala" class="wp-table-reloaded wp-table-reloaded-id-3" style="background: transparent; border-collapse: collapse;" >
<?php #hideTotales
$salaGrupo = '';
$contador = 0;
foreach ( $user_count as $fivesdraft )
{
if($contador&1) {echo "<tr class='odd'>";}
else {echo "<tr class='even'>";}
?>
<!--<td><?php //echo $fivesdraft->sala ?></td> -->
<?php
if ($salaGrupo != $fivesdraft->sala) {
echo "<tr>
<td colspan='2' style='border:0;background: transparent'></td>
<td colspan='9' style='background: transparent;border: 0; font-size:26px; padding: 15px 0 5px'>".ucwords($fivesdraft->sala)."</td></tr>
<tr>
<th style='text-align: center;'>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fecha&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</th>
<th style='border:0;background: transparent'></th>
<th style='border-right:0;'></th>
<th style='text-align:center; border-right:0; border-left:0;'>Maquinas</th>
<th style='border-left:0;'></th>
<th style='border:0; background: transparent'></th>
<th class='azul' style='text-align:center;border-right:0;'>Bingo</th>
<th style='border-left:0;'></th>
<th style='border:0;background: transparent'></th>
<th class='azul' style='text-align:center;border-right:0;'>SportBook</th>
<th style='border-left:0;'></th>
<th style='border:0;background: transparent'></th>
<th style='border-right:0;'></th>
<th class='azul' style='text-align:center; border-right:0; border-left:0'>Totales</th>
<th style='border-left:0;'></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th style='border-bottom:0; text-align:center' class='blanktd'>Premios</th>
<th style='border-bottom:0; text-align:center' class='blanktd'>Total</th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th style='border-bottom:0; text-align: center' class='blanktd'>NETWIN</th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>IEPS<input id='toggleIEPS' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th style='border-right:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-right:0; border-left:0;'></th>
<th style='border-left:0;'>Retenci&oacute;n <input id='toggleRet' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>SEGOB<input id='toggleSEG' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>Estatal<input id='toggleEst' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>IDE<input id='toggleIDE' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th><th></th>
<th>Impuestos<input id='toggleImp' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>DEP<input id='toggleDep' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>Particiapaci&oacute;n<input id='togglePart' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
</tr>
<tr>
<th></th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Devoluciones</th>
<th>Premios</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Premios</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Premios</th>
<th style='border:0; background: transparent'></th>
<th>Ingresos</th>
<th>Devoluciones</th>
<th>Premios</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0; text-align:center'>de sala</th>
<th style='border-top:0; text-align:center'>premios</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0; text-align:center'>IEPS</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Premios</th>
<th style='border-top:0;'>Sorteos</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>ISR</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
</tr>
";
}
else {
//echo '<td></td>';
}
$salaGrupo = $fivesdraft->sala;
?>
<td style="padding:5px 2px;"><?php echo date("y-m-d", strtotime($fivesdraft->fecha)) ?></td>
<td style="border: 0; background: transparent;"></td><!--<td ><?php echo $fivesdraft->JugadoresActivos ?></td>-->
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->ingresosTotalesMaq)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoDevolucionesMaq)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoPremioMaq)."<br />"; ?></td>
<td style="border: 0; background: transparent;"></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoPremioBingo)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->ingresosTotalesBingo)."<br />"; ?></td>
<td style="border: 0; background: transparent"></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->ingresosTotalesSB)."<br />"; ?></td>
<td style="text-align: right;"><?php echo money_format('%+#10.2n', $fivesdraft->pagoPremioSB)."<br />"; ?></td>
<td style="border: 0; background: transparent"></td>
<td style="text-align: right;"><?php
echo money_format('%+#10.2n', $fivesdraft->ingresosTotales)."<br />"; ?></td>
<td style="text-align: right;"><?php
echo money_format('%+#10.2n', $fivesdraft->pagoDevoluciones)."<br />"; ?></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->pagoPremio)."'>". money_format('%+#10.2n', $fivesdraft->pagoPremio)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->sorteos)."'>". money_format('%+#10.2n', $fivesdraft->sorteos)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->totalPremios)."'>". money_format('%+#10.2n', $fivesdraft->totalPremios)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->netWinIEPS)."'>". money_format('%+#10.2n', $fivesdraft->netWinIEPS)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsMaq)."'>". money_format('%+#10.2n', $fivesdraft->iepsMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsBingo)."'>". money_format('%+#10.2n', $fivesdraft->iepsBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsSB)."'>". money_format('%+#10.2n', $fivesdraft->iepsSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->iepsSala)."'>". money_format('%+#10.2n', $fivesdraft->iepsSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retMaq)."'>". money_format('%+#10.2n', $fivesdraft->retMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retBingo)."'>". money_format('%+#10.2n', $fivesdraft->retBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retSB)."'>". money_format('%+#10.2n', $fivesdraft->retSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retPremios)."'>". money_format('%+#10.2n', $fivesdraft->retPremios)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retSorteos)."'>". money_format('%+#10.2n', $fivesdraft->retSorteos)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->retSala)."'>". money_format('%+#10.2n', $fivesdraft->retSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobMaq)."'>". money_format('%+#10.2n', $fivesdraft->segobMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobBingo)."'>". money_format('%+#10.2n', $fivesdraft->segobBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobSB)."'>". money_format('%+#10.2n', $fivesdraft->segobSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->segobSala)."'>". money_format('%+#10.2n', $fivesdraft->segobSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalMaq)."'>". money_format('%+#10.2n', $fivesdraft->estatalMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalBingo)."'>". money_format('%+#10.2n', $fivesdraft->estatalBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalSB)."'>". money_format('%+#10.2n', $fivesdraft->estatalSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->estatalSala)."'>". money_format('%+#10.2n', $fivesdraft->estatalSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideMaq)."'>". money_format('%+#10.2n', $fivesdraft->ideMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideBingo)."'>". money_format('%+#10.2n', $fivesdraft->ideBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideSB)."'>". money_format('%+#10.2n', $fivesdraft->ideSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ideSala)."'>". money_format('%+#10.2n', $fivesdraft->ideSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->impuestoMaq)."'>". money_format('%+#10.2n', $fivesdraft->impuestoMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->impuestoBingo)."'>". money_format('%+#10.2n', $fivesdraft->impuestoBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->impuestoSB)."'>". money_format('%+#10.2n', $fivesdraft->impuestoSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->ISRSala)."'>". money_format('%+#10.2n', $fivesdraft->ISRSala)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->totalImpuesto)."'>". money_format('%+#10.2n', $fivesdraft->totalImpuesto)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depMaq)."'>". money_format('%+#10.2n', $fivesdraft->depMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depBingo)."'>". money_format('%+#10.2n', $fivesdraft->depBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depSB)."'>". money_format('%+#10.2n', $fivesdraft->depSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->depSala)."'>". money_format('%+#10.2n', $fivesdraft->depSala)."</td>"; ?>
<td style="border: 0; background: transparent"></td>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partMaq)."'>". money_format('%+#10.2n', $fivesdraft->partMaq)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partBingo)."'>". money_format('%+#10.2n', $fivesdraft->partBingo)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partSB)."'>". money_format('%+#10.2n', $fivesdraft->partSB)."</td>"; ?>
<?php echo "<td style='text-align: right; color:".getColor($fivesdraft->partSala)."'>". money_format('%+#10.2n', $fivesdraft->partSala)."</td>"; ?>
</tr>
<?php
$contador++;
} // end foreach
} // end if user_count = 0 si el query devuelve resultados
if (count($user_countTotales)!=0) {
$contador = 0;
?>
<table id="hideTotales" class="wp-table-reloaded wp-table-reloaded-id-3" style="font-size:12px !important;background: transparent; border-collapse: collapse;">
<thead>
<tr>
<th><h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TOTALES &nbsp; &nbsp;&nbsp;</h1></th><th style='border:0;background: transparent' class='blanktd'></th>
<th style='border-right:0;' class='blanktd'></th>
<th style='text-align:center; border-left: 0; border-right: 0;'>M&aacute;quinas</th>
<th style='border-left:0;' class='blanktd'></th>
<th style='border:0;background: transparent' class='blanktd'></th>
<th class='azul' style='text-align:center; border-right: 0;'>Bingo</th>
<th style='border-left:0;' class='blanktd'></th>
<th style='border:0;background: transparent' class='blanktd'></th>
<th class='azul' style='text-align:center; border-right: 0;'>SportBook</th>
<th style='border-left:0;'></th>
<th style='border:0;background: transparent' class='blanktd'></th>
<th style='border-right:0;'></th>
<th class='azul' style='text-align:center;border-left: 0; border-right: 0;'>Totales</th>
<th style='border-left:0;'></th>
<th style='border:0;background: transparent' class='blanktd'></th>
<th style='border-bottom:0;text-align: center;' class='blanktd'>Premios</th>
<th style='border-bottom:0;text-align: center;' class='blanktd'>Total</th>
<th style='border:0;background: transparent' class='blanktd'></th>
<th style='border-bottom:0;text-align: center;' class='blanktd'>NETWIN</th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>IEPS<span class="" style="float: right;"><input id='toggleIEPSTotales' type='button' value='+/-'/></span></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th><th></th><th></th>
<th>Retenci&oacute;n <input id='toggleRetTotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>SEGOB<input id='toggleSEGTotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>Estatal<input id='toggleEstTotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>IDE<input id='toggleIDETotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th><th></th>
<th>Impuestos<input id='toggleImpTotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>DEP<input id='toggleDepTotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
<th></th><th></th><th></th>
<th>Particiapaci&oacute;n<input id='togglePartTotales' type='button' value='+/-'/></th>
<th style='border:0; background: transparent' class='blanktd'></th>
</tr>
<tr>
<th style='text-align: center;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th>Ingresos</th>
<th>Devoluciones</th>
<th>Premios</th>
<th style='border:0;background: transparent'></th>
<th>Ingresos</th>
<th>Premios</th>
<th style='border:0;background: transparent'></th>
<th>Ingresos</th>
<th>Premios</th>
<th style='border:0;background: transparent'></th>
<th>Ingresos</th>
<th>Devoluciones</th>
<th>Premios</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;text-align: center;'>de sala</th>
<th style='border-top:0;text-align: center;'>premios</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;text-align: center;'>IEPS</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Premios</th>
<th style='border-top:0;'>Sorteos</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>ISR</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
<th style='border:0;background: transparent'></th>
<th style='border-top:0;'>Maquinas</th>
<th style='border-top:0;'>Bingo</th>
<th style='border-top:0;'>SB</th>
<th style='border-top:0;'>Sala</th>
</tr>
</thead>
<?php
foreach ( $user_countTotales as $fivesdraftTotales ) {
if ($contador&1) { echo "<tr class='odd'>";}
else {echo "<tr class='even'>";}
echo "<td>".$fivesdraftTotales->sala."</td><td style='border:0;background: transparent'></td><td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotMaq)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoDevMaq)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoPreMaq)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotBinTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagPremBingoTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagPremSBTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ingTotTot)."</td>"; // Totales (maq, Bingo, SB)
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoDevTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->pagoPremTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->sorteosTot)."</td>"; // Sorteos
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->premiosTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->netWinTot)."</td>"; // NetWin IEPS
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsMaqTot)."</td>"; // IEPS
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->iepsSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retMaqTot)."</td>"; // Retencion
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retgSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSalaTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSalaTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->retSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segMaqTot)."</td>"; // SEGOB
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->segSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estMaqTot)."</td>"; // Estatal
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->estSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ideMaqTot)."</td>"; // IDE
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ideBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ideSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->IdeSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impMaqTot)."</td>"; // Impuestos
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->ISRSalaTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->impSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depMaqTot)."</td>"; // DEP
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->depSalaTot)."</td>";
echo "<td style='border:0;background: transparent'></td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partMaqTot)."</td>"; // Participacion
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partBingoTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partSBTot)."</td>";
echo "<td>". money_format('%+#10.2n', $fivesdraftTotales->partSalaTot)."</td>";
echo "</tr>";
$contador++;
}
echo "</table>";
} // END IF Totales
else {
// Si no genera consulta
}
//echo "<p>User count is {$user_count}</p>";
?>
</table>
</div>
<!--
F I N
Contenido Personalizado
-->
<?php endif; ?>
<?php endif; ?>
<?php
} // is_page('Sala')
if (is_page(496)) { // Captura SB
comments_template( '', false );
$salasSB = array("aguaprieta","ensenada","sanluis","guamuchil","teziutlan");
?>
<?php
$host = "216.70.86.180";
$user = "bookAdmin2";
$password = "comE310";
$database = "reportediario";
/*
$user = "prometeo";
$password = "3:10toYuma!";
$database = "reporteAutomata";
*/
//Culi
$connection = mysql_connect($host,$user,$password)
or die("Could not connect: ".mysql_error());
mysql_select_db($database,$connection)
or die("Error in selecting the database:".mysql_error());
$sala = trim($current_user->user_login);
?>
<div style="text-align:center; padding-left: 50px;">
<?php
if (in_array($sala, $salasSB)) {
$sql ="SELECT MIN(fecha) AS ultimoReporte FROM data WHERE sala = '$sala' AND ingresosTotalesSB IS NULL";
$sql_result=mysql_query($sql,$connection)
or exit("Sql Error".mysql_error());
$sql_num=mysql_num_rows($sql_result);
while($row=mysql_fetch_array($sql_result)) {
$fechaReporte = $row['ultimoReporte'];
$fechaCaptura = date("Y-m-d",strtotime($fechaReporte.""));
?>
<?php
echo "<p style='margin-bottom:20px; font-weight:bold'>Fecha de captura: " .$dias[date('w', strtotime($fechaCaptura))]." ".date('d', strtotime($fechaCaptura)). " de " . $meses[date('n', strtotime($fechaCaptura))-1]. ", " .date('Y', strtotime($fechaCaptura))."</p>";
} // END While
} // in_array($session->username, $salasSB
// salas captura manual Sportbook
if (in_array($sala, $salasSB)) {
$resultadoSB = mysql_query("SELECT ingresosTotalesMaq, pagoDevolucionesMaq, pagoPremioMaq, ingresosTotalesSB FROM data WHERE sala = '$sala' AND fecha = '$fechaReporte'");
if(mysql_num_rows($resultadoSB) != 0) {
while($row1=mysql_fetch_array($resultadoSB)) {
$ingTotMaq = $row1['ingresosTotalesMaq'];
$pagoDevMaq = $row1['pagoDevolucionesMaq'];
$pagoPreMaq = $row1['pagoPremioMaq'];
}
}
} // FIN salas Sportbook
?>
<br />
<div class="" style="background: #e5e3db;width: 400px; margin: 0 auto; padding-top: 10px;" >
<form name="capturaSB" method="POST" action="<?php echo get_permalink( '499' ); ?>" class="wp-core-ui">
<input type="hidden" name="fechaCaptura" value="<?php echo date("Y-m-d", strtotime($fechaCaptura)); ?>" />
<h1 style="-webkit-border-top-left-radius: 10px;-webkit-border-top-right-radius: 10px;-moz-border-radius-topleft: 10px;-moz-border-radius-topright: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px; background:red;width: 350px;margin: 5px auto 0; text-align: center; padding: 5px; background: #54ab8b;text-shadow: black 0.1em 0.1em 0.2em; color: #f5f5f5; border-bottom: 1px solid #43896f;">SportBook</h1>
<div class="roundShite" style="width: 350px;margin: 0 auto 5px; text-align: center; padding: 5px; border-top: 1px solid #326753;">
<table >
<tr>
<th style="text-align: right; width: 50%;">Ingreros Totales:</th>
<th><input class="hey" type='text' name="ingresosTotalesSB" id="heh5" value="" onKeyPress="return checkIt(event)" /></th>
</tr>
<tr>
<td style="text-align: right;">Pago de Premio:</td>
<td><input class="hey" type='text' name="pagoPremioSB" id="heh6" value="" onKeyPress="return checkIt(event)" /></td>
</tr>
</table>
</div>
<h1 style="-webkit-border-top-left-radius: 10px;-webkit-border-top-right-radius: 10px;-moz-border-radius-topleft: 10px;-moz-border-radius-topright: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px; background:red;width: 350px;margin: 5px auto 0; text-align: center; padding: 5px; background: #bab5a0; color: #e5e3db;border-bottom: 1px solid #a59e82;">M&aacute;quinas</h1>
<div class="roundShite" style="width: 350px;margin: 0 auto 5px; text-align: center; padding: 5px; border-top: 1px solid #8d8667;">
<table class='disabledInputs'>
<tr>
<th style="text-align: right; width: 50%;">Ingreros Totales:</th>
<th><input class="hey" type="text" step="any" name="ingresosTotalesMaq" id="heh" value="<?php echo money_format("%10.2n", round($ingTotMaq,2)) ?>" onKeyPress="return checkIt(event)" readonly/></th>
</tr>
<tr>
<td style="text-align: right;">Pago dev.:</td>
<td><input class="hey" type="text" step="any" name="pagoDevolucionesMaq" id="heh1" value=" <?php echo money_format("%+#10.2n", round($pagoDevMaq,2)) ?>" onKeyPress="return checkIt(event)" readonly/></td>
</tr>
<tr>
<td style="text-align: right;">Pago de Premio:</td>
<td><input class="hey" type="text" step="any" name="pagoPremioMaq" id="heh2" value="<?php echo money_format("%+#10.2n", round($pagoPreMaq,2)) ?>" onKeyPress="return checkIt(event)" readonly/></td>
</tr>
</table>
</div>
<h1 style="-webkit-border-top-left-radius: 10px;-webkit-border-top-right-radius: 10px;-moz-border-radius-topleft: 10px;-moz-border-radius-topright: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px; background:red;width: 350px;margin: 5px auto 0; text-align: center; padding: 5px; background: #bab5a0;color: #e5e3db;border-bottom: 1px solid #a59e82;">Bingo</h1>
<div class="roundShite" style="width: 350px;margin: 0 auto; text-align: center; padding: 5px;border-top: 1px solid #8d8667;">
<table class='disabledInputs'>
<tr>
<th style="text-align: right; width: 50%;">Ingreros Totales:</th>
<th><input class="hey" type="text" name="ingresosTotalesBingo" id="heh3" value="<?php echo money_format("%+#10.2n", round(0,2)) ?>" onKeyPress="return checkIt(event)" readonly/></th>
</tr>
<tr>
<td style="text-align: right;">Pago de Premio:</td>
<td><input class="hey" type="text" name="pagoPremioBingo" id="heh4" value="<?php echo money_format("%+#10.2n", round(0,2)) ?>" onKeyPress="return checkIt(event)" readonly/></td>
</tr>
</table>
</div>
<input style="margin: 10px 0 30px; width: 85%; height: 30px;" type="submit" name="" value="Vista Previa" class="button button-primary"/>
</form>
</div>
<?php
} // END 496 Captura SB
if (is_page(499)) { // Vist Previa Captura SB
comments_template( '', false );
$mysql_db_hostname = "216.70.86.180";
$mysql_db_user = "bookAdmin2";
$mysql_db_password = "comE310";
$mysql_db_database = "reportediario";
// Culi
/*
$mysql_db_user = "prometeo";
$mysql_db_password = "3:10toYuma!";
$mysql_db_database = "reporteAutomata";
*/
$con = mysql_connect($mysql_db_hostname,$mysql_db_user,$mysql_db_password);
if (!$con)
{die('Could not connect: ' . mysql_error());}
mysql_select_db($mysql_db_database, $con);
// DB Insert
$sala = trim($current_user->user_login);
$theDate = $_POST['fechaCaptura'];
$unfingTotMaq = preg_replace('/[$,]/', '', $_POST['ingresosTotalesMaq']);
$unfPagoPreMaq = preg_replace('/[$,]/', '', $_POST['pagoPremioMaq']);
$unfPagoDevMaq = preg_replace('/[$,]/', '', $_POST['pagoDevolucionesMaq']);
$unfingTotBin = preg_replace('/[$,]/', '', $_POST['ingresosTotalesBingo']);
$unfPagoPreBin = preg_replace('/[$,]/', '', $_POST['pagoPremioBingo']);
$unfingTotSB = preg_replace('/[$,]/', '', $_POST['ingresosTotalesSB']);
$unfPagoPreSB = preg_replace('/[$,]/', '', $_POST['pagoPremioSB']);
$ingresosTotal= 0;
$pagoDevolucionesTotal= 0;
$sorteos= 0;
$pagoPremioTotal= 0;
$totalPremios= 0;
$netWinIEPS= 0;
$iepsMaq= 0;
$iepsBingo= 0;
$iepsSB= 0;
$iepsSala= 0;
$retencionMaq= 0;
$retencionBingo= 0;
$retencionSB= 0;
$retencionSala= 0;
$segobMaq= 0;
$segobBingo= 0;
$segobSB= 0;
$segobSala= 0;
$estatalMaq= 0;
$estataBingo= 0;
$estatalSB= 0;
$estatalSala= 0;
$ideMaq= 0;
$ideBingo= 0;
$ideSB= 0;
$ideSala= 0;
$impMaq= 0;
$impBingo= 0;
$impSB= 0;
$impSala= 0;
$depMaq= 0;
$depBingo= 0;
$depSB= 0;
$depSala= 0;
$partMaq = 0;
$partBingo = 0;
$partSB = 0;
$partSala = 0;
/*
T E S T C A L C U L O S
*/
$fecha = $theDate;
$m = date('n', strtotime($fecha));
$yearo = date('Y', strtotime($fecha));
// Obtiene el primer dia del mes
//$inicioMes = date('Y-m-d',mktime(1,1,1,$m,1,date('Y')));
$inicioMes = date('Y-m-d',mktime(1,1,1,$m,1,$yearo));
// Variables
$tres = 0.3;
$dos = 0.2;
$uno = 0.1;
$cerotres = 0.03;
$cerodos = 0.02;
$cerouno = 0.01;
// Calcula ingresos totales [maquinas+bingo+sportbook]
$ingresosTotal = $unfingTotMaq + $unfingTotBin + $unfingTotSB;
// Calcula devoluciones, solo para maquinas
$pagoDevolucionesTotal = $unfPagoDevMaq;
// Calcula premios totales [maquinas+bingo+sportbook]
$pagoPremioTotal = $unfPagoPreMaq + $unfPagoPreBin + $unfPagoPreSB;
// S E G O B
// SEGOB Maquinas
$segobMaq = $unfingTotMaq - $unfPagoDevMaq;
if ($segobMaq > 0) {
$segobMaq2 = round($segobMaq*0.02,2);
}
else {$segobMaq2 = 0;}
// SEGOB Bingo
$segobBingo = $unfingTotBin*$cerouno;
// SEGOB SB
$segobSB = $unfingTotSB*$cerouno;
// Calcula SEGOB Sala
$segobSala = $segobMaq2 + $segobBingo + $segobSB;
// END S E G O B
// R E T E N C I O N 1%
// Retencion Maquinas
$retencionMaq = $unfPagoPreMaq*$cerouno;
// Retencion Bingo
$retencionBingo = $unfPagoPreBin*$cerouno;
// Retencion Sportbook
$retencionSB = $unfPagoPreSB*$cerouno;
// Mod 2013
// Retencion de premios
$retencionPremios = $retencionMaq + $retencionBingo + $retencionSB;
// Retencio Sala
if ( date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08')) ) { // Antes de Agosto 2013
$retencionSala = $retencionMaq + $retencionBingo + $retencionSB;
}
// END R E T E N C I O N 1%
// I M P U E S T O E S T A T A L
$ax = 102 * 150;
$axHolly = 150 * 450;
$axHolly2 = 150*325;
$axMtemrls = 150*110;
$axMty = 150*655;
$axGpe = 150*622;
$axAlle = 150*168;
$an = date('Y', strtotime($fecha));
// si ingresos totales son mayores a 0
if ($ingresosTotal >0) {
// Estatal Maquina
// L I N A R E S
// A partir de 2013 no paga Estatal
if ($sala == 'linares') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*106/date('t',strtotime($fecha));
}
else {
if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))){$estatalMaq = $ax/date('t',strtotime($fecha));}
}
} // End Linares
// H O L L Y W O O D 1
// A partir de 2013 no paga Estatal
else if ($sala == 'hollywood1') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*384/date('t',strtotime($fecha));
}
else if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {
$estatalMaq = $axHolly/date('t',strtotime($fecha));
}
} // End Hollywood 1
// H O L L Y W O O D 2
// A partir de 2013 no paga Estatal
else if ($sala == 'hollywood2') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*504/date('t',strtotime($fecha));
}
else if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {
$estatalMaq = $axHolly2/date('t',strtotime($fecha));
}
} // End Hollywood 2
// M O N T E M O R E L O S
// A partir de 2013 no paga Estatal
else if ($sala == 'montemorelos') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*183/date('t',strtotime($fecha));
}
else {
if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {$estatalMaq = $axMtemrls/date('t',strtotime($fecha));}
}
} // End Montemorelos
// M O N T E R R E Y
// A partir de 2013 no paga Estatal
else if ($sala == 'monterrey') {
if ($an==2013) {
$estatalMaq=0;
}
else if ($an<2013){
if ($ingresosTotal >0){$estatalMaq = $axMtemrls/date('t',strtotime($fecha));}
else {$estatalMaq = 0;}
}
} // End Monterrey
// G U A D A L U P E
// A partir de 2013 no paga Estatal
else if ($sala == 'guadalupe') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*704/date('t',strtotime($fecha));
}
else {
if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {
$estatalMaq = $axGpe/date('t',strtotime($fecha));
}
}
} // End Guadalupe
// A L L E N D E
// A partir de 2013 no paga Estatal
else if ($sala == 'allende') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*176/date('t',strtotime($fecha));
}
else {$estatalMaq = 0;}
} // End Allende
// A G U A P R I E T A
else if ($sala == 'aguaprieta') {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = ($retencionBingo/.01)*.06;
$estatalSB = ($retencionSB/.01)*.06;
} // End Agua Prieta
// E N S E N A D A
else if ($sala == 'ensenada') {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = ($retencionBingo/.01)*.06;
$estatalSB = ($retencionSB/.01)*.0945;
} // End Ensenada
// G O M E Z P A L A C I O
// modificación, Gomez Palacio no paga estatal
else if ($sala == 'gomezpalacio') {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = 0;
$estatalSB = 0;
$estatalSala = 0;
} // End Gomez Palacio
// N A U C A L P A N
else if ($sala == 'naucalpan') {
// A partir de 2013 Naucalpan paga Impuesto Estatal
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 26304/date('t',strtotime($fecha));
}
$estatalBingo = 0;
$estatalSB = 0;
} // End Gomez Palacio
// R E S T O D E S A L A S
else {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = ($retencionBingo/.01)*.06;
$estatalSB = ($retencionSB/.01)*.06;
}
// End Estatal Maquinas
} // END ingresos totales igual a 0
else {$estatalMaq = 0;}
// Estatal Bingo
$estatalBingo = 0;
// Estatal SB
//$estatalSB = 0;
// Estatal Sala
if ($sala !== 'gomezpalacio') { $estatalSala = $estatalMaq + $estatalBingo + $estatalSB; }
// END I M P U E S T O E S T A T A L
// I D E
// IDE Maquinas
$ideMaq = ($unfingTotMaq - $unfPagoDevMaq - $unfPagoPreMaq + $retencionMaq) * $cerotres;
// Calcula IDE Bingo
$ideBingo = ($unfingTotBin - $unfPagoPreBin + $retencionBingo + $estatalBingo)*$cerotres;
// Calcula IDE Sportbook
$ideSB = ($unfingTotSB - $unfPagoPreSB + $retencionSB + $estatalSB)*$cerotres;
// Calcula IDE Sala
$ideSala = $ideMaq + $ideBingo + $ideSB;
// END I D E
// D E P / N E T W I N B r u t o
// DEP Maquinas
$salasDEP = array('linares', 'aguaprieta', 'nogales', 'ensenada', 'hollywood1', 'hollywood2', 'cananea', 'guamuchil', 'montemorelos', 'monterrey', 'guadalupe', 'allende', 'ajijic', 'puertovallarta', 'guadalajara', 'texcoco', 'teziutlan', 'sanluis', 'gomezpalacio');
// Salas sin sumar Impuesto Estatal
if (in_array($sala, $salasDEP)) {$depMaq = $unfingTotMaq - $unfPagoDevMaq - $unfPagoPreMaq + $retencionMaq;}
// Salas sumando Impuesto Estatal
else {$depMaq = $unfingTotMaq - $unfPagoDevMaq - $unfPagoPreMaq + $retencionMaq + $estatalMaq;}
// DEP Bingo
$depBingo = $unfingTotBin - $unfPagoPreBin + $retencionBingo;
// DEP SportBook
$depSB = $unfingTotSB - $unfPagoPreSB + $retencionSB;
// Calcula NETWIN Bruto / Dep Sala
$depSala = $depMaq + $depBingo +$depSB;
// D E P / N E T W I N B r u t o
// El calculo de impuestos varia dependiendo el día del mes
// Si NO es primero de mes, se toma un acumulado de los días anteriores
// Extrae el dia(numero) de $fecha
$diaFecha = date('d', strtotime($fecha));
// Participación de Máquinas = 0
$partMaq = 0;
// Salas que no calculan ISR
$noISR = array("linares","teziutlan");
$FoliattiPart = array('monterrey', 'guadalupe', 'ajijic', 'puertovallarta', 'guadalajara');
// Si es Primero de Mes
if ($diaFecha == '01') {
// S O R T E O S
$validaSorteos = $ingresosTotal - $pagoDevolucionesTotal - $pagoPremioTotal;
// MOD Agosto 2013
if ( $validaSorteos > 0){
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$sorteos = $validaSorteos - ($segobSala*1.1+($ideSala - $retencionPremios))/0.3;
}
else {$sorteos = $validaSorteos - ($segobSala*1.1+($ideSala - $retencionSala))/0.3;}
}
if ($sorteos < 0) {$sorteos = 0;}
// END S O R T E O S
// MOD Agosto 2013
// Retencion 1%
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$retencionSorteos = $sorteos * 0.01;
$retencionSala = $retencionSorteos + $retencionPremios;
}
else {
$retencionSorteos = 0;
}
// I E P S
// IEPS Maquinas
$iepsMaq = ($unfingTotMaq - $pagoDevolucionesTotal - $unfPagoPreMaq - $sorteos) * $tres;
// IEPS Bingo
$iepsBingo = ($unfingTotBin - $unfPagoPreBin) * $tres;
// IEPS Sportbook
$iepsSB = ($unfingTotSB - $unfPagoPreSB) * $tres;
if ($iepsSB < 0) { $iepsSB = 0; }
// IEPS Sala
$iepsSala = $iepsMaq + $iepsBingo + $iepsSB;
// END I E P S
// I M P U E S T O T O T A L
// Impuesto Maquinas
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$impMaq = $iepsMaq + $retencionSala + $estatalMaq;
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {$impMaq = $iepsMaq + $retencionMaq + $estatalMaq;}
// Impuesto Bingo
$impBingo = $iepsBingo + $retencionBingo + $estatalBingo;
// Impuesto SportBook
$impSB = $iepsSB + $retencionSB + $estatalSB;
/*
C a l c u l o I S R 2 0 1 3
Calcula ISR a partir de 2013
IEPS sala + ret sala + estatal sala + ISR sala
*/
// Calcula ISR
if ( !in_array($session->username, $noISR)) { // si calcula ISR
if (($ingresosTotal-$pagoDevolucionesTotal-$pagoPremioTotal) > 0) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$ISRSala = ((($ingresosTotal-$pagoDevolucionesTotal-$pagoPremioTotal-$iepsSala+$segobSala)*0.0282)*.30);
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {
$ISRSala = ((($ingresosTotal-$pagoDevolucionesTotal)*0.0081)*.30);
}
}
else {$ISRSala = 0;}
}
// si no calcula ISR
else {$ISRSala = 0;}
// Calcula impuesto Sala
$impSala = $iepsSala + $retencionSala + $estatalSala + $ISRSala;
// END I M P U E S T O T O T A L
// P A R T I C I P A C I O N
// Participación Máquinas
// L I N A R E S
if ($sala == 'linares') {
$partMaq = 0;
$partSB = 0;
$partBingo = 0;
// Comienza a pagar participación a partir del 1 de Febrero de 2013
/*
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){$partMaq = ($depMaq-$impMaq)*0.11;}
else {$partMaq = 0;}
} // fin if fecha aplica para participacion
else {
$partMaq = 0;
}
*/
} // End Linares
// C A N A N E A
else if ($sala == 'cananea') {
if ($depSala > 0) {
$partMaq = 100000/date('t',strtotime($fecha));
}
else {$partMaq = 0;}
$partBingo = 0;
$partSB = 0;
} // End Cananea
// H O L L Y W O O D
else if ($sala == 'hollywood1' || $sala == 'hollywood2') {
$partMaq = ($depMaq - $impMaq)*0.12;
} // End Hollywood
// S A L A S F O L I A T T I
else if (in_array($sala, $FoliattiPart)) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = ($depMaq - $impMaq)*0.11;
}
elseif (date('Y-m-d', strtotime($fecha)) < date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = ($depMaq - $impMaq)*0;
}
}
else {$partMaq = ($depMaq - $impMaq)*0.11;}
// End Participacion Maquinas
// participacion sportbook
if ($sala == 'texcoco' || $sala == 'ensenada') {if ($unfPagoPreMaq > 0) {$partSB = ($depSB - $impSB)*0.11;}}
else if ($sala == 'teziutlan') {
if ($unfPagoPreMaq > 0) {
$partBingo = ($depBingo -$impBingo)*0.11;
$partSB = ($depSB - $impSB)*0.09;
if($partSB<0){$partSB=0;}
}
}
else if ($sala == 'naucalpan') {
if ($unfPagoPreMaq > 0) {
$partBingo = ($depBingo -$impBingo)*0.11;
$partSB = ($depSB - $impSB)*0.11;
}
}
else {$partSB = 0;}
if ($partMaq < 0) {$partMaq = 0;}
if ($partSB < 0) {$partSB = 0;}
// participacion Sala
$partSala = $partMaq + $partBingo + $partSB;
// END P A R T I C I P A C I O N
} // END Si es primero de mes
else if ($diaFecha != '01') {
$dayBefore = date("Y-m-d",strtotime($fecha." last day "));
$sql = "SELECT SUM(ingresosTotalesMaq), SUM(pagoDevolucionesMaq), SUM(pagoPremioMaq), SUM(ingresosTotales), SUM(pagoDevoluciones), SUM(pagoPremio), SUM(segobSala), SUM(ideSala), SUM(retPremios), SUM(retSala), SUM(sorteos), SUM(ingresosTotalesBingo), SUM(pagoPremioBingo), SUM(iepsMaq), SUM(iepsBingo), SUM(iepsSB), SUM(ingresosTotalesSB),SUM(pagoPremioSB), SUM(depMaq), SUM(depBingo), SUM(depSB), SUM(impuestoMaq), SUM(impuestoBingo), SUM(impuestoSB), SUM(ISRSala), SUM(partMaq), SUM(partBingo), SUM(partSB) FROM data WHERE fecha BETWEEN '$inicioMes' AND '$dayBefore' AND '$sala' = sala GROUP BY sala";
$sql_result=mysql_query($sql,$con) or exit("Sql Error".mysql_error());
$sql_num=mysql_num_rows($sql_result);
while($row=mysql_fetch_array($sql_result)) {
// Calculca Sorteos --------------------------------------------
//--------------------------------------------------------------
$ingresosTotales = $ingresosTotal + $row['SUM(ingresosTotales)'];
$pagoDevTotales = $pagoDevolucionesTotal + $row['SUM(pagoDevoluciones)'];
$pagoPremioTotales = $pagoPremioTotal + $row['SUM(pagoPremio)'];
$segobTotal = $segobSala + $row['SUM(segobSala)'];
$ideTotal =$ideSala + $row['SUM(ideSala)'];
// MOD Agosto 2013
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$retTotal = $retencionPremios + $row['SUM(retPremios)'];
}
else {$retTotal =$retencionSala + $row['SUM(retSala)'];}
$sorteosTotal =$row['SUM(sorteos)'];
$valSorteosTest = $ingresosTotales - $pagoDevTotales - $pagoPremioTotales;
if ( $valSorteosTest > 0){
$sorteos = ($valSorteosTest - (($segobTotal*1.1)+($ideTotal - $retTotal))/0.3) - $sorteosTotal;
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$retencionSorteos = $sorteos * 0.01;
$retencionSala = $retencionSorteos + $retencionPremios;
}
}
if ($sorteos < 0) {$sorteos = 0;}
//-------------------------------------------------------------
// Calcula IEPS -------------------------------------------------
// Calcula IEPS Maqinas -----------------------------------------
$ingrTotMaq= $unfingTotMaq + $row['SUM(ingresosTotalesMaq)'];
$pgDvMaq= $unfPagoDevMaq + $row['SUM(pagoDevolucionesMaq)'];
$pgPrMaq= $unfPagoPreMaq + $row['SUM(pagoPremioMaq)'];
$srts = $sorteos + $row['SUM(sorteos)'];
$iepsMaqtest = $row['SUM(iepsMaq)'];
$iepsMaq = (($ingrTotMaq - $pgDvMaq - $pgPrMaq - $srts)*0.3)- $iepsMaqtest;
if ($iepsMaq < 0) {$iepsMaq = 0;}
//-------------------------------------------------------------
// Calcula IEPS Bingo -------------------------------------------
$ingrTotBingo= $unfingTotBin + $row['SUM(ingresosTotalesBingo)'];
$pgPrBingo= $unfPagoPreBin + $row['SUM(pagoPremioBingo)'];
$iepsBing = $row['SUM(iepsBingo)'];
$iepsBingo = (($ingrTotBingo - $pgPrBingo)*0.3)- $iepsBing;
if ($iepsBingo < 0) {$iepsBingo = 0;}
//-------------------------------------------------------------
// Calcula IEPS SpoortBook -------------------------------
$ingrTotSB= $unfingTotSB + $row['SUM(ingresosTotalesSB)'];
$pgPrSB= $unfPagoPreSB + $row['SUM(pagoPremioSB)'];
$iepsSpBo = $row['SUM(iepsSB)'];
$iepsSB = (($ingrTotSB - $pgPrSB)*0.3)- $iepsSpBo;
if ($iepsSB < 0) {$iepsSB = 0;}
//----------------------------------------------------
$iepsSala = $iepsMaq + $iepsBingo + $iepsSB;
// Fin IEPS ---------------------------------------------------
// Calcula Impuesto Maquinas
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$impMaq = $iepsMaq + $retencionSala + $estatalMaq;
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {$impMaq = $iepsMaq + $retencionMaq + $estatalMaq;}
// Calcula impuesto Bingo
$impBingo = $iepsBingo + $retencionBingo + $estatalBingo;
// Calcula impuesto SportBook
$impSB = $iepsSB + $retencionSB + $estatalSB;
/*
C a l c u l o I S R 2 0 1 3
Calcula ISR a partir de 2013
IEPS sala + ret sala + estatal sala + ISR sala
*/
// Calcula ISR
if ( !in_array($session->username, $noISR)) { // si calcula ISR
if (($ingresosTotales-$pagoDevTotales-$pagoPremioTotales) > 0) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$ISRSala = ((($ingresosTotales-$pagoDevTotales-$pagoPremioTotales-($iepsSala+$iepsMaqtest)+$segobTotal)*0.0282)*.30)-$row['SUM(ISRSala)'];
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {
$ISRSala = ((( $ingresosTotales - $pagoDevTotales )*0.0081)*.30) - $row['SUM(ISRSala)'];
}
} // END $ingresosTotales-$pagoDevTotales-$pagoPremioTotales) > 0
else {$ISRSala = 0;}
} // END si calcula ISR
else {$ISRSala = 0;} // si no calcula ISR
//$ISRSala = ((( ($ingresosTotal + $row['SUM(ingresosTotales)']) - ($pagoDevolucionesTotal + $row['SUM(pagoDevoluciones)']) )*0.0081)*.30) - $row['SUM(ISRSala)'];
// Calcula impuesto Sala
//$impSala = $impMaq + $impBingo + $impSB;
$impSala = $iepsSala + $retencionSala + $estatalSala + $ISRSala;
// Calcula Participacion
// Maquinas
// L I N A R E S
if ($sala == 'linares') {
$partMaq = 0;
$partBingo = 0;
$partSB = 0;
$partSala = 0;
// linares comienza a pagar participación el 1 de Febrero de 2013
/*
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
$partMaq = ($depMaqTot - $impMaqTot)*0.11 - $partMaqHist;
}
} // fin if fecha aplica para participacion
else {
}
*/
} // End Linares
// A G U A P R I E T A
else if($sala == 'aguaprieta') {
$partMaq = 0;
$partBingo = 0;
$partSB = 0;
$partSala = 0;
// Agua Prieta comienza a pagar participación el 1 de Febrero de 2013
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
$partMaq = ($depMaqTot - $impMaqTot)*0.11 - $partMaqHist;
}
} // fin if fecha aplica para participacion
else {
if ($unfingTotMaq > 0) {
$partMaq = ($depMaq-$impMaq)*0.11;
}
}
} // End Agua Prieta
// C A N A N E A
else if ($sala == 'cananea') {
if ($depSala > 0) {
$partMaq = 100000/$diaMes;
}
else {$partMaq = 0;}
$partBingo = 0;
$partSB = 0;
} // End Cananea
// G U A M U C H I L
else if ($sala == 'guamuchil') {
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
$partMaq = ($depMaqTot - $impMaqTot)*0.11 - $partMaqHist;
}
} // fin if fecha aplica para participacion
else {
if ($unfingTotMaq > 0) {
$partMaq = ($depMaq-$impMaq)*0.11;
}
}
$partBingo = 0;
$partSB = 0;
}
else {
if ($unfingTotMaq > 0) {
// Participacion Maquinas
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
// Participacion Bingo
$depBingoTot = $depBingo + $row['SUM(depBingo)'];
$impBingoTot = $impBingo + $row['SUM(impuestoBingo)'];
$partBingoHist = $row['SUM(partBingo)'];
if ($sala == 'teziutlan' || $sala == 'naucalpan') {
$partBingo = ($depBingoTot -$impBingoTot)*.11 -$partBingoHist;
if($partBingo<0){$partBingo=0;}
}
// Participacion SportBook
$depSBTot = $depSB + $row['SUM(depSB)'];
$impSBTot = $impSB + $row['SUM(impuestoSB)'];
$partSBHist = $row['SUM(partSB)'];
if ($sala == 'hollywood1' || $sala == 'hollywood2') {
$partMaq = ($depMaqTot - $impMaqTot)*0.12- $partMaqHist;
}
else if ( in_array($sala, $FoliattiPart)) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = ($depMaqTot - $impMaqTot)*0.11- $partMaqHist;
}
elseif (date('Y-m-d', strtotime($fecha)) < date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = 0;
}
}
else {$partMaq = ($depMaqTot - $impMaqTot)*0.11- $partMaqHist;}
if ($sala == 'texcoco' || $sala == 'naucalpan' || $sala == 'ensenada') {
$partSB = ($depSBTot - $impSBTot)*0.11 - $partSBHist;
}
else if ($sala == 'teziutlan') {$partSB = ($depSBTot - $impSBTot)*0.09 - $partSBHist; if($partSB<0){$partSB=0;}}
else {$partSB = 0;}
} // end if ingTotMaq mayor a 0
if ($partMaq < 0) {$partMaq = 0;}
} // end else
$partSala = $partMaq + $partBingo + $partSB;
if ($partMaq < 0) {$partMaq = 0;}
$partSala = $partMaq + $partBingo + $partSB;
} // end while
} // end if No es primero de Mes
// Calcula total premios [pago de devoluciones+sorteos+pago de premios]
$totalPremios = $pagoDevolucionesTotal + $sorteos + $pagoPremioTotal;
// Calcula NET WIN IEPS
$netWinIEPS = $ingresosTotal - $totalPremios;
/*
F I N
T E S T C A L C U L O S
$sql="REPLACE INTO data (sala, fecha, ingresosTotalesMaq, pagoDevolucionesMaq, pagoPremioMaq, ingresosTotalesBingo, pagoPremioBingo, ingresosTotalesSB, pagoPremioSB, ingresosTotales, pagoDevoluciones, sorteos, pagoPremio, totalPremios, netWinIEPS, iepsMaq, iepsBingo, iepsSB, iepsSala, retMaq, retBingo, retSB, retPremios, retSorteos, retSala, segobMaq, segobBingo, segobSB, segobSala, estatalMaq, estatalBingo, estatalSB, estatalSala, ideMaq, ideBingo, ideSB, ideSala, impuestoMaq, impuestoBingo, impuestoSB, ISRSala, totalImpuesto, depMaq, depBingo, depSB, depSala, partMaq, partBingo, partSB, partSala, JugadoresActivos) VALUES('$sala','$theDate','$unfingTotMaq','$unfPagoDevMaq','$unfPagoPreMaq','0','0',NULL,'0','$ingresosTotal','$pagoDevolucionesTotal','$sorteos','$pagoPremioTotal','$totalPremios','$netWinIEPS','$iepsMaq','$iepsBingo','$iepsSB','$iepsSala','$retencionMaq','$retencionBingo','$retencionSB','$retencionPremios','$retencionSorteos','$retencionSala','$segobMaq2','$segobBingo','$segobSB','$segobSala','$estatalMaq','$estatalBingo','$estatalSB','$estatalSala','$ideMaq','$ideBingo','$ideSB','$ideSala','$impMaq','$impBingo','$impSB','$ISRSala','$impSala','$depMaq','$depBingo','$depSB','$depSala','$partMaq','$partBingo','$partSB','$partSala','$jActivos')";
if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }
*/
?>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Ingresos Totales</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Devoluciones Totales</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Premios Totales</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Premios de Sala</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Pago de Premios</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">NETWIN IEPS</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ingresosTotal,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($pagoDevolucionesTotal,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($sorteos,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($pagoPremioTotal,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($totalPremios,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($netWinIEPS,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">IEPS</th>
<th colspan="6" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Retencion</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Premios</th>
<th style="background: #f5aec5;">Sorteos</th>
<th style="background: #eaaaef;">Sala</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($iepsMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($iepsBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($iepsSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($iepsSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionSB,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionPremios,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionSorteos,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($retencionSala,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">SEGOB</th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Estatal</th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">IDE</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<body>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($segobMaq2,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($segobBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($segobSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($segobSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($estatalMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($estataBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($estatalSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($estatalSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ideMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ideBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ideSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($ideSala,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th colspan="5" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Impuestos</th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">DEP</th>
<th colspan="4" style="background: #9eedb9; border-bottom: 1px solid #48dd7b;">Particiapaci&oacute;n</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">ISR</th>
<th style="background: #f5aec5;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<body>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($impMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($impBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($impSB,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ISRSala,2)); ?></td>
<td style="background: #fff;"><?php echo money_format('%+#10.2n', round($impSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($depMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($depBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($depSB,2)); ?></td>
<td style="background: #fff;"><?php echo money_format('%+#10.2n', round($depSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($partMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($partBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($partSB,2)); ?></td>
<td style="background: #fff;"><?php echo money_format('%+#10.2n', round($partSala,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<form method="post" action="<?php echo get_permalink( 502 );?>" style="width: 400px; margin: 0 auto 30px; text-align: center;" class="wp-core-ui" >
<input type="hidden" name="fecha" value="<?php echo date("Y-m-d", strtotime($fecha)); ?>" />
<input type="hidden" name="unfingTotMaq" value="<?php echo $unfingTotMaq; ?>" /><input type="hidden" name="unfPagoPreMaq" value="<?php echo $unfPagoPreMaq; ?>" /><input type="hidden" name="unfPagoDevMaq" value="<?php echo $unfPagoDevMaq; ?>" /><input type="hidden" name="unfingTotBin" value="<?php echo $unfingTotBin; ?>" /><input type="hidden" name="unfPagoPreBin" value="<?php echo $unfPagoPreBin; ?>" /><input type="hidden" name="unfingTotSB" value="<?php echo $unfingTotSB; ?>" /><input type="hidden" name="unfPagoPreSB" value="<?php echo $unfPagoPreSB; ?>" /><input type="hidden" name="ingresosTotal" value="<?php echo $ingresosTotal; ?>" /><input type="hidden" name="pagoDevolucionesTotal" value="<?php echo $pagoDevolucionesTotal; ?>" /><input type="hidden" name="sorteos" value="<?php echo $sorteos; ?>" /><input type="hidden" name="pagoPremioTotal" value="<?php echo $pagoPremioTotal; ?>" /><input type="hidden" name="totalPremios" value="<?php echo $totalPremios; ?>" /><input type="hidden" name="netWinIEPS" value="<?php echo $netWinIEPS; ?>" /><input type="hidden" name="iepsMaq" value="<?php echo $iepsMaq; ?>" /><input type="hidden" name="iepsBingo" value="<?php echo $iepsBingo; ?>" /><input type="hidden" name="iepsSB" value="<?php echo $iepsSB; ?>" /><input type="hidden" name="iepsSala" value="<?php echo $iepsSala; ?>" /><input type="hidden" name="retencionMaq" value="<?php echo $retencionMaq; ?>" /><input type="hidden" name="retencionBingo" value="<?php echo $retencionBingo; ?>" /><input type="hidden" name="retencionSB" value="<?php echo $retencionSB; ?>" /> <!--MOD Agosto 2013--><input type="hidden" name="retencionPremios" value="<?php echo $retencionPremios; ?>" /><input type="hidden" name="retencionSorteos" value="<?php echo $retencionSorteos; ?>" /><!--END MOD Agosto 2013--><input type="hidden" name="retencionSala" value="<?php echo $retencionSala; ?>" /><input type="hidden" name="segobMaq" value="<?php echo $segobMaq2; ?>" /><input type="hidden" name="segobBingo" value="<?php echo $segobBingo; ?>" /><input type="hidden" name="segobSB" value="<?php echo $segobSB; ?>" /><input type="hidden" name="segobSala" value="<?php echo $segobSala; ?>" /><input type="hidden" name="estatalMaq" value="<?php echo $estatalMaq; ?>" /><input type="hidden" name="estataBingo" value="<?php echo $estataBingo; ?>" /><input type="hidden" name="estatalSB" value="<?php echo $estatalSB; ?>" /><input type="hidden" name="estatalSala" value="<?php echo $estatalSala; ?>" /><input type="hidden" name="ideMaq" value="<?php echo $ideMaq; ?>" /><input type="hidden" name="ideBingo" value="<?php echo $ideBingo; ?>" /><input type="hidden" name="ideSB" value="<?php echo $ideSB; ?>" /><input type="hidden" name="ideSala" value="<?php echo $ideSala; ?>" /><input type="hidden" name="impMaq" value="<?php echo $impMaq; ?>" /><input type="hidden" name="impBingo" value="<?php echo $impBingo; ?>" /><input type="hidden" name="impSB" value="<?php echo $impSB; ?>" /><input type="hidden" name="ISRSala" value="<?php echo $ISRSala; ?>" /><input type="hidden" name="impSala" value="<?php echo $impSala; ?>" /><input type="hidden" name="depMaq" value="<?php echo $depMaq; ?>" /><input type="hidden" name="depBingo" value="<?php echo $depBingo; ?>" /><input type="hidden" name="depSB" value="<?php echo $depSB; ?>" /><input type="hidden" name="depSala" value="<?php echo $depSala; ?>" /><input type="hidden" name="partMaq" value="<?php echo $partMaq; ?>" /><input type="hidden" name="partBingo" value="<?php echo $partBingo; ?>" /><input type="hidden" name="partSB" value="<?php echo $partSB; ?>" /><input type="hidden" name="partSala" value="<?php echo $partSala; ?>" />
<input type="button" name="" value="Regresar" ONCLICK="window.location.href='<?php echo get_permalink( 496 ) ?>'" class="button button-secondary" style="height: 25px;width: 45%; margin-right:10px;" />
<input type="submit" name="" value="Guardar Cambios" style="height: 25px;width: 45%; margin-left: 10px;" class="button button-primary" />
</form>
<?php
/*
echo "Jugadores Activos: ".$jActivos."<br />";
*/
mysql_close($con); // DB
} // End Previa SportsBook
// Si Procesa SportsBook
if ((is_page(502))) {
$sala = trim($current_user->user_login);
if (isset($_POST["fecha"])) { // si variables estan definidas (si viene de Previa SB)
$theDate = $_POST["fecha"];
$unfingTotMaq = $_POST['unfingTotMaq'];
$unfPagoPreMaq = $_POST['unfPagoPreMaq'];
$unfPagoDevMaq = $_POST['unfPagoDevMaq'];
$unfingTotBin = $_POST['unfingTotBin'];
$unfPagoPreBin = $_POST['unfPagoPreBin'];
$unfingTotSB = $_POST['unfingTotSB'];
$unfPagoPreSB = $_POST['unfPagoPreSB'];
$ingresosTotal= $_POST['ingresosTotal'];
$pagoDevolucionesTotal= $_POST['pagoDevolucionesTotal'];
$sorteos= $_POST['sorteos'];
$pagoPremioTotal= $_POST['pagoPremioTotal'];
$totalPremios= $_POST['totalPremios'];
$netWinIEPS= $_POST['netWinIEPS'];
$iepsMaq= $_POST['iepsMaq'];
$iepsBingo= $_POST['iepsBingo'];
$iepsSB= $_POST['iepsSB'];
$iepsSala= $_POST['iepsSala'];
$retencionMaq= $_POST['retencionMaq'];
$retencionBingo= $_POST['retencionBingo'];
$retencionSB= $_POST['retencionSB'];
/*
MOD Agosto 2013
*/
$retencionPremios= $_POST['retencionPremios'];
$retencionSorteos= $_POST['retencionSorteos'];
/*
FIN MOD Agosto 2013
*/
$retencionSala= $_POST['retencionSala'];
$segobMaq= $_POST['segobMaq'];
$segobBingo= $_POST['segobBingo'];
$segobSB= $_POST['segobSB'];
$segobSala= $_POST['segobSala'];
$estatalMaq= $_POST['estatalMaq'];
$estataBingo= $_POST['estataBingo'];
$estatalSB= $_POST['estatalSB'];
$estatalSala= $_POST['estatalSala'];
$ideMaq= $_POST['ideMaq'];
$ideBingo= $_POST['ideBingo'];
$ideSB= $_POST['ideSB'];
$ideSala= $_POST['ideSala'];
$impMaq= $_POST['impMaq'];
$impBingo= $_POST['impBingo'];
$impSB= $_POST['impSB'];
$ISRSala = $_POST['ISRSala'];
$impSala= $_POST['impSala'];
$depMaq= $_POST['depMaq'];
$depBingo= $_POST['depBingo'];
$depSB= $_POST['depSB'];
$depSala= $_POST['depSala'];
$partMaq = $_POST['partMaq'];
$partBingo = $_POST['partBingo'];
$partSB = $_POST['partSB'];
$partSala = $_POST['partSala'];
// Conecta a DB
$con = mysql_connect("216.70.86.180","bookAdmin2","comE310");
//$con = mysql_connect("216.70.86.180","prometeo","3:10toYuma!");
if (!$con) {die('Could not connect: ' . mysql_error());}
mysql_select_db("reportediario", $con);
//mysql_select_db("reporteAutomata", $con);
$sqlUpdate = "UPDATE data SET ingresosTotalesSB = '$unfingTotSB', pagoPremioSB = '$unfPagoPreSB', ingresosTotales = '$ingresosTotal', pagoDevoluciones = '$pagoDevolucionesTotal', sorteos = '$sorteos', pagoPremio = '$pagoPremioTotal', totalPremios = '$totalPremios', netWinIEPS = '$netWinIEPS', iepsMaq = '$iepsMaq', iepsBingo = '$iepsBingo', iepsSB = '$iepsSB', iepsSala = '$iepsSala', retMaq = '$retencionMaq', retBingo = '$retencionBingo', retSB = '$retencionSB', retPremios = '$retencionPremios', retSorteos = '$retencionSorteos', retSala = '$retencionSala', segobMaq = '$segobMaq', segobBingo = '$segobBingo', segobSB = '$segobSB', segobSala = '$segobSala', estatalMaq = '$estatalMaq', estatalBingo = '$estatalBingo', estatalSB = '$estatalSB', estatalSala = '$estatalSala', ideMaq = '$ideMaq', ideBingo = '$ideBingo', ideSB = '$ideSB', ideSala = '$ideSala', impuestoMaq = '$impMaq', impuestoBingo = '$impBingo', impuestoSB = '$impSB', ISRSala = '$ISRSala', totalImpuesto = '$impSala', depMaq = '$depMaq', depBingo = '$depBingo', depSB = '$depSB', depSala = '$depSala', partMaq = '$partMaq', partBingo = '$partBingo', partSB = '$partSB', partSala = '$partSala' WHERE sala = '$sala' AND fecha = '$theDate'";
if (!mysql_query($sqlUpdate,$con)) { die('Error: ' . mysql_error()); }
echo "<div style='width:150px; margin: 0 auto 150px; text-align: center;'><h1>Reporte Actualizado.<h1><br /><a href='".get_permalink( 496 )."'>Continuar</a></div>";
mysql_close($con);
} // End si variables definidas
else {
echo "<div style='width:150px; margin: 0 auto 150px; text-align: center;'><p>No hay informaci&oacute;n.</p><br /><a href='".get_permalink( 496 )."'>Continuar</a></div>";
} // Si no viene de Previa SB
} // // End Procesa SportsBook
if (is_page( 505 )) { // si captura manual
comments_template( '', false );
$host = "216.70.86.180";
$user = "bookAdmin2";
$password = "comE310";
$database = "reportediario";
/*
$user = "prometeo";
$password = "3:10toYuma!";
$database = "reporteAutomata";
*/
$connection = mysql_connect($host,$user,$password)
or die("Could not connect: ".mysql_error());
mysql_select_db($database,$connection)
or die("Error in selecting the database:".mysql_error());
$sala = trim($current_user->user_login);
?>
<div style="text-align:center; padding-left: 50px;">
<?php
$sql ="SELECT MAX(fecha) AS ultimoReporte FROM data WHERE sala = '$sala'";
$sql_result=mysql_query($sql,$connection)
or exit("Sql Error".mysql_error());
$sql_num=mysql_num_rows($sql_result);
while($row=mysql_fetch_array($sql_result)) {
$fechaReporte = $row['ultimoReporte'];
$fechaCaptura = date("Y-m-d",strtotime($fechaReporte."+ 1 day"));
?>
<?php
echo "<p style='margin-bottom:10px; font-weight:bold'>Fecha de captura: " .$dias[date('w', strtotime($fechaCaptura))]." ".date('d', strtotime($fechaCaptura)). " de " . $meses[date('n', strtotime($fechaCaptura))-1]. ", " .date('Y', strtotime($fechaCaptura))."</p>";
} // END While
?>
<div class="" style="background: #e5e3db;width: 400px; margin: 0 auto; margin-bottom: 100px;" >
<form name="capturaManual" method="POST" action="<?php echo get_permalink( '507' ); ?>" class="wp-core-ui hey">
<input type="hidden" name="fechaCaptura" value="<?php echo date("Y-m-d", strtotime($fechaCaptura)); ?>" />
<h1 style="-webkit-border-top-left-radius: 10px;-webkit-border-top-right-radius: 10px;-moz-border-radius-topleft: 10px;-moz-border-radius-topright: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px; background:red;width: 350px;margin: 5px auto 0; text-align: center; padding: 5px; background: #3a8aa8 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIElEQVQIW2MMXHp48/poW18GKGAE0ciCYAFkQbgATBAACYgOcUhkq4MAAAAASUVORK5CYII=) repeat; color: #f5f5f5;text-shadow: black 0.1em 0.1em 0.2em; border-bottom: 1px solid #2d6b82;">M&aacute;quinas</h1>
<div class="roundShite" style="width: 350px;margin: 0 auto 5px; text-align: center; padding: 5px; text-shadow: white 0.1em 0.1em 0.2em; border-top: 1px solid #f8f8f8;">
<table class=''>
<tr>
<th style="text-align: right; width: 50%; padding-right: 5px;">Ingreros Totales: </th>
<th><input type="text" step="any" name="ingresosTotalesMaq" id="heh" value="" onKeyPress="return checkIt(event)" /></th>
</tr>
<tr>
<td style="text-align: right;padding-right: 5px;">Pago devoluci&oacute;n: </td>
<td><input type="text" step="any" name="pagoDevolucionesMaq" id="heh1" value="" onKeyPress="return checkIt(event)" /></td>
</tr>
<tr>
<td style="text-align: right;padding-right: 5px;">Pago de Premio: </td>
<td><input type="text" step="any" name="pagoPremioMaq" id="heh2" value="" onKeyPress="return checkIt(event)" /></td>
</tr>
</table>
</div>
<h1 style="-webkit-border-top-left-radius: 10px;-webkit-border-top-right-radius: 10px;-moz-border-radius-topleft: 10px;-moz-border-radius-topright: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px; background:red;width: 350px;margin: 5px auto 0; text-align: center; padding: 5px; background: #d26a73 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIElEQVQIW2Pc6Re+2X3TSl8GKGAE0ciCYAFkQbgATBAABQcOFhzMezkAAAAASUVORK5CYII=) repeat;color: #f5f5f5;text-shadow: black 0.1em 0.1em 0.2em; border-bottom: 1px solid #c6434e;">Bingo</h1>
<div class="roundShite" style="width: 350px;margin: 0 auto; text-align: center; padding: 5px; border-top: 1px solid #a4323c;">
<table class=''>
<tr>
<th style="text-align: right; width: 50%;padding-right: 5px;">Ingreros Totales: </th>
<th><input type="text" name="ingresosTotalesBingo" id="heh3" value="" onKeyPress="return checkIt(event)" /></th>
</tr>
<tr>
<td style="text-align: right;padding-right: 5px;">Pago de Premio: </td>
<td><input type="text" name="pagoPremioBingo" id="heh4" value="" onKeyPress="return checkIt(event)" /></td>
</tr>
</table>
</div>
<h1 style="-webkit-border-top-left-radius: 10px;-webkit-border-top-right-radius: 10px;-moz-border-radius-topleft: 10px;-moz-border-radius-topright: 10px;border-top-left-radius: 10px;border-top-right-radius: 10px; background:red;width: 350px;margin: 5px auto 0; text-align: center; padding: 5px; background: #54ab8b url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIElEQVQIW2P0rc/ZvLlxii8DFDCCaGRBsACyIFwAJggAAkwN8Nf2b1AAAAAASUVORK5CYII=) repeat;text-shadow: black 0.1em 0.1em 0.2em; color: #f5f5f5;border-bottom: 1px solid #43896f;">SportBook</h1>
<div class="roundShite" style="width: 350px;margin: 0 auto 5px; text-align: center; padding: 5px;border-top: 1px solid #326753;">
<table >
<tr>
<th style="text-align: right; width: 50%;padding-right: 5px;">Ingreros Totales: </th>
<th><input type='text' name="ingresosTotalesSB" id="heh5" value="" onKeyPress="return checkIt(event)" /></th>
</tr>
<tr>
<td style="text-align: right;padding-right: 5px;">Pago de Premio: </td>
<td><input type='text' name="pagoPremioSB" id="heh6" value="" onKeyPress="return checkIt(event)" /></td>
</tr>
</table>
</div>
<input style="margin: 10px 0 30px; width: 85%; height: 30px;" type="submit" name="" value="Vista Previa" class="button button-primary"/>
</form>
</div>
<?php
} // End Captura Manual
if (is_page(507)) { // si captura Manual
comments_template( '', false );
$mysql_db_hostname = "216.70.86.180";
$mysql_db_user = "bookAdmin2";
$mysql_db_password = "comE310";
$mysql_db_database = "reportediario";
// Culi
/*
$mysql_db_user = "prometeo";
$mysql_db_password = "3:10toYuma!";
$mysql_db_database = "reporteAutomata";
*/
$con = mysql_connect($mysql_db_hostname,$mysql_db_user,$mysql_db_password);
if (!$con)
{die('Could not connect: ' . mysql_error());}
mysql_select_db($mysql_db_database, $con);
// DB Insert
$sala = trim($current_user->user_login);
$theDate = $_POST['fechaCaptura'];
$unfingTotMaq = preg_replace('/[$,]/', '', $_POST['ingresosTotalesMaq']);
$unfPagoPreMaq = preg_replace('/[$,]/', '', $_POST['pagoPremioMaq']);
$unfPagoDevMaq = preg_replace('/[$,]/', '', $_POST['pagoDevolucionesMaq']);
$unfingTotBin = preg_replace('/[$,]/', '', $_POST['ingresosTotalesBingo']);
$unfPagoPreBin = preg_replace('/[$,]/', '', $_POST['pagoPremioBingo']);
$unfingTotSB = preg_replace('/[$,]/', '', $_POST['ingresosTotalesSB']);
$unfPagoPreSB = preg_replace('/[$,]/', '', $_POST['pagoPremioSB']);
$ingresosTotal= 0;
$pagoDevolucionesTotal= 0;
$sorteos= 0;
$pagoPremioTotal= 0;
$totalPremios= 0;
$netWinIEPS= 0;
$iepsMaq= 0;
$iepsBingo= 0;
$iepsSB= 0;
$iepsSala= 0;
$retencionMaq= 0;
$retencionBingo= 0;
$retencionSB= 0;
$retencionSala= 0;
$segobMaq= 0;
$segobBingo= 0;
$segobSB= 0;
$segobSala= 0;
$estatalMaq= 0;
$estataBingo= 0;
$estatalSB= 0;
$estatalSala= 0;
$ideMaq= 0;
$ideBingo= 0;
$ideSB= 0;
$ideSala= 0;
$impMaq= 0;
$impBingo= 0;
$impSB= 0;
$impSala= 0;
$depMaq= 0;
$depBingo= 0;
$depSB= 0;
$depSala= 0;
$partMaq = 0;
$partBingo = 0;
$partSB = 0;
$partSala = 0;
/*
T E S T C A L C U L O S
*/
$fecha = $theDate;
$m = date('n', strtotime($fecha));
$yearo = date('Y', strtotime($fecha));
// Obtiene el primer dia del mes
//$inicioMes = date('Y-m-d',mktime(1,1,1,$m,1,date('Y')));
$inicioMes = date('Y-m-d',mktime(1,1,1,$m,1,$yearo));
// Variables
$tres = 0.3;
$dos = 0.2;
$uno = 0.1;
$cerotres = 0.03;
$cerodos = 0.02;
$cerouno = 0.01;
// Calcula ingresos totales [maquinas+bingo+sportbook]
$ingresosTotal = $unfingTotMaq + $unfingTotBin + $unfingTotSB;
// Calcula devoluciones, solo para maquinas
$pagoDevolucionesTotal = $unfPagoDevMaq;
// Calcula premios totales [maquinas+bingo+sportbook]
$pagoPremioTotal = $unfPagoPreMaq + $unfPagoPreBin + $unfPagoPreSB;
// S E G O B
// SEGOB Maquinas
$segobMaq = $unfingTotMaq - $unfPagoDevMaq;
if ($segobMaq > 0) {
$segobMaq2 = round($segobMaq*0.02,2);
}
else {$segobMaq2 = 0;}
// SEGOB Bingo
$segobBingo = $unfingTotBin*$cerouno;
// SEGOB SB
$segobSB = $unfingTotSB*$cerouno;
// Calcula SEGOB Sala
$segobSala = $segobMaq2 + $segobBingo + $segobSB;
// END S E G O B
// R E T E N C I O N 1%
// Retencion Maquinas
$retencionMaq = $unfPagoPreMaq*$cerouno;
// Retencion Bingo
$retencionBingo = $unfPagoPreBin*$cerouno;
// Retencion Sportbook
$retencionSB = $unfPagoPreSB*$cerouno;
// Mod 2013
// Retencion de premios
$retencionPremios = $retencionMaq + $retencionBingo + $retencionSB;
// Retencio Sala
if ( date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08')) ) { // Antes de Agosto 2013
$retencionSala = $retencionMaq + $retencionBingo + $retencionSB;
}
// END R E T E N C I O N 1%
// I M P U E S T O E S T A T A L
$ax = 102 * 150;
$axHolly = 150 * 450;
$axHolly2 = 150*325;
$axMtemrls = 150*110;
$axMty = 150*655;
$axGpe = 150*622;
$axAlle = 150*168;
$an = date('Y', strtotime($fecha));
// si ingresos totales son mayores a 0
if ($ingresosTotal >0) {
// Estatal Maquina
// L I N A R E S
// A partir de 2013 no paga Estatal
if ($sala == 'linares') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*106/date('t',strtotime($fecha));
}
else {
if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))){$estatalMaq = $ax/date('t',strtotime($fecha));}
}
} // End Linares
// H O L L Y W O O D 1
// A partir de 2013 no paga Estatal
else if ($sala == 'hollywood1') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*384/date('t',strtotime($fecha));
}
else if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {
$estatalMaq = $axHolly/date('t',strtotime($fecha));
}
} // End Hollywood 1
// H O L L Y W O O D 2
// A partir de 2013 no paga Estatal
else if ($sala == 'hollywood2') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*504/date('t',strtotime($fecha));
}
else if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {
$estatalMaq = $axHolly2/date('t',strtotime($fecha));
}
} // End Hollywood 2
// M O N T E M O R E L O S
// A partir de 2013 no paga Estatal
else if ($sala == 'montemorelos') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*183/date('t',strtotime($fecha));
}
else {
if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {$estatalMaq = $axMtemrls/date('t',strtotime($fecha));}
}
} // End Montemorelos
// M O N T E R R E Y
// A partir de 2013 no paga Estatal
else if ($sala == 'monterrey') {
if ($an==2013) {
$estatalMaq=0;
}
else if ($an<2013){
if ($ingresosTotal >0){$estatalMaq = $axMtemrls/date('t',strtotime($fecha));}
else {$estatalMaq = 0;}
}
} // End Monterrey
// G U A D A L U P E
// A partir de 2013 no paga Estatal
else if ($sala == 'guadalupe') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*704/date('t',strtotime($fecha));
}
else {
if (date('Y', strtotime($fecha)) < date('Y',strtotime('2013'))) {
$estatalMaq = $axGpe/date('t',strtotime($fecha));
}
}
} // End Guadalupe
// A L L E N D E
// A partir de 2013 no paga Estatal
else if ($sala == 'allende') {
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 184.62*176/date('t',strtotime($fecha));
}
else {$estatalMaq = 0;}
} // End Allende
// A G U A P R I E T A
else if ($sala == 'aguaprieta') {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = ($retencionBingo/.01)*.06;
$estatalSB = ($retencionSB/.01)*.06;
} // End Agua Prieta
// E N S E N A D A
else if ($sala == 'ensenada') {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = ($retencionBingo/.01)*.06;
$estatalSB = ($retencionSB/.01)*.0945;
} // End Ensenada
// G O M E Z P A L A C I O
// modificación, Gomez Palacio no paga estatal
else if ($sala == 'gomezpalacio') {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = 0;
$estatalSB = 0;
$estatalSala = 0;
} // End Gomez Palacio
// N A U C A L P A N
else if ($sala == 'naucalpan') {
// A partir de 2013 Naucalpan paga Impuesto Estatal
if ( date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08')) ) { // A partir de Agosto 2013
$estatalMaq = 26304/date('t',strtotime($fecha));
}
$estatalBingo = 0;
$estatalSB = 0;
} // End Gomez Palacio
// R E S T O D E S A L A S
else {
$estatalMaq = ($retencionMaq/.01)*.06;
$estatalBingo = ($retencionBingo/.01)*.06;
$estatalSB = ($retencionSB/.01)*.06;
}
// End Estatal Maquinas
} // END ingresos totales igual a 0
else {$estatalMaq = 0;}
// Estatal Bingo
$estatalBingo = 0;
// Estatal SB
//$estatalSB = 0;
// Estatal Sala
if ($sala !== 'gomezpalacio') { $estatalSala = $estatalMaq + $estatalBingo + $estatalSB; }
// END I M P U E S T O E S T A T A L
// I D E
// IDE Maquinas
$ideMaq = ($unfingTotMaq - $unfPagoDevMaq - $unfPagoPreMaq + $retencionMaq) * $cerotres;
// Calcula IDE Bingo
$ideBingo = ($unfingTotBin - $unfPagoPreBin + $retencionBingo + $estatalBingo)*$cerotres;
// Calcula IDE Sportbook
$ideSB = ($unfingTotSB - $unfPagoPreSB + $retencionSB + $estatalSB)*$cerotres;
// Calcula IDE Sala
$ideSala = $ideMaq + $ideBingo + $ideSB;
// END I D E
// D E P / N E T W I N B r u t o
// DEP Maquinas
$salasDEP = array('linares', 'aguaprieta', 'nogales', 'ensenada', 'hollywood1', 'hollywood2', 'cananea', 'guamuchil', 'montemorelos', 'monterrey', 'guadalupe', 'allende', 'ajijic', 'puertovallarta', 'guadalajara', 'texcoco', 'teziutlan', 'sanluis', 'gomezpalacio');
// Salas sin sumar Impuesto Estatal
if (in_array($sala, $salasDEP)) {$depMaq = $unfingTotMaq - $unfPagoDevMaq - $unfPagoPreMaq + $retencionMaq;}
// Salas sumando Impuesto Estatal
else {$depMaq = $unfingTotMaq - $unfPagoDevMaq - $unfPagoPreMaq + $retencionMaq + $estatalMaq;}
// DEP Bingo
$depBingo = $unfingTotBin - $unfPagoPreBin + $retencionBingo;
// DEP SportBook
$depSB = $unfingTotSB - $unfPagoPreSB + $retencionSB;
// Calcula NETWIN Bruto / Dep Sala
$depSala = $depMaq + $depBingo +$depSB;
// D E P / N E T W I N B r u t o
// El calculo de impuestos varia dependiendo el día del mes
// Si NO es primero de mes, se toma un acumulado de los días anteriores
// Extrae el dia(numero) de $fecha
$diaFecha = date('d', strtotime($fecha));
// Participación de Máquinas = 0
$partMaq = 0;
// Salas que no calculan ISR
$noISR = array("linares","teziutlan");
$FoliattiPart = array('monterrey', 'guadalupe', 'ajijic', 'puertovallarta', 'guadalajara');
// Si es Primero de Mes
if ($diaFecha == '01') {
// S O R T E O S
$validaSorteos = $ingresosTotal - $pagoDevolucionesTotal - $pagoPremioTotal;
// MOD Agosto 2013
if ( $validaSorteos > 0){
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$sorteos = $validaSorteos - ($segobSala*1.1+($ideSala - $retencionPremios))/0.3;
}
else {$sorteos = $validaSorteos - ($segobSala*1.1+($ideSala - $retencionSala))/0.3;}
}
if ($sorteos < 0) {$sorteos = 0;}
// END S O R T E O S
// MOD Agosto 2013
// Retencion 1%
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$retencionSorteos = $sorteos * 0.01;
$retencionSala = $retencionSorteos + $retencionPremios;
}
else {
$retencionSorteos = 0;
}
// I E P S
// IEPS Maquinas
$iepsMaq = ($unfingTotMaq - $pagoDevolucionesTotal - $unfPagoPreMaq - $sorteos) * $tres;
// IEPS Bingo
$iepsBingo = ($unfingTotBin - $unfPagoPreBin) * $tres;
// IEPS Sportbook
$iepsSB = ($unfingTotSB - $unfPagoPreSB) * $tres;
if ($iepsSB < 0) { $iepsSB = 0; }
// IEPS Sala
$iepsSala = $iepsMaq + $iepsBingo + $iepsSB;
// END I E P S
// I M P U E S T O T O T A L
// Impuesto Maquinas
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$impMaq = $iepsMaq + $retencionSala + $estatalMaq;
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {$impMaq = $iepsMaq + $retencionMaq + $estatalMaq;}
// Impuesto Bingo
$impBingo = $iepsBingo + $retencionBingo + $estatalBingo;
// Impuesto SportBook
$impSB = $iepsSB + $retencionSB + $estatalSB;
/*
C a l c u l o I S R 2 0 1 3
Calcula ISR a partir de 2013
IEPS sala + ret sala + estatal sala + ISR sala
*/
// Calcula ISR
if ( !in_array($session->username, $noISR)) { // si calcula ISR
if (($ingresosTotal-$pagoDevolucionesTotal-$pagoPremioTotal) > 0) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$ISRSala = ((($ingresosTotal-$pagoDevolucionesTotal-$pagoPremioTotal-$iepsSala+$segobSala)*0.0282)*.30);
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {
$ISRSala = ((($ingresosTotal-$pagoDevolucionesTotal)*0.0081)*.30);
}
}
else {$ISRSala = 0;}
}
// si no calcula ISR
else {$ISRSala = 0;}
// Calcula impuesto Sala
$impSala = $iepsSala + $retencionSala + $estatalSala + $ISRSala;
// END I M P U E S T O T O T A L
// P A R T I C I P A C I O N
// Participación Máquinas
// L I N A R E S
if ($sala == 'linares') {
$partMaq = 0;
$partSB = 0;
$partBingo = 0;
// Comienza a pagar participación a partir del 1 de Febrero de 2013
/*
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){$partMaq = ($depMaq-$impMaq)*0.11;}
else {$partMaq = 0;}
} // fin if fecha aplica para participacion
else {
$partMaq = 0;
}
*/
} // End Linares
// C A N A N E A
else if ($sala == 'cananea') {
if ($depSala > 0) {
$partMaq = 100000/date('t',strtotime($fecha));
}
else {$partMaq = 0;}
$partBingo = 0;
$partSB = 0;
} // End Cananea
// H O L L Y W O O D
else if ($sala == 'hollywood1' || $sala == 'hollywood2') {
$partMaq = ($depMaq - $impMaq)*0.12;
} // End Hollywood
// S A L A S F O L I A T T I
else if (in_array($sala, $FoliattiPart)) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = ($depMaq - $impMaq)*0.11;
}
elseif (date('Y-m-d', strtotime($fecha)) < date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = ($depMaq - $impMaq)*0;
}
}
else {$partMaq = ($depMaq - $impMaq)*0.11;}
// End Participacion Maquinas
// participacion sportbook
if ($sala == 'texcoco' || $sala == 'ensenada') {if ($unfPagoPreMaq > 0) {$partSB = ($depSB - $impSB)*0.11;}}
else if ($sala == 'teziutlan') {
if ($unfPagoPreMaq > 0) {
$partBingo = ($depBingo -$impBingo)*0.11;
$partSB = ($depSB - $impSB)*0.09;
if($partSB<0){$partSB=0;}
}
}
else if ($sala == 'naucalpan') {
if ($unfPagoPreMaq > 0) {
$partBingo = ($depBingo -$impBingo)*0.11;
$partSB = ($depSB - $impSB)*0.11;
}
}
else {$partSB = 0;}
if ($partMaq < 0) {$partMaq = 0;}
if ($partSB < 0) {$partSB = 0;}
// participacion Sala
$partSala = $partMaq + $partBingo + $partSB;
// END P A R T I C I P A C I O N
} // END Si es primero de mes
else if ($diaFecha != '01') {
$dayBefore = date("Y-m-d",strtotime($fecha." last day "));
$sql = "SELECT SUM(ingresosTotalesMaq), SUM(pagoDevolucionesMaq), SUM(pagoPremioMaq), SUM(ingresosTotales), SUM(pagoDevoluciones), SUM(pagoPremio), SUM(segobSala), SUM(ideSala), SUM(retPremios), SUM(retSala), SUM(sorteos), SUM(ingresosTotalesBingo), SUM(pagoPremioBingo), SUM(iepsMaq), SUM(iepsBingo), SUM(iepsSB), SUM(ingresosTotalesSB),SUM(pagoPremioSB), SUM(depMaq), SUM(depBingo), SUM(depSB), SUM(impuestoMaq), SUM(impuestoBingo), SUM(impuestoSB), SUM(ISRSala), SUM(partMaq), SUM(partBingo), SUM(partSB) FROM data WHERE fecha BETWEEN '$inicioMes' AND '$dayBefore' AND '$sala' = sala GROUP BY sala";
$sql_result=mysql_query($sql,$con) or exit("Sql Error".mysql_error());
$sql_num=mysql_num_rows($sql_result);
while($row=mysql_fetch_array($sql_result)) {
// Calculca Sorteos --------------------------------------------
//--------------------------------------------------------------
$ingresosTotales = $ingresosTotal + $row['SUM(ingresosTotales)'];
$pagoDevTotales = $pagoDevolucionesTotal + $row['SUM(pagoDevoluciones)'];
$pagoPremioTotales = $pagoPremioTotal + $row['SUM(pagoPremio)'];
$segobTotal = $segobSala + $row['SUM(segobSala)'];
$ideTotal =$ideSala + $row['SUM(ideSala)'];
// MOD Agosto 2013
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$retTotal = $retencionPremios + $row['SUM(retPremios)'];
}
else {$retTotal =$retencionSala + $row['SUM(retSala)'];}
$sorteosTotal =$row['SUM(sorteos)'];
$valSorteosTest = $ingresosTotales - $pagoDevTotales - $pagoPremioTotales;
if ( $valSorteosTest > 0){
$sorteos = ($valSorteosTest - (($segobTotal*1.1)+($ideTotal - $retTotal))/0.3) - $sorteosTotal;
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$retencionSorteos = $sorteos * 0.01;
$retencionSala = $retencionSorteos + $retencionPremios;
}
}
if ($sorteos < 0) {$sorteos = 0;}
//-------------------------------------------------------------
// Calcula IEPS -------------------------------------------------
// Calcula IEPS Maqinas -----------------------------------------
$ingrTotMaq= $unfingTotMaq + $row['SUM(ingresosTotalesMaq)'];
$pgDvMaq= $unfPagoDevMaq + $row['SUM(pagoDevolucionesMaq)'];
$pgPrMaq= $unfPagoPreMaq + $row['SUM(pagoPremioMaq)'];
$srts = $sorteos + $row['SUM(sorteos)'];
$iepsMaqtest = $row['SUM(iepsMaq)'];
$iepsMaq = (($ingrTotMaq - $pgDvMaq - $pgPrMaq - $srts)*0.3)- $iepsMaqtest;
if ($iepsMaq < 0) {$iepsMaq = 0;}
//-------------------------------------------------------------
// Calcula IEPS Bingo -------------------------------------------
$ingrTotBingo= $unfingTotBin + $row['SUM(ingresosTotalesBingo)'];
$pgPrBingo= $unfPagoPreBin + $row['SUM(pagoPremioBingo)'];
$iepsBing = $row['SUM(iepsBingo)'];
$iepsBingo = (($ingrTotBingo - $pgPrBingo)*0.3)- $iepsBing;
if ($iepsBingo < 0) {$iepsBingo = 0;}
//-------------------------------------------------------------
// Calcula IEPS SpoortBook -------------------------------
$ingrTotSB= $unfingTotSB + $row['SUM(ingresosTotalesSB)'];
$pgPrSB= $unfPagoPreSB + $row['SUM(pagoPremioSB)'];
$iepsSpBo = $row['SUM(iepsSB)'];
$iepsSB = (($ingrTotSB - $pgPrSB)*0.3)- $iepsSpBo;
if ($iepsSB < 0) {$iepsSB = 0;}
//----------------------------------------------------
$iepsSala = $iepsMaq + $iepsBingo + $iepsSB;
// Fin IEPS ---------------------------------------------------
// Calcula Impuesto Maquinas
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$impMaq = $iepsMaq + $retencionSala + $estatalMaq;
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {$impMaq = $iepsMaq + $retencionMaq + $estatalMaq;}
// Calcula impuesto Bingo
$impBingo = $iepsBingo + $retencionBingo + $estatalBingo;
// Calcula impuesto SportBook
$impSB = $iepsSB + $retencionSB + $estatalSB;
/*
C a l c u l o I S R 2 0 1 3
Calcula ISR a partir de 2013
IEPS sala + ret sala + estatal sala + ISR sala
*/
// Calcula ISR
if ( !in_array($session->username, $noISR)) { // si calcula ISR
if (($ingresosTotales-$pagoDevTotales-$pagoPremioTotales) > 0) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m',strtotime('2013-08'))) { // A partir de Agosto 2013
$ISRSala = ((($ingresosTotales-$pagoDevTotales-$pagoPremioTotales-($iepsSala+$iepsMaqtest)+$segobTotal)*0.0282)*.30)-$row['SUM(ISRSala)'];
}
elseif (date('Y-m', strtotime($fecha)) < date('Y-m',strtotime('2013-08'))) {
$isrSala = $row['SUM(ISRSala)'];
echo "ingresos: ".$ingresosTotales."<br />pago dev".$pagoDevTotales." <br />ISR: ".$isrSala;
$ISRSala = ((( $ingresosTotales - $pagoDevTotales )*0.0081)*.30) -$row['SUM(ISRSala)'];
}
} // END $ingresosTotales-$pagoDevTotales-$pagoPremioTotales) > 0
else {$ISRSala = 0;}
} // END si calcula ISR
else {$ISRSala = 0;} // si no calcula ISR
//$ISRSala = ((( ($ingresosTotal + $row['SUM(ingresosTotales)']) - ($pagoDevolucionesTotal + $row['SUM(pagoDevoluciones)']) )*0.0081)*.30) - $row['SUM(ISRSala)'];
// Calcula impuesto Sala
//$impSala = $impMaq + $impBingo + $impSB;
$impSala = $iepsSala + $retencionSala + $estatalSala + $ISRSala;
// Calcula Participacion
// Maquinas
// L I N A R E S
if ($sala == 'linares') {
$partMaq = 0;
$partBingo = 0;
$partSB = 0;
$partSala = 0;
// linares comienza a pagar participación el 1 de Febrero de 2013
/*
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
$partMaq = ($depMaqTot - $impMaqTot)*0.11 - $partMaqHist;
}
} // fin if fecha aplica para participacion
else {
}
*/
} // End Linares
// A G U A P R I E T A
else if($sala == 'aguaprieta') {
$partMaq = 0;
$partBingo = 0;
$partSB = 0;
$partSala = 0;
// Agua Prieta comienza a pagar participación el 1 de Febrero de 2013
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
$partMaq = ($depMaqTot - $impMaqTot)*0.11 - $partMaqHist;
}
} // fin if fecha aplica para participacion
else {
if ($unfingTotMaq > 0) {
$partMaq = ($depMaq-$impMaq)*0.11;
}
}
} // End Agua Prieta
// C A N A N E A
else if ($sala == 'cananea') {
if ($depSala > 0) {
$partMaq = 100000/$diaMes;
}
else {$partMaq = 0;}
$partBingo = 0;
$partSB = 0;
} // End Cananea
// G U A M U C H I L
else if ($sala == 'guamuchil') {
$fechaPart = strtotime('2013-01-31');
if (strtotime($fecha) > $fechapart) {
if ($unfingTotMaq >0){
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
$partMaq = ($depMaqTot - $impMaqTot)*0.11 - $partMaqHist;
}
} // fin if fecha aplica para participacion
else {
if ($unfingTotMaq > 0) {
$partMaq = ($depMaq-$impMaq)*0.11;
}
}
$partBingo = 0;
$partSB = 0;
}
else {
if ($unfingTotMaq > 0) {
// Participacion Maquinas
$depMaqTot = $depMaq + $row['SUM(depMaq)'];
$impMaqTot = $impMaq + $row['SUM(impuestoMaq)'];
$partMaqHist = $row['SUM(partMaq)'];
// Participacion Bingo
$depBingoTot = $depBingo + $row['SUM(depBingo)'];
$impBingoTot = $impBingo + $row['SUM(impuestoBingo)'];
$partBingoHist = $row['SUM(partBingo)'];
if ($sala == 'teziutlan' || $sala == 'naucalpan') {
$partBingo = ($depBingoTot -$impBingoTot)*.11 -$partBingoHist;
if($partBingo<0){$partBingo=0;}
}
// Participacion SportBook
$depSBTot = $depSB + $row['SUM(depSB)'];
$impSBTot = $impSB + $row['SUM(impuestoSB)'];
$partSBHist = $row['SUM(partSB)'];
if ($sala == 'hollywood1' || $sala == 'hollywood2') {
$partMaq = ($depMaqTot - $impMaqTot)*0.12- $partMaqHist;
}
else if ( in_array($sala, $FoliattiPart)) {
if (date('Y-m', strtotime($fecha)) >= date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = ($depMaqTot - $impMaqTot)*0.11- $partMaqHist;
}
elseif (date('Y-m-d', strtotime($fecha)) < date('Y-m-d',strtotime('2013-01-01'))) {
$partMaq = 0;
}
}
else {$partMaq = ($depMaqTot - $impMaqTot)*0.11- $partMaqHist;}
if ($sala == 'texcoco' || $sala == 'naucalpan' || $sala == 'ensenada') {
$partSB = ($depSBTot - $impSBTot)*0.11 - $partSBHist;
}
else if ($sala == 'teziutlan') {$partSB = ($depSBTot - $impSBTot)*0.09 - $partSBHist; if($partSB<0){$partSB=0;}}
else {$partSB = 0;}
} // end if ingTotMaq mayor a 0
if ($partMaq < 0) {$partMaq = 0;}
} // end else
$partSala = $partMaq + $partBingo + $partSB;
if ($partMaq < 0) {$partMaq = 0;}
$partSala = $partMaq + $partBingo + $partSB;
} // end while
} // end if No es primero de Mes
// Calcula total premios [pago de devoluciones+sorteos+pago de premios]
$totalPremios = $pagoDevolucionesTotal + $sorteos + $pagoPremioTotal;
// Calcula NET WIN IEPS
$netWinIEPS = $ingresosTotal - $totalPremios;
/*
F I N
T E S T C A L C U L O S
$sql="REPLACE INTO data (sala, fecha, ingresosTotalesMaq, pagoDevolucionesMaq, pagoPremioMaq, ingresosTotalesBingo, pagoPremioBingo, ingresosTotalesSB, pagoPremioSB, ingresosTotales, pagoDevoluciones, sorteos, pagoPremio, totalPremios, netWinIEPS, iepsMaq, iepsBingo, iepsSB, iepsSala, retMaq, retBingo, retSB, retPremios, retSorteos, retSala, segobMaq, segobBingo, segobSB, segobSala, estatalMaq, estatalBingo, estatalSB, estatalSala, ideMaq, ideBingo, ideSB, ideSala, impuestoMaq, impuestoBingo, impuestoSB, ISRSala, totalImpuesto, depMaq, depBingo, depSB, depSala, partMaq, partBingo, partSB, partSala, JugadoresActivos) VALUES('$sala','$theDate','$unfingTotMaq','$unfPagoDevMaq','$unfPagoPreMaq','0','0',NULL,'0','$ingresosTotal','$pagoDevolucionesTotal','$sorteos','$pagoPremioTotal','$totalPremios','$netWinIEPS','$iepsMaq','$iepsBingo','$iepsSB','$iepsSala','$retencionMaq','$retencionBingo','$retencionSB','$retencionPremios','$retencionSorteos','$retencionSala','$segobMaq2','$segobBingo','$segobSB','$segobSala','$estatalMaq','$estatalBingo','$estatalSB','$estatalSala','$ideMaq','$ideBingo','$ideSB','$ideSala','$impMaq','$impBingo','$impSB','$ISRSala','$impSala','$depMaq','$depBingo','$depSB','$depSala','$partMaq','$partBingo','$partSB','$partSala','$jActivos')";
if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }
*/
?>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Ingresos Totales</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Devoluciones Totales</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Premios Totales</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Premios de Sala</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Pago de Premios</th>
<th style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">NETWIN IEPS</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ingresosTotal,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($pagoDevolucionesTotal,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($sorteos,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($pagoPremioTotal,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($totalPremios,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($netWinIEPS,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">IEPS</th>
<th colspan="6" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Retencion</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Premios</th>
<th style="background: #f5aec5;">Sorteos</th>
<th style="background: #eaaaef;">Sala</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<tbody>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($iepsMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($iepsBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($iepsSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($iepsSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionSB,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionPremios,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($retencionSorteos,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($retencionSala,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">SEGOB</th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Estatal</th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">IDE</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<body>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($segobMaq2,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($segobBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($segobSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($segobSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($estatalMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($estataBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($estatalSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($estatalSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ideMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ideBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ideSB,2)); ?></td>
<td><?php echo money_format('%+#10.2n', round($ideSala,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<table class="wp-table-reloaded wp-table-reloaded-id-3" style="width: 80%; margin: 15px auto;">
<thead>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th colspan="5" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">Impuestos</th>
<th colspan="4" style="background: #dfecee; border-bottom: 1px solid #b5dcf1;">DEP</th>
<th colspan="4" style="background: #9eedb9; border-bottom: 1px solid #48dd7b;">Particiapaci&oacute;n</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
<tr>
<th style="background: #e5e3db; border: 0;"></th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">ISR</th>
<th style="background: #f5aec5;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #fef4b4;">Maquinas</th>
<th style="background: #fee5b4;">Bingo</th>
<th style="background: #fed6b4;">SB</th>
<th style="background: #febdb4;">Sala</th>
<th style="background: #e5e3db; border: 0;"></th>
</tr>
</thead>
<body>
<tr>
<td style="background: #e5e3db; border: 0;"></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($impMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($impBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($impSB,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($ISRSala,2)); ?></td>
<td style="background: #fff;"><?php echo money_format('%+#10.2n', round($impSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($depMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($depBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($depSB,2)); ?></td>
<td style="background: #fff;"><?php echo money_format('%+#10.2n', round($depSala,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($partMaq,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($partBingo,2)); ?></td>
<td style="background: #f5f5f5;"><?php echo money_format('%+#10.2n', round($partSB,2)); ?></td>
<td style="background: #fff;"><?php echo money_format('%+#10.2n', round($partSala,2)); ?></td>
<td style="background: #e5e3db; border: 0;"></td>
</tr>
</tbody>
</table>
<form method="post" action="<?php echo get_permalink( 509 );?>" style="width: 400px; margin: 0 auto 30px; text-align: center;" class="wp-core-ui" >
<input type="hidden" name="fecha" value="<?php echo date("Y-m-d", strtotime($fecha)); ?>" />
<input type="hidden" name="unfingTotMaq" value="<?php echo $unfingTotMaq; ?>" /><input type="hidden" name="unfPagoPreMaq" value="<?php echo $unfPagoPreMaq; ?>" /><input type="hidden" name="unfPagoDevMaq" value="<?php echo $unfPagoDevMaq; ?>" /><input type="hidden" name="unfingTotBin" value="<?php echo $unfingTotBin; ?>" /><input type="hidden" name="unfPagoPreBin" value="<?php echo $unfPagoPreBin; ?>" /><input type="hidden" name="unfingTotSB" value="<?php echo $unfingTotSB; ?>" /><input type="hidden" name="unfPagoPreSB" value="<?php echo $unfPagoPreSB; ?>" /><input type="hidden" name="ingresosTotal" value="<?php echo $ingresosTotal; ?>" /><input type="hidden" name="pagoDevolucionesTotal" value="<?php echo $pagoDevolucionesTotal; ?>" /><input type="hidden" name="sorteos" value="<?php echo $sorteos; ?>" /><input type="hidden" name="pagoPremioTotal" value="<?php echo $pagoPremioTotal; ?>" /><input type="hidden" name="totalPremios" value="<?php echo $totalPremios; ?>" /><input type="hidden" name="netWinIEPS" value="<?php echo $netWinIEPS; ?>" /><input type="hidden" name="iepsMaq" value="<?php echo $iepsMaq; ?>" /><input type="hidden" name="iepsBingo" value="<?php echo $iepsBingo; ?>" /><input type="hidden" name="iepsSB" value="<?php echo $iepsSB; ?>" /><input type="hidden" name="iepsSala" value="<?php echo $iepsSala; ?>" /><input type="hidden" name="retencionMaq" value="<?php echo $retencionMaq; ?>" /><input type="hidden" name="retencionBingo" value="<?php echo $retencionBingo; ?>" /><input type="hidden" name="retencionSB" value="<?php echo $retencionSB; ?>" /> <!--MOD Agosto 2013--><input type="hidden" name="retencionPremios" value="<?php echo $retencionPremios; ?>" /><input type="hidden" name="retencionSorteos" value="<?php echo $retencionSorteos; ?>" /><!--END MOD Agosto 2013--><input type="hidden" name="retencionSala" value="<?php echo $retencionSala; ?>" /><input type="hidden" name="segobMaq" value="<?php echo $segobMaq2; ?>" /><input type="hidden" name="segobBingo" value="<?php echo $segobBingo; ?>" /><input type="hidden" name="segobSB" value="<?php echo $segobSB; ?>" /><input type="hidden" name="segobSala" value="<?php echo $segobSala; ?>" /><input type="hidden" name="estatalMaq" value="<?php echo $estatalMaq; ?>" /><input type="hidden" name="estataBingo" value="<?php echo $estataBingo; ?>" /><input type="hidden" name="estatalSB" value="<?php echo $estatalSB; ?>" /><input type="hidden" name="estatalSala" value="<?php echo $estatalSala; ?>" /><input type="hidden" name="ideMaq" value="<?php echo $ideMaq; ?>" /><input type="hidden" name="ideBingo" value="<?php echo $ideBingo; ?>" /><input type="hidden" name="ideSB" value="<?php echo $ideSB; ?>" /><input type="hidden" name="ideSala" value="<?php echo $ideSala; ?>" /><input type="hidden" name="impMaq" value="<?php echo $impMaq; ?>" /><input type="hidden" name="impBingo" value="<?php echo $impBingo; ?>" /><input type="hidden" name="impSB" value="<?php echo $impSB; ?>" /><input type="hidden" name="ISRSala" value="<?php echo $ISRSala; ?>" /><input type="hidden" name="impSala" value="<?php echo $impSala; ?>" /><input type="hidden" name="depMaq" value="<?php echo $depMaq; ?>" /><input type="hidden" name="depBingo" value="<?php echo $depBingo; ?>" /><input type="hidden" name="depSB" value="<?php echo $depSB; ?>" /><input type="hidden" name="depSala" value="<?php echo $depSala; ?>" /><input type="hidden" name="partMaq" value="<?php echo $partMaq; ?>" /><input type="hidden" name="partBingo" value="<?php echo $partBingo; ?>" /><input type="hidden" name="partSB" value="<?php echo $partSB; ?>" /><input type="hidden" name="partSala" value="<?php echo $partSala; ?>" />
<input type="button" name="" value="Regresar" ONCLICK="window.location.href='<?php echo get_permalink( 505 ) ?>'" class="button button-secondary" style="height: 25px;width: 45%; margin-right:10px;" />
<input type="submit" name="" value="Guardar Cambios" style="height: 25px;width: 45%; margin-left: 10px;" class="button button-primary" />
</form>
<?php
/*
echo "Jugadores Activos: ".$jActivos."<br />";
*/
mysql_close($con); // DB
} // End Previa Manual
if (is_page(509)) { // Si procesa Manual
$sala = trim($current_user->user_login);
if (isset($_POST["fecha"])) { // si variables estan definidas (si viene de Previa SB)
$theDate = $_POST["fecha"];
$unfingTotMaq = $_POST['unfingTotMaq'];
$unfPagoPreMaq = $_POST['unfPagoPreMaq'];
$unfPagoDevMaq = $_POST['unfPagoDevMaq'];
$unfingTotBin = $_POST['unfingTotBin'];
$unfPagoPreBin = $_POST['unfPagoPreBin'];
$unfingTotSB = $_POST['unfingTotSB'];
$unfPagoPreSB = $_POST['unfPagoPreSB'];
$ingresosTotal= $_POST['ingresosTotal'];
$pagoDevolucionesTotal= $_POST['pagoDevolucionesTotal'];
$sorteos= $_POST['sorteos'];
$pagoPremioTotal= $_POST['pagoPremioTotal'];
$totalPremios= $_POST['totalPremios'];
$netWinIEPS= $_POST['netWinIEPS'];
$iepsMaq= $_POST['iepsMaq'];
$iepsBingo= $_POST['iepsBingo'];
$iepsSB= $_POST['iepsSB'];
$iepsSala= $_POST['iepsSala'];
$retencionMaq= $_POST['retencionMaq'];
$retencionBingo= $_POST['retencionBingo'];
$retencionSB= $_POST['retencionSB'];
/*
MOD Agosto 2013
*/
$retencionPremios= $_POST['retencionPremios'];
$retencionSorteos= $_POST['retencionSorteos'];
/*
FIN MOD Agosto 2013
*/
$retencionSala= $_POST['retencionSala'];
$segobMaq= $_POST['segobMaq'];
$segobBingo= $_POST['segobBingo'];
$segobSB= $_POST['segobSB'];
$segobSala= $_POST['segobSala'];
$estatalMaq= $_POST['estatalMaq'];
$estataBingo= $_POST['estataBingo'];
$estatalSB= $_POST['estatalSB'];
$estatalSala= $_POST['estatalSala'];
$ideMaq= $_POST['ideMaq'];
$ideBingo= $_POST['ideBingo'];
$ideSB= $_POST['ideSB'];
$ideSala= $_POST['ideSala'];
$impMaq= $_POST['impMaq'];
$impBingo= $_POST['impBingo'];
$impSB= $_POST['impSB'];
$ISRSala = $_POST['ISRSala'];
$impSala= $_POST['impSala'];
$depMaq= $_POST['depMaq'];
$depBingo= $_POST['depBingo'];
$depSB= $_POST['depSB'];
$depSala= $_POST['depSala'];
$partMaq = $_POST['partMaq'];
$partBingo = $_POST['partBingo'];
$partSB = $_POST['partSB'];
$partSala = $_POST['partSala'];
// Conecta a DB
$con = mysql_connect("216.70.86.180","bookAdmin2","comE310");
//$con = mysql_connect("216.70.86.180","prometeo","3:10toYuma!");
if (!$con) {die('Could not connect: ' . mysql_error());}
mysql_select_db("reportediario", $con);
//mysql_select_db("reporteAutomata", $con);
$sql="INSERT INTO data (sala, fecha, ingresosTotalesMaq, pagoDevolucionesMaq, pagoPremioMaq, ingresosTotalesBingo, pagoPremioBingo, ingresosTotalesSB, pagoPremioSB, ingresosTotales, pagoDevoluciones, sorteos, pagoPremio, totalPremios, netWinIEPS, iepsMaq, iepsBingo, iepsSB, iepsSala, retMaq, retBingo, retSB, retPremios, retSorteos, retSala, segobMaq, segobBingo, segobSB, segobSala, estatalMaq, estatalBingo, estatalSB, estatalSala, ideMaq, ideBingo, ideSB, ideSala, impuestoMaq, impuestoBingo, impuestoSB, ISRSala, totalImpuesto, depMaq, depBingo, depSB, depSala, partMaq, partBingo, partSB, partSala, JugadoresActivos) VALUES('$sala','$theDate','$unfingTotMaq','$unfPagoDevMaq','$unfPagoPreMaq','$unfingTotBin','$unfPagoPreBin','$unfingTotSB','$unfPagoPreSB','$ingresosTotal','$pagoDevolucionesTotal','$sorteos','$pagoPremioTotal','$totalPremios','$netWinIEPS','$iepsMaq','$iepsBingo','$iepsSB','$iepsSala','$retencionMaq','$retencionBingo','$retencionSB','$retencionPremios','$retencionSorteos','$retencionSala','$segobMaq2','$segobBingo','$segobSB','$segobSala','$estatalMaq','$estatalBingo','$estatalSB','$estatalSala','$ideMaq','$ideBingo','$ideSB','$ideSala','$impMaq','$impBingo','$impSB','$ISRSala','$impSala','$depMaq','$depBingo','$depSB','$depSala','$partMaq','$partBingo','$partSB','$partSala','0')";
echo $sql;
if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }
echo "<div style='width:150px; margin: 0 auto 150px; text-align: center;'><h1>Reporte Guardado.<h1><br /><a href='".get_permalink( 505 )."'>Continuar</a></div>";
mysql_close($con);
} // End si variables definidas
else {
echo "<div style='width:150px; margin: 0 auto 150px; text-align: center;'><p>No hay informaci&oacute;n.</p><br /><a href='".get_permalink( 505 )."'>Continuar</a></div>";
} // Si no viene de Previa SB
} // End Procesa Manual
// si es Estados Financieros
if (is_page(192)) {
echo "<nav id='site-navigation' class='main-navigation' role='navigation' style='margin: 150px 0'>";
wp_nav_menu( array('menu' => 'Estados Financieros', 'menu_class' => 'nav-menu' ));
echo "</nav";
}
// si es Dictamen Fiscal
if (is_page(194)) {
echo "<nav id='site-navigation' class='main-navigation' role='navigation' style='margin: 150px 0'>";
wp_nav_menu( array('menu' => 'Dictámenes Fiscales', 'menu_class' => 'nav-menu' ));
echo "</nav";
}
// SEGOB
if (is_page(187)) {
echo "<nav id='site-navigation' class='main-navigation' role='navigation' style='margin: 150px 0'>";
wp_nav_menu( array('menu' => 'SEGOB', 'menu_class' => 'nav-menu' ));
echo "</nav";
}
// Actas y Asambleas
if (is_page(137)) {
echo "<nav id='site-navigation' class='main-navigation' role='navigation' style='margin: 150px 0'>";
wp_nav_menu( array('menu' => 'Actas y Asambleas', 'menu_class' => 'nav-menu' ));
echo "</nav";
}
// Contratos PSA
if (is_page(185)) {
echo "<nav id='site-navigation' class='main-navigation' role='navigation' style='margin: 150px 0'>";
wp_nav_menu( array('menu' => 'Contratos', 'menu_class' => 'nav-menu' ));
echo "</nav";
}
//is_page( array( 42, 54, 6 ) )
?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
<!--
<div style="padding-top: 20px;">
<h1 class="site-title" style="text-align:center; line-height:0.9em; letter-spacing:0.3em"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">INICIO</a></h1>
</div> FIN INICIO -->
</div><!-- #primary -->
<?php
// Accionistas
if (is_page(124)) :
get_sidebar( 'accionista' );
/*
elseif ( is_404() ) :
get_sidebar( '404' );
*/
else :
get_sidebar();
endif;
?>
<?php
if (is_page(505) || is_page(461)) { get_footer('inLine'); }// Captura SB
else {
get_footer();
}
?>
@alexserver
Copy link

linea de codigo: https://gist.github.com/jonexe/9652540#file-page-php-L3354
algun comentario al respecto

@jonexe
Copy link
Author

jonexe commented Mar 19, 2014

empieza el show creo que en la linea 82
https://gist.github.com/jonexe/9652540#file-page-php-L82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment