<?php
//anexo de Domingo 
require("../conectar.php");
$lunes=$_POST['L'];
$martes=$_POST['MA'];
$miercoles=$_POST['MI'];
$jueves=$_POST['J'];
$viernes=$_POST['V'];
$sabado=$_POST['S'];
$domingo=$_POST['D'];
$hora1=$_POST['hora1'];
$hora2=$_POST['hora2'];
$idconcepto=$_POST['idconceptodias'];
$fechasalida=$_POST['fechasalida'];
$comprueba="SELECT c.id_concepto, c.dia_inicio, c.dia_salida, d.no_depto, CONCAT( d.clave,  ' ', com.nombre ) AS depa, c.id_departamento, c.status_renta, c.no_anios, c.no_meses, no_sem, no_dias, c.Lunes, c.Martes, c.Miercoles, c.Jueves, c.Viernes, c.Sabado, c.Domingo, c.HoraLimpieza1, c.HoraLimpieza2 FROM conceptos AS cINNER JOIN departamentos AS d ON d.id_departamento = c.id_departamento
INNER JOIN complejo AS com ON com.id_complejo = c.id_complejo
WHERE (
c.status_renta <>  ' '
AND c.status_renta <>  'LIBRE'
)
AND c.id_complejo NOT IN('14','0','21','23')
AND (
(
'$fechasalida'
BETWEEN c.dia_inicio
AND c.dia_salida
)
OR $fechasalida =  'c.dia_inicio'
OR $fechasalida =  'c.dia_salida'
)
AND c.salida_prematura = c.dia_salida
GROUP BY d.id_departamento
ORDER BY no_depto ASC ";
$ejecuta=mysql_query($comprueba);
$reg=mysql_fetch_array($ejecuta);
$sql="UPDATE conceptos 
		  SET Lunes='$lunes',
		  Martes='$martes',
		  Miercoles='$miercoles',
		  Jueves='$jueves',
		  Viernes='$viernes',
		  Sabado='$sabado',
		  Domingo='$domingo', 
		  HoraLimpieza1='$hora1',
		  HoraLimpieza2='$hora2' 
	  WHERE id_concepto='$idconcepto'
	  ";
	  mysql_query($sql);
?>
<script language="JavaScript" type="text/javascript"> 
alert("registro correcto");
window.opener.location.reload();
window.close();
</script>