# 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" || $s == "www.rumbavenezuela.com") { @mysql_select_db('caracas'); } else if ($s == "www.rumbabogota.com") { @mysql_select_db('bogota'); } if ($s == "www.rumbapanama.com") { @mysql_select_db('panama'); } } $city_sql = ""; $reporter_sql = ""; $category_sql = ""; $a = $_REQUEST[a]; $d = $_REQUEST[d]; $m = $_REQUEST[m]; $a2 = $_REQUEST[a2]; $d2 = $_REQUEST[d2]; $m2 = $_REQUEST[m2]; $reportero = $_REQUEST[reportero]; $domain = $_REQUEST[domain]; $ciudad = $_REQUEST[ciudad]; $down = $_REQUEST[down]; if ($down) { if ($ciudad != "") $city_sql = " and city='$ciudad' "; if ($reportero != "") $reporter_sql = " and author='$reportero' "; if ($domain == "www.rumbavenezuela.com") $category_sql = " AND (city!='' or city!='Caracas') "; else if ($domain == "www.rumbacaracas.com") $category_sql = " AND (city='' or city='Caracas) "; $f = ''; if ($domain == "www.rumbavenezuela.com") $f .= ''; $f .= ''; sql($domain); $sql = 'SELECT * FROM people_photoevent WHERE date >= \''.$a.'-'.$m.'-'.$d.'\' AND date <= \''.$a2.'-'.$m2.'-'.$d2.'\' '.$city_sql.' '.$reporter_sql.' '.$category_sql.' ORDER BY date ASC;'; $sql = @mysql_query($sql); // echo @mysql_error(); while ($row = @mysql_fetch_array($sql)) { //DHP $teve++; $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); if ($row['aa']) { $uhmju = false; $d1 = substr($row['date'],8,2); $m1 = substr($row['date'],5,2); $a1 = substr($row['date'],0,4); while (!$uhmju) { list($d1,$m1,$a1) = explode('.',dia_despues($d1,$m1,$a1)); if (dia_semana($d1,$m1,$a1) != 'Sábado' && dia_semana($d1,$m1,$a1) != 'Domingo') { $dhp++; } if (($d1 == $row['da'] && $m1 == $row['ma'] && $row['aa'] == $a1) || $dhp > 30) { $uhmju = true; } } } //DTP $dtp = 0; if ($row['aa']) { $uhmju = false; $d2 = $row['dia']; $m2 = $row['mes']; $a2 = $row['ano']; while (!$uhmju) { $dtp++; list($d2,$m2,$a2) = explode('.',dia_despues($d2,$m2,$a2)); if (($d2 == $row['da'] && $m2 == $row['ma'] && $a2 == $row['aa']) || $dtp > 30) { $uhmju = true; } } } $f .= ''; if ($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 Reporteros Fecha Cargada DHP DTP
'.$row['city'].''.$row['title'].' '.$row['author'].' '.$row['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 date <= \''.$a2.'-'.$m2.'-'.$d2.'\' AND city!="" ORDER BY city ASC;'; $rs = @mysql_query($sql); $count = @mysql_num_rows($rs) ?> = \''.$a.'-'.$m.'-'.$d.'\' AND date <= \''.$a2.'-'.$m2.'-'.$d2.'\' '.$city_sql.' '.$reporter_sql.' '.$category_sql.' ORDER BY date ASC;'; $sql = @mysql_query($sql); //echo @mysql_error(); while ($row = @mysql_fetch_array($sql)) { /* //DHP $teve++; $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); if ($row['aa']) { $uhmju = false; $d1 = substr($row['date'],8,2); $m1 = substr($row['date'],5,2); $a1 = substr($row['date'],0,4); while (!$uhmju) { list($d1,$m1,$a1) = explode('.',dia_despues($d1,$m1,$a1)); if (dia_semana($d1,$m1,$a1) != 'Sábado' && dia_semana($d1,$m1,$a1) != 'Domingo') { $dhp++; } if (($d1 == $row['da'] && $m1 == $row['ma'] && $row['aa'] == $a1) || $dhp > 30) { $uhmju = true; } } } //DTP $dtp = 0; if ($row['aa']) { $uhmju = false; $d2 = $row['dia']; $m2 = $row['mes']; $a2 = $row['ano']; while (!$uhmju) { $dtp++; list($d2,$m2,$a2) = explode('.',dia_despues($d2,$m2,$a2)); if (($d2 == $row['da'] && $m2 == $row['ma'] && $a2 == $row['aa']) || $dtp > 30) { $uhmju = true; } } } */ $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['date']), substr($row['datetime_added'],0,10) ); $dtp = getDays( ($row['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 Evento   ( ) Reporteros Fecha Cargada DHP DTP
Total Eventos Cargados:   DHP Aprx. 0 DTP Aprx. 0