# The two can be equal in leap years when february has 29 days, the equal sign is added here //In the first case the whole interval is within a week, in the second case the interval falls in two weeks. if ($the_first_day_of_week <= $the_last_day_of_week) { if ($the_first_day_of_week <= 6 && 6 <= $the_last_day_of_week) $no_remaining_days--; if ($the_first_day_of_week <= 7 && 7 <= $the_last_day_of_week) $no_remaining_days--; } else { if ($the_first_day_of_week <= 6) { //In the case when the interval falls in two weeks, there will be a Sunday for sure $no_remaining_days--; } } //The no. of business days is: (number of weeks between the two dates) * (5 working days) + the remainder //---->february in none leap years gave a remainder of 0 but still calculated weekends between first and last day, this is one way to fix it $workingDays = $no_full_weeks * 5; if ($no_remaining_days > 0 ) { $workingDays += $no_remaining_days; } return @ceil($workingDays); } //The function returns the no. of total days between two dates function getDays($startDate, $endDate) { //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24 $days = abs(strtotime($endDate) - strtotime($startDate)) / 86400; return @ceil($days); } function sql($s) { @mysql_connect('74.208.229.38','reader','p10OSBKmO'); if ($s == "www.rumbacaracas.com") { @mysql_select_db('caracas'); } /* else if ($s == "www.rumbavenezuela.com") { @mysql_connect('localhost','rv2rumb_rumbaven','j54jHSU3jh9WKSC') or die('Unable to connect to Rumba Venezuela Database Server'); @mysql_select_db('rv2rumb_rumbavenezuela') or die('Unable to connect to Rumba Bogota Database'); } */ if ($s == "www.rumbabogota.com") { @mysql_select_db('bogota'); } if ($s == "www.rumbapanama.com") { mysql_select_db('panama'); } if ($s == "www.rumbavenezuela.com") { mysql_select_db('venezuela'); } } $username_sql = ""; $city_sql = ""; $a = $_REQUEST[a]; $d = $_REQUEST[d]; $m = $_REQUEST[m]; $a2 = $_REQUEST[a2]; $d2 = $_REQUEST[d2]; $m2 = $_REQUEST[m2]; $usuario = $_REQUEST[usuario]; $down = $_REQUEST[down]; if ($down) { // if ($categoria != "") // $city_sql = " and categoria LIKE '%$categoria%' "; if ($usuario != "") $username_sql = " and user='$usuario' "; $f = ''; if ($_REQUEST[domain] == "www.rumbavenezuela.com") $f .= ''; $f .= ''; sql($_REQUEST[domain]); $sql = 'SELECT * FROM `events_event` WHERE from_date >= \''.$a.'-'.$m.'-'.$d.'\' AND to_date <= \''.$a2.'-'.$m2.'-'.$d2.'\' '.$username_sql.' '.$city_sql.' ORDER BY from_date ASC;'; $sql = @mysql_query($sql); // echo @mysql_error(); while ($row = @mysql_fetch_array($sql)) { //DHP $dhp = 0; $row['aa'] = str_pad(substr($row['datetime_added'],0,4),2,0,STR_PAD_LEFT); $row['ma'] = str_pad(substr($row['datetime_added'],5,2),2,0,STR_PAD_LEFT); $row['da'] = str_pad(substr($row['datetime_added'],8,2),2,0,STR_PAD_LEFT); $dhp = getWorkingDays( ($row['from_date']), substr($row['datetime_added'],0,10) ); $dtp = getDays( ($row['from_date']), substr($row['datetime_added'],0,10) ); $f .= ''; if ($_REQUEST[domain] == "www.rumbavenezuela.com") $f .= ''; $f .= ''; } $f .= '
REPORTE DESDE EL '.$d.' DE '.strtoupper($meses[$m]).' DE '.$a.' HASTA EL '.$d2.' DE '.strtoupper($meses[$m2]).' DE '.$a2.'
CiudadEvento / Fliers Reporteros Fecha Cargada DHP DTP
'.$row['title'].''.$row['title'].' '.$row['user'].' '.$row['from_date'].' '.substr($row['datetime_added'],0,10).' '.$dhp.' '.$dtp.'
'; header( "Content-Type: application/octet-stream"); header( "Content-Disposition: attachment; filename=$d-$m-".$a."_-_$d2-$m2-$a2.xls"); echo($f); exit; } ?>

 
 
Generar Reporte del al  

= '.$a.$m.$d.' AND ((`ano`*10000)+(`mes`*100)+`dia`) <= '.$a2.$m2.$d2.' ORDER BY categoria ASC;'; $rs = @mysql_query($sql); $count = @mysql_num_rows($rs) ?> = \''.$a.'-'.$m.'-'.$d.'\' AND to_date <= \''.$a2.'-'.$m2.'-'.$d2.'\' '.$username_sql.' '.$city_sql.' ORDER BY from_date ASC;'; //$sql = '(SELECT * FROM `events_event` WHERE from_date >= \''.$a.'-'.$m.'-'.$d.'\' AND to_date <= \''.$a2.'-'.$m2.'-'.$d2.'\' '.$username_sql.' '.$city_sql.' ORDER BY from_date ASC) UNION (SELECT * FROM `events_event` WHERE DATE(\''.$a.'-'.$m.'-'.$d.'\') BETWEEN from_date AND to_date ORDER BY from_date ASC)'; $sql = 'SELECT * FROM `events_event` WHERE datetime_added >= \''.$a.'-'.$m.'-'.$d.'\' AND datetime_added <= \''.$a2.'-'.$m2.'-'.$d2.'\' '.$username_sql.' '.$city_sql.' ORDER BY from_date ASC'; $sql = @mysql_query($sql); //echo @mysql_error(); while ($row = @mysql_fetch_array($sql)) { //DHP $teve++; $row['aa'] = str_pad(substr($row['datetime_added'],0,4),2,0,STR_PAD_LEFT); $row['ma'] = str_pad(substr($row['datetime_added'],5,2),2,0,STR_PAD_LEFT); $row['da'] = str_pad(substr($row['datetime_added'],8,2),2,0,STR_PAD_LEFT); $dhp = getWorkingDays( ($row['from_date']), substr($row['datetime_added'],0,10) ); $dtp = getDays( ($row['from_date']), substr($row['datetime_added'],0,10) ); ?>
REPORTE DESDE EL Descargar Reporte"; ?>
* DHP = Días Hábiles de Publicación
* DTP = Días Totales de Publicación
Ciudad Eventos/Fliers   ( ) Usuario Cargada
Total Eventos Cargados:   DHP Aprx. 0 DTP Aprx. 0