<?php

$datos = array();
#lunes
$l = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Monday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$lunes = mysql_result($l,0,"total");

#martes
$m = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Tuesday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$martes = mysql_result($m,0,"total");

#miercoles
$mi = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Wednesday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$miercoles = mysql_result($mi,0,"total");

#jueves
$j = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Thursday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$jueves = mysql_result($j,0,"total");


#viernes
$v = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Friday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$viernes = mysql_result($v,0,"total");

#sabado
$s = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Saturday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$sabado = mysql_result($s,0,"total");

#domingo
$d = mysql_query("select sum(total) as total from ventas where DAYNAME(fecha)='Sunday' and YEARWEEK(fecha) = YEARWEEK(NOW())") or die(mysql_error());
$domingo = mysql_result($d,0,"total");







$datos["lunes"] = $lunes;
$datos["martes"] = $martes;
$datos["miercoles"] = $miercoles;
$datos["jueves"] = $jueves;
$datos["viernes"] = $viernes;
$datos["sabado"] = $sabado;
$datos["domingo"] = $domingo;
$datos["abono"] = $abono;
$datos["redito"] = $redito;
$datos["mora"] = $mora;
//echo json_encode($datos);

?>